Skip to content

Commit

Permalink
Fix JDK 21 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Oct 21, 2023
1 parent 404e44d commit 8f8f858
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,26 @@ public static void compileWithDocumentationGenerator(

public static void compileWithDocumentationGenerator(
String outputDirectory, String path, String... lines) {
/*
* The compiler options specified here largely match those used by Error Prone's
* `CompilationTestHelper`. A key difference is the stricter linting configuration. When
* compiling using JDK 21+, these lint options also require that certain JDK modules are
* explicitly exported.
*/
compile(
ImmutableList.of(
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"-encoding",
"UTF-8",
"-parameters",
"-proc:none",
"-Werror",
"-Xlint:all,-processing,-serial",
"-Xplugin:DocumentationGenerator -XoutputDirectory=" + outputDirectory),
"-Xlint:all,-serial",
"-Xplugin:DocumentationGenerator -XoutputDirectory=" + outputDirectory,
"-XDdev",
"-XDcompilePolicy=simple"),
FileObjects.forSourceLines(path, lines));
}

Expand Down

0 comments on commit 8f8f858

Please sign in to comment.