This commit is contained in:
Stephane Nicoll
2019-12-26 10:42:40 +01:00
parent 1e38dd5531
commit 2c1e81adf0
24 changed files with 65 additions and 78 deletions

View File

@@ -181,10 +181,10 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
if (annotation != null) {
String prefix = getPrefix(annotation);
if (element instanceof TypeElement) {
processAnnotatedTypeElement(prefix, (TypeElement) element, new Stack<TypeElement>());
processAnnotatedTypeElement(prefix, (TypeElement) element, new Stack<>());
}
else if (element instanceof ExecutableElement) {
processExecutableElement(prefix, (ExecutableElement) element, new Stack<TypeElement>());
processExecutableElement(prefix, (ExecutableElement) element, new Stack<>());
}
}
}

View File

@@ -74,7 +74,7 @@ public abstract class ExecutableArchiveLauncher extends Launcher {
}
private Iterator<Archive> applyClassPathArchivePostProcessing(Iterator<Archive> archives) throws Exception {
List<Archive> list = new ArrayList<Archive>();
List<Archive> list = new ArrayList<>();
while (archives.hasNext()) {
list.add(archives.next());
}

View File

@@ -167,7 +167,7 @@ public class PropertiesLauncher extends Launcher {
}
}
private void initializeProperties() throws Exception, IOException {
private void initializeProperties() throws Exception {
List<String> configs = new ArrayList<>();
if (getProperty(CONFIG_LOCATION) != null) {
configs.add(getProperty(CONFIG_LOCATION));
@@ -195,7 +195,7 @@ public class PropertiesLauncher extends Launcher {
}
}
private void loadResource(InputStream resource) throws IOException, Exception {
private void loadResource(InputStream resource) throws Exception {
this.properties.load(resource);
for (Object key : Collections.list(this.properties.propertyNames())) {
String text = this.properties.getProperty((String) key);
@@ -591,7 +591,7 @@ public class PropertiesLauncher extends Launcher {
}
private List<Archive> asList(Iterator<Archive> iterator) {
List<Archive> list = new ArrayList<Archive>();
List<Archive> list = new ArrayList<>();
while (iterator.hasNext()) {
list.add(iterator.next());
}

View File

@@ -172,9 +172,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
MergedAnnotations annotations = MergedAnnotations.from(testClass,
MergedAnnotations.SearchStrategy.TYPE_HIERARCHY);
ClassPathEntryFilter filter = new ClassPathEntryFilter(annotations.get(ClassPathExclusions.class));
List<URL> processedUrls = new ArrayList<>();
List<URL> additionalUrls = getAdditionalUrls(annotations.get(ClassPathOverrides.class));
processedUrls.addAll(additionalUrls);
List<URL> processedUrls = new ArrayList<>(additionalUrls);
for (URL url : urls) {
if (!filter.isExcluded(url)) {
processedUrls.add(url);

View File

@@ -81,7 +81,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
}
private void runTestWithModifiedClassPath(ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext) throws ClassNotFoundException, Throwable {
ExtensionContext extensionContext) throws Throwable {
Class<?> testClass = extensionContext.getRequiredTestClass();
Method testMethod = invocationContext.getExecutable();
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
@@ -95,8 +95,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
}
}
private void runTest(ClassLoader classLoader, String testClassName, String testMethodName)
throws ClassNotFoundException, Throwable {
private void runTest(ClassLoader classLoader, String testClassName, String testMethodName) throws Throwable {
Class<?> testClass = classLoader.loadClass(testClassName);
Method testMethod = findMethod(testClass, testMethodName);
LauncherDiscoveryRequest request = new LauncherDiscoveryRequestBuilder(classLoader)

View File

@@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import javax.annotation.processing.Processor;
import javax.tools.JavaCompiler;
@@ -59,7 +60,7 @@ public class TestCompiler {
this.fileManager = compiler.getStandardFileManager(null, null, null);
this.outputLocation = outputLocation;
this.outputLocation.mkdirs();
Iterable<? extends File> temp = Arrays.asList(this.outputLocation);
Iterable<? extends File> temp = Collections.singletonList(this.outputLocation);
this.fileManager.setLocation(StandardLocation.CLASS_OUTPUT, temp);
this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, temp);
}