JDK-5097944 : Compiler-crash: NullPointerException at ...Types.capture(Types.java:2671)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-09-07
  • Updated: 2004-09-07
  • Resolved: 2004-09-07
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 09/07/2004


FULL PRODUCT VERSION :
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
compiler crashes at com.sun.tools.javac.code.Types.capture(Types.java:2671)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
------------- BEGIN SOURCES
------------- File NodeI.java:
package graphs.common.interfaces;
import java.util.Iterator;
public interface NodeI<EdgeType extends EdgeI, GraphType extends GraphI> {
}
------------- File EdgeI.java:
package graphs.common.interfaces;
public interface EdgeI<NodeType extends NodeI> {
}
------------- File GraphI.java:
package graphs.common.interfaces;
public interface GraphI <
	GraphType extends GraphI<GraphType, EdgeType, NodeType>,
	EdgeType extends EdgeI < NodeType >,
	NodeType extends NodeI < EdgeType , GraphType >> {
}
------------- File BasicNode.java:
package graphs.common.implAddList;
import graphs.common.interfaces.NodeI;
import graphs.common.interfaces.EdgeI;
import graphs.common.interfaces.GraphI;
import java.util.Iterator;
import java.util.Collection;
public class BasicNode<EdgeType extends EdgeI, GraphType extends GraphI>
implements NodeI<EdgeType, GraphType> {
}
------------- File BasicGraph.java:
package graphs.common.implAddList;
import graphs.common.interfaces.GraphI;
import graphs.common.interfaces.NodeI;
import graphs.common.interfaces.EdgeI;
public class BasicGraph  <
	GraphType extends BasicGraph & GraphI<GraphType, EdgeType, NodeType>,
	EdgeType extends EdgeI < NodeType >,
	NodeType extends NodeI < EdgeType, GraphType >>
implements GraphI<GraphType, EdgeType, NodeType> {
}
------------- File BasicEdge.java:
package graphs.common.implAddList;
import graphs.common.interfaces.EdgeI;
import graphs.common.interfaces.NodeI;
public class BasicEdge<NodeType extends NodeI> implements EdgeI<NodeType> {
}
------------- END SOURCES
Compile with:

set JAVA_HOME=C:\Programme\jdk1.5.0
set JAVA_COMPILE=%JAVA_HOME%\bin\javac -source 1.5 -target 1.5 -sourcepath src -d bin -Xlint:unchecked
%JAVA_HOME%\bin\java -version
%JAVA_COMPILE% src\graphs\common\interfaces\GraphI.java
%JAVA_COMPILE% src\graphs\common\implAddList\BasicGraph.java
pause


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no crash
ACTUAL -
C:\Daten\arbeit5\v4_jdk15repro>set JAVA_HOME=C:\Programme\jdk1.5.0

C:\Daten\arbeit5\v4_jdk15repro>set JAVA_COMPILE=C:\Programme\jdk1.5.0\bin\javac
-source 1.5 -target 1.5 -sourcepath src -d bin -Xlint:unchecked

C:\Daten\arbeit5\v4_jdk15repro>C:\Programme\jdk1.5.0\bin\java -version
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)

C:\Daten\arbeit5\v4_jdk15repro>C:\Programme\jdk1.5.0\bin\javac -source 1.5 -targ
et 1.5 -sourcepath src -d bin -Xlint:unchecked src\graphs\common\interfaces\Grap
hI.java

C:\Daten\arbeit5\v4_jdk15repro>C:\Programme\jdk1.5.0\bin\javac -source 1.5 -targ
et 1.5 -sourcepath src -d bin -Xlint:unchecked src\graphs\common\implAddList\Bas
icGraph.java
src\graphs\common\implAddList\BasicGraph.java:6: type parameter GraphType is not
 within its bound
        GraphType extends BasicGraph & GraphI<GraphType, EdgeType, NodeType>,
                                              ^
java.lang.NullPointerException
        at com.sun.tools.javac.code.Types.capture(Types.java:2671)
        at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:338)

        at com.sun.tools.javac.code.Types$IsSubTypeFcn.visitType(Types.java:384)

        at com.sun.tools.javac.code.Type$Visitor.visitTypeVar(Type.java:958)
        at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:790)
        at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:344)

        at com.sun.tools.javac.code.Types.isSubType(Types.java:327)
        at com.sun.tools.javac.comp.Check.checkExtends(Check.java:412)
        at com.sun.tools.javac.comp.Check.access$100(Check.java:37)
        at com.sun.tools.javac.comp.Check$Validator.visitTypeApply(Check.java:78
1)
        at com.sun.tools.javac.tree.Tree$TypeApply.accept(Tree.java:1064)
        at com.sun.tools.javac.comp.Check.validate(Check.java:716)
        at com.sun.tools.javac.comp.Check.validate(Check.java:726)
        at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2382)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2357)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2306)
        at com.sun.tools.javac.comp.Attr.visitTypeParameter(Attr.java:2268)
        at com.sun.tools.javac.tree.Tree$TypeParameter.accept(Tree.java:1080)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
        at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:307)
        at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:845)
        at com.sun.tools.javac.code.Symbol.complete(Symbol.java:355)
        at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:614)

        at com.sun.tools.javac.comp.Enter.complete(Enter.java:448)
        at com.sun.tools.javac.comp.Enter.main(Enter.java:426)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:382)
        at com.sun.tools.javac.main.Main.compile(Main.java:592)
        at com.sun.tools.javac.main.Main.compile(Main.java:544)
        at com.sun.tools.javac.Main.compile(Main.java:58)
        at com.sun.tools.javac.Main.main(Main.java:48)

C:\Daten\arbeit5\v4_jdk15repro>pause

ERROR MESSAGES/STACK TRACES THAT OCCUR :
see Actual Result

REPRODUCIBILITY :
This bug can be reproduced always.

(Incident Review ID: 301887) 
======================================================================