[ 
https://issues.apache.org/jira/browse/SUREFIRE-2245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850747#comment-17850747
 ] 

ASF GitHub Bot commented on SUREFIRE-2245:
------------------------------------------

michael-o commented on code in PR #737:
URL: https://github.com/apache/maven-surefire/pull/737#discussion_r1620861999


##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java:
##########
@@ -935,31 +932,17 @@ protected final PluginConsoleLogger getConsoleLogger() {
         return consoleLogger;
     }
 
-    private static <T extends ToolchainManager> Toolchain getToolchainMaven33x(
-            Class<T> toolchainManagerType, T toolchainManager, MavenSession 
session, Map<String, String> toolchainArgs)
-            throws MojoFailureException {
-        Method getToolchainsMethod =
-                tryGetMethod(toolchainManagerType, "getToolchains", 
MavenSession.class, String.class, Map.class);
-        if (getToolchainsMethod != null) {
-            //noinspection unchecked
-            List<Toolchain> tcs =
-                    invokeMethodWithArray(toolchainManager, 
getToolchainsMethod, session, "jdk", toolchainArgs);
-            if (tcs.isEmpty()) {
-                throw new MojoFailureException(
-                        "Requested toolchain specification did not match any 
configured toolchain: " + toolchainArgs);
-            }
-            return tcs.get(0);
-        }
-        return null;
-    }
-
-    // TODO remove the part with ToolchainManager lookup once we depend on
-    // 3.0.9 (have it as prerequisite). Define as regular component field then.
     private Toolchain getToolchain() throws MojoFailureException {
         Toolchain tc = null;
 
         if (getJdkToolchain() != null) {
-            tc = getToolchainMaven33x(ToolchainManager.class, 
getToolchainManager(), getSession(), getJdkToolchain());
+            List<Toolchain> tcs = 
getToolchainManager().getToolchains(getSession(), "jdk", getJdkToolchain());
+            if (tcs.isEmpty()) {
+                throw new MojoFailureException(
+                        "Requested toolchain specification did not match any 
configured toolchain: "
+                                + getJdkToolchain());
+            }
+            tc = tcs.get(0);

Review Comment:
   Guys, please check wether this is correct logically...





> Upgrade to Parent 42 and Maven 3.6.3
> ------------------------------------
>
>                 Key: SUREFIRE-2245
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2245
>             Project: Maven Surefire
>          Issue Type: Dependency upgrade
>            Reporter: Michael Osipov
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: 3.3.0
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to