8030807: langtools should still build using jdk 7

Reviewed-by: briangoetz
This commit is contained in:
Vicente Romero 2013-12-19 20:16:44 +00:00
parent 4d793c02be
commit 3c77de74be
19 changed files with 48 additions and 40 deletions

View file

@ -394,7 +394,7 @@ public abstract class Configuration {
// 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)) {

View file

@ -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 class DeprecatedAPIListBuilder {
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);
}

View file

@ -273,7 +273,9 @@ public class Util {
*/
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) {

View file

@ -459,7 +459,7 @@ public class JavacTrees extends DocTrees {
/** @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 @@ public class JavacTrees extends DocTrees {
/** @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 */

View file

@ -508,7 +508,7 @@ public class Annotate {
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:

View file

@ -2601,7 +2601,7 @@ public class Check {
* @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'

View file

@ -372,7 +372,7 @@ public class Flow {
/** 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. */

View file

@ -2013,7 +2013,7 @@ public class Infer {
}
private void solve(GraphStrategy ss, Warner warn) {
solve(ss, new HashMap<>(), warn);
solve(ss, new HashMap<Type, Set<Type>>(), warn);
}
/**

View file

@ -1771,11 +1771,11 @@ public class LambdaToMethod extends TreeTranslator {
}
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>());
}
/**

View file

@ -578,7 +578,7 @@ public class JavaCompiler {
}
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) {

View file

@ -2356,7 +2356,7 @@ public class JavacParser implements Parser {
} 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 @@ public class JavacParser implements Parser {
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 @@ public class JavacParser implements Parser {
List<JCExpressionStatement> forUpdate() {
return moreStatementExpressions(token.pos,
parseExpression(),
new ListBuffer<>()).toList();
new ListBuffer<JCExpressionStatement>()).toList();
}
/** AnnotationsOpt = { '@' Annotation }

View file

@ -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 @@ public class JavacFiler implements Filer, Closeable {
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<>();

View file

@ -192,7 +192,9 @@ public class CreateSymbols extends AbstractProcessor {
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;

View file

@ -56,7 +56,7 @@ public abstract class Profiles {
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())) {

View file

@ -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 @@ public class RichDiagnosticFormatter extends
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

View file

@ -883,7 +883,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
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 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* @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) {

View file

@ -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 @@ public class JavacState
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 @@ public class JavacState
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,

View file

@ -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 @@ import java.util.List;
* @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

View file

@ -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 @@ public class ToolProvider {
} catch (Throwable e) {
return trace(WARNING, e);
}
toolClasses.put(name, new WeakReference<>(c));
toolClasses.put(name, new WeakReference<Class<?>>(c));
}
return c.asSubclass(clazz);
}