Bug 58461

Summary: [1.5] java.lang.VerifyError from enhanced for loop
Product: [Eclipse Project] JDT Reporter: Changshin Lee <iasandcb>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Changshin Lee CLA 2004-04-14 08:20:34 EDT
Here's a simple example for enhanced loop.

public class Test {
	public static void main(String[] args) {
		for (String arg : args) {
			System.out.println(arg);		
		}
	}
}

This works fine. However, here's another example.

public class Test2 {
	public static void main(String[] args) {
		List list = new ArrayList();
		for (String arg : args) {
			System.out.println(arg);		
			list.add(arg);
		}
		for (Object arg: list) {
			System.out.println(arg);
		}
	}
}

This results in

Exception in thread "main" java.lang.VerifyError: (class: Test2, method: main
signature: ([Ljava/lang/String;)V) Illegal type in constant pool

My testing platform is

Eclipse3.0-I20040407 featuring Cheetah02 + Tiger beta1 (JDK 1.5.0 b32c).

Thanks,

Ias
Comment 1 Olivier Thomann CLA 2004-04-14 09:03:37 EDT
I will investigate this one.
Comment 2 Olivier Thomann CLA 2004-04-14 09:34:48 EDT
Fixed and released in 1.5 stream.
Regression test added.
Thanks for your report.