Oops, AIOOBE ?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Oct 5 23:00:40 UTC 2018


I see this has also been discussed in the spec-experts mailing list:

http://mail.openjdk.java.net/pipermail/amber-spec-experts/2018-October/000798.html

In his response to Kevin, Brian seems to end up in the same place I did 
- this code should be rejected.

Maurizio


On 05/10/18 23:55, Maurizio Cimadamore wrote:
> Should 'o' even be in scope in the receiver expression of the method 
> reference body?
>
> Maurizio
>
>
> On 05/10/18 23:46, 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