Skip to content

Derive test expectations from the JDK feature version - #518

Open
slachiewicz wants to merge 1 commit into
agent/errorprone-2.50from
agent/jdk27-tests
Open

slachiewicz wants to merge 1 commit into
agent/errorprone-2.50from
agent/jdk27-tests

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

The javac and eclipse compiler tests decided their expected errors, warnings, output files and -source/-target by checking java.version for the substrings 11, 17, 21 and 25. Any other JDK fell through to the Java 1.3 defaults or to expecting ReservedWord.class, so the suite failed on JDK 26 and 27 with four failures across plexus-compiler-javac and plexus-compiler-eclipse. This adds getJavaFeatureVersion() to AbstractCompilerTest, which works on Java 8, and rewrites those checks as numeric comparisons. The errorprone test uses the same helper.

Behaviour on JDK 11, 17, 21 and 25 is unchanged. On JDK 9 and 10 the EclipseCompilerErrorsAsWarningsTest now expects three output files like its two sibling tests, since assert has been a keyword since Java 1.4.

Stacked on #517.

Verified: full mvn verify with -Dversion.maven-invoker-plugin=3.10.2-SNAPSHOT → green on JDK 27 and on JDK 26, including all 12 ITs. Not run on JDK 21 or 25 locally.

This change was created with AI assistance.

@slachiewicz slachiewicz added the maintenance Cleanup, refactoring or other internal change label Sep 15, 2026
The javac and eclipse compiler tests listed the JDKs they knew (11, 17,
21, 25) by substring, so any other JDK fell back to Java 1.3 source
settings or to expecting ReservedWord.class, and the suite failed on
JDK 26 and 27. A shared getJavaFeatureVersion() replaces the lists.
@slachiewicz
slachiewicz marked this pull request as ready for review September 15, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Cleanup, refactoring or other internal change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant