Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-67960] Work around MCOMPILER-346 #511

Merged
merged 1 commit into from
Mar 5, 2022

Conversation

basil
Copy link
Member

@basil basil commented Mar 5, 2022

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 a NullPointerException. If you encounter it with -source 11, you get an AssertionError. 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 11 for 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 strange NullPointerExceptions or AssertionErrors when their code does not compile rather than a comprehensible error message explaining the source of the compilation error.

Testing done

See jenkinsci/pom#235.

@basil basil added the bug label Mar 5, 2022
@basil basil merged commit 61a34d0 into jenkinsci:master Mar 5, 2022
@basil basil deleted the JENKINS-67960 branch March 5, 2022 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants