This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 6d229a7 [MCHECKSTYLE-399] Upgrade Checkstyle to 8.41.1
6d229a7 is described below
commit 6d229a74b4a7eb2efc5fce287d932f6b5c250647
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Sun Dec 20 22:33:10 2020 +0100
[MCHECKSTYLE-399] Upgrade Checkstyle to 8.41.1
---
pom.xml | 11 +--
.../checkstyle/exec/DefaultCheckstyleExecutor.java | 80 ----------------------
2 files changed, 2 insertions(+), 89 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2231c4e..90dc78d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,7 +66,7 @@ under the License.
<!-- Because Checkstyle 7+ requires Java 8 -->
<javaVersion>8</javaVersion>
<mavenVersion>3.0</mavenVersion>
- <checkstyleVersion>8.29</checkstyleVersion>
+ <checkstyleVersion>8.41.1</checkstyleVersion>
<doxiaVersion>1.4</doxiaVersion>
<sitePluginVersion>3.9.1</sitePluginVersion>
<surefire.version>2.22.2</surefire.version>
@@ -208,13 +208,6 @@ under the License.
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyleVersion}</version>
- <exclusions>
- <!-- MCHECKSTYLE-156 -->
- <exclusion>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<!-- misc -->
@@ -285,7 +278,7 @@ under the License.
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
- <version>8.39</version>
+ <version>8.41.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
diff --git
a/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
b/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
index 94a01e0..7449b3f 100644
---
a/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
+++
b/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
@@ -25,10 +25,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -155,8 +151,6 @@ public class DefaultCheckstyleExecutor
testSourceDirectories );
}
- setUpCheckstyleClassloader( checker, classPathStrings,
outputDirectories );
-
checker.setModuleClassLoader(
Thread.currentThread().getContextClassLoader() );
if ( filterSet != null )
@@ -257,80 +251,6 @@ public class DefaultCheckstyleExecutor
return checkerListener.getResults();
}
- private void setUpCheckstyleClassloader( Checker checker,
- List<String> classPathStrings,
- List<String> outputDirectories )
- throws CheckstyleExecutorException
- {
- final List<URL> urls = new ArrayList<>( classPathStrings.size() );
-
- for ( String path : classPathStrings )
- {
- try
- {
- urls.add( new File( path ).toURI().toURL() );
- }
- catch ( MalformedURLException e )
- {
- throw new CheckstyleExecutorException( e.getMessage(), e );
- }
- }
-
- for ( String outputDirectoryString : outputDirectories )
- {
- try
- {
- if ( outputDirectoryString != null )
- {
- File outputDirectoryFile = new File( outputDirectoryString
);
- if ( outputDirectoryFile.exists() )
- {
- URL outputDirectoryUrl =
outputDirectoryFile.toURI().toURL();
- getLogger().debug( "Adding the outputDirectory " +
outputDirectoryUrl.toString()
- + " to the Checkstyle class
path" );
- urls.add( outputDirectoryUrl );
- }
- }
- }
- catch ( MalformedURLException e )
- {
- throw new CheckstyleExecutorException( e.getMessage(), e );
- }
- }
-
- URLClassLoader projectClassLoader = AccessController.doPrivileged( new
PrivilegedAction<URLClassLoader>()
- {
- public URLClassLoader run()
- {
- return new URLClassLoader( urls.toArray( new URL[0] ), null );
- }
- } );
-
- /*
- * MCHECKSTYLE-381: More recent Checkstyle versions will drop the
setClassLoader() method.
- * However, it was used before Checkstyle 8.25.
- */
- try
- {
- checker.setClassLoader( projectClassLoader );
- /*
- * MCHECKSTYLE-387: If the previous method call was successful,
emit a warning that the user is using
- * an old version of checkstyle.
- */
- getLogger().warn( "Old version of checkstyle detected. Consider
updating to >= v8.30" );
- getLogger().warn( "For more information see: "
- +
"https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html"
);
- }
- catch ( NoSuchMethodError ignored )
- {
- /*
- * The current checkstyle version does not support the method
setClassLoader anymore.
- * This is expected. The method call is being retained for less
recent versions of checkstyle.
- */
- }
-
- }
-
protected void addSourceDirectory( CheckstyleCheckerListener sinkListener,
Collection<File> sourceDirectories,
Collection<File> testSourceDirectories,
List<Resource> resources,
CheckstyleExecutorRequest request )