Bug 143718

Summary: [1.6][compiler] ClassFormatError : wrong stack map frame is used
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, martinae, Mike_Wilson, steven.wasleski
Version: 3.2   
Target Milestone: 3.2 RC7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Regression test none

Description Olivier Thomann CLA 2006-05-25 10:20:59 EDT
Using latest, there is a case where the stack map frame type APPEND is used instead of a FULL FRAME type.
I will attach a test case.
Comment 1 Olivier Thomann CLA 2006-05-25 10:23:08 EDT
public class X {
	String s;
	
	X() {
        int i = 0;
        if (s == null) {
        	System.out.print("PASSED");
        } else {
        	System.out.print("FAILED");
        }
       	System.out.print("DONE" + i);
	}
    
    public static void main(String argv[]) {
    	new X();
    }
}

If this code is compiled in 1.6 mode, it compiles fine, but it failed at runtime with a class format error.
Comment 2 Olivier Thomann CLA 2006-05-25 10:23:52 EDT
Created attachment 42574 [details]
Proposed fix
Comment 3 Olivier Thomann CLA 2006-05-25 10:26:10 EDT
Created attachment 42575 [details]
Regression test
Comment 4 Olivier Thomann CLA 2006-05-25 10:27:27 EDT
I am surprised that this is not a verify error. The "format" of the .class file is fine. The error is a wrong type of frame. I believe a verify error would be more appropriate.
Comment 5 Philipe Mulet CLA 2006-05-29 06:28:24 EDT
Fix looks good. Proposing for RC7, as it is needed for 1.6 compliance testing (as reported by Steven Wasleski).

Steven - can you confirm that the proposed patch makes us pass ?
Comment 6 Philipe Mulet CLA 2006-05-29 12:29:36 EDT
The fix is trivial, and is mandated for true 1.6 compliance

Martin - pls cast your vote
Comment 7 Philipe Mulet CLA 2006-05-29 12:30:08 EDT
Dani - pls cast your vote
Comment 8 Philipe Mulet CLA 2006-05-29 12:30:29 EDT
Mike - pls cast your vote
Comment 9 Philipe Mulet CLA 2006-05-29 12:31:25 EDT
+1 for 3.2RC7
Comment 10 Mike Wilson CLA 2006-05-29 12:43:47 EDT
+1
Comment 11 Martin Aeschlimann CLA 2006-05-30 04:14:48 EDT
+1
Comment 12 Dani Megert CLA 2006-05-30 04:44:13 EDT
+1
Comment 13 Olivier Thomann CLA 2006-05-30 10:46:10 EDT
Fixed and released in HEAD.
Regression test added in org.eclipse.jdt.core.tests.compiler.regression.StackMapAttributeTest.test008
Comment 14 Olivier Thomann CLA 2006-05-30 10:46:43 EDT
In order to verify this, you should use a recent 1.6 drop (b84 can reproduce the original failure).
Comment 15 Olivier Thomann CLA 2006-06-02 15:44:42 EDT
Verified with I20060602-1317 for RC7.