javac generates unverifiable initializer for nested subclass of local class.
Jeremy Manson
jeremymanson at google.com
Wed Jul 31 23:36:52 PDT 2013
Hi folks,
I mentioned to a couple of people on the list that we have a some
unreported bugs. In an effort to be better about reporting them, I'll
mention this oldie but goodie that dates back to JDK 6 update 4.
(I have to verify that each of them is still a bug, so this might be a
trickle rather than a flood)
public class TestTest {
public static void main(final String args[]) {
class NamedLocal {
Object m() {
return args;
}
class NamedLocalSub extends NamedLocal {}
}
new NamedLocal().new NamedLocalSub();
}
}
With JDK8 b84:
$ javac TestTest.java
$ java TestTest
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
TestTest$1NamedLocal$NamedLocalSub.<init>(LTestTest$1NamedLocal;)V @7:
getfield
Reason:
Type uninitializedThis (current frame, stack[1]) is not assignable to
'TestTest$1NamedLocal$NamedLocalSub'
Current Frame:
bci: @7
flags: { flagThisUninit }
locals: { uninitializedThis, 'TestTest$1NamedLocal' }
stack: { uninitializedThis, uninitializedThis }
Bytecode:
0000000: 2a2b b500 012a 2ab4 0002 b700 03b1
at TestTest.main(TestTest.java:10)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20130731/de87e0d8/attachment.html
More information about the compiler-dev
mailing list