Merge branch '3.2.x'

Closes gh-41079
This commit is contained in:
Phillip Webb 2024-06-11 12:31:43 -07:00
commit 41c93c53e5
4 changed files with 27 additions and 43 deletions

View File

@ -16,6 +16,7 @@
package org.springframework.boot.build.classpath;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
@ -35,6 +36,11 @@ import org.gradle.api.tasks.TaskAction;
*/
public class CheckClasspathForProhibitedDependencies extends DefaultTask {
private static final Set<String> PROHIBITED_GROUPS = Set.of("org.codehaus.groovy", "org.eclipse.jetty.toolchain",
"commons-logging", "org.apache.geronimo.specs", "com.sun.activation");
private static final Set<String> PERMITTED_JAVAX_GROUPS = Set.of("javax.batch", "javax.cache", "javax.money");
private Configuration classpath;
public CheckClasspathForProhibitedDependencies() {
@ -69,38 +75,20 @@ public class CheckClasspathForProhibitedDependencies extends DefaultTask {
}
private boolean prohibited(ModuleVersionIdentifier id) {
String group = id.getGroup();
if (group.equals("javax.batch")) {
return false;
}
if (group.equals("javax.cache")) {
return false;
}
if (group.equals("javax.money")) {
return false;
}
if (group.equals("org.codehaus.groovy")) {
return true;
}
if (group.equals("org.eclipse.jetty.toolchain")) {
return true;
}
if (group.startsWith("javax")) {
return true;
}
if (group.equals("commons-logging")) {
return true;
}
if (group.equals("org.slf4j") && id.getName().equals("jcl-over-slf4j")) {
return true;
}
if (group.startsWith("org.jboss.spec")) {
return true;
}
if (group.equals("org.apache.geronimo.specs")) {
return true;
}
return group.equals("com.sun.activation");
return PROHIBITED_GROUPS.contains(id.getGroup()) || prohibitedJavax(id) || prohibitedSlf4j(id)
|| prohibitedJbossSpec(id);
}
private boolean prohibitedSlf4j(ModuleVersionIdentifier id) {
return id.getGroup().equals("org.slf4j") && id.getName().equals("jcl-over-slf4j");
}
private boolean prohibitedJbossSpec(ModuleVersionIdentifier id) {
return id.getGroup().startsWith("org.jboss.spec");
}
private boolean prohibitedJavax(ModuleVersionIdentifier id) {
return id.getGroup().startsWith("javax.") && !PERMITTED_JAVAX_GROUPS.contains(id.getGroup());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -37,14 +37,10 @@ class ModifiedClassPathExtensionForkParameterizedTests {
@ParameterizedTest
@ValueSource(strings = { "one", "two", "three" })
void testIsInvokedOnceForEachArgument(String argument) {
if (argument.equals("one")) {
assertThat(arguments).isEmpty();
}
else if (argument.equals("two")) {
assertThat(arguments).doesNotContain("two", "three");
}
else if (argument.equals("three")) {
assertThat(arguments).doesNotContain("three");
switch (argument) {
case "one" -> assertThat(arguments).isEmpty();
case "two" -> assertThat(arguments).doesNotContain("two", "three");
case "three" -> assertThat(arguments).doesNotContain("three");
}
arguments.add(argument);
}

View File

@ -219,7 +219,7 @@ public class LoggingSystemProperties {
if (this.environment instanceof ConfigurableEnvironment configurableEnvironment) {
PropertySourcesPropertyResolver resolver = new PropertySourcesPropertyResolver(
configurableEnvironment.getPropertySources());
resolver.setConversionService(((ConfigurableEnvironment) this.environment).getConversionService());
resolver.setConversionService(configurableEnvironment.getConversionService());
resolver.setIgnoreUnresolvableNestedPlaceholders(true);
return resolver;
}

View File

@ -128,7 +128,7 @@ class NestedJarResourceSet extends AbstractSingleArchiveResourceSet {
}
}
}
return this.multiRelease.booleanValue();
return this.multiRelease;
}
@Override