langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
changeset 22163 3651128c74eb
parent 22159 682da512ec17
child 22165 ec53c8946fc2
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Dec 18 19:22:58 2013 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Dec 18 16:05:18 2013 -0500
@@ -81,8 +81,7 @@
  */
 public class JavaCompiler {
     /** The context key for the compiler. */
-    protected static final Context.Key<JavaCompiler> compilerKey =
-        new Context.Key<JavaCompiler>();
+    protected static final Context.Key<JavaCompiler> compilerKey = new Context.Key<>();
 
     /** Get the JavaCompiler instance for this context. */
     public static JavaCompiler instance(Context context) {
@@ -556,7 +555,7 @@
      *  we don't accidentally overwrite an input file when -s is set.
      *  initialized by `compile'.
      */
-    protected Set<JavaFileObject> inputFiles = new HashSet<JavaFileObject>();
+    protected Set<JavaFileObject> inputFiles = new HashSet<>();
 
     protected boolean shouldStop(CompileState cs) {
         CompileState shouldStopPolicy = (errorCount() > 0 || unrecoverableError())
@@ -579,7 +578,7 @@
     }
 
     protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) {
-        return shouldStop(cs) ? new ListBuffer<T>() : queue;
+        return shouldStop(cs) ? new ListBuffer<>() : queue;
     }
 
     protected final <T> List<T> stopIfError(CompileState cs, List<T> list) {
@@ -943,7 +942,7 @@
 
         //parse all files
         ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
-        Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
+        Set<JavaFileObject> filesSoFar = new HashSet<>();
         for (JavaFileObject fileObject : fileObjects) {
             if (!filesSoFar.contains(fileObject)) {
                 filesSoFar.add(fileObject);
@@ -1352,8 +1351,7 @@
         return stopIfError(CompileState.FLOW, results);
     }
 
-    HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>> desugaredEnvs =
-            new HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>>();
+    HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>> desugaredEnvs = new HashMap<>();
 
     /**
      * Prepare attributed parse trees, in conjunction with their attribution contexts,
@@ -1383,7 +1381,7 @@
          * already been added to C and its superclasses.
          */
         class ScanNested extends TreeScanner {
-            Set<Env<AttrContext>> dependencies = new LinkedHashSet<Env<AttrContext>>();
+            Set<Env<AttrContext>> dependencies = new LinkedHashSet<>();
             protected boolean hasLambdas;
             @Override
             public void visitClassDef(JCClassDecl node) {
@@ -1456,7 +1454,7 @@
                     List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
                     if (pdef.head != null) {
                         Assert.check(pdef.tail.isEmpty());
-                        results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
+                        results.add(new Pair<>(env, (JCClassDecl)pdef.head));
                     }
                 }
                 return;
@@ -1470,7 +1468,7 @@
                     rootClasses.contains((JCClassDecl)untranslated) &&
                     ((cdef.mods.flags & (Flags.PROTECTED|Flags.PUBLIC)) != 0 ||
                      cdef.sym.packge().getQualifiedName() == names.java_lang)) {
-                    results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, removeMethodBodies(cdef)));
+                    results.add(new Pair<>(env, removeMethodBodies(cdef)));
                 }
                 return;
             }
@@ -1498,7 +1496,7 @@
                 JCClassDecl cdef = (JCClassDecl)env.tree;
                 if (untranslated instanceof JCClassDecl &&
                     rootClasses.contains((JCClassDecl)untranslated)) {
-                    results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, cdef));
+                    results.add(new Pair<>(env, cdef));
                 }
                 return;
             }
@@ -1513,7 +1511,7 @@
             //generate code for each class
             for (List<JCTree> l = cdefs; l.nonEmpty(); l = l.tail) {
                 JCClassDecl cdef = (JCClassDecl)l.head;
-                results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, cdef));
+                results.add(new Pair<>(env, cdef));
             }
         }
         finally {
@@ -1586,11 +1584,11 @@
         // where
         Map<JCCompilationUnit, Queue<Env<AttrContext>>> groupByFile(Queue<Env<AttrContext>> envs) {
             // use a LinkedHashMap to preserve the order of the original list as much as possible
-            Map<JCCompilationUnit, Queue<Env<AttrContext>>> map = new LinkedHashMap<JCCompilationUnit, Queue<Env<AttrContext>>>();
+            Map<JCCompilationUnit, Queue<Env<AttrContext>>> map = new LinkedHashMap<>();
             for (Env<AttrContext> env: envs) {
                 Queue<Env<AttrContext>> sublist = map.get(env.toplevel);
                 if (sublist == null) {
-                    sublist = new ListBuffer<Env<AttrContext>>();
+                    sublist = new ListBuffer<>();
                     map.put(env.toplevel, sublist);
                 }
                 sublist.add(env);