Community
Participate
Working Groups
The following code doesn't pass verifier because the method String get(int) of the anonymous class because eclipse compiler generate as last byte-code a ireturn and not a areturn. program : package fr.umlv.tatoo.test; import java.util.AbstractList; import java.util.List; public class BogusVerifier { private static class Entry { public void doIt(final List<? extends String> args) { List<String> list=new AbstractList<String>() { @Override public int size() { return 0; } @Override public String get(int i) { return args.get(i); } }; } } } javap output: public java.lang.String get(int); Code: 0: aload_0 1: getfield #15; //Field val$args:Ljava/util/List; 4: iload_1 5: invokeinterface #31, 2; //InterfaceMethod java/util/List.get:(I)Ljava/lang/Object; 10: checkcast #33; //class java/lang/String 13: ireturn // <-------------- OUPS Rémi Forax
Also bridge method Object get(...) has an unoptimal 'checkcast: Object'. // Method descriptor #29 (I)Ljava/lang/Object; // Stack: 2, Locals: 2 public bridge synthetic Object get(int arg); 0 aload_0 1 iload_1 2 invokevirtual X$1.get(int) : String [37] 5 checkcast Object [39] 8 areturn
VerifyError comes from miscomputation of implicit conversion in presence of wildcard capture type. Fixed by using its erasure. Added GenericTypeTest#test779-780.
Verified in 3.2 M1 with build I20050808-2000.
Verified using M20050923-1430 for 3.1.1