Bug 260031 - Wrong type for class constants in stackmap frames
Summary: Wrong type for class constants in stackmap frames
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-06 04:30 EST by ulf.brosziewski CLA
Modified: 2009-04-29 05:52 EDT (History)
4 users (show)

See Also:


Attachments
Proposed fix (1.84 KB, patch)
2009-04-27 10:43 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression test (4.29 KB, patch)
2009-04-27 10:51 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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