From 9d4a40df1763501046053a4b5d882ba34ea4fa83 Mon Sep 17 00:00:00 2001 From: Daniel Muehlbachler-Pietrzykowski Date: Fri, 4 Mar 2022 14:22:23 +0100 Subject: [PATCH] Issue #403: upgrade to checkstyle 10.0; drop java 1.8 support --- .github/workflows/sonar-checkstyle-workflows.yml | 11 ----------- .gitignore | 3 +++ README.md | 1 + pom.xml | 6 +++--- .../org/checkstyle/plugins/sonar/RunPluginTest.java | 4 ++-- .../plugins/checkstyle/CheckstyleConstantsTest.java | 3 ++- .../checkstyle/CheckstyleSeverityUtilsTest.java | 3 ++- 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/sonar-checkstyle-workflows.yml b/.github/workflows/sonar-checkstyle-workflows.yml index 66082e69..83dea960 100644 --- a/.github/workflows/sonar-checkstyle-workflows.yml +++ b/.github/workflows/sonar-checkstyle-workflows.yml @@ -7,17 +7,6 @@ on: pull_request: jobs: - mvn-install-java-8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v1 - with: - java-version: 8 - - name: install - run: "./.ci/ci.sh install" - mvn-install-java-11: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index d6ef3594..ed17e064 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,9 @@ target/ .project .settings +# ---- VSCode +.vscode/ + # ---- Mac OS X .DS_Store? Icon? diff --git a/README.md b/README.md index b623e4c8..d88101ad 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Compatibility matrix from checkstyle team: | Checkstyle Plugin | Sonar min | Sonar max | Checkstyle | Jdk | |-------------------|-----------|-----------|------------|-----| +| 10.0 | 8.9 | 8.9+ | 10.0 | 11 | | 9.3 | 8.9 | 8.9+ | 9.3 | 1.8 | | 9.2.1 | 8.9 | 8.9+ | 9.2.1 | 1.8 | | 9.2 | 8.9 | 8.9+ | 9.2 | 1.8 | diff --git a/pom.xml b/pom.xml index 54aaa896..b1c9185a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.checkstyle checkstyle-sonar-plugin - 9.4-SNAPSHOT + 10.0-SNAPSHOT sonar-plugin Checkstyle SonarQube Plugin @@ -93,7 +93,7 @@ - 9.3 + 10.0 8.9.0.43852 7.2.0.26923 3.1.2 @@ -103,7 +103,7 @@ 8.35 0.8.5 - 1.8 + 11 UTF-8 true diff --git a/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java b/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java index ac8cdc08..64eaa1e7 100644 --- a/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java +++ b/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java @@ -154,8 +154,8 @@ private static void executeBuildWithCommonProperties(Build build, boolean bui private static void assertNoDifferences() { try { - final String differences = new String(Files - .readAllBytes(new File(litsDifferencesPath()).toPath()), UTF_8); + final String differences = Files + .readString(new File(litsDifferencesPath()).toPath(), UTF_8); Assertions.assertThat(differences) .isEmpty(); diff --git a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleConstantsTest.java b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleConstantsTest.java index a4666c67..8e376df0 100644 --- a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleConstantsTest.java +++ b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleConstantsTest.java @@ -23,6 +23,7 @@ import java.lang.reflect.Constructor; +import org.eclipse.jdt.core.dom.Modifier; import org.junit.Test; public class CheckstyleConstantsTest { @@ -31,7 +32,7 @@ public class CheckstyleConstantsTest { public void privateConstructor() throws ReflectiveOperationException { final Constructor constructor = CheckstyleConstants.class .getDeclaredConstructor(); - assertThat(constructor.isAccessible()).isFalse(); + assertThat(Modifier.isPrivate(constructor.getModifiers())).isTrue(); constructor.setAccessible(true); constructor.newInstance(); } diff --git a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleSeverityUtilsTest.java b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleSeverityUtilsTest.java index 5591a89b..b4d54cd9 100644 --- a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleSeverityUtilsTest.java +++ b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleSeverityUtilsTest.java @@ -23,6 +23,7 @@ import java.lang.reflect.Constructor; +import org.eclipse.jdt.core.dom.Modifier; import org.junit.Assert; import org.junit.Test; import org.sonar.api.rules.RulePriority; @@ -72,7 +73,7 @@ public void privateConstructor() throws ReflectiveOperationException { final Constructor constructor = CheckstyleSeverityUtils.class .getDeclaredConstructor(); - assertThat(constructor.isAccessible()).isFalse(); + assertThat(Modifier.isPrivate(constructor.getModifiers())).isTrue(); constructor.setAccessible(true); constructor.newInstance(); }