diff --git a/build.xml b/build.xml index 11ed6dce1cc..9a555602e49 100644 --- a/build.xml +++ b/build.xml @@ -283,7 +283,7 @@ + source="1.6" target="1.6"> diff --git a/compiler/preloader/preloader.iml b/compiler/preloader/preloader.iml index d5c07432750..72aeb571869 100644 --- a/compiler/preloader/preloader.iml +++ b/compiler/preloader/preloader.iml @@ -1,12 +1,11 @@ - + - + - - + \ No newline at end of file diff --git a/compiler/preloader/src/org/jetbrains/kotlin/preloading/ClassPreloadingUtils.java b/compiler/preloader/src/org/jetbrains/kotlin/preloading/ClassPreloadingUtils.java index ed9fd7eef24..3d15d170dbb 100644 --- a/compiler/preloader/src/org/jetbrains/kotlin/preloading/ClassPreloadingUtils.java +++ b/compiler/preloader/src/org/jetbrains/kotlin/preloading/ClassPreloadingUtils.java @@ -57,7 +57,7 @@ public class ClassPreloadingUtils { } private static URLClassLoader createFallbackClassLoader(Collection files) throws IOException { - List urls = new ArrayList<>(files.size()); + List 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 result = new ArrayList<>(); + List result = new ArrayList(); for (ResourceData data : (ArrayList) 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 classpath = new ArrayList<>(1); + Collection 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 resources = new HashMap<>((int) (classNumberEstimate / 0.75)); + Map 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 list = new ArrayList<>(); + List list = new ArrayList(); list.add((ResourceData) previous); list.add(resourceData); resources.put(name, list); diff --git a/compiler/preloader/src/org/jetbrains/kotlin/preloading/MemoryBasedClassLoader.java b/compiler/preloader/src/org/jetbrains/kotlin/preloading/MemoryBasedClassLoader.java index 316eaf41111..102597e1263 100644 --- a/compiler/preloader/src/org/jetbrains/kotlin/preloading/MemoryBasedClassLoader.java +++ b/compiler/preloader/src/org/jetbrains/kotlin/preloading/MemoryBasedClassLoader.java @@ -20,7 +20,6 @@ import java.io.IOException; import java.net.URL; import java.util.*; -@SuppressWarnings("unchecked") /** * A class loader which loads classes and resources from the given map. * @@ -29,6 +28,7 @@ import java.util.*; * Therefore if you need to be able to find classes via findResource(), you should pass a fallback * class loader which is able to do that at any point of time. */ +@SuppressWarnings("unchecked") public class MemoryBasedClassLoader extends ClassLoader { private final ClassCondition classesToLoadByParent; private final ClassLoader parent; @@ -140,7 +140,7 @@ public class MemoryBasedClassLoader extends ClassLoader { Enumeration fromParent = parent.getResources(name); if (!own.hasMoreElements()) return fromParent; - List result = new ArrayList<>(); + List 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: " + name; List resourceDatas = (ArrayList) resources; - List urls = new ArrayList<>(resourceDatas.size()); + List urls = new ArrayList(resourceDatas.size()); for (ResourceData data : resourceDatas) { urls.add(data.getURL()); } diff --git a/compiler/preloader/src/org/jetbrains/kotlin/preloading/Preloader.java b/compiler/preloader/src/org/jetbrains/kotlin/preloading/Preloader.java index e83a18b5e2c..901d3c89472 100644 --- a/compiler/preloader/src/org/jetbrains/kotlin/preloading/Preloader.java +++ b/compiler/preloader/src/org/jetbrains/kotlin/preloading/Preloader.java @@ -44,26 +44,29 @@ public class Preloader { } private static void run(String[] args) throws Exception { - long startTime = System.nanoTime(); + final long startTime = System.nanoTime(); - Options options = parseOptions(args); + final Options options = parseOptions(args); ClassLoader classLoader = createClassLoader(options); - Handler handler = getHandler(options, classLoader); + final Handler handler = getHandler(options, classLoader); ClassLoader preloaded = ClassPreloadingUtils.preloadClasses(options.classpath, options.estimate, classLoader, null, handler); Class mainClass = preloaded.loadClass(options.mainClass); Method mainMethod = mainClass.getMethod("main", String[].class); Runtime.getRuntime().addShutdownHook( - new Thread(() -> { - if (options.measure) { - System.out.println(); - System.out.println("=== Preloader's measurements: "); - System.out.format("Total time: %.3fs\n", (System.nanoTime() - startTime) / 1e9); + new Thread(new Runnable() { + @Override + public void run() { + if (options.measure) { + System.out.println(); + System.out.println("=== Preloader's measurements: "); + System.out.format("Total time: %.3fs\n", (System.nanoTime() - startTime) / 1e9); + } + handler.done(); } - handler.done(); }) ); @@ -120,10 +123,10 @@ public class Preloader { private static Options parseOptions(String[] args) throws Exception { List classpath = Collections.emptyList(); boolean measure = false; - List instrumenters = new ArrayList<>(); + List instrumenters = new ArrayList(); int estimate = DEFAULT_CLASS_NUMBER_ESTIMATE; String mainClass = null; - List arguments = new ArrayList<>(); + List arguments = new ArrayList(); for (int i = 0; i < args.length; i++) { String arg = args[i]; @@ -162,7 +165,7 @@ public class Preloader { private static List parseClassPath(String classpath) { String[] paths = classpath.split(File.pathSeparator); - List files = new ArrayList<>(paths.length); + List files = new ArrayList(paths.length); for (String path : paths) { File file = new File(path); if (!file.exists()) { @@ -176,10 +179,10 @@ public class Preloader { private static Handler getHandler(Options options, ClassLoader withInstrumenter) { if (!options.measure) return new Handler(); - Instrumenter instrumenter = options.instrumenters.isEmpty() ? Instrumenter.DO_NOTHING : loadInstrumenter(withInstrumenter); + final Instrumenter instrumenter = options.instrumenters.isEmpty() ? Instrumenter.DO_NOTHING : loadInstrumenter(withInstrumenter); - int[] counter = new int[1]; - int[] size = new int[1]; + final int[] counter = new int[1]; + final int[] size = new int[1]; return new Handler() { @Override public void beforeDefineClass(String name, int sizeInBytes) {