8030807: langtools should still build using jdk 7
authorvromero
Thu, 19 Dec 2013 20:16:44 +0000
changeset 22165 ec53c8946fc2
parent 22164 c8eb1ae29c58
child 22166 adc980c0dbcc
8030807: langtools should still build using jdk 7 Reviewed-by: briangoetz
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java
langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java
langtools/src/share/classes/javax/tools/DiagnosticCollector.java
langtools/src/share/classes/javax/tools/ToolProvider.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Dec 19 20:16:44 2013 +0000
@@ -394,7 +394,7 @@
         // in which each appears
         Map<Profile, List<PackageDoc>> interimResults = new EnumMap<>(Profile.class);
         for (Profile p: Profile.values())
-            interimResults.put(p, new ArrayList<>());
+            interimResults.put(p, new ArrayList<PackageDoc>());
 
         for (PackageDoc pkg: packages) {
             if (nodeprecated && Util.isDeprecated(pkg)) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Thu Dec 19 20:16:44 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
     public DeprecatedAPIListBuilder(Configuration configuration) {
         deprecatedLists = new ArrayList<>();
         for (int i = 0; i < NUM_TYPES; i++) {
-            deprecatedLists.add(i, new ArrayList<>());
+            deprecatedLists.add(i, new ArrayList<Doc>());
         }
         buildDeprecatedAPIInfo(configuration);
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Thu Dec 19 20:16:44 2013 +0000
@@ -273,7 +273,9 @@
      */
     public static List<Type> getAllInterfaces(Type type,
             Configuration configuration, boolean sort) {
-        Map<ClassDoc,Type> results = sort ? new TreeMap<>() : new LinkedHashMap<>();
+        Map<ClassDoc,Type> results = sort ?
+                new TreeMap<ClassDoc,Type>() :
+                new LinkedHashMap<ClassDoc,Type>();
         Type[] interfaceTypes = null;
         Type superType = null;
         if (type instanceof ParameterizedType) {
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Thu Dec 19 20:16:44 2013 +0000
@@ -459,7 +459,7 @@
 
     /** @see com.sun.tools.javadoc.ClassDocImpl#findField */
     private VarSymbol findField(ClassSymbol tsym, Name fieldName) {
-        return searchField(tsym, fieldName, new HashSet<>());
+        return searchField(tsym, fieldName, new HashSet<ClassSymbol>());
     }
 
     /** @see com.sun.tools.javadoc.ClassDocImpl#searchField */
@@ -525,7 +525,7 @@
 
     /** @see com.sun.tools.javadoc.ClassDocImpl#findMethod */
     private MethodSymbol findMethod(ClassSymbol tsym, Name methodName, List<Type> paramTypes) {
-        return searchMethod(tsym, methodName, paramTypes, new HashSet<>());
+        return searchMethod(tsym, methodName, paramTypes, new HashSet<ClassSymbol>());
     }
 
     /** @see com.sun.tools.javadoc.ClassDocImpl#searchMethod */
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Dec 19 20:16:44 2013 +0000
@@ -508,7 +508,7 @@
             repeated = repeated.reverse();
             TreeMaker m = make.at(ctx.pos.get(firstOccurrence));
             Pair<MethodSymbol, Attribute> p =
-                    new Pair<>(containerValueSymbol,
+                    new Pair<MethodSymbol, Attribute>(containerValueSymbol,
                                new Attribute.Array(arrayOfOrigAnnoType, repeated));
             if (ctx.isTypeCompound) {
                 /* TODO: the following code would be cleaner:
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Dec 19 20:16:44 2013 +0000
@@ -2601,7 +2601,7 @@
      *  @param type         The type whose interfaces are checked.
      */
     void checkClassBounds(DiagnosticPosition pos, Type type) {
-        checkClassBounds(pos, new HashMap<>(), type);
+        checkClassBounds(pos, new HashMap<TypeSymbol,Type>(), type);
     }
 //where
         /** Enter all interfaces of type `type' into the hash table `seensofar'
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Dec 19 20:16:44 2013 +0000
@@ -372,7 +372,7 @@
 
         /** Resolve all continues of this statement. */
         boolean resolveContinues(JCTree tree) {
-            return resolveJump(tree, new ListBuffer<>(), JumpKind.CONTINUE);
+            return resolveJump(tree, new ListBuffer<P>(), JumpKind.CONTINUE);
         }
 
         /** Resolve all breaks of this statement. */
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Dec 19 20:16:44 2013 +0000
@@ -2013,7 +2013,7 @@
         }
 
         private void solve(GraphStrategy ss, Warner warn) {
-            solve(ss, new HashMap<>(), warn);
+            solve(ss, new HashMap<Type, Set<Type>>(), warn);
         }
 
         /**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Dec 19 20:16:44 2013 +0000
@@ -1771,11 +1771,11 @@
                 }
                 translatedSymbols = new EnumMap<>(LambdaSymbolKind.class);
 
-                translatedSymbols.put(PARAM, new LinkedHashMap<>());
-                translatedSymbols.put(LOCAL_VAR, new LinkedHashMap<>());
-                translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<>());
-                translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<>());
-                translatedSymbols.put(TYPE_VAR, new LinkedHashMap<>());
+                translatedSymbols.put(PARAM, new LinkedHashMap<Symbol, Symbol>());
+                translatedSymbols.put(LOCAL_VAR, new LinkedHashMap<Symbol, Symbol>());
+                translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<Symbol, Symbol>());
+                translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<Symbol, Symbol>());
+                translatedSymbols.put(TYPE_VAR, new LinkedHashMap<Symbol, Symbol>());
             }
 
              /**
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Dec 19 20:16:44 2013 +0000
@@ -578,7 +578,7 @@
     }
 
     protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) {
-        return shouldStop(cs) ? new ListBuffer<>() : queue;
+        return shouldStop(cs) ? new ListBuffer<T>() : queue;
     }
 
     protected final <T> List<T> stopIfError(CompileState cs, List<T> list) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Dec 19 20:16:44 2013 +0000
@@ -2356,7 +2356,7 @@
             } else {
                 JCExpression t = parseType();
                 ListBuffer<JCStatement> stats =
-                        variableDeclarators(mods, t, new ListBuffer<>());
+                        variableDeclarators(mods, t, new ListBuffer<JCStatement>());
                 // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
                 storeEnd(stats.last(), token.endPos);
                 accept(SEMI);
@@ -2394,7 +2394,7 @@
                 JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
                 F.at(pos);
                 ListBuffer<JCStatement> stats =
-                        variableDeclarators(mods, t, new ListBuffer<>());
+                        variableDeclarators(mods, t, new ListBuffer<JCStatement>());
                 // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
                 storeEnd(stats.last(), token.endPos);
                 accept(SEMI);
@@ -2730,7 +2730,7 @@
     List<JCExpressionStatement> forUpdate() {
         return moreStatementExpressions(token.pos,
                                         parseExpression(),
-                                        new ListBuffer<>()).toList();
+                                        new ListBuffer<JCExpressionStatement>()).toList();
     }
 
     /** AnnotationsOpt = { '@' Annotation }
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java	Thu Dec 19 20:16:44 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -359,13 +359,13 @@
 
         log = Log.instance(context);
 
-        fileObjectHistory = synchronizedSet(new LinkedHashSet<>());
-        generatedSourceNames = synchronizedSet(new LinkedHashSet<>());
-        generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<>());
+        fileObjectHistory = synchronizedSet(new LinkedHashSet<FileObject>());
+        generatedSourceNames = synchronizedSet(new LinkedHashSet<String>());
+        generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<JavaFileObject>());
 
-        generatedClasses = synchronizedMap(new LinkedHashMap<>());
+        generatedClasses = synchronizedMap(new LinkedHashMap<String, JavaFileObject>());
 
-        openTypeNames  = synchronizedSet(new LinkedHashSet<>());
+        openTypeNames  = synchronizedSet(new LinkedHashSet<String>());
 
         aggregateGeneratedSourceNames = new LinkedHashSet<>();
         aggregateGeneratedClassNames  = new LinkedHashSet<>();
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Dec 19 20:16:44 2013 +0000
@@ -192,7 +192,9 @@
         Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym;
         for (int i = 1; i < profileAnnos.length; i++) {
             profileAnnos[i] = new Attribute.Compound(syms.profileType,
-                    List.<Pair<Symbol.MethodSymbol, Attribute>>of(new Pair<>(profileValue, new Attribute.Constant(syms.intType, i))));
+                    List.<Pair<Symbol.MethodSymbol, Attribute>>of(
+                        new Pair<Symbol.MethodSymbol, Attribute>(profileValue,
+                        new Attribute.Constant(syms.intType, i))));
         }
 
         Type.moreInfo = true;
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Thu Dec 19 20:16:44 2013 +0000
@@ -56,7 +56,7 @@
         if (args.length >= 2) {
             Map<Integer,Set<String>> lists = new TreeMap<>();
             for (int i = 1; i <= 4; i++)
-                lists.put(i, new TreeSet<>());
+                lists.put(i, new TreeSet<String>());
 
             File rt_jar_lst = new File(args[1]);
             for (String line: Files.readAllLines(rt_jar_lst.toPath(), Charset.defaultCharset())) {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Dec 19 20:16:44 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,7 +100,7 @@
         whereClauses = new EnumMap<>(WhereClauseKind.class);
         configuration = new RichConfiguration(Options.instance(context), formatter);
         for (WhereClauseKind kind : WhereClauseKind.values())
-            whereClauses.put(kind, new LinkedHashMap<>());
+            whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
     }
 
     @Override
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Thu Dec 19 20:16:44 2013 +0000
@@ -883,7 +883,7 @@
     public MethodDocImpl findMethod(String methodName, String[] paramTypes) {
         // Use hash table 'searched' to avoid searching same class twice.
         //### It is not clear how this could happen.
-        return searchMethod(methodName, paramTypes, new HashSet<>());
+        return searchMethod(methodName, paramTypes, new HashSet<ClassDocImpl>());
     }
 
     private MethodDocImpl searchMethod(String methodName,
@@ -1041,7 +1041,7 @@
      * @return the first FieldDocImpl which matches, null if not found.
      */
     public FieldDoc findField(String fieldName) {
-        return searchField(fieldName, new HashSet<>());
+        return searchField(fieldName, new HashSet<ClassDocImpl>());
     }
 
     private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
--- a/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java	Thu Dec 19 20:16:44 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -288,7 +288,7 @@
             b.append("R ").append(theArgs).append("\n");
 
             // Copy over the javac_state for the packages that did not need recompilation.
-            now.copyPackagesExcept(prev, recompiledPackages, new HashSet<>());
+            now.copyPackagesExcept(prev, recompiledPackages, new HashSet<String>());
             // Save the packages, ie package names, dependencies, pubapis and artifacts!
             // I.e. the lot.
             Module.saveModules(now.modules(), b);
@@ -712,9 +712,12 @@
             Transformer t = e.getKey();
             Map<String,Set<URI>> srcs = e.getValue();
             // These maps need to be synchronized since multiple threads will be writing results into them.
-            Map<String,Set<URI>> packageArtifacts = Collections.synchronizedMap(new HashMap<>());
-            Map<String,Set<String>> packageDependencies = Collections.synchronizedMap(new HashMap<>());
-            Map<String,String> packagePublicApis = Collections.synchronizedMap(new HashMap<>());
+            Map<String,Set<URI>> packageArtifacts =
+                    Collections.synchronizedMap(new HashMap<String,Set<URI>>());
+            Map<String,Set<String>> packageDependencies =
+                    Collections.synchronizedMap(new HashMap<String,Set<String>>());
+            Map<String,String> packagePublicApis =
+                    Collections.synchronizedMap(new HashMap<String, String>());
 
             boolean  r = t.transform(srcs,
                                      visibleSrcs,
--- a/langtools/src/share/classes/javax/tools/DiagnosticCollector.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/javax/tools/DiagnosticCollector.java	Thu Dec 19 20:16:44 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,8 @@
  * @since 1.6
  */
 public final class DiagnosticCollector<S> implements DiagnosticListener<S> {
-    private List<Diagnostic<? extends S>> diagnostics = Collections.synchronizedList(new ArrayList<>());
+    private List<Diagnostic<? extends S>> diagnostics =
+            Collections.synchronizedList(new ArrayList<Diagnostic<? extends S>>());
 
     public void report(Diagnostic<? extends S> diagnostic) {
         diagnostic.getClass(); // null check
--- a/langtools/src/share/classes/javax/tools/ToolProvider.java	Thu Dec 19 11:38:45 2013 -0500
+++ b/langtools/src/share/classes/javax/tools/ToolProvider.java	Thu Dec 19 20:16:44 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -173,7 +173,7 @@
             } catch (Throwable e) {
                 return trace(WARNING, e);
             }
-            toolClasses.put(name, new WeakReference<>(c));
+            toolClasses.put(name, new WeakReference<Class<?>>(c));
         }
         return c.asSubclass(clazz);
     }