Skip to content

Commit aba6318

Browse files
authored
Configures maven-compiler-plugin for jspecify (#562)
* Configures maven-compiler-plugin for jspecify Fixes gh-561 * Adds exports/open to jvm.config Fixes gh-561 * Moves jspecify behind profile Activate with java25 and jspecify.enabled=true See gh-561 * Updates ant to ignore securitymanager exceptions See gh-561 * Adds JSpecifyMode=true Fixes some javadoc warnings See gh-561
1 parent dc2f1d9 commit aba6318

File tree

2 files changed

+67
-15
lines changed

2 files changed

+67
-15
lines changed

.mvn/jvm.config

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom
1+
-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom
2+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
3+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
4+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
5+
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
6+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
7+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
8+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
9+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
10+
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
11+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

pom.xml

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
<revision>${project.version}</revision>
4242
<asciidoctorj.version>2.5.13</asciidoctorj.version>
4343
<jruby-complete.version>9.4.9.0</jruby-complete.version>
44+
<error-prone.version>2.42.0</error-prone.version>
45+
<nullaway.version>0.12.10</nullaway.version>
4446

4547
<!-- Sonar -->
4648
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
@@ -917,36 +919,76 @@
917919
</build>
918920
</profile>
919921
<profile>
920-
<id>java8</id>
922+
<id>java17</id>
921923
<activation>
922-
<jdk>[1.8,)</jdk>
924+
<jdk>[17,)</jdk>
923925
</activation>
924926
<build>
925927
<plugins>
926928
<plugin>
927929
<artifactId>maven-javadoc-plugin</artifactId>
928930
<configuration>
929-
<additionalparam>-Xdoclint:none</additionalparam>
931+
<doclint>none</doclint>
930932
</configuration>
931933
</plugin>
932934
</plugins>
933935
</build>
934936
</profile>
935937
<profile>
936-
<id>java11</id>
938+
<id>jspecify</id>
937939
<activation>
938-
<jdk>[1.11,)</jdk>
940+
<jdk>[25,)</jdk>
941+
<property>
942+
<name>jspecify.enabled</name>
943+
<value>true</value>
944+
</property>
939945
</activation>
940946
<build>
941-
<plugins>
942-
<plugin>
943-
<artifactId>maven-javadoc-plugin</artifactId>
944-
<configuration>
945-
<!-- https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8212233 -->
946-
<source>8</source>
947-
</configuration>
948-
</plugin>
949-
</plugins>
947+
<pluginManagement>
948+
<plugins>
949+
<plugin>
950+
<groupId>org.apache.maven.plugins</groupId>
951+
<artifactId>maven-compiler-plugin</artifactId>
952+
<version>${maven-compiler-plugin.version}</version>
953+
<configuration>
954+
<source>${maven.compiler.source}</source>
955+
<target>${maven.compiler.target}</target>
956+
<release>${java.version}</release>
957+
<compilerArgs>
958+
<compilerArg>-parameters</compilerArg>
959+
<!-- https://errorprone.info/docs/installation#maven -->
960+
<compilerArg>-XDcompilePolicy=simple</compilerArg>
961+
<compilerArg>--should-stop=ifError=FLOW</compilerArg>
962+
<compilerArg>
963+
-Xplugin:ErrorProne
964+
<!-- JSpecify mode https://github.com/uber/NullAway/wiki/JSpecify-Support -->
965+
-XepOpt:NullAway:JSpecifyMode=true
966+
<!-- Check JSpecify annotations -->
967+
-Xep:NullAway:ERROR
968+
-XepOpt:NullAway:OnlyNullMarked
969+
<!-- FIXME Remove once https://github.com/uber/NullAway/pull/1295 is released -->
970+
-XepOpt:NullAway:CustomContractAnnotations=org.springframework.lang.Contract
971+
-XepOpt:NullAway:SuppressionNameAliases=DataFlowIssue
972+
<!-- https://github.com/uber/NullAway/issues/162 -->
973+
-XepExcludedPaths:.*/src/test/java/.*
974+
</compilerArg>
975+
</compilerArgs>
976+
<annotationProcessorPaths>
977+
<path>
978+
<groupId>com.google.errorprone</groupId>
979+
<artifactId>error_prone_core</artifactId>
980+
<version>${error-prone.version}</version>
981+
</path>
982+
<path>
983+
<groupId>com.uber.nullaway</groupId>
984+
<artifactId>nullaway</artifactId>
985+
<version>${nullaway.version}</version>
986+
</path>
987+
</annotationProcessorPaths>
988+
</configuration>
989+
</plugin>
990+
</plugins>
991+
</pluginManagement>
950992
</build>
951993
</profile>
952994
<profile>

0 commit comments

Comments
 (0)