JDK-8052070 : javac crashes when there are duplicated type parameters
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8,9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-07-25
  • Updated: 2018-03-06
  • Resolved: 2015-01-20
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 9
9 b48Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
Consider the following code:
---
public class Main<A, A, T> {
}
---

Compiling it with:
$ javac -fullversion
javac full version "1.8.0-b132"                                                                                                                                                                                                  

Leads to:
An exception has occurred in the compiler (1.8.0). 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.MemberEnter.baseEnv(MemberEnter.java:1385)
        at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1046)
        at com.sun.tools.javac.code.Symbol.complete(Symbol.java:560)
        at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1024)
        at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:960)
        at com.sun.tools.javac.code.Symbol$ClassSymbol.getKind(Symbol.java:1088)
        at com.sun.tools.javac.code.Kinds.kindName(Kinds.java:162)
        at com.sun.tools.javac.comp.Check.duplicateError(Check.java:327)
        at com.sun.tools.javac.comp.Check.checkUnique(Check.java:3370)
        at com.sun.tools.javac.comp.Enter.visitTypeParameter(Enter.java:458)
        at com.sun.tools.javac.tree.JCTree$JCTypeParameter.accept(JCTree.java:2218)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:262)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:276)
        at com.sun.tools.javac.comp.Enter.visitClassDef(Enter.java:422)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:687)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:262)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:276)
        at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:338)
        at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:518)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:262)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:276)
        at com.sun.tools.javac.comp.Enter.complete(Enter.java:490)
        at com.sun.tools.javac.comp.Enter.main(Enter.java:475)
        at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:985)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
        at com.sun.tools.javac.main.Main.compile(Main.java:523)
        at com.sun.tools.javac.main.Main.compile(Main.java:381)
        at com.sun.tools.javac.main.Main.compile(Main.java:370)
        at com.sun.tools.javac.main.Main.compile(Main.java:361)
        at com.sun.tools.javac.Main.compile(Main.java:56)
        at com.sun.tools.javac.Main.main(Main.java:42)

Comments
There are two problems here: 1. The initial completer installed by scan of the package for classes in both source and binary form lingers on longer than it should. There is a region of code where the class symbol is carrying an incorrect completer that points to ClassFinder.thisCompleter while it should not. This problem does not manifest itself in the test case provided in this bug but manifests itself when a fix is attempted. 2. typeEnter as a completer for a type is installed slightly prematurely - it should be installed after high level artifacts are scanned/processed (type parameters for example)
04-01-2015

Jan, may I take over this one ? I have a fix under test and perhaps you can review the patch ? Thanks.
04-01-2015