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 bffd2f60cdc9e044babd5e4000a838a9daf971f2
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      | 30 ----------------------
 2 files changed, 1 insertion(+), 31 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..80296a1 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -1444,43 +1444,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