JDK-8133449 : "An exception has occurred in the compiler" using generics
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u51,8u60
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: other
  • CPU: x86
  • Submitted: 2015-08-11
  • Updated: 2015-08-12
  • Resolved: 2015-08-12
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
OS X 10.9.5

A DESCRIPTION OF THE PROBLEM :
"An exception has occurred in the compiler (1.8.0_51)"

Please see "Actual Result" for full error message and "Source code for an executable test case" for full source code

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Program compiles
ACTUAL -
dynip-02:JavaError helen$ javac javaError.java 
An exception has occurred in the compiler (1.8.0_51). 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:1388)
	at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1046)
	at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574)
	at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1037)
	at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:973)
	at com.sun.tools.javac.code.Symbol$ClassSymbol.getKind(Symbol.java:1101)
	at com.sun.tools.javac.code.Kinds.kindName(Kinds.java:162)
	at com.sun.tools.javac.comp.Check.duplicateError(Check.java:329)
	at com.sun.tools.javac.comp.Check.checkUnique(Check.java:3435)
	at com.sun.tools.javac.comp.Enter.visitTypeParameter(Enter.java:454)
	at com.sun.tools.javac.tree.JCTree$JCTypeParameter.accept(JCTree.java:2224)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
	at com.sun.tools.javac.comp.Enter.visitClassDef(Enter.java:418)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
	at com.sun.tools.javac.comp.Enter.visitClassDef(Enter.java:426)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
	at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:334)
	at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:518)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:258)
	at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:272)
	at com.sun.tools.javac.comp.Enter.complete(Enter.java:486)
	at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
	at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857)
	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)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class JavaError
{
static abstract class Function<X, X, X> {}

public static void main(final String[] args)
    {    
        JavaError demo = new JavaError();
    }

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Changed code to 
static abstract class Function<X, Y, Z> {}


Comments
Closing this as duplicate of JDK-8133312
12-08-2015

Checked this for JDK 8u51, 8u60 ea b26 and 9 ea b76. The attached test case fails to compile with JDK 8u51 and 8u60 ea b26, however this compiled with errors in JDk 9 ea b76. Output with JDK 8u51: > javac JavaError.java An exception has occurred in the compiler (1.8.0_51). 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:1388) at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1046) at com.sun.tools.javac.code.Symbol.complete(Symbol.java:574) at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1037) at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:973) at com.sun.tools.javac.code.Symbol$ClassSymbol.getKind(Symbol.java:1101) at com.sun.tools.javac.code.Kinds.kindName(Kinds.java:162) at com.sun.tools.javac.comp.Check.duplicateError(Check.java:329)
12-08-2015