Cleanup and format code

This commit is contained in:
Phillip Webb
2017-03-06 16:44:31 -08:00
parent c7b46e4d1c
commit d8f827d224
649 changed files with 1922 additions and 2003 deletions

View File

@@ -90,7 +90,7 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
protected Set<Artifact> filterDependencies(Set<Artifact> dependencies,
FilterArtifacts filters) throws MojoExecutionException {
try {
Set<Artifact> filtered = new LinkedHashSet<Artifact>(dependencies);
Set<Artifact> filtered = new LinkedHashSet<>(dependencies);
filtered.retainAll(filters.filter(dependencies));
return filtered;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -270,7 +270,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
private void doRunWithForkedJvm(String startClassName)
throws MojoExecutionException, MojoFailureException {
List<String> args = new ArrayList<String>();
List<String> args = new ArrayList<>();
addAgents(args);
addJvmArgs(args);
addClasspath(args);
@@ -392,7 +392,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
protected URL[] getClassPathUrls() throws MojoExecutionException {
try {
List<URL> urls = new ArrayList<URL>();
List<URL> urls = new ArrayList<>();
addUserDefinedFolders(urls);
addResources(urls);
addProjectClasses(urls);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -45,7 +45,7 @@ public class ArtifactsLibraries implements Libraries {
private static final Map<String, LibraryScope> SCOPES;
static {
Map<String, LibraryScope> scopes = new HashMap<String, LibraryScope>();
Map<String, LibraryScope> scopes = new HashMap<>();
scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);
scopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME);
scopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED);
@@ -85,8 +85,8 @@ public class ArtifactsLibraries implements Libraries {
}
private Set<String> getDuplicates(Set<Artifact> artifacts) {
Set<String> duplicates = new HashSet<String>();
Set<String> seen = new HashSet<String>();
Set<String> duplicates = new HashSet<>();
Set<String> seen = new HashSet<>();
for (Artifact artifact : artifacts) {
String fileName = getFileName(artifact);
if (artifact.getFile() != null && !seen.add(fileName)) {

View File

@@ -242,7 +242,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
}
private ArtifactsFilter[] getAdditionalFilters() {
List<ArtifactsFilter> filters = new ArrayList<ArtifactsFilter>();
List<ArtifactsFilter> filters = new ArrayList<>();
if (this.excludeDevtools) {
Exclude exclude = new Exclude();
exclude.setGroupId("org.springframework.boot");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2017 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.
@@ -38,7 +38,7 @@ class RunArguments {
}
RunArguments(String[] args) {
this.args = new LinkedList<String>(Arrays.asList(args));
this.args = new LinkedList<>(Arrays.asList(args));
}
public LinkedList<String> getArgs() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -132,7 +132,7 @@ public class StartMojo extends AbstractRunMojo {
protected RunArguments resolveJvmArguments() {
RunArguments jvmArguments = super.resolveJvmArguments();
if (isFork()) {
List<String> remoteJmxArguments = new ArrayList<String>();
List<String> remoteJmxArguments = new ArrayList<>();
remoteJmxArguments.add("-Dcom.sun.management.jmxremote");
remoteJmxArguments.add("-Dcom.sun.management.jmxremote.port=" + this.jmxPort);
remoteJmxArguments.add("-Dcom.sun.management.jmxremote.authenticate=false");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -124,7 +124,7 @@ public class ArtifactsLibrariesTests {
given(artifact2.getBaseVersion()).willReturn("1.0");
given(artifact2.getFile()).willReturn(new File("a"));
given(artifact2.getArtifactHandler()).willReturn(this.artifactHandler);
this.artifacts = new LinkedHashSet<Artifact>(Arrays.asList(artifact1, artifact2));
this.artifacts = new LinkedHashSet<>(Arrays.asList(artifact1, artifact2));
this.libs = new ArtifactsLibraries(this.artifacts, null, mock(Log.class));
this.libs.doWithLibraries(this.callback);
verify(this.callback, times(2)).library(this.libraryCaptor.capture());

View File

@@ -148,7 +148,7 @@ public class DependencyFilterMojoTests {
public Set<Artifact> filterDependencies(Artifact... artifacts)
throws MojoExecutionException {
Set<Artifact> input = new LinkedHashSet<Artifact>(Arrays.asList(artifacts));
Set<Artifact> input = new LinkedHashSet<>(Arrays.asList(artifacts));
return filterDependencies(input, getFilters(this.additionalFilters));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -101,7 +101,7 @@ public class ExcludeFilterTests {
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(
createExclude("com.foo", "bar"), createExclude("com.foo", "bar2"),
createExclude("org.acme", "app")));
Set<Artifact> artifacts = new HashSet<Artifact>();
Set<Artifact> artifacts = new HashSet<>();
artifacts.add(createArtifact("com.foo", "bar"));
artifacts.add(createArtifact("com.foo", "bar"));
Artifact anotherAcme = createArtifact("org.acme", "another-app");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -98,7 +98,7 @@ public class IncludeFilterTests {
IncludeFilter filter = new IncludeFilter(Arrays.asList(
createInclude("com.foo", "bar"), createInclude("com.foo", "bar2"),
createInclude("org.acme", "app")));
Set<Artifact> artifacts = new HashSet<Artifact>();
Set<Artifact> artifacts = new HashSet<>();
artifacts.add(createArtifact("com.foo", "bar"));
artifacts.add(createArtifact("com.foo", "bar"));
Artifact anotherAcme = createArtifact("org.acme", "another-app");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -93,7 +93,7 @@ public final class Verify {
public ArchiveVerifier(ZipFile zipFile) {
this.zipFile = zipFile;
Enumeration<? extends ZipEntry> entries = zipFile.entries();
this.content = new HashMap<String, ZipEntry>();
this.content = new HashMap<>();
while (entries.hasMoreElements()) {
ZipEntry zipEntry = entries.nextElement();
this.content.put(zipEntry.getName(), zipEntry);