Oops, AIOOBE ?

Vicente Romero vicente.romero at oracle.com
Mon Oct 8 17:02:17 UTC 2018


Hi Remi,

I have pushed a fix [1] that removes arguments from scope in concise 
methods with the `=` form. This will effectively forbid cases like the 
one you found a bug for. Arguments will still be in scope in the `->` form.

Thanks,
Vicente

[1] http://hg.openjdk.java.net/amber/amber/rev/32f06d86416e

On 10/05/2018 06:46 PM, Remi Forax wrote:
> Hi Vicente,
> another bug :)
>
> import java.util.HashMap;
> import java.util.function.Function;
>
> public class Visitor<R> {
>    private final HashMap<Class<?>, Function<Object, R>> map = new HashMap<>();
>    
>    public void call(Object o) = map.get(o.getClass())::apply;
> }
>
>
> An exception has occurred in the compiler (12-amber). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
> java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 16
> 	at jdk.compiler/com.sun.tools.javac.jvm.Code$State.pop(Code.java:1764)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Code.emitop0(Code.java:862)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Items$Item.coerce(Items.java:256)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Items$Item.coerce(Items.java:269)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:814)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitTypeCast(Gen.java:2007)
> 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTypeCast.accept(JCTree.java:2098)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:812)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1590)
> 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1524)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:590)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:625)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:611)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:662)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1026)
> 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1033)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:590)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:625)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:896)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:859)
> 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:879)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:590)
> 	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2196)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:756)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1635)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1603)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
> 	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
> 	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
> 	at jdk.compiler/com.sun.tools.javac.main.JavacToolProvider.run(JavacToolProvider.java:46)
> 	at java.base/java.util.spi.ToolProvider.run(ToolProvider.java:137)
>
>
> regards,
> Rémi



More information about the amber-dev mailing list