Community
Participate
Working Groups
When compiling for Java 7, AspectJ can compute an invalid StackMapTable. The verifier will throw a ClassNotFoundException when the generated class is loaded. Example: class Parent<T> {} class ChildA<T> extends Parent<T> {} class ChildB<T> extends Parent<T> {} public Object methodWithBadStackMapTable(boolean value) { return value ? new ChildA<String>() : new ChildB<String>(); } javap shows the computed StackMapTable to be: StackMapTable: number_of_entries = 2 frame_type = 15 /* same */ frame_type = 71 /* same_locals_1_stack_item */ stack = [ class "Parent<T>" ] when it should be: StackMapTable: number_of_entries = 2 frame_type = 15 /* same */ frame_type = 71 /* same_locals_1_stack_item */ stack = [ class Parent ]
Created attachment 223544 [details] maven project reproducing the issue
Created attachment 223545 [details] patch to org.aspectj.weaver.bcel.asm.StackMapAdder
thanks for the testcase and nice little fix! Committed locally, it'll be on the public repo when I can finally get a decent connection to git.eclipse.org.
all pushed to the public repo.