mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
204 lines
11 KiB
Diff
204 lines
11 KiB
Diff
diff --git a/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java b/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java
|
|
index a248dd8..4e7f053 100644
|
|
--- a/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java
|
|
+++ b/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java
|
|
@@ -188,6 +188,7 @@ public class MetricsServlet extends HttpServlet {
|
|
return mapper.writer();
|
|
}
|
|
|
|
+ @SuppressWarnings("IdentityConversion")
|
|
protected TimeUnit parseTimeUnit(String value, TimeUnit defaultValue) {
|
|
try {
|
|
return TimeUnit.valueOf(String.valueOf(value).toUpperCase(Locale.US));
|
|
diff --git a/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java b/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java
|
|
index 0bd1297..7c69a08 100644
|
|
--- a/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java
|
|
+++ b/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java
|
|
@@ -189,6 +189,7 @@ public class MetricsServlet extends HttpServlet {
|
|
return mapper.writer();
|
|
}
|
|
|
|
+ @SuppressWarnings("IdentityConversion")
|
|
protected TimeUnit parseTimeUnit(String value, TimeUnit defaultValue) {
|
|
try {
|
|
return TimeUnit.valueOf(String.valueOf(value).toUpperCase(Locale.US));
|
|
diff --git a/pom.xml b/pom.xml
|
|
index 6192b52..8c312b6 100644
|
|
--- a/pom.xml
|
|
+++ b/pom.xml
|
|
@@ -68,7 +68,8 @@
|
|
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
|
|
<errorprone.version>2.19.1</errorprone.version>
|
|
<errorprone.javac.version>9+181-r4173-1</errorprone.javac.version>
|
|
-
|
|
+ <error-prone-support.flags>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode ${error-prone.configuration-args}</error-prone-support.flags>
|
|
+ <java.version>8</java.version>
|
|
<sonar.projectKey>dropwizard_metrics</sonar.projectKey>
|
|
<sonar.organization>dropwizard</sonar.organization>
|
|
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
|
@@ -166,10 +167,9 @@
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-compiler-plugin</artifactId>
|
|
<configuration>
|
|
- <compilerArgs>
|
|
+ <compilerArgs combine.children="append">
|
|
<arg>-Xlint:all</arg>
|
|
<arg>-XDcompilePolicy=simple</arg>
|
|
- <arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-sources/.*</arg>
|
|
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
|
|
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
|
|
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
|
|
@@ -181,18 +181,129 @@
|
|
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
|
|
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
|
|
</compilerArgs>
|
|
- <annotationProcessorPaths>
|
|
- <path>
|
|
- <groupId>com.google.errorprone</groupId>
|
|
- <artifactId>error_prone_core</artifactId>
|
|
- <version>${errorprone.version}</version>
|
|
- </path>
|
|
- </annotationProcessorPaths>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
+ <profile>
|
|
+ <id>error-prone-compile</id>
|
|
+ <build>
|
|
+ <plugins>
|
|
+ <plugin>
|
|
+ <groupId>org.apache.maven.plugins</groupId>
|
|
+ <artifactId>maven-compiler-plugin</artifactId>
|
|
+ <version>${maven-compiler-plugin.version}</version>
|
|
+ <executions>
|
|
+ <!-- Skip the `default-compile` execution as we don't want to execute the compile goal twice -->
|
|
+ <execution>
|
|
+ <id>default-compile</id>
|
|
+ <phase>compile</phase>
|
|
+ <goals>
|
|
+ <goal>compile</goal>
|
|
+ </goals>
|
|
+ <configuration>
|
|
+ <skipMain>true</skipMain>
|
|
+ </configuration>
|
|
+ </execution>
|
|
+ <execution>
|
|
+ <id>error-prone-compile</id>
|
|
+ <phase>compile</phase>
|
|
+ <goals>
|
|
+ <goal>compile</goal>
|
|
+ </goals>
|
|
+ <configuration>
|
|
+ <failOnError>true</failOnError>
|
|
+ <source>${java.version}</source>
|
|
+ <target>${java.version}</target>
|
|
+ <compilerArgs combine.children="append">
|
|
+ <arg>-Xpkginfo:always</arg>
|
|
+ <arg>-XDcompilePolicy=simple</arg>
|
|
+ <arg>${error-prone-support.flags}</arg>
|
|
+ </compilerArgs>
|
|
+ <annotationProcessorPaths combine.children="append">
|
|
+ <path>
|
|
+ <groupId>com.google.errorprone</groupId>
|
|
+ <artifactId>error_prone_core</artifactId>
|
|
+ <version>${error-prone.version}</version>
|
|
+ </path>
|
|
+ <path>
|
|
+ <groupId>tech.picnic.error-prone-support</groupId>
|
|
+ <artifactId>error-prone-contrib</artifactId>
|
|
+ <version>${error-prone-support.version}</version>
|
|
+ </path>
|
|
+ <path>
|
|
+ <groupId>tech.picnic.error-prone-support</groupId>
|
|
+ <artifactId>refaster-runner</artifactId>
|
|
+ <version>${error-prone-support.version}</version>
|
|
+ </path>
|
|
+ </annotationProcessorPaths>
|
|
+ </configuration>
|
|
+ </execution>
|
|
+ </executions>
|
|
+ </plugin>
|
|
+ </plugins>
|
|
+ </build>
|
|
+ </profile>
|
|
+ <profile>
|
|
+ <id>error-prone-test-compile</id>
|
|
+ <build>
|
|
+ <plugins>
|
|
+ <plugin>
|
|
+ <groupId>org.apache.maven.plugins</groupId>
|
|
+ <artifactId>maven-compiler-plugin</artifactId>
|
|
+ <version>${maven-compiler-plugin.version}</version>
|
|
+ <executions>
|
|
+ <!-- Skip the `default-testCompile` execution as we don't want to execute the compile goal twice -->
|
|
+ <execution>
|
|
+ <id>default-testCompile</id>
|
|
+ <phase>test-compile</phase>
|
|
+ <goals>
|
|
+ <goal>testCompile</goal>
|
|
+ </goals>
|
|
+ <configuration>
|
|
+ <skip>true</skip>
|
|
+ </configuration>
|
|
+ </execution>
|
|
+ <execution>
|
|
+ <id>error-prone-test-compile</id>
|
|
+ <phase>test-compile</phase>
|
|
+ <goals>
|
|
+ <goal>testCompile</goal>
|
|
+ </goals>
|
|
+ <configuration>
|
|
+ <failOnError>true</failOnError>
|
|
+ <source>${java.version}</source>
|
|
+ <target>${java.version}</target>
|
|
+ <compilerArgs combine.children="append">
|
|
+ <arg>-Xpkginfo:always</arg>
|
|
+ <arg>-XDcompilePolicy=simple</arg>
|
|
+ <arg>${error-prone-support.flags}</arg>
|
|
+ </compilerArgs>
|
|
+ <annotationProcessorPaths combine.children="append">
|
|
+ <path>
|
|
+ <groupId>com.google.errorprone</groupId>
|
|
+ <artifactId>error_prone_core</artifactId>
|
|
+ <version>${error-prone.version}</version>
|
|
+ </path>
|
|
+ <path>
|
|
+ <groupId>tech.picnic.error-prone-support</groupId>
|
|
+ <artifactId>error-prone-contrib</artifactId>
|
|
+ <version>${error-prone-support.version}</version>
|
|
+ </path>
|
|
+ <path>
|
|
+ <groupId>tech.picnic.error-prone-support</groupId>
|
|
+ <artifactId>refaster-runner</artifactId>
|
|
+ <version>${error-prone-support.version}</version>
|
|
+ </path>
|
|
+ </annotationProcessorPaths>
|
|
+ </configuration>
|
|
+ </execution>
|
|
+ </executions>
|
|
+ </plugin>
|
|
+ </plugins>
|
|
+ </build>
|
|
+ </profile>
|
|
<profile>
|
|
<id>release-sign-artifacts</id>
|
|
<activation>
|
|
@@ -323,15 +434,7 @@
|
|
<compilerArgs>
|
|
<arg>-Xlint:all</arg>
|
|
<arg>-XDcompilePolicy=simple</arg>
|
|
- <arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-sources/.*</arg>
|
|
</compilerArgs>
|
|
- <annotationProcessorPaths>
|
|
- <path>
|
|
- <groupId>com.google.errorprone</groupId>
|
|
- <artifactId>error_prone_core</artifactId>
|
|
- <version>${errorprone.version}</version>
|
|
- </path>
|
|
- </annotationProcessorPaths>
|
|
</configuration>
|
|
</plugin>
|
|
<plugin>
|