Remove deprecated setCompilerVersion() call - #1088
Conversation
CompilerConfiguration.setCompilerVersion() is deprecated and no longer evaluated by the underlying compilers. The compilerVersion field is already @deprecated; remove the no-op call to eliminate the deprecation warning while keeping the field for backward compatibility.
There was a problem hiding this comment.
Pull request overview
This PR removes a deprecated, no-op call to CompilerConfiguration.setCompilerVersion() from AbstractCompilerMojo.executeReal(), eliminating a deprecation warning while keeping the deprecated compilerVersion parameter for backward compatibility with existing user configurations.
Changes:
- Removed the
compilerConfiguration.setCompilerVersion(compilerVersion);call during compiler configuration setup. - Kept the deprecated
compilerVersionMaven parameter intact so users still receive a deprecation warning (without breaking builds).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ascheman
left a comment
There was a problem hiding this comment.
Thanks for chasing down these deprecation no-ops. The code change itself is correct: CompilerConfiguration.setCompilerVersion() is a deprecated no-op (plexus-compiler no longer evaluates it — a forked javac's version is auto-detected via <executable>), and this was the only place in src/main that read the compilerVersion parameter. So the removal is behavior-preserving, and keeping the @Deprecated field for backward compatibility is the right call.
One thing to address before this goes in — because this PR is what makes it wrong:
With this call gone, compilerVersion is now fully inert (nothing reads it), yet the docs still present it as a working feature. In src/site/markdown/examples/compile-using-different-jdk.md.vm:
The
compilerVersionparameter can be used to specify the version of the compiler that the plugin will use. However, you also need to setforktotruefor this to work.<fork>true</fork> <executable><!-- path-to-javac --></executable> <compilerVersion>1.3</compilerVersion>
After this PR that <compilerVersion>1.3</compilerVersion> line does nothing. The <fork> + <executable> mechanism still selects the JDK and is fine to keep — it's just the <compilerVersion> element (and the sentence describing it) that's now dead. Could you drop those from the example in this same PR, so we don't finish deprecating the parameter while the docs still advertise it? Happy to approve once that's in.
CompilerConfiguration.setCompilerVersion()is deprecated and no longer evaluated by the underlying compilers. ThecompilerVersionfield inAbstractCompilerMojois already@Deprecatedwith this Javadoc:This removes the no-op call to eliminate the deprecation warning while keeping the
@Deprecatedfield for backward compatibility — users who still setmaven.compiler.compilerVersionwill get a deprecation warning but not a build error."