Bug 260031

Summary: Wrong type for class constants in stackmap frames
Product: [Eclipse Project] JDT Reporter: ulf.brosziewski
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, david_audel, jarthana, philippe_mulet
Version: 3.4.1   
Target Milestone: 3.5 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Proposed fix + regression test none

Description ulf.brosziewski CLA 2009-01-06 04:30:16 EST
To reproduce the bug, compile the following class (compliance level 1.6) and
run its main method with
   java -XX:-FailOverToOldVerifier StackMapBug

public class StackMapBug {
   
   private static void dummy(Class<?> c, int n) { }

   public static void main(String... args) {
      dummy(Integer.class, (args == null ? -1 : 1));
   }
}

The JVM (JDK 1.6.0_10, Win32) exits with
Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames
at branch target 10 in method StackMapBug.main([Ljava/lang/String;)V at offset 3

In the two stackmap frames for the main method, the type of the first stack
item is specified as java/lang/Integer (instead of java/lang/Class). Here is
a part of the javap output for the example class:

  StackMapTable: number_of_entries = 2
   frame_type = 74 /* same_locals_1_stack_item */
     stack = [ class java/lang/Integer ]
   frame_type = 255 /* full_frame */
     offset_delta = 0
     locals = [ class "[Ljava/lang/String;" ]
     stack = [ class java/lang/Integer, int ]
Comment 1 Anthony Hunter CLA 2009-02-12 19:34:09 EST
This does not belong in the tools cross-project component.

Is this an Eclipse JDT issue?

Resolving as NOT_ECLIPSE, Ulf will need to reopen on the right spot.
Comment 2 ulf.brosziewski CLA 2009-02-13 03:16:59 EST
I'm sorry about that error. It *is* a JDT issue.
Comment 3 Olivier Thomann CLA 2009-04-27 10:43:48 EDT
Created attachment 133366 [details]
Proposed fix
Comment 4 Olivier Thomann CLA 2009-04-27 10:44:17 EDT
Trivial fix. I'll add a regression test for it.
Comment 5 Olivier Thomann CLA 2009-04-27 10:51:29 EDT
Created attachment 133367 [details]
Proposed fix + regression test

Same patch with corresponding regression test.
Comment 6 Olivier Thomann CLA 2009-04-27 16:31:44 EDT
Released for 3.5M7.
Regression test added in org.eclipse.jdt.core.tests.compiler.regression.StackMapAttributeTest#test042
Comment 7 Jay Arthanareeswaran CLA 2009-04-29 05:52:14 EDT
Verified for 3.5M7 using build I20090428-0100