Bug 58461 - [1.5] java.lang.VerifyError from enhanced for loop
Summary: [1.5] java.lang.VerifyError from enhanced for loop
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-14 08:20 EDT by Changshin Lee CLA
Modified: 2005-01-11 11:02 EST (History)
0 users

See Also:


Attachments

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