-
Bug
-
Resolution: Fixed
-
P3
-
8u192, 11.0.1, 12, 13
-
b19
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8228940 | 12u-cpu | Jan Lahoda | P3 | Resolved | Fixed | master |
JDK-8223577 | 12.0.2 | Jan Lahoda | P3 | Resolved | Fixed | b03 |
JDK-8235203 | 11.0.7-oracle | Jan Lahoda | P3 | Resolved | Fixed | b02 |
JDK-8223578 | 11.0.4 | Jan Lahoda | P3 | Resolved | Fixed | b03 |
JDK-8224146 | openjdk8u222 | Steve Groeger | P3 | Resolved | Fixed | b03 |
Background: an Annotation Processor class can be packaged in a jar file and is identified by a special text file inside the jar named: META-INF/services/javax.annotation.processing.Processor. This text file has only one line, specifying the class name of the annotation process class to run. When javac runs, it checks all jars on the classpath and if it finds the special text file in any jar file, then it attempts to run the class listed there.
The issue here is that when the annotation processor class can't be executed, javac catches the exception and exits without reporting on the reason for the exit. Examples of reasons why the annotation processor can't be executed include:
* the annotation processor class is compiled for a higher version of Java than the javac is running, giving UnsupportedClassVersionError.
* the annotation processor class file is corrupt so can't be loaded.
In either of the above cases javac will swallow the error and exit without telling the user why it failed to compile the java source code as expected.
Testcase
put HelloWorld.java in current directory, edit <path_to_jar> and run:
javac -cp .:<path_to_jar>/bad.annotation.processor.jar HelloWorld.java
Instead of producing HelloWorld.class as expected, javac exits silently.
Here, bad.annotation.processor.jar is a file that was created to contain:
META-INF/services/javax.annotation.processing.Processor <<-- text file to list bad class
bad/notaclass.class <<-- dummy file, can't be loaded as a java class
This fails on jdk8u as well as jdk11-jdk13
- backported by
-
JDK-8223577 [javac] fails and exits with no error if a bad annotation processor provided
- Resolved
-
JDK-8223578 [javac] fails and exits with no error if a bad annotation processor provided
- Resolved
-
JDK-8224146 [javac] fails and exits with no error if a bad annotation processor provided
- Resolved
-
JDK-8228940 [javac] fails and exits with no error if a bad annotation processor provided
- Resolved
-
JDK-8235203 [javac] fails and exits with no error if a bad annotation processor provided
- Resolved
- duplicates
-
JDK-8130493 javac silently ignores malformed annotation processor class
- Closed
- relates to
-
JDK-8130493 javac silently ignores malformed annotation processor class
- Closed