[jdk8u-dev] RFR: 8151255: javac with a annotation processor returns incorrect error code
yangsummer
duke at openjdk.org
Wed Jan 31 10:08:06 UTC 2024
On Fri, 26 Jan 2024 03:53:10 GMT, yangsummer <duke at openjdk.org> wrote:
> Hi,
>
> When I was building my application using Maven 3.6.3, I had two applications A and B that had a dependency relationship. B relied on A's jar. When I built both A and B simultaneously, A built successfully. Although B threw an exception, Javac believed that B had built successfully. I unpacked B's jar package and found that there was no class file inside. So I searched for the reason based on the exception information, and found that Javac was divided into multiple rounds when processing annotations. If an abort occurred in a certain round, Javac would not be able to find the delegate compiler. If Javac's own errors were 0 at this time, it would consider compilation successful, but te specific error information was reported to the global diagnosticCollector by the delegate compiler, So even though Maven printed an error, it didn't stop working due to the error, but instead continued to package and ultimately printed an incorrect package.
I have looked at the code of jdk23 and found that the delegated compiler is no longer used when processing annotations, and when an abort occurs, the exception should be reported directly to the global diagnosticCollector, so this problem of mine no longer exists. Moreover, the code difference is relatively large and it is difficult to backport it to Java8.
I have looked at the code of jdk23 and found that the delegated compiler is no longer used when processing annotations, and when an abort occurs, the exception should be reported directly to the global diagnosticCollector, so this problem of mine no longer exists. Moreover, the code difference is relatively large and it is difficult to backport it to Java8.
-------------
PR Comment: https://git.openjdk.org/jdk8u-dev/pull/432#issuecomment-1918781661
PR Comment: https://git.openjdk.org/jdk8u-dev/pull/432#issuecomment-1918782283
More information about the jdk8u-dev
mailing list