From ce441b2f8bcbdf6a4dec5a088454741a70d6ea63 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Thu, 6 Jun 2024 19:22:34 +0200 Subject: [PATCH] Try Checkstyle backport JRE8 10.x --- pom.xml | 4 ++-- .../empty-logging-check/pom.xml | 2 +- .../pom.xml | 18 ++++++++---------- .../checkstyle/AbstractCheckstyleReport.java | 5 ++++- .../CheckstyleViolationCheckMojo.java | 5 ++++- .../apt/examples/inline-checker-config.apt.vm | 2 +- .../apt/examples/upgrading-checkstyle.apt.vm | 2 +- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index adff04a6..22bbeda9 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ under the License. 8 3.6.3 1.4.1 - 9.3 + 10.17.0 1.7.36 1.11.1 1.11.1 @@ -197,7 +197,7 @@ under the License. com.puppycrawl.tools - checkstyle + checkstyle-backport-jre8 ${checkstyleVersion} diff --git a/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml b/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml index 29242e06..b252a6db 100644 --- a/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml +++ b/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml @@ -29,7 +29,7 @@ com.puppycrawl.tools - checkstyle + checkstyle-backport-jre8 @checkstyleVersion@ diff --git a/src/it/MCHECKSTYLE-357-with-header-override/pom.xml b/src/it/MCHECKSTYLE-357-with-header-override/pom.xml index b05481ee..28a79ac8 100644 --- a/src/it/MCHECKSTYLE-357-with-header-override/pom.xml +++ b/src/it/MCHECKSTYLE-357-with-header-override/pom.xml @@ -44,6 +44,11 @@ + + + + + @@ -55,9 +60,7 @@ - - - + @@ -133,11 +136,6 @@ - - - - - @@ -169,8 +167,8 @@ com.puppycrawl.tools - checkstyle - 8.15 + checkstyle-backport-jre8 + @checkstyleVersion@ diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java index e86b6d9f..271d27c1 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java @@ -622,7 +622,10 @@ protected AuditListener getListener() throws MavenReportException { listener = new DefaultLogger(out, OutputStreamOptions.CLOSE); } else if ("sarif".equals(outputFileFormat)) { try { - listener = new SarifLogger(out, OutputStreamOptions.CLOSE); + listener = new SarifLogger( + out, + com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions.valueOf( + OutputStreamOptions.CLOSE.name())); } catch (IOException e) { throw new MavenReportException("Failed to create SarifLogger", e); } diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java index 14c8443b..b6e0a141 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java @@ -813,7 +813,10 @@ private AuditListener getListener() throws MojoFailureException, MojoExecutionEx OutputStream xmlOut = getOutputStream(outputXmlFile); CompositeAuditListener compoundListener = new CompositeAuditListener(); compoundListener.addListener(new XMLLogger(xmlOut, OutputStreamOptions.CLOSE)); - compoundListener.addListener(new SarifLogger(out, OutputStreamOptions.CLOSE)); + compoundListener.addListener(new SarifLogger( + out, + com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions.valueOf( + OutputStreamOptions.CLOSE.name()))); listener = compoundListener; } catch (IOException e) { throw new MojoExecutionException("Unable to create temporary file", e); diff --git a/src/site/apt/examples/inline-checker-config.apt.vm b/src/site/apt/examples/inline-checker-config.apt.vm index 94320139..045fc02c 100644 --- a/src/site/apt/examples/inline-checker-config.apt.vm +++ b/src/site/apt/examples/inline-checker-config.apt.vm @@ -151,7 +151,7 @@ Using a different header com.puppycrawl.tools checkstyle - 8.15 + ${checkstyleVersion} diff --git a/src/site/apt/examples/upgrading-checkstyle.apt.vm b/src/site/apt/examples/upgrading-checkstyle.apt.vm index d5b3a0d5..c1412814 100644 --- a/src/site/apt/examples/upgrading-checkstyle.apt.vm +++ b/src/site/apt/examples/upgrading-checkstyle.apt.vm @@ -28,7 +28,7 @@ Upgrading Checkstyle at Runtime Maven Checkstyle plugin comes with a default Checkstyle version: for <<>>, - Checkstyle ${checkstyleVersion} is used by default. + Checkstyle ${checkstyleVersion} is used by default. Given Checkstyle generally keeps good compatibility between versions, you can override the version used at runtime to benefit from {{{https://checkstyle.org/releasenotes.html}Checkstyle latest bugfixes}}: