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

slachiewicz pushed a commit to branch MCOMPILER-476
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git

commit 3ff39edecab6509b83ce944f05f9b94d032267e9
Author: Sylwester Lachiewicz <slachiew...@apache.org>
AuthorDate: Sun Dec 19 14:32:41 2021 +0100

    [MCOMPILER-476] Simplify code for toolchains
---
 .../singleproject-toolchains/pom.xml               |  2 +-
 .../plugin/compiler/AbstractCompilerMojo.java      | 31 ----------------------
 2 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/src/it/multirelease-patterns/singleproject-toolchains/pom.xml 
b/src/it/multirelease-patterns/singleproject-toolchains/pom.xml
index efcadb4..f094c03 100644
--- a/src/it/multirelease-patterns/singleproject-toolchains/pom.xml
+++ b/src/it/multirelease-patterns/singleproject-toolchains/pom.xml
@@ -44,7 +44,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-toolchains-plugin</artifactId>
-        <version>1.1</version>
+        <version>3.0.0</version>
         <executions>
           <execution>
             <goals>
diff --git 
a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
index 93fa6aa..e286c20 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -22,7 +22,6 @@ package org.apache.maven.plugin.compiler;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
@@ -1444,43 +1443,13 @@ public abstract class AbstractCompilerMojo
         return value;
     }
 
-    //TODO remove the part with ToolchainManager lookup once we depend on
-    //3.0.9 (have it as prerequisite). Define as regular component field then.
     protected final Toolchain getToolchain()
     {
         Toolchain tc = null;
-        
         if ( jdkToolchain != null )
         {
-            // Maven 3.3.1 has plugin execution scoped Toolchain Support
-            try
-            {
-                Method getToolchainsMethod =
-                    toolchainManager.getClass().getMethod( "getToolchains", 
MavenSession.class, String.class,
-                                                           Map.class );
-
-                @SuppressWarnings( "unchecked" )
-                List<Toolchain> tcs =
-                    (List<Toolchain>) getToolchainsMethod.invoke( 
toolchainManager, session, "jdk",
-                                                                  jdkToolchain 
);
-
-                if ( tcs != null && !tcs.isEmpty() )
-                {
-                    tc = tcs.get( 0 );
-                }
-            }
-            catch ( NoSuchMethodException | SecurityException | 
IllegalAccessException | IllegalArgumentException
-                | InvocationTargetException e )
-            {
-                // ignore
-            }
-        }
-        
-        if ( tc == null )
-        {
             tc = toolchainManager.getToolchainFromBuildContext( "jdk", session 
);
         }
-        
         return tc;
     }
 

Reply via email to