|
Quick Lists
|
|
Bug ID:
|
4898618
|
|
Votes
|
1
|
|
Synopsis
|
extended 'for' with generic collections causes the compiler to crash
|
|
Category
|
java:compiler
|
|
Reported Against
|
tiger
, 1.4.2_01
|
|
Release Fixed
|
1.5(tiger-b24)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4933768
,
4937353
|
|
Submit Date
|
30-JUL-2003
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
with adding_generics-2_2-ea
FULL OS VERSION :
Linux wolf.cl.cam.ac.uk 2.4.19-3cl #1 SMP Mon Nov 4 12:20:37 GMT 2002 i686 athlon i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
the following program causes the compiler to crash (this may be similar to bug 4881292 but the code show there compiles correctly with generics v2.2)
the result is
A
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the attached code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the compiler doesn't crash
ACTUAL -
the compiler does crash
ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.4.1_01). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: xClassName
at com.sun.tools.javac.jvm.ClassWriter.xClassName(ClassWriter.java:384)
at com.sun.tools.javac.jvm.ClassWriter.writePool(ClassWriter.java:473)
at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1002)
at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:883)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:316)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:455)
at com.sun.tools.javac.main.Main.compile(Main.java:520)
at com.sun.tools.javac.Main.compile(Main.java:41)
at com.sun.tools.javac.Main.main(Main.java:32)
make: *** [Fuzzy.class] Error 4
Compilation exited abnormally with code 2 at Wed Jul 30 17:24:03
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
class Fuzzy<T> {
void main(String [] strings) {
HashSet<T> buffer = new HashSet<T> ();
for(T item : buffer)
;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
expand 'for' manually. The following code works
import java.util.*;
class Fuzzy<T> {
void main(String [] strings) {
HashSet<T> buffer = new HashSet<T> ();
Iterator<T> iter = buffer.iterator();
while(iter.hasNext()) {
T item = iter.next();
}
}
}
(Incident Review ID: 193170)
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
Since "Lower" is after "TransTypes", it should not generate generic types
in its rewritings.
xxxxx@xxxxx 2003-07-30
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |