JDK-8197557 : Javadoc fails with ClassFinder$BadClassFile "undeclared type variable"
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 9,10
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: x86_64
  • Submitted: 2018-02-09
  • Updated: 2018-11-27
  • Resolved: 2018-02-12
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Darwin dphillips-mbp 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64


A DESCRIPTION OF THE PROBLEM :
Javadoc fails for a valid class file that was compiled with javac:

An internal exception has occurred. 
	(com.sun.tools.javac.code.ClassFinder$BadClassFile: bad class file: /Users/dphillips/src/presto/presto-hive/target/presto-hive-0.195-SNAPSHOT.jar(/com/facebook/presto/hive/HiveSplitManager$1.class)
  undeclared type variable: T


REGRESSION.  Last worked in version 8u162

ADDITIONAL REGRESSION INFORMATION: 
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the following:

git clone https://github.com/prestodb/presto
./mvnw clean install -DskipTests -Dair.check.skip-all -P ci -pl presto-hive-hadoop2 -am

Explanation: Javadoc fails for the "presto-hive-hadoop2" module of the Presto project. You can reproduce by cloning the project and building that module and dependencies. The "ci" profile is needed to run Javadoc. Disabling tests and checkers make the build faster (not required).


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exit code: 1 - javadoc: error - An internal exception has occurred. 
	(com.sun.tools.javac.code.ClassFinder$BadClassFile: bad class file: /Users/dphillips/src/presto/presto-hive/target/presto-hive-0.195-SNAPSHOT.jar(/com/facebook/presto/hive/HiveSplitManager$1.class)
  undeclared type variable: T
  Please remove or make sure it appears in the correct subdirectory of the classpath.)
Please file a bug against the javadoc tool via the Java bug reporting page
(http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)
for duplicates. Include error messages and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.ClassFinder$BadClassFile: bad class file: /Users/dphillips/src/presto/presto-hive/target/presto-hive-0.195-SNAPSHOT.jar(/com/facebook/presto/hive/HiveSplitManager$1.class)
  undeclared type variable: T
  Please remove or make sure it appears in the correct subdirectory of the classpath.
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.badClassFile(ClassReader.java:278)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.findTypeVar(ClassReader.java:963)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readEnclosingMethodAttr(ClassReader.java:1451)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$10.read(ClassReader.java:1170)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readAttrs(ClassReader.java:1537)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassAttrs(ClassReader.java:1551)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:2612)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2706)
	at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2719)
	at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:348)
	at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:285)
	at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
	at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1314)
	at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:1248)
	at jdk.compiler/com.sun.tools.javac.code.Symbol$TypeSymbol.getEnclosedElements(Symbol.java:800)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getItems0(Utils.java:2468)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getItems0(Utils.java:2463)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.recursiveGetItems(Utils.java:2451)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils$16.visitPackage(Utils.java:2436)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils$16.visitPackage(Utils.java:2432)
	at jdk.compiler/com.sun.tools.javac.code.Symbol$PackageSymbol.accept(Symbol.java:1166)
	at java.compiler@9.0.4/javax.lang.model.util.AbstractElementVisitor6.visit(AbstractElementVisitor6.java:106)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getItems(Utils.java:2445)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getClasses(Utils.java:2182)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getAllClasses(Utils.java:2355)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:273)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:207)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:117)
	at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:72)
	at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:574)
	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:423)
	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:340)
	at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
	at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)

Command line was: /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/javadoc -J-Xmx1024m @options @packages

Refer to the generated Javadoc files in '/Users/dphillips/src/presto/presto-hive-hadoop2/target/apidocs' dir.


REPRODUCIBILITY :
This bug can be reproduced always.


Comments
This is a duplicate of JDK-8187087 and JDK-8187422
12-02-2018

This issue not reproducible on 8uxx, 8u172 ea b05 - Pass 9 GA - Fail 9.0.4 GA - Fail 10 ea b42 - Fail
12-02-2018

