[JENKINS-67960] Work around MCOMPILER-346#235
Merged
basil merged 1 commit intojenkinsci:masterfrom Mar 5, 2022
basil:JENKINS-67960
Merged
[JENKINS-67960] Work around MCOMPILER-346#235basil merged 1 commit intojenkinsci:masterfrom basil:JENKINS-67960
basil merged 1 commit intojenkinsci:masterfrom
basil:JENKINS-67960
Conversation
timja
approved these changes
Mar 5, 2022
olamy
approved these changes
Mar 5, 2022
MarkEWaite
approved these changes
Mar 5, 2022
Member
|
for reference the root cause is a jdk bug https://bugs.openjdk.java.net/browse/JDK-8210649 |
Member
|
few other workaround until next m-compiler-p release.
I will try to release m-compiler-p really soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
See JENKINS-67960 and MCOMPILER-346. I have run into this bug repeatedly while working on Jenkins, most recently in jenkinsci/acceptance-test-harness#733.
Problem
When compiling Jenkins code with compilation errors with Java 11, MCOMPILER-346 is frequently encountered. If you encounter it with
-source 8, you get aNullPointerException. If you encounter it with-source 11, you get anAssertionError. Either way, you do not get a readable message with the compilation error. Therefore, you have no idea what you need to fix in order to get the code to compile.Solution
TBD. MCOMPILER-346 has remained open since June 28, 2018. I submitted a Minimal Reproducible Example (MRE) hoping that this will help the Maven developers resolve the issue.
Workaround
In the past, I have worked around this issue by switching back to Java 8. This works with
-source 8, but it does not work with-source 11for obvious reasons. Therefore, a new workaround is needed. I have just discovered a new workaround: running Maven with-Dmaven.compiler.forceJavacCompilerUse=true. Until MCOMPILER-346 is fixed, we should enable this workaround by default for all Jenkins builds. Otherwise, people compiling with Java 11 will get strangeNullPointerExceptions orAssertionErrors when their code does not compile rather than a comprehensible error message explaining the source of the compilation error.Testing done
Reproduced the failure from jenkinsci/acceptance-test-harness#733 locally. Then upgraded the POM to the one from this PR and could no longer reproduce the issue. Instead, I got a comprehensible error message.