JDK-4856983 : (crash) mutually f-bounded type vars with multiple bounds may crash javac
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-05-01
  • Updated: 2012-10-09
  • Resolved: 2004-09-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0u1 01Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description

Name: rmT116609			Date: 05/01/2003


FULL PRODUCT VERSION :
I'm using the early access generics compiler with JDK 1.4.1.

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)

FULL OS VERSION :
Windows XP Home

A DESCRIPTION OF THE PROBLEM :
The generics compiler crashes with a program that looks quite innocent to me.


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.NullPointerException
	at com.sun.tools.javac.v8.code.Type.isSubType(Type.java:428)
	at com.sun.tools.javac.v8.comp.Check.checkExtends(Check.java:319)
	at com.sun.tools.javac.v8.comp.Check$Validator.visitTypeApply(Check.java:562)
	at com.sun.tools.javac.v8.tree.Tree$TypeApply.accept(Tree.java:975)
	at com.sun.tools.javac.v8.comp.Check.validate(Check.java:516)
	at com.sun.tools.javac.v8.comp.Check.validate(Check.java:526)
	at com.sun.tools.javac.v8.comp.Check$Validator.visitTypeParameter(Check.java:570)
	at com.sun.tools.javac.v8.tree.Tree$TypeParameter.accept(Tree.java:1001)
	at com.sun.tools.javac.v8.comp.Check.validate(Check.java:516)
	at com.sun.tools.javac.v8.comp.Check.validateTypeParams(Check.java:534)
	at com.sun.tools.javac.v8.comp.Attr.attribClassBody(Attr.java:1978)
	at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1964)
	at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1928)
	at com.sun.tools.javac.v8.comp.Attr.visitClassDef(Attr.java:336)
	at com.sun.tools.javac.v8.tree.Tree$ClassDef.accept(Tree.java:388)
	at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:212)
	at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:246)
	at com.sun.tools.javac.v8.comp.Attr.attribClassBody(Attr.java:2019)
	at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1964)
	at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1951)
	at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1947)
	at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1928)
	at com.sun.tools.javac.v8.comp.Attr.visitTypeParameter(Attr.java:1905)
	at com.sun.tools.javac.v8.tree.Tree$TypeParameter.accept(Tree.java:1001)
	at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:212)
	at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:246)
	at com.sun.tools.javac.v8.comp.Attr.attribStats(Attr.java:262)
	at com.sun.tools.javac.v8.comp.Enter$CompleteEnter.complete(Enter.java:1028)
	at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:321)
	at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:623)
	at com.sun.tools.javac.v8.comp.Enter.complete(Enter.java:656)
	at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:635)
	at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:311)
	at com.sun.tools.javac.v8.Main.compile(Main.java:484)
	at com.sun.tools.javac.Main.compile(Main.java:33)
	at com.sun.tools.javac.Main.main(Main.java:24)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package genericstest;

public class OuterClass {
	
	static interface I<T> {}
	static class X<T> {}
	static class A<U extends X<V> & I<V>, V extends I<U>> {}
}

---------- END SOURCE ----------
(Review ID: 182443) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.5.0_01 mustang FIXED IN: 1.5.0_01 INTEGRATED IN: 1.5.0_01
27-09-2004

EVALUATION Crashes are evil. ###@###.### 2003-05-01 This problem appears to have been introduced between the 1.0 and the 1.2 prototypes. ###@###.### 2003-08-13 It would be worthwhile to investigate why earlier versions of the compiler do NOT crash on this program. Perhaps some relatively recent change introduced this problem. ###@###.### 2003-09-29 The problem is related to the order in which the declarations occur. This program crashes the compiler: class C<X extends Number & Comparable<Y>, Y> {} Whereas this doesn't: class C<Y, X extends Number & Comparable<Y>> {} We should fix this asap and try to include it in a tiger update. ###@###.### 2004-09-07
07-09-2004

WORK AROUND Declare any type variables with multiple bounds last, in the submitter's example, change: static class A<U extends X<V> & I<V>, V extends I<U>> {} static class A<V extends I<U>, U extends X<V> & I<V>> {} ###@###.### 2004-09-07
07-09-2004

PUBLIC COMMENTS Multiple bounds does not mix well with F-bounded type variables, the compiler crash on this small example: class C<X extends Number & Comparable<Y>, Y> {} but not: class C<Y, X extends Number & Comparable<Y>> {} ###@###.### 2004-09-07
07-09-2004