Use Java 7+ diamond operator in compiler modules
This commit is contained in:
@@ -57,7 +57,7 @@ public class ClassPreloadingUtils {
|
||||
}
|
||||
|
||||
private static URLClassLoader createFallbackClassLoader(Collection<File> files) throws IOException {
|
||||
List<URL> urls = new ArrayList<URL>(files.size());
|
||||
List<URL> urls = new ArrayList<>(files.size());
|
||||
for (File file : files) {
|
||||
urls.add(file.toURI().toURL());
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class ClassPreloadingUtils {
|
||||
return extractManifestClasspath((ResourceData) manifest);
|
||||
}
|
||||
else if (manifest instanceof ArrayList) {
|
||||
List<File> result = new ArrayList<File>();
|
||||
List<File> result = new ArrayList<>();
|
||||
for (ResourceData data : (ArrayList<ResourceData>) manifest) {
|
||||
result.addAll(extractManifestClasspath(data));
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class ClassPreloadingUtils {
|
||||
String classpathSpaceSeparated = (String) manifest.getMainAttributes().get(Attributes.Name.CLASS_PATH);
|
||||
if (classpathSpaceSeparated == null) return Collections.emptyList();
|
||||
|
||||
Collection<File> classpath = new ArrayList<File>(1);
|
||||
Collection<File> classpath = new ArrayList<>(1);
|
||||
for (String jar : classpathSpaceSeparated.split(" ")) {
|
||||
if (".".equals(jar)) continue;
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ClassPreloadingUtils {
|
||||
ClassHandler handler
|
||||
) throws IOException {
|
||||
// 0.75 is HashMap.DEFAULT_LOAD_FACTOR
|
||||
Map<String, Object> resources = new HashMap<String, Object>((int) (classNumberEstimate / 0.75));
|
||||
Map<String, Object> resources = new HashMap<>((int) (classNumberEstimate / 0.75));
|
||||
|
||||
for (File jarFile : jarFiles) {
|
||||
if (handler != null) {
|
||||
@@ -154,7 +154,7 @@ public class ClassPreloadingUtils {
|
||||
resources.put(name, resourceData);
|
||||
}
|
||||
else if (previous instanceof ResourceData) {
|
||||
List<ResourceData> list = new ArrayList<ResourceData>();
|
||||
List<ResourceData> list = new ArrayList<>();
|
||||
list.add((ResourceData) previous);
|
||||
list.add(resourceData);
|
||||
resources.put(name, list);
|
||||
|
||||
@@ -140,7 +140,7 @@ public class MemoryBasedClassLoader extends ClassLoader {
|
||||
Enumeration<URL> fromParent = parent.getResources(name);
|
||||
if (!own.hasMoreElements()) return fromParent;
|
||||
|
||||
List<URL> result = new ArrayList<URL>();
|
||||
List<URL> result = new ArrayList<>();
|
||||
while (own.hasMoreElements()) {
|
||||
result.add(own.nextElement());
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public class MemoryBasedClassLoader extends ClassLoader {
|
||||
else {
|
||||
assert resources instanceof ArrayList : "Resource map should contain ResourceData or ArrayList<ResourceData>: " + name;
|
||||
List<ResourceData> resourceDatas = (ArrayList<ResourceData>) resources;
|
||||
List<URL> urls = new ArrayList<URL>(resourceDatas.size());
|
||||
List<URL> urls = new ArrayList<>(resourceDatas.size());
|
||||
for (ResourceData data : resourceDatas) {
|
||||
urls.add(data.getURL());
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class Preloader {
|
||||
List<File> instrumenters = Collections.emptyList();
|
||||
int estimate = DEFAULT_CLASS_NUMBER_ESTIMATE;
|
||||
String mainClass = null;
|
||||
List<String> arguments = new ArrayList<String>();
|
||||
List<String> arguments = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
String arg = args[i];
|
||||
@@ -130,7 +130,7 @@ public class Preloader {
|
||||
|
||||
private static List<File> parseClassPath(String classpath) {
|
||||
String[] paths = classpath.split(File.pathSeparator);
|
||||
List<File> files = new ArrayList<File>(paths.length);
|
||||
List<File> files = new ArrayList<>(paths.length);
|
||||
for (String path : paths) {
|
||||
File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
|
||||
Reference in New Issue
Block a user