You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/12/21 07:05:29 UTC

[maven-checkstyle-plugin] branch MCHECKSTYLE-399 updated (6ff79bd -> 101195a)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MCHECKSTYLE-399
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git.


 discard 6ff79bd  [MCHECKSTYLE-399] Upgrade Checkstyle to 8.38
     new 101195a  [MCHECKSTYLE-399] Upgrade Checkstyle to 8.38

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (6ff79bd)
            \
             N -- N -- N   refs/heads/MCHECKSTYLE-399 (101195a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java  | 1 -
 1 file changed, 1 deletion(-)


[maven-checkstyle-plugin] 01/01: [MCHECKSTYLE-399] Upgrade Checkstyle to 8.38

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MCHECKSTYLE-399
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git

commit 101195ac7d10869e2d4d69f4c9f003524115aa20
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Dec 20 22:33:10 2020 +0100

    [MCHECKSTYLE-399] Upgrade Checkstyle to 8.38
---
 pom.xml                                            |  9 +--
 .../checkstyle/exec/DefaultCheckstyleExecutor.java | 80 ----------------------
 2 files changed, 1 insertion(+), 88 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3fdedd1..3a0ed40 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.38</checkstyleVersion>
     <doxiaVersion>1.4</doxiaVersion>
     <sitePluginVersion>3.9.0</sitePluginVersion>
     <project.build.outputTimestamp>2020-02-08T08:24:16Z</project.build.outputTimestamp>
@@ -207,13 +207,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 -->
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 )