Cleanup and format code
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user