Issue is reproducible on 9.0.4 with below stack trace == 1 error [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] presto-root ........................................ SUCCESS [ 15.017 s] [INFO] presto-spi ......................................... SUCCESS [ 14.911 s] [INFO] presto-plugin-toolkit .............................. SUCCESS [ 4.467 s] [INFO] presto-client ...................................... SUCCESS [ 4.927 s] [INFO] presto-parser ...................................... SUCCESS [ 13.742 s] [INFO] presto-array ....................................... SUCCESS [ 4.137 s] [INFO] presto-matching .................................... SUCCESS [ 3.676 s] [INFO] presto-memory-context .............................. SUCCESS [ 3.873 s] [INFO] presto-tpch ........................................ SUCCESS [ 5.623 s] [INFO] presto-main ........................................ SUCCESS [ 43.583 s] [INFO] presto-resource-group-managers ..................... SUCCESS [ 32.823 s] [INFO] presto-tests ....................................... SUCCESS [ 9.638 s] [INFO] presto-memory ...................................... SUCCESS [ 7.796 s] [INFO] presto-orc ......................................... SUCCESS [01:12 min] [INFO] presto-rcfile ...................................... SUCCESS [ 11.538 s] [INFO] presto-benchmark ................................... SUCCESS [ 8.176 s] [INFO] presto-hive ........................................ SUCCESS [ 22.706 s] [INFO] presto-hive-hadoop2 ................................ FAILURE [ 15.930 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 04:58 min [INFO] Finished at: 2018-02-11T21:46:45-08:00 [INFO] Final Memory: 243M/810M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0:jar (attach-javadocs) on project presto-hive-hadoop2: MavenReportException: Error while generating Javadoc: [ERROR] Exit code: 1 - javadoc: error - An internal exception has occurred. [ERROR] (com.sun.tools.javac.code.ClassFinder$BadClassFile: bad class file: /scratch/fairoz/JI/9052601/presto/presto-hive/target/presto-hive-0.195-SNAPSHOT.jar(/com/facebook/presto/hive/HiveSplitManager$1.class) [ERROR] undeclared type variable: T [ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath.) [ERROR] Please file a bug against the javadoc tool via the Java bug reporting page [ERROR] (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) [ERROR] for duplicates. Include error messages and the following diagnostic in your report. Thank you. [ERROR] com.sun.tools.javac.code.ClassFinder$BadClassFile: bad class file: /scratch/fairoz/JI/9052601/presto/presto-hive/target/presto-hive-0.195-SNAPSHOT.jar(/com/facebook/presto/hive/HiveSplitManager$1.class) [ERROR] undeclared type variable: T [ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath. [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.badClassFile(ClassReader.java:278) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.findTypeVar(ClassReader.java:963) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readEnclosingMethodAttr(ClassReader.java:1451) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$10.read(ClassReader.java:1170) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readAttrs(ClassReader.java:1537) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassAttrs(ClassReader.java:1551) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:2612) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2706) [ERROR] at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2719) [ERROR] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:348) [ERROR] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:285) [ERROR] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633) [ERROR] at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1314) [ERROR] at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:1248) [ERROR] at jdk.compiler/com.sun.tools.javac.code.Symbol$TypeSymbol.getEnclosedElements(Symbol.java:800) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getItems0(Utils.java:2468) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getItems0(Utils.java:2463) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.recursiveGetItems(Utils.java:2451) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils$16.visitPackage(Utils.java:2436) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils$16.visitPackage(Utils.java:2432) [ERROR] at jdk.compiler/com.sun.tools.javac.code.Symbol$PackageSymbol.accept(Symbol.java:1166) [ERROR] at java.compiler@9.0.4/javax.lang.model.util.AbstractElementVisitor6.visit(AbstractElementVisitor6.java:106) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getItems(Utils.java:2445) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getClasses(Utils.java:2182) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getAllClasses(Utils.java:2355) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:273) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:207) [ERROR] at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:117) [ERROR] at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:72) [ERROR] at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:574) [ERROR] at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:423) [ERROR] at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:340) [ERROR] at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63) [ERROR] at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52) [ERROR] [ERROR] Command line was: /scratch/fairoz/JAVA/jdk-9.0.4/bin/javadoc -J-Xmx1024m @options @packages [ERROR] [ERROR] Refer to the generated Javadoc files in '/scratch/fairoz/JI/9052601/presto/presto-hive-hadoop2/target/apidocs' dir. [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :presto-hive-hadoop2
12-02-2018