[
https://issues.apache.org/jira/browse/SUREFIRE-2245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17851434#comment-17851434
]
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_r1623497355
##########
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:
True, but simply hides code complexity. It is has no further use. I wouldn't
necessarily delete it.
> 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)