JDK-8056984 : Exception in compiler: java.lang.AssertionError: isSubClass T
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u20
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2014-08-28
  • Updated: 2024-03-12
  • Resolved: 2014-09-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 8 JDK 9
8u40Fixed 9 b31Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux io.tomosw.bruker.de 3.7.10-1.40-desktop #1 SMP PREEMPT Thu Jul 10 11:22:12 UTC 2014 (9b06319) x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
Assertion in javac while compiling classes which compiled fine using jdk8u5

REGRESSION.  Last worked in version 8u5

ADDITIONAL REGRESSION INFORMATION: 
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the three files A.java, B.java and C.java

javac A.java B.java C.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The files are compiled without errors.
ACTUAL -
A java.lang.AssertionError is thrown in the compiler

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.8.0_20). 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.AssertionError: isSubClass T
	at com.sun.tools.javac.code.Symbol.isSubClass(Symbol.java:447)
	at com.sun.tools.javac.code.Symbol.isMemberOf(Symbol.java:456)
	at com.sun.tools.javac.code.Symbol$MethodSymbol.overrides(Symbol.java:1469)
	at com.sun.tools.javac.code.Types$ImplementationCache.implementationInternal(Types.java:2671)
	at com.sun.tools.javac.code.Types$ImplementationCache.get(Types.java:2653)
	at com.sun.tools.javac.code.Types.implementation(Types.java:2682)
	at com.sun.tools.javac.code.Symbol$MethodSymbol.implementation(Symbol.java:1529)
	at com.sun.tools.javac.code.Symbol$MethodSymbol.implementation(Symbol.java:1518)
	at com.sun.tools.javac.comp.Resolve.notOverriddenIn(Resolve.java:416)
	at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:402)
	at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:362)
	at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1448)
	at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1618)
	at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1710)
	at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1662)
	at com.sun.tools.javac.comp.DeferredAttr$DeferredChecker$2.lookup(DeferredAttr.java:1325)
	at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3325)
	at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3310)
	at com.sun.tools.javac.comp.DeferredAttr$DeferredChecker.quicklyResolveMethod(DeferredAttr.java:1333)
	at com.sun.tools.javac.comp.DeferredAttr$DeferredChecker.visitApply(DeferredAttr.java:1223)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.DeferredAttr$FilterScanner.scan(DeferredAttr.java:901)
	at com.sun.tools.javac.comp.DeferredAttr.isDeferred(DeferredAttr.java:1088)
	at com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:701)
	at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1834)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
	at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:656)
	at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1611)
	at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
	at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:692)
	at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1142)
	at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
	at com.sun.tools.javac.comp.Attr.visitForeachLoop(Attr.java:1207)
	at com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1035)
	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
	at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:692)
	at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1142)
	at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
	at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1035)
	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:607)
	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:676)
	at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4342)
	at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4252)
	at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4181)
	at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4156)
	at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
	at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
	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)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
A.java
======

import java.util.*;

public class A<T extends B & C<T>> extends B {
    private final List<T> tList;
    public A(List<T> tList) {
        this.tList = new LinkedList<>();
        for (T t : tList) {
            // If the following two lines are used instead of the third line
            // this class compiles with jdk8u20 as well
            // final T tClone = t.clone("");
            // this.tList.add(tClone);
            this.tList.add(t.clone(""));
        }
    }

    public T clone(String s) {
        return null;
    }
}


B.java
======

public abstract class B {
    protected B() {
    }
}


C.java
======

public interface C<T> {
    public T clone(String s);
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I added a comment in A.java how the source can be modified to make it compile with 8u20 as well.


Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/d7e615e0115c User: lana Date: 2014-09-17 17:25:51 +0000
17-09-2014

We encountered this same bug when we moved to 1.8.0_20 for the JDeveloper sources. The work-around to pull the expression out of the method call into a local worked for us as well.Unfortunately, the code base that caused the Javac assert is too complex to easily create a small sample. Hope you fix this soon.
11-09-2014

URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/d7e615e0115c User: jlahoda Date: 2014-09-08 08:52:31 +0000
08-09-2014

This bug seems to come from the analysis that determines as to whether we need slow deferred attribution for the chained call or not.
01-09-2014