add back violations.xml

This commit is contained in:
Jerry Lee 2023-02-12 18:31:29 +08:00
parent 88ab15c6c1
commit 9992b40548
2 changed files with 64 additions and 1 deletions

View File

@ -622,7 +622,7 @@
<version>2.5.0</version> <version>2.5.0</version>
<configuration> <configuration>
<violationsFiles> <violationsFiles>
<violationsFile>${project.parent.basedir}/.mvn/modernizer/violations.xml</violationsFile> <violationsFile>${maven.multiModuleProjectDirectory}/src/violations.xml</violationsFile>
</violationsFiles> </violationsFiles>
</configuration> </configuration>
</plugin> </plugin>

63
src/violations.xml Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<modernizer>
<violation>
<name>java/lang/Class.newInstance:()Ljava/lang/Object;</name>
<version>1.1</version>
<comment>Prefer Class.getConstructor().newInstance()</comment>
</violation>
<violation>
<name>java/lang/String."&lt;init&gt;":([B)V</name>
<version>1.1</version>
<comment>Prefer new String(byte[], Charset)</comment>
</violation>
<violation>
<name>java/lang/String.getBytes:()[B</name>
<version>1.1</version>
<comment>Prefer String.getBytes(Charset)</comment>
</violation>
<violation>
<!-- File.getPath() is the canonical way to convert File to its String representation suitable for passing to new File() -->
<name>java/io/File.toString:()Ljava/lang/String;</name>
<version>1.1</version>
<comment>Prefer File.getPath()</comment>
</violation>
<violation>
<name>org/testng/Assert.assertEquals:(Ljava/lang/Iterable;Ljava/lang/Iterable;)V</name>
<version>1.8</version>
<comment>Use io.trino.testing.assertions.Assert.assertEquals due to TestNG #543</comment>
</violation>
<violation>
<name>org/testng/Assert.assertEquals:(Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/String;)V</name>
<version>1.8</version>
<comment>Use io.trino.testing.assertions.Assert.assertEquals due to TestNG #543</comment>
</violation>
<violation>
<name>org/testng/Assert.assertThrows:(Lorg/testng/Assert$ThrowingRunnable;)V</name>
<version>1.8</version>
<comment>Use AssertJ's assertThatThrownBy, see https://github.com/trinodb/trino/issues/5320 for rationale</comment>
</violation>
<violation>
<name>org/testng/Assert.assertThrows:(Ljava/lang/Class;Lorg/testng/Assert$ThrowingRunnable;)V</name>
<version>1.8</version>
<comment>Use AssertJ's assertThatThrownBy, see https://github.com/trinodb/trino/issues/5320 for rationale</comment>
</violation>
<violation>
<name>java/util/TimeZone.getTimeZone:(Ljava/lang/String;)Ljava/util/TimeZone;</name>
<version>1.8</version>
<comment>Avoid TimeZone.getTimeZone as it returns GMT for a zone not supported by the JVM. Use TimeZone.getTimeZone(ZoneId.of(..)) instead, or TimeZone.getTimeZone(..., false).</comment>
</violation>
<violation>
<name>org/joda/time/DateTimeZone.toTimeZone:()Ljava/util/TimeZone;</name>
<version>1.8</version>
<comment>Avoid DateTimeZone.toTimeZone as it returns GMT for a zone not supported by the JVM. Use TimeZone.getTimeZone(ZoneId.of(dtz.getId())) instead.</comment>
</violation>
</modernizer>