dc20b7561a
* Adds `@SuppressWarnings("NarrowingCompoundAssignment")` * Adds `@SuppressWarnings("TypeParameterUnusedInFormals")` * Adds `@SuppressWarnings("JavaUtilDate")` * Adds a limit to `String.split()` * Add `error_prone_annotations` to the `pom.xml` * Adds `@InlineMe(...)` to deprecated methods * Adds `@SuppressWarnings("ImmutableEnumChecker")` * Adds `@SuppressWarnings("ModifiedButNotUsed")` * Adds `@SuppressWarnings("MixedMutabilityReturnType")` * Removes an unused import * Adds `requires` to `module-info.java` * Adds ErrorProne `link` into `pom.xml` * Remove unused imports Removed from: - ParseBenchmark * Adds `@SuppressWarnings("EqualsGetClass")` * Excludes from `proto` just the generated code. Replaces `.*proto.*` with `.*/generated-test-sources/protobuf/.*` in such way will be excluded just the generated code and not the whole `proto` directory * Removes an unused variable Removes the `descriptor` variable because is unused. * Fixes the `BadImport` warn into `ProtosWithAnnotationsTest` * Fixes the `BadImport` warns into `ProtosWithAnnotationsTest` * Enables ErrorProne in `gson/src/test.*` Removes the `gson/src/test.*` path from the `-XepExcludedPaths` parameter of the ErrorProne plugin * Fixes `UnusedVariable` warns This commit fix all `UnusedVariable` warns given by ErrorProne in the `gson/src/test.*` path. Some field is annotated with `@Keep` that means is used by reflection. In some other case the record is annotated with `@SuppressWarnings("unused")` * Fixes `JavaUtilDate` warns This commit fix all `JavaUtilDate` warns given by ErrorProne in the `gson/src/test.*` path. Classes/Methods are annotated with `@SuppressWarnings("JavaUtilDate")` because it's not possible use differente Date API. * Fixes `EqualsGetClass` warns This commit fix all `EqualsGetClass` warns given by ErrorProne in the `gson/src/test.*` path. I have rewrite the `equals()` methods to use `instanceof` * Replaces pattern matching for instanceof with casts * Fixes `JdkObsolete` warns This commit fix all `JdkObsolete` warns given by ErrorProne in the `gson/src/test.*` path. In some cases I have replaced the obsolete JDK classes with the newest alternatives. In other cases, I have added the `@SuppressWarnings("JdkObsolete")` * Fixes `ClassCanBeStatic` warns This commit fix all `ClassCanBeStatic` warns given by ErrorProne in the `gson/src/test.*` path. I have added the `static` keyword, or I have added `@SuppressWarnings("ClassCanBeStatic")` * Fixes `UndefinedEquals` warns This commit fix all `UndefinedEquals` warns given by ErrorProne in the `gson/src/test.*` path. I have added `@SuppressWarnings("UndefinedEquals")` or fixed the asserts Note: In this commit I have also renamed a test from `testRawCollectionDeserializationNotAlllowed` to `testRawCollectionDeserializationNotAllowed` * Fixes `GetClassOnEnum` warns This commit fix all `GetClassOnEnum` warns given by ErrorProne in the `gson/src/test.*` path. I have replaced the `.getClass()` with `.getDeclaringClass()` * Fixes `ImmutableEnumChecker` warns This commit fix all `ImmutableEnumChecker` warns given by ErrorProne in the `gson/src/test.*` path. I have added the `final` keyword, or I have added the `@SuppressWarnings("ImmutableEnumChecker")` annotation * Fixes `StaticAssignmentOfThrowable` warns This commit fix all `StaticAssignmentOfThrowable` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `AssertionFailureIgnored` warns This commit fix all `AssertionFailureIgnored` warns given by ErrorProne in the `gson/src/test.*` path. I have added the `@SuppressWarnings("AssertionFailureIgnored")` annotation * Fixes `ModifiedButNotUsed` warns This commit fix all `ModifiedButNotUsed` warns given by ErrorProne in the `gson/src/test.*` path. I have added the `@SuppressWarnings("ModifiedButNotUsed")` annotation * Fixes `MissingSummary` warns This commit fix all `MissingSummary` warns given by ErrorProne in the `gson/src/test.*` path. I have remove the Javadoc `@author` * Fixes `FloatingPointLiteralPrecision` warns This commit fix all `FloatingPointLiteralPrecision` warns given by ErrorProne in the `gson/src/test.*` path. I have added the `@SuppressWarnings("FloatingPointLiteralPrecision")` annotation * Fixes `StringSplitter` warns This commit fix all `StringSplitter` warns given by ErrorProne in the `gson/src/test.*` path. I have replaced the `String.split(...)` with `Splitter` * Fixes `EmptyCatch` warns This commit fix all `EmptyCatch` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `UnicodeEscape` warns This commit fix all `UnicodeEscape` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `EmptyBlockTag` warns This commit fix all `EmptyBlockTag` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `LongFloatConversion` warns This commit fix all `LongFloatConversion` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `LongDoubleConversion` warns This commit fix all `LongDoubleConversion` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `TruthAssertExpected` warns This commit fix all `TruthAssertExpected` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `UnusedMethod` warns This commit fix all `UnusedMethod` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `UnusedTypeParameter` warns This commit fix all `UnusedTypeParameter` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `CatchFail` warns This commit fix all `CatchFail` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `MathAbsoluteNegative` warns This commit fix all `MathAbsoluteNegative` warns given by ErrorProne in the `gson/src/test.*` path. * Fixes `LoopOverCharArray` warns This commit fix all `LoopOverCharArray` warns given by ErrorProne in the `gson/src/test.*` path. `toCharArray` allocates a new array, using `charAt` is more efficient * Fixes `HidingField` warns This commit fix all `HidingField` warns given by ErrorProne in the `gson/src/test.*` path. * Implements code review feedback * Implements code review feedback This commit implements some other code review feedback * Enable ErrorProne in `extra` Thi commit removes the `.*extras/src/test.*` path from the `-XepExcludedPaths` parameter of ErrorProne. * Fix the `JavaUtilDate` warns This commit fix all `JavaUtilDate` warns given by ErrorProne in the `extras/src/test.*` path. * Implements code review feedback * Removes redundant new-line * Implements code review feedback * Adds `JDK11` to run test with `--release 11` * Revert "Adds `JDK11` to run test with `--release 11`" This reverts commit a7cca386098ae847a10a31c09c3ab9b11eee5920.
288 lines
10 KiB
XML
288 lines
10 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
Copyright 2008 Google LLC
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
<modelVersion>4.0.0</modelVersion>
|
|
|
|
<parent>
|
|
<groupId>com.google.code.gson</groupId>
|
|
<artifactId>gson-parent</artifactId>
|
|
<version>2.10.2-SNAPSHOT</version>
|
|
</parent>
|
|
|
|
<artifactId>gson</artifactId>
|
|
<name>Gson</name>
|
|
|
|
<licenses>
|
|
<license>
|
|
<name>Apache-2.0</name>
|
|
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
|
</license>
|
|
</licenses>
|
|
|
|
<properties>
|
|
<excludeTestCompilation>**/Java17*</excludeTestCompilation>
|
|
</properties>
|
|
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>junit</groupId>
|
|
<artifactId>junit</artifactId>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.google.truth</groupId>
|
|
<artifactId>truth</artifactId>
|
|
<version>1.1.3</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.google.guava</groupId>
|
|
<artifactId>guava-testlib</artifactId>
|
|
<version>31.1-jre</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.google.errorprone</groupId>
|
|
<artifactId>error_prone_annotations</artifactId>
|
|
<version>2.18.0</version>
|
|
<optional>true</optional>
|
|
</dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
<plugins>
|
|
<!--
|
|
Plugins for source generation and compilation
|
|
-->
|
|
<plugin>
|
|
<groupId>org.codehaus.mojo</groupId>
|
|
<artifactId>templating-maven-plugin</artifactId>
|
|
<version>1.0.0</version>
|
|
<executions>
|
|
<execution>
|
|
<id>filtering-java-templates</id>
|
|
<goals>
|
|
<goal>filter-sources</goal>
|
|
</goals>
|
|
<configuration>
|
|
<sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory>
|
|
<outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-compiler-plugin</artifactId>
|
|
<executions>
|
|
<execution>
|
|
<id>default-compile</id>
|
|
<configuration>
|
|
<excludes>
|
|
<!-- module-info.java is compiled using ModiTect -->
|
|
<exclude>module-info.java</exclude>
|
|
</excludes>
|
|
</configuration>
|
|
</execution>
|
|
<execution>
|
|
<id>default-testCompile</id>
|
|
<phase>test-compile</phase>
|
|
<goals>
|
|
<goal>testCompile</goal>
|
|
</goals>
|
|
<configuration>
|
|
<testExcludes>
|
|
<exclude>${excludeTestCompilation}</exclude>
|
|
</testExcludes>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>biz.aQute.bnd</groupId>
|
|
<artifactId>bnd-maven-plugin</artifactId>
|
|
<version>6.4.0</version>
|
|
<executions>
|
|
<execution>
|
|
<goals>
|
|
<goal>bnd-process</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<!--
|
|
Plugins for test execution
|
|
-->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-surefire-plugin</artifactId>
|
|
<version>3.0.0-M9</version>
|
|
<configuration>
|
|
<!-- Deny illegal access, this is required for ReflectionAccessTest -->
|
|
<!-- Requires Java >= 9; Important: In case future Java versions
|
|
don't support this flag anymore, don't remove it unless CI also runs with
|
|
that Java version. Ideally would use toolchain to specify that this should
|
|
run with e.g. Java 11, but Maven toolchain requirements (unlike Gradle ones)
|
|
don't seem to be portable (every developer would have to set up toolchain
|
|
configuration locally). -->
|
|
<argLine>--illegal-access=deny</argLine>
|
|
</configuration>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>com.coderplus.maven.plugins</groupId>
|
|
<artifactId>copy-rename-maven-plugin</artifactId>
|
|
<version>1.0.1</version>
|
|
<executions>
|
|
<execution>
|
|
<id>pre-obfuscate-class</id>
|
|
<phase>process-test-classes</phase>
|
|
<goals>
|
|
<goal>rename</goal>
|
|
</goals>
|
|
<configuration>
|
|
<fileSets>
|
|
<fileSet>
|
|
<sourceFile>${project.build.directory}/test-classes/com/google/gson/functional/EnumWithObfuscatedTest.class</sourceFile>
|
|
<destinationFile>${project.build.directory}/test-classes-obfuscated-injar/com/google/gson/functional/EnumWithObfuscatedTest.class</destinationFile>
|
|
</fileSet>
|
|
<fileSet>
|
|
<sourceFile>${project.build.directory}/test-classes/com/google/gson/functional/EnumWithObfuscatedTest$Gender.class</sourceFile>
|
|
<destinationFile>${project.build.directory}/test-classes-obfuscated-injar/com/google/gson/functional/EnumWithObfuscatedTest$Gender.class</destinationFile>
|
|
</fileSet>
|
|
</fileSets>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>com.github.wvengen</groupId>
|
|
<artifactId>proguard-maven-plugin</artifactId>
|
|
<version>2.6.0</version>
|
|
<executions>
|
|
<execution>
|
|
<id>obfuscate-test-class</id>
|
|
<phase>process-test-classes</phase>
|
|
<goals>
|
|
<goal>proguard</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
<configuration>
|
|
<obfuscate>true</obfuscate>
|
|
<injar>test-classes-obfuscated-injar</injar>
|
|
<outjar>test-classes-obfuscated-outjar</outjar>
|
|
<inFilter>**/*.class</inFilter>
|
|
<proguardInclude>${basedir}/src/test/resources/testcases-proguard.conf</proguardInclude>
|
|
<libs>
|
|
<lib>${project.build.directory}/classes</lib>
|
|
<lib>${java.home}/jmods/java.base.jmod</lib>
|
|
</libs>
|
|
</configuration>
|
|
</plugin>
|
|
<plugin>
|
|
<artifactId>maven-resources-plugin</artifactId>
|
|
<version>3.3.0</version>
|
|
<executions>
|
|
<execution>
|
|
<id>post-obfuscate-class</id>
|
|
<phase>process-test-classes</phase>
|
|
<goals>
|
|
<goal>copy-resources</goal>
|
|
</goals>
|
|
<configuration>
|
|
<outputDirectory>${project.build.directory}/test-classes/com/google/gson/functional</outputDirectory>
|
|
<resources>
|
|
<resource>
|
|
<directory>${project.build.directory}/test-classes-obfuscated-outjar/com/google/gson/functional</directory>
|
|
<includes>
|
|
<include>EnumWithObfuscatedTest.class</include>
|
|
<include>EnumWithObfuscatedTest$Gender.class</include>
|
|
</includes>
|
|
</resource>
|
|
</resources>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<!--
|
|
Plugins for building / modifying artifacts
|
|
-->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-jar-plugin</artifactId>
|
|
<configuration>
|
|
<archive>
|
|
<!-- Use existing manifest generated by BND plugin -->
|
|
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
|
</archive>
|
|
</configuration>
|
|
</plugin>
|
|
<!-- Add module-info to JAR, see https://github.com/moditect/moditect#adding-module-descriptors-to-existing-jar-files -->
|
|
<!-- Uses ModiTect instead of separate maven-compiler-plugin executions
|
|
for better Eclipse IDE support, see https://github.com/eclipse-m2e/m2e-core/issues/393 -->
|
|
<!-- Note: For some reason this has to be executed before javadoc plugin; otherwise `javadoc:jar` goal fails
|
|
to find source files -->
|
|
<plugin>
|
|
<groupId>org.moditect</groupId>
|
|
<artifactId>moditect-maven-plugin</artifactId>
|
|
<version>1.0.0.RC2</version>
|
|
<executions>
|
|
<execution>
|
|
<id>add-module-info</id>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>add-module-info</goal>
|
|
</goals>
|
|
<configuration>
|
|
<jvmVersion>9</jvmVersion>
|
|
<module>
|
|
<moduleInfoFile>${project.build.sourceDirectory}/module-info.java</moduleInfoFile>
|
|
</module>
|
|
<!-- Overwrite the previously generated JAR file, if any -->
|
|
<overwriteExistingFiles>true</overwriteExistingFiles>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
<!-- Note: Javadoc plugin has to be run in combination with >= `package` phase,
|
|
e.g. `mvn package javadoc:javadoc`, otherwise it fails with
|
|
"Aggregator report contains named and unnamed modules" -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-javadoc-plugin</artifactId>
|
|
<configuration>
|
|
<excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
<profiles>
|
|
<profile>
|
|
<id>JDK17</id>
|
|
<activation>
|
|
<jdk>[17,)</jdk>
|
|
</activation>
|
|
<properties>
|
|
<maven.compiler.testRelease>17</maven.compiler.testRelease>
|
|
<excludeTestCompilation />
|
|
</properties>
|
|
</profile>
|
|
</profiles>
|
|
</project>
|