JDK-6292765 : java.lang.NullPointerException at Check.checkCompatibleConcretes
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0,6,6u21
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,windows_xp,windows_vista
  • CPU: x86
  • Submitted: 2005-06-30
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
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.
JDK 7
7 b03Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Windows XP

A DESCRIPTION OF THE PROBLEM :
The following simple code causes a
java.lang.NullPointerException at Check.checkCompatibleConcretes:

class A<T> {}

class B<S> extends A< C<Object> > {}

class C<S> extends B<S> {}

// Note: The bug may be related to the bug with internal review ID: 478380


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just try to compile the following code:

class A<T> {}

class B<S> extends A< C<Object> > {}

class C<S> extends B<S> {}


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Successful compilation
ACTUAL -
java.lang.NullPointerException at Check.checkCompatibleConcretes

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.5.0_04). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  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.comp.Check.checkCompatibleConcretes(Check.java:1141)
        at com.sun.tools.javac.comp.Check.checkCompatibleSupertypes(Check.java:1495)
        at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2451)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2406)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2355)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:444)
        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:67)
        at com.sun.tools.javac.Main.main(Main.java:52)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class A<T> {}

class B<S> extends A< C<Object> > {}

class C<S> extends B<S> {}

---------- END SOURCE ----------
###@###.### 2005-06-30 09:26:06 GMT

Comments
SUGGESTED FIX Webrev of changes: http://sa.sfbay/projects/langtools/bugid_summary.pl?bugid=6292765 See also attached file 6292765.tar.gz.
03-10-2006

SUGGESTED FIX Index: j2se/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java --- /tmp/geta5618 2006-10-02 17:14:19.000000000 -0700 +++ MemberEnter.java 2006-10-02 16:34:42.000000000 -0700 @@ -939,10 +939,6 @@ } } - // Check that a generic class doesn't extend Throwable - if (!ct.allparams().isEmpty() && types.isSubtype(supertype, syms.throwableType)) - log.error(tree.extending.pos, "generic.throwable"); - // check that no package exists with same fully qualified name, // but admit classes in the unnamed package which have the same // name as a top-level package. Index: j2se/src/share/classes/com/sun/tools/javac/comp/Attr.java --- /tmp/geta5600 2006-10-02 17:12:56.000000000 -0700 +++ Attr.java 2006-10-02 16:46:30.000000000 -0700 @@ -2679,6 +2679,10 @@ assert env.info.scope.lookup(l.head.name).scope != null; } + // Check that a generic class doesn't extend Throwable + if (!c.type.allparams().isEmpty() && types.isSubtype(c.type, syms.throwableType)) + log.error(tree.extending.pos(), "generic.throwable"); + // Check that all methods which implement some // method conform to the method they implement. chk.checkImplementations(tree);
03-10-2006

EVALUATION An SDN user pointed out that the fix for 6218229 didn't fix this problem. This is probably very similar to 6404691 but the test case in this example is simpler which should help in tracking down the root cause.
20-06-2006