Cleanup and format code
This commit is contained in:
@@ -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.
|
||||
@@ -57,7 +57,7 @@ public class JarWriter implements LoaderClassesWriter {
|
||||
|
||||
private final JarOutputStream jarOutput;
|
||||
|
||||
private final Set<String> writtenEntries = new HashSet<String>();
|
||||
private final Set<String> writtenEntries = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Create a new {@link JarWriter} instance.
|
||||
@@ -89,7 +89,7 @@ public class JarWriter implements LoaderClassesWriter {
|
||||
private void setExecutableFilePermission(File file) {
|
||||
try {
|
||||
Path path = file.toPath();
|
||||
Set<PosixFilePermission> permissions = new HashSet<PosixFilePermission>(
|
||||
Set<PosixFilePermission> permissions = new HashSet<>(
|
||||
Files.getPosixFilePermissions(path));
|
||||
permissions.add(PosixFilePermission.OWNER_EXECUTE);
|
||||
Files.setPosixFilePermissions(path, permissions);
|
||||
|
||||
@@ -123,7 +123,7 @@ public final class Layouts {
|
||||
private static final Map<LibraryScope, String> SCOPE_DESTINATIONS;
|
||||
|
||||
static {
|
||||
Map<LibraryScope, String> map = new HashMap<LibraryScope, String>();
|
||||
Map<LibraryScope, String> map = new HashMap<>();
|
||||
map.put(LibraryScope.COMPILE, "WEB-INF/lib/");
|
||||
map.put(LibraryScope.CUSTOM, "WEB-INF/lib/");
|
||||
map.put(LibraryScope.RUNTIME, "WEB-INF/lib/");
|
||||
|
||||
@@ -136,7 +136,7 @@ public abstract class MainClassFinder {
|
||||
"Invalid root folder '" + rootFolder + "'");
|
||||
}
|
||||
String prefix = rootFolder.getAbsolutePath() + "/";
|
||||
Deque<File> stack = new ArrayDeque<File>();
|
||||
Deque<File> stack = new ArrayDeque<>();
|
||||
stack.push(rootFolder);
|
||||
while (!stack.isEmpty()) {
|
||||
File file = stack.pop();
|
||||
@@ -275,7 +275,7 @@ public abstract class MainClassFinder {
|
||||
String classesLocation) {
|
||||
classesLocation = (classesLocation != null ? classesLocation : "");
|
||||
Enumeration<JarEntry> sourceEntries = source.entries();
|
||||
List<JarEntry> classEntries = new ArrayList<JarEntry>();
|
||||
List<JarEntry> classEntries = new ArrayList<>();
|
||||
while (sourceEntries.hasMoreElements()) {
|
||||
JarEntry entry = sourceEntries.nextElement();
|
||||
if (entry.getName().startsWith(classesLocation)
|
||||
@@ -319,7 +319,7 @@ public abstract class MainClassFinder {
|
||||
|
||||
private static class ClassDescriptor extends ClassVisitor {
|
||||
|
||||
private final Set<String> annotationNames = new LinkedHashSet<String>();
|
||||
private final Set<String> annotationNames = new LinkedHashSet<>();
|
||||
|
||||
private boolean mainMethodFound;
|
||||
|
||||
@@ -398,7 +398,7 @@ public abstract class MainClassFinder {
|
||||
MainClass(String name, Set<String> annotationNames) {
|
||||
this.name = name;
|
||||
this.annotationNames = Collections
|
||||
.unmodifiableSet(new HashSet<String>(annotationNames));
|
||||
.unmodifiableSet(new HashSet<>(annotationNames));
|
||||
}
|
||||
|
||||
String getName() {
|
||||
@@ -446,7 +446,7 @@ public abstract class MainClassFinder {
|
||||
private static final class SingleMainClassCallback
|
||||
implements MainClassCallback<Object> {
|
||||
|
||||
private final Set<MainClass> mainClasses = new LinkedHashSet<MainClass>();
|
||||
private final Set<MainClass> mainClasses = new LinkedHashSet<>();
|
||||
|
||||
private final String annotationName;
|
||||
|
||||
@@ -461,7 +461,7 @@ public abstract class MainClassFinder {
|
||||
}
|
||||
|
||||
private String getMainClassName() {
|
||||
Set<MainClass> matchingMainClasses = new LinkedHashSet<MainClass>();
|
||||
Set<MainClass> matchingMainClasses = new LinkedHashSet<>();
|
||||
if (this.annotationName != null) {
|
||||
for (MainClass mainClass : this.mainClasses) {
|
||||
if (mainClass.getAnnotationNames().contains(this.annotationName)) {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Repackager {
|
||||
|
||||
private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication";
|
||||
|
||||
private List<MainClassTimeoutWarningListener> mainClassTimeoutListeners = new ArrayList<MainClassTimeoutWarningListener>();
|
||||
private List<MainClassTimeoutWarningListener> mainClassTimeoutListeners = new ArrayList<>();
|
||||
|
||||
private String mainClass;
|
||||
|
||||
@@ -236,8 +236,8 @@ public class Repackager {
|
||||
LaunchScript launchScript) throws IOException {
|
||||
JarWriter writer = new JarWriter(destination, launchScript);
|
||||
try {
|
||||
final List<Library> unpackLibraries = new ArrayList<Library>();
|
||||
final List<Library> standardLibraries = new ArrayList<Library>();
|
||||
final List<Library> unpackLibraries = new ArrayList<>();
|
||||
final List<Library> standardLibraries = new ArrayList<>();
|
||||
libraries.doWithLibraries(new LibraryCallback() {
|
||||
|
||||
@Override
|
||||
@@ -270,7 +270,7 @@ public class Repackager {
|
||||
final List<Library> unpackLibraries, final List<Library> standardLibraries)
|
||||
throws IOException {
|
||||
writer.writeManifest(buildManifest(sourceJar));
|
||||
Set<String> seen = new HashSet<String>();
|
||||
Set<String> seen = new HashSet<>();
|
||||
writeNestedLibraries(unpackLibraries, seen, writer);
|
||||
if (this.layout instanceof RepackagingLayout) {
|
||||
writer.writeEntries(sourceJar, new RenamingEntryTransformer(
|
||||
|
||||
@@ -212,7 +212,7 @@ public class DefaultLaunchScriptTests {
|
||||
}
|
||||
|
||||
private Map<?, ?> createProperties(String... pairs) {
|
||||
Map<Object, Object> properties = new HashMap<Object, Object>();
|
||||
Map<Object, Object> properties = new HashMap<>();
|
||||
for (String pair : pairs) {
|
||||
String[] keyValue = pair.split(":");
|
||||
properties.put(keyValue[0], keyValue[1]);
|
||||
|
||||
@@ -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.
|
||||
@@ -178,7 +178,7 @@ public class MainClassFinderTests {
|
||||
|
||||
private static class ClassNameCollector implements MainClassCallback<Object> {
|
||||
|
||||
private final List<String> classNames = new ArrayList<String>();
|
||||
private final List<String> classNames = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Object doWith(MainClass mainClass) {
|
||||
|
||||
Reference in New Issue
Block a user