JDK-4991190 : NullPointerException at ...code.Types$IsSubTypeFcn.isSubType(Types.java:335)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-02-09
  • Updated: 2004-02-10
  • Resolved: 2004-02-10
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 02/09/2004


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

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

A DESCRIPTION OF THE PROBLEM :
I've got a codesample, which when compiled yields the following stack trace:
java.lang.NullPointerException
        at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:335)
        at com.sun.tools.javac.code.Types$IsSubTypeFcn.visitType(Types.java:377)
        at com.sun.tools.javac.code.Type$Visitor.visitTypeVar(Type.java:971)
        at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:813)
        at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:335)
        at com.sun.tools.javac.code.Types.isSubType(Types.java:319)
        at com.sun.tools.javac.comp.Check.checkExtends(Check.java:434)
        at com.sun.tools.javac.comp.Check.access+000(Check.java:37)
        at com.sun.tools.javac.comp.Check$Validator.visitTypeApply(Check.java:766)
        at com.sun.tools.javac.tree.Tree$TypeApply.accept(Tree.java:1063)
        at com.sun.tools.javac.comp.Check.validate(Check.java:701)
        at com.sun.tools.javac.comp.Check.validate(Check.java:711)
        at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2260)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2235)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2188)
        at com.sun.tools.javac.comp.Attr.visitTypeParameter(Attr.java:2155)
        at com.sun.tools.javac.tree.Tree$TypeParameter.accept(Tree.java:1079)
        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:667)
        at com.sun.tools.javac.code.Symbol.complete(Symbol.java:352)
        at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:612)
        at com.sun.tools.javac.comp.Enter.complete(Enter.java:414)
        at com.sun.tools.javac.comp.Enter.main(Enter.java:393)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:382)
        at com.sun.tools.javac.main.Main.compile(Main.java:593)
        at com.sun.tools.javac.main.Main.compile(Main.java:545)
        at com.sun.tools.javac.Main.compile(Main.java:44)
        at com.sun.tools.javac.Main.main(Main.java:35)

if i remove the Codepiece 'BasicGraph &' from file BasicGraph.java, then I get a compiler error and no stack trace any more. (unfortunately I do not understand the error - but this is not the problem, the stacktrace should not happen)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
this is the *.bat file I use to compile and which produces the NullPointerException:

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


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no NullPointerException, at most a compile time error
ACTUAL -
see above

ERROR MESSAGES/STACK TRACES THAT OCCUR :
see above

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
==== File EdgeI.java:
package graphs.common.interfaces;
public interface EdgeI<NodeType extends NodeI> {
}
==== File NodeI.java:
package graphs.common.interfaces;
import java.util.Iterator;
public interface NodeI<EdgeType extends EdgeI, GraphType extends GraphI> {
}
==== 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 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> {
}
==== 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> {
}
==== end
---------- END SOURCE ----------
(Incident Review ID: 237746) 
======================================================================

Comments
PUBLIC COMMENTS ...
10-06-2004