Hi everyone,
I was looking through the JSR-223 code in org.armedbear.lisp.scripting as I noticed that AbclScriptEngineFactory is not fully compliant to JSR-223 [1] (p. 101-102 in the Final Draft Specification, v1.0).
For the methods:
- java.util.List<java.lang.String> getExtensions() - java.util.List<java.lang.String> getMimeTypes() - java.util.List<java.lang.String> getNames()
_immutable_ Lists should be returned.
Please find a remedying patch below.
Cheerz, Clemens
[1] http://jcp.org/en/jsr/detail?id=223
----
Index: AbclScriptEngineFactory.java =================================================================== --- AbclScriptEngineFactory.java (revision 12157) +++ AbclScriptEngineFactory.java (working copy) @@ -21,6 +21,7 @@ package org.armedbear.lisp.scripting;
import java.util.ArrayList; +import java.util.Collections; import java.util.List;
import javax.script.ScriptEngine; @@ -44,7 +45,7 @@ public List<String> getExtensions() { List<String> extensions = new ArrayList<String>(1); extensions.add("lisp"); - return extensions; + return Collections.unmodifiableList(extensions); }
@Override @@ -89,7 +90,7 @@
@Override public List<String> getMimeTypes() { - return new ArrayList<String>(); + return Collections.unmodifiableList(new ArrayList<String>()); }
@Override @@ -99,7 +100,7 @@ names.add("cl"); names.add("Lisp"); names.add("Common Lisp"); - return names; + return Collections.unmodifiableList(names); }
@Override --
# Trust in code: # lynx http://lxr.linux.no/linux+v2.6.23.14/arch/i386/kernel/cpu/common.c#L677
On Sun, Sep 20, 2009 at 2:50 PM, Clemens Blamauer clemens.blamauer@gmail.com wrote:
Hi everyone,
I was looking through the JSR-223 code in org.armedbear.lisp.scripting as I noticed that AbclScriptEngineFactory is not fully compliant to JSR-223 [1] (p. 101-102 in the Final Draft Specification, v1.0).
For the methods:
- java.util.List<java.lang.String> getExtensions()
- java.util.List<java.lang.String> getMimeTypes()
- java.util.List<java.lang.String> getNames()
_immutable_ Lists should be returned.
Please find a remedying patch below.
Thank you, I patched the class and committed to trunk.
Bye, Alessio
armedbear-devel@common-lisp.net