[MCOMPILER-569] Document implicitly compiled excluded sources - #1092
[MCOMPILER-569] Document implicitly compiled excluded sources#1092wilx wants to merge 2 commits into
Conversation
Clarify that excluded sources may still be compiled implicitly and link the compile and testCompile exclusion parameters to the implicit option. Fixes apache#778
|
|
||
| /** | ||
| * A list of exclusion filters for the compiler. | ||
| * A file such as {@code module-info.java} may still be compiled if it is implicitly referenced by the compiler, |
There was a problem hiding this comment.
I don't understand what "implicitly referenced by the compiler" means.
There was a problem hiding this comment.
This is described in https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#searching-for-module-package-and-type-declarations. The relevant lines are
When compiling code for a module, the compiler also needs to have available the declaration of that module.
A successful search may produce a class file, a source file, or both. If both are found, then you can use the -Xprefer option to instruct the compiler which to use.
If a search finds and uses a source file, then by default javac compiles that source file. This behavior can be altered with -implicit.
Feel free to suggest better wording.
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Documents that excludes/testExcludes only affect the plugin’s explicit source filtering, and that javac may still compile excluded files when it discovers them implicitly (e.g., module-info.java), pointing users at the implicit setting.
Changes:
- Clarify
excludesJavadoc to mention implicit compilation byjavac - Clarify
testExcludesJavadoc similarly - Add a reference to
AbstractCompilerMojo#implicitfrom both parameters
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java | Adds Javadoc clarifying that excluded sources can still be compiled implicitly and references implicit. |
| src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java | Mirrors the same clarification for test compilation excludes and references implicit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * A file such as {@code module-info.java} may still be compiled if it is implicitly referenced by the compiler, | ||
| * even if it has been excluded. | ||
| * | ||
| * @see AbstractCompilerMojo#implicit |
| * A file such as {@code module-info.java} may still be compiled if it is implicitly referenced by the compiler, | ||
| * even if it has been excluded. | ||
| * | ||
| * @see AbstractCompilerMojo#implicit |
Explain that exclusions only affect sources passed explicitly by the plugin and that javac can still discover sources through the source path.
|
I have pushed a change with different wording. |
Clarify the
compileandtestCompileexclusion parameter documentation: an excluded source such asmodule-info.javamay still be compiled whenjavacfinds it implicitly. Link both parameters to<implicit>, which can be set tononeto suppress class generation for implicitly referenced sources.This documents the distinction between the plugin's explicit source filtering and
javac's implicit source discovery.Fixes #778
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MCOMPILER-XXX] - Fixes bug in ApproximateQuantiles,where you replace
MCOMPILER-XXXwith the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean verifyto make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
mvn -Prun-its clean verify).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.