# HG changeset patch # User briangoetz # Date 1387400718 18000 # Node ID 3651128c74ebbbbbca63bc9f90293a845f92f706 # Parent 3b3e23e673298007df5b26497dfc616bcf4a93d5 8030244: Update langtools to use Diamond Reviewed-by: darcy diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java Wed Dec 18 16:05:18 2013 -0500 @@ -36,7 +36,7 @@ @jdk.Exported public interface AttributeTree extends DocTree { @jdk.Exported - enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE }; + enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE } Name getName(); ValueKind getValueKind(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/source/doctree/DocTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/DocTree.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/source/doctree/DocTree.java Wed Dec 18 16:05:18 2013 -0500 @@ -236,7 +236,7 @@ Kind(String tagName) { this.tagName = tagName; } - }; + } /** * Gets the kind of this tree. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java --- a/langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java Wed Dec 18 16:05:18 2013 -0500 @@ -49,7 +49,7 @@ /** enum constant for expression lambdas */ EXPRESSION, /** enum constant for statement lambdas */ - STATEMENT; + STATEMENT } List getParameters(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/source/util/TaskEvent.java --- a/langtools/src/share/classes/com/sun/source/util/TaskEvent.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/source/util/TaskEvent.java Wed Dec 18 16:05:18 2013 -0500 @@ -69,7 +69,7 @@ * For events relating to an individual annotation processing round. **/ ANNOTATION_PROCESSING_ROUND - }; + } public TaskEvent(Kind kind) { this(kind, null, null, null); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/source/util/Trees.java --- a/langtools/src/share/classes/com/sun/source/util/Trees.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/source/util/Trees.java Wed Dec 18 16:05:18 2013 -0500 @@ -82,8 +82,8 @@ ClassLoader cl = arg.getClass().getClassLoader(); Class c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl); argType = Class.forName(argType.getName(), false, cl); - Method m = c.getMethod("instance", new Class[] { argType }); - return (Trees) m.invoke(null, new Object[] { arg }); + Method m = c.getMethod("instance", argType); + return (Trees) m.invoke(null, arg); } catch (Throwable e) { throw new AssertionError(e); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/AccessFlags.java --- a/langtools/src/share/classes/com/sun/tools/classfile/AccessFlags.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/AccessFlags.java Wed Dec 18 16:05:18 2013 -0500 @@ -58,7 +58,7 @@ public static final int ACC_ENUM = 0x4000; // class, inner, field public static final int ACC_MANDATED = 0x8000; // class, inner, field, method - public static enum Kind { Class, InnerClass, Field, Method}; + public static enum Kind { Class, InnerClass, Field, Method} AccessFlags(ClassReader cr) throws IOException { this(cr.readUnsignedShort()); @@ -159,7 +159,7 @@ } private static Set getModifiers(int flags, int[] modifierFlags, Kind t) { - Set s = new LinkedHashSet(); + Set s = new LinkedHashSet<>(); for (int m: modifierFlags) { if ((flags & m) != 0) s.add(flagToModifier(m, t)); @@ -168,7 +168,7 @@ } private Set getFlags(int[] expectedFlags, Kind t) { - Set s = new LinkedHashSet(); + Set s = new LinkedHashSet<>(); int f = flags; for (int e: expectedFlags) { if ((f & e) != 0) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/Attribute.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java Wed Dec 18 16:05:18 2013 -0500 @@ -90,7 +90,7 @@ try { Class[] constrArgTypes = {ClassReader.class, int.class, int.class}; Constructor constr = attrClass.getDeclaredConstructor(constrArgTypes); - return constr.newInstance(new Object[] { cr, name_index, data.length }); + return constr.newInstance(cr, name_index, data.length); } catch (Throwable t) { reasonForDefaultAttr = t.toString(); // fall through and use DefaultAttribute @@ -107,7 +107,7 @@ } protected void init() { - standardAttributes = new HashMap>(); + standardAttributes = new HashMap<>(); standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class); standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class); standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/Attributes.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Attributes.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Attributes.java Wed Dec 18 16:05:18 2013 -0500 @@ -38,8 +38,12 @@ * deletion without notice. */ public class Attributes implements Iterable { + + public final Attribute[] attrs; + public final Map map; + Attributes(ClassReader cr) throws IOException { - map = new HashMap(); + map = new HashMap<>(); int attrs_count = cr.readUnsignedShort(); attrs = new Attribute[attrs_count]; for (int i = 0; i < attrs_count; i++) { @@ -55,7 +59,7 @@ public Attributes(ConstantPool constant_pool, Attribute[] attrs) { this.attrs = attrs; - map = new HashMap(); + map = new HashMap<>(); for (Attribute attr : attrs) { try { map.put(attr.getName(constant_pool), attr); @@ -100,7 +104,4 @@ length += a.byteLength(); return length; } - - public final Attribute[] attrs; - public final Map map; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/CharacterRangeTable_attribute.java --- a/langtools/src/share/classes/com/sun/tools/classfile/CharacterRangeTable_attribute.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/CharacterRangeTable_attribute.java Wed Dec 18 16:05:18 2013 -0500 @@ -86,5 +86,5 @@ public final int character_range_start; public final int character_range_end; public final int flags; - }; + } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java Wed Dec 18 16:05:18 2013 -0500 @@ -245,7 +245,7 @@ ClassFileReader classFinder, Set rootClassNames, boolean transitiveClosure) throws ClassFileNotFoundException { - final Set results = new HashSet(); + final Set results = new HashSet<>(); Recorder r = new Recorder() { public void addDependency(Dependency d) { results.add(d); @@ -276,7 +276,7 @@ ClassFileReader classFinder, Set rootClassNames, boolean transitiveClosure, Recorder recorder) throws ClassFileNotFoundException { - Set doneClasses = new HashSet(); + Set doneClasses = new HashSet<>(); getFinder(); // ensure initialized getFilter(); // ensure initialized @@ -284,7 +284,7 @@ // Work queue of names of classfiles to be searched. // Entries will be unique, and for classes that do not yet have // dependencies in the results map. - Deque deque = new LinkedList(rootClassNames); + Deque deque = new LinkedList<>(rootClassNames); String className; while ((className = deque.poll()) != null) { @@ -560,7 +560,7 @@ } static abstract class BasicDependencyFinder implements Finder { - private Map locations = new HashMap(); + private Map locations = new HashMap<>(); Location getLocation(String className) { Location l = locations.get(className); @@ -578,7 +578,7 @@ try { constant_pool = classFile.constant_pool; origin = getLocation(classFile.getName()); - deps = new HashSet(); + deps = new HashSet<>(); } catch (ConstantPoolException e) { throw new ClassFileError(e); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/Instruction.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Instruction.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Instruction.java Wed Dec 18 16:05:18 2013 -0500 @@ -93,7 +93,7 @@ /** The length, in bytes, of this kind of instruction, or -1 is the * length depends on the specific instruction. */ public final int length; - }; + } /** A utility visitor to help decode the operands of an instruction. * @see Instruction#accept */ diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/Opcode.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Opcode.java Wed Dec 18 16:05:18 2013 -0500 @@ -468,5 +468,5 @@ /** Standard opcodes. */ STANDARD, /** Legacy support for PicoJava opcodes. */ - PICOJAVA }; + PICOJAVA } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/ReferenceFinder.java --- a/langtools/src/share/classes/com/sun/tools/classfile/ReferenceFinder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/ReferenceFinder.java Wed Dec 18 16:05:18 2013 -0500 @@ -94,7 +94,7 @@ * @throws ConstantPoolException if an error of the constant pool */ public boolean parse(ClassFile cf) throws ConstantPoolException { - List cprefs = new ArrayList(); + List cprefs = new ArrayList<>(); int index = 1; for (ConstantPool.CPInfo cpInfo : cf.constant_pool.entries()) { if (cpInfo.accept(cpVisitor, cf.constant_pool)) { @@ -108,7 +108,7 @@ } for (Method m : cf.methods) { - Set ids = new HashSet(); + Set ids = new HashSet<>(); Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code); if (c_attr != null) { for (Instruction instr : c_attr.getInstructions()) { @@ -119,7 +119,7 @@ } } if (ids.size() > 0) { - List refInfos = new ArrayList(ids.size()); + List refInfos = new ArrayList<>(ids.size()); for (int id : ids) { refInfos.add(CPRefInfo.class.cast(cf.constant_pool.get(id))); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/Signature.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Signature.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Signature.java Wed Dec 18 16:05:18 2013 -0500 @@ -96,7 +96,7 @@ while (sigp < sig.length() && sig.charAt(sigp) == '^') { sigp++; if (throwsTypes == null) - throwsTypes = new ArrayList(); + throwsTypes = new ArrayList<>(); throwsTypes.add(parseTypeSignature()); } return new MethodType(typeParamTypes, paramTypes, returnType, throwsTypes); @@ -108,7 +108,7 @@ List superinterfaces = null; while (sigp < sig.length()) { if (superinterfaces == null) - superinterfaces = new ArrayList(); + superinterfaces = new ArrayList<>(); superinterfaces.add(parseTypeSignature()); } return new ClassSigType(typeParamTypes, superclass, superinterfaces); @@ -183,7 +183,7 @@ private List parseTypeSignatures(char term) { sigp++; - List types = new ArrayList(); + List types = new ArrayList<>(); while (sig.charAt(sigp) != term) types.add(parseTypeSignature()); sigp++; @@ -229,7 +229,7 @@ private List parseTypeParamTypes() { assert sig.charAt(sigp) == '<'; sigp++; - List types = new ArrayList(); + List types = new ArrayList<>(); while (sig.charAt(sigp) != '>') types.add(parseTypeParamType()); sigp++; @@ -247,7 +247,7 @@ while (sig.charAt(sigp) == ':') { sigp++; if (interfaceBounds == null) - interfaceBounds = new ArrayList(); + interfaceBounds = new ArrayList<>(); interfaceBounds.add(parseTypeSignature()); } return new TypeParamType(name, classBound, interfaceBounds); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/Type.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Type.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Type.java Wed Dec 18 16:05:18 2013 -0500 @@ -103,7 +103,7 @@ return primitiveTypes.contains(name); } // where - private static final Set primitiveTypes = new HashSet(Arrays.asList( + private static final Set primitiveTypes = new HashSet<>(Arrays.asList( "boolean", "byte", "char", "double", "float", "int", "long", "short", "void")); @Override @@ -344,7 +344,8 @@ * {@code -} */ public static class WildcardType extends Type { - public enum Kind { UNBOUNDED, EXTENDS, SUPER }; + public enum Kind { UNBOUNDED, EXTENDS, SUPER } + public WildcardType() { this(Kind.UNBOUNDED, null); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java --- a/langtools/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java Wed Dec 18 16:05:18 2013 -0500 @@ -165,7 +165,7 @@ { // Write type path int len = cr.readUnsignedByte(); - List loc = new ArrayList(len); + List loc = new ArrayList<>(len); for (int i = 0; i < len * TypePathEntry.bytesPerEntry; ++i) loc.add(cr.readUnsignedByte()); position.location = Position.getTypePathFromBinary(loc); @@ -342,7 +342,7 @@ // For generic/array types. // TODO: or should we use null? Noone will use this object. - public List location = new ArrayList(0); + public List location = new ArrayList<>(0); // Tree position. public int pos = -1; @@ -498,7 +498,7 @@ * @param list The bytecode representation of the type path. */ public static List getTypePathFromBinary(List list) { - List loc = new ArrayList(list.size() / TypePathEntry.bytesPerEntry); + List loc = new ArrayList<>(list.size() / TypePathEntry.bytesPerEntry); int idx = 0; while (idx < list.size()) { if (idx + 1 == list.size()) { @@ -511,7 +511,7 @@ } public static List getBinaryFromTypePath(List locs) { - List loc = new ArrayList(locs.size() * TypePathEntry.bytesPerEntry); + List loc = new ArrayList<>(locs.size() * TypePathEntry.bytesPerEntry); for (TypePathEntry tpe : locs) { loc.add(tpe.tag.tag); loc.add(tpe.arg); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -52,7 +52,7 @@ protected final ConfigurationImpl configuration; protected final SubWriterHolderWriter writer; protected final ClassDoc classdoc; - protected Map typeMap = new LinkedHashMap(); + protected Map typeMap = new LinkedHashMap<>(); protected Set methodTypes = EnumSet.noneOf(MethodTypes.class); private int methodTypesOr = 0; public final boolean nodepr; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -103,9 +103,9 @@ super(configuration, filename); this.classdoc = classdoc; if (mapper.classToPackageAnnotations.containsKey(classdoc.qualifiedName())) - pkgToPackageAnnotations = new TreeSet(mapper.classToPackageAnnotations.get(classdoc.qualifiedName())); + pkgToPackageAnnotations = new TreeSet<>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName())); configuration.currentcd = classdoc; - this.pkgSet = new TreeSet(); + this.pkgSet = new TreeSet<>(); this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam); this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations); this.pkgToMethodTypeParameter = pkgDivide(mapper.classToExecMemberDocTypeParam); @@ -177,7 +177,7 @@ } private Map> pkgDivide(Map> classMap) { - Map> map = new HashMap>(); + Map> map = new HashMap<>(); List list= classMap.get(classdoc.qualifiedName()); if (list != null) { Collections.sort(list); @@ -186,7 +186,7 @@ pkgSet.add(pkg); List inPkg = map.get(pkg.name()); if (inPkg == null) { - inPkg = new ArrayList(); + inPkg = new ArrayList<>(); map.put(pkg.name(), inPkg); } inPkg.add(doc); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -178,7 +178,7 @@ /** * Collected set of doclint options */ - public Set doclintOpts = new LinkedHashSet(); + public Set doclintOpts = new LinkedHashSet<>(); /** * Unique Resource Handler for this package. @@ -286,7 +286,7 @@ } } if (root.specifiedClasses().length > 0) { - Map map = new HashMap(); + Map map = new HashMap<>(); PackageDoc pd; ClassDoc[] classes = root.classes(); for (ClassDoc aClass : classes) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -61,7 +61,7 @@ super(writer, classDoc); VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc, VisibleMemberMap.CONSTRUCTORS, configuration); - List constructors = new ArrayList(visibleMemberMap.getMembersFor(classDoc)); + List constructors = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc)); for (ProgramElementDoc constructor : constructors) { if (constructor.isProtected() || constructor.isPrivate()) { setFoundNonPubConstructor(true); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -1738,7 +1738,7 @@ return text; } - static final Set blockTags = new HashSet(); + static final Set blockTags = new HashSet<>(); static { for (HtmlTag t: HtmlTag.values()) { if (t.blockType == HtmlTag.BlockType.BLOCK) @@ -1944,7 +1944,7 @@ */ public List getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak, boolean isJava5DeclarationLocation) { - List results = new ArrayList(); + List results = new ArrayList<>(); ContentBuilder annotation; for (AnnotationDesc aDesc : descList) { AnnotationTypeDoc annotationDoc = aDesc.annotationType(); @@ -1971,7 +1971,7 @@ if (aDesc.isSynthesized()) { for (AnnotationDesc.ElementValuePair pair : pairs) { AnnotationValue annotationValue = pair.value(); - List annotationTypeValues = new ArrayList(); + List annotationTypeValues = new ArrayList<>(); if (annotationValue.value() instanceof AnnotationValue[]) { AnnotationValue[] annotationArray = (AnnotationValue[]) annotationValue.value(); @@ -1994,7 +1994,7 @@ if (pairs.length == 1 && isAnnotationDocumented) { AnnotationValue[] annotationArray = (AnnotationValue[]) (pairs[0].value()).value(); - List annotationTypeValues = new ArrayList(); + List annotationTypeValues = new ArrayList<>(); annotationTypeValues.addAll(Arrays.asList(annotationArray)); String sep = ""; for (AnnotationValue av : annotationTypeValues) { @@ -2052,7 +2052,7 @@ pairs[j].element(), pairs[j].element().name(), false)); annotation.addContent("="); AnnotationValue annotationValue = pairs[j].value(); - List annotationTypeValues = new ArrayList(); + List annotationTypeValues = new ArrayList<>(); if (annotationValue.value() instanceof AnnotationValue[]) { AnnotationValue[] annotationArray = (AnnotationValue[]) annotationValue.value(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -76,7 +76,7 @@ super(configuration, DocPath.forPackage(packageDoc).resolve(DocPaths.PACKAGE_FRAME)); this.packageDoc = packageDoc; if (configuration.root.specifiedPackages().length == 0) { - documentedClasses = new HashSet(Arrays.asList(configuration.root.classes())); + documentedClasses = new HashSet<>(Arrays.asList(configuration.root.classes())); } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -47,7 +47,7 @@ public class PackageUseWriter extends SubWriterHolderWriter { final PackageDoc pkgdoc; - final SortedMap> usingPackageToUsedClasses = new TreeMap>(); + final SortedMap> usingPackageToUsedClasses = new TreeMap<>(); /** * Constructor. @@ -73,7 +73,7 @@ Set usedClasses = usingPackageToUsedClasses .get(usingPackage.name()); if (usedClasses == null) { - usedClasses = new TreeSet(); + usedClasses = new TreeSet<>(); usingPackageToUsedClasses.put(Util.getPackageName(usingPackage), usedClasses); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -90,6 +90,6 @@ private void ensureMutableContents() { if (contents.isEmpty()) - contents = new ArrayList(); + contents = new ArrayList<>(); } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocument.java Wed Dec 18 16:05:18 2013 -0500 @@ -54,7 +54,7 @@ * @param htmlTree HTML tree of the document */ public HtmlDocument(Content docType, Content docComment, Content htmlTree) { - docContent = new ArrayList(); + docContent = new ArrayList<>(); addContent(nullCheck(docType)); addContent(nullCheck(docComment)); addContent(nullCheck(htmlTree)); @@ -67,7 +67,7 @@ * @param htmlTree HTML tree of the document */ public HtmlDocument(Content docType, Content htmlTree) { - docContent = new ArrayList(); + docContent = new ArrayList<>(); addContent(nullCheck(docType)); addContent(nullCheck(htmlTree)); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Wed Dec 18 16:05:18 2013 -0500 @@ -98,5 +98,5 @@ typeNameLabel, typeNameLink, typeSummary, - useSummary; + useSummary } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java Wed Dec 18 16:05:18 2013 -0500 @@ -99,7 +99,7 @@ public static enum BlockType { BLOCK, INLINE, - OTHER; + OTHER } /** @@ -107,7 +107,7 @@ */ public static enum EndTag { END, - NOEND; + NOEND } HtmlTag() { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Wed Dec 18 16:05:18 2013 -0500 @@ -79,7 +79,7 @@ */ public void addAttr(HtmlAttr attrName, String attrValue) { if (attrs.isEmpty()) - attrs = new LinkedHashMap(3); + attrs = new LinkedHashMap<>(3); attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue)); } @@ -109,7 +109,7 @@ } else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) { if (content.isEmpty()) - content = new ArrayList(); + content = new ArrayList<>(); content.add(tagContent); } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java Wed Dec 18 16:05:18 2013 -0500 @@ -95,7 +95,7 @@ return rawHtmlContent; } - private enum State { TEXT, ENTITY, TAG, STRING }; + private enum State { TEXT, ENTITY, TAG, STRING } @Override public int charCount() { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Dec 18 16:05:18 2013 -0500 @@ -307,8 +307,8 @@ message = new MessageRetriever(this, "com.sun.tools.doclets.internal.toolkit.resources.doclets"); - excludedDocFileDirs = new HashSet(); - excludedQualifiers = new HashSet(); + excludedDocFileDirs = new HashSet<>(); + excludedQualifiers = new HashSet<>(); setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH); } @@ -392,10 +392,9 @@ // Group the packages to be documented by the lowest profile (if any) // in which each appears - Map> interimResults = - new EnumMap>(Profile.class); + Map> interimResults = new EnumMap<>(Profile.class); for (Profile p: Profile.values()) - interimResults.put(p, new ArrayList()); + interimResults.put(p, new ArrayList<>()); for (PackageDoc pkg: packages) { if (nodeprecated && Util.isDeprecated(pkg)) { @@ -412,7 +411,7 @@ } // Build the profilePackages structure used by the doclet - profilePackages = new HashMap(); + profilePackages = new HashMap<>(); List prev = Collections.emptyList(); int size; for (Map.Entry> e: interimResults.entrySet()) { @@ -434,11 +433,11 @@ } private void initPackageArray() { - Set set = new HashSet(Arrays.asList(root.specifiedPackages())); + Set set = new HashSet<>(Arrays.asList(root.specifiedPackages())); for (ClassDoc aClass : root.specifiedClasses()) { set.add(aClass.containingPackage()); } - ArrayList results = new ArrayList(set); + ArrayList results = new ArrayList<>(set); Collections.sort(results); packages = results.toArray(new PackageDoc[] {}); } @@ -449,7 +448,7 @@ * @param options the two dimensional array of options. */ public void setOptions(String[][] options) throws Fault { - LinkedHashSet customTagStrs = new LinkedHashSet(); + LinkedHashSet customTagStrs = new LinkedHashSet<>(); // Some options, specifically -link and -linkoffline, require that // the output directory has already been created: so do that first. @@ -629,7 +628,7 @@ * @return an array of tokens. */ private String[] tokenize(String s, char separator, int maxTokens) { - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); StringBuilder token = new StringBuilder (); boolean prevIsEscapeChar = false; for (int i = 0; i < s.length(); i += Character.charCount(i)) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -87,8 +87,7 @@ this.writer = writer; this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType, configuration); - this.members = new ArrayList( - this.visibleMemberMap.getMembersFor(classDoc)); + this.members = new ArrayList<>(this.visibleMemberMap.getMembersFor(classDoc)); if (configuration.getMemberComparator() != null) { Collections.sort(this.members, configuration.getMemberComparator()); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -87,8 +87,7 @@ this.writer = writer; this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType, configuration); - this.members = new ArrayList( - this.visibleMemberMap.getMembersFor(classDoc)); + this.members = new ArrayList<>(this.visibleMemberMap.getMembersFor(classDoc)); if (configuration.getMemberComparator() != null) { Collections.sort(this.members, configuration.getMemberComparator()); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java Wed Dec 18 16:05:18 2013 -0500 @@ -68,7 +68,7 @@ this.configuration = configuration; this.writerFactory = configuration.getWriterFactory(); - Set containingPackagesSeen = new HashSet(); + Set containingPackagesSeen = new HashSet<>(); context = new AbstractBuilder.Context(configuration, containingPackagesSeen, LayoutParser.getInstance(configuration)); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -97,7 +97,7 @@ ConstantsSummaryWriter writer) { super(context); this.writer = writer; - this.classDocsWithConstFields = new HashSet(); + this.classDocsWithConstFields = new HashSet<>(); } /** @@ -151,7 +151,7 @@ */ public void buildContents(XMLNode node, Content contentTree) { Content contentListTree = writer.getContentsHeader(); - printedPackageHeaders = new HashSet(); + printedPackageHeaders = new HashSet<>(); for (PackageDoc pkg : configuration.packages) { if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg.name())) { writer.addLinkToPackageContent(pkg, @@ -169,7 +169,7 @@ * @param contentTree the tree to which the summaries will be added */ public void buildConstantSummaries(XMLNode node, Content contentTree) { - printedPackageHeaders = new HashSet(); + printedPackageHeaders = new HashSet<>(); Content summariesTree = writer.getConstantSummaries(); for (PackageDoc aPackage : configuration.packages) { if (hasConstantField(aPackage)) { @@ -331,7 +331,7 @@ * will be added */ protected void buildMembersSummary(XMLNode node, Content classConstantTree) { - List members = new ArrayList(members()); + List members = new ArrayList<>(members()); if (members.size() > 0) { Collections.sort(members); writer.addConstantMembers(classdoc, members, classConstantTree); @@ -352,7 +352,7 @@ } else { return null; } - List inclList = new LinkedList(); + List inclList = new LinkedList<>(); FieldDoc member; while(iter.hasNext()){ member = (FieldDoc)iter.next(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -94,8 +94,7 @@ classDoc, VisibleMemberMap.CONSTRUCTORS, configuration); - constructors = - new ArrayList(visibleMemberMap.getMembersFor(classDoc)); + constructors = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc)); for (ProgramElementDoc constructor : constructors) { if (constructor.isProtected() || constructor.isPrivate()) { writer.setFoundNonPubConstructor(true); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -88,8 +88,7 @@ classDoc, VisibleMemberMap.ENUM_CONSTANTS, configuration); - enumConstants = - new ArrayList(visibleMemberMap.getMembersFor(classDoc)); + enumConstants = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc)); if (configuration.getMemberComparator() != null) { Collections.sort(enumConstants, configuration.getMemberComparator()); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -89,9 +89,7 @@ classDoc, VisibleMemberMap.FIELDS, configuration); - fields = - new ArrayList(visibleMemberMap.getLeafClassMembers( - configuration)); + fields = new ArrayList<>(visibleMemberMap.getLeafClassMembers(configuration)); if (configuration.getMemberComparator() != null) { Collections.sort(fields, configuration.getMemberComparator()); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java Wed Dec 18 16:05:18 2013 -0500 @@ -60,7 +60,7 @@ private boolean isParsing; private LayoutParser(Configuration configuration) { - xmlElementsMap = new HashMap(); + xmlElementsMap = new HashMap<>(); this.configuration = configuration; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -330,11 +330,11 @@ */ private void buildSummary(MemberSummaryWriter writer, VisibleMemberMap visibleMemberMap, LinkedList summaryTreeList) { - List members = new ArrayList(visibleMemberMap.getLeafClassMembers( + List members = new ArrayList<>(visibleMemberMap.getLeafClassMembers( configuration)); if (members.size() > 0) { Collections.sort(members); - List tableContents = new LinkedList(); + List tableContents = new LinkedList<>(); for (int i = 0; i < members.size(); i++) { ProgramElementDoc member = members.get(i); final ProgramElementDoc propertyDoc = @@ -400,7 +400,7 @@ commentTextBuilder.append(propertyDoc.commentText()); // copy certain tags - List allTags = new LinkedList(); + List allTags = new LinkedList<>(); String[] tagNames = {"@defaultValue", "@since"}; for (String tagName: tagNames) { Tag[] tags = propertyDoc.tags(tagName); @@ -514,7 +514,7 @@ private void addSummary(MemberSummaryWriter writer, VisibleMemberMap visibleMemberMap, boolean showInheritedSummary, Content memberSummaryTree) { - LinkedList summaryTreeList = new LinkedList(); + LinkedList summaryTreeList = new LinkedList<>(); buildSummary(writer, visibleMemberMap, summaryTreeList); if (showInheritedSummary) buildInheritedSummary(writer, visibleMemberMap, summaryTreeList); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -90,8 +90,7 @@ VisibleMemberMap.METHODS, configuration); methods = - new ArrayList(visibleMemberMap.getLeafClassMembers( - configuration)); + new ArrayList<>(visibleMemberMap.getLeafClassMembers(configuration)); if (configuration.getMemberComparator() != null) { Collections.sort(methods, configuration.getMemberComparator()); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -90,7 +90,7 @@ VisibleMemberMap.PROPERTIES, configuration); properties = - new ArrayList(visibleMemberMap.getMembersFor(classDoc)); + new ArrayList<>(visibleMemberMap.getMembersFor(classDoc)); if (configuration.getMemberComparator() != null) { Collections.sort(properties, configuration.getMemberComparator()); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/XMLNode.java Wed Dec 18 16:05:18 2013 -0500 @@ -42,8 +42,8 @@ XMLNode(XMLNode parent, String qname) { this.parent = parent; name = qname; - attrs = new HashMap(); - children = new ArrayList(); + attrs = new HashMap<>(); + children = new ArrayList<>(); if (parent != null) parent.children.add(this); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java Wed Dec 18 16:05:18 2013 -0500 @@ -63,7 +63,7 @@ if (params == null) { return null; } - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); for (int i = 0; i < params.length; i++) { String name = params[i] instanceof Parameter ? ((Parameter) params[i]).name() : @@ -195,7 +195,7 @@ private Content getTagletOutput(boolean isNonTypeParams, Doc holder, TagletWriter writer, Object[] formalParameters, ParamTag[] paramTags) { Content result = writer.getOutputInstance(); - Set alreadyDocumented = new HashSet(); + Set alreadyDocumented = new HashSet<>(); if (paramTags.length > 0) { result.addContent( processParamTags(isNonTypeParams, paramTags, diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Wed Dec 18 16:05:18 2013 -0500 @@ -173,12 +173,12 @@ public TagletManager(boolean nosince, boolean showversion, boolean showauthor, boolean javafx, MessageRetriever message) { - overridenStandardTags = new HashSet(); - potentiallyConflictingTags = new HashSet(); - standardTags = new HashSet(); - standardTagsLowercase = new HashSet(); - unseenCustomTags = new HashSet(); - customTags = new LinkedHashMap(); + overridenStandardTags = new HashSet<>(); + potentiallyConflictingTags = new HashSet<>(); + standardTags = new HashSet<>(); + standardTagsLowercase = new HashSet<>(); + unseenCustomTags = new HashSet<>(); + customTags = new LinkedHashMap<>(); this.nosince = nosince; this.showversion = showversion; this.showauthor = showauthor; @@ -235,11 +235,11 @@ customTagClass = tagClassLoader.loadClass(classname); Method meth = customTagClass.getMethod("register", - new Class[] {java.util.Map.class}); + Map.class); Object[] list = customTags.values().toArray(); Taglet lastTag = (list != null && list.length > 0) ? (Taglet) list[list.length-1] : null; - meth.invoke(null, new Object[] {customTags}); + meth.invoke(null, customTags); list = customTags.values().toArray(); Object newLastTag = (list != null&& list.length > 0) ? list[list.length-1] : null; @@ -276,7 +276,7 @@ * @return the resulting array of directory and JAR file URLs */ private URL[] pathToURLs(String path) { - Set urls = new LinkedHashSet(); + Set urls = new LinkedHashSet<>(); for (String s: path.split(File.pathSeparator)) { if (s.isEmpty()) continue; try { @@ -414,7 +414,7 @@ * @param holderType the type of documentation that the misused tag was found in. */ private void printTagMisuseWarn(Taglet taglet, Tag tag, String holderType) { - Set locationsSet = new LinkedHashSet(); + Set locationsSet = new LinkedHashSet<>(); if (taglet.inOverview()) { locationsSet.add("overview"); } @@ -582,14 +582,14 @@ */ private void initCustomTagletArrays() { Iterator it = customTags.values().iterator(); - ArrayList pTags = new ArrayList(customTags.size()); - ArrayList tTags = new ArrayList(customTags.size()); - ArrayList fTags = new ArrayList(customTags.size()); - ArrayList cTags = new ArrayList(customTags.size()); - ArrayList mTags = new ArrayList(customTags.size()); - ArrayList iTags = new ArrayList(customTags.size()); - ArrayList oTags = new ArrayList(customTags.size()); - ArrayList sTags = new ArrayList(); + ArrayList pTags = new ArrayList<>(customTags.size()); + ArrayList tTags = new ArrayList<>(customTags.size()); + ArrayList fTags = new ArrayList<>(customTags.size()); + ArrayList cTags = new ArrayList<>(customTags.size()); + ArrayList mTags = new ArrayList<>(customTags.size()); + ArrayList iTags = new ArrayList<>(customTags.size()); + ArrayList oTags = new ArrayList<>(customTags.size()); + ArrayList sTags = new ArrayList<>(); Taglet current; while (it.hasNext()) { current = it.next(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java Wed Dec 18 16:05:18 2013 -0500 @@ -113,7 +113,7 @@ TagletWriter writer) { Content result = writer.getOutputInstance(); if (holder instanceof MethodDoc) { - Set declaredExceptionTags = new LinkedHashSet(); + Set declaredExceptionTags = new LinkedHashSet<>(); for (Type declaredExceptionType : declaredExceptionTypes) { DocFinder.Output inheritedDoc = DocFinder.search(new DocFinder.Input((MethodDoc) holder, this, @@ -139,7 +139,7 @@ ExecutableMemberDoc execHolder = (ExecutableMemberDoc) holder; ThrowsTag[] tags = execHolder.throwsTags(); Content result = writer.getOutputInstance(); - HashSet alreadyDocumented = new HashSet(); + HashSet alreadyDocumented = new HashSet<>(); if (tags.length > 0) { result.addContent(throwsTagsOutput( execHolder.throwsTags(), writer, alreadyDocumented, true)); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java Wed Dec 18 16:05:18 2013 -0500 @@ -114,14 +114,14 @@ } private void init() { - allClasses = new HashMap>(); - ordinaryClasses = new HashMap>(); - exceptions = new HashMap>(); - enums = new HashMap>(); - annotationTypes = new HashMap>(); - errors = new HashMap>(); - interfaces = new HashMap>(); - packageSet = new HashSet(); + allClasses = new HashMap<>(); + ordinaryClasses = new HashMap<>(); + exceptions = new HashMap<>(); + enums = new HashMap<>(); + annotationTypes = new HashMap<>(); + errors = new HashMap<>(); + interfaces = new HashMap<>(); + packageSet = new HashSet<>(); } /** @@ -166,7 +166,7 @@ Set s = map.get(key); if (s == null) { packageSet.add(key); - s = new HashSet(); + s = new HashSet<>(); } s.add(classdoc); map.put(key, s); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java Wed Dec 18 16:05:18 2013 -0500 @@ -51,35 +51,35 @@ * List of baseclasses. Contains only java.lang.Object. Can be used to get * the mapped listing of sub-classes. */ - private List baseclasses = new ArrayList(); + private List baseclasses = new ArrayList<>(); /** * Mapping for each Class with their SubClasses */ - private Map> subclasses = new HashMap>(); + private Map> subclasses = new HashMap<>(); /** * List of base-interfaces. Contains list of all the interfaces who do not * have super-interfaces. Can be used to get the mapped listing of * sub-interfaces. */ - private List baseinterfaces = new ArrayList(); + private List baseinterfaces = new ArrayList<>(); /** * Mapping for each Interface with their SubInterfaces */ - private Map> subinterfaces = new HashMap>(); + private Map> subinterfaces = new HashMap<>(); - private List baseEnums = new ArrayList(); - private Map> subEnums = new HashMap>(); + private List baseEnums = new ArrayList<>(); + private Map> subEnums = new HashMap<>(); - private List baseAnnotationTypes = new ArrayList(); - private Map> subAnnotationTypes = new HashMap>(); + private List baseAnnotationTypes = new ArrayList<>(); + private Map> subAnnotationTypes = new HashMap<>(); /** * Mapping for each Interface with classes who implement it. */ - private Map> implementingclasses = new HashMap>(); + private Map> implementingclasses = new HashMap<>(); /** * Constructor. Build the Tree using the Root of this Javadoc run. @@ -234,7 +234,7 @@ private boolean add(Map> map, ClassDoc superclass, ClassDoc cd) { List list = map.get(superclass); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); map.put(superclass, list); } if (list.contains(cd)) { @@ -256,7 +256,7 @@ private List get(Map> map, ClassDoc cd) { List list = map.get(cd); if (list == null) { - return new ArrayList(); + return new ArrayList<>(); } return list; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java Wed Dec 18 16:05:18 2013 -0500 @@ -48,138 +48,138 @@ * Mapping of ClassDocs to set of PackageDoc used by that class. * Entries may be null. */ - public Map> classToPackage = new HashMap>(); + public Map> classToPackage = new HashMap<>(); /** * Mapping of Annotations to set of PackageDoc that use the annotation. */ - public Map> classToPackageAnnotations = new HashMap>(); + public Map> classToPackageAnnotations = new HashMap<>(); /** * Mapping of ClassDocs to set of ClassDoc used by that class. * Entries may be null. */ - public Map> classToClass = new HashMap>(); + public Map> classToClass = new HashMap<>(); /** * Mapping of ClassDocs to list of ClassDoc which are direct or * indirect subclasses of that class. * Entries may be null. */ - public Map> classToSubclass = new HashMap>(); + public Map> classToSubclass = new HashMap<>(); /** * Mapping of ClassDocs to list of ClassDoc which are direct or * indirect subinterfaces of that interface. * Entries may be null. */ - public Map> classToSubinterface = new HashMap>(); + public Map> classToSubinterface = new HashMap<>(); /** * Mapping of ClassDocs to list of ClassDoc which implement * this interface. * Entries may be null. */ - public Map> classToImplementingClass = new HashMap>(); + public Map> classToImplementingClass = new HashMap<>(); /** * Mapping of ClassDocs to list of FieldDoc declared as that class. * Entries may be null. */ - public Map> classToField = new HashMap>(); + public Map> classToField = new HashMap<>(); /** * Mapping of ClassDocs to list of MethodDoc returning that class. * Entries may be null. */ - public Map> classToMethodReturn = new HashMap>(); + public Map> classToMethodReturn = new HashMap<>(); /** * Mapping of ClassDocs to list of MethodDoc having that class * as an arg. * Entries may be null. */ - public Map> classToMethodArgs = new HashMap>(); + public Map> classToMethodArgs = new HashMap<>(); /** * Mapping of ClassDocs to list of MethodDoc which throws that class. * Entries may be null. */ - public Map> classToMethodThrows = new HashMap>(); + public Map> classToMethodThrows = new HashMap<>(); /** * Mapping of ClassDocs to list of ConstructorDoc having that class * as an arg. * Entries may be null. */ - public Map> classToConstructorArgs = new HashMap>(); + public Map> classToConstructorArgs = new HashMap<>(); /** * Mapping of ClassDocs to list of ConstructorDoc which throws that class. * Entries may be null. */ - public Map> classToConstructorThrows = new HashMap>(); + public Map> classToConstructorThrows = new HashMap<>(); /** * The mapping of AnnotationTypeDocs to constructors that use them. */ - public Map> classToConstructorAnnotations = new HashMap>(); + public Map> classToConstructorAnnotations = new HashMap<>(); /** * The mapping of AnnotationTypeDocs to Constructor parameters that use them. */ - public Map> classToConstructorParamAnnotation = new HashMap>(); + public Map> classToConstructorParamAnnotation = new HashMap<>(); /** * The mapping of ClassDocs to Constructor arguments that use them as type parameters. */ - public Map> classToConstructorDocArgTypeParam = new HashMap>(); + public Map> classToConstructorDocArgTypeParam = new HashMap<>(); /** * The mapping of ClassDocs to ClassDocs that use them as type parameters. */ - public Map> classToClassTypeParam = new HashMap>(); + public Map> classToClassTypeParam = new HashMap<>(); /** * The mapping of AnnotationTypeDocs to ClassDocs that use them. */ - public Map> classToClassAnnotations = new HashMap>(); + public Map> classToClassAnnotations = new HashMap<>(); /** * The mapping of ClassDocs to ExecutableMemberDocs that use them as type parameters. */ - public Map> classToExecMemberDocTypeParam = new HashMap>(); + public Map> classToExecMemberDocTypeParam = new HashMap<>(); /** * The mapping of ClassDocs to ExecutableMemberDocs arguments that use them as type parameters. */ - public Map> classToExecMemberDocArgTypeParam = new HashMap>(); + public Map> classToExecMemberDocArgTypeParam = new HashMap<>(); /** * The mapping of AnnotationTypeDocs to ExecutableMemberDocs that use them. */ - public Map> classToExecMemberDocAnnotations = new HashMap>(); + public Map> classToExecMemberDocAnnotations = new HashMap<>(); /** * The mapping of ClassDocs to ExecutableMemberDocs that have return type * with type parameters of that class. */ - public Map> classToExecMemberDocReturnTypeParam = new HashMap>(); + public Map> classToExecMemberDocReturnTypeParam = new HashMap<>(); /** * The mapping of AnnotationTypeDocs to MethodDoc parameters that use them. */ - public Map> classToExecMemberDocParamAnnotation = new HashMap>(); + public Map> classToExecMemberDocParamAnnotation = new HashMap<>(); /** * The mapping of ClassDocs to FieldDocs that use them as type parameters. */ - public Map> classToFieldDocTypeParam = new HashMap>(); + public Map> classToFieldDocTypeParam = new HashMap<>(); /** * The mapping of AnnotationTypeDocs to FieldDocs that use them. */ - public Map> annotationToFieldDoc = new HashMap>(); + public Map> annotationToFieldDoc = new HashMap<>(); public ClassUseMapper(RootDoc root, ClassTree classtree) { @@ -234,7 +234,7 @@ private Collection subclasses(ClassDoc cd) { Collection ret = classToSubclass.get(cd.qualifiedName()); if (ret == null) { - ret = new TreeSet(); + ret = new TreeSet<>(); List subs = classtree.subclasses(cd); if (subs != null) { ret.addAll(subs); @@ -253,7 +253,7 @@ private Collection subinterfaces(ClassDoc cd) { Collection ret = classToSubinterface.get(cd.qualifiedName()); if (ret == null) { - ret = new TreeSet(); + ret = new TreeSet<>(); List subs = classtree.subinterfaces(cd); if (subs != null) { ret.addAll(subs); @@ -275,7 +275,7 @@ private Collection implementingClasses(ClassDoc cd) { Collection ret = classToImplementingClass.get(cd.qualifiedName()); if (ret == null) { - ret = new TreeSet(); + ret = new TreeSet<>(); List impl = classtree.implementingclasses(cd); if (impl != null) { ret.addAll(impl); @@ -297,7 +297,7 @@ */ private void mapExecutable(ExecutableMemberDoc em) { boolean isConstructor = em.isConstructor(); - List classArgs = new ArrayList(); + List classArgs = new ArrayList<>(); for (Parameter param : em.parameters()) { Type pcd = param.type(); // primitives don't get mapped, also avoid dups @@ -326,8 +326,7 @@ private List refList(Map> map, ClassDoc cd) { List list = map.get(cd.qualifiedName()); if (list == null) { - List l = new ArrayList(); - list = l; + list = new ArrayList<>(); map.put(cd.qualifiedName(), list); } return list; @@ -336,7 +335,7 @@ private Set packageSet(ClassDoc cd) { Set pkgSet = classToPackage.get(cd.qualifiedName()); if (pkgSet == null) { - pkgSet = new TreeSet(); + pkgSet = new TreeSet<>(); classToPackage.put(cd.qualifiedName(), pkgSet); } return pkgSet; @@ -345,8 +344,7 @@ private Set classSet(ClassDoc cd) { Set clsSet = classToClass.get(cd.qualifiedName()); if (clsSet == null) { - Set s = new TreeSet(); - clsSet = s; + clsSet = new TreeSet<>(); classToClass.put(cd.qualifiedName(), clsSet); } return clsSet; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -69,9 +69,9 @@ * @param configuration the current configuration of the doclet */ public DeprecatedAPIListBuilder(Configuration configuration) { - deprecatedLists = new ArrayList>(); + deprecatedLists = new ArrayList<>(); for (int i = 0; i < NUM_TYPES; i++) { - deprecatedLists.add(i, new ArrayList()); + deprecatedLists.add(i, new ArrayList<>()); } buildDeprecatedAPIInfo(configuration); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java Wed Dec 18 16:05:18 2013 -0500 @@ -46,8 +46,7 @@ * @since 1.8 */ abstract class DocFileFactory { - private static final Map factories = - new WeakHashMap(); + private static final Map factories = new WeakHashMap<>(); /** * Get the appropriate factory, based on the file manager given in the diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java Wed Dec 18 16:05:18 2013 -0500 @@ -171,7 +171,7 @@ * subclass of IOException. This subclass of DocFinder.Output allows * multiple tag inheritence. */ - public List tagList = new ArrayList(); + public List tagList = new ArrayList<>(); } /** diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java Wed Dec 18 16:05:18 2013 -0500 @@ -68,7 +68,7 @@ public static final DocPath INDEX_FILES = DocPath.create("index-files"); /** Generate the name of one of the files in the split index. */ - public static final DocPath indexN(int n) { + public static DocPath indexN(int n) { return DocPath.create("index-" + n + ".html"); } @@ -88,22 +88,22 @@ public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html"); /** The name of the file for the profile frame. */ - public static final DocPath profileFrame(String profileName) { + public static DocPath profileFrame(String profileName) { return DocPath.create(profileName + "-frame.html"); } /** The name of the file for the profile package frame. */ - public static final DocPath profilePackageFrame(String profileName) { + public static DocPath profilePackageFrame(String profileName) { return DocPath.create(profileName + "-package-frame.html"); } /** The name of the file for the profile package summary. */ - public static final DocPath profilePackageSummary(String profileName) { + public static DocPath profilePackageSummary(String profileName) { return DocPath.create(profileName + "-package-summary.html"); } /** The name of the file for the profile summary. */ - public static final DocPath profileSummary(String profileName) { + public static DocPath profileSummary(String profileName) { return DocPath.create(profileName + "-summary.html"); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java Wed Dec 18 16:05:18 2013 -0500 @@ -104,7 +104,7 @@ this.path = path; this.relative = relative; if (packageToItemMap == null) { - packageToItemMap = new HashMap(); + packageToItemMap = new HashMap<>(); } if (!packageToItemMap.containsKey(packageName)) { // save the previous packageToItemMap.put(packageName, this); // mapped location diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java Wed Dec 18 16:05:18 2013 -0500 @@ -61,24 +61,24 @@ /** * Map of regular expressions with the corresponding group name. */ - private Map regExpGroupMap = new HashMap(); + private Map regExpGroupMap = new HashMap<>(); /** * List of regular expressions sorted according to the length. Regular * expression with longest length will be first in the sorted order. */ - private List sortedRegExpList = new ArrayList(); + private List sortedRegExpList = new ArrayList<>(); /** * List of group names in the same order as given on the command line. */ - private List groupList = new ArrayList(); + private List groupList = new ArrayList<>(); /** * Map of non-regular expressions(possible package names) with the * corresponding group name. */ - private Map pkgNameGroupMap = new HashMap(); + private Map pkgNameGroupMap = new HashMap<>(); /** * The global configuration information for this run. @@ -176,7 +176,7 @@ * @param packages Packages specified on the command line. */ public Map> groupPackages(PackageDoc[] packages) { - Map> groupPackageMap = new HashMap>(); + Map> groupPackageMap = new HashMap<>(); String defaultGroupName = (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? configuration.message.getText("doclet.Packages") : @@ -229,7 +229,7 @@ List getPkgList(Map> map, String groupname) { List list = map.get(groupname); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); map.put(groupname, list); } return list; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java Wed Dec 18 16:05:18 2013 -0500 @@ -43,8 +43,8 @@ */ public class ImplementedMethods { - private Map interfaces = new HashMap(); - private List methlist = new ArrayList(); + private Map interfaces = new HashMap<>(); + private List methlist = new ArrayList<>(); private Configuration configuration; private final ClassDoc classdoc; private final MethodDoc method; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java Wed Dec 18 16:05:18 2013 -0500 @@ -51,7 +51,7 @@ * Mapping of each Unicode Character with the member list containing * members with names starting with it. */ - private Map> indexmap = new HashMap>(); + private Map> indexmap = new HashMap<>(); /** * Don't generate deprecated information if true. @@ -149,7 +149,7 @@ ClassDoc[] classes = root.classes(); if (!classesOnly) { if (packages.length == 0) { - Set set = new HashSet(); + Set set = new HashSet<>(); for (ClassDoc aClass : classes) { PackageDoc pd = aClass.containingPackage(); if (pd != null && pd.name().length() > 0) { @@ -202,7 +202,7 @@ Character unicode = ch; List list = indexmap.get(unicode); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); indexmap.put(unicode, list); } list.add(element); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java Wed Dec 18 16:05:18 2013 -0500 @@ -71,7 +71,7 @@ * definitions are on separate pages. */ public String[] getMetaKeywords(ClassDoc classdoc) { - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList<>(); // Add field and method keywords only if -keywords option is used if( configuration.keywords ) { @@ -88,7 +88,7 @@ */ protected ArrayList getClassKeyword(ClassDoc classdoc) { String cltypelower = classdoc.isInterface() ? "interface" : "class"; - ArrayList metakeywords = new ArrayList(1); + ArrayList metakeywords = new ArrayList<>(1); metakeywords.add(classdoc.qualifiedName() + " " + cltypelower); return metakeywords; } @@ -145,7 +145,7 @@ * @param memberdocs array of MemberDoc objects to be added to keywords */ protected ArrayList getMemberKeywords(MemberDoc[] memberdocs) { - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList<>(); String membername; for (MemberDoc memberdoc : memberdocs) { membername = memberdoc.name() + (memberdoc.isMethod() ? "()" : ""); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -76,7 +76,7 @@ } protected void generatePackageListFile(RootDoc root) { - ArrayList names = new ArrayList(); + ArrayList names = new ArrayList<>(); for (PackageDoc pkg : configuration.packages) { // if the -nodeprecated option is set and the package is marked as // deprecated, do not include it in the packages list. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Wed Dec 18 16:05:18 2013 -0500 @@ -102,7 +102,7 @@ if (location != StandardLocation.SOURCE_PATH) throw new IllegalArgumentException(); - Set files = new LinkedHashSet(); + Set files = new LinkedHashSet<>(); if (fileManager.hasLocation(location)) { for (Path f: fileManager.getLocation(location)) { if (Files.isDirectory(f)) { @@ -221,7 +221,7 @@ /** If the file is a directory, list its contents. */ public Iterable list() throws IOException { - List files = new ArrayList(); + List files = new ArrayList<>(); try (DirectoryStream ds = Files.newDirectoryStream(file)) { for (Path f: ds) { files.add(new StandardDocFile(f)); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/SimpleDocFileFactory.java Wed Dec 18 16:05:18 2013 -0500 @@ -83,7 +83,7 @@ if (location != StandardLocation.SOURCE_PATH) throw new IllegalArgumentException(); - Set files = new LinkedHashSet(); + Set files = new LinkedHashSet<>(); for (String s : configuration.sourcepath.split(File.pathSeparator)) { if (s.isEmpty()) continue; @@ -206,7 +206,7 @@ /** If the file is a directory, list its contents. */ public Iterable list() { - List files = new ArrayList(); + List files = new ArrayList<>(); for (File f: file.listFiles()) { files.add(new SimpleDocFile(f)); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java Wed Dec 18 16:05:18 2013 -0500 @@ -105,7 +105,7 @@ if (location != StandardLocation.SOURCE_PATH) throw new IllegalArgumentException(); - Set files = new LinkedHashSet(); + Set files = new LinkedHashSet<>(); Location l = fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; for (File f: fileManager.getLocation(l)) { @@ -231,7 +231,7 @@ /** If the file is a directory, list its contents. */ public Iterable list() { - List files = new ArrayList(); + List files = new ArrayList<>(); for (File f: file.listFiles()) { files.add(new StandardDocFile(f)); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Wed Dec 18 16:05:18 2013 -0500 @@ -76,7 +76,7 @@ */ public static List excludeDeprecatedMembersAsList( ProgramElementDoc[] members) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (ProgramElementDoc member : members) { if (member.tags("deprecated").length == 0) { list.add(member); @@ -273,7 +273,7 @@ */ public static List getAllInterfaces(Type type, Configuration configuration, boolean sort) { - Map results = sort ? new TreeMap() : new LinkedHashMap(); + Map results = sort ? new TreeMap<>() : new LinkedHashMap<>(); Type[] interfaceTypes = null; Type superType = null; if (type instanceof ParameterizedType) { @@ -300,13 +300,13 @@ } } if (superType == null) - return new ArrayList(results.values()); + return new ArrayList<>(results.values()); //Try walking the tree. addAllInterfaceTypes(results, superType, interfaceTypesOf(superType), false, configuration); - List resultsList = new ArrayList(results.values()); + List resultsList = new ArrayList<>(results.values()); if (sort) { Collections.sort(resultsList, new TypeComparator()); } @@ -744,8 +744,7 @@ if (!javafx) { return classes; } - final List filteredOutClasses = - new ArrayList(classes.length); + final List filteredOutClasses = new ArrayList<>(classes.length); for (ClassDoc classDoc : classes) { if (classDoc.isPrivate() || classDoc.isPackagePrivate()) { continue; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java Wed Dec 18 16:05:18 2013 -0500 @@ -70,19 +70,19 @@ /** * List of ClassDoc objects for which ClassMembers objects are built. */ - private final List visibleClasses = new ArrayList(); + private final List visibleClasses = new ArrayList<>(); /** * Map for each member name on to a map which contains members with same * name-signature. The mapped map will contain mapping for each MemberDoc * onto it's respecive level string. */ - private final Map> memberNameMap = new HashMap>(); + private final Map> memberNameMap = new HashMap<>(); /** * Map of class and it's ClassMembers object. */ - private final Map classMap = new HashMap(); + private final Map classMap = new HashMap<>(); /** * Type whose visible members are requested. This is the leaf of @@ -100,12 +100,9 @@ */ private final Configuration configuration; - private static final Map propertiesCache = - new HashMap(); - private static final Map classPropertiesMap = - new HashMap(); - private static final Map getterSetterMap = - new HashMap(); + private static final Map propertiesCache = new HashMap<>(); + private static final Map classPropertiesMap = new HashMap<>(); + private static final Map getterSetterMap = new HashMap<>(); /** * Construct a VisibleMemberMap of the given type for the given @@ -172,7 +169,7 @@ * @return the package private members inherited by the class. */ private List getInheritedPackagePrivateMethods(Configuration configuration) { - List results = new ArrayList(); + List results = new ArrayList<>(); for (ClassDoc currentClass : visibleClasses) { if (currentClass != classdoc && currentClass.isPackagePrivate() && @@ -208,7 +205,7 @@ public List getMembersFor(ClassDoc cd) { ClassMembers clmembers = classMap.get(cd); if (clmembers == null) { - return new ArrayList(); + return new ArrayList<>(); } return clmembers.getMembers(); } @@ -218,8 +215,8 @@ * classes followed by interfaces traversed. Don't sort alphabetically. */ private void sort(List list) { - List classes = new ArrayList(); - List interfaces = new ArrayList(); + List classes = new ArrayList<>(); + List interfaces = new ArrayList<>(); for (ClassDoc cd : list) { if (cd.isClass()) { classes.add(cd); @@ -238,7 +235,7 @@ Object key = getMemberKey(element); Map memberLevelMap = memberNameMap.get(key); if (memberLevelMap == null) { - memberLevelMap = new HashMap(); + memberLevelMap = new HashMap<>(); memberNameMap.put(key, memberLevelMap); } memberLevelMap.put(element, level); @@ -263,7 +260,7 @@ private Set members; public ClassMember(ProgramElementDoc programElementDoc) { - members = new HashSet(); + members = new HashSet<>(); members.add(programElementDoc); } @@ -297,7 +294,7 @@ /** * List of inherited members from the mapping class. */ - private List members = new ArrayList(); + private List members = new ArrayList<>(); /** * Level/Depth of inheritance. @@ -368,7 +365,7 @@ */ private void addMembers(ClassDoc fromClass) { List cdmembers = getClassMembers(fromClass, true); - List incllist = new ArrayList(); + List incllist = new ArrayList<>(); for (ProgramElementDoc pgmelem : cdmembers) { if (!found(members, pgmelem) && memberIsVisible(pgmelem) && @@ -487,7 +484,7 @@ private AnnotationTypeElementDoc[] filter(AnnotationTypeDoc doc, boolean required) { AnnotationTypeElementDoc[] members = doc.elements(); - List targetMembers = new ArrayList(); + List targetMembers = new ArrayList<>(); for (AnnotationTypeElementDoc member : members) { if ((required && member.defaultValue() == null) || ((!required) && member.defaultValue() != null)) { @@ -534,7 +531,7 @@ return propertiesCache.get(cd); } - final List result = new ArrayList(); + final List result = new ArrayList<>(); for (final MethodDoc propertyMethod : allMethods) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclint/DocLint.java --- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java Wed Dec 18 16:05:18 2013 -0500 @@ -306,7 +306,7 @@ } } - Queue todo = new LinkedList(); + Queue todo = new LinkedList<>(); }; task.addTaskListener(tl); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclint/Entity.java --- a/langtools/src/share/classes/com/sun/tools/doclint/Entity.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclint/Entity.java Wed Dec 18 16:05:18 2013 -0500 @@ -312,8 +312,8 @@ return codes.containsKey(code) || ( 32 <= code && code < 2127); } - private static final Map names = new HashMap(); - private static final Map codes = new HashMap(); + private static final Map names = new HashMap<>(); + private static final Map codes = new HashMap<>(); static { for (Entity e: values()) { String name = e.name(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclint/Env.java --- a/langtools/src/share/classes/com/sun/tools/doclint/Env.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclint/Env.java Wed Dec 18 16:05:18 2013 -0500 @@ -81,7 +81,7 @@ else return AccessKind.PACKAGE; } - }; + } /** Message handler. */ final Messages messages; @@ -140,7 +140,7 @@ } void setCustomTags(String cTags) { - customTags = new LinkedHashSet(); + customTags = new LinkedHashSet<>(); for (String s : cTags.split(DocLint.TAGS_SEPARATOR)) { if (!s.isEmpty()) customTags.add(s); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java --- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java Wed Dec 18 16:05:18 2013 -0500 @@ -291,7 +291,7 @@ INLINE, LIST_ITEM, TABLE_ITEM, - OTHER; + OTHER } /** @@ -300,7 +300,7 @@ public static enum EndKind { NONE, OPTIONAL, - REQUIRED; + REQUIRED } public static enum Flag { @@ -356,7 +356,7 @@ return StringUtils.toLowerCase(name()); } - static final Map index = new HashMap(); + static final Map index = new HashMap<>(); static { for (Attr t: values()) { index.put(t.getText(), t); @@ -394,7 +394,7 @@ this.blockType = blockType; this.endKind = endKind; this.flags = flags; - this.attrs = new EnumMap(Attr.class); + this.attrs = new EnumMap<>(Attr.class); for (Map m: attrMaps) this.attrs.putAll(m); attrs.put(Attr.CLASS, AttrKind.OK); @@ -450,7 +450,7 @@ return map; } - private static final Map index = new HashMap(); + private static final Map index = new HashMap<>(); static { for (HtmlTag t: values()) { index.put(t.getText(), t); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/doclint/Messages.java --- a/langtools/src/share/classes/com/sun/tools/doclint/Messages.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/doclint/Messages.java Wed Dec 18 16:05:18 2013 -0500 @@ -76,7 +76,7 @@ if (opt.equals(g.optName())) return true; return false; } - }; + } private final Options options; private final Stats stats; @@ -154,7 +154,7 @@ * Handler for (sub)options specific to message handling. */ static class Options { - Map map = new HashMap(); + Map map = new HashMap<>(); private final Stats stats; static boolean isValidOptions(String opts) { @@ -256,7 +256,7 @@ if (b) { groupCounts = new int[Messages.Group.values().length]; dkindCounts = new int[Diagnostic.Kind.values().length]; - codeCounts = new HashMap(); + codeCounts = new HashMap<>(); } else { groupCounts = null; dkindCounts = null; @@ -321,7 +321,7 @@ return o2.compareTo(o1); } }; - private final TreeMap> map = new TreeMap>(DECREASING); + private final TreeMap> map = new TreeMap<>(DECREASING); void put(String label, int n) { if (n == 0) { @@ -329,7 +329,7 @@ } Set labels = map.get(n); if (labels == null) { - map.put(n, labels = new TreeSet()); + map.put(n, labels = new TreeSet<>()); } labels.add(label); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java Wed Dec 18 16:05:18 2013 -0500 @@ -107,7 +107,7 @@ Map, Boolean> trustedClasses; protected ClientCodeWrapper(Context context) { - trustedClasses = new HashMap, Boolean>(); + trustedClasses = new HashMap<>(); } public JavaFileManager wrap(JavaFileManager fm) { @@ -136,7 +136,7 @@ } public Iterable wrapJavaFileObjects(Iterable list) { - List wrapped = new ArrayList(); + List wrapped = new ArrayList<>(); for (JavaFileObject fo : list) wrapped.add(wrap(fo)); return Collections.unmodifiableList(wrapped); @@ -152,7 +152,7 @@ public DiagnosticListener wrap(DiagnosticListener dl) { if (isTrusted(dl)) return dl; - return new WrappedDiagnosticListener(dl); + return new WrappedDiagnosticListener<>(dl); } TaskListener wrap(TaskListener tl) { @@ -169,7 +169,7 @@ } Collection unwrap(Collection listeners) { - Collection c = new ArrayList(listeners.size()); + Collection c = new ArrayList<>(listeners.size()); for (TaskListener l: listeners) c.add(unwrap(l)); return c; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/DiagnosticFormatter.java Wed Dec 18 16:05:18 2013 -0500 @@ -176,7 +176,7 @@ /** * JLS paragraph this diagnostic might refer to (if applicable). */ - JLS; + JLS } /** @@ -212,7 +212,7 @@ * Controls the maximum amount of subdiagnostics that are part of a * given multiline diagnostic. */ - LENGTH; + LENGTH } } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -105,7 +105,7 @@ } static private String[] toArray(Iterable iter) { - ListBuffer result = new ListBuffer(); + ListBuffer result = new ListBuffer<>(); if (iter != null) for (String s : iter) result.append(s); @@ -115,7 +115,7 @@ static private List toList(Iterable fileObjects) { if (fileObjects == null) return List.nil(); - ListBuffer result = new ListBuffer(); + ListBuffer result = new ListBuffer<>(); for (JavaFileObject fo : fileObjects) result.append(fo); return result.toList(); @@ -124,7 +124,7 @@ public Main.Result doCall() { if (!used.getAndSet(true)) { initContext(); - notYetEntered = new HashMap(); + notYetEntered = new HashMap<>(); compilerMain.setAPIMode(true); result = compilerMain.compile(args, classNames, context, fileObjects, processors); cleanup(); @@ -160,7 +160,7 @@ initContext(); compilerMain.log = Log.instance(context); compilerMain.setOptions(Options.instance(context)); - compilerMain.filenames = new LinkedHashSet(); + compilerMain.filenames = new LinkedHashSet<>(); Collection filenames = compilerMain.processArgs(CommandLine.parse(args), classNames); if (filenames != null && !filenames.isEmpty()) throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " ")); @@ -169,10 +169,10 @@ compiler.genEndPos = true; // NOTE: this value will be updated after annotation processing compiler.initProcessAnnotations(processors); - notYetEntered = new HashMap(); + notYetEntered = new HashMap<>(); for (JavaFileObject file: fileObjects) notYetEntered.put(file, null); - genList = new ListBuffer>(); + genList = new ListBuffer<>(); // endContext will be called when all classes have been generated // TODO: should handle the case after each phase if errors have occurred args = null; @@ -289,7 +289,7 @@ JCCompilationUnit unit = notYetEntered.remove(file); if (unit != null) { if (roots == null) - roots = new ListBuffer(); + roots = new ListBuffer<>(); roots.append(unit); } } @@ -300,7 +300,7 @@ for (CompilationUnitTree cu : trees) { if (cu instanceof JCCompilationUnit) { if (roots == null) - roots = new ListBuffer(); + roots = new ListBuffer<>(); roots.append((JCCompilationUnit)cu); notYetEntered.remove(cu.getSourceFile()); } @@ -318,7 +318,7 @@ if (notYetEntered.isEmpty()) compiler = compiler.processAnnotations(units); - ListBuffer elements = new ListBuffer(); + ListBuffer elements = new ListBuffer<>(); for (JCCompilationUnit unit : units) { for (JCTree node : unit.defs) { if (node.hasTag(JCTree.Tag.CLASSDEF)) { @@ -358,7 +358,7 @@ public Iterable analyze(Iterable classes) throws IOException { enter(null); // ensure all classes have been entered - final ListBuffer results = new ListBuffer(); + final ListBuffer results = new ListBuffer<>(); try { if (classes == null) { handleFlowResults(compiler.flow(compiler.attribute(compiler.todo)), results); @@ -414,7 +414,7 @@ * @param classes a list of class elements */ public Iterable generate(Iterable classes) throws IOException { - final ListBuffer results = new ListBuffer(); + final ListBuffer results = new ListBuffer<>(); try { analyze(null); // ensure all classes have been parsed, entered, and analyzed @@ -468,7 +468,7 @@ abstract class Filter { void run(Queue> list, Iterable classes) { - Set set = new HashSet(); + Set set = new HashSet<>(); for (TypeElement item: classes) set.add(item); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Wed Dec 18 16:05:18 2013 -0500 @@ -398,7 +398,7 @@ if (ref.paramTypes == null) paramTypes = null; else { - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (List l = ref.paramTypes; l.nonEmpty(); l = l.tail) { JCTree tree = l.head; Type t = attr.attribType(tree, env); @@ -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<>()); } /** @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 paramTypes) { - return searchMethod(tsym, methodName, paramTypes, new HashSet()); + return searchMethod(tsym, methodName, paramTypes, new HashSet<>()); } /** @see com.sun.tools.javadoc.ClassDocImpl#searchMethod */ diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/api/MultiTaskListener.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/MultiTaskListener.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/MultiTaskListener.java Wed Dec 18 16:05:18 2013 -0500 @@ -42,8 +42,7 @@ */ public class MultiTaskListener implements TaskListener { /** The context key for the MultiTaskListener. */ - public static final Context.Key taskListenerKey = - new Context.Key(); + public static final Context.Key taskListenerKey = new Context.Key<>(); /** Get the MultiTaskListener instance for this context. */ public static MultiTaskListener instance(Context context) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/WrappingJavaFileManager.java Wed Dec 18 16:05:18 2013 -0500 @@ -115,7 +115,7 @@ * @return the mapping */ protected Iterable wrap(Iterable fileObjects) { - List mapped = new ArrayList(); + List mapped = new ArrayList<>(); for (JavaFileObject fileObject : fileObjects) mapped.add(wrap(fileObject)); return Collections.unmodifiableList(mapped); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Wed Dec 18 16:05:18 2013 -0500 @@ -64,7 +64,7 @@ return false; } - public TypeAnnotationPosition getPosition() { return null; }; + public TypeAnnotationPosition getPosition() { return null; } /** The value for an annotation element of primitive type or String. */ public static class Constant extends Attribute { @@ -226,8 +226,7 @@ } public Map getElementValues() { - Map valmap = - new LinkedHashMap(); + Map valmap = new LinkedHashMap<>(); for (Pair value : values) valmap.put(value.fst, value.snd); return valmap; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java Wed Dec 18 16:05:18 2013 -0500 @@ -43,8 +43,7 @@ * deletion without notice. */ public class DeferredLintHandler { - protected static final Context.Key deferredLintHandlerKey = - new Context.Key(); + protected static final Context.Key deferredLintHandlerKey = new Context.Key<>(); public static DeferredLintHandler instance(Context context) { DeferredLintHandler instance = context.get(deferredLintHandlerKey); @@ -67,7 +66,7 @@ } private DiagnosticPosition currentPos; - private Map> loggersQueue = new HashMap>(); + private Map> loggersQueue = new HashMap<>(); /**Associate the given logger with the current position as set by {@link #setPos(DiagnosticPosition) }. * Will be invoked when {@link #flush(DiagnosticPosition) } will be invoked with the same position. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Flags.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Wed Dec 18 16:05:18 2013 -0500 @@ -29,6 +29,7 @@ import java.util.EnumSet; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import javax.lang.model.element.Modifier; @@ -322,8 +323,7 @@ } // Cache of modifier sets. - private static final Map> modifierSets = - new java.util.concurrent.ConcurrentHashMap>(64); + private static final Map> modifierSets = new ConcurrentHashMap<>(64); public static boolean isStatic(Symbol symbol) { return (symbol.flags() & STATIC) != 0; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Lint.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Wed Dec 18 16:05:18 2013 -0500 @@ -27,6 +27,8 @@ import java.util.EnumSet; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.List; @@ -44,7 +46,7 @@ public class Lint { /** The context key for the root Lint object. */ - protected static final Context.Key lintKey = new Context.Key(); + protected static final Context.Key lintKey = new Context.Key<>(); /** Get the root Lint instance. */ public static Lint instance(Context context) { @@ -83,8 +85,7 @@ private final EnumSet values; private final EnumSet suppressedValues; - private static final Map map = - new java.util.concurrent.ConcurrentHashMap(20); + private static final Map map = new ConcurrentHashMap<>(20); protected Lint(Context context) { // initialize values according to the lint options @@ -242,7 +243,7 @@ public final String option; public final boolean hidden; - }; + } /** * Checks if a warning category is enabled. A warning category may be enabled @@ -341,5 +342,5 @@ public void visitError(Attribute.Error e) { } - }; + } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Source.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Wed Dec 18 16:05:18 2013 -0500 @@ -73,8 +73,7 @@ /** 1.9 covers the to be determined language features that will be added in JDK 9. */ JDK1_9("1.9"); - private static final Context.Key sourceKey - = new Context.Key(); + private static final Context.Key sourceKey = new Context.Key<>(); public static Source instance(Context context) { Source instance = context.get(sourceKey); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed Dec 18 16:05:18 2013 -0500 @@ -1541,7 +1541,7 @@ if (paramNames == null || paramNames.size() != type.getParameterTypes().size()) { paramNames = List.nil(); } - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); List remaining = paramNames; // assert: remaining and paramNames are both empty or both // have same cardinality as type.getParameterTypes() diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java Wed Dec 18 16:05:18 2013 -0500 @@ -180,7 +180,7 @@ // are introduced, because PlaceHolder is a subtype of TypeCompound. T res; @SuppressWarnings("unchecked") - T ph = (T) new Placeholder(ctx, lb.toList(), sym); + T ph = (T) new Placeholder<>(ctx, lb.toList(), sym); res = ph; buf = buf.prepend(res); atLeastOneRepeated = true; @@ -244,7 +244,7 @@ attributes = filterDeclSentinels(attributes); if (l.isEmpty()) { - ; // no-op + // no-op } else if (attributes.isEmpty()) { attributes = l; } else { @@ -255,7 +255,7 @@ public SymbolMetadata appendUniqueTypes(List l) { if (l.isEmpty()) { - ; // no-op + // no-op } else if (type_attributes.isEmpty()) { type_attributes = l; } else { @@ -271,7 +271,7 @@ public SymbolMetadata appendInitTypeAttributes(List l) { if (l.isEmpty()) { - ; // no-op + // no-op } else if (init_type_attributes.isEmpty()) { init_type_attributes = l; } else { @@ -282,7 +282,7 @@ public SymbolMetadata appendClassInitTypeAttributes(List l) { if (l.isEmpty()) { - ; // no-op + // no-op } else if (clinit_type_attributes.isEmpty()) { clinit_type_attributes = l; } else { @@ -295,7 +295,7 @@ attributes = filterDeclSentinels(attributes); if (l.isEmpty()) { - ; // no-op + // no-op } else if (attributes.isEmpty()) { attributes = l; } else { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Dec 18 16:05:18 2013 -0500 @@ -51,8 +51,7 @@ */ public class Symtab { /** The context key for the symbol table. */ - protected static final Context.Key symtabKey = - new Context.Key(); + protected static final Context.Key symtabKey = new Context.Key<>(); /** Get the symbol table instance. */ public static Symtab instance(Context context) { @@ -190,20 +189,20 @@ /** A set containing all operator names. */ - public final Set operatorNames = new HashSet(); + public final Set operatorNames = new HashSet<>(); /** A hashtable containing the encountered top-level and member classes, * indexed by flat names. The table does not contain local classes. * It should be updated from the outside to reflect classes defined * by compiled source files. */ - public final Map classes = new HashMap(); + public final Map classes = new HashMap<>(); /** A hashtable containing the encountered packages. * the table should be updated from outside to reflect packages defined * by compiled source files. */ - public final Map packages = new HashMap(); + public final Map packages = new HashMap<>(); public void initType(Type type, ClassSymbol c) { type.tsym = c; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Type.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Wed Dec 18 16:05:18 2013 -0500 @@ -1450,7 +1450,7 @@ /** lower bounds */ LOWER, /** equality constraints */ - EQ; + EQ } /** inference variable bounds */ @@ -1472,7 +1472,7 @@ public UndetVar(TypeVar origin, Types types) { super(UNDETVAR, origin); - bounds = new EnumMap>(InferenceBound.class); + bounds = new EnumMap<>(InferenceBound.class); List declaredBounds = types.getBounds(origin); declaredCount = declaredBounds.length(); bounds.put(InferenceBound.UPPER, declaredBounds); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Wed Dec 18 16:05:18 2013 -0500 @@ -82,8 +82,7 @@ * and determine the TypeAnnotationPositions for all type annotations. */ public class TypeAnnotations { - protected static final Context.Key typeAnnosKey = - new Context.Key(); + protected static final Context.Key typeAnnosKey = new Context.Key<>(); public static TypeAnnotations instance(Context context) { TypeAnnotations instance = context.get(typeAnnosKey); @@ -155,7 +154,7 @@ new TypeAnnotationPositions(false).scan(tree); } - public enum AnnotationType { DECLARATION, TYPE, BOTH }; + public enum AnnotationType { DECLARATION, TYPE, BOTH } /** * Determine whether an annotation is a declaration annotation, @@ -286,9 +285,9 @@ private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym, TypeAnnotationPosition pos) { List annotations = sym.getRawAttributes(); - ListBuffer declAnnos = new ListBuffer(); - ListBuffer typeAnnos = new ListBuffer(); - ListBuffer onlyTypeAnnos = new ListBuffer(); + ListBuffer declAnnos = new ListBuffer<>(); + ListBuffer typeAnnos = new ListBuffer<>(); + ListBuffer onlyTypeAnnos = new ListBuffer<>(); for (Attribute.Compound a : annotations) { switch (annotationType(a, sym)) { @@ -351,7 +350,7 @@ MethodType methType = sym.owner.type.asMethodType(); List params = ((MethodSymbol)sym.owner).params; List oldArgs = methType.argtypes; - ListBuffer newArgs = new ListBuffer(); + ListBuffer newArgs = new ListBuffer<>(); while (params.nonEmpty()) { if (params.head == sym) { newArgs.add(type); @@ -1224,8 +1223,7 @@ private void copyNewClassAnnotationsToOwner(JCNewClass tree) { Symbol sym = tree.def.sym; TypeAnnotationPosition pos = new TypeAnnotationPosition(); - ListBuffer newattrs = - new ListBuffer(); + ListBuffer newattrs = new ListBuffer<>(); for (Attribute.TypeCompound old : sym.getRawTypeAttributes()) { newattrs.append(new Attribute.TypeCompound(old.type, old.values, diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/code/Types.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Dec 18 16:05:18 2013 -0500 @@ -75,8 +75,7 @@ * deletion without notice. */ public class Types { - protected static final Context.Key typesKey = - new Context.Key(); + protected static final Context.Key typesKey = new Context.Key<>(); final Symtab syms; final JavacMessages messages; @@ -247,8 +246,8 @@ Type base = asSuper(sym.type, t.tsym); if (base == null) return null; - ListBuffer from = new ListBuffer(); - ListBuffer to = new ListBuffer(); + ListBuffer from = new ListBuffer<>(); + ListBuffer to = new ListBuffer<>(); try { adapt(base, t, from, to); } catch (AdaptFailure ex) { @@ -257,7 +256,7 @@ Type res = subst(sym.type, from.toList(), to.toList()); if (!isSubtype(res, t)) return null; - ListBuffer openVars = new ListBuffer(); + ListBuffer openVars = new ListBuffer<>(); for (List l = sym.type.allparams(); l.nonEmpty(); l = l.tail) if (res.contains(l.head) && !t.contains(l.head)) @@ -269,7 +268,7 @@ } else { // Unbound type arguments default to ? List opens = openVars.toList(); - ListBuffer qs = new ListBuffer(); + ListBuffer qs = new ListBuffer<>(); for (List iter = opens; iter.nonEmpty(); iter = iter.tail) { qs.append(new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass, (TypeVar) iter.head.unannotatedType())); } @@ -347,7 +346,7 @@ */ class DescriptorCache { - private WeakHashMap _map = new WeakHashMap(); + private WeakHashMap _map = new WeakHashMap<>(); class FunctionDescriptor { Symbol descSym; @@ -727,7 +726,7 @@ !overridesObjectMethod(origin, sym) && (interfaceCandidates(origin.type, (MethodSymbol)sym).head.flags() & DEFAULT) == 0; } - }; + } // /** @@ -864,7 +863,7 @@ } } - private Set cache = new HashSet(); + private Set cache = new HashSet<>(); private boolean containsTypeRecursive(Type t, Type s) { TypePair pair = new TypePair(t, s); @@ -1144,7 +1143,7 @@ if (!visit(supertype(t), supertype(s))) return false; - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); for (Type x : interfaces(t)) set.add(new UniqueType(x.unannotatedType(), Types.this)); for (Type x : interfaces(s)) { @@ -1232,9 +1231,9 @@ protected boolean containsTypes(List ts1, List ts2) { return containsTypeEquivalent(ts1, ts2); } - }; - - /** + } + + /** * Strict type-equality relation - type variables are considered * equals if they share the same object identity. */ @@ -1707,7 +1706,7 @@ // where private TypeRelation disjointType = new TypeRelation() { - private Set cache = new HashSet(); + private Set cache = new HashSet<>(); @Override public Boolean visitType(Type t, Type s) { @@ -2446,7 +2445,7 @@ // // - Map isDerivedRawCache = new HashMap(); + Map isDerivedRawCache = new HashMap<>(); public boolean isDerivedRaw(Type t) { Boolean result = isDerivedRawCache.get(t); @@ -2608,8 +2607,7 @@ // class ImplementationCache { - private WeakHashMap>> _map = - new WeakHashMap>>(); + private WeakHashMap>> _map = new WeakHashMap<>(); class Entry { final MethodSymbol cachedImpl; @@ -2638,8 +2636,8 @@ SoftReference> ref_cache = _map.get(ms); Map cache = ref_cache != null ? ref_cache.get() : null; if (cache == null) { - cache = new HashMap(); - _map.put(ms, new SoftReference>(cache)); + cache = new HashMap<>(); + _map.put(ms, new SoftReference<>(cache)); } Entry e = cache.get(origin); CompoundScope members = membersClosure(origin.type, true); @@ -2681,8 +2679,7 @@ // class MembersClosureCache extends SimpleVisitor { - private WeakHashMap _map = - new WeakHashMap(); + private WeakHashMap _map = new WeakHashMap<>(); class Entry { final boolean skipInterfaces; @@ -2800,7 +2797,7 @@ s.isInheritedIn(site.tsym, Types.this) && overrideEquivalent(memberType(site, s), memberType(site, msym)); } - }; + } // /** @@ -2856,9 +2853,9 @@ public Boolean visitErrorType(ErrorType t, Type s) { return false; } - }; - - TypeRelation hasSameArgs_strict = new HasSameArgs(true); + } + + TypeRelation hasSameArgs_strict = new HasSameArgs(true); TypeRelation hasSameArgs_nonstrict = new HasSameArgs(false); // @@ -3301,7 +3298,7 @@ * (that is, subclasses come first, arbitrary but fixed * otherwise). */ - private Map> closureCache = new HashMap>(); + private Map> closureCache = new HashMap<>(); /** * Returns the closure of a class or interface type. @@ -3404,13 +3401,13 @@ && isSameType(t2, typePair.t2); } } - Set mergeCache = new HashSet(); + Set mergeCache = new HashSet<>(); private Type merge(Type c1, Type c2) { ClassType class1 = (ClassType) c1; List act1 = class1.getTypeArguments(); ClassType class2 = (ClassType) c2; List act2 = class2.getTypeArguments(); - ListBuffer merged = new ListBuffer(); + ListBuffer merged = new ListBuffer<>(); List typarams = class1.tsym.type.getTypeArguments(); while (act1.nonEmpty() && act2.nonEmpty() && typarams.nonEmpty()) { @@ -4090,7 +4087,7 @@ Adapter(ListBuffer from, ListBuffer to) { this.from = from; this.to = to; - mapping = new HashMap(); + mapping = new HashMap<>(); } public void adapt(Type source, Type target) throws AdaptFailure { @@ -4159,7 +4156,7 @@ return null; } - private Set cache = new HashSet(); + private Set cache = new HashSet<>(); private void adaptRecursive(Type source, Type target) { TypePair pair = new TypePair(source, target); @@ -4233,7 +4230,7 @@ @Override public Type visitClassType(ClassType t, Void s) { - ListBuffer rewritten = new ListBuffer(); + ListBuffer rewritten = new ListBuffer<>(); boolean changed = false; for (Type arg : t.allparams()) { Type bound = visit(arg); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Wed Dec 18 16:05:18 2013 -0500 @@ -49,8 +49,7 @@ * deletion without notice. */ public class Annotate { - protected static final Context.Key annotateKey = - new Context.Key(); + protected static final Context.Key annotateKey = new Context.Key<>(); public static Annotate instance(Context context) { Annotate instance = context.get(annotateKey); @@ -88,11 +87,11 @@ private int enterCount = 0; - ListBuffer q = new ListBuffer(); - ListBuffer typesQ = new ListBuffer(); - ListBuffer repeatedQ = new ListBuffer(); - ListBuffer afterRepeatedQ = new ListBuffer(); - ListBuffer validateQ = new ListBuffer(); + ListBuffer q = new ListBuffer<>(); + ListBuffer typesQ = new ListBuffer<>(); + ListBuffer repeatedQ = new ListBuffer<>(); + ListBuffer afterRepeatedQ = new ListBuffer<>(); + ListBuffer validateQ = new ListBuffer<>(); public void earlier(Worker a) { q.prepend(a); @@ -352,7 +351,7 @@ if (na.elemtype != null) { log.error(na.elemtype.pos(), "new.not.allowed.in.annotation"); } - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); for (List l = na.elems; l.nonEmpty(); l=l.tail) { buf.append(enterAttributeValue(types.elemtype(expected), l.head, @@ -509,8 +508,8 @@ repeated = repeated.reverse(); TreeMaker m = make.at(ctx.pos.get(firstOccurrence)); Pair p = - new Pair(containerValueSymbol, - new Attribute.Array(arrayOfOrigAnnoType, repeated)); + new Pair<>(containerValueSymbol, + new Attribute.Array(arrayOfOrigAnnoType, repeated)); if (ctx.isTypeCompound) { /* TODO: the following code would be cleaner: Attribute.TypeCompound at = new Attribute.TypeCompound(targetContainerType, List.of(p), diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Dec 18 16:05:18 2013 -0500 @@ -73,8 +73,7 @@ * deletion without notice. */ public class Attr extends JCTree.Visitor { - protected static final Context.Key attrKey = - new Context.Key(); + protected static final Context.Key attrKey = new Context.Key<>(); final Names names; final Log log; @@ -668,7 +667,7 @@ /** Attribute a list of expressions, returning a list of types. */ List attribExprs(List trees, Env env, Type pt) { - ListBuffer ts = new ListBuffer(); + ListBuffer ts = new ListBuffer<>(); for (List l = trees; l.nonEmpty(); l = l.tail) ts.append(attribExpr(l.head, env, pt)); return ts.toList(); @@ -702,7 +701,7 @@ * Caller is responsible for calling checkRefTypes. */ List attribAnyTypes(List trees, Env env) { - ListBuffer argtypes = new ListBuffer(); + ListBuffer argtypes = new ListBuffer<>(); for (List l = trees; l.nonEmpty(); l = l.tail) argtypes.append(attribType(l.head, env)); return argtypes.toList(); @@ -1238,7 +1237,7 @@ // Attribute all cases and // check that there are no duplicate case labels or default clauses. - Set labels = new HashSet(); // The set of case labels. + Set labels = new HashSet<>(); // The set of case labels. boolean hasDefault = false; // Is there a default label? for (List l = tree.cases; l.nonEmpty(); l = l.tail) { JCCase c = l.head; @@ -3815,7 +3814,7 @@ Resolve.InapplicableSymbolError errSym = rs.new InapplicableSymbolError(null) { @Override protected Pair errCandidate() { - return new Pair(sym, diag); + return new Pair<>(sym, diag); } }; List argtypes2 = Type.map(argtypes, @@ -3968,7 +3967,7 @@ } Type checkIntersection(JCTree tree, List bounds) { - Set boundSet = new HashSet(); + Set boundSet = new HashSet<>(); if (bounds.nonEmpty()) { // accept class or interface or typevar as first bound. bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false); @@ -4573,7 +4572,7 @@ if (at.getAnnotations().size() == 1) { log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute); } else { - ListBuffer comps = new ListBuffer(); + ListBuffer comps = new ListBuffer<>(); for (JCAnnotation an : at.getAnnotations()) { comps.add(an.attribute); } @@ -4634,7 +4633,7 @@ } } } - }; + } // diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Dec 18 16:05:18 2013 -0500 @@ -64,8 +64,7 @@ * deletion without notice. */ public class Check { - protected static final Context.Key checkKey = - new Context.Key(); + protected static final Context.Key checkKey = new Context.Key<>(); private final Names names; private final Log log; @@ -191,7 +190,7 @@ /** A table mapping flat names of all compiled classes in this run to their * symbols; maintained from outside. */ - public Map compiled = new HashMap(); + public Map compiled = new HashMap<>(); /** A handler for messages about deprecated usage. */ @@ -937,7 +936,7 @@ List actuals = type.allparams(); List args = type.getTypeArguments(); List forms = type.tsym.type.getTypeArguments(); - ListBuffer bounds_buf = new ListBuffer(); + ListBuffer bounds_buf = new ListBuffer<>(); // For matching pairs of actual argument types `a' and // formal type parameters with declared bound `b' ... @@ -1169,7 +1168,7 @@ boolean specialized; SpecialTreeVisitor() { this.specialized = false; - }; + } @Override public void visitTree(JCTree tree) { /* no-op */ } @@ -1818,13 +1817,13 @@ * @returns symbol from t2 that conflicts with one in t1. */ private Symbol firstIncompatibility(DiagnosticPosition pos, Type t1, Type t2, Type site) { - Map interfaces1 = new HashMap(); + Map interfaces1 = new HashMap<>(); closure(t1, interfaces1); Map interfaces2; if (t1 == t2) interfaces2 = interfaces1; else - closure(t2, interfaces1, interfaces2 = new HashMap()); + closure(t2, interfaces1, interfaces2 = new HashMap<>()); for (Type t3 : interfaces1.values()) { for (Type t4 : interfaces2.values()) { @@ -1904,7 +1903,7 @@ } //WHERE boolean checkCommonOverriderIn(Symbol s1, Symbol s2, Type site) { - Map supertypes = new HashMap(); + Map supertypes = new HashMap<>(); Type st1 = types.memberType(site, s1); Type st2 = types.memberType(site, s2); closure(site, supertypes); @@ -2602,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<>(), type); } //where /** Enter all interfaces of type `type' into the hash table `seensofar' @@ -2846,14 +2845,14 @@ if (containerTarget == null) { containerTargets = getDefaultTargetSet(); } else { - containerTargets = new HashSet(); - for (Attribute app : containerTarget.values) { - if (!(app instanceof Attribute.Enum)) { - continue; // recovery + containerTargets = new HashSet<>(); + for (Attribute app : containerTarget.values) { + if (!(app instanceof Attribute.Enum)) { + continue; // recovery + } + Attribute.Enum e = (Attribute.Enum)app; + containerTargets.add(e.value.name); } - Attribute.Enum e = (Attribute.Enum)app; - containerTargets.add(e.value.name); - } } Set containedTargets; @@ -2861,14 +2860,14 @@ if (containedTarget == null) { containedTargets = getDefaultTargetSet(); } else { - containedTargets = new HashSet(); - for (Attribute app : containedTarget.values) { - if (!(app instanceof Attribute.Enum)) { - continue; // recovery + containedTargets = new HashSet<>(); + for (Attribute app : containedTarget.values) { + if (!(app instanceof Attribute.Enum)) { + continue; // recovery + } + Attribute.Enum e = (Attribute.Enum)app; + containedTargets.add(e.value.name); } - Attribute.Enum e = (Attribute.Enum)app; - containedTargets.add(e.value.name); - } } if (!isTargetSubsetOf(containerTargets, containedTargets)) { @@ -2879,7 +2878,7 @@ /* get a set of names for the default target */ private Set getDefaultTargetSet() { if (defaultTargets == null) { - Set targets = new HashSet(); + Set targets = new HashSet<>(); targets.add(names.ANNOTATION_TYPE); targets.add(names.CONSTRUCTOR); targets.add(names.FIELD); @@ -3078,7 +3077,7 @@ private boolean validateAnnotation(JCAnnotation a) { boolean isValid = true; // collect an inventory of the annotation elements - Set members = new LinkedHashSet(); + Set members = new LinkedHashSet<>(); for (Scope.Entry e = a.annotationType.type.tsym.members().elems; e != null; e = e.sibling) @@ -3128,7 +3127,7 @@ JCTree rhs = assign.rhs; if (!rhs.hasTag(NEWARRAY)) return false; JCNewArray na = (JCNewArray) rhs; - Set targets = new HashSet(); + Set targets = new HashSet<>(); for (JCTree elem : na.elems) { if (!targets.add(TreeInfo.symbol(elem))) { isValid = false; @@ -3246,7 +3245,7 @@ * constructors. */ void checkCyclicConstructors(JCClassDecl tree) { - Map callMap = new HashMap(); + Map callMap = new HashMap<>(); // enter each constructor this-call into the map for (List l = tree.defs; l.nonEmpty(); l = l.tail) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/CompileStates.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/CompileStates.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/CompileStates.java Wed Dec 18 16:05:18 2013 -0500 @@ -39,8 +39,7 @@ */ public class CompileStates extends HashMap, CompileStates.CompileState> { /** The context key for the compile states. */ - protected static final Context.Key compileStatesKey = - new Context.Key(); + protected static final Context.Key compileStatesKey = new Context.Key<>(); /** Get the CompileStates instance for this context. */ public static CompileStates instance(Context context) { @@ -74,7 +73,7 @@ return a.value > b.value ? a : b; } private final int value; - }; + } private static final long serialVersionUID = 1812267524140424433L; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/ConstFold.java Wed Dec 18 16:05:18 2013 -0500 @@ -42,8 +42,7 @@ * deletion without notice. */ strictfp class ConstFold { - protected static final Context.Key constFoldKey = - new Context.Key(); + protected static final Context.Key constFoldKey = new Context.Key<>(); private Symtab syms; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Wed Dec 18 16:05:18 2013 -0500 @@ -63,8 +63,7 @@ * deletion without notice. */ public class DeferredAttr extends JCTree.Visitor { - protected static final Context.Key deferredAttrKey = - new Context.Key(); + protected static final Context.Key deferredAttrKey = new Context.Key<>(); final Attr attr; final Check chk; @@ -147,8 +146,7 @@ */ class SpeculativeCache { - private Map> cache = - new WeakHashMap>(); + private Map> cache = new WeakHashMap<>(); class Entry { JCTree speculativeTree; @@ -335,7 +333,7 @@ /** * This is the plain type-checking mode. Produces side-effects on the underlying AST node */ - CHECK; + CHECK } /** @@ -345,7 +343,7 @@ * disabled during speculative type-checking. */ JCTree attribSpeculative(JCTree tree, Env env, ResultInfo resultInfo) { - final JCTree newTree = new TreeCopier(make).copy(tree); + final JCTree newTree = new TreeCopier<>(make).copy(tree); Env speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared())); speculativeEnv.info.scope.owner = env.info.scope.owner; Log.DeferredDiagnosticHandler deferredDiagnosticHandler = @@ -362,7 +360,7 @@ } super.scan(tree); } - }; + } PosScanner posScanner = new PosScanner(); posScanner.scan(newTree); return posScanner.found; @@ -425,7 +423,7 @@ final Warner warn; /** list of deferred attribution nodes to be processed */ - ArrayList deferredAttrNodes = new ArrayList(); + ArrayList deferredAttrNodes = new ArrayList<>(); DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase, InferenceContext inferenceContext, DeferredAttrContext parent, Warner warn) { @@ -454,7 +452,7 @@ */ void complete() { while (!deferredAttrNodes.isEmpty()) { - Map> depVarsMap = new LinkedHashMap>(); + Map> depVarsMap = new LinkedHashMap<>(); List stuckVars = List.nil(); boolean progress = false; //scan a defensive copy of the node list - this is because a deferred @@ -470,7 +468,7 @@ .intersect(inferenceContext.restvars())) { Set prevDeps = depVarsMap.get(t); if (prevDeps == null) { - prevDeps = new LinkedHashSet(); + prevDeps = new LinkedHashSet<>(); depVarsMap.put(t, prevDeps); } prevDeps.addAll(restStuckVars); @@ -815,8 +813,8 @@ Type pt; Infer.InferenceContext inferenceContext; - Set stuckVars = new LinkedHashSet(); - Set depVars = new LinkedHashSet(); + Set stuckVars = new LinkedHashSet<>(); + Set depVars = new LinkedHashSet<>(); @Override public boolean isStuck() { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Wed Dec 18 16:05:18 2013 -0500 @@ -90,8 +90,7 @@ * deletion without notice. */ public class Enter extends JCTree.Visitor { - protected static final Context.Key enterKey = - new Context.Key(); + protected static final Context.Key enterKey = new Context.Key<>(); Log log; Symtab syms; @@ -147,8 +146,7 @@ /** A hashtable mapping classes and packages to the environments current * at the points of their definitions. */ - Map> typeEnvs = - new HashMap>(); + Map> typeEnvs = new HashMap<>(); /** Accessor for typeEnvs */ @@ -207,7 +205,7 @@ * @param tree The toplevel tree. */ Env topLevelEnv(JCCompilationUnit tree) { - Env localEnv = new Env(tree, new AttrContext()); + Env localEnv = new Env<>(tree, new AttrContext()); localEnv.toplevel = tree; localEnv.enclClass = predefClassDef; tree.namedImportScope = new ImportScope(tree.packge); @@ -218,7 +216,7 @@ } public Env getTopLevelEnv(JCCompilationUnit tree) { - Env localEnv = new Env(tree, new AttrContext()); + Env localEnv = new Env<>(tree, new AttrContext()); localEnv.toplevel = tree; localEnv.enclClass = predefClassDef; localEnv.info.scope = tree.namedImportScope; @@ -271,7 +269,7 @@ /** Visitor method: enter classes of a list of trees, returning a list of types. */ List classEnter(List trees, Env env) { - ListBuffer ts = new ListBuffer(); + ListBuffer ts = new ListBuffer<>(); for (List l = trees; l.nonEmpty(); l = l.tail) { Type t = classEnter(l.head, env); if (t != null) @@ -483,7 +481,7 @@ public void complete(List trees, ClassSymbol c) { annotate.enterStart(); ListBuffer prevUncompleted = uncompleted; - if (memberEnter.completionEnabled) uncompleted = new ListBuffer(); + if (memberEnter.completionEnabled) uncompleted = new ListBuffer<>(); try { // enter all classes, and construct uncompleted list diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Env.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java Wed Dec 18 16:05:18 2013 -0500 @@ -92,7 +92,7 @@ * and copying all other fields. */ public Env dup(JCTree tree, A info) { - return dupto(new Env(tree, info)); + return dupto(new Env<>(tree, info)); } /** Duplicate this environment into a given Environment, diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Wed Dec 18 16:05:18 2013 -0500 @@ -181,8 +181,7 @@ * deletion without notice. */ public class Flow { - protected static final Context.Key flowKey = - new Context.Key(); + protected static final Context.Key flowKey = new Context.Key<>(); private final Names names; private final Log log; @@ -373,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<>(), JumpKind.CONTINUE); } /** Resolve all breaks of this statement. */ @@ -449,7 +448,7 @@ ListBuffer pendingExitsPrev = pendingExits; Lint lintPrev = lint; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); lint = lint.augment(tree.sym); try { @@ -498,7 +497,7 @@ log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt"); List exits = pendingExits.toList(); - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); while (exits.nonEmpty()) { PendingExit exit = exits.head; exits = exits.tail; @@ -527,7 +526,7 @@ public void visitDoLoop(JCDoWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scanStat(tree.body); alive |= resolveContinues(tree); scan(tree.cond); @@ -537,7 +536,7 @@ public void visitWhileLoop(JCWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree.cond); alive = !tree.cond.type.isFalse(); scanStat(tree.body); @@ -549,7 +548,7 @@ public void visitForLoop(JCForLoop tree) { ListBuffer prevPendingExits = pendingExits; scanStats(tree.init); - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); if (tree.cond != null) { scan(tree.cond); alive = !tree.cond.type.isFalse(); @@ -567,7 +566,7 @@ visitVarDef(tree.var); ListBuffer prevPendingExits = pendingExits; scan(tree.expr); - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scanStat(tree.body); alive |= resolveContinues(tree); resolveBreaks(tree, prevPendingExits); @@ -576,14 +575,14 @@ public void visitLabelled(JCLabeledStatement tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scanStat(tree.body); alive |= resolveBreaks(tree, prevPendingExits); } public void visitSwitch(JCSwitch tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree.selector); boolean hasDefault = false; for (List l = tree.cases; l.nonEmpty(); l = l.tail) { @@ -610,7 +609,7 @@ public void visitTry(JCTry tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); for (JCTree resource : tree.resources) { if (resource instanceof JCVariableDecl) { JCVariableDecl vdecl = (JCVariableDecl) resource; @@ -741,7 +740,7 @@ try { attrEnv = env; Flow.this.make = make; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); alive = true; scan(tree); } finally { @@ -846,7 +845,7 @@ ListBuffer pendingExitsPrev = pendingExits; Lint lintPrev = lint; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); if (tree.name != names.empty) { caught = List.nil(); } @@ -951,7 +950,7 @@ scan(tree.body); List exits = pendingExits.toList(); - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); while (exits.nonEmpty()) { FlowPendingExit exit = exits.head; exits = exits.tail; @@ -986,7 +985,7 @@ public void visitDoLoop(JCDoWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree.body); resolveContinues(tree); scan(tree.cond); @@ -995,7 +994,7 @@ public void visitWhileLoop(JCWhileLoop tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree.cond); scan(tree.body); resolveContinues(tree); @@ -1005,7 +1004,7 @@ public void visitForLoop(JCForLoop tree) { ListBuffer prevPendingExits = pendingExits; scan(tree.init); - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); if (tree.cond != null) { scan(tree.cond); } @@ -1019,7 +1018,7 @@ visitVarDef(tree.var); ListBuffer prevPendingExits = pendingExits; scan(tree.expr); - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree.body); resolveContinues(tree); resolveBreaks(tree, prevPendingExits); @@ -1027,14 +1026,14 @@ public void visitLabelled(JCLabeledStatement tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree.body); resolveBreaks(tree, prevPendingExits); } public void visitSwitch(JCSwitch tree) { ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree.selector); for (List l = tree.cases; l.nonEmpty(); l = l.tail) { JCCase c = l.head; @@ -1060,7 +1059,7 @@ } ListBuffer prevPendingExits = pendingExits; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); for (JCTree resource : tree.resources) { if (resource instanceof JCVariableDecl) { JCVariableDecl vdecl = (JCVariableDecl) resource; @@ -1270,7 +1269,7 @@ thrown = List.nil(); scan(tree.body); List exits = pendingExits.toList(); - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); while (exits.nonEmpty()) { FlowPendingExit exit = exits.head; exits = exits.tail; @@ -1307,8 +1306,8 @@ try { attrEnv = env; Flow.this.make = make; - pendingExits = new ListBuffer(); - preciseRethrowTypes = new HashMap>(); + pendingExits = new ListBuffer<>(); + preciseRethrowTypes = new HashMap<>(); this.thrown = this.caught = null; this.classDef = null; scan(tree); @@ -1651,7 +1650,7 @@ int nextadrPrev = nextadr; ListBuffer

pendingExitsPrev = pendingExits; - pendingExits = new ListBuffer

(); + pendingExits = new ListBuffer<>(); if (tree.name != names.empty) { firstadr = nextadr; } @@ -1826,7 +1825,7 @@ flowKind = FlowKind.NORMAL; final Bits initsSkip = new Bits(true); final Bits uninitsSkip = new Bits(true); - pendingExits = new ListBuffer

(); + pendingExits = new ListBuffer<>(); int prevErrors = getLogNumberOfErrors(); do { final Bits uninitsEntry = new Bits(uninits); @@ -1896,7 +1895,7 @@ scan(tree.init); final Bits initsSkip = new Bits(true); final Bits uninitsSkip = new Bits(true); - pendingExits = new ListBuffer

(); + pendingExits = new ListBuffer<>(); int prevErrors = getLogNumberOfErrors(); do { final Bits uninitsEntry = new Bits(uninits); @@ -1946,7 +1945,7 @@ final Bits uninitsStart = new Bits(uninits); letInit(tree.pos(), tree.var.sym); - pendingExits = new ListBuffer

(); + pendingExits = new ListBuffer<>(); int prevErrors = getLogNumberOfErrors(); do { final Bits uninitsEntry = new Bits(uninits); @@ -1969,7 +1968,7 @@ public void visitLabelled(JCLabeledStatement tree) { ListBuffer

prevPendingExits = pendingExits; - pendingExits = new ListBuffer

(); + pendingExits = new ListBuffer<>(); scan(tree.body); resolveBreaks(tree, prevPendingExits); } @@ -2219,7 +2218,7 @@ ListBuffer

prevPending = pendingExits; try { returnadr = nextadr; - pendingExits = new ListBuffer

(); + pendingExits = new ListBuffer<>(); for (List l = tree.params; l.nonEmpty(); l = l.tail) { JCVariableDecl def = l.head; scan(def); @@ -2676,7 +2675,7 @@ try { attrEnv = env; Flow.this.make = make; - pendingExits = new ListBuffer(); + pendingExits = new ListBuffer<>(); scan(tree); } finally { pendingExits = null; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Wed Dec 18 16:05:18 2013 -0500 @@ -62,8 +62,7 @@ * deletion without notice. */ public class Infer { - protected static final Context.Key inferKey = - new Context.Key(); + protected static final Context.Key inferKey = new Context.Key<>(); Resolve rs; Check chk; @@ -510,9 +509,9 @@ uv.listener = null; } } - }; + } - /** max number of incorporation rounds */ + /** max number of incorporation rounds */ static final int MAX_INCORPORATION_STEPS = 100; /** @@ -893,8 +892,7 @@ } /** an incorporation cache keeps track of all executed incorporation-related operations */ - Map incorporationCache = - new HashMap(); + Map incorporationCache = new HashMap<>(); /** * Make sure that the upper bounds we got so far lead to a solvable inference @@ -927,7 +925,7 @@ return !t.isErroneous() && !inferenceContext.free(t) && !t.hasTag(BOT); } - }; + } /** * This enumeration defines all possible bound-checking related errors. @@ -1045,7 +1043,7 @@ if (g.nodes.isEmpty()) { //should not happen throw new NodeNotFoundException(g); - }; + } return g.nodes.get(0); } @@ -1111,16 +1109,15 @@ //cache miss if (n.isLeaf()) { //if leaf, stop - cachedPath = new Pair, Integer>(List.of(n), n.data.length()); + cachedPath = new Pair<>(List.of(n), n.data.length()); } else { //if non-leaf, proceed recursively - Pair, Integer> path = new Pair, Integer>(List.of(n), n.data.length()); + Pair, Integer> path = new Pair<>(List.of(n), n.data.length()); for (Node n2 : n.getAllDependencies()) { if (n2 == n) continue; Pair, Integer> subpath = computeTreeToLeafs(n2); - path = new Pair, Integer>( - path.fst.prependList(subpath.fst), - path.snd + subpath.snd); + path = new Pair<>(path.fst.prependList(subpath.fst), + path.snd + subpath.snd); } cachedPath = path; } @@ -1131,12 +1128,10 @@ } /** cache used to avoid redundant computation of tree costs */ - final Map, Integer>> treeCache = - new HashMap, Integer>>(); + final Map, Integer>> treeCache = new HashMap<>(); /** constant value used to mark non-existent paths */ - final Pair, Integer> noPath = - new Pair, Integer>(null, Integer.MAX_VALUE); + final Pair, Integer> noPath = new Pair<>(null, Integer.MAX_VALUE); /** * Pick the leaf that minimize cost @@ -1460,7 +1455,7 @@ Node(Type ivar) { super(ListBuffer.of(ivar)); - this.deps = new EnumMap>(DependencyKind.class); + this.deps = new EnumMap<>(DependencyKind.class); } @Override @@ -1502,7 +1497,7 @@ * Retrieves all dependencies with given kind(s). */ protected Set getDependencies(DependencyKind... depKinds) { - Set buf = new LinkedHashSet(); + Set buf = new LinkedHashSet<>(); for (DependencyKind dk : depKinds) { Set depsByKind = deps.get(dk); if (depsByKind != null) { @@ -1518,7 +1513,7 @@ protected void addDependency(DependencyKind dk, Node depToAdd) { Set depsByKind = deps.get(dk); if (depsByKind == null) { - depsByKind = new LinkedHashSet(); + depsByKind = new LinkedHashSet<>(); deps.put(dk, depsByKind); } depsByKind.add(depToAdd); @@ -1554,11 +1549,11 @@ */ protected Set closure(DependencyKind... depKinds) { boolean progress = true; - Set closure = new HashSet(); + Set closure = new HashSet<>(); closure.add(this); while (progress) { progress = false; - for (Node n1 : new HashSet(closure)) { + for (Node n1 : new HashSet<>(closure)) { progress = closure.addAll(n1.getDependencies(depKinds)); } } @@ -1595,12 +1590,12 @@ } } //update deps - EnumMap> deps2 = new EnumMap>(DependencyKind.class); + EnumMap> deps2 = new EnumMap<>(DependencyKind.class); for (DependencyKind dk : DependencyKind.values()) { for (Node d : getDependencies(dk)) { Set depsByKind = deps2.get(dk); if (depsByKind == null) { - depsByKind = new LinkedHashSet(); + depsByKind = new LinkedHashSet<>(); deps2.put(dk, depsByKind); } if (data.contains(d.data.first())) { @@ -1674,7 +1669,7 @@ */ void initNodes(Map> stuckDeps) { //add nodes - nodes = new ArrayList(); + nodes = new ArrayList<>(); for (Type t : inferenceContext.restvars()) { nodes.add(new Node(t)); } @@ -1696,7 +1691,7 @@ } } //merge cyclic nodes - ArrayList acyclicNodes = new ArrayList(); + ArrayList acyclicNodes = new ArrayList<>(); for (List conSubGraph : GraphUtils.tarjan(nodes)) { if (conSubGraph.length() > 1) { Node root = conSubGraph.head; @@ -1753,8 +1748,7 @@ /** list of inference vars in this context */ List inferencevars; - java.util.Map> freeTypeListeners = - new java.util.HashMap>(); + Map> freeTypeListeners = new HashMap<>(); List freetypeListeners = List.nil(); @@ -1946,7 +1940,7 @@ void notifyChange(List inferredVars) { InferenceException thrownEx = null; for (Map.Entry> entry : - new HashMap>(freeTypeListeners).entrySet()) { + new HashMap<>(freeTypeListeners).entrySet()) { if (!Type.containsAny(entry.getValue(), inferencevars.diff(inferredVars))) { try { entry.getKey().typesInferred(this); @@ -2019,7 +2013,7 @@ } private void solve(GraphStrategy ss, Warner warn) { - solve(ss, new HashMap>(), warn); + solve(ss, new HashMap<>(), warn); } /** diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Dec 18 16:05:18 2013 -0500 @@ -106,8 +106,7 @@ public static final int FLAG_BRIDGES = 1 << 2; // - protected static final Context.Key unlambdaKey = - new Context.Key(); + protected static final Context.Key unlambdaKey = new Context.Key<>(); public static LambdaToMethod instance(Context context) { LambdaToMethod instance = context.get(unlambdaKey); @@ -161,7 +160,7 @@ private KlassInfo(JCClassDecl clazz) { this.clazz = clazz; appendedMethodList = new ListBuffer<>(); - deserializeCases = new HashMap>(); + deserializeCases = new HashMap<>(); MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType, List.nil(), syms.methodClass); deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, clazz.sym); @@ -204,7 +203,7 @@ this.make = make; this.attrEnv = env; this.context = null; - this.contextMap = new HashMap>(); + this.contextMap = new HashMap<>(); return translate(cdef); } // @@ -261,8 +260,8 @@ { Symbol owner = localContext.owner; - ListBuffer ownerTypeAnnos = new ListBuffer(); - ListBuffer lambdaTypeAnnos = new ListBuffer(); + ListBuffer ownerTypeAnnos = new ListBuffer<>(); + ListBuffer lambdaTypeAnnos = new ListBuffer<>(); for (Attribute.TypeCompound tc : owner.getRawTypeAttributes()) { if (tc.position.onLambda == tree) { @@ -1147,12 +1146,11 @@ * maps for fake clinit symbols to be used as owners of lambda occurring in * a static var init context */ - private Map clinits = - new HashMap(); + private Map clinits = new HashMap<>(); private JCClassDecl analyzeAndPreprocessClass(JCClassDecl tree) { frameStack = List.nil(); - localClassDefs = new HashMap(); + localClassDefs = new HashMap<>(); return translate(tree); } @@ -1180,7 +1178,7 @@ try { log.useSource(tree.sym.sourcefile); syntheticMethodNameCounts = new SyntheticMethodNameCounter(); - prevClinits = new HashMap(); + prevClinits = new HashMap<>(); if (tree.sym.owner.kind == MTH) { localClassDefs.put(tree.sym, tree); } @@ -1352,7 +1350,7 @@ // Build lambda parameters // partially cloned from TreeMaker.Params until 8014021 is fixed Symbol owner = owner(); - ListBuffer paramBuff = new ListBuffer(); + ListBuffer paramBuff = new ListBuffer<>(); int i = 0; for (List l = ptypes; l.nonEmpty(); l = l.tail) { JCVariableDecl param = make.Param(make.paramName(i++), l.head, owner); @@ -1773,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<>()); + translatedSymbols.put(LOCAL_VAR, new LinkedHashMap<>()); + translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<>()); + translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<>()); + translatedSymbols.put(TYPE_VAR, new LinkedHashMap<>()); } /** @@ -2168,7 +2166,7 @@ LOCAL_VAR, // original to translated lambda locals CAPTURED_VAR, // variables in enclosing scope to translated synthetic parameters CAPTURED_THIS, // class symbols to translated synthetic parameters (for captured member access) - TYPE_VAR; // original to translated lambda type variables + TYPE_VAR // original to translated lambda type variables } /** diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Dec 18 16:05:18 2013 -0500 @@ -59,8 +59,7 @@ * deletion without notice. */ public class Lower extends TreeTranslator { - protected static final Context.Key lowerKey = - new Context.Key(); + protected static final Context.Key lowerKey = new Context.Key<>(); public static Lower instance(Context context) { Lower instance = context.get(lowerKey); @@ -141,7 +140,7 @@ /** A hash table mapping local classes to a list of pruned trees. */ - public Map> prunedTree = new WeakHashMap>(); + public Map> prunedTree = new WeakHashMap<>(); /** A hash table mapping virtual accessed symbols in outer subclasses * to the actually referred symbol in superclasses. @@ -396,7 +395,7 @@ } } - Map enumSwitchMap = new LinkedHashMap(); + Map enumSwitchMap = new LinkedHashMap<>(); EnumMapping mapForEnum(DiagnosticPosition pos, TypeSymbol enumClass) { EnumMapping map = enumSwitchMap.get(enumClass); @@ -441,7 +440,7 @@ class EnumMapping { EnumMapping(DiagnosticPosition pos, TypeSymbol forEnum) { this.forEnum = forEnum; - this.values = new LinkedHashMap(); + this.values = new LinkedHashMap<>(); this.pos = pos; Name varName = names .fromString(target.syntheticNameChar() + @@ -497,7 +496,7 @@ .setType(new ArrayType(syms.intType, syms.arrayClass)); // try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {} - ListBuffer stmts = new ListBuffer(); + ListBuffer stmts = new ListBuffer<>(); Symbol ordinalMethod = lookupMethod(pos, names.ordinal, forEnum.type, @@ -1654,7 +1653,7 @@ return block; // Add resource declaration or expression to block statements - ListBuffer stats = new ListBuffer(); + ListBuffer stats = new ListBuffer<>(); JCTree resource = resources.head; JCExpression expr = null; if (resource instanceof JCVariableDecl) { @@ -2548,9 +2547,9 @@ // process each enumeration constant, adding implicit constructor parameters int nextOrdinal = 0; - ListBuffer values = new ListBuffer(); - ListBuffer enumDefs = new ListBuffer(); - ListBuffer otherDefs = new ListBuffer(); + ListBuffer values = new ListBuffer<>(); + ListBuffer enumDefs = new ListBuffer<>(); + ListBuffer otherDefs = new ListBuffer<>(); for (List defs = tree.defs; defs.nonEmpty(); defs=defs.tail) { @@ -2824,7 +2823,7 @@ } //where private Map makeTranslationMap(JCMethodDecl tree) { - Map translationMap = new HashMap(); + Map translationMap = new HashMap<>(); for (JCVariableDecl vd : tree.params) { Symbol p = vd.sym; if (p != p.baseSymbol()) { @@ -3075,7 +3074,7 @@ List args = _args; if (parameters.isEmpty()) return args; boolean anyChanges = false; - ListBuffer result = new ListBuffer(); + ListBuffer result = new ListBuffer<>(); while (parameters.tail.nonEmpty()) { JCExpression arg = translate(args.head, parameters.head); anyChanges |= (arg != args.head); @@ -3086,7 +3085,7 @@ Type parameter = parameters.head; if (varargsElement != null) { anyChanges = true; - ListBuffer elems = new ListBuffer(); + ListBuffer elems = new ListBuffer<>(); while (args.nonEmpty()) { JCExpression arg = translate(args.head, varargsElement); elems.append(arg); @@ -3611,7 +3610,7 @@ JCArrayAccess selector = make.Indexed(map.mapVar, make.App(make.Select(tree.selector, ordinalMethod))); - ListBuffer cases = new ListBuffer(); + ListBuffer cases = new ListBuffer<>(); for (JCCase c : tree.cases) { if (c.pat != null) { VarSymbol label = (VarSymbol)TreeInfo.symbol(c.pat); @@ -3674,16 +3673,14 @@ * used instead of String.hashCode. */ - ListBuffer stmtList = new ListBuffer(); + ListBuffer stmtList = new ListBuffer<>(); // Map from String case labels to their original position in // the list of case labels. - Map caseLabelToPosition = - new LinkedHashMap(alternatives + 1, 1.0f); + Map caseLabelToPosition = new LinkedHashMap<>(alternatives + 1, 1.0f); // Map of hash codes to the string case labels having that hashCode. - Map> hashToString = - new LinkedHashMap>(alternatives + 1, 1.0f); + Map> hashToString = new LinkedHashMap<>(alternatives + 1, 1.0f); int casePosition = 0; for(JCCase oneCase : caseList) { @@ -3697,7 +3694,7 @@ Set stringSet = hashToString.get(hashCode); if (stringSet == null) { - stringSet = new LinkedHashSet(1, 1.0f); + stringSet = new LinkedHashSet<>(1, 1.0f); stringSet.add(labelExpr); hashToString.put(hashCode, stringSet); } else { @@ -3907,18 +3904,18 @@ currentMethodDef = null; outermostClassDef = (cdef.hasTag(CLASSDEF)) ? (JCClassDecl)cdef : null; outermostMemberDef = null; - this.translated = new ListBuffer(); - classdefs = new HashMap(); - actualSymbols = new HashMap(); - freevarCache = new HashMap>(); + this.translated = new ListBuffer<>(); + classdefs = new HashMap<>(); + actualSymbols = new HashMap<>(); + freevarCache = new HashMap<>(); proxies = new Scope(syms.noSymbol); twrVars = new Scope(syms.noSymbol); outerThisStack = List.nil(); - accessNums = new HashMap(); - accessSyms = new HashMap(); - accessConstrs = new HashMap(); + accessNums = new HashMap<>(); + accessSyms = new HashMap<>(); + accessConstrs = new HashMap<>(); accessConstrTags = List.nil(); - accessed = new ListBuffer(); + accessed = new ListBuffer<>(); translate(cdef, (JCExpression)null); for (List l = accessed.toList(); l.nonEmpty(); l = l.tail) makeAccessible(l.head); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Wed Dec 18 16:05:18 2013 -0500 @@ -62,8 +62,7 @@ * deletion without notice. */ public class MemberEnter extends JCTree.Visitor implements Completer { - protected static final Context.Key memberEnterKey = - new Context.Key(); + protected static final Context.Key memberEnterKey = new Context.Key<>(); /** A switch to determine whether we check for package/class conflicts */ @@ -126,7 +125,7 @@ /** A queue for classes whose members still need to be entered into the * symbol table. */ - ListBuffer> halfcompleted = new ListBuffer>(); + ListBuffer> halfcompleted = new ListBuffer<>(); /** Set to true only when the first of a set of classes is * processed from the half completed queue. @@ -178,7 +177,7 @@ // enter imported types immediately new Object() { - Set processed = new HashSet(); + Set processed = new HashSet<>(); void importFrom(TypeSymbol tsym) { if (tsym == null || !processed.add(tsym)) return; @@ -203,7 +202,7 @@ // enter non-types before annotations that might use them annotate.earlier(new Annotate.Worker() { - Set processed = new HashSet(); + Set processed = new HashSet<>(); public String toString() { return "import static " + tsym + ".*" + " in " + sourcefile; @@ -271,7 +270,7 @@ // enter imported types immediately new Object() { - Set processed = new HashSet(); + Set processed = new HashSet<>(); void importFrom(TypeSymbol tsym) { if (tsym == null || !processed.add(tsym)) return; @@ -297,7 +296,7 @@ // enter non-types before annotations that might use them annotate.earlier(new Annotate.Worker() { - Set processed = new HashSet(); + Set processed = new HashSet<>(); boolean found = false; public String toString() { @@ -378,7 +377,7 @@ attr.attribTypeVariables(typarams, env); // Enter and attribute value parameters. - ListBuffer argbuf = new ListBuffer(); + ListBuffer argbuf = new ListBuffer<>(); for (List l = params; l.nonEmpty(); l = l.tail) { memberEnter(l.head, env); argbuf.append(l.head.vartype.type); @@ -397,7 +396,7 @@ } // Attribute thrown exceptions. - ListBuffer thrownbuf = new ListBuffer(); + ListBuffer thrownbuf = new ListBuffer<>(); for (List l = thrown; l.nonEmpty(); l = l.tail) { Type exc = attr.attribType(l.head, env); if (!exc.hasTag(TYPEVAR)) { @@ -591,7 +590,7 @@ } // Set m.params - ListBuffer params = new ListBuffer(); + ListBuffer params = new ListBuffer<>(); JCVariableDecl lastParam = null; for (List l = tree.params; l.nonEmpty(); l = l.tail) { JCVariableDecl param = lastParam = l.head; @@ -915,10 +914,8 @@ private void actualEnterAnnotations(List annotations, Env env, Symbol s) { - Map> annotated = - new LinkedHashMap>(); - Map pos = - new HashMap(); + Map> annotated = new LinkedHashMap<>(); + Map pos = new HashMap<>(); for (List al = annotations; !al.isEmpty(); al = al.tail) { JCAnnotation a = al.head; @@ -952,7 +949,7 @@ } s.setDeclarationAttributesWithCompletion( - annotate.new AnnotateRepeatedContext(env, annotated, pos, log, false)); + annotate.new AnnotateRepeatedContext<>(env, annotated, pos, log, false)); } /** Queue processing of an attribute default value. */ @@ -1064,9 +1061,9 @@ ct.supertype_field = modelMissingTypes(supertype, tree.extending, false); // Determine interfaces. - ListBuffer interfaces = new ListBuffer(); + ListBuffer interfaces = new ListBuffer<>(); ListBuffer all_interfaces = null; // lazy init - Set interfaceSet = new HashSet(); + Set interfaceSet = new HashSet<>(); List interfaceTrees = tree.implementing; for (JCExpression iface : interfaceTrees) { Type i = attr.attribBase(iface, baseEnv, false, true, true); @@ -1214,10 +1211,8 @@ private void actualEnterTypeAnnotations(final List annotations, final Env env, final Symbol s) { - Map> annotated = - new LinkedHashMap>(); - Map pos = - new HashMap(); + Map> annotated = new LinkedHashMap<>(); + Map pos = new HashMap<>(); for (List al = annotations; !al.isEmpty(); al = al.tail) { JCAnnotation a = al.head; @@ -1245,7 +1240,7 @@ if (s != null) { s.appendTypeAttributesWithCompletion( - annotate.new AnnotateRepeatedContext(env, annotated, pos, log, true)); + annotate.new AnnotateRepeatedContext<>(env, annotated, pos, log, true)); } } @@ -1448,7 +1443,7 @@ } List visit(List trees) { - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (JCTree t: trees) lb.append(visit(t)); return lb.toList(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Dec 18 16:05:18 2013 -0500 @@ -78,8 +78,7 @@ * deletion without notice. */ public class Resolve { - protected static final Context.Key resolveKey = - new Context.Key(); + protected static final Context.Key resolveKey = new Context.Key<>(); Names names; Log log; @@ -918,7 +917,7 @@ public MethodCheck mostSpecificCheck(List actuals, boolean strict) { return new MostSpecificCheck(strict, actuals); } - }; + } /** * Check context to be used during method applicability checks. A method check @@ -1616,7 +1615,7 @@ (flags & DEFAULT) != 0 || (flags & ABSTRACT) == 0); } - }; + } /** Find best qualified method matching given name, type and value * arguments. @@ -3780,7 +3779,7 @@ bestSoFar = c; } Assert.checkNonNull(bestSoFar); - return new Pair(bestSoFar.sym, bestSoFar.details); + return new Pair<>(bestSoFar.sym, bestSoFar.details); } } @@ -3827,7 +3826,7 @@ } else if (filteredCandidates.size() == 1) { Map.Entry _e = filteredCandidates.entrySet().iterator().next(); - final Pair p = new Pair(_e.getKey(), _e.getValue()); + final Pair p = new Pair<>(_e.getKey(), _e.getValue()); JCDiagnostic d = new InapplicableSymbolError(resolveContext) { @Override protected Pair errCandidate() { @@ -3846,7 +3845,7 @@ } //where private Map mapCandidates() { - Map candidates = new LinkedHashMap(); + Map candidates = new LinkedHashMap<>(); for (Candidate c : resolveContext.candidates) { if (c.isApplicable()) continue; candidates.put(c.sym, c.details); @@ -3855,7 +3854,7 @@ } Map filterCandidates(Map candidatesMap) { - Map candidates = new LinkedHashMap(); + Map candidates = new LinkedHashMap<>(); for (Map.Entry _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { @@ -4175,8 +4174,7 @@ }; /** rewriter map used for method resolution simplification */ - static final Map rewriters = - new LinkedHashMap(); + static final Map rewriters = new LinkedHashMap<>(); static { String argMismatchRegex = MethodCheckDiag.ARG_MISMATCH.regex(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/Todo.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Todo.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Todo.java Wed Dec 18 16:05:18 2013 -0500 @@ -43,8 +43,7 @@ */ public class Todo extends AbstractQueue> { /** The context key for the todo list. */ - protected static final Context.Key todoKey = - new Context.Key(); + protected static final Context.Key todoKey = new Context.Key<>(); /** Get the Todo instance for this context. */ public static Todo instance(Context context) { @@ -98,7 +97,7 @@ public Queue>> groupByFile() { if (contentsByFile == null) { - contentsByFile = new LinkedList>>(); + contentsByFile = new LinkedList<>(); for (Env env: contents) { addByFile(env); } @@ -109,7 +108,7 @@ private void addByFile(Env env) { JavaFileObject file = env.toplevel.sourcefile; if (fileMap == null) - fileMap = new HashMap(); + fileMap = new HashMap<>(); FileQueue fq = fileMap.get(file); if (fq == null) { fq = new FileQueue(); @@ -132,7 +131,7 @@ } } - LinkedList> contents = new LinkedList>(); + LinkedList> contents = new LinkedList<>(); LinkedList>> contentsByFile; Map fileMap; @@ -167,6 +166,6 @@ return (fileContents.size() == 0 ? null : fileContents.get(0)); } - LinkedList> fileContents = new LinkedList>(); + LinkedList> fileContents = new LinkedList<>(); } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Wed Dec 18 16:05:18 2013 -0500 @@ -51,8 +51,7 @@ */ public class TransTypes extends TreeTranslator { /** The context key for the TransTypes phase. */ - protected static final Context.Key transTypesKey = - new Context.Key(); + protected static final Context.Key transTypesKey = new Context.Key<>(); /** Get the instance for this context. */ public static TransTypes instance(Context context) { @@ -88,7 +87,7 @@ log = Log.instance(context); syms = Symtab.instance(context); enter = Enter.instance(context); - overridden = new HashMap(); + overridden = new HashMap<>(); Source source = Source.instance(context); allowEnums = source.allowEnums(); addBridges = source.addBridges(); @@ -1004,7 +1003,7 @@ super.visitClassDef(tree); make.at(tree.pos); if (addBridges) { - ListBuffer bridges = new ListBuffer(); + ListBuffer bridges = new ListBuffer<>(); if (false) //see CR: 6996415 bridges.appendList(addOverrideBridgesIfNeeded(tree, c)); if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/CacheFSInfo.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/CacheFSInfo.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/CacheFSInfo.java Wed Dec 18 16:05:18 2013 -0500 @@ -112,7 +112,7 @@ } // could also be a Map> ? - private Map cache = new ConcurrentHashMap(); + private Map cache = new ConcurrentHashMap<>(); private static class Entry { File canonicalFile; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java Wed Dec 18 16:05:18 2013 -0500 @@ -77,7 +77,7 @@ if (path == null) return Collections.emptyList(); - List list = new ArrayList(); + List list = new ArrayList<>(); for (StringTokenizer st = new StringTokenizer(path); st.hasMoreTokens(); ) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java Wed Dec 18 16:05:18 2013 -0500 @@ -102,8 +102,9 @@ public int compare(File f1, File f2) { return -f1.getName().compareTo(f2.getName()); } - }; - }; + } + } + protected SortFiles sortFiles; /** @@ -179,7 +180,7 @@ } public Iterable getJavaFileObjectsFromStrings(Iterable names) { - ListBuffer files = new ListBuffer(); + ListBuffer files = new ListBuffer<>(); for (String name : names) files.append(new File(nullCheck(name))); return getJavaFileObjectsFromFiles(files.toList()); @@ -445,7 +446,7 @@ /** A directory of zip files already opened. */ - Map archives = new HashMap(); + Map archives = new HashMap<>(); private static final String[] symbolFileLocation = { "lib", "ct.sym" }; private static final RelativeDirectory symbolFilePrefix @@ -592,7 +593,7 @@ Iterable path = getLocation(location); if (path == null) return null; - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (File f: path) { try { lb.append(f.toURI().toURL()); @@ -618,7 +619,7 @@ if (path == null) return List.nil(); RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName); - ListBuffer results = new ListBuffer(); + ListBuffer results = new ListBuffer<>(); for (File directory : path) listContainer(directory, subdirectory, kinds, recurse, results); @@ -778,9 +779,9 @@ { ArrayList result; if (files instanceof Collection) - result = new ArrayList(((Collection)files).size()); + result = new ArrayList<>(((Collection)files).size()); else - result = new ArrayList(); + result = new ArrayList<>(); for (File f: files) result.add(new RegularFileObject(this, nullCheck(f))); return result; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/Locations.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/Locations.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/Locations.java Wed Dec 18 16:05:18 2013 -0500 @@ -144,7 +144,7 @@ * @return The elements of the path */ private static Iterable getPathEntries(String path, File emptyPathDefault) { - ListBuffer entries = new ListBuffer(); + ListBuffer entries = new ListBuffer<>(); int start = 0; while (start <= path.length()) { int sep = path.indexOf(File.pathSeparatorChar, start); @@ -167,7 +167,7 @@ private static final long serialVersionUID = 0; private boolean expandJarClassPaths = false; - private Set canonicalValues = new HashSet(); + private Set canonicalValues = new HashSet<>(); public Path expandJarClassPaths(boolean x) { expandJarClassPaths = x; @@ -510,7 +510,7 @@ */ private class BootClassPathLocationHandler extends LocationHandler { private Collection searchPath; - final Map optionValues = new EnumMap(Option.class); + final Map optionValues = new EnumMap<>(Option.class); /** * rt.jar as found on the default bootclasspath. @@ -648,8 +648,8 @@ Map handlersForOption; void initHandlers() { - handlersForLocation = new HashMap(); - handlersForOption = new EnumMap(Option.class); + handlersForLocation = new HashMap<>(); + handlersForOption = new EnumMap<>(Option.class); LocationHandler[] handlers = { new BootClassPathLocationHandler(), diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java Wed Dec 18 16:05:18 2013 -0500 @@ -241,7 +241,7 @@ File absFile = (absFileRef == null ? null : absFileRef.get()); if (absFile == null) { absFile = file.getAbsoluteFile(); - absFileRef = new SoftReference(absFile); + absFileRef = new SoftReference<>(absFile); } return absFile; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java Wed Dec 18 16:05:18 2013 -0500 @@ -65,7 +65,7 @@ protected ZipArchive(JavacFileManager fm, ZipFile zfile, boolean initMap) throws IOException { this.fileManager = fm; this.zfile = zfile; - this.map = new HashMap>(); + this.map = new HashMap<>(); if (initMap) initMap(); } @@ -133,7 +133,7 @@ File absFile = (absFileRef == null ? null : absFileRef.get()); if (absFile == null) { absFile = new File(zfile.getName()).getAbsoluteFile(); - absFileRef = new SoftReference(absFile); + absFileRef = new SoftReference<>(absFile); } return absFile; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java Wed Dec 18 16:05:18 2013 -0500 @@ -110,8 +110,7 @@ private boolean writeIndex = false; - private Map> relativeDirectoryCache = - new HashMap>(); + private Map> relativeDirectoryCache = new HashMap<>(); public synchronized boolean isOpen() { @@ -284,7 +283,7 @@ try { checkIndex(); if (allDirs == Collections.EMPTY_SET) { - allDirs = new java.util.LinkedHashSet(directories.keySet()); + allDirs = new java.util.LinkedHashSet<>(directories.keySet()); } return allDirs; @@ -449,7 +448,7 @@ // construct the inflater object or reuse an existing one if (inflater == null) - inflaterRef = new SoftReference(inflater = new Inflater(true)); + inflaterRef = new SoftReference<>(inflater = new Inflater(true)); inflater.reset(); inflater.setInput(src); @@ -570,8 +569,8 @@ // Add each of the files if (len > 0) { - directories = new LinkedHashMap(); - ArrayList entryList = new ArrayList(); + directories = new LinkedHashMap<>(); + ArrayList entryList = new ArrayList<>(); for (int pos = 0; pos < len; ) { pos = readEntry(pos, entryList, directories); } @@ -708,7 +707,7 @@ private com.sun.tools.javac.util.List zipFileEntriesDirectories = com.sun.tools.javac.util.List.nil(); private com.sun.tools.javac.util.List zipFileEntries = com.sun.tools.javac.util.List.nil(); - private List entries = new ArrayList(); + private List entries = new ArrayList<>(); private ZipFileIndex zipFileIndex; @@ -864,7 +863,7 @@ if (zipFile.lastModified() != fileStamp) { ret = false; } else { - directories = new LinkedHashMap(); + directories = new LinkedHashMap<>(); int numDirs = raf.readInt(); for (int nDirs = 0; nDirs < numDirs; nDirs++) { int dirNameBytesLen = raf.readInt(); @@ -922,8 +921,8 @@ raf.writeLong(zipFileLastModified); writtenSoFar += 8; - List directoriesToWrite = new ArrayList(); - Map offsets = new HashMap(); + List directoriesToWrite = new ArrayList<>(); + Map offsets = new HashMap<>(); raf.writeInt(directories.keySet().size()); writtenSoFar += 4; @@ -1038,7 +1037,7 @@ File absFile = (absFileRef == null ? null : absFileRef.get()); if (absFile == null) { absFile = zipFile.getAbsoluteFile(); - absFileRef = new SoftReference(absFile); + absFileRef = new SoftReference<>(absFile); } return absFile; } @@ -1052,7 +1051,7 @@ return rd; } rd = new RelativeDirectory(path); - relativeDirectoryCache.put(path, new SoftReference(rd)); + relativeDirectoryCache.put(path, new SoftReference<>(rd)); return rd; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java --- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java Wed Dec 18 16:05:18 2013 -0500 @@ -39,8 +39,7 @@ /** A cache for ZipFileIndex objects. */ public class ZipFileIndexCache { - private final Map map = - new HashMap(); + private final Map map = new HashMap<>(); /** Get a shared instance of the cache. */ private static ZipFileIndexCache sharedInstance; @@ -75,7 +74,7 @@ * @return A list of ZipFileIndex entries, or an empty list */ public synchronized List getZipFileIndexes(boolean openedOnly) { - List zipFileIndexes = new ArrayList(); + List zipFileIndexes = new ArrayList<>(); zipFileIndexes.addAll(map.values()); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java Wed Dec 18 16:05:18 2013 -0500 @@ -49,11 +49,11 @@ /** The list of CRTable entries. */ - private ListBuffer entries = new ListBuffer(); + private ListBuffer entries = new ListBuffer<>(); /** The hashtable for source positions. */ - private Map positions = new HashMap(); + private Map positions = new HashMap<>(); /** The object for ending positions stored in the parser. */ diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Wed Dec 18 16:05:18 2013 -0500 @@ -75,8 +75,7 @@ */ public class ClassReader { /** The context key for the class reader. */ - protected static final Context.Key classReaderKey = - new Context.Key(); + protected static final Context.Key classReaderKey = new Context.Key<>(); public static final int INITIAL_BUFFER_SIZE = 0x0fff0; @@ -233,7 +232,7 @@ /** * The set of attribute names for which warnings have been generated for the current class */ - Set warnedAttrs = new HashSet(); + Set warnedAttrs = new HashSet<>(); /** * Completer that delegates to the complete-method of this class. @@ -271,8 +270,8 @@ Assert.check(classes == null || classes == syms.classes); classes = syms.classes; } else { - packages = new HashMap(); - classes = new HashMap(); + packages = new HashMap<>(); + classes = new HashMap<>(); } packages.put(names.empty, syms.rootPackage); @@ -937,7 +936,8 @@ * Reading Attributes ***********************************************************************/ - protected enum AttributeKind { CLASS, MEMBER }; + protected enum AttributeKind { CLASS, MEMBER } + protected abstract class AttributeReader { protected AttributeReader(Name name, ClassFile.Version version, Set kinds) { this.name = name; @@ -978,7 +978,7 @@ protected Set CLASS_OR_MEMBER_ATTRIBUTE = EnumSet.of(AttributeKind.CLASS, AttributeKind.MEMBER); - protected Map attributeReaders = new HashMap(); + protected Map attributeReaders = new HashMap<>(); private void initAttributeReaders() { AttributeReader[] readers = { @@ -1131,7 +1131,7 @@ Assert.check(c == currentOwner); ct1.typarams_field = readTypeParams(nextChar()); ct1.supertype_field = sigToType(); - ListBuffer is = new ListBuffer(); + ListBuffer is = new ListBuffer<>(); while (sigp != siglimit) is.append(sigToType()); ct1.interfaces_field = is.toList(); } finally { @@ -1275,7 +1275,7 @@ } enterTypevars(self); if (!missingTypeVariables.isEmpty()) { - ListBuffer typeVars = new ListBuffer(); + ListBuffer typeVars = new ListBuffer<>(); for (Type typevar : missingTypeVariables) { typeVars.append(findTypeVar(typevar.tsym.name)); } @@ -1402,8 +1402,7 @@ void attachAnnotations(final Symbol sym) { int numAttributes = nextChar(); if (numAttributes != 0) { - ListBuffer proxies = - new ListBuffer(); + ListBuffer proxies = new ListBuffer<>(); for (int i = 0; i> pairs = - new ListBuffer>(); + ListBuffer> pairs = new ListBuffer<>(); for (int i=0; i(name, value)); + pairs.append(new Pair<>(name, value)); } return new CompoundAnnotationProxy(t, pairs.toList()); } @@ -1631,7 +1629,7 @@ return new Attribute.Class(types, readTypeOrClassSymbol(nextChar())); case '[': { int n = nextChar(); - ListBuffer l = new ListBuffer(); + ListBuffer l = new ListBuffer<>(); for (int i=0; i deproxyCompoundList(List pl) { // also must fill in types!!!! - ListBuffer buf = - new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); for (List l = pl; l.nonEmpty(); l=l.tail) { buf.append(deproxyCompound(l.head)); } @@ -1735,14 +1732,12 @@ } Attribute.Compound deproxyCompound(CompoundAnnotationProxy a) { - ListBuffer> buf = - new ListBuffer>(); + ListBuffer> buf = new ListBuffer<>(); for (List> l = a.values; l.nonEmpty(); l = l.tail) { MethodSymbol meth = findAccessMethod(a.type, l.head.fst); - buf.append(new Pair - (meth, deproxy(meth.type.getReturnType(), l.head.snd))); + buf.append(new Pair<>(meth, deproxy(meth.type.getReturnType(), l.head.snd))); } return new Attribute.Compound(a.type, buf.toList()); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -63,8 +63,7 @@ * deletion without notice. */ public class ClassWriter extends ClassFile { - protected static final Context.Key classWriterKey = - new Context.Key(); + protected static final Context.Key classWriterKey = new Context.Key<>(); private final Options options; @@ -683,7 +682,7 @@ case SOURCE: break; case CLASS: hasInvisible = true; break; case RUNTIME: hasVisible = true; break; - default: ;// /* fail soft */ throw new AssertionError(vis); + default: // /* fail soft */ throw new AssertionError(vis); } } } @@ -694,7 +693,7 @@ int attrIndex = writeAttr(names.RuntimeVisibleParameterAnnotations); databuf.appendByte(m.params.length()); for (VarSymbol s : m.params) { - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); for (Attribute.Compound a : s.getRawAttributes()) if (types.getRetention(a) == RetentionPolicy.RUNTIME) buf.append(a); @@ -709,7 +708,7 @@ int attrIndex = writeAttr(names.RuntimeInvisibleParameterAnnotations); databuf.appendByte(m.params.length()); for (VarSymbol s : m.params) { - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); for (Attribute.Compound a : s.getRawAttributes()) if (types.getRetention(a) == RetentionPolicy.CLASS) buf.append(a); @@ -732,14 +731,14 @@ */ int writeJavaAnnotations(List attrs) { if (attrs.isEmpty()) return 0; - ListBuffer visibles = new ListBuffer(); - ListBuffer invisibles = new ListBuffer(); + ListBuffer visibles = new ListBuffer<>(); + ListBuffer invisibles = new ListBuffer<>(); for (Attribute.Compound a : attrs) { switch (types.getRetention(a)) { case SOURCE: break; case CLASS: invisibles.append(a); break; case RUNTIME: visibles.append(a); break; - default: ;// /* fail soft */ throw new AssertionError(vis); + default: // /* fail soft */ throw new AssertionError(vis); } } @@ -793,7 +792,7 @@ case SOURCE: break; case CLASS: invisibles.append(tc); break; case RUNTIME: visibles.append(tc); break; - default: ;// /* fail soft */ throw new AssertionError(vis); + default: // /* fail soft */ throw new AssertionError(vis); } } @@ -1009,8 +1008,8 @@ if (c.name != names.empty) pool.put(c.name); if (innerClasses == null) { - innerClasses = new HashSet(); - innerClassesQueue = new ListBuffer(); + innerClasses = new HashSet<>(); + innerClassesQueue = new ListBuffer<>(); pool.put(names.InnerClasses); } innerClasses.add(c); @@ -1644,7 +1643,7 @@ pool = c.pool; innerClasses = null; innerClassesQueue = null; - bootstrapMethods = new LinkedHashMap(); + bootstrapMethods = new LinkedHashMap<>(); Type supertype = types.supertype(c.type); List interfaces = types.interfaces(c.type); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Wed Dec 18 16:05:18 2013 -0500 @@ -112,7 +112,7 @@ /** A buffer for expression catch data. Each enter is a vector * of four unsigned shorts. */ - ListBuffer catchInfo = new ListBuffer(); + ListBuffer catchInfo = new ListBuffer<>(); /** A buffer for line number information. Each entry is a vector * of two unsigned shorts. @@ -1988,7 +1988,7 @@ } } - }; + } /** Local variables, indexed by register. */ LocalVar[] lvar; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Dec 18 16:05:18 2013 -0500 @@ -59,8 +59,7 @@ * deletion without notice. */ public class Gen extends JCTree.Visitor { - protected static final Context.Key genKey = - new Context.Key(); + protected static final Context.Key genKey = new Context.Key<>(); private final Log log; private final Symtab syms; @@ -122,7 +121,7 @@ stringBufferType = target.useStringBuilder() ? syms.stringBuilderType : syms.stringBufferType; - stringBufferAppend = new HashMap(); + stringBufferAppend = new HashMap<>(); accessDollar = names. fromString("access" + target.syntheticNameChar()); lower = Lower.instance(context); @@ -475,11 +474,11 @@ * @param c The enclosing class. */ List normalizeDefs(List defs, ClassSymbol c) { - ListBuffer initCode = new ListBuffer(); - ListBuffer initTAs = new ListBuffer(); - ListBuffer clinitCode = new ListBuffer(); - ListBuffer clinitTAs = new ListBuffer(); - ListBuffer methodDefs = new ListBuffer(); + ListBuffer initCode = new ListBuffer<>(); + ListBuffer initTAs = new ListBuffer<>(); + ListBuffer clinitCode = new ListBuffer<>(); + ListBuffer clinitTAs = new ListBuffer<>(); + ListBuffer methodDefs = new ListBuffer<>(); // Sort definitions into three listbuffers: // - initCode for instance initializers // - clinitCode for class initializers @@ -562,8 +561,8 @@ private List getAndRemoveNonFieldTAs(VarSymbol sym) { List tas = sym.getRawTypeAttributes(); - ListBuffer fieldTAs = new ListBuffer(); - ListBuffer nonfieldTAs = new ListBuffer(); + ListBuffer fieldTAs = new ListBuffer<>(); + ListBuffer nonfieldTAs = new ListBuffer<>(); for (TypeCompound ta : tas) { if (ta.getPosition().type == TargetType.FIELD) { fieldTAs.add(ta); @@ -603,7 +602,7 @@ // We are seeing a constructor that does not call another // constructor of the same class. List stats = md.body.stats; - ListBuffer newstats = new ListBuffer(); + ListBuffer newstats = new ListBuffer<>(); if (stats.nonEmpty()) { // Copy initializers of synthetic variables generated in @@ -1485,7 +1484,7 @@ } } }; - syncEnv.info.gaps = new ListBuffer(); + syncEnv.info.gaps = new ListBuffer<>(); genTry(tree.body, List.nil(), syncEnv); code.endScopes(limit); } @@ -1529,7 +1528,7 @@ return tree.finalizer != null; } }; - tryEnv.info.gaps = new ListBuffer(); + tryEnv.info.gaps = new ListBuffer<>(); genTry(tree.body, tree.catchers, tryEnv); } //where @@ -2505,8 +2504,7 @@ c.pool = pool; pool.reset(); generateReferencesToPrunedTree(c, pool); - Env localEnv = - new Env(cdef, new GenContext()); + Env localEnv = new Env<>(cdef, new GenContext()); localEnv.toplevel = env.toplevel; localEnv.enclClass = cdef; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -78,8 +78,7 @@ * deletion without notice. */ public class JNIWriter { - protected static final Context.Key jniWriterKey = - new Context.Key(); + protected static final Context.Key jniWriterKey = new Context.Key<>(); /** Access to files. */ private final JavaFileManager fileManager; @@ -240,9 +239,9 @@ * Including super class fields. */ List getAllFields(TypeElement subclazz) { - List fields = new ArrayList(); + List fields = new ArrayList<>(); TypeElement cd = null; - Stack s = new Stack(); + Stack s = new Stack<>(); cd = subclazz; while (true) { @@ -355,7 +354,7 @@ Mangle.Type.METHOD_JNI_SHORT)); print(out, " (JNIEnv *, "); List paramargs = md.getParameters(); - List args = new ArrayList(); + List args = new ArrayList<>(); for (VariableElement p: paramargs) { args.add(types.erasure(p.asType())); } @@ -493,7 +492,7 @@ public static final int METHOD_JDK_1 = 6; public static final int METHOD_JNI_SHORT = 7; public static final int METHOD_JNI_LONG = 8; - }; + } private Elements elems; private Types types; @@ -671,7 +670,7 @@ throws SignatureException { String signature = null; //Java type signature. String typeSignature = null; //Internal type signature. - List params = new ArrayList(); //List of parameters. + List params = new ArrayList<>(); //List of parameters. String paramsig = null; //Java parameter signature. String paramJVMSig = null; //Internal parameter signature. String returnSig = null; //Java return type signature. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Wed Dec 18 16:05:18 2013 -0500 @@ -71,7 +71,7 @@ this.pp = pp; this.pool = pool; this.types = types; - this.indices = new HashMap(pool.length); + this.indices = new HashMap<>(pool.length); for (int i = 1; i < pp; i++) { if (pool[i] != null) indices.put(pool[i], i); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/Profile.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Profile.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Profile.java Wed Dec 18 16:05:18 2013 -0500 @@ -50,8 +50,7 @@ } }; - private static final Context.Key profileKey = - new Context.Key(); + private static final Context.Key profileKey = new Context.Key<>(); public static Profile instance(Context context) { Profile instance = context.get(profileKey); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java Wed Dec 18 16:05:18 2013 -0500 @@ -63,8 +63,7 @@ /** JDK 9, initially an alias for 8. */ JDK1_9("1.9", 52, 0); - private static final Context.Key targetKey = - new Context.Key(); + private static final Context.Key targetKey = new Context.Key<>(); public static Target instance(Context context) { Target instance = context.get(targetKey); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java --- a/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java Wed Dec 18 16:05:18 2013 -0500 @@ -54,7 +54,7 @@ public static String[] parse(String[] args) throws IOException { - ListBuffer newArgs = new ListBuffer(); + ListBuffer newArgs = new ListBuffer<>(); for (String arg : args) { if (arg.length() > 1 && arg.charAt(0) == '@') { arg = arg.substring(1); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java --- 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 compilerKey = - new Context.Key(); + protected static final Context.Key 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 inputFiles = new HashSet(); + protected Set inputFiles = new HashSet<>(); protected boolean shouldStop(CompileState cs) { CompileState shouldStopPolicy = (errorCount() > 0 || unrecoverableError()) @@ -579,7 +578,7 @@ } protected final Queue stopIfError(CompileState cs, Queue queue) { - return shouldStop(cs) ? new ListBuffer() : queue; + return shouldStop(cs) ? new ListBuffer<>() : queue; } protected final List stopIfError(CompileState cs, List list) { @@ -943,7 +942,7 @@ //parse all files ListBuffer trees = new ListBuffer<>(); - Set filesSoFar = new HashSet(); + Set filesSoFar = new HashSet<>(); for (JavaFileObject fileObject : fileObjects) { if (!filesSoFar.contains(fileObject)) { filesSoFar.add(fileObject); @@ -1352,8 +1351,7 @@ return stopIfError(CompileState.FLOW, results); } - HashMap, Queue, JCClassDecl>>> desugaredEnvs = - new HashMap, Queue, JCClassDecl>>>(); + HashMap, Queue, 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> dependencies = new LinkedHashSet>(); + Set> dependencies = new LinkedHashSet<>(); protected boolean hasLambdas; @Override public void visitClassDef(JCClassDecl node) { @@ -1456,7 +1454,7 @@ List pdef = lower.translateTopLevelClass(env, env.tree, localMake); if (pdef.head != null) { Assert.check(pdef.tail.isEmpty()); - results.add(new Pair, 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, 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, JCClassDecl>(env, cdef)); + results.add(new Pair<>(env, cdef)); } return; } @@ -1513,7 +1511,7 @@ //generate code for each class for (List l = cdefs; l.nonEmpty(); l = l.tail) { JCClassDecl cdef = (JCClassDecl)l.head; - results.add(new Pair, JCClassDecl>(env, cdef)); + results.add(new Pair<>(env, cdef)); } } finally { @@ -1586,11 +1584,11 @@ // where Map>> groupByFile(Queue> envs) { // use a LinkedHashMap to preserve the order of the original list as much as possible - Map>> map = new LinkedHashMap>>(); + Map>> map = new LinkedHashMap<>(); for (Env env: envs) { Queue> sublist = map.get(env.toplevel); if (sublist == null) { - sublist = new ListBuffer>(); + sublist = new ListBuffer<>(); map.put(env.toplevel, sublist); } sublist.add(env); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/main/Main.java --- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed Dec 18 16:05:18 2013 -0500 @@ -393,8 +393,8 @@ if (options == null) options = Options.instance(context); // creates a new one - filenames = new LinkedHashSet(); - classnames = new ListBuffer(); + filenames = new LinkedHashSet<>(); + classnames = new ListBuffer<>(); JavaCompiler comp = null; /* * TODO: Logic below about what is an acceptable command line @@ -453,7 +453,7 @@ JavacProcessingEnvironment pEnv = JavacProcessingEnvironment.instance(context); ClassLoader cl = pEnv.getProcessorClassLoader(); ServiceLoader sl = ServiceLoader.load(Plugin.class, cl); - Set> pluginsToCall = new LinkedHashSet>(); + Set> pluginsToCall = new LinkedHashSet<>(); for (String plugin: plugins.split("\\x00")) { pluginsToCall.add(List.from(plugin.split("\\s+"))); } @@ -486,7 +486,7 @@ String xdoclint = options.get(XDOCLINT); String xdoclintCustom = options.get(XDOCLINT_CUSTOM); if (xdoclint != null || xdoclintCustom != null) { - Set doclintOpts = new LinkedHashSet(); + Set doclintOpts = new LinkedHashSet<>(); if (xdoclint != null) doclintOpts.add(DocLint.XMSGS_OPTION); if (xdoclintCustom != null) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/main/Option.java --- a/langtools/src/share/classes/com/sun/tools/javac/main/Option.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/main/Option.java Wed Dec 18 16:05:18 2013 -0500 @@ -564,7 +564,7 @@ } // where private static Map createChoices(String... choices) { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); for (String c: choices) map.put(c, false); return map; @@ -719,7 +719,7 @@ } private static Map getXLintChoices() { - Map choices = new LinkedHashMap(); + Map choices = new LinkedHashMap<>(); choices.put("all", false); for (Lint.LintCategory c : Lint.LintCategory.values()) choices.put(c.option, c.hidden); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java --- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Wed Dec 18 16:05:18 2013 -0500 @@ -94,7 +94,7 @@ * defaulted. */ private Map getAllReflectedValues() { - Map res = new LinkedHashMap(); + Map res = new LinkedHashMap<>(); for (Map.Entry entry : getAllValues().entrySet()) { @@ -115,8 +115,7 @@ * Includes all elements, whether explicit or defaulted. */ private Map getAllValues() { - Map res = - new LinkedHashMap(); + Map res = new LinkedHashMap<>(); // First find the default values. ClassSymbol sym = (ClassSymbol) anno.type.tsym; @@ -186,7 +185,7 @@ if (elemName.equals(elemName.table.names.java_lang_Class)) { // Class[] // Construct a proxy for a MirroredTypesException - ListBuffer elems = new ListBuffer(); + ListBuffer elems = new ListBuffer<>(); for (Attribute value : a.values) { Type elem = ((Attribute.Class) value).classType; elems.append(elem); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java --- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java Wed Dec 18 16:05:18 2013 -0500 @@ -547,7 +547,7 @@ JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree); if (tree == null || enterEnv.toplevel == null) return null; - return new Pair(tree, enterEnv.toplevel); + return new Pair<>(tree, enterEnv.toplevel); } /** @@ -578,7 +578,7 @@ // 6388543: if v != null, we should search within annoTree to find // the tree matching v. For now, we ignore v and return the tree of // the annotation. - return new Pair(annoTree, elemTreeTop.snd); + return new Pair<>(annoTree, elemTreeTop.snd); } /** diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java --- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Wed Dec 18 16:05:18 2013 -0500 @@ -246,7 +246,7 @@ throw new IllegalArgumentException( "Incorrect number of type arguments"); - ListBuffer targs = new ListBuffer(); + ListBuffer targs = new ListBuffer<>(); for (TypeMirror t : typeArgs) { if (!(t instanceof ReferenceType || t instanceof WildcardType)) throw new IllegalArgumentException(t.toString()); @@ -314,7 +314,7 @@ MethodSymbol m = (MethodSymbol) elem; ClassSymbol origin = (ClassSymbol) m.owner; - Set results = new LinkedHashSet(); + Set results = new LinkedHashSet<>(); for (Type t : types.closure(origin.type)) { if (t != origin.type) { ClassSymbol c = (ClassSymbol) t.tsym; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java --- a/langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java Wed Dec 18 16:05:18 2013 -0500 @@ -113,8 +113,8 @@ super(charset); if (register) context.put(JavaFileManager.class, this); - pathsForLocation = new HashMap(); - fileSystems = new HashMap(); + pathsForLocation = new HashMap<>(); + fileSystems = new HashMap<>(); setContext(context); } @@ -155,7 +155,7 @@ Iterable path = getLocation(location); if (path == null) return null; - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (Path p: path) { try { lb.append(p.toUri().toURL()); @@ -308,7 +308,7 @@ Iterable paths = getLocation(location); if (paths == null) return List.nil(); - ListBuffer results = new ListBuffer(); + ListBuffer results = new ListBuffer<>(); for (Path path : paths) list(path, packageName, kinds, recurse, results); @@ -394,9 +394,9 @@ Iterable paths) { ArrayList result; if (paths instanceof Collection) - result = new ArrayList(((Collection)paths).size()); + result = new ArrayList<>(((Collection)paths).size()); else - result = new ArrayList(); + result = new ArrayList<>(); for (Path p: paths) result.add(PathFileObject.createSimplePathFileObject(this, nullCheck(p))); return result; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Wed Dec 18 16:05:18 2013 -0500 @@ -130,7 +130,7 @@ List tags = blockTags(); // split body into first sentence and body - ListBuffer fs = new ListBuffer(); + ListBuffer fs = new ListBuffer<>(); loop: for (; body.nonEmpty(); body = body.tail) { DCTree t = body.head; @@ -194,7 +194,7 @@ */ @SuppressWarnings("fallthrough") protected List blockContent() { - ListBuffer trees = new ListBuffer(); + ListBuffer trees = new ListBuffer<>(); textStart = -1; loop: @@ -265,7 +265,7 @@ * Non-standard tags are represented by {@link UnknownBlockTag}. */ protected List blockTags() { - ListBuffer tags = new ListBuffer(); + ListBuffer tags = new ListBuffer<>(); while (ch == '@') tags.add(blockTag()); return tags.toList(); @@ -535,7 +535,7 @@ return List.nil(); JavacParser p = fac.newParser(s.replace("...", "[]"), false, false, false); - ListBuffer paramTypes = new ListBuffer(); + ListBuffer paramTypes = new ListBuffer<>(); paramTypes.add(p.parseType()); if (p.token().kind == TokenKind.IDENTIFIER) @@ -614,7 +614,7 @@ */ @SuppressWarnings("fallthrough") protected List inlineContent() { - ListBuffer trees = new ListBuffer(); + ListBuffer trees = new ListBuffer<>(); skipWhitespace(); int pos = bp; @@ -792,7 +792,7 @@ * "value" may be unquoted, single-quoted, or double-quoted. */ protected List htmlAttrs() { - ListBuffer attrs = new ListBuffer(); + ListBuffer attrs = new ListBuffer<>(); skipWhitespace(); loop: @@ -803,7 +803,7 @@ List value = null; ValueKind vkind = ValueKind.EMPTY; if (ch == '=') { - ListBuffer v = new ListBuffer(); + ListBuffer v = new ListBuffer<>(); nextChar(); skipWhitespace(); if (ch == '\'' || ch == '"') { @@ -990,7 +990,7 @@ } - Set htmlBlockTags = new HashSet(Arrays.asList( + Set htmlBlockTags = new HashSet<>(Arrays.asList( "h1", "h2", "h3", "h4", "h5", "h6", "p", "pre")); protected boolean isSentenceBreak(Name n) { @@ -1278,7 +1278,7 @@ }, }; - tagParsers = new HashMap(); + tagParsers = new HashMap<>(); for (TagParser p: parsers) tagParsers.put(names.fromString(p.getTreeKind().tagName), p); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Wed Dec 18 16:05:18 2013 -0500 @@ -729,7 +729,7 @@ + new String(reader.getRawCharacters(pos, endPos)) + "|"); char[] buf = reader.getRawCharacters(pos, endPos); - return new BasicComment(new UnicodeReader(fac, buf, buf.length), style); + return new BasicComment<>(new UnicodeReader(fac, buf, buf.length), style); } /** diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Dec 18 16:05:18 2013 -0500 @@ -1010,8 +1010,8 @@ /** optimization: To save allocating a new operand/operator stack * for every binary operation, we use supplys. */ - ArrayList odStackSupply = new ArrayList(); - ArrayList opStackSupply = new ArrayList(); + ArrayList odStackSupply = new ArrayList<>(); + ArrayList opStackSupply = new ArrayList<>(); private JCExpression[] newOdStack() { if (odStackSupply.isEmpty()) @@ -1314,7 +1314,7 @@ //is a generic type i.e. A::m int pos1 = token.pos; accept(LT); - ListBuffer args = new ListBuffer(); + ListBuffer args = new ListBuffer<>(); args.append(typeArgument()); while (token.kind == COMMA) { nextToken(); @@ -1696,7 +1696,7 @@ CAST, EXPLICIT_LAMBDA, IMPLICIT_LAMBDA, - PARENS; + PARENS } JCExpression lambdaExpressionOrStatement(boolean hasParens, boolean explicitParams, int pos) { @@ -2172,7 +2172,7 @@ return syntaxError(token.pos, List.of(t), "array.dimension.missing"); } } else { - ListBuffer dims = new ListBuffer(); + ListBuffer dims = new ListBuffer<>(); // maintain array dimension type annotations ListBuffer> dimAnnotations = new ListBuffer<>(); @@ -2226,7 +2226,7 @@ */ JCExpression arrayInitializer(int newpos, JCExpression t) { accept(LBRACE); - ListBuffer elems = new ListBuffer(); + ListBuffer elems = new ListBuffer<>(); if (token.kind == COMMA) { nextToken(); } else if (token.kind != RBRACE) { @@ -2288,7 +2288,7 @@ @SuppressWarnings("fallthrough") List blockStatements() { //todo: skip to anchor on error(?) - ListBuffer stats = new ListBuffer(); + ListBuffer stats = new ListBuffer<>(); while (true) { List stat = blockStatement(); if (stat.isEmpty()) { @@ -2356,7 +2356,7 @@ } else { JCExpression t = parseType(); ListBuffer stats = - variableDeclarators(mods, t, new ListBuffer()); + variableDeclarators(mods, t, new ListBuffer<>()); // 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 stats = - variableDeclarators(mods, t, new ListBuffer()); + variableDeclarators(mods, t, new ListBuffer<>()); // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon storeEnd(stats.last(), token.endPos); accept(SEMI); @@ -2495,7 +2495,7 @@ accept(RPAREN); } JCBlock body = block(); - ListBuffer catchers = new ListBuffer(); + ListBuffer catchers = new ListBuffer<>(); JCBlock finalizer = null; if (token.kind == CATCH || token.kind == FINALLY) { while (token.kind == CATCH) catchers.append(catchClause()); @@ -2643,7 +2643,7 @@ * SwitchLabel = CASE ConstantExpression ":" | DEFAULT ":" */ List switchBlockStatementGroups() { - ListBuffer cases = new ListBuffer(); + ListBuffer cases = new ListBuffer<>(); while (true) { int pos = token.pos; switch (token.kind) { @@ -2730,7 +2730,7 @@ List forUpdate() { return moreStatementExpressions(token.pos, parseExpression(), - new ListBuffer()).toList(); + new ListBuffer<>()).toList(); } /** AnnotationsOpt = { '@' Annotation } @@ -2739,7 +2739,7 @@ */ List annotationsOpt(Tag kind) { if (token.kind != MONKEYS_AT) return List.nil(); // optimization - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); int prevmode = mode; while (token.kind == MONKEYS_AT) { int pos = token.pos; @@ -2768,7 +2768,7 @@ } protected JCModifiers modifiersOpt(JCModifiers partial) { long flags; - ListBuffer annotations = new ListBuffer(); + ListBuffer annotations = new ListBuffer<>(); int pos; if (partial == null) { flags = 0; @@ -2868,7 +2868,7 @@ /** AnnotationFieldValues = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" */ List annotationFieldValues() { accept(LPAREN); - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); if (token.kind != RPAREN) { buf.append(annotationFieldValue()); while (token.kind == COMMA) { @@ -2913,7 +2913,7 @@ case LBRACE: pos = token.pos; accept(LBRACE); - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); if (token.kind == COMMA) { nextToken(); } else if (token.kind != RBRACE) { @@ -3035,7 +3035,7 @@ /** Resources = Resource { ";" Resources } */ List resources() { - ListBuffer defs = new ListBuffer(); + ListBuffer defs = new ListBuffer<>(); defs.append(resource()); while (token.kind == SEMI) { // All but last of multiple declarators must subsume a semicolon @@ -3085,7 +3085,7 @@ pid = qualident(false); accept(SEMI); } - ListBuffer defs = new ListBuffer(); + ListBuffer defs = new ListBuffer<>(); boolean checkForImports = true; boolean firstTypeDecl = true; while (token.kind != EOF) { @@ -3294,7 +3294,7 @@ */ List enumBody(Name enumName) { accept(LBRACE); - ListBuffer defs = new ListBuffer(); + ListBuffer defs = new ListBuffer<>(); if (token.kind == COMMA) { nextToken(); } else if (token.kind != RBRACE && token.kind != SEMI) { @@ -3363,7 +3363,7 @@ /** TypeList = Type {"," Type} */ List typeList() { - ListBuffer ts = new ListBuffer(); + ListBuffer ts = new ListBuffer<>(); ts.append(parseType()); while (token.kind == COMMA) { nextToken(); @@ -3383,7 +3383,7 @@ if (token.kind == LBRACE) nextToken(); } - ListBuffer defs = new ListBuffer(); + ListBuffer defs = new ListBuffer<>(); while (token.kind != RBRACE && token.kind != EOF) { defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface)); if (token.pos <= endPosTable.errorEndPos) { @@ -3558,7 +3558,7 @@ /** QualidentList = [Annotations] Qualident {"," [Annotations] Qualident} */ List qualidentList() { - ListBuffer ts = new ListBuffer(); + ListBuffer ts = new ListBuffer<>(); List typeAnnos = typeAnnotationsOpt(); JCExpression qi = qualident(true); @@ -3591,7 +3591,7 @@ List typeParametersOpt() { if (token.kind == LT) { checkGenerics(); - ListBuffer typarams = new ListBuffer(); + ListBuffer typarams = new ListBuffer<>(); nextToken(); typarams.append(typeParameter()); while (token.kind == COMMA) { @@ -3616,7 +3616,7 @@ int pos = token.pos; List annos = typeAnnotationsOpt(); Name name = ident(); - ListBuffer bounds = new ListBuffer(); + ListBuffer bounds = new ListBuffer<>(); if (token.kind == EXTENDS) { nextToken(); bounds.append(parseType()); @@ -3636,7 +3636,7 @@ return formalParameters(false); } List formalParameters(boolean lambdaParameters) { - ListBuffer params = new ListBuffer(); + ListBuffer params = new ListBuffer<>(); JCVariableDecl lastParam; accept(LPAREN); if (token.kind != RPAREN) { @@ -3661,7 +3661,7 @@ if (hasParens) { accept(LPAREN); } - ListBuffer params = new ListBuffer(); + ListBuffer params = new ListBuffer<>(); if (token.kind != RPAREN && token.kind != ARROW) { params.append(implicitParameter()); while (token.kind == COMMA) { @@ -4051,7 +4051,7 @@ SimpleEndPosTable(JavacParser parser) { super(parser); - endPosMap = new HashMap(); + endPosMap = new HashMap<>(); } public void storeEnd(JCTree tree, int endpos) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/LazyDocCommentTable.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/LazyDocCommentTable.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/LazyDocCommentTable.java Wed Dec 18 16:05:18 2013 -0500 @@ -59,7 +59,7 @@ LazyDocCommentTable(ParserFactory fac) { this.fac = fac; diagSource = fac.log.currentSource(); - table = new HashMap(); + table = new HashMap<>(); } public boolean hasComment(JCTree tree) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java Wed Dec 18 16:05:18 2013 -0500 @@ -46,7 +46,7 @@ public class ParserFactory { /** The context key for the parser factory. */ - protected static final Context.Key parserFactoryKey = new Context.Key(); + protected static final Context.Key parserFactoryKey = new Context.Key<>(); public static ParserFactory instance(Context context) { ParserFactory instance = context.get(parserFactoryKey); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Scanner.java Wed Dec 18 16:05:18 2013 -0500 @@ -56,7 +56,7 @@ /** Buffer of saved tokens (used during lookahead) */ - private List savedTokens = new ArrayList(); + private List savedTokens = new ArrayList<>(); private JavaTokenizer tokenizer; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/ScannerFactory.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/ScannerFactory.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/ScannerFactory.java Wed Dec 18 16:05:18 2013 -0500 @@ -43,8 +43,7 @@ */ public class ScannerFactory { /** The context key for the scanner factory. */ - public static final Context.Key scannerFactoryKey = - new Context.Key(); + public static final Context.Key scannerFactoryKey = new Context.Key<>(); /** Get the Factory instance for this context. */ public static ScannerFactory instance(Context context) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java Wed Dec 18 16:05:18 2013 -0500 @@ -62,8 +62,7 @@ */ private Name[] tokenName = new Name[TokenKind.values().length]; - public static final Context.Key tokensKey = - new Context.Key(); + public static final Context.Key tokensKey = new Context.Key<>(); public static Tokens instance(Context context) { Tokens instance = context.get(tokensKey); @@ -316,7 +315,7 @@ DEFAULT, NAMED, STRING, - NUMERIC; + NUMERIC } /** The token kind */ diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java Wed Dec 18 16:05:18 2013 -0500 @@ -359,16 +359,16 @@ log = Log.instance(context); - fileObjectHistory = synchronizedSet(new LinkedHashSet()); - generatedSourceNames = synchronizedSet(new LinkedHashSet()); - generatedSourceFileObjects = synchronizedSet(new LinkedHashSet()); + fileObjectHistory = synchronizedSet(new LinkedHashSet<>()); + generatedSourceNames = synchronizedSet(new LinkedHashSet<>()); + generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<>()); - generatedClasses = synchronizedMap(new LinkedHashMap()); + generatedClasses = synchronizedMap(new LinkedHashMap<>()); - openTypeNames = synchronizedSet(new LinkedHashSet()); + openTypeNames = synchronizedSet(new LinkedHashSet<>()); - aggregateGeneratedSourceNames = new LinkedHashSet(); - aggregateGeneratedClassNames = new LinkedHashSet(); + aggregateGeneratedSourceNames = new LinkedHashSet<>(); + aggregateGeneratedClassNames = new LinkedHashSet<>(); lint = (Lint.instance(context)).isEnabled(PROCESSING); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed Dec 18 16:05:18 2013 -0500 @@ -201,7 +201,7 @@ } private Set initPlatformAnnotations() { - Set platformAnnotations = new HashSet(); + Set platformAnnotations = new HashSet<>(); platformAnnotations.add("java.lang.Deprecated"); platformAnnotations.add("java.lang.Override"); platformAnnotations.add("java.lang.SuppressWarnings"); @@ -374,7 +374,7 @@ try { loader.reload(); } catch(Exception e) { - ; // Ignore problems during a call to reload. + // Ignore problems during a call to reload. } } } @@ -450,7 +450,7 @@ private Map initProcessorOptions(Context context) { Options options = Options.instance(context); Set keySet = options.keySet(); - Map tempOptions = new LinkedHashMap(); + Map tempOptions = new LinkedHashMap<>(); for(String key : keySet) { if (key.startsWith("-A") && key.length() > 2) { @@ -473,7 +473,7 @@ } private Set initUnmatchedProcessorOptions() { - Set unmatchedProcessorOptions = new HashSet(); + Set unmatchedProcessorOptions = new HashSet<>(); unmatchedProcessorOptions.addAll(processorOptions.keySet()); return unmatchedProcessorOptions; } @@ -501,14 +501,14 @@ checkSourceVersionCompatibility(source, log); - supportedAnnotationPatterns = new ArrayList(); + supportedAnnotationPatterns = new ArrayList<>(); for (String importString : processor.getSupportedAnnotationTypes()) { supportedAnnotationPatterns.add(importStringToPattern(importString, processor, log)); } - supportedOptionNames = new ArrayList(); + supportedOptionNames = new ArrayList<>(); for (String optionName : processor.getSupportedOptions() ) { if (checkOptionName(optionName, log)) supportedOptionNames.add(optionName); @@ -639,7 +639,7 @@ DiscoveredProcessors(Iterator processorIterator) { this.processorIterator = processorIterator; - this.procStateList = new ArrayList(); + this.procStateList = new ArrayList<>(); } /** @@ -657,8 +657,7 @@ Set annotationsPresent, List topLevelClasses, List packageInfoFiles) { - Map unmatchedAnnotations = - new HashMap(annotationsPresent.size()); + Map unmatchedAnnotations = new HashMap<>(annotationsPresent.size()); for(TypeElement a : annotationsPresent) { unmatchedAnnotations.put(a.getQualifiedName().toString(), @@ -676,7 +675,7 @@ // were parse errors on the initial source files; however, we // are not doing processing in that case. - Set rootElements = new LinkedHashSet(); + Set rootElements = new LinkedHashSet<>(); rootElements.addAll(topLevelClasses); rootElements.addAll(packageInfoFiles); rootElements = Collections.unmodifiableSet(rootElements); @@ -688,8 +687,8 @@ while(unmatchedAnnotations.size() > 0 && psi.hasNext() ) { ProcessorState ps = psi.next(); - Set matchedNames = new HashSet(); - Set typeElements = new LinkedHashSet(); + Set matchedNames = new HashSet<>(); + Set typeElements = new LinkedHashSet<>(); for (Map.Entry entry: unmatchedAnnotations.entrySet()) { String unmatchedAnnotationName = entry.getKey(); @@ -864,7 +863,7 @@ Log.DeferredDiagnosticHandler deferredDiagnosticHandler) { this(context, 1, 0, 0, deferredDiagnosticHandler); this.roots = roots; - genClassFiles = new HashMap(); + genClassFiles = new HashMap<>(); compiler.todo.clear(); // free the compiler's resources @@ -976,7 +975,7 @@ void findAnnotationsPresent() { ComputeAnnotationSet annotationComputer = new ComputeAnnotationSet(elementUtils); // Use annotation processing to compute the set of annotations present - annotationsPresent = new LinkedHashSet(); + annotationsPresent = new LinkedHashSet<>(); for (ClassSymbol classSym : topLevelClasses) annotationComputer.scan(classSym, annotationsPresent); for (PackageSymbol pkgSym : packageInfoFiles) @@ -1162,7 +1161,7 @@ Log.DeferredDiagnosticHandler deferredDiagnosticHandler) { log = Log.instance(context); - Set specifiedPackages = new LinkedHashSet(); + Set specifiedPackages = new LinkedHashSet<>(); for (PackageSymbol psym : pckSymbols) specifiedPackages.add(psym); this.specifiedPackages = Collections.unmodifiableSet(specifiedPackages); @@ -1185,8 +1184,8 @@ // Set up next round. // Copy mutable collections returned from filer. round = round.next( - new LinkedHashSet(filer.getGeneratedSourceFileObjects()), - new LinkedHashMap(filer.getGeneratedClasses())); + new LinkedHashSet<>(filer.getGeneratedSourceFileObjects()), + new LinkedHashMap<>(filer.getGeneratedClasses())); // Check for errors during setup. if (round.unrecoverableError()) @@ -1217,7 +1216,7 @@ errorStatus = true; Set newSourceFiles = - new LinkedHashSet(filer.getGeneratedSourceFileObjects()); + new LinkedHashSet<>(filer.getGeneratedSourceFileObjects()); roots = cleanTrees(round.roots); JavaCompiler compiler = round.finalCompiler(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Wed Dec 18 16:05:18 2013 -0500 @@ -138,7 +138,7 @@ private class AnnotationSetScanner extends ElementScanner8, DeclaredType> { // Insertion-order preserving set - Set annotatedElements = new LinkedHashSet(); + Set annotatedElements = new LinkedHashSet<>(); Types typeUtil; AnnotationSetScanner(Set defaultSet, Types typeUtil) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java --- a/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Wed Dec 18 16:05:18 2013 -0500 @@ -227,10 +227,9 @@ indentation++; if (kind == ENUM) { - List enclosedElements = - new ArrayList(e.getEnclosedElements()); + List enclosedElements = new ArrayList<>(e.getEnclosedElements()); // Handle any enum constants specially before other entities. - List enumConstants = new ArrayList(); + List enumConstants = new ArrayList<>(); for(Element element : enclosedElements) { if (element.getKind() == ENUM_CONSTANT) enumConstants.add(element); @@ -333,7 +332,7 @@ if (kind == ENUM_CONSTANT) return; - Set modifiers = new LinkedHashSet(); + Set modifiers = new LinkedHashSet<>(); modifiers.addAll(e.getModifiers()); switch (kind) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java --- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Wed Dec 18 16:05:18 2013 -0500 @@ -96,7 +96,7 @@ static Set getLegacyPackages() { ResourceBundle legacyBundle = ResourceBundle.getBundle("com.sun.tools.javac.resources.legacy"); - Set keys = new HashSet(); + Set keys = new HashSet<>(); for (Enumeration e = legacyBundle.getKeys(); e.hasMoreElements(); ) keys.add(e.nextElement()); return keys; @@ -129,7 +129,7 @@ void createSymbols() throws IOException { Set legacy = getLegacyPackages(); Set legacyProprietary = getLegacyPackages(); - Set documented = new HashSet(); + Set documented = new HashSet<>(); Set packages = ((JavacProcessingEnvironment)processingEnv).getSpecifiedPackages(); Map pOptions = processingEnv.getOptions(); @@ -158,7 +158,7 @@ fm.setLocation(StandardLocation.CLASS_PATH, List.nil()); fm.setLocation(StandardLocation.SOURCE_PATH, List.nil()); { - ArrayList bootClassPath = new ArrayList(); + ArrayList bootClassPath = new ArrayList<>(); bootClassPath.add(jarFile); for (File path : fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)) { if (!new File(path.getName()).equals(new File("rt.jar"))) @@ -173,8 +173,8 @@ if (!destDir.mkdirs()) throw new RuntimeException("Could not create " + destDir); fm.setLocation(StandardLocation.CLASS_OUTPUT, List.of(destDir)); - Set hiddenPackages = new HashSet(); - Set crisp = new HashSet(); + Set hiddenPackages = new HashSet<>(); + Set crisp = new HashSet<>(); List options = List.of("-XDdev"); // options = options.prepend("-doe"); // options = options.prepend("-verbose"); @@ -192,8 +192,7 @@ 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.>of( - new Pair(profileValue, new Attribute.Constant(syms.intType, i)))); + List.>of(new Pair<>(profileValue, new Attribute.Constant(syms.intType, i)))); } Type.moreInfo = true; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java --- a/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java Wed Dec 18 16:05:18 2013 -0500 @@ -54,9 +54,9 @@ public static void main(String[] args) throws IOException { Profiles p = Profiles.read(new File(args[0])); if (args.length >= 2) { - Map> lists = new TreeMap>(); + Map> lists = new TreeMap<>(); for (int i = 1; i <= 4; i++) - lists.put(i, new TreeSet()); + lists.put(i, new TreeSet<>()); File rt_jar_lst = new File(args[1]); for (String line: Files.readAllLines(rt_jar_lst.toPath(), Charset.defaultCharset())) { @@ -101,11 +101,11 @@ final Package parent; final String name; - Map subpackages = new TreeMap(); + Map subpackages = new TreeMap<>(); int profile; - Map includedTypes = new TreeMap(); - Map excludedTypes = new TreeMap(); + Map includedTypes = new TreeMap<>(); + Map excludedTypes = new TreeMap<>(); Package(Package parent, String name) { this.parent = parent; @@ -142,7 +142,7 @@ } } - final Map packages = new TreeMap(); + final Map packages = new TreeMap<>(); final int maxProfile = 4; // Three compact profiles plus full JRE @@ -191,7 +191,7 @@ @Override public Set getPackages(int profile) { - Set results = new TreeSet(); + Set results = new TreeSet<>(); for (Package p: packages.values()) p.getPackages(profile, results); return results; @@ -255,7 +255,7 @@ SimpleProfiles(Properties p) { int max = 0; - map = new HashMap(); + map = new HashMap<>(); for (Map.Entry e: p.entrySet()) { String typeName = (String) e.getKey(); int profile = Integer.valueOf((String) e.getValue()); @@ -277,7 +277,7 @@ @Override public Set getPackages(int profile) { - Set results = new TreeSet(); + Set results = new TreeSet<>(); for (Map.Entry e: map.entrySet()) { String tn = e.getKey(); int prf = e.getValue(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java Wed Dec 18 16:05:18 2013 -0500 @@ -48,8 +48,7 @@ public class DocTreeMaker { /** The context key for the tree factory. */ - protected static final Context.Key treeMakerKey = - new Context.Key(); + protected static final Context.Key treeMakerKey = new Context.Key<>(); /** Get the TreeMaker instance. */ public static DocTreeMaker instance(Context context) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Wed Dec 18 16:05:18 2013 -0500 @@ -522,7 +522,7 @@ return packageAnnotations; } public List getImports() { - ListBuffer imports = new ListBuffer(); + ListBuffer imports = new ListBuffer<>(); for (JCTree tree : defs) { if (tree.hasTag(IMPORT)) imports.append((JCImport)tree); @@ -624,7 +624,7 @@ /** poly expression to be treated as a standalone expression */ STANDALONE, /** true poly expression */ - POLY; + POLY } /** is this poly expression a 'true' poly expression? */ @@ -1590,7 +1590,7 @@ public enum ParameterKind { IMPLICIT, - EXPLICIT; + EXPLICIT } public List params; @@ -1921,7 +1921,7 @@ public enum OverloadKind { OVERLOADED, - UNOVERLOADED; + UNOVERLOADED } /** diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Wed Dec 18 16:05:18 2013 -0500 @@ -65,7 +65,7 @@ public List copy(List trees, P p) { if (trees == null) return null; - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (T tree: trees) lb.append(copy(tree, p)); return lb.toList(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Dec 18 16:05:18 2013 -0500 @@ -49,8 +49,7 @@ * deletion without notice. */ public class TreeInfo { - protected static final Context.Key treeInfoKey = - new Context.Key(); + protected static final Context.Key treeInfoKey = new Context.Key<>(); public static TreeInfo instance(Context context) { TreeInfo instance = context.get(treeInfoKey); @@ -727,7 +726,7 @@ /** Return the types of a list of trees. */ public static List types(List trees) { - ListBuffer ts = new ListBuffer(); + ListBuffer ts = new ListBuffer<>(); for (List l = trees; l.nonEmpty(); l = l.tail) ts.append(l.head.type); return ts.toList(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Wed Dec 18 16:05:18 2013 -0500 @@ -47,8 +47,7 @@ public class TreeMaker implements JCTree.Factory { /** The context key for the tree factory. */ - protected static final Context.Key treeMakerKey = - new Context.Key(); + protected static final Context.Key treeMakerKey = new Context.Key<>(); /** Get the TreeMaker instance. */ public static TreeMaker instance(Context context) { @@ -609,7 +608,7 @@ * in given list of variable declarations. */ public List Idents(List params) { - ListBuffer ids = new ListBuffer(); + ListBuffer ids = new ListBuffer<>(); for (List l = params; l.nonEmpty(); l = l.tail) ids.append(Ident(l.head)); return ids.toList(); @@ -710,7 +709,7 @@ /** Create a list of trees representing given list of types. */ public List Types(List ts) { - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (List l = ts; l.nonEmpty(); l = l.tail) lb.append(Type(l.head)); return lb.toList(); @@ -733,7 +732,7 @@ */ public List Annotations(List attributes) { if (attributes == null) return List.nil(); - ListBuffer result = new ListBuffer(); + ListBuffer result = new ListBuffer<>(); for (List i = attributes; i.nonEmpty(); i=i.tail) { Attribute a = i.head; result.append(Annotation(a)); @@ -800,7 +799,7 @@ } } public JCAnnotation visitCompoundInternal(Attribute.Compound compound) { - ListBuffer args = new ListBuffer(); + ListBuffer args = new ListBuffer<>(); for (List> values = compound.values; values.nonEmpty(); values=values.tail) { Pair pair = values.head; JCExpression valueTree = translate(pair.snd); @@ -809,7 +808,7 @@ return Annotation(Type(compound.type), args.toList()); } public JCAnnotation visitTypeCompoundInternal(Attribute.TypeCompound compound) { - ListBuffer args = new ListBuffer(); + ListBuffer args = new ListBuffer<>(); for (List> values = compound.values; values.nonEmpty(); values=values.tail) { Pair pair = values.head; JCExpression valueTree = translate(pair.snd); @@ -818,7 +817,7 @@ return TypeAnnotation(Type(compound.type), args.toList()); } public void visitArray(Attribute.Array array) { - ListBuffer elems = new ListBuffer(); + ListBuffer elems = new ListBuffer<>(); for (int i = 0; i < array.values.length; i++) elems.append(translate(array.values[i])); result = NewArray(null, List.nil(), elems.toList()).setType(array.type); @@ -881,7 +880,7 @@ /** Create a list of type parameter trees from a list of type variables. */ public List TypeParams(List typarams) { - ListBuffer tparams = new ListBuffer(); + ListBuffer tparams = new ListBuffer<>(); for (List l = typarams; l.nonEmpty(); l = l.tail) tparams.append(TypeParam(l.head.tsym.name, (TypeVar)l.head)); return tparams.toList(); @@ -897,7 +896,7 @@ * their types and an their owner. */ public List Params(List argtypes, Symbol owner) { - ListBuffer params = new ListBuffer(); + ListBuffer params = new ListBuffer<>(); MethodSymbol mth = (owner.kind == MTH) ? ((MethodSymbol)owner) : null; if (mth != null && mth.params != null && argtypes.length() == mth.params.length()) { for (VarSymbol param : ((MethodSymbol)owner).params) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java Wed Dec 18 16:05:18 2013 -0500 @@ -156,7 +156,7 @@ * @return a Collection whose elements are the formatted arguments of the diagnostic */ protected Collection formatArguments(JCDiagnostic d, Locale l) { - ListBuffer buf = new ListBuffer(); + ListBuffer buf = new ListBuffer<>(); for (Object o : d.getArgs()) { buf.append(formatArgument(d, o, l)); } @@ -389,7 +389,7 @@ protected boolean caretEnabled; public SimpleConfiguration(Set parts) { - multilineLimits = new HashMap(); + multilineLimits = new HashMap<>(); setVisible(parts); setMultilineLimit(MultilineLimit.DEPTH, -1); setMultilineLimit(MultilineLimit.LENGTH, -1); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java Wed Dec 18 16:05:18 2013 -0500 @@ -45,9 +45,21 @@ * deletion without notice. */ public abstract class AbstractLog { + /** Factory for diagnostics + */ + protected JCDiagnostic.Factory diags; + + /** The file that's currently being translated. + */ + protected DiagnosticSource source; + + /** A cache of lightweight DiagnosticSource objects. + */ + protected Map sourceMap; + AbstractLog(JCDiagnostic.Factory diags) { this.diags = diags; - sourceMap = new HashMap(); + sourceMap = new HashMap<>(); } /** Re-assign source, returning previous setting. @@ -246,16 +258,4 @@ private DiagnosticPosition wrap(int pos) { return (pos == Position.NOPOS ? null : new SimpleDiagnosticPosition(pos)); } - - /** Factory for diagnostics - */ - protected JCDiagnostic.Factory diags; - - /** The file that's currently being translated. - */ - protected DiagnosticSource source; - - /** A cache of lightweight DiagnosticSource objects. - */ - protected Map sourceMap; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Wed Dec 18 16:05:18 2013 -0500 @@ -122,7 +122,7 @@ Class.forName(classLoaderClass).asSubclass(ClassLoader.class); Class[] constrArgTypes = { URL[].class, ClassLoader.class }; Constructor constr = loader.getConstructor(constrArgTypes); - return constr.newInstance(new Object[] { urls, thisClassLoader }); + return constr.newInstance(urls, thisClassLoader); } catch (Throwable t) { // ignore errors loading user-provided class loader, fall through } @@ -356,8 +356,7 @@ contentCache.remove(file); } - protected final Map contentCache - = new HashMap(); + protected final Map contentCache = new HashMap<>(); protected static class ContentCacheEntry { final long timestamp; @@ -365,7 +364,7 @@ ContentCacheEntry(JavaFileObject file, CharBuffer cb) { this.timestamp = file.getLastModified(); - this.ref = new SoftReference(cb); + this.ref = new SoftReference<>(cb); } boolean isValid(JavaFileObject file) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Wed Dec 18 16:05:18 2013 -0500 @@ -288,7 +288,7 @@ } private void initFormats(String pos, String nopos, String clazz) { - availableFormats = new EnumMap(BasicFormatKind.class); + availableFormats = new EnumMap<>(BasicFormatKind.class); setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, pos); setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, nopos); setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, clazz); @@ -308,7 +308,7 @@ } private void initIndentation() { - indentationLevels = new HashMap(); + indentationLevels = new HashMap<>(); setIndentation(DiagnosticPart.SUMMARY, 0); setIndentation(DiagnosticPart.DETAILS, DetailsInc); setIndentation(DiagnosticPart.SUBDIAGNOSTICS, DiagInc); @@ -368,7 +368,7 @@ * Source line is displayed after the first line of the diagnostic * message */ - AFTER_SUMMARY; + AFTER_SUMMARY } /** @@ -406,7 +406,7 @@ /** * A format string to be used for diagnostics regarding classfiles */ - DEFAULT_CLASS_FORMAT; + DEFAULT_CLASS_FORMAT } } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/Context.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java Wed Dec 18 16:05:18 2013 -0500 @@ -109,7 +109,7 @@ */ public static interface Factory { T make(Context c); - }; + } /** * The underlying map storing the data. @@ -119,7 +119,7 @@ * or * {@literal Key -> Factory } */ - private Map,Object> ht = new HashMap,Object>(); + private Map,Object> ht = new HashMap<>(); /** Set the factory for the key in this context. */ public void put(Key key, Factory fac) { @@ -166,7 +166,7 @@ /** * The table of preregistered factories. */ - private Map,Factory> ft = new HashMap,Factory>(); + private Map,Factory> ft = new HashMap<>(); public Context(Context prev) { kt.putAll(prev.kt); // retain all implicit keys @@ -177,13 +177,13 @@ /* * The key table, providing a unique Key for each Class. */ - private Map, Key> kt = new HashMap, Key>(); + private Map, Key> kt = new HashMap<>(); private Key key(Class clss) { checkState(kt); Key k = uncheckedCast(kt.get(clss)); if (k == null) { - k = new Key(); + k = new Key<>(); kt.put(clss, k); } return k; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java Wed Dec 18 16:05:18 2013 -0500 @@ -191,7 +191,7 @@ buf = cs.toString().toCharArray(); bufLen = buf.length; } - refBuf = new SoftReference(buf); + refBuf = new SoftReference<>(buf); return buf; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java Wed Dec 18 16:05:18 2013 -0500 @@ -50,8 +50,7 @@ /** A factory for creating diagnostic objects. */ public static class Factory { /** The context key for the diagnostic factory. */ - protected static final Context.Key diagnosticFactoryKey = - new Context.Key(); + protected static final Context.Key diagnosticFactoryKey = new Context.Key<>(); /** Get the Factory instance for this context. */ public static Factory instance(Context context) { @@ -292,7 +291,7 @@ DiagnosticType(String key) { this.key = key; } - }; + } /** * A DiagnosticPosition provides information about the positions in a file diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java Wed Dec 18 16:05:18 2013 -0500 @@ -44,8 +44,7 @@ */ public class JavacMessages implements Messages { /** The context key for the JavacMessages object. */ - public static final Context.Key messagesKey = - new Context.Key(); + public static final Context.Key messagesKey = new Context.Key<>(); /** Get the JavacMessages instance for this context. */ public static JavacMessages instance(Context context) { @@ -93,7 +92,7 @@ */ public JavacMessages(String bundleName, Locale locale) throws MissingResourceException { bundleNames = List.nil(); - bundleCache = new HashMap>>(); + bundleCache = new HashMap<>(); add(bundleName); setCurrentLocale(locale); } @@ -124,7 +123,7 @@ throw new InternalError("Cannot find javac resource bundle for locale " + locale); } } - bundleCache.put(locale, new SoftReference>(bundleList)); + bundleCache.put(locale, new SoftReference<>(bundleList)); } return bundleList; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/List.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java Wed Dec 18 16:05:18 2013 -0500 @@ -132,26 +132,26 @@ /** Construct a list consisting of given element. */ public static List of(A x1) { - return new List(x1, List.nil()); + return new List<>(x1, List.nil()); } /** Construct a list consisting of given elements. */ public static List of(A x1, A x2) { - return new List(x1, of(x2)); + return new List<>(x1, of(x2)); } /** Construct a list consisting of given elements. */ public static List of(A x1, A x2, A x3) { - return new List(x1, of(x2, x3)); + return new List<>(x1, of(x2, x3)); } /** Construct a list consisting of given elements. */ @SuppressWarnings({"varargs", "unchecked"}) public static List of(A x1, A x2, A x3, A... rest) { - return new List(x1, new List(x2, new List(x3, from(rest)))); + return new List<>(x1, new List<>(x2, new List<>(x3, from(rest)))); } /** @@ -162,7 +162,7 @@ List xs = nil(); if (array != null) for (int i = array.length - 1; i >= 0; i--) - xs = new List(array[i], xs); + xs = new List<>(array[i], xs); return xs; } @@ -181,7 +181,7 @@ @Deprecated public static List fill(int len, A init) { List l = nil(); - for (int i = 0; i < len; i++) l = new List(init, l); + for (int i = 0; i < len; i++) l = new List<>(init, l); return l; } @@ -225,7 +225,7 @@ * a new list. */ public List prepend(A x) { - return new List(x, this); + return new List<>(x, this); } /** Prepend given list of elements to front of list, forming and returning @@ -261,7 +261,7 @@ List rev = nil(); for (List l = this; l.nonEmpty(); l = l.tail) - rev = new List(l.head, rev); + rev = new List<>(l.head, rev); return rev; } @@ -526,7 +526,7 @@ if (fromIndex < 0 || toIndex > size() || fromIndex > toIndex) throw new IllegalArgumentException(); - ArrayList a = new ArrayList(toIndex - fromIndex); + ArrayList a = new ArrayList<>(toIndex - fromIndex); int i = 0; for (List l = this; l.tail != null; l = l.tail, i++) { if (i == toIndex) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java Wed Dec 18 16:05:18 2013 -0500 @@ -41,7 +41,7 @@ public class ListBuffer extends AbstractQueue { public static ListBuffer of(T x) { - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); lb.add(x); return lb; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/Log.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Wed Dec 18 16:05:18 2013 -0500 @@ -53,12 +53,10 @@ */ public class Log extends AbstractLog { /** The context key for the log. */ - public static final Context.Key logKey - = new Context.Key(); + public static final Context.Key logKey = new Context.Key<>(); /** The context key for the output PrintWriter. */ - public static final Context.Key outKey = - new Context.Key(); + public static final Context.Key outKey = new Context.Key<>(); /* TODO: Should unify this with prefix handling in JCDiagnostic.Factory. */ public enum PrefixKind { @@ -164,7 +162,7 @@ } } - public enum WriterKind { NOTICE, WARNING, ERROR }; + public enum WriterKind { NOTICE, WARNING, ERROR } protected PrintWriter errWriter; @@ -270,7 +268,7 @@ String ek = options.get("expectKeys"); if (ek != null) - expectDiagKeys = new HashSet(Arrays.asList(ek.split(", *"))); + expectDiagKeys = new HashSet<>(Arrays.asList(ek.split(", *"))); } private int getIntOption(Options options, Option option, int defaultValue) { @@ -339,7 +337,7 @@ * error message more than once. For each error, a pair consisting of the * source file name and source code position of the error is added to the set. */ - private Set> recorded = new HashSet>(); + private Set> recorded = new HashSet<>(); public boolean hasDiagnosticListener() { return diagListener != null; @@ -435,7 +433,7 @@ if (multipleErrors || file == null) return true; - Pair coords = new Pair(file, pos); + Pair coords = new Pair<>(file, pos); boolean shouldReport = !recorded.contains(coords); if (shouldReport) recorded.add(coords); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Wed Dec 18 16:05:18 2013 -0500 @@ -126,7 +126,7 @@ if (verbose) { if (sourcesWithReportedWarnings == null) - sourcesWithReportedWarnings = new HashSet(); + sourcesWithReportedWarnings = new HashSet<>(); if (log.nwarnings < log.MaxWarnings) { // generate message and remember the source file diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/Names.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java Wed Dec 18 16:05:18 2013 -0500 @@ -36,7 +36,7 @@ */ public class Names { - public static final Context.Key namesKey = new Context.Key(); + public static final Context.Key namesKey = new Context.Key<>(); public static Names instance(Context context) { Names instance = context.get(namesKey); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/Options.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/Options.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Options.java Wed Dec 18 16:05:18 2013 -0500 @@ -42,8 +42,7 @@ private static final long serialVersionUID = 0; /** The context key for the options. */ - public static final Context.Key optionsKey = - new Context.Key(); + public static final Context.Key optionsKey = new Context.Key<>(); private LinkedHashMap values; @@ -57,7 +56,7 @@ protected Options(Context context) { // DEBUGGING -- Use LinkedHashMap for reproducability - values = new LinkedHashMap(); + values = new LinkedHashMap<>(); context.put(optionsKey, this); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/Pair.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java Wed Dec 18 16:05:18 2013 -0500 @@ -62,6 +62,6 @@ } public static Pair of(A a, B b) { - return new Pair(a,b); + return new Pair<>(a,b); } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Wed Dec 18 16:05:18 2013 -0500 @@ -97,10 +97,10 @@ this.diags = JCDiagnostic.Factory.instance(context); this.types = Types.instance(context); this.messages = JavacMessages.instance(context); - whereClauses = new EnumMap>(WhereClauseKind.class); + 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<>()); } @Override @@ -279,7 +279,7 @@ protected class ClassNameSimplifier { /* table for keeping track of all short name usages */ - Map> nameClashes = new HashMap>(); + Map> nameClashes = new HashMap<>(); /** * Add a name usage to the simplifier's internal cache @@ -322,7 +322,7 @@ } return name; } - }; + } // // @@ -437,7 +437,7 @@ return ms; } } - }; + } // // @@ -704,7 +704,7 @@ /** full class names simplification (where possible) */ SIMPLE_NAMES, /** type-variable names disambiguation */ - UNIQUE_TYPEVAR_NAMES; + UNIQUE_TYPEVAR_NAMES } } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/SharedNameTable.java Wed Dec 18 16:05:18 2013 -0500 @@ -53,7 +53,7 @@ } static private synchronized void dispose(SharedNameTable t) { - freelist = freelist.prepend(new SoftReference(t)); + freelist = freelist.prepend(new SoftReference<>(t)); } /** The hash table for names. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -545,7 +545,7 @@ * Return an empty array if there are no interfaces. */ public ClassDoc[] interfaces() { - ListBuffer ta = new ListBuffer(); + ListBuffer ta = new ListBuffer<>(); for (Type t : env.types.interfaces(type)) { ta.append(env.getClassDoc((ClassSymbol)t.tsym)); } @@ -716,7 +716,7 @@ * are not included. */ public ClassDoc[] innerClasses(boolean filter) { - ListBuffer innerClasses = new ListBuffer(); + ListBuffer innerClasses = new ListBuffer<>(); for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) { if (e.sym != null && e.sym.kind == Kinds.TYP) { ClassSymbol s = (ClassSymbol)e.sym; @@ -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<>()); } 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<>()); } private FieldDocImpl searchField(String fieldName, Set searched) { @@ -1106,7 +1106,7 @@ // information is not available for binary classfiles if (tsym.sourcefile == null) return new ClassDoc[0]; - ListBuffer importedClasses = new ListBuffer(); + ListBuffer importedClasses = new ListBuffer<>(); Env compenv = env.enter.getEnv(tsym); if (compenv == null) return new ClassDocImpl[0]; @@ -1144,7 +1144,7 @@ // information is not available for binary classfiles if (tsym.sourcefile == null) return new PackageDoc[0]; - ListBuffer importedPackages = new ListBuffer(); + ListBuffer importedPackages = new ListBuffer<>(); //### Add the implicit "import java.lang.*" to the result Names names = tsym.name.table.names; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/Comment.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java Wed Dec 18 16:05:18 2013 -0500 @@ -50,7 +50,7 @@ /** * sorted comments with different tags. */ - private final ListBuffer tagList = new ListBuffer(); + private final ListBuffer tagList = new ListBuffer<>(); /** * text minus any tags. @@ -218,7 +218,7 @@ * Return tags of the specified kind in this comment. */ Tag[] tags(String tagname) { - ListBuffer found = new ListBuffer(); + ListBuffer found = new ListBuffer<>(); String target = tagname; if (target.charAt(0) != '@') { target = "@" + target; @@ -235,7 +235,7 @@ * Return throws tags in this comment. */ ThrowsTag[] throwsTags() { - ListBuffer found = new ListBuffer(); + ListBuffer found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof ThrowsTag) { found.append((ThrowsTag)next); @@ -264,7 +264,7 @@ * param tags. */ private ParamTag[] paramTags(boolean typeParams) { - ListBuffer found = new ListBuffer(); + ListBuffer found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof ParamTag) { ParamTag p = (ParamTag)next; @@ -280,7 +280,7 @@ * Return see also tags in this comment. */ SeeTag[] seeTags() { - ListBuffer found = new ListBuffer(); + ListBuffer found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof SeeTag) { found.append((SeeTag)next); @@ -293,7 +293,7 @@ * Return serialField tags in this comment. */ SerialFieldTag[] serialFieldTags() { - ListBuffer found = new ListBuffer(); + ListBuffer found = new ListBuffer<>(); for (Tag next : tagList) { if (next instanceof SerialFieldTag) { found.append((SerialFieldTag)next); @@ -306,7 +306,7 @@ * Return array of tags with text and inline See Tags for a Doc comment. */ static Tag[] getInlineTags(DocImpl holder, String inlinetext) { - ListBuffer taglist = new ListBuffer(); + ListBuffer taglist = new ListBuffer<>(); int delimend = 0, textstart = 0, len = inlinetext.length(); boolean inPre = false; DocEnv docenv = holder.env; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java Wed Dec 18 16:05:18 2013 -0500 @@ -62,8 +62,7 @@ * @author Scott Seligman (generics) */ public class DocEnv { - protected static final Context.Key docEnvKey = - new Context.Key(); + protected static final Context.Key docEnvKey = new Context.Key<>(); public static DocEnv instance(Context context) { DocEnv instance = context.get(docEnvKey); @@ -110,7 +109,7 @@ Context context; DocLint doclint; - WeakHashMap treePaths = new WeakHashMap(); + WeakHashMap treePaths = new WeakHashMap<>(); /** Allow documenting from class files? */ boolean docClasses = false; @@ -544,8 +543,7 @@ messager.exit(); } - protected Map packageMap = - new HashMap(); + protected Map packageMap = new HashMap<>(); /** * Return the PackageDoc of this package symbol. */ @@ -571,8 +569,7 @@ } - protected Map classMap = - new HashMap(); + protected Map classMap = new HashMap<>(); /** * Return the ClassDoc (or a subtype) of this class symbol. */ @@ -613,8 +610,7 @@ return (tree.mods.flags & Flags.ANNOTATION) != 0; } - protected Map fieldMap = - new HashMap(); + protected Map fieldMap = new HashMap<>(); /** * Return the FieldDoc of this var symbol. */ @@ -638,8 +634,7 @@ } } - protected Map methodMap = - new HashMap(); + protected Map methodMap = new HashMap<>(); /** * Create a MethodDoc for this MethodSymbol. * Should be called only on symbols representing methods. @@ -805,7 +800,7 @@ } void initDoclint(Collection opts, Collection customTagNames) { - ArrayList doclintOpts = new ArrayList(); + ArrayList doclintOpts = new ArrayList<>(); for (String opt: opts) { doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -155,7 +155,7 @@ * thrown by this method. */ public ClassDoc[] thrownExceptions() { - ListBuffer l = new ListBuffer(); + ListBuffer l = new ListBuffer<>(); for (Type ex : sym.type.getThrownTypes()) { ex = env.types.erasure(ex); //### Will these casts succeed in the face of static semantic diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java Wed Dec 18 16:05:18 2013 -0500 @@ -136,9 +136,9 @@ docenv.legacyDoclet = legacyDoclet; javadocReader.sourceCompleter = docClasses ? null : thisCompleter; - ListBuffer names = new ListBuffer(); - ListBuffer classTrees = new ListBuffer(); - ListBuffer packTrees = new ListBuffer(); + ListBuffer names = new ListBuffer<>(); + ListBuffer classTrees = new ListBuffer<>(); + ListBuffer packTrees = new ListBuffer<>(); try { StandardJavaFileManager fm = docenv.fileManager instanceof StandardJavaFileManager @@ -226,7 +226,7 @@ if (files == null) { Location location = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (JavaFileObject fo: docenv.fileManager.list( location, name, EnumSet.of(JavaFileObject.Kind.SOURCE), false)) { String binaryName = docenv.fileManager.inferBinaryName(location, fo); @@ -259,10 +259,9 @@ ListBuffer packages, List excludedPackages) throws IOException { - Map> packageFiles = - new HashMap>(); + Map> packageFiles = new HashMap<>(); - Map includedPackages = new HashMap(); + Map includedPackages = new HashMap<>(); includedPackages.put("", true); for (String p: excludedPackages) includedPackages.put(p, false); @@ -427,7 +426,7 @@ * From a list of top level trees, return the list of contained class definitions */ List listClasses(List trees) { - ListBuffer result = new ListBuffer(); + ListBuffer result = new ListBuffer<>(); for (JCCompilationUnit t : trees) { for (JCTree def : t.defs) { if (def.hasTag(JCTree.Tag.CLASSDEF)) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -145,7 +145,7 @@ if (allClassesFiltered != null && filtered) { return allClassesFiltered; } - ListBuffer classes = new ListBuffer(); + ListBuffer classes = new ListBuffer<>(); for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) { if (e.sym != null) { ClassSymbol s = (ClassSymbol)e.sym; @@ -198,7 +198,7 @@ * @return included ordinary classes in this package. */ public ClassDoc[] ordinaryClasses() { - ListBuffer ret = new ListBuffer(); + ListBuffer ret = new ListBuffer<>(); for (ClassDocImpl c : getClasses(true)) { if (c.isOrdinaryClass()) { ret.append(c); @@ -213,7 +213,7 @@ * @return included Exceptions in this package. */ public ClassDoc[] exceptions() { - ListBuffer ret = new ListBuffer(); + ListBuffer ret = new ListBuffer<>(); for (ClassDocImpl c : getClasses(true)) { if (c.isException()) { ret.append(c); @@ -228,7 +228,7 @@ * @return included Errors in this package. */ public ClassDoc[] errors() { - ListBuffer ret = new ListBuffer(); + ListBuffer ret = new ListBuffer<>(); for (ClassDocImpl c : getClasses(true)) { if (c.isError()) { ret.append(c); @@ -243,7 +243,7 @@ * @return included enum types in this package. */ public ClassDoc[] enums() { - ListBuffer ret = new ListBuffer(); + ListBuffer ret = new ListBuffer<>(); for (ClassDocImpl c : getClasses(true)) { if (c.isEnum()) { ret.append(c); @@ -258,7 +258,7 @@ * @return included interfaces in this package. */ public ClassDoc[] interfaces() { - ListBuffer ret = new ListBuffer(); + ListBuffer ret = new ListBuffer<>(); for (ClassDocImpl c : getClasses(true)) { if (c.isInterface()) { ret.append(c); @@ -273,8 +273,7 @@ * @return included annotation types in this package. */ public AnnotationTypeDoc[] annotationTypes() { - ListBuffer ret = - new ListBuffer(); + ListBuffer ret = new ListBuffer<>(); for (ClassDocImpl c : getClasses(true)) { if (c.isAnnotationType()) { ret.append((AnnotationTypeDocImpl)c); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -97,7 +97,7 @@ super(env, null); this.options = options; cmdLinePackages = List.nil(); - ListBuffer classList = new ListBuffer(); + ListBuffer classList = new ListBuffer<>(); for (String className : classes) { ClassDocImpl c = env.loadClass(className); if (c == null) @@ -116,7 +116,7 @@ * @param classes a list of ClassDeclaration */ private void setClasses(DocEnv env, List classes) { - ListBuffer result = new ListBuffer(); + ListBuffer result = new ListBuffer<>(); for (JCClassDecl def : classes) { //### Do we want modifier check here? if (env.shouldDocument(def.sym)) { @@ -137,7 +137,7 @@ * @param packages a list of package names (String) */ private void setPackages(DocEnv env, List packages) { - ListBuffer packlist = new ListBuffer(); + ListBuffer packlist = new ListBuffer<>(); for (String name : packages) { PackageDocImpl pkg = env.lookupPackage(name); if (pkg != null) { @@ -183,7 +183,7 @@ * Classes and interfaces specified on the command line. */ public ClassDoc[] specifiedClasses() { - ListBuffer classesToDocument = new ListBuffer(); + ListBuffer classesToDocument = new ListBuffer<>(); for (ClassDocImpl cd : cmdLineClasses) { cd.addAllClasses(classesToDocument, true); } @@ -195,7 +195,7 @@ * packages) to be documented. */ public ClassDoc[] classes() { - ListBuffer classesToDocument = new ListBuffer(); + ListBuffer classesToDocument = new ListBuffer<>(); for (ClassDocImpl cd : cmdLineClasses) { cd.addAllClasses(classesToDocument, true); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java Wed Dec 18 16:05:18 2013 -0500 @@ -426,7 +426,7 @@ ParameterParseMachine(String parameters) { this.parameters = parameters; - this.paramList = new ListBuffer(); + this.paramList = new ListBuffer<>(); typeId = new StringBuilder(); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java Wed Dec 18 16:05:18 2013 -0500 @@ -68,14 +68,14 @@ * @author Neal Gafter (rewrite but not too proud) */ class SerializedForm { - ListBuffer methods = new ListBuffer(); + ListBuffer methods = new ListBuffer<>(); /* List of FieldDocImpl - Serializable fields. * Singleton list if class defines Serializable fields explicitly. * Otherwise, list of default serializable fields. * 0 length list for Externalizable. */ - private final ListBuffer fields = new ListBuffer(); + private final ListBuffer fields = new ListBuffer<>(); /* True if class specifies serializable fields explicitly. * using special static member, serialPersistentFields. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/Start.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/Start.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/Start.java Wed Dec 18 16:05:18 2013 -0500 @@ -207,7 +207,7 @@ } public boolean begin(Class docletClass, Iterable options, Iterable fileObjects) { - Collection opts = new ArrayList(); + Collection opts = new ArrayList<>(); for (String opt: options) opts.add(opt); return begin(docletClass, opts.toArray(new String[opts.size()]), fileObjects); } @@ -251,7 +251,7 @@ Iterable fileObjects) throws IOException { long tm = System.currentTimeMillis(); - ListBuffer javaNames = new ListBuffer(); + ListBuffer javaNames = new ListBuffer<>(); // Preprocess @file arguments try { @@ -314,7 +314,7 @@ if ((i + optionLength) > argv.length) { usageError("main.requires_argument", arg); } - ListBuffer args = new ListBuffer(); + ListBuffer args = new ListBuffer<>(); for (int j = 0; j < optionLength-1; ++j) { args.append(argv[++i]); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javadoc/ToolOption.java --- a/langtools/src/share/classes/com/sun/tools/javadoc/ToolOption.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javadoc/ToolOption.java Wed Dec 18 16:05:18 2013 -0500 @@ -266,13 +266,13 @@ static abstract class Helper { /** List of decoded options. */ - final ListBuffer options = new ListBuffer(); + final ListBuffer options = new ListBuffer<>(); /** Selected packages, from -subpackages. */ - final ListBuffer subPackages = new ListBuffer(); + final ListBuffer subPackages = new ListBuffer<>(); /** Excluded packages, from -exclude. */ - final ListBuffer excludedPackages = new ListBuffer(); + final ListBuffer excludedPackages = new ListBuffer<>(); /** javac options, set by various options. */ Options compOpts; // = Options.instance(context) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javah/Gen.java --- a/langtools/src/share/classes/com/sun/tools/javah/Gen.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javah/Gen.java Wed Dec 18 16:05:18 2013 -0500 @@ -347,9 +347,9 @@ */ List getAllFields(TypeElement subclazz) { - List fields = new ArrayList(); + List fields = new ArrayList<>(); TypeElement cd = null; - Stack s = new Stack(); + Stack s = new Stack<>(); cd = subclazz; while (true) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javah/JNI.java --- a/langtools/src/share/classes/com/sun/tools/javah/JNI.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javah/JNI.java Wed Dec 18 16:05:18 2013 -0500 @@ -108,7 +108,7 @@ Mangle.Type.METHOD_JNI_SHORT)); pw.print(" (JNIEnv *, "); List paramargs = md.getParameters(); - List args = new ArrayList(); + List args = new ArrayList<>(); for (VariableElement p: paramargs) { args.add(types.erasure(p.asType())); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javah/JavahTask.java --- a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java Wed Dec 18 16:05:18 2013 -0500 @@ -262,7 +262,7 @@ throw new IllegalArgumentException(e.getMessage()); } - this.classes = new ArrayList(); + this.classes = new ArrayList<>(); if (classes != null) { for (String classname: classes) { classname.getClass(); // null-check @@ -367,7 +367,7 @@ handleOption(arg, iter); else if (allowClasses) { if (classes == null) - classes = new ArrayList(); + classes = new ArrayList<>(); classes.add(arg); while (iter.hasNext()) classes.add(iter.next()); @@ -414,7 +414,7 @@ private Iterable expandAtArgs(Iterable args) throws BadArgs { try { - List l = new ArrayList(); + List l = new ArrayList<>(); for (String arg: args) l.add(arg); return Arrays.asList(CommandLine.parse(l.toArray(new String[l.size()]))); } catch (FileNotFoundException e) { @@ -497,7 +497,7 @@ ((JavahFileManager) fileManager).setSymbolFileEnabled(false); JavaCompiler c = ToolProvider.getSystemJavaCompiler(); - List opts = new ArrayList(); + List opts = new ArrayList<>(); opts.add("-proc:only"); opts.addAll(javac_extras); CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null); @@ -511,7 +511,7 @@ } private List pathToFiles(String path) { - List files = new ArrayList(); + List files = new ArrayList<>(); for (String f: path.split(File.pathSeparator)) { if (f.length() > 0) files.add(new File(f)); @@ -618,7 +618,7 @@ // could make this a HashMap> // and for efficiency, keep a hard reference to the bundle for the task // locale - bundles = new HashMap(); + bundles = new HashMap<>(); } if (locale == null) @@ -657,7 +657,7 @@ boolean llni; boolean doubleAlign; boolean force; - Set javac_extras = new LinkedHashSet(); + Set javac_extras = new LinkedHashSet<>(); PrintWriter log; JavaFileManager fileManager; @@ -711,7 +711,7 @@ } private Set getAllClasses(Set classes) { - Set allClasses = new LinkedHashSet(); + Set allClasses = new LinkedHashSet<>(); getAllClasses0(classes, allClasses); return allClasses; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javah/LLNI.java --- a/langtools/src/share/classes/com/sun/tools/javah/LLNI.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javah/LLNI.java Wed Dec 18 16:05:18 2013 -0500 @@ -89,7 +89,7 @@ protected void generateDeclsForClass(PrintWriter pw, TypeElement clazz, String cname) throws TypeSignature.SignatureException, Util.Exit { - doneHandleTypes = new HashSet(); + doneHandleTypes = new HashSet<>(); /* The following handle types are predefined in "typedefs.h". Suppress inclusion in the output by generating them "into the blue" here. */ genHandleType(null, "java.lang.Class"); @@ -453,7 +453,7 @@ res = "JNIEXPORT " + jniType(retType) + " JNICALL" + lineSep + jniMethodName(method, cname, longName) + "(JNIEnv *, " + cRcvrDecl(method, cname); List params = method.getParameters(); - List argTypes = new ArrayList(); + List argTypes = new ArrayList<>(); for (VariableElement p: params){ argTypes.add(types.erasure(p.asType())); } @@ -488,7 +488,7 @@ if (longName) { TypeMirror mType = types.erasure(method.getReturnType()); List params = method.getParameters(); - List argTypes = new ArrayList(); + List argTypes = new ArrayList<>(); for (VariableElement param: params) { argTypes.add(types.erasure(param.asType())); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javah/Mangle.java --- a/langtools/src/share/classes/com/sun/tools/javah/Mangle.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javah/Mangle.java Wed Dec 18 16:05:18 2013 -0500 @@ -55,7 +55,7 @@ public static final int METHOD_JDK_1 = 6; public static final int METHOD_JNI_SHORT = 7; public static final int METHOD_JNI_LONG = 8; - }; + } private Elements elems; private Types types; @@ -176,7 +176,7 @@ } /* Warning: Intentional ASCII operation. */ - private static final boolean isalnum(char ch) { + private static boolean isalnum(char ch) { return ch <= 0x7f && /* quick test */ ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || @@ -184,7 +184,7 @@ } /* Warning: Intentional ASCII operation. */ - private static final boolean isprint(char ch) { + private static boolean isprint(char ch) { return ch >= 32 && ch <= 126; } } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java --- a/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java Wed Dec 18 16:05:18 2013 -0500 @@ -95,7 +95,7 @@ throws SignatureException { String signature = null; //Java type signature. String typeSignature = null; //Internal type signature. - List params = new ArrayList(); //List of parameters. + List params = new ArrayList<>(); //List of parameters. String paramsig = null; //Java parameter signature. String paramJVMSig = null; //Internal parameter signature. String returnSig = null; //Java return type signature. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -235,8 +235,7 @@ } private List getDetailWriters(Code_attribute attr) { - List detailWriters = - new ArrayList(); + List detailWriters = new ArrayList<>(); if (options.details.contains(InstructionDetailWriter.Kind.SOURCE)) { sourceWriter.reset(classWriter.getClassFile(), attr); if (sourceWriter.hasSource()) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/Context.java --- a/langtools/src/share/classes/com/sun/tools/javap/Context.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/Context.java Wed Dec 18 16:05:18 2013 -0500 @@ -37,8 +37,11 @@ * deletion without notice. */ public class Context { + + Map, Object> map; + public Context() { - map = new HashMap, Object>(); + map = new HashMap<>(); } @SuppressWarnings("unchecked") @@ -50,6 +53,4 @@ public T put(Class key, T value) { return (T) map.put(key, value); } - - Map, Object> map; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/JavapTask.java --- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java Wed Dec 18 16:05:18 2013 -0500 @@ -356,7 +356,7 @@ Iterable classes) { this(out, fileManager, diagnosticListener); - this.classes = new ArrayList(); + this.classes = new ArrayList<>(); for (String classname: classes) { classname.getClass(); // null-check this.classes.add(classname); @@ -512,7 +512,7 @@ handleOption(arg, iter); else if (allowClasses) { if (classes == null) - classes = new ArrayList(); + classes = new ArrayList<>(); classes.add(arg); while (iter.hasNext()) classes.add(iter.next()); @@ -988,7 +988,7 @@ // could make this a HashMap> // and for efficiency, keep a hard reference to the bundle for the task // locale - bundles = new HashMap(); + bundles = new HashMap<>(); } if (locale == null) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -64,7 +64,7 @@ } public abstract boolean match(LocalVariableTable_attribute.Entry entry, int pc); public final String text; - }; + } static LocalVariableTableWriter instance(Context context) { LocalVariableTableWriter instance = context.get(LocalVariableTableWriter.class); @@ -81,7 +81,7 @@ public void reset(Code_attribute attr) { codeAttr = attr; - pcMap = new HashMap>(); + pcMap = new HashMap<>(); LocalVariableTable_attribute lvt = (LocalVariableTable_attribute) (attr.attributes.get(Attribute.LocalVariableTable)); if (lvt == null) @@ -145,7 +145,7 @@ private void put(int pc, LocalVariableTable_attribute.Entry entry) { List list = pcMap.get(pc); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); pcMap.put(pc, list); } if (!list.contains(entry)) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -65,7 +65,7 @@ } public abstract boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc); public final String text; - }; + } static LocalVariableTypeTableWriter instance(Context context) { LocalVariableTypeTableWriter instance = context.get(LocalVariableTypeTableWriter.class); @@ -82,7 +82,7 @@ public void reset(Code_attribute attr) { codeAttr = attr; - pcMap = new HashMap>(); + pcMap = new HashMap<>(); LocalVariableTypeTable_attribute lvt = (LocalVariableTypeTable_attribute) (attr.attributes.get(Attribute.LocalVariableTypeTable)); if (lvt == null) @@ -146,7 +146,7 @@ private void put(int pc, LocalVariableTypeTable_attribute.Entry entry) { List list = pcMap.get(pc); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); pcMap.put(pc, list); } if (!list.contains(entry)) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/Options.java --- a/langtools/src/share/classes/com/sun/tools/javap/Options.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/Options.java Wed Dec 18 16:05:18 2013 -0500 @@ -78,7 +78,7 @@ public boolean showFlags; public boolean showLineAndLocalVariableTables; public int showAccess; - public Set accessOptions = new HashSet(); + public Set accessOptions = new HashSet<>(); public Set details = EnumSet.noneOf(InstructionDetailWriter.Kind.class); public boolean showDisassembled; public boolean showDescriptors; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/SourceWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/SourceWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/SourceWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -106,9 +106,8 @@ } private void setLineMap(Code_attribute attr) { - SortedMap> map = - new TreeMap>(); - SortedSet allLines = new TreeSet(); + SortedMap> map = new TreeMap<>(); + SortedSet allLines = new TreeSet<>(); for (Attribute a: attr.attributes) { if (a instanceof LineNumberTable_attribute) { LineNumberTable_attribute t = (LineNumberTable_attribute) a; @@ -117,7 +116,7 @@ int line = e.line_number; SortedSet pcLines = map.get(start_pc); if (pcLines == null) { - pcLines = new TreeSet(); + pcLines = new TreeSet<>(); map.put(start_pc, pcLines); } pcLines.add(line); @@ -126,7 +125,7 @@ } } lineMap = map; - lineList = new ArrayList(allLines); + lineList = new ArrayList<>(allLines); } private void setSource(ClassFile cf) { @@ -186,7 +185,7 @@ if (text == null) return new String[0]; - List lines = new ArrayList(); + List lines = new ArrayList<>(); lines.add(""); // dummy line 0 try { BufferedReader r = new BufferedReader(new StringReader(text)); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -95,7 +95,7 @@ new CustomVerificationTypeInfo(args[i].replace(".", "/")); } - map = new HashMap(); + map = new HashMap<>(); StackMapBuilder builder = new StackMapBuilder(); // using -1 as the pc for the initial frame effectively compensates for diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/TryBlockWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/TryBlockWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/TryBlockWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -64,7 +64,7 @@ } public abstract boolean match(Exception_data entry, int pc); public final String text; - }; + } static TryBlockWriter instance(Context context) { TryBlockWriter instance = context.get(TryBlockWriter.class); @@ -80,8 +80,8 @@ } public void reset(Code_attribute attr) { - indexMap = new HashMap(); - pcMap = new HashMap>(); + indexMap = new HashMap<>(); + pcMap = new HashMap<>(); for (int i = 0; i < attr.exception_table.length; i++) { Exception_data entry = attr.exception_table[i]; indexMap.put(entry, i); @@ -129,7 +129,7 @@ private void put(int pc, Exception_data entry) { List list = pcMap.get(pc); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); pcMap.put(pc, list); } if (!list.contains(entry)) diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java Wed Dec 18 16:05:18 2013 -0500 @@ -48,7 +48,8 @@ * deletion without notice. */ public class TypeAnnotationWriter extends InstructionDetailWriter { - public enum NoteKind { VISIBLE, INVISIBLE }; + public enum NoteKind { VISIBLE, INVISIBLE } + public static class Note { Note(NoteKind kind, TypeAnnotation anno) { this.kind = kind; @@ -74,7 +75,7 @@ public void reset(Code_attribute attr) { Method m = classWriter.getMethod(); - pcMap = new HashMap>(); + pcMap = new HashMap<>(); check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations)); check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations)); } @@ -101,7 +102,7 @@ private void addNote(int pc, Note note) { List list = pcMap.get(pc); if (list == null) - pcMap.put(pc, list = new ArrayList()); + pcMap.put(pc, list = new ArrayList<>()); list.add(note); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java --- a/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java Wed Dec 18 16:05:18 2013 -0500 @@ -50,7 +50,7 @@ PACKAGE, CLASS, VERBOSE - }; + } private final Type type; private final Map results = new HashMap<>(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java --- a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java Wed Dec 18 16:05:18 2013 -0500 @@ -189,7 +189,7 @@ } private List walkTree(Path dir) throws IOException { - final List files = new ArrayList(); + final List files = new ArrayList<>(); Files.walkFileTree(dir, new SimpleFileVisitor() { public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java --- a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Wed Dec 18 16:05:18 2013 -0500 @@ -217,7 +217,7 @@ private static final String PROGNAME = "jdeps"; private final Options options = new Options(); - private final List classes = new ArrayList(); + private final List classes = new ArrayList<>(); private PrintWriter log; void setLog(PrintWriter out) { @@ -614,7 +614,7 @@ } private List getArchives(List filenames) throws IOException { - List result = new ArrayList(); + List result = new ArrayList<>(); for (String s : filenames) { Path p = Paths.get(s); if (Files.exists(p)) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java Wed Dec 18 16:05:18 2013 -0500 @@ -42,12 +42,12 @@ * or deletion without notice.

*/ public class BuildState { - private Map modules = new HashMap(); - private Map packages = new HashMap(); - private Map sources = new HashMap(); - private Map artifacts = new HashMap(); + private Map modules = new HashMap<>(); + private Map packages = new HashMap<>(); + private Map sources = new HashMap<>(); + private Map artifacts = new HashMap<>(); // Map from package to a set of packages that depend on said package. - private Map> dependents = new HashMap>(); + private Map> dependents = new HashMap<>(); public Map modules() { return modules; } public Map packages() { return packages; } @@ -151,13 +151,13 @@ * Calculate the package dependents (ie the reverse of the dependencies). */ public void calculateDependents() { - dependents = new HashMap>(); + dependents = new HashMap<>(); for (String s : packages.keySet()) { Package p = packages.get(s); for (String d : p.dependencies()) { Set ss = dependents.get(d); if (ss == null) { - ss = new HashSet(); + ss = new HashSet<>(); dependents.put(d, ss); } // Add the dependent information to the global dependent map. @@ -181,8 +181,8 @@ */ public void checkInternalState(String msg, boolean linkedOnly, Map srcs) { boolean baad = false; - Map original = new HashMap(); - Map calculated = new HashMap(); + Map original = new HashMap<>(); + Map calculated = new HashMap<>(); for (String s : sources.keySet()) { Source ss = sources.get(s); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java Wed Dec 18 16:05:18 2013 -0500 @@ -97,18 +97,19 @@ } // Sort the properties in increasing key order. - List sortedKeys = new ArrayList(); + List sortedKeys = new ArrayList<>(); for (Object key : p.keySet()) { sortedKeys.add((String)key); } Collections.sort(sortedKeys); - Iterator keys = sortedKeys.iterator(); // Collect the properties into a string buffer. StringBuilder data = new StringBuilder(); - while (keys.hasNext()) { - String key = keys.next(); - data.append(CompileProperties.escape(key)+":"+CompileProperties.escape((String)p.get(key))+"\n"); + for (String key : sortedKeys) { + data.append(CompileProperties.escape(key)) + .append(":") + .append(CompileProperties.escape((String) p.get(key))) + .append("\n"); } String destFilename = destRoot.getPath()+File.separator+pkgNameF+File.separator+src.getName(); @@ -124,7 +125,7 @@ Set as = packageArtifacts.get(pkgName); if (as == null) { - as = new HashSet(); + as = new HashSet<>(); packageArtifacts.put(pkgName, as); } as.add(dest.toURI()); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/CompileChunk.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CompileChunk.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CompileChunk.java Wed Dec 18 16:05:18 2013 -0500 @@ -41,7 +41,7 @@ public class CompileChunk implements Comparable { public int numPackages; public int numDependents; - public Set srcs = new HashSet(); + public Set srcs = new HashSet<>(); public StringBuilder pkgNames = new StringBuilder(); public String pkgFromTos = ""; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java Wed Dec 18 16:05:18 2013 -0500 @@ -111,7 +111,7 @@ String classname = src.getName().substring(0,dp); // Sort the properties in increasing key order. - List sortedKeys = new ArrayList(); + List sortedKeys = new ArrayList<>(); for (Object key : p.keySet()) { sortedKeys.add((String)key); } @@ -140,7 +140,7 @@ Set as = packageArtifacts.get(pkgName); if (as == null) { - as = new HashSet(); + as = new HashSet<>(); packageArtifacts.put(pkgName, as); } as.add(dest.toURI()); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java Wed Dec 18 16:05:18 2013 -0500 @@ -85,7 +85,7 @@ Set as = packageArtifacts.get(pkgName); if (as == null) { - as = new HashSet(); + as = new HashSet<>(); packageArtifacts.put(pkgName, as); } as.add(dest.toURI()); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java Wed Dec 18 16:05:18 2013 -0500 @@ -157,9 +157,9 @@ } prev = new BuildState(); now = new BuildState(); - taintedPackages = new HashSet(); - recompiledPackages = new HashSet(); - packagesWithChangedPublicApis = new HashSet(); + taintedPackages = new HashSet<>(); + recompiledPackages = new HashSet<>(); + packagesWithChangedPublicApis = new HashSet<>(); } public BuildState prev() { return prev; } @@ -197,7 +197,7 @@ * Specify which sources are visible to the compiler through -sourcepath. */ public void setVisibleSources(Map vs) { - visibleSrcs = new HashSet(); + visibleSrcs = new HashSet<>(); for (String s : vs.keySet()) { Source src = vs.get(s); visibleSrcs.add(src.file().toURI()); @@ -208,7 +208,7 @@ * Specify which classes are visible to the compiler through -classpath. */ public void setVisibleClasses(Map vs) { - visibleSrcs = new HashSet(); + visibleSrcs = new HashSet<>(); for (String s : vs.keySet()) { Source src = vs.get(s); visibleSrcs.add(src.file().toURI()); @@ -238,7 +238,7 @@ if (p != null) { return p.artifacts(); } - return new HashMap(); + return new HashMap<>(); } /** @@ -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<>()); // Save the packages, ie package names, dependencies, pubapis and artifacts! // I.e. the lot. Module.saveModules(now.modules(), b); @@ -421,7 +421,7 @@ * prior to propagating dependencies. */ public void clearTaintedPackages() { - taintedPackages = new HashSet(); + taintedPackages = new HashSet<>(); } /** @@ -462,7 +462,7 @@ * Acquire the compile_java_packages suffix rule for .java files. */ public Map getJavaSuffixRule() { - Map sr = new HashMap(); + Map sr = new HashMap<>(); sr.put(".java", compileJavaPackages); return sr; } @@ -509,7 +509,7 @@ * that are not recognized as such, in the javac_state file. */ public void removeUnidentifiedArtifacts() { - Set allKnownArtifacts = new HashSet(); + Set allKnownArtifacts = new HashSet<>(); for (Package pkg : prev.packages().values()) { for (File f : pkg.artifacts().values()) { allKnownArtifacts.add(f); @@ -562,7 +562,7 @@ * Return those files belonging to prev, but not now. */ private Set calculateRemovedSources() { - Set removed = new HashSet(); + Set removed = new HashSet<>(); for (String src : prev.sources().keySet()) { if (now.sources().get(src) == null) { removed.add(prev.sources().get(src)); @@ -575,7 +575,7 @@ * Return those files belonging to now, but not prev. */ private Set calculateAddedSources() { - Set added = new HashSet(); + Set added = new HashSet<>(); for (String src : now.sources().keySet()) { if (prev.sources().get(src) == null) { added.add(now.sources().get(src)); @@ -591,7 +591,7 @@ * a warning! */ private Set calculateModifiedSources() { - Set modified = new HashSet(); + Set modified = new HashSet<>(); for (String src : now.sources().keySet()) { Source n = now.sources().get(src); Source t = prev.sources().get(src); @@ -627,7 +627,7 @@ * Run the copy translator only. */ public void performCopying(File binDir, Map suffixRules) { - Map sr = new HashMap(); + Map sr = new HashMap<>(); for (Map.Entry e : suffixRules.entrySet()) { if (e.getValue() == copyFiles) { sr.put(e.getKey(), e.getValue()); @@ -641,7 +641,7 @@ * I.e. all translators that are not copy nor compile_java_source. */ public void performTranslation(File gensrcDir, Map suffixRules) { - Map sr = new HashMap(); + Map sr = new HashMap<>(); for (Map.Entry e : suffixRules.entrySet()) { if (e.getValue() != copyFiles && e.getValue() != compileJavaPackages) { @@ -659,7 +659,7 @@ String[] args, Set recentlyCompiled, boolean[] rcValue) { - Map suffixRules = new HashMap(); + Map suffixRules = new HashMap<>(); suffixRules.put(".java", compileJavaPackages); compileJavaPackages.setExtra(serverSettings); compileJavaPackages.setExtra(args); @@ -669,7 +669,7 @@ clearTaintedPackages(); boolean again = !packagesWithChangedPublicApis.isEmpty(); taintPackagesDependingOnChangedPackages(packagesWithChangedPublicApis, recentlyCompiled); - packagesWithChangedPublicApis = new HashSet(); + packagesWithChangedPublicApis = new HashSet<>(); return again && rcValue[0]; } @@ -679,12 +679,12 @@ private void addFileToTransform(Map>> gs, Transformer t, Source s) { Map> fs = gs.get(t); if (fs == null) { - fs = new HashMap>(); + fs = new HashMap<>(); gs.put(t, fs); } Set ss = fs.get(s.pkg().name()); if (ss == null) { - ss = new HashSet(); + ss = new HashSet<>(); fs.put(s.pkg().name(), ss); } ss.add(s.file().toURI()); @@ -698,7 +698,7 @@ { boolean rc = true; // Group sources based on transforms. A source file can only belong to a single transform. - Map>> groupedSources = new HashMap>>(); + Map>> groupedSources = new HashMap<>(); for (Source src : now.sources().values()) { Transformer t = suffixRules.get(src.suffix()); if (t != null) { @@ -712,9 +712,9 @@ Transformer t = e.getKey(); Map> srcs = e.getValue(); // These maps need to be synchronized since multiple threads will be writing results into them. - Map> packageArtifacts = Collections.synchronizedMap(new HashMap>()); - Map> packageDependencies = Collections.synchronizedMap(new HashMap>()); - Map packagePublicApis = Collections.synchronizedMap(new HashMap()); + Map> packageArtifacts = Collections.synchronizedMap(new HashMap<>()); + Map> packageDependencies = Collections.synchronizedMap(new HashMap<>()); + Map packagePublicApis = Collections.synchronizedMap(new HashMap<>()); boolean r = t.transform(srcs, visibleSrcs, @@ -770,7 +770,7 @@ * Utility method to recursively find all files below a directory. */ private static Set findAllFiles(File dir) { - Set foundFiles = new HashSet(); + Set foundFiles = new HashSet<>(); if (dir == null) { return foundFiles; } @@ -803,8 +803,8 @@ if (makefileSourceList == null) return; - Set calculatedSources = new HashSet(); - Set listedSources = new HashSet(); + Set calculatedSources = new HashSet<>(); + Set listedSources = new HashSet<>(); // Create a set of filenames with full paths. for (Source s : now.sources().values()) { diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/Main.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Main.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Main.java Wed Dec 18 16:05:18 2013 -0500 @@ -232,14 +232,14 @@ findCopyOptions(args, suffix_rules); // All found modules are put here. - Map modules = new HashMap(); + Map modules = new HashMap<>(); // We start out in the legacy empty no-name module. // As soon as we stumble on a module-info.java file we change to that module. Module current_module = new Module("", ""); modules.put("", current_module); // Find all sources, use the suffix rules to know which files are sources. - Map sources = new HashMap(); + Map sources = new HashMap<>(); // Find the files, this will automatically populate the found modules // with found packages where the sources are found! findFiles(args, "-src", suffix_rules.keySet(), sources, modules, current_module, false); @@ -257,7 +257,7 @@ // all concatenated. The list created here is used by the SmartFileWrapper to // make sure only the correct sources are actually available. // We might find more modules here as well. - Map sources_to_link_to = new HashMap(); + Map sources_to_link_to = new HashMap<>(); findFiles(args, "-src", Util.set(".java"), sources_to_link_to, modules, current_module, true); findFiles(args, "-sourcepath", Util.set(".java"), sources_to_link_to, modules, current_module, true); // Rewrite the -src option to make it through to the javac instances. @@ -308,7 +308,7 @@ javac_state.performTranslation(gensrc_dir, suffix_rules); // Add any potentially generated java sources to the tobe compiled list. // (Generated sources must always have a package.) - Map generated_sources = new HashMap(); + Map generated_sources = new HashMap<>(); Source.scanRoot(gensrc_dir, Util.set(".java"), null, null, null, null, generated_sources, modules, current_module, false, true, false); javac_state.now().flattenPackagesSourcesAndArtifacts(modules); @@ -325,7 +325,7 @@ // Do the compilations, repeatedly until no tainted packages exist. boolean again; // Collect the name of all compiled packages. - Set recently_compiled = new HashSet(); + Set recently_compiled = new HashSet<>(); boolean[] rc = new boolean[1]; do { // Clean out artifacts in tainted packages. @@ -670,7 +670,7 @@ * Add -src before source root directories if not already there. */ private static String[] addSrcBeforeDirectories(String[] args) { - List newargs = new ArrayList(); + List newargs = new ArrayList<>(); for (int i = 0; i dirs = new HashSet(); + Set dirs = new HashSet<>(); for (int i = 0; i= args.length) { @@ -870,15 +870,15 @@ throws ProblemException, ProblemException { // Track which source roots, source path roots and class path roots have been added. - Set roots = new HashSet(); + Set roots = new HashSet<>(); // Track the current set of package includes,excludes as well as excluded source files, // to be used in the next -src/-sourcepath/-classpath - List includes = new LinkedList(); - List excludes = new LinkedList(); - List excludefiles = new LinkedList(); - List includefiles = new LinkedList(); + List includes = new LinkedList<>(); + List excludes = new LinkedList<>(); + List excludefiles = new LinkedList<>(); + List includefiles = new LinkedList<>(); // This include is used to find all modules in the source. - List moduleinfo = new LinkedList(); + List moduleinfo = new LinkedList<>(); moduleinfo.add("module-info.java"); for (int i = 0; i(); - excludes = new LinkedList(); - excludefiles = new LinkedList(); - includefiles = new LinkedList(); + includes = new LinkedList<>(); + excludes = new LinkedList<>(); + excludefiles = new LinkedList<>(); + includefiles = new LinkedList<>(); } } return true; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/Module.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Module.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Module.java Wed Dec 18 16:05:18 2013 -0500 @@ -44,9 +44,9 @@ public class Module implements Comparable { private String name; private String dirname; - private Map packages = new HashMap(); - private Map sources = new HashMap(); - private Map artifacts = new HashMap(); + private Map packages = new HashMap<>(); + private Map sources = new HashMap<>(); + private Map artifacts = new HashMap<>(); public Module(String n, String dn) { name = n; diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/Package.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Package.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Package.java Wed Dec 18 16:05:18 2013 -0500 @@ -71,15 +71,15 @@ // then that module's file system name is part of the path. private String dirname; // This package depends on these packages. - private Set dependencies = new HashSet(); + private Set dependencies = new HashSet<>(); // This package has the following dependents, that depend on this package. - private Set dependents = new HashSet(); + private Set dependents = new HashSet<>(); // This is the public api of this package. - private List pubapi = new ArrayList(); + private List pubapi = new ArrayList<>(); // Map from source file name to Source info object. - private Map sources = new HashMap(); + private Map sources = new HashMap<>(); // This package generated these artifacts. - private Map artifacts = new HashMap(); + private Map artifacts = new HashMap<>(); public Package(Module m, String n) { int c = n.indexOf(":"); @@ -146,7 +146,7 @@ public static List pubapiToList(String ps) { String[] lines = ps.split("\n"); - List r = new ArrayList(); + List r = new ArrayList<>(); for (String l : lines) { r.add(l); } @@ -213,7 +213,7 @@ } public void saveDependencies(StringBuilder b) { - List sorted_dependencies = new ArrayList(); + List sorted_dependencies = new ArrayList<>(); for (String key : dependencies) { sorted_dependencies.add(key); } @@ -230,7 +230,7 @@ } public static void savePackages(Map packages, StringBuilder b) { - List sorted_packages = new ArrayList(); + List sorted_packages = new ArrayList<>(); for (String key : packages.keySet() ) { sorted_packages.add(key); } @@ -257,7 +257,7 @@ public void setArtifacts(Set as) { assert(!artifacts.isEmpty()); - artifacts = new HashMap(); + artifacts = new HashMap<>(); addArtifacts(as); } @@ -279,7 +279,7 @@ } public void saveArtifacts(StringBuilder b) { - List sorted_artifacts = new ArrayList(); + List sorted_artifacts = new ArrayList<>(); for (File f : artifacts.values()) { sorted_artifacts.add(f); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/Source.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Source.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Source.java Wed Dec 18 16:05:18 2013 -0500 @@ -165,7 +165,7 @@ } public static void saveSources(Map sources, StringBuilder b) { - List sorted_sources = new ArrayList(); + List sorted_sources = new ArrayList<>(); for (String key : sources.keySet()) { sorted_sources.add(key); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/Util.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Util.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Util.java Wed Dec 18 16:05:18 2013 -0500 @@ -121,7 +121,7 @@ * Convenience method to create a set with strings. */ public static Set set(String... ss) { - Set set = new HashSet(); + Set set = new HashSet<>(); set.addAll(Arrays.asList(ss)); return set; } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java Wed Dec 18 16:05:18 2013 -0500 @@ -47,8 +47,7 @@ * or deletion without notice.

*/ public class Dependencies { - protected static final Context.Key dependenciesKey = - new Context.Key(); + protected static final Context.Key dependenciesKey = new Context.Key<>(); // The log to be used for error reporting. protected Log log; @@ -77,9 +76,9 @@ public void reset() { - deps = new HashMap>(); - explicitPackages = new HashSet(); - publicApiPerClass = new HashMap(); + deps = new HashMap<>(); + explicitPackages = new HashSet<>(); + publicApiPerClass = new HashMap<>(); } /** @@ -89,14 +88,14 @@ * @return */ public Map> getDependencies() { - Map> new_deps = new HashMap>(); + Map> new_deps = new HashMap<>(); if (explicitPackages == null) return new_deps; for (Name pkg : explicitPackages) { Set set = deps.get(pkg); if (set != null) { Set new_set = new_deps.get(pkg.toString()); if (new_set == null) { - new_set = new HashSet(); + new_set = new HashSet<>(); // Modules beware.... new_deps.put(":"+pkg.toString(), new_set); } @@ -121,7 +120,7 @@ * of all the class pubapis) */ public Map getPubapis() { - Map publicApiPerPackage = new HashMap(); + Map publicApiPerPackage = new HashMap<>(); if (publicApiPerClass == null) return publicApiPerPackage; Name[] keys = publicApiPerClass.keySet().toArray(new Name[0]); Arrays.sort(keys, new CompareNames()); @@ -176,7 +175,7 @@ if (!currPkg.equals(depPkg)) { Set theset = deps.get(currPkg); if (theset==null) { - theset = new HashSet(); + theset = new HashSet<>(); deps.put(currPkg, theset); } theset.add(depPkg); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java Wed Dec 18 16:05:18 2013 -0500 @@ -54,9 +54,9 @@ public class SmartFileManager extends ForwardingJavaFileManager { // Set of sources that can be seen by javac. - Set visibleSources = new HashSet(); + Set visibleSources = new HashSet<>(); // Map from modulename:packagename to artifacts. - Map> packageArtifacts = new HashMap>(); + Map> packageArtifacts = new HashMap<>(); // Where to print informational messages. PrintWriter stdout; @@ -69,7 +69,7 @@ } public void cleanArtifacts() { - packageArtifacts = new HashMap>(); + packageArtifacts = new HashMap<>(); } public void setLog(PrintWriter pw) { @@ -93,7 +93,7 @@ return files; } // Now filter! - ListBuffer filteredFiles = new ListBuffer(); + ListBuffer filteredFiles = new ListBuffer<>(); for (JavaFileObject f : files) { URI uri = f.toUri(); String t = uri.toString(); @@ -213,7 +213,7 @@ void addArtifact(String pkgName, URI art) { Set s = packageArtifacts.get(pkgName); if (s == null) { - s = new HashSet(); + s = new HashSet<>(); packageArtifacts.put(pkgName, s); } s.add(art); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java Wed Dec 18 16:05:18 2013 -0500 @@ -44,7 +44,7 @@ // A semaphore protecting the poolsize number of threads. private Semaphore available; // The stack of compiler threads. - private Stack compilers = new Stack(); + private Stack compilers = new Stack<>(); // And the executor server to spawn threads. private final ExecutorService executorPool; // How many requests are active right now? diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java Wed Dec 18 16:05:18 2013 -0500 @@ -47,6 +47,7 @@ import javax.tools.StandardJavaFileManager; import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.BaseFileManager; import com.sun.tools.javac.util.StringUtils; @@ -131,7 +132,7 @@ context.put(JavaFileManager.class, smartFileManager); ResolveWithDeps.preRegister(context); JavaCompilerWithDeps.preRegister(context, this); - subTasks = new ArrayList>(); + subTasks = new ArrayList<>(); } /** @@ -218,8 +219,8 @@ if (!expect(in, JavacServer.PROTOCOL_ARGS)) { return; } - ArrayList the_options = new ArrayList(); - ArrayList the_classes = new ArrayList(); + ArrayList the_options = new ArrayList<>(); + ArrayList the_classes = new ArrayList<>(); Iterable path = Arrays. asList(new File(cwd)); for (;;) { @@ -240,7 +241,7 @@ } // Load sources to compile - Set sourcesToCompile = new HashSet(); + Set sourcesToCompile = new HashSet<>(); for (;;) { String l = in.readLine(); if (l == null) @@ -255,7 +256,7 @@ } } // Load visible sources - Set visibleSources = new HashSet(); + Set visibleSources = new HashSet<>(); boolean fix_drive_letter_case = StringUtils.toLowerCase(System.getProperty("os.name")).startsWith("windows"); for (;;) { @@ -284,14 +285,12 @@ // Now setup the actual compilation.... // First deal with explicit source files on cmdline and in at file. - com.sun.tools.javac.util.ListBuffer compilationUnits = - new com.sun.tools.javac.util.ListBuffer(); + ListBuffer compilationUnits = new ListBuffer<>(); for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(the_classes)) { compilationUnits.append(i); } // Now deal with sources supplied as source_to_compile. - com.sun.tools.javac.util.ListBuffer sourcesToCompileFiles = - new com.sun.tools.javac.util.ListBuffer(); + ListBuffer sourcesToCompileFiles = new ListBuffer<>(); for (URI u : sourcesToCompile) { sourcesToCompileFiles.append(new File(u)); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java Wed Dec 18 16:05:18 2013 -0500 @@ -101,7 +101,7 @@ */ private static synchronized PortFile getPortFile(String filename) throws FileNotFoundException { if (allPortFiles == null) { - allPortFiles = new HashMap(); + allPortFiles = new HashMap<>(); } PortFile pf = allPortFiles.get(filename); if (pf == null) { @@ -371,7 +371,7 @@ // If the java/sh/cmd launcher fails the failure will be captured by stdouterr because of the redirection here. String[] cmd = {"/bin/sh", "-c", sjavac + " >> " + stdouterrfile + " 2>&1"}; if (!(new File("/bin/sh")).canExecute()) { - ArrayList wincmd = new ArrayList(); + ArrayList wincmd = new ArrayList<>(); wincmd.add("cmd"); wincmd.add("/c"); wincmd.add("start"); @@ -567,7 +567,7 @@ } if (l.length() > 1 && l.charAt(0) == '+') { String pkg = l.substring(1); - lastUriSet = new HashSet(); + lastUriSet = new HashSet<>(); packageArtifacts.put(pkg, lastUriSet); } else if (l.length() > 1 && lastUriSet != null) { lastUriSet.add(new URI(l.substring(1))); @@ -585,14 +585,14 @@ } if (l.length() > 1 && l.charAt(0) == '+') { String pkg = l.substring(1); - lastPackageSet = new HashSet(); + lastPackageSet = new HashSet<>(); packageDependencies.put(pkg, lastPackageSet); } else if (l.length() > 1 && lastPackageSet != null) { lastPackageSet.add(l.substring(1)); } } // Load package pubapis - Map tmp = new HashMap(); + Map tmp = new HashMap<>(); StringBuffer lastPublicApi = null; for (;;) { String l = in.readLine(); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java --- a/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java Wed Dec 18 16:05:18 2013 -0500 @@ -187,7 +187,7 @@ private static Set arrayToSet(String[] array) { assert array != null; - Set set = new HashSet(array.length); + Set set = new HashSet<>(array.length); for (String s : array) set.add(s); return Collections.unmodifiableSet(set); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/lang/model/SourceVersion.java --- a/langtools/src/share/classes/javax/lang/model/SourceVersion.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/lang/model/SourceVersion.java Wed Dec 18 16:05:18 2013 -0500 @@ -243,7 +243,7 @@ private final static Set keywords; static { - Set s = new HashSet(); + Set s = new HashSet<>(); String [] kws = { "abstract", "continue", "for", "new", "switch", "assert", "default", "if", "package", "synchronized", diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/lang/model/type/MirroredTypesException.java --- a/langtools/src/share/classes/javax/lang/model/type/MirroredTypesException.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/lang/model/type/MirroredTypesException.java Wed Dec 18 16:05:18 2013 -0500 @@ -55,7 +55,7 @@ */ MirroredTypesException(String message, TypeMirror type) { super(message); - List tmp = (new ArrayList()); + List tmp = (new ArrayList<>()); tmp.add(type); types = Collections.unmodifiableList(tmp); } @@ -68,7 +68,7 @@ public MirroredTypesException(List types) { super("Attempt to access Class objects for TypeMirrors " + (types = // defensive copy - new ArrayList(types)).toString() ); + new ArrayList<>(types)).toString() ); this.types = Collections.unmodifiableList(types); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/lang/model/util/ElementFilter.java --- a/langtools/src/share/classes/javax/lang/model/util/ElementFilter.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/lang/model/util/ElementFilter.java Wed Dec 18 16:05:18 2013 -0500 @@ -187,7 +187,7 @@ private static List listFilter(Iterable elements, Set targetKinds, Class clazz) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (Element e : elements) { if (targetKinds.contains(e.getKind())) list.add(clazz.cast(e)); @@ -200,7 +200,7 @@ Set targetKinds, Class clazz) { // Return set preserving iteration order of input set. - Set set = new LinkedHashSet(); + Set set = new LinkedHashSet<>(); for (Element e : elements) { if (targetKinds.contains(e.getKind())) set.add(clazz.cast(e)); diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/tools/DiagnosticCollector.java --- a/langtools/src/share/classes/javax/tools/DiagnosticCollector.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/tools/DiagnosticCollector.java Wed Dec 18 16:05:18 2013 -0500 @@ -39,8 +39,7 @@ * @since 1.6 */ public final class DiagnosticCollector implements DiagnosticListener { - private List> diagnostics = - Collections.synchronizedList(new ArrayList>()); + private List> diagnostics = Collections.synchronizedList(new ArrayList<>()); public void report(Diagnostic diagnostic) { diagnostic.getClass(); // null check diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/tools/JavaFileObject.java --- a/langtools/src/share/classes/javax/tools/JavaFileObject.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/tools/JavaFileObject.java Wed Dec 18 16:05:18 2013 -0500 @@ -81,7 +81,7 @@ extension.getClass(); // null check this.extension = extension; } - }; + } /** * Gets the kind of this file object. diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/tools/StandardLocation.java --- a/langtools/src/share/classes/javax/tools/StandardLocation.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/tools/StandardLocation.java Wed Dec 18 16:05:18 2013 -0500 @@ -98,7 +98,7 @@ } //where private static final ConcurrentMap locations - = new ConcurrentHashMap(); + = new ConcurrentHashMap<>(); public String getName() { return name(); } diff -r 3b3e23e67329 -r 3651128c74eb langtools/src/share/classes/javax/tools/ToolProvider.java --- a/langtools/src/share/classes/javax/tools/ToolProvider.java Wed Dec 18 19:22:58 2013 +0000 +++ b/langtools/src/share/classes/javax/tools/ToolProvider.java Wed Dec 18 16:05:18 2013 -0500 @@ -145,7 +145,7 @@ // Cache for tool classes. // Use weak references to avoid keeping classes around unnecessarily - private Map>> toolClasses = new HashMap>>(); + private Map>> toolClasses = new HashMap<>(); // Cache for tool classloader. // Use a weak reference to avoid keeping it around unnecessarily @@ -173,7 +173,7 @@ } catch (Throwable e) { return trace(WARNING, e); } - toolClasses.put(name, new WeakReference>(c)); + toolClasses.put(name, new WeakReference<>(c)); } return c.asSubclass(clazz); } @@ -207,7 +207,7 @@ trace(FINE, urls[0].toString()); cl = URLClassLoader.newInstance(urls); - refToolClassLoader = new WeakReference(cl); + refToolClassLoader = new WeakReference<>(cl); } return Class.forName(toolClassName, false, cl);