--- 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();
--- 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.
--- 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<? extends VariableTree> getParameters();
--- 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);
--- 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);
}
--- 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<String> getModifiers(int flags, int[] modifierFlags, Kind t) {
- Set<String> s = new LinkedHashSet<String>();
+ Set<String> s = new LinkedHashSet<>();
for (int m: modifierFlags) {
if ((flags & m) != 0)
s.add(flagToModifier(m, t));
@@ -168,7 +168,7 @@
}
private Set<String> getFlags(int[] expectedFlags, Kind t) {
- Set<String> s = new LinkedHashSet<String>();
+ Set<String> s = new LinkedHashSet<>();
int f = flags;
for (int e: expectedFlags) {
if ((f & e) != 0) {
--- 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<? extends Attribute> 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<String,Class<? extends Attribute>>();
+ standardAttributes = new HashMap<>();
standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
--- 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.</b>
*/
public class Attributes implements Iterable<Attribute> {
+
+ public final Attribute[] attrs;
+ public final Map<String, Attribute> map;
+
Attributes(ClassReader cr) throws IOException {
- map = new HashMap<String,Attribute>();
+ 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<String,Attribute>();
+ 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<String, Attribute> map;
}
--- 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;
- };
+ }
}
--- 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<String> rootClassNames,
boolean transitiveClosure)
throws ClassFileNotFoundException {
- final Set<Dependency> results = new HashSet<Dependency>();
+ final Set<Dependency> results = new HashSet<>();
Recorder r = new Recorder() {
public void addDependency(Dependency d) {
results.add(d);
@@ -276,7 +276,7 @@
ClassFileReader classFinder, Set<String> rootClassNames,
boolean transitiveClosure, Recorder recorder)
throws ClassFileNotFoundException {
- Set<String> doneClasses = new HashSet<String>();
+ Set<String> 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<String> deque = new LinkedList<String>(rootClassNames);
+ Deque<String> deque = new LinkedList<>(rootClassNames);
String className;
while ((className = deque.poll()) != null) {
@@ -560,7 +560,7 @@
}
static abstract class BasicDependencyFinder implements Finder {
- private Map<String,Location> locations = new HashMap<String,Location>();
+ private Map<String,Location> 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<Dependency>();
+ deps = new HashSet<>();
} catch (ConstantPoolException e) {
throw new ClassFileError(e);
}
--- 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 */
--- 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 }
}
--- 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<Integer> cprefs = new ArrayList<Integer>();
+ List<Integer> 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<Integer> ids = new HashSet<Integer>();
+ Set<Integer> 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<CPRefInfo> refInfos = new ArrayList<CPRefInfo>(ids.size());
+ List<CPRefInfo> refInfos = new ArrayList<>(ids.size());
for (int id : ids) {
refInfos.add(CPRefInfo.class.cast(cf.constant_pool.get(id)));
}
--- 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<Type>();
+ throwsTypes = new ArrayList<>();
throwsTypes.add(parseTypeSignature());
}
return new MethodType(typeParamTypes, paramTypes, returnType, throwsTypes);
@@ -108,7 +108,7 @@
List<Type> superinterfaces = null;
while (sigp < sig.length()) {
if (superinterfaces == null)
- superinterfaces = new ArrayList<Type>();
+ superinterfaces = new ArrayList<>();
superinterfaces.add(parseTypeSignature());
}
return new ClassSigType(typeParamTypes, superclass, superinterfaces);
@@ -183,7 +183,7 @@
private List<Type> parseTypeSignatures(char term) {
sigp++;
- List<Type> types = new ArrayList<Type>();
+ List<Type> types = new ArrayList<>();
while (sig.charAt(sigp) != term)
types.add(parseTypeSignature());
sigp++;
@@ -229,7 +229,7 @@
private List<TypeParamType> parseTypeParamTypes() {
assert sig.charAt(sigp) == '<';
sigp++;
- List<TypeParamType> types = new ArrayList<TypeParamType>();
+ List<TypeParamType> 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<Type>();
+ interfaceBounds = new ArrayList<>();
interfaceBounds.add(parseTypeSignature());
}
return new TypeParamType(name, classBound, interfaceBounds);
--- 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<String> primitiveTypes = new HashSet<String>(Arrays.asList(
+ private static final Set<String> 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);
}
--- 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<Integer> loc = new ArrayList<Integer>(len);
+ List<Integer> 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<TypePathEntry> location = new ArrayList<TypePathEntry>(0);
+ public List<TypePathEntry> 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<TypePathEntry> getTypePathFromBinary(List<Integer> list) {
- List<TypePathEntry> loc = new ArrayList<TypePathEntry>(list.size() / TypePathEntry.bytesPerEntry);
+ List<TypePathEntry> 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<Integer> getBinaryFromTypePath(List<TypePathEntry> locs) {
- List<Integer> loc = new ArrayList<Integer>(locs.size() * TypePathEntry.bytesPerEntry);
+ List<Integer> loc = new ArrayList<>(locs.size() * TypePathEntry.bytesPerEntry);
for (TypePathEntry tpe : locs) {
loc.add(tpe.tag.tag);
loc.add(tpe.arg);
--- 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<String,Integer> typeMap = new LinkedHashMap<String,Integer>();
+ protected Map<String,Integer> typeMap = new LinkedHashMap<>();
protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
private int methodTypesOr = 0;
public final boolean nodepr;
--- 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<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
+ pkgToPackageAnnotations = new TreeSet<>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
configuration.currentcd = classdoc;
- this.pkgSet = new TreeSet<PackageDoc>();
+ 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<String,List<ProgramElementDoc>> pkgDivide(Map<String,? extends List<? extends ProgramElementDoc>> classMap) {
- Map<String,List<ProgramElementDoc>> map = new HashMap<String,List<ProgramElementDoc>>();
+ Map<String,List<ProgramElementDoc>> map = new HashMap<>();
List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
if (list != null) {
Collections.sort(list);
@@ -186,7 +186,7 @@
pkgSet.add(pkg);
List<ProgramElementDoc> inPkg = map.get(pkg.name());
if (inPkg == null) {
- inPkg = new ArrayList<ProgramElementDoc>();
+ inPkg = new ArrayList<>();
map.put(pkg.name(), inPkg);
}
inPkg.add(doc);
--- 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<String> doclintOpts = new LinkedHashSet<String>();
+ public Set<String> doclintOpts = new LinkedHashSet<>();
/**
* Unique Resource Handler for this package.
@@ -286,7 +286,7 @@
}
}
if (root.specifiedClasses().length > 0) {
- Map<String,PackageDoc> map = new HashMap<String,PackageDoc>();
+ Map<String,PackageDoc> map = new HashMap<>();
PackageDoc pd;
ClassDoc[] classes = root.classes();
for (ClassDoc aClass : classes) {
--- 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<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+ List<ProgramElementDoc> constructors = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
for (ProgramElementDoc constructor : constructors) {
if (constructor.isProtected() || constructor.isPrivate()) {
setFoundNonPubConstructor(true);
--- 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<String> blockTags = new HashSet<String>();
+ static final Set<String> blockTags = new HashSet<>();
static {
for (HtmlTag t: HtmlTag.values()) {
if (t.blockType == HtmlTag.BlockType.BLOCK)
@@ -1944,7 +1944,7 @@
*/
public List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak,
boolean isJava5DeclarationLocation) {
- List<Content> results = new ArrayList<Content>();
+ List<Content> 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<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+ List<AnnotationValue> 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<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+ List<AnnotationValue> 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<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+ List<AnnotationValue> annotationTypeValues = new ArrayList<>();
if (annotationValue.value() instanceof AnnotationValue[]) {
AnnotationValue[] annotationArray =
(AnnotationValue[]) annotationValue.value();
--- 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<ClassDoc>(Arrays.asList(configuration.root.classes()));
+ documentedClasses = new HashSet<>(Arrays.asList(configuration.root.classes()));
}
}
--- 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<String,Set<ClassDoc>> usingPackageToUsedClasses = new TreeMap<String,Set<ClassDoc>>();
+ final SortedMap<String,Set<ClassDoc>> usingPackageToUsedClasses = new TreeMap<>();
/**
* Constructor.
@@ -73,7 +73,7 @@
Set<ClassDoc> usedClasses = usingPackageToUsedClasses
.get(usingPackage.name());
if (usedClasses == null) {
- usedClasses = new TreeSet<ClassDoc>();
+ usedClasses = new TreeSet<>();
usingPackageToUsedClasses.put(Util.getPackageName(usingPackage),
usedClasses);
}
--- 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<Content>();
+ contents = new ArrayList<>();
}
}
--- 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<Content>();
+ 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<Content>();
+ docContent = new ArrayList<>();
addContent(nullCheck(docType));
addContent(nullCheck(htmlTree));
}
--- 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
}
--- 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() {
--- 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<HtmlAttr,String>(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>();
+ content = new ArrayList<>();
content.add(tagContent);
}
}
--- 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() {
--- 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<String>();
- excludedQualifiers = new HashSet<String>();
+ 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<Profile, List<PackageDoc>> interimResults =
- new EnumMap<Profile, List<PackageDoc>>(Profile.class);
+ Map<Profile, List<PackageDoc>> interimResults = new EnumMap<>(Profile.class);
for (Profile p: Profile.values())
- interimResults.put(p, new ArrayList<PackageDoc>());
+ 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<String,PackageDoc[]>();
+ profilePackages = new HashMap<>();
List<PackageDoc> prev = Collections.<PackageDoc>emptyList();
int size;
for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) {
@@ -434,11 +433,11 @@
}
private void initPackageArray() {
- Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
+ Set<PackageDoc> set = new HashSet<>(Arrays.asList(root.specifiedPackages()));
for (ClassDoc aClass : root.specifiedClasses()) {
set.add(aClass.containingPackage());
}
- ArrayList<PackageDoc> results = new ArrayList<PackageDoc>(set);
+ ArrayList<PackageDoc> 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<String[]> customTagStrs = new LinkedHashSet<String[]>();
+ LinkedHashSet<String[]> 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<String> tokens = new ArrayList<String>();
+ List<String> tokens = new ArrayList<>();
StringBuilder token = new StringBuilder ();
boolean prevIsEscapeChar = false;
for (int i = 0; i < s.length(); i += Character.charCount(i)) {
--- 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<ProgramElementDoc>(
- this.visibleMemberMap.getMembersFor(classDoc));
+ this.members = new ArrayList<>(this.visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(this.members, configuration.getMemberComparator());
}
--- 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<ProgramElementDoc>(
- this.visibleMemberMap.getMembersFor(classDoc));
+ this.members = new ArrayList<>(this.visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(this.members, configuration.getMemberComparator());
}
--- 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<String> containingPackagesSeen = new HashSet<String>();
+ Set<String> containingPackagesSeen = new HashSet<>();
context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
LayoutParser.getInstance(configuration));
}
--- 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<ClassDoc>();
+ this.classDocsWithConstFields = new HashSet<>();
}
/**
@@ -151,7 +151,7 @@
*/
public void buildContents(XMLNode node, Content contentTree) {
Content contentListTree = writer.getContentsHeader();
- printedPackageHeaders = new HashSet<String>();
+ 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<String>();
+ 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<FieldDoc> members = new ArrayList<FieldDoc>(members());
+ List<FieldDoc> members = new ArrayList<>(members());
if (members.size() > 0) {
Collections.sort(members);
writer.addConstantMembers(classdoc, members, classConstantTree);
@@ -352,7 +352,7 @@
} else {
return null;
}
- List<FieldDoc> inclList = new LinkedList<FieldDoc>();
+ List<FieldDoc> inclList = new LinkedList<>();
FieldDoc member;
while(iter.hasNext()){
member = (FieldDoc)iter.next();
--- 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<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+ constructors = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
for (ProgramElementDoc constructor : constructors) {
if (constructor.isProtected() || constructor.isPrivate()) {
writer.setFoundNonPubConstructor(true);
--- 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<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+ enumConstants = new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(enumConstants, configuration.getMemberComparator());
}
--- 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<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
- configuration));
+ fields = new ArrayList<>(visibleMemberMap.getLeafClassMembers(configuration));
if (configuration.getMemberComparator() != null) {
Collections.sort(fields, configuration.getMemberComparator());
}
--- 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<String,XMLNode>();
+ xmlElementsMap = new HashMap<>();
this.configuration = configuration;
}
--- 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<Content> summaryTreeList) {
- List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
+ List<ProgramElementDoc> members = new ArrayList<>(visibleMemberMap.getLeafClassMembers(
configuration));
if (members.size() > 0) {
Collections.sort(members);
- List<Content> tableContents = new LinkedList<Content>();
+ List<Content> 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<Tag> allTags = new LinkedList<Tag>();
+ List<Tag> 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<Content> summaryTreeList = new LinkedList<Content>();
+ LinkedList<Content> summaryTreeList = new LinkedList<>();
buildSummary(writer, visibleMemberMap, summaryTreeList);
if (showInheritedSummary)
buildInheritedSummary(writer, visibleMemberMap, summaryTreeList);
--- 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<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
- configuration));
+ new ArrayList<>(visibleMemberMap.getLeafClassMembers(configuration));
if (configuration.getMemberComparator() != null) {
Collections.sort(methods, configuration.getMemberComparator());
}
--- 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<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+ new ArrayList<>(visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(properties, configuration.getMemberComparator());
}
--- 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<String,String>();
- children = new ArrayList<XMLNode>();
+ attrs = new HashMap<>();
+ children = new ArrayList<>();
if (parent != null)
parent.children.add(this);
--- 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<String,String> result = new HashMap<String,String>();
+ HashMap<String,String> 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<String> alreadyDocumented = new HashSet<String>();
+ Set<String> alreadyDocumented = new HashSet<>();
if (paramTags.length > 0) {
result.addContent(
processParamTags(isNonTypeParams, paramTags,
--- 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<String>();
- potentiallyConflictingTags = new HashSet<String>();
- standardTags = new HashSet<String>();
- standardTagsLowercase = new HashSet<String>();
- unseenCustomTags = new HashSet<String>();
- customTags = new LinkedHashMap<String,Taglet>();
+ 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<URL> urls = new LinkedHashSet<URL>();
+ Set<URL> 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<String> locationsSet = new LinkedHashSet<String>();
+ Set<String> locationsSet = new LinkedHashSet<>();
if (taglet.inOverview()) {
locationsSet.add("overview");
}
@@ -582,14 +582,14 @@
*/
private void initCustomTagletArrays() {
Iterator<Taglet> it = customTags.values().iterator();
- ArrayList<Taglet> pTags = new ArrayList<Taglet>(customTags.size());
- ArrayList<Taglet> tTags = new ArrayList<Taglet>(customTags.size());
- ArrayList<Taglet> fTags = new ArrayList<Taglet>(customTags.size());
- ArrayList<Taglet> cTags = new ArrayList<Taglet>(customTags.size());
- ArrayList<Taglet> mTags = new ArrayList<Taglet>(customTags.size());
- ArrayList<Taglet> iTags = new ArrayList<Taglet>(customTags.size());
- ArrayList<Taglet> oTags = new ArrayList<Taglet>(customTags.size());
- ArrayList<Taglet> sTags = new ArrayList<Taglet>();
+ ArrayList<Taglet> pTags = new ArrayList<>(customTags.size());
+ ArrayList<Taglet> tTags = new ArrayList<>(customTags.size());
+ ArrayList<Taglet> fTags = new ArrayList<>(customTags.size());
+ ArrayList<Taglet> cTags = new ArrayList<>(customTags.size());
+ ArrayList<Taglet> mTags = new ArrayList<>(customTags.size());
+ ArrayList<Taglet> iTags = new ArrayList<>(customTags.size());
+ ArrayList<Taglet> oTags = new ArrayList<>(customTags.size());
+ ArrayList<Taglet> sTags = new ArrayList<>();
Taglet current;
while (it.hasNext()) {
current = it.next();
--- 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<Tag> declaredExceptionTags = new LinkedHashSet<Tag>();
+ Set<Tag> 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<String> alreadyDocumented = new HashSet<String>();
+ HashSet<String> alreadyDocumented = new HashSet<>();
if (tags.length > 0) {
result.addContent(throwsTagsOutput(
execHolder.throwsTags(), writer, alreadyDocumented, true));
--- 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<String,Set<ClassDoc>>();
- ordinaryClasses = new HashMap<String,Set<ClassDoc>>();
- exceptions = new HashMap<String,Set<ClassDoc>>();
- enums = new HashMap<String,Set<ClassDoc>>();
- annotationTypes = new HashMap<String,Set<ClassDoc>>();
- errors = new HashMap<String,Set<ClassDoc>>();
- interfaces = new HashMap<String,Set<ClassDoc>>();
- packageSet = new HashSet<String>();
+ 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<ClassDoc> s = map.get(key);
if (s == null) {
packageSet.add(key);
- s = new HashSet<ClassDoc>();
+ s = new HashSet<>();
}
s.add(classdoc);
map.put(key, s);
--- 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<ClassDoc> baseclasses = new ArrayList<ClassDoc>();
+ private List<ClassDoc> baseclasses = new ArrayList<>();
/**
* Mapping for each Class with their SubClasses
*/
- private Map<ClassDoc,List<ClassDoc>> subclasses = new HashMap<ClassDoc,List<ClassDoc>>();
+ private Map<ClassDoc,List<ClassDoc>> 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<ClassDoc> baseinterfaces = new ArrayList<ClassDoc>();
+ private List<ClassDoc> baseinterfaces = new ArrayList<>();
/**
* Mapping for each Interface with their SubInterfaces
*/
- private Map<ClassDoc,List<ClassDoc>> subinterfaces = new HashMap<ClassDoc,List<ClassDoc>>();
+ private Map<ClassDoc,List<ClassDoc>> subinterfaces = new HashMap<>();
- private List<ClassDoc> baseEnums = new ArrayList<ClassDoc>();
- private Map<ClassDoc,List<ClassDoc>> subEnums = new HashMap<ClassDoc,List<ClassDoc>>();
+ private List<ClassDoc> baseEnums = new ArrayList<>();
+ private Map<ClassDoc,List<ClassDoc>> subEnums = new HashMap<>();
- private List<ClassDoc> baseAnnotationTypes = new ArrayList<ClassDoc>();
- private Map<ClassDoc,List<ClassDoc>> subAnnotationTypes = new HashMap<ClassDoc,List<ClassDoc>>();
+ private List<ClassDoc> baseAnnotationTypes = new ArrayList<>();
+ private Map<ClassDoc,List<ClassDoc>> subAnnotationTypes = new HashMap<>();
/**
* Mapping for each Interface with classes who implement it.
*/
- private Map<ClassDoc,List<ClassDoc>> implementingclasses = new HashMap<ClassDoc,List<ClassDoc>>();
+ private Map<ClassDoc,List<ClassDoc>> implementingclasses = new HashMap<>();
/**
* Constructor. Build the Tree using the Root of this Javadoc run.
@@ -234,7 +234,7 @@
private boolean add(Map<ClassDoc,List<ClassDoc>> map, ClassDoc superclass, ClassDoc cd) {
List<ClassDoc> list = map.get(superclass);
if (list == null) {
- list = new ArrayList<ClassDoc>();
+ list = new ArrayList<>();
map.put(superclass, list);
}
if (list.contains(cd)) {
@@ -256,7 +256,7 @@
private List<ClassDoc> get(Map<ClassDoc,List<ClassDoc>> map, ClassDoc cd) {
List<ClassDoc> list = map.get(cd);
if (list == null) {
- return new ArrayList<ClassDoc>();
+ return new ArrayList<>();
}
return list;
}
--- 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<String,Set<PackageDoc>> classToPackage = new HashMap<String,Set<PackageDoc>>();
+ public Map<String,Set<PackageDoc>> classToPackage = new HashMap<>();
/**
* Mapping of Annotations to set of PackageDoc that use the annotation.
*/
- public Map<String,List<PackageDoc>> classToPackageAnnotations = new HashMap<String,List<PackageDoc>>();
+ public Map<String,List<PackageDoc>> classToPackageAnnotations = new HashMap<>();
/**
* Mapping of ClassDocs to set of ClassDoc used by that class.
* Entries may be null.
*/
- public Map<String,Set<ClassDoc>> classToClass = new HashMap<String,Set<ClassDoc>>();
+ public Map<String,Set<ClassDoc>> 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<String,List<ClassDoc>> classToSubclass = new HashMap<String,List<ClassDoc>>();
+ public Map<String,List<ClassDoc>> 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<String,List<ClassDoc>> classToSubinterface = new HashMap<String,List<ClassDoc>>();
+ public Map<String,List<ClassDoc>> classToSubinterface = new HashMap<>();
/**
* Mapping of ClassDocs to list of ClassDoc which implement
* this interface.
* Entries may be null.
*/
- public Map<String,List<ClassDoc>> classToImplementingClass = new HashMap<String,List<ClassDoc>>();
+ public Map<String,List<ClassDoc>> classToImplementingClass = new HashMap<>();
/**
* Mapping of ClassDocs to list of FieldDoc declared as that class.
* Entries may be null.
*/
- public Map<String,List<FieldDoc>> classToField = new HashMap<String,List<FieldDoc>>();
+ public Map<String,List<FieldDoc>> classToField = new HashMap<>();
/**
* Mapping of ClassDocs to list of MethodDoc returning that class.
* Entries may be null.
*/
- public Map<String,List<MethodDoc>> classToMethodReturn = new HashMap<String,List<MethodDoc>>();
+ public Map<String,List<MethodDoc>> classToMethodReturn = new HashMap<>();
/**
* Mapping of ClassDocs to list of MethodDoc having that class
* as an arg.
* Entries may be null.
*/
- public Map<String,List<ExecutableMemberDoc>> classToMethodArgs = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToMethodArgs = new HashMap<>();
/**
* Mapping of ClassDocs to list of MethodDoc which throws that class.
* Entries may be null.
*/
- public Map<String,List<ExecutableMemberDoc>> classToMethodThrows = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToMethodThrows = new HashMap<>();
/**
* Mapping of ClassDocs to list of ConstructorDoc having that class
* as an arg.
* Entries may be null.
*/
- public Map<String,List<ExecutableMemberDoc>> classToConstructorArgs = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToConstructorArgs = new HashMap<>();
/**
* Mapping of ClassDocs to list of ConstructorDoc which throws that class.
* Entries may be null.
*/
- public Map<String,List<ExecutableMemberDoc>> classToConstructorThrows = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToConstructorThrows = new HashMap<>();
/**
* The mapping of AnnotationTypeDocs to constructors that use them.
*/
- public Map<String,List<ConstructorDoc>> classToConstructorAnnotations = new HashMap<String,List<ConstructorDoc>>();
+ public Map<String,List<ConstructorDoc>> classToConstructorAnnotations = new HashMap<>();
/**
* The mapping of AnnotationTypeDocs to Constructor parameters that use them.
*/
- public Map<String,List<ExecutableMemberDoc>> classToConstructorParamAnnotation = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToConstructorParamAnnotation = new HashMap<>();
/**
* The mapping of ClassDocs to Constructor arguments that use them as type parameters.
*/
- public Map<String,List<ExecutableMemberDoc>> classToConstructorDocArgTypeParam = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToConstructorDocArgTypeParam = new HashMap<>();
/**
* The mapping of ClassDocs to ClassDocs that use them as type parameters.
*/
- public Map<String,List<ClassDoc>> classToClassTypeParam = new HashMap<String,List<ClassDoc>>();
+ public Map<String,List<ClassDoc>> classToClassTypeParam = new HashMap<>();
/**
* The mapping of AnnotationTypeDocs to ClassDocs that use them.
*/
- public Map<String,List<ClassDoc>> classToClassAnnotations = new HashMap<String,List<ClassDoc>>();
+ public Map<String,List<ClassDoc>> classToClassAnnotations = new HashMap<>();
/**
* The mapping of ClassDocs to ExecutableMemberDocs that use them as type parameters.
*/
- public Map<String,List<MethodDoc>> classToExecMemberDocTypeParam = new HashMap<String,List<MethodDoc>>();
+ public Map<String,List<MethodDoc>> classToExecMemberDocTypeParam = new HashMap<>();
/**
* The mapping of ClassDocs to ExecutableMemberDocs arguments that use them as type parameters.
*/
- public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocArgTypeParam = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocArgTypeParam = new HashMap<>();
/**
* The mapping of AnnotationTypeDocs to ExecutableMemberDocs that use them.
*/
- public Map<String,List<MethodDoc>> classToExecMemberDocAnnotations = new HashMap<String,List<MethodDoc>>();
+ public Map<String,List<MethodDoc>> classToExecMemberDocAnnotations = new HashMap<>();
/**
* The mapping of ClassDocs to ExecutableMemberDocs that have return type
* with type parameters of that class.
*/
- public Map<String,List<MethodDoc>> classToExecMemberDocReturnTypeParam = new HashMap<String,List<MethodDoc>>();
+ public Map<String,List<MethodDoc>> classToExecMemberDocReturnTypeParam = new HashMap<>();
/**
* The mapping of AnnotationTypeDocs to MethodDoc parameters that use them.
*/
- public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocParamAnnotation = new HashMap<String,List<ExecutableMemberDoc>>();
+ public Map<String,List<ExecutableMemberDoc>> classToExecMemberDocParamAnnotation = new HashMap<>();
/**
* The mapping of ClassDocs to FieldDocs that use them as type parameters.
*/
- public Map<String,List<FieldDoc>> classToFieldDocTypeParam = new HashMap<String,List<FieldDoc>>();
+ public Map<String,List<FieldDoc>> classToFieldDocTypeParam = new HashMap<>();
/**
* The mapping of AnnotationTypeDocs to FieldDocs that use them.
*/
- public Map<String,List<FieldDoc>> annotationToFieldDoc = new HashMap<String,List<FieldDoc>>();
+ public Map<String,List<FieldDoc>> annotationToFieldDoc = new HashMap<>();
public ClassUseMapper(RootDoc root, ClassTree classtree) {
@@ -234,7 +234,7 @@
private Collection<ClassDoc> subclasses(ClassDoc cd) {
Collection<ClassDoc> ret = classToSubclass.get(cd.qualifiedName());
if (ret == null) {
- ret = new TreeSet<ClassDoc>();
+ ret = new TreeSet<>();
List<ClassDoc> subs = classtree.subclasses(cd);
if (subs != null) {
ret.addAll(subs);
@@ -253,7 +253,7 @@
private Collection<ClassDoc> subinterfaces(ClassDoc cd) {
Collection<ClassDoc> ret = classToSubinterface.get(cd.qualifiedName());
if (ret == null) {
- ret = new TreeSet<ClassDoc>();
+ ret = new TreeSet<>();
List<ClassDoc> subs = classtree.subinterfaces(cd);
if (subs != null) {
ret.addAll(subs);
@@ -275,7 +275,7 @@
private Collection<ClassDoc> implementingClasses(ClassDoc cd) {
Collection<ClassDoc> ret = classToImplementingClass.get(cd.qualifiedName());
if (ret == null) {
- ret = new TreeSet<ClassDoc>();
+ ret = new TreeSet<>();
List<ClassDoc> impl = classtree.implementingclasses(cd);
if (impl != null) {
ret.addAll(impl);
@@ -297,7 +297,7 @@
*/
private void mapExecutable(ExecutableMemberDoc em) {
boolean isConstructor = em.isConstructor();
- List<Type> classArgs = new ArrayList<Type>();
+ List<Type> 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 <T> List<T> refList(Map<String,List<T>> map, ClassDoc cd) {
List<T> list = map.get(cd.qualifiedName());
if (list == null) {
- List<T> l = new ArrayList<T>();
- list = l;
+ list = new ArrayList<>();
map.put(cd.qualifiedName(), list);
}
return list;
@@ -336,7 +335,7 @@
private Set<PackageDoc> packageSet(ClassDoc cd) {
Set<PackageDoc> pkgSet = classToPackage.get(cd.qualifiedName());
if (pkgSet == null) {
- pkgSet = new TreeSet<PackageDoc>();
+ pkgSet = new TreeSet<>();
classToPackage.put(cd.qualifiedName(), pkgSet);
}
return pkgSet;
@@ -345,8 +344,7 @@
private Set<ClassDoc> classSet(ClassDoc cd) {
Set<ClassDoc> clsSet = classToClass.get(cd.qualifiedName());
if (clsSet == null) {
- Set<ClassDoc> s = new TreeSet<ClassDoc>();
- clsSet = s;
+ clsSet = new TreeSet<>();
classToClass.put(cd.qualifiedName(), clsSet);
}
return clsSet;
--- 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<List<Doc>>();
+ deprecatedLists = new ArrayList<>();
for (int i = 0; i < NUM_TYPES; i++) {
- deprecatedLists.add(i, new ArrayList<Doc>());
+ deprecatedLists.add(i, new ArrayList<>());
}
buildDeprecatedAPIInfo(configuration);
}
--- 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<Configuration, DocFileFactory> factories =
- new WeakHashMap<Configuration, DocFileFactory>();
+ private static final Map<Configuration, DocFileFactory> factories = new WeakHashMap<>();
/**
* Get the appropriate factory, based on the file manager given in the
--- 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<Tag> tagList = new ArrayList<Tag>();
+ public List<Tag> tagList = new ArrayList<>();
}
/**
--- 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");
}
--- 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<String,Item>();
+ packageToItemMap = new HashMap<>();
}
if (!packageToItemMap.containsKey(packageName)) { // save the previous
packageToItemMap.put(packageName, this); // mapped location
--- 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<String,String> regExpGroupMap = new HashMap<String,String>();
+ private Map<String,String> 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<String> sortedRegExpList = new ArrayList<String>();
+ private List<String> sortedRegExpList = new ArrayList<>();
/**
* List of group names in the same order as given on the command line.
*/
- private List<String> groupList = new ArrayList<String>();
+ private List<String> groupList = new ArrayList<>();
/**
* Map of non-regular expressions(possible package names) with the
* corresponding group name.
*/
- private Map<String,String> pkgNameGroupMap = new HashMap<String,String>();
+ private Map<String,String> pkgNameGroupMap = new HashMap<>();
/**
* The global configuration information for this run.
@@ -176,7 +176,7 @@
* @param packages Packages specified on the command line.
*/
public Map<String,List<PackageDoc>> groupPackages(PackageDoc[] packages) {
- Map<String,List<PackageDoc>> groupPackageMap = new HashMap<String,List<PackageDoc>>();
+ Map<String,List<PackageDoc>> groupPackageMap = new HashMap<>();
String defaultGroupName =
(pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
configuration.message.getText("doclet.Packages") :
@@ -229,7 +229,7 @@
List<PackageDoc> getPkgList(Map<String,List<PackageDoc>> map, String groupname) {
List<PackageDoc> list = map.get(groupname);
if (list == null) {
- list = new ArrayList<PackageDoc>();
+ list = new ArrayList<>();
map.put(groupname, list);
}
return list;
--- 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<MethodDoc,Type> interfaces = new HashMap<MethodDoc,Type>();
- private List<MethodDoc> methlist = new ArrayList<MethodDoc>();
+ private Map<MethodDoc,Type> interfaces = new HashMap<>();
+ private List<MethodDoc> methlist = new ArrayList<>();
private Configuration configuration;
private final ClassDoc classdoc;
private final MethodDoc method;
--- 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<Character,List<Doc>> indexmap = new HashMap<Character,List<Doc>>();
+ private Map<Character,List<Doc>> 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<PackageDoc> set = new HashSet<PackageDoc>();
+ Set<PackageDoc> 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<Doc> list = indexmap.get(unicode);
if (list == null) {
- list = new ArrayList<Doc>();
+ list = new ArrayList<>();
indexmap.put(unicode, list);
}
list.add(element);
--- 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<String> results = new ArrayList<String>();
+ ArrayList<String> results = new ArrayList<>();
// Add field and method keywords only if -keywords option is used
if( configuration.keywords ) {
@@ -88,7 +88,7 @@
*/
protected ArrayList<String> getClassKeyword(ClassDoc classdoc) {
String cltypelower = classdoc.isInterface() ? "interface" : "class";
- ArrayList<String> metakeywords = new ArrayList<String>(1);
+ ArrayList<String> 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<String> getMemberKeywords(MemberDoc[] memberdocs) {
- ArrayList<String> results = new ArrayList<String>();
+ ArrayList<String> results = new ArrayList<>();
String membername;
for (MemberDoc memberdoc : memberdocs) {
membername = memberdoc.name() + (memberdoc.isMethod() ? "()" : "");
--- 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<String> names = new ArrayList<String>();
+ ArrayList<String> 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.
--- 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<DocFile> files = new LinkedHashSet<DocFile>();
+ Set<DocFile> 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<DocFile> list() throws IOException {
- List<DocFile> files = new ArrayList<DocFile>();
+ List<DocFile> files = new ArrayList<>();
try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
for (Path f: ds) {
files.add(new StandardDocFile(f));
--- 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<DocFile> files = new LinkedHashSet<DocFile>();
+ Set<DocFile> 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<DocFile> list() {
- List<DocFile> files = new ArrayList<DocFile>();
+ List<DocFile> files = new ArrayList<>();
for (File f: file.listFiles()) {
files.add(new SimpleDocFile(f));
}
--- 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<DocFile> files = new LinkedHashSet<DocFile>();
+ Set<DocFile> 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<DocFile> list() {
- List<DocFile> files = new ArrayList<DocFile>();
+ List<DocFile> files = new ArrayList<>();
for (File f: file.listFiles()) {
files.add(new StandardDocFile(f));
}
--- 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<ProgramElementDoc> excludeDeprecatedMembersAsList(
ProgramElementDoc[] members) {
- List<ProgramElementDoc> list = new ArrayList<ProgramElementDoc>();
+ List<ProgramElementDoc> list = new ArrayList<>();
for (ProgramElementDoc member : members) {
if (member.tags("deprecated").length == 0) {
list.add(member);
@@ -273,7 +273,7 @@
*/
public static List<Type> getAllInterfaces(Type type,
Configuration configuration, boolean sort) {
- Map<ClassDoc,Type> results = sort ? new TreeMap<ClassDoc,Type>() : new LinkedHashMap<ClassDoc,Type>();
+ Map<ClassDoc,Type> 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<Type>(results.values());
+ return new ArrayList<>(results.values());
//Try walking the tree.
addAllInterfaceTypes(results,
superType,
interfaceTypesOf(superType),
false, configuration);
- List<Type> resultsList = new ArrayList<Type>(results.values());
+ List<Type> resultsList = new ArrayList<>(results.values());
if (sort) {
Collections.sort(resultsList, new TypeComparator());
}
@@ -744,8 +744,7 @@
if (!javafx) {
return classes;
}
- final List<ClassDoc> filteredOutClasses =
- new ArrayList<ClassDoc>(classes.length);
+ final List<ClassDoc> filteredOutClasses = new ArrayList<>(classes.length);
for (ClassDoc classDoc : classes) {
if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
continue;
--- 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<ClassDoc> visibleClasses = new ArrayList<ClassDoc>();
+ private final List<ClassDoc> 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<Object,Map<ProgramElementDoc,String>> memberNameMap = new HashMap<Object,Map<ProgramElementDoc,String>>();
+ private final Map<Object,Map<ProgramElementDoc,String>> memberNameMap = new HashMap<>();
/**
* Map of class and it's ClassMembers object.
*/
- private final Map<ClassDoc,ClassMembers> classMap = new HashMap<ClassDoc,ClassMembers>();
+ private final Map<ClassDoc,ClassMembers> 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<ClassDoc, ProgramElementDoc[]> propertiesCache =
- new HashMap<ClassDoc, ProgramElementDoc[]>();
- private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap =
- new HashMap<ProgramElementDoc, ProgramElementDoc>();
- private static final Map<ProgramElementDoc, GetterSetter> getterSetterMap =
- new HashMap<ProgramElementDoc, GetterSetter>();
+ private static final Map<ClassDoc, ProgramElementDoc[]> propertiesCache = new HashMap<>();
+ private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap = new HashMap<>();
+ private static final Map<ProgramElementDoc, GetterSetter> 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<ProgramElementDoc> getInheritedPackagePrivateMethods(Configuration configuration) {
- List<ProgramElementDoc> results = new ArrayList<ProgramElementDoc>();
+ List<ProgramElementDoc> results = new ArrayList<>();
for (ClassDoc currentClass : visibleClasses) {
if (currentClass != classdoc &&
currentClass.isPackagePrivate() &&
@@ -208,7 +205,7 @@
public List<ProgramElementDoc> getMembersFor(ClassDoc cd) {
ClassMembers clmembers = classMap.get(cd);
if (clmembers == null) {
- return new ArrayList<ProgramElementDoc>();
+ return new ArrayList<>();
}
return clmembers.getMembers();
}
@@ -218,8 +215,8 @@
* classes followed by interfaces traversed. Don't sort alphabetically.
*/
private void sort(List<ClassDoc> list) {
- List<ClassDoc> classes = new ArrayList<ClassDoc>();
- List<ClassDoc> interfaces = new ArrayList<ClassDoc>();
+ List<ClassDoc> classes = new ArrayList<>();
+ List<ClassDoc> interfaces = new ArrayList<>();
for (ClassDoc cd : list) {
if (cd.isClass()) {
classes.add(cd);
@@ -238,7 +235,7 @@
Object key = getMemberKey(element);
Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
if (memberLevelMap == null) {
- memberLevelMap = new HashMap<ProgramElementDoc, String>();
+ memberLevelMap = new HashMap<>();
memberNameMap.put(key, memberLevelMap);
}
memberLevelMap.put(element, level);
@@ -263,7 +260,7 @@
private Set<ProgramElementDoc> members;
public ClassMember(ProgramElementDoc programElementDoc) {
- members = new HashSet<ProgramElementDoc>();
+ members = new HashSet<>();
members.add(programElementDoc);
}
@@ -297,7 +294,7 @@
/**
* List of inherited members from the mapping class.
*/
- private List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>();
+ private List<ProgramElementDoc> members = new ArrayList<>();
/**
* Level/Depth of inheritance.
@@ -368,7 +365,7 @@
*/
private void addMembers(ClassDoc fromClass) {
List<ProgramElementDoc> cdmembers = getClassMembers(fromClass, true);
- List<ProgramElementDoc> incllist = new ArrayList<ProgramElementDoc>();
+ List<ProgramElementDoc> 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<AnnotationTypeElementDoc> targetMembers = new ArrayList<AnnotationTypeElementDoc>();
+ List<AnnotationTypeElementDoc> 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<MethodDoc> result = new ArrayList<MethodDoc>();
+ final List<MethodDoc> result = new ArrayList<>();
for (final MethodDoc propertyMethod : allMethods) {
--- 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<CompilationUnitTree> todo = new LinkedList<CompilationUnitTree>();
+ Queue<CompilationUnitTree> todo = new LinkedList<>();
};
task.addTaskListener(tl);
--- 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<String,Entity> names = new HashMap<String,Entity>();
- private static final Map<Integer,Entity> codes = new HashMap<Integer,Entity>();
+ private static final Map<String,Entity> names = new HashMap<>();
+ private static final Map<Integer,Entity> codes = new HashMap<>();
static {
for (Entity e: values()) {
String name = e.name();
--- 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<String>();
+ customTags = new LinkedHashSet<>();
for (String s : cTags.split(DocLint.TAGS_SEPARATOR)) {
if (!s.isEmpty())
customTags.add(s);
--- 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<String,Attr> index = new HashMap<String,Attr>();
+ static final Map<String,Attr> 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,AttrKind>(Attr.class);
+ this.attrs = new EnumMap<>(Attr.class);
for (Map<Attr,AttrKind> m: attrMaps)
this.attrs.putAll(m);
attrs.put(Attr.CLASS, AttrKind.OK);
@@ -450,7 +450,7 @@
return map;
}
- private static final Map<String,HtmlTag> index = new HashMap<String,HtmlTag>();
+ private static final Map<String,HtmlTag> index = new HashMap<>();
static {
for (HtmlTag t: values()) {
index.put(t.getText(), t);
--- 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<String, Env.AccessKind> map = new HashMap<String, Env.AccessKind>();
+ Map<String, Env.AccessKind> 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<String, Integer>();
+ codeCounts = new HashMap<>();
} else {
groupCounts = null;
dkindCounts = null;
@@ -321,7 +321,7 @@
return o2.compareTo(o1);
}
};
- private final TreeMap<Integer, Set<String>> map = new TreeMap<Integer, Set<String>>(DECREASING);
+ private final TreeMap<Integer, Set<String>> map = new TreeMap<>(DECREASING);
void put(String label, int n) {
if (n == 0) {
@@ -329,7 +329,7 @@
}
Set<String> labels = map.get(n);
if (labels == null) {
- map.put(n, labels = new TreeSet<String>());
+ map.put(n, labels = new TreeSet<>());
}
labels.add(label);
}
--- 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<Class<?>, Boolean> trustedClasses;
protected ClientCodeWrapper(Context context) {
- trustedClasses = new HashMap<Class<?>, Boolean>();
+ trustedClasses = new HashMap<>();
}
public JavaFileManager wrap(JavaFileManager fm) {
@@ -136,7 +136,7 @@
}
public Iterable<JavaFileObject> wrapJavaFileObjects(Iterable<? extends JavaFileObject> list) {
- List<JavaFileObject> wrapped = new ArrayList<JavaFileObject>();
+ List<JavaFileObject> wrapped = new ArrayList<>();
for (JavaFileObject fo : list)
wrapped.add(wrap(fo));
return Collections.unmodifiableList(wrapped);
@@ -152,7 +152,7 @@
public <T /*super JavaFileOject*/> DiagnosticListener<T> wrap(DiagnosticListener<T> dl) {
if (isTrusted(dl))
return dl;
- return new WrappedDiagnosticListener<T>(dl);
+ return new WrappedDiagnosticListener<>(dl);
}
TaskListener wrap(TaskListener tl) {
@@ -169,7 +169,7 @@
}
Collection<TaskListener> unwrap(Collection<? extends TaskListener> listeners) {
- Collection<TaskListener> c = new ArrayList<TaskListener>(listeners.size());
+ Collection<TaskListener> c = new ArrayList<>(listeners.size());
for (TaskListener l: listeners)
c.add(unwrap(l));
return c;
--- 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
}
}
}
--- 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<String> iter) {
- ListBuffer<String> result = new ListBuffer<String>();
+ ListBuffer<String> result = new ListBuffer<>();
if (iter != null)
for (String s : iter)
result.append(s);
@@ -115,7 +115,7 @@
static private List<JavaFileObject> toList(Iterable<? extends JavaFileObject> fileObjects) {
if (fileObjects == null)
return List.nil();
- ListBuffer<JavaFileObject> result = new ListBuffer<JavaFileObject>();
+ ListBuffer<JavaFileObject> 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<JavaFileObject, JCCompilationUnit>();
+ 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<File>();
+ compilerMain.filenames = new LinkedHashSet<>();
Collection<File> 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<JavaFileObject, JCCompilationUnit>();
+ notYetEntered = new HashMap<>();
for (JavaFileObject file: fileObjects)
notYetEntered.put(file, null);
- genList = new ListBuffer<Env<AttrContext>>();
+ 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<JCCompilationUnit>();
+ roots = new ListBuffer<>();
roots.append(unit);
}
}
@@ -300,7 +300,7 @@
for (CompilationUnitTree cu : trees) {
if (cu instanceof JCCompilationUnit) {
if (roots == null)
- roots = new ListBuffer<JCCompilationUnit>();
+ roots = new ListBuffer<>();
roots.append((JCCompilationUnit)cu);
notYetEntered.remove(cu.getSourceFile());
}
@@ -318,7 +318,7 @@
if (notYetEntered.isEmpty())
compiler = compiler.processAnnotations(units);
- ListBuffer<TypeElement> elements = new ListBuffer<TypeElement>();
+ ListBuffer<TypeElement> elements = new ListBuffer<>();
for (JCCompilationUnit unit : units) {
for (JCTree node : unit.defs) {
if (node.hasTag(JCTree.Tag.CLASSDEF)) {
@@ -358,7 +358,7 @@
public Iterable<? extends Element> analyze(Iterable<? extends TypeElement> classes) throws IOException {
enter(null); // ensure all classes have been entered
- final ListBuffer<Element> results = new ListBuffer<Element>();
+ final ListBuffer<Element> 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<? extends JavaFileObject> generate(Iterable<? extends TypeElement> classes) throws IOException {
- final ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
+ final ListBuffer<JavaFileObject> 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<Env<AttrContext>> list, Iterable<? extends TypeElement> classes) {
- Set<TypeElement> set = new HashSet<TypeElement>();
+ Set<TypeElement> set = new HashSet<>();
for (TypeElement item: classes)
set.add(item);
--- 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<Type> lb = new ListBuffer<Type>();
+ ListBuffer<Type> lb = new ListBuffer<>();
for (List<JCTree> 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<ClassSymbol>());
+ 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<Type> paramTypes) {
- return searchMethod(tsym, methodName, paramTypes, new HashSet<ClassSymbol>());
+ return searchMethod(tsym, methodName, paramTypes, new HashSet<>());
}
/** @see com.sun.tools.javadoc.ClassDocImpl#searchMethod */
--- 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<MultiTaskListener> taskListenerKey =
- new Context.Key<MultiTaskListener>();
+ public static final Context.Key<MultiTaskListener> taskListenerKey = new Context.Key<>();
/** Get the MultiTaskListener instance for this context. */
public static MultiTaskListener instance(Context context) {
--- 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<JavaFileObject> wrap(Iterable<JavaFileObject> fileObjects) {
- List<JavaFileObject> mapped = new ArrayList<JavaFileObject>();
+ List<JavaFileObject> mapped = new ArrayList<>();
for (JavaFileObject fileObject : fileObjects)
mapped.add(wrap(fileObject));
return Collections.unmodifiableList(mapped);
--- 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<MethodSymbol, Attribute> getElementValues() {
- Map<MethodSymbol, Attribute> valmap =
- new LinkedHashMap<MethodSymbol, Attribute>();
+ Map<MethodSymbol, Attribute> valmap = new LinkedHashMap<>();
for (Pair<MethodSymbol, Attribute> value : values)
valmap.put(value.fst, value.snd);
return valmap;
--- 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.</b>
*/
public class DeferredLintHandler {
- protected static final Context.Key<DeferredLintHandler> deferredLintHandlerKey =
- new Context.Key<DeferredLintHandler>();
+ protected static final Context.Key<DeferredLintHandler> deferredLintHandlerKey = new Context.Key<>();
public static DeferredLintHandler instance(Context context) {
DeferredLintHandler instance = context.get(deferredLintHandlerKey);
@@ -67,7 +66,7 @@
}
private DiagnosticPosition currentPos;
- private Map<DiagnosticPosition, ListBuffer<LintLogger>> loggersQueue = new HashMap<DiagnosticPosition, ListBuffer<LintLogger>>();
+ private Map<DiagnosticPosition, ListBuffer<LintLogger>> 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.
--- 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<Long, Set<Modifier>> modifierSets =
- new java.util.concurrent.ConcurrentHashMap<Long, Set<Modifier>>(64);
+ private static final Map<Long, Set<Modifier>> modifierSets = new ConcurrentHashMap<>(64);
public static boolean isStatic(Symbol symbol) {
return (symbol.flags() & STATIC) != 0;
--- 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<Lint> lintKey = new Context.Key<Lint>();
+ protected static final Context.Key<Lint> lintKey = new Context.Key<>();
/** Get the root Lint instance. */
public static Lint instance(Context context) {
@@ -83,8 +85,7 @@
private final EnumSet<LintCategory> values;
private final EnumSet<LintCategory> suppressedValues;
- private static final Map<String, LintCategory> map =
- new java.util.concurrent.ConcurrentHashMap<String, LintCategory>(20);
+ private static final Map<String, LintCategory> 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) {
}
- };
+ }
}
--- 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<Source> sourceKey
- = new Context.Key<Source>();
+ private static final Context.Key<Source> sourceKey = new Context.Key<>();
public static Source instance(Context context) {
Source instance = context.get(sourceKey);
--- 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<VarSymbol> buf = new ListBuffer<VarSymbol>();
+ ListBuffer<VarSymbol> buf = new ListBuffer<>();
List<Name> remaining = paramNames;
// assert: remaining and paramNames are both empty or both
// have same cardinality as type.getParameterTypes()
--- 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<T>(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<Attribute.TypeCompound> 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<Attribute.TypeCompound> 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<Attribute.TypeCompound> 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 {
--- 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<Symtab> symtabKey =
- new Context.Key<Symtab>();
+ protected static final Context.Key<Symtab> 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<Name> operatorNames = new HashSet<Name>();
+ public final Set<Name> 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<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>();
+ public final Map<Name, ClassSymbol> 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<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>();
+ public final Map<Name, PackageSymbol> packages = new HashMap<>();
public void initType(Type type, ClassSymbol c) {
type.tsym = c;
--- 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, List<Type>>(InferenceBound.class);
+ bounds = new EnumMap<>(InferenceBound.class);
List<Type> declaredBounds = types.getBounds(origin);
declaredCount = declaredBounds.length();
bounds.put(InferenceBound.UPPER, declaredBounds);
--- 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<TypeAnnotations> typeAnnosKey =
- new Context.Key<TypeAnnotations>();
+ protected static final Context.Key<TypeAnnotations> 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<Attribute.Compound> annotations = sym.getRawAttributes();
- ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<Attribute.Compound>();
- ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>();
- ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
+ ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<>();
+ ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<>();
+ ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<>();
for (Attribute.Compound a : annotations) {
switch (annotationType(a, sym)) {
@@ -351,7 +350,7 @@
MethodType methType = sym.owner.type.asMethodType();
List<VarSymbol> params = ((MethodSymbol)sym.owner).params;
List<Type> oldArgs = methType.argtypes;
- ListBuffer<Type> newArgs = new ListBuffer<Type>();
+ ListBuffer<Type> 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<Attribute.TypeCompound> newattrs =
- new ListBuffer<Attribute.TypeCompound>();
+ ListBuffer<Attribute.TypeCompound> newattrs = new ListBuffer<>();
for (Attribute.TypeCompound old : sym.getRawTypeAttributes()) {
newattrs.append(new Attribute.TypeCompound(old.type, old.values,
--- 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.</b>
*/
public class Types {
- protected static final Context.Key<Types> typesKey =
- new Context.Key<Types>();
+ protected static final Context.Key<Types> 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<Type> from = new ListBuffer<Type>();
- ListBuffer<Type> to = new ListBuffer<Type>();
+ ListBuffer<Type> from = new ListBuffer<>();
+ ListBuffer<Type> 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<Type> openVars = new ListBuffer<Type>();
+ ListBuffer<Type> openVars = new ListBuffer<>();
for (List<Type> 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<Type> opens = openVars.toList();
- ListBuffer<Type> qs = new ListBuffer<Type>();
+ ListBuffer<Type> qs = new ListBuffer<>();
for (List<Type> 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<TypeSymbol, Entry> _map = new WeakHashMap<TypeSymbol, Entry>();
+ private WeakHashMap<TypeSymbol, Entry> _map = new WeakHashMap<>();
class FunctionDescriptor {
Symbol descSym;
@@ -727,7 +726,7 @@
!overridesObjectMethod(origin, sym) &&
(interfaceCandidates(origin.type, (MethodSymbol)sym).head.flags() & DEFAULT) == 0;
}
- };
+ }
// <editor-fold defaultstate="collapsed" desc="isSubtype">
/**
@@ -864,7 +863,7 @@
}
}
- private Set<TypePair> cache = new HashSet<TypePair>();
+ private Set<TypePair> 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<UniqueType> set = new HashSet<UniqueType>();
+ HashSet<UniqueType> 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<Type> ts1, List<Type> 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<TypePair> cache = new HashSet<TypePair>();
+ private Set<TypePair> cache = new HashSet<>();
@Override
public Boolean visitType(Type t, Type s) {
@@ -2446,7 +2445,7 @@
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="isDerivedRaw">
- Map<Type,Boolean> isDerivedRawCache = new HashMap<Type,Boolean>();
+ Map<Type,Boolean> isDerivedRawCache = new HashMap<>();
public boolean isDerivedRaw(Type t) {
Boolean result = isDerivedRawCache.get(t);
@@ -2608,8 +2607,7 @@
// <editor-fold defaultstate="collapsed" desc="Determining method implementation in given site">
class ImplementationCache {
- private WeakHashMap<MethodSymbol, SoftReference<Map<TypeSymbol, Entry>>> _map =
- new WeakHashMap<MethodSymbol, SoftReference<Map<TypeSymbol, Entry>>>();
+ private WeakHashMap<MethodSymbol, SoftReference<Map<TypeSymbol, Entry>>> _map = new WeakHashMap<>();
class Entry {
final MethodSymbol cachedImpl;
@@ -2638,8 +2636,8 @@
SoftReference<Map<TypeSymbol, Entry>> ref_cache = _map.get(ms);
Map<TypeSymbol, Entry> cache = ref_cache != null ? ref_cache.get() : null;
if (cache == null) {
- cache = new HashMap<TypeSymbol, Entry>();
- _map.put(ms, new SoftReference<Map<TypeSymbol, Entry>>(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 @@
// <editor-fold defaultstate="collapsed" desc="compute transitive closure of all members in given site">
class MembersClosureCache extends SimpleVisitor<CompoundScope, Boolean> {
- private WeakHashMap<TypeSymbol, Entry> _map =
- new WeakHashMap<TypeSymbol, Entry>();
+ private WeakHashMap<TypeSymbol, Entry> _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));
}
- };
+ }
// </editor-fold>
/**
@@ -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);
// </editor-fold>
@@ -3301,7 +3298,7 @@
* (that is, subclasses come first, arbitrary but fixed
* otherwise).
*/
- private Map<Type,List<Type>> closureCache = new HashMap<Type,List<Type>>();
+ private Map<Type,List<Type>> closureCache = new HashMap<>();
/**
* Returns the closure of a class or interface type.
@@ -3404,13 +3401,13 @@
&& isSameType(t2, typePair.t2);
}
}
- Set<TypePair> mergeCache = new HashSet<TypePair>();
+ Set<TypePair> mergeCache = new HashSet<>();
private Type merge(Type c1, Type c2) {
ClassType class1 = (ClassType) c1;
List<Type> act1 = class1.getTypeArguments();
ClassType class2 = (ClassType) c2;
List<Type> act2 = class2.getTypeArguments();
- ListBuffer<Type> merged = new ListBuffer<Type>();
+ ListBuffer<Type> merged = new ListBuffer<>();
List<Type> typarams = class1.tsym.type.getTypeArguments();
while (act1.nonEmpty() && act2.nonEmpty() && typarams.nonEmpty()) {
@@ -4090,7 +4087,7 @@
Adapter(ListBuffer<Type> from, ListBuffer<Type> to) {
this.from = from;
this.to = to;
- mapping = new HashMap<Symbol,Type>();
+ mapping = new HashMap<>();
}
public void adapt(Type source, Type target) throws AdaptFailure {
@@ -4159,7 +4156,7 @@
return null;
}
- private Set<TypePair> cache = new HashSet<TypePair>();
+ private Set<TypePair> 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<Type> rewritten = new ListBuffer<Type>();
+ ListBuffer<Type> rewritten = new ListBuffer<>();
boolean changed = false;
for (Type arg : t.allparams()) {
Type bound = visit(arg);
--- 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.</b>
*/
public class Annotate {
- protected static final Context.Key<Annotate> annotateKey =
- new Context.Key<Annotate>();
+ protected static final Context.Key<Annotate> annotateKey = new Context.Key<>();
public static Annotate instance(Context context) {
Annotate instance = context.get(annotateKey);
@@ -88,11 +87,11 @@
private int enterCount = 0;
- ListBuffer<Worker> q = new ListBuffer<Worker>();
- ListBuffer<Worker> typesQ = new ListBuffer<Worker>();
- ListBuffer<Worker> repeatedQ = new ListBuffer<Worker>();
- ListBuffer<Worker> afterRepeatedQ = new ListBuffer<Worker>();
- ListBuffer<Worker> validateQ = new ListBuffer<Worker>();
+ ListBuffer<Worker> q = new ListBuffer<>();
+ ListBuffer<Worker> typesQ = new ListBuffer<>();
+ ListBuffer<Worker> repeatedQ = new ListBuffer<>();
+ ListBuffer<Worker> afterRepeatedQ = new ListBuffer<>();
+ ListBuffer<Worker> 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<Attribute> buf = new ListBuffer<Attribute>();
+ ListBuffer<Attribute> buf = new ListBuffer<>();
for (List<JCExpression> 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<MethodSymbol, Attribute> p =
- new Pair<MethodSymbol, Attribute>(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),
--- 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.</b>
*/
public class Attr extends JCTree.Visitor {
- protected static final Context.Key<Attr> attrKey =
- new Context.Key<Attr>();
+ protected static final Context.Key<Attr> 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<Type> attribExprs(List<JCExpression> trees, Env<AttrContext> env, Type pt) {
- ListBuffer<Type> ts = new ListBuffer<Type>();
+ ListBuffer<Type> ts = new ListBuffer<>();
for (List<JCExpression> 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<Type> attribAnyTypes(List<JCExpression> trees, Env<AttrContext> env) {
- ListBuffer<Type> argtypes = new ListBuffer<Type>();
+ ListBuffer<Type> argtypes = new ListBuffer<>();
for (List<JCExpression> 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<Object> labels = new HashSet<Object>(); // The set of case labels.
+ Set<Object> labels = new HashSet<>(); // The set of case labels.
boolean hasDefault = false; // Is there a default label?
for (List<JCCase> 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<Symbol, JCDiagnostic> errCandidate() {
- return new Pair<Symbol, JCDiagnostic>(sym, diag);
+ return new Pair<>(sym, diag);
}
};
List<Type> argtypes2 = Type.map(argtypes,
@@ -3968,7 +3967,7 @@
}
Type checkIntersection(JCTree tree, List<JCExpression> bounds) {
- Set<Type> boundSet = new HashSet<Type>();
+ Set<Type> 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<Attribute.Compound> comps = new ListBuffer<Attribute.Compound>();
+ ListBuffer<Attribute.Compound> comps = new ListBuffer<>();
for (JCAnnotation an : at.getAnnotations()) {
comps.add(an.attribute);
}
@@ -4634,7 +4633,7 @@
}
}
}
- };
+ }
// <editor-fold desc="post-attribution visitor">
--- 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.</b>
*/
public class Check {
- protected static final Context.Key<Check> checkKey =
- new Context.Key<Check>();
+ protected static final Context.Key<Check> 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<Name,ClassSymbol> compiled = new HashMap<Name, ClassSymbol>();
+ public Map<Name,ClassSymbol> compiled = new HashMap<>();
/** A handler for messages about deprecated usage.
*/
@@ -937,7 +936,7 @@
List<Type> actuals = type.allparams();
List<Type> args = type.getTypeArguments();
List<Type> forms = type.tsym.type.getTypeArguments();
- ListBuffer<Type> bounds_buf = new ListBuffer<Type>();
+ ListBuffer<Type> 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<TypeSymbol,Type> interfaces1 = new HashMap<TypeSymbol,Type>();
+ Map<TypeSymbol,Type> interfaces1 = new HashMap<>();
closure(t1, interfaces1);
Map<TypeSymbol,Type> interfaces2;
if (t1 == t2)
interfaces2 = interfaces1;
else
- closure(t2, interfaces1, interfaces2 = new HashMap<TypeSymbol,Type>());
+ 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<TypeSymbol,Type> supertypes = new HashMap<TypeSymbol,Type>();
+ Map<TypeSymbol,Type> 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<TypeSymbol,Type>(), 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<Name>();
- 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<Name> containedTargets;
@@ -2861,14 +2860,14 @@
if (containedTarget == null) {
containedTargets = getDefaultTargetSet();
} else {
- containedTargets = new HashSet<Name>();
- 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<Name> getDefaultTargetSet() {
if (defaultTargets == null) {
- Set<Name> targets = new HashSet<Name>();
+ Set<Name> 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<MethodSymbol> members = new LinkedHashSet<MethodSymbol>();
+ Set<MethodSymbol> 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<Symbol> targets = new HashSet<Symbol>();
+ Set<Symbol> 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<Symbol,Symbol> callMap = new HashMap<Symbol, Symbol>();
+ Map<Symbol,Symbol> callMap = new HashMap<>();
// enter each constructor this-call into the map
for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
--- 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<Env<AttrContext>, CompileStates.CompileState> {
/** The context key for the compile states. */
- protected static final Context.Key<CompileStates> compileStatesKey =
- new Context.Key<CompileStates>();
+ protected static final Context.Key<CompileStates> 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;
--- 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.</b>
*/
strictfp class ConstFold {
- protected static final Context.Key<ConstFold> constFoldKey =
- new Context.Key<ConstFold>();
+ protected static final Context.Key<ConstFold> constFoldKey = new Context.Key<>();
private Symtab syms;
--- 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.</b>
*/
public class DeferredAttr extends JCTree.Visitor {
- protected static final Context.Key<DeferredAttr> deferredAttrKey =
- new Context.Key<DeferredAttr>();
+ protected static final Context.Key<DeferredAttr> deferredAttrKey = new Context.Key<>();
final Attr attr;
final Check chk;
@@ -147,8 +146,7 @@
*/
class SpeculativeCache {
- private Map<Symbol, List<Entry>> cache =
- new WeakHashMap<Symbol, List<Entry>>();
+ private Map<Symbol, List<Entry>> 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<AttrContext> env, ResultInfo resultInfo) {
- final JCTree newTree = new TreeCopier<Object>(make).copy(tree);
+ final JCTree newTree = new TreeCopier<>(make).copy(tree);
Env<AttrContext> 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<DeferredAttrNode> deferredAttrNodes = new ArrayList<DeferredAttrNode>();
+ ArrayList<DeferredAttrNode> 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<Type, Set<Type>> depVarsMap = new LinkedHashMap<Type, Set<Type>>();
+ Map<Type, Set<Type>> depVarsMap = new LinkedHashMap<>();
List<Type> 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<Type> prevDeps = depVarsMap.get(t);
if (prevDeps == null) {
- prevDeps = new LinkedHashSet<Type>();
+ prevDeps = new LinkedHashSet<>();
depVarsMap.put(t, prevDeps);
}
prevDeps.addAll(restStuckVars);
@@ -815,8 +813,8 @@
Type pt;
Infer.InferenceContext inferenceContext;
- Set<Type> stuckVars = new LinkedHashSet<Type>();
- Set<Type> depVars = new LinkedHashSet<Type>();
+ Set<Type> stuckVars = new LinkedHashSet<>();
+ Set<Type> depVars = new LinkedHashSet<>();
@Override
public boolean isStuck() {
--- 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.</b>
*/
public class Enter extends JCTree.Visitor {
- protected static final Context.Key<Enter> enterKey =
- new Context.Key<Enter>();
+ protected static final Context.Key<Enter> 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<TypeSymbol,Env<AttrContext>> typeEnvs =
- new HashMap<TypeSymbol,Env<AttrContext>>();
+ Map<TypeSymbol,Env<AttrContext>> typeEnvs = new HashMap<>();
/** Accessor for typeEnvs
*/
@@ -207,7 +205,7 @@
* @param tree The toplevel tree.
*/
Env<AttrContext> topLevelEnv(JCCompilationUnit tree) {
- Env<AttrContext> localEnv = new Env<AttrContext>(tree, new AttrContext());
+ Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
localEnv.toplevel = tree;
localEnv.enclClass = predefClassDef;
tree.namedImportScope = new ImportScope(tree.packge);
@@ -218,7 +216,7 @@
}
public Env<AttrContext> getTopLevelEnv(JCCompilationUnit tree) {
- Env<AttrContext> localEnv = new Env<AttrContext>(tree, new AttrContext());
+ Env<AttrContext> 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.
*/
<T extends JCTree> List<Type> classEnter(List<T> trees, Env<AttrContext> env) {
- ListBuffer<Type> ts = new ListBuffer<Type>();
+ ListBuffer<Type> ts = new ListBuffer<>();
for (List<T> l = trees; l.nonEmpty(); l = l.tail) {
Type t = classEnter(l.head, env);
if (t != null)
@@ -483,7 +481,7 @@
public void complete(List<JCCompilationUnit> trees, ClassSymbol c) {
annotate.enterStart();
ListBuffer<ClassSymbol> prevUncompleted = uncompleted;
- if (memberEnter.completionEnabled) uncompleted = new ListBuffer<ClassSymbol>();
+ if (memberEnter.completionEnabled) uncompleted = new ListBuffer<>();
try {
// enter all classes, and construct uncompleted list
--- 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<A> dup(JCTree tree, A info) {
- return dupto(new Env<A>(tree, info));
+ return dupto(new Env<>(tree, info));
}
/** Duplicate this environment into a given Environment,
--- 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.</b>
*/
public class Flow {
- protected static final Context.Key<Flow> flowKey =
- new Context.Key<Flow>();
+ protected static final Context.Key<Flow> 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<P>(), JumpKind.CONTINUE);
+ return resolveJump(tree, new ListBuffer<>(), JumpKind.CONTINUE);
}
/** Resolve all breaks of this statement. */
@@ -449,7 +448,7 @@
ListBuffer<PendingExit> pendingExitsPrev = pendingExits;
Lint lintPrev = lint;
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
lint = lint.augment(tree.sym);
try {
@@ -498,7 +497,7 @@
log.error(TreeInfo.diagEndPos(tree.body), "missing.ret.stmt");
List<PendingExit> exits = pendingExits.toList();
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
while (exits.nonEmpty()) {
PendingExit exit = exits.head;
exits = exits.tail;
@@ -527,7 +526,7 @@
public void visitDoLoop(JCDoWhileLoop tree) {
ListBuffer<PendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
scanStat(tree.body);
alive |= resolveContinues(tree);
scan(tree.cond);
@@ -537,7 +536,7 @@
public void visitWhileLoop(JCWhileLoop tree) {
ListBuffer<PendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree.cond);
alive = !tree.cond.type.isFalse();
scanStat(tree.body);
@@ -549,7 +548,7 @@
public void visitForLoop(JCForLoop tree) {
ListBuffer<PendingExit> prevPendingExits = pendingExits;
scanStats(tree.init);
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
if (tree.cond != null) {
scan(tree.cond);
alive = !tree.cond.type.isFalse();
@@ -567,7 +566,7 @@
visitVarDef(tree.var);
ListBuffer<PendingExit> prevPendingExits = pendingExits;
scan(tree.expr);
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
scanStat(tree.body);
alive |= resolveContinues(tree);
resolveBreaks(tree, prevPendingExits);
@@ -576,14 +575,14 @@
public void visitLabelled(JCLabeledStatement tree) {
ListBuffer<PendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
scanStat(tree.body);
alive |= resolveBreaks(tree, prevPendingExits);
}
public void visitSwitch(JCSwitch tree) {
ListBuffer<PendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<PendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree.selector);
boolean hasDefault = false;
for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
@@ -610,7 +609,7 @@
public void visitTry(JCTry tree) {
ListBuffer<PendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<PendingExit>();
+ 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<PendingExit>();
+ pendingExits = new ListBuffer<>();
alive = true;
scan(tree);
} finally {
@@ -846,7 +845,7 @@
ListBuffer<FlowPendingExit> pendingExitsPrev = pendingExits;
Lint lintPrev = lint;
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
if (tree.name != names.empty) {
caught = List.nil();
}
@@ -951,7 +950,7 @@
scan(tree.body);
List<FlowPendingExit> exits = pendingExits.toList();
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
while (exits.nonEmpty()) {
FlowPendingExit exit = exits.head;
exits = exits.tail;
@@ -986,7 +985,7 @@
public void visitDoLoop(JCDoWhileLoop tree) {
ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree.body);
resolveContinues(tree);
scan(tree.cond);
@@ -995,7 +994,7 @@
public void visitWhileLoop(JCWhileLoop tree) {
ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree.cond);
scan(tree.body);
resolveContinues(tree);
@@ -1005,7 +1004,7 @@
public void visitForLoop(JCForLoop tree) {
ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
scan(tree.init);
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
if (tree.cond != null) {
scan(tree.cond);
}
@@ -1019,7 +1018,7 @@
visitVarDef(tree.var);
ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
scan(tree.expr);
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree.body);
resolveContinues(tree);
resolveBreaks(tree, prevPendingExits);
@@ -1027,14 +1026,14 @@
public void visitLabelled(JCLabeledStatement tree) {
ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree.body);
resolveBreaks(tree, prevPendingExits);
}
public void visitSwitch(JCSwitch tree) {
ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<FlowPendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree.selector);
for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
JCCase c = l.head;
@@ -1060,7 +1059,7 @@
}
ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<FlowPendingExit>();
+ 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<FlowPendingExit> exits = pendingExits.toList();
- pendingExits = new ListBuffer<FlowPendingExit>();
+ 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<FlowPendingExit>();
- preciseRethrowTypes = new HashMap<Symbol, List<Type>>();
+ pendingExits = new ListBuffer<>();
+ preciseRethrowTypes = new HashMap<>();
this.thrown = this.caught = null;
this.classDef = null;
scan(tree);
@@ -1651,7 +1650,7 @@
int nextadrPrev = nextadr;
ListBuffer<P> pendingExitsPrev = pendingExits;
- pendingExits = new ListBuffer<P>();
+ 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<P>();
+ 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<P>();
+ 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<P>();
+ pendingExits = new ListBuffer<>();
int prevErrors = getLogNumberOfErrors();
do {
final Bits uninitsEntry = new Bits(uninits);
@@ -1969,7 +1968,7 @@
public void visitLabelled(JCLabeledStatement tree) {
ListBuffer<P> prevPendingExits = pendingExits;
- pendingExits = new ListBuffer<P>();
+ pendingExits = new ListBuffer<>();
scan(tree.body);
resolveBreaks(tree, prevPendingExits);
}
@@ -2219,7 +2218,7 @@
ListBuffer<P> prevPending = pendingExits;
try {
returnadr = nextadr;
- pendingExits = new ListBuffer<P>();
+ pendingExits = new ListBuffer<>();
for (List<JCVariableDecl> 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<PendingExit>();
+ pendingExits = new ListBuffer<>();
scan(tree);
} finally {
pendingExits = null;
--- 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.</b>
*/
public class Infer {
- protected static final Context.Key<Infer> inferKey =
- new Context.Key<Infer>();
+ protected static final Context.Key<Infer> 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<IncorporationBinaryOp, Boolean> incorporationCache =
- new HashMap<IncorporationBinaryOp, Boolean>();
+ Map<IncorporationBinaryOp, Boolean> 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<List<Node>, Integer>(List.of(n), n.data.length());
+ cachedPath = new Pair<>(List.of(n), n.data.length());
} else {
//if non-leaf, proceed recursively
- Pair<List<Node>, Integer> path = new Pair<List<Node>, Integer>(List.of(n), n.data.length());
+ Pair<List<Node>, Integer> path = new Pair<>(List.of(n), n.data.length());
for (Node n2 : n.getAllDependencies()) {
if (n2 == n) continue;
Pair<List<Node>, Integer> subpath = computeTreeToLeafs(n2);
- path = new Pair<List<Node>, 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<Node, Pair<List<Node>, Integer>> treeCache =
- new HashMap<Node, Pair<List<Node>, Integer>>();
+ final Map<Node, Pair<List<Node>, Integer>> treeCache = new HashMap<>();
/** constant value used to mark non-existent paths */
- final Pair<List<Node>, Integer> noPath =
- new Pair<List<Node>, Integer>(null, Integer.MAX_VALUE);
+ final Pair<List<Node>, 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, Set<Node>>(DependencyKind.class);
+ this.deps = new EnumMap<>(DependencyKind.class);
}
@Override
@@ -1502,7 +1497,7 @@
* Retrieves all dependencies with given kind(s).
*/
protected Set<Node> getDependencies(DependencyKind... depKinds) {
- Set<Node> buf = new LinkedHashSet<Node>();
+ Set<Node> buf = new LinkedHashSet<>();
for (DependencyKind dk : depKinds) {
Set<Node> depsByKind = deps.get(dk);
if (depsByKind != null) {
@@ -1518,7 +1513,7 @@
protected void addDependency(DependencyKind dk, Node depToAdd) {
Set<Node> depsByKind = deps.get(dk);
if (depsByKind == null) {
- depsByKind = new LinkedHashSet<Node>();
+ depsByKind = new LinkedHashSet<>();
deps.put(dk, depsByKind);
}
depsByKind.add(depToAdd);
@@ -1554,11 +1549,11 @@
*/
protected Set<Node> closure(DependencyKind... depKinds) {
boolean progress = true;
- Set<Node> closure = new HashSet<Node>();
+ Set<Node> closure = new HashSet<>();
closure.add(this);
while (progress) {
progress = false;
- for (Node n1 : new HashSet<Node>(closure)) {
+ for (Node n1 : new HashSet<>(closure)) {
progress = closure.addAll(n1.getDependencies(depKinds));
}
}
@@ -1595,12 +1590,12 @@
}
}
//update deps
- EnumMap<DependencyKind, Set<Node>> deps2 = new EnumMap<DependencyKind, Set<Node>>(DependencyKind.class);
+ EnumMap<DependencyKind, Set<Node>> deps2 = new EnumMap<>(DependencyKind.class);
for (DependencyKind dk : DependencyKind.values()) {
for (Node d : getDependencies(dk)) {
Set<Node> depsByKind = deps2.get(dk);
if (depsByKind == null) {
- depsByKind = new LinkedHashSet<Node>();
+ depsByKind = new LinkedHashSet<>();
deps2.put(dk, depsByKind);
}
if (data.contains(d.data.first())) {
@@ -1674,7 +1669,7 @@
*/
void initNodes(Map<Type, Set<Type>> stuckDeps) {
//add nodes
- nodes = new ArrayList<Node>();
+ nodes = new ArrayList<>();
for (Type t : inferenceContext.restvars()) {
nodes.add(new Node(t));
}
@@ -1696,7 +1691,7 @@
}
}
//merge cyclic nodes
- ArrayList<Node> acyclicNodes = new ArrayList<Node>();
+ ArrayList<Node> acyclicNodes = new ArrayList<>();
for (List<? extends Node> conSubGraph : GraphUtils.tarjan(nodes)) {
if (conSubGraph.length() > 1) {
Node root = conSubGraph.head;
@@ -1753,8 +1748,7 @@
/** list of inference vars in this context */
List<Type> inferencevars;
- java.util.Map<FreeTypeListener, List<Type>> freeTypeListeners =
- new java.util.HashMap<FreeTypeListener, List<Type>>();
+ Map<FreeTypeListener, List<Type>> freeTypeListeners = new HashMap<>();
List<FreeTypeListener> freetypeListeners = List.nil();
@@ -1946,7 +1940,7 @@
void notifyChange(List<Type> inferredVars) {
InferenceException thrownEx = null;
for (Map.Entry<FreeTypeListener, List<Type>> entry :
- new HashMap<FreeTypeListener, List<Type>>(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<Type, Set<Type>>(), warn);
+ solve(ss, new HashMap<>(), warn);
}
/**
--- 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;
// <editor-fold defaultstate="collapsed" desc="Instantiating">
- protected static final Context.Key<LambdaToMethod> unlambdaKey =
- new Context.Key<LambdaToMethod>();
+ protected static final Context.Key<LambdaToMethod> 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<String, ListBuffer<JCStatement>>();
+ deserializeCases = new HashMap<>();
MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
List.<Type>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<JCTree, TranslationContext<?>>();
+ this.contextMap = new HashMap<>();
return translate(cdef);
}
// </editor-fold>
@@ -261,8 +260,8 @@
{
Symbol owner = localContext.owner;
- ListBuffer<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
- ListBuffer<Attribute.TypeCompound> lambdaTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
+ ListBuffer<Attribute.TypeCompound> ownerTypeAnnos = new ListBuffer<>();
+ ListBuffer<Attribute.TypeCompound> 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<ClassSymbol, Symbol> clinits =
- new HashMap<ClassSymbol, Symbol>();
+ private Map<ClassSymbol, Symbol> clinits = new HashMap<>();
private JCClassDecl analyzeAndPreprocessClass(JCClassDecl tree) {
frameStack = List.nil();
- localClassDefs = new HashMap<Symbol, JCClassDecl>();
+ localClassDefs = new HashMap<>();
return translate(tree);
}
@@ -1180,7 +1178,7 @@
try {
log.useSource(tree.sym.sourcefile);
syntheticMethodNameCounts = new SyntheticMethodNameCounter();
- prevClinits = new HashMap<ClassSymbol, Symbol>();
+ 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<JCVariableDecl> paramBuff = new ListBuffer<JCVariableDecl>();
+ ListBuffer<JCVariableDecl> paramBuff = new ListBuffer<>();
int i = 0;
for (List<Type> 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<Symbol, Symbol>());
- translatedSymbols.put(LOCAL_VAR, new LinkedHashMap<Symbol, Symbol>());
- translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<Symbol, Symbol>());
- translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<Symbol, Symbol>());
- translatedSymbols.put(TYPE_VAR, new LinkedHashMap<Symbol, Symbol>());
+ 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
}
/**
--- 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.</b>
*/
public class Lower extends TreeTranslator {
- protected static final Context.Key<Lower> lowerKey =
- new Context.Key<Lower>();
+ protected static final Context.Key<Lower> 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<ClassSymbol, List<JCTree>> prunedTree = new WeakHashMap<ClassSymbol, List<JCTree>>();
+ public Map<ClassSymbol, List<JCTree>> 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<TypeSymbol,EnumMapping> enumSwitchMap = new LinkedHashMap<TypeSymbol,EnumMapping>();
+ Map<TypeSymbol,EnumMapping> 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<VarSymbol,Integer>();
+ 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<JCStatement> stmts = new ListBuffer<JCStatement>();
+ ListBuffer<JCStatement> 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<JCStatement> stats = new ListBuffer<JCStatement>();
+ ListBuffer<JCStatement> 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<JCExpression> values = new ListBuffer<JCExpression>();
- ListBuffer<JCTree> enumDefs = new ListBuffer<JCTree>();
- ListBuffer<JCTree> otherDefs = new ListBuffer<JCTree>();
+ ListBuffer<JCExpression> values = new ListBuffer<>();
+ ListBuffer<JCTree> enumDefs = new ListBuffer<>();
+ ListBuffer<JCTree> otherDefs = new ListBuffer<>();
for (List<JCTree> defs = tree.defs;
defs.nonEmpty();
defs=defs.tail) {
@@ -2824,7 +2823,7 @@
}
//where
private Map<Symbol, Symbol> makeTranslationMap(JCMethodDecl tree) {
- Map<Symbol, Symbol> translationMap = new HashMap<Symbol,Symbol>();
+ Map<Symbol, Symbol> translationMap = new HashMap<>();
for (JCVariableDecl vd : tree.params) {
Symbol p = vd.sym;
if (p != p.baseSymbol()) {
@@ -3075,7 +3074,7 @@
List<JCExpression> args = _args;
if (parameters.isEmpty()) return args;
boolean anyChanges = false;
- ListBuffer<JCExpression> result = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> 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<JCExpression> elems = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> 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<JCCase> cases = new ListBuffer<JCCase>();
+ ListBuffer<JCCase> 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<JCStatement> stmtList = new ListBuffer<JCStatement>();
+ ListBuffer<JCStatement> stmtList = new ListBuffer<>();
// Map from String case labels to their original position in
// the list of case labels.
- Map<String, Integer> caseLabelToPosition =
- new LinkedHashMap<String, Integer>(alternatives + 1, 1.0f);
+ Map<String, Integer> caseLabelToPosition = new LinkedHashMap<>(alternatives + 1, 1.0f);
// Map of hash codes to the string case labels having that hashCode.
- Map<Integer, Set<String>> hashToString =
- new LinkedHashMap<Integer, Set<String>>(alternatives + 1, 1.0f);
+ Map<Integer, Set<String>> hashToString = new LinkedHashMap<>(alternatives + 1, 1.0f);
int casePosition = 0;
for(JCCase oneCase : caseList) {
@@ -3697,7 +3694,7 @@
Set<String> stringSet = hashToString.get(hashCode);
if (stringSet == null) {
- stringSet = new LinkedHashSet<String>(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<JCTree>();
- classdefs = new HashMap<ClassSymbol,JCClassDecl>();
- actualSymbols = new HashMap<Symbol,Symbol>();
- freevarCache = new HashMap<ClassSymbol,List<VarSymbol>>();
+ 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<Symbol,Integer>();
- accessSyms = new HashMap<Symbol,MethodSymbol[]>();
- accessConstrs = new HashMap<Symbol,MethodSymbol>();
+ accessNums = new HashMap<>();
+ accessSyms = new HashMap<>();
+ accessConstrs = new HashMap<>();
accessConstrTags = List.nil();
- accessed = new ListBuffer<Symbol>();
+ accessed = new ListBuffer<>();
translate(cdef, (JCExpression)null);
for (List<Symbol> l = accessed.toList(); l.nonEmpty(); l = l.tail)
makeAccessible(l.head);
--- 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.</b>
*/
public class MemberEnter extends JCTree.Visitor implements Completer {
- protected static final Context.Key<MemberEnter> memberEnterKey =
- new Context.Key<MemberEnter>();
+ protected static final Context.Key<MemberEnter> 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<Env<AttrContext>> halfcompleted = new ListBuffer<Env<AttrContext>>();
+ ListBuffer<Env<AttrContext>> 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<Symbol> processed = new HashSet<Symbol>();
+ Set<Symbol> 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<Symbol> processed = new HashSet<Symbol>();
+ Set<Symbol> processed = new HashSet<>();
public String toString() {
return "import static " + tsym + ".*" + " in " + sourcefile;
@@ -271,7 +270,7 @@
// enter imported types immediately
new Object() {
- Set<Symbol> processed = new HashSet<Symbol>();
+ Set<Symbol> 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<Symbol> processed = new HashSet<Symbol>();
+ Set<Symbol> processed = new HashSet<>();
boolean found = false;
public String toString() {
@@ -378,7 +377,7 @@
attr.attribTypeVariables(typarams, env);
// Enter and attribute value parameters.
- ListBuffer<Type> argbuf = new ListBuffer<Type>();
+ ListBuffer<Type> argbuf = new ListBuffer<>();
for (List<JCVariableDecl> 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<Type> thrownbuf = new ListBuffer<Type>();
+ ListBuffer<Type> thrownbuf = new ListBuffer<>();
for (List<JCExpression> 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<VarSymbol> params = new ListBuffer<VarSymbol>();
+ ListBuffer<VarSymbol> params = new ListBuffer<>();
JCVariableDecl lastParam = null;
for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
JCVariableDecl param = lastParam = l.head;
@@ -915,10 +914,8 @@
private void actualEnterAnnotations(List<JCAnnotation> annotations,
Env<AttrContext> env,
Symbol s) {
- Map<TypeSymbol, ListBuffer<Attribute.Compound>> annotated =
- new LinkedHashMap<TypeSymbol, ListBuffer<Attribute.Compound>>();
- Map<Attribute.Compound, DiagnosticPosition> pos =
- new HashMap<Attribute.Compound, DiagnosticPosition>();
+ Map<TypeSymbol, ListBuffer<Attribute.Compound>> annotated = new LinkedHashMap<>();
+ Map<Attribute.Compound, DiagnosticPosition> pos = new HashMap<>();
for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
JCAnnotation a = al.head;
@@ -952,7 +949,7 @@
}
s.setDeclarationAttributesWithCompletion(
- annotate.new AnnotateRepeatedContext<Attribute.Compound>(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<Type> interfaces = new ListBuffer<Type>();
+ ListBuffer<Type> interfaces = new ListBuffer<>();
ListBuffer<Type> all_interfaces = null; // lazy init
- Set<Type> interfaceSet = new HashSet<Type>();
+ Set<Type> interfaceSet = new HashSet<>();
List<JCExpression> 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<JCAnnotation> annotations,
final Env<AttrContext> env,
final Symbol s) {
- Map<TypeSymbol, ListBuffer<Attribute.TypeCompound>> annotated =
- new LinkedHashMap<TypeSymbol, ListBuffer<Attribute.TypeCompound>>();
- Map<Attribute.TypeCompound, DiagnosticPosition> pos =
- new HashMap<Attribute.TypeCompound, DiagnosticPosition>();
+ Map<TypeSymbol, ListBuffer<Attribute.TypeCompound>> annotated = new LinkedHashMap<>();
+ Map<Attribute.TypeCompound, DiagnosticPosition> pos = new HashMap<>();
for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
JCAnnotation a = al.head;
@@ -1245,7 +1240,7 @@
if (s != null) {
s.appendTypeAttributesWithCompletion(
- annotate.new AnnotateRepeatedContext<Attribute.TypeCompound>(env, annotated, pos, log, true));
+ annotate.new AnnotateRepeatedContext<>(env, annotated, pos, log, true));
}
}
@@ -1448,7 +1443,7 @@
}
List<Type> visit(List<? extends JCTree> trees) {
- ListBuffer<Type> lb = new ListBuffer<Type>();
+ ListBuffer<Type> lb = new ListBuffer<>();
for (JCTree t: trees)
lb.append(visit(t));
return lb.toList();
--- 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.</b>
*/
public class Resolve {
- protected static final Context.Key<Resolve> resolveKey =
- new Context.Key<Resolve>();
+ protected static final Context.Key<Resolve> resolveKey = new Context.Key<>();
Names names;
Log log;
@@ -918,7 +917,7 @@
public MethodCheck mostSpecificCheck(List<Type> 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<Symbol, JCDiagnostic>(bestSoFar.sym, bestSoFar.details);
+ return new Pair<>(bestSoFar.sym, bestSoFar.details);
}
}
@@ -3827,7 +3826,7 @@
} else if (filteredCandidates.size() == 1) {
Map.Entry<Symbol, JCDiagnostic> _e =
filteredCandidates.entrySet().iterator().next();
- final Pair<Symbol, JCDiagnostic> p = new Pair<Symbol, JCDiagnostic>(_e.getKey(), _e.getValue());
+ final Pair<Symbol, JCDiagnostic> p = new Pair<>(_e.getKey(), _e.getValue());
JCDiagnostic d = new InapplicableSymbolError(resolveContext) {
@Override
protected Pair<Symbol, JCDiagnostic> errCandidate() {
@@ -3846,7 +3845,7 @@
}
//where
private Map<Symbol, JCDiagnostic> mapCandidates() {
- Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>();
+ Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<>();
for (Candidate c : resolveContext.candidates) {
if (c.isApplicable()) continue;
candidates.put(c.sym, c.details);
@@ -3855,7 +3854,7 @@
}
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) {
- Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>();
+ Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<>();
for (Map.Entry<Symbol, JCDiagnostic> _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<Template, DiagnosticRewriter> rewriters =
- new LinkedHashMap<Template, DiagnosticRewriter>();
+ static final Map<Template, DiagnosticRewriter> rewriters = new LinkedHashMap<>();
static {
String argMismatchRegex = MethodCheckDiag.ARG_MISMATCH.regex();
--- 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<Env<AttrContext>> {
/** The context key for the todo list. */
- protected static final Context.Key<Todo> todoKey =
- new Context.Key<Todo>();
+ protected static final Context.Key<Todo> todoKey = new Context.Key<>();
/** Get the Todo instance for this context. */
public static Todo instance(Context context) {
@@ -98,7 +97,7 @@
public Queue<Queue<Env<AttrContext>>> groupByFile() {
if (contentsByFile == null) {
- contentsByFile = new LinkedList<Queue<Env<AttrContext>>>();
+ contentsByFile = new LinkedList<>();
for (Env<AttrContext> env: contents) {
addByFile(env);
}
@@ -109,7 +108,7 @@
private void addByFile(Env<AttrContext> env) {
JavaFileObject file = env.toplevel.sourcefile;
if (fileMap == null)
- fileMap = new HashMap<JavaFileObject, FileQueue>();
+ fileMap = new HashMap<>();
FileQueue fq = fileMap.get(file);
if (fq == null) {
fq = new FileQueue();
@@ -132,7 +131,7 @@
}
}
- LinkedList<Env<AttrContext>> contents = new LinkedList<Env<AttrContext>>();
+ LinkedList<Env<AttrContext>> contents = new LinkedList<>();
LinkedList<Queue<Env<AttrContext>>> contentsByFile;
Map<JavaFileObject, FileQueue> fileMap;
@@ -167,6 +166,6 @@
return (fileContents.size() == 0 ? null : fileContents.get(0));
}
- LinkedList<Env<AttrContext>> fileContents = new LinkedList<Env<AttrContext>>();
+ LinkedList<Env<AttrContext>> fileContents = new LinkedList<>();
}
}
--- 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<TransTypes> transTypesKey =
- new Context.Key<TransTypes>();
+ protected static final Context.Key<TransTypes> 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<MethodSymbol,MethodSymbol>();
+ 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<JCTree> bridges = new ListBuffer<JCTree>();
+ ListBuffer<JCTree> bridges = new ListBuffer<>();
if (false) //see CR: 6996415
bridges.appendList(addOverrideBridgesIfNeeded(tree, c));
if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) {
--- 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<File,SoftReference<Entry>> ?
- private Map<File,Entry> cache = new ConcurrentHashMap<File,Entry>();
+ private Map<File,Entry> cache = new ConcurrentHashMap<>();
private static class Entry {
File canonicalFile;
--- 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<File> list = new ArrayList<File>();
+ List<File> list = new ArrayList<>();
for (StringTokenizer st = new StringTokenizer(path);
st.hasMoreTokens(); ) {
--- 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<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
- ListBuffer<File> files = new ListBuffer<File>();
+ ListBuffer<File> 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<File, Archive> archives = new HashMap<File,Archive>();
+ Map<File, Archive> archives = new HashMap<>();
private static final String[] symbolFileLocation = { "lib", "ct.sym" };
private static final RelativeDirectory symbolFilePrefix
@@ -592,7 +593,7 @@
Iterable<? extends File> path = getLocation(location);
if (path == null)
return null;
- ListBuffer<URL> lb = new ListBuffer<URL>();
+ ListBuffer<URL> 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<JavaFileObject> results = new ListBuffer<JavaFileObject>();
+ ListBuffer<JavaFileObject> results = new ListBuffer<>();
for (File directory : path)
listContainer(directory, subdirectory, kinds, recurse, results);
@@ -778,9 +779,9 @@
{
ArrayList<RegularFileObject> result;
if (files instanceof Collection<?>)
- result = new ArrayList<RegularFileObject>(((Collection<?>)files).size());
+ result = new ArrayList<>(((Collection<?>)files).size());
else
- result = new ArrayList<RegularFileObject>();
+ result = new ArrayList<>();
for (File f: files)
result.add(new RegularFileObject(this, nullCheck(f)));
return result;
--- 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<File> getPathEntries(String path, File emptyPathDefault) {
- ListBuffer<File> entries = new ListBuffer<File>();
+ ListBuffer<File> 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<File> canonicalValues = new HashSet<File>();
+ private Set<File> canonicalValues = new HashSet<>();
public Path expandJarClassPaths(boolean x) {
expandJarClassPaths = x;
@@ -510,7 +510,7 @@
*/
private class BootClassPathLocationHandler extends LocationHandler {
private Collection<File> searchPath;
- final Map<Option, String> optionValues = new EnumMap<Option,String>(Option.class);
+ final Map<Option, String> optionValues = new EnumMap<>(Option.class);
/**
* rt.jar as found on the default bootclasspath.
@@ -648,8 +648,8 @@
Map<Option, LocationHandler> handlersForOption;
void initHandlers() {
- handlersForLocation = new HashMap<Location, LocationHandler>();
- handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);
+ handlersForLocation = new HashMap<>();
+ handlersForOption = new EnumMap<>(Option.class);
LocationHandler[] handlers = {
new BootClassPathLocationHandler(),
--- 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<File>(absFile);
+ absFileRef = new SoftReference<>(absFile);
}
return absFile;
}
--- 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<RelativeDirectory,List<String>>();
+ 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<File>(absFile);
+ absFileRef = new SoftReference<>(absFile);
}
return absFile;
}
--- 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<String, SoftReference<RelativeDirectory>> relativeDirectoryCache =
- new HashMap<String, SoftReference<RelativeDirectory>>();
+ private Map<String, SoftReference<RelativeDirectory>> relativeDirectoryCache = new HashMap<>();
public synchronized boolean isOpen() {
@@ -284,7 +283,7 @@
try {
checkIndex();
if (allDirs == Collections.EMPTY_SET) {
- allDirs = new java.util.LinkedHashSet<RelativeDirectory>(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>(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<RelativeDirectory, DirectoryEntry>();
- ArrayList<Entry> entryList = new ArrayList<Entry>();
+ directories = new LinkedHashMap<>();
+ ArrayList<Entry> 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<String> zipFileEntriesDirectories = com.sun.tools.javac.util.List.<String>nil();
private com.sun.tools.javac.util.List<Entry> zipFileEntries = com.sun.tools.javac.util.List.<Entry>nil();
- private List<Entry> entries = new ArrayList<Entry>();
+ private List<Entry> entries = new ArrayList<>();
private ZipFileIndex zipFileIndex;
@@ -864,7 +863,7 @@
if (zipFile.lastModified() != fileStamp) {
ret = false;
} else {
- directories = new LinkedHashMap<RelativeDirectory, DirectoryEntry>();
+ 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<DirectoryEntry> directoriesToWrite = new ArrayList<DirectoryEntry>();
- Map<RelativeDirectory, Long> offsets = new HashMap<RelativeDirectory, Long>();
+ List<DirectoryEntry> directoriesToWrite = new ArrayList<>();
+ Map<RelativeDirectory, Long> 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<File>(absFile);
+ absFileRef = new SoftReference<>(absFile);
}
return absFile;
}
@@ -1052,7 +1051,7 @@
return rd;
}
rd = new RelativeDirectory(path);
- relativeDirectoryCache.put(path, new SoftReference<RelativeDirectory>(rd));
+ relativeDirectoryCache.put(path, new SoftReference<>(rd));
return rd;
}
--- 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<File, ZipFileIndex> map =
- new HashMap<File, ZipFileIndex>();
+ private final Map<File, ZipFileIndex> 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<ZipFileIndex> getZipFileIndexes(boolean openedOnly) {
- List<ZipFileIndex> zipFileIndexes = new ArrayList<ZipFileIndex>();
+ List<ZipFileIndex> zipFileIndexes = new ArrayList<>();
zipFileIndexes.addAll(map.values());
--- 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<CRTEntry> entries = new ListBuffer<CRTEntry>();
+ private ListBuffer<CRTEntry> entries = new ListBuffer<>();
/** The hashtable for source positions.
*/
- private Map<Object,SourceRange> positions = new HashMap<Object,SourceRange>();
+ private Map<Object,SourceRange> positions = new HashMap<>();
/** The object for ending positions stored in the parser.
*/
--- 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<ClassReader> classReaderKey =
- new Context.Key<ClassReader>();
+ protected static final Context.Key<ClassReader> 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<Name> warnedAttrs = new HashSet<Name>();
+ Set<Name> 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<Name, PackageSymbol>();
- classes = new HashMap<Name, ClassSymbol>();
+ 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<AttributeKind> kinds) {
this.name = name;
@@ -978,7 +978,7 @@
protected Set<AttributeKind> CLASS_OR_MEMBER_ATTRIBUTE =
EnumSet.of(AttributeKind.CLASS, AttributeKind.MEMBER);
- protected Map<Name, AttributeReader> attributeReaders = new HashMap<Name, AttributeReader>();
+ protected Map<Name, AttributeReader> 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<Type> is = new ListBuffer<Type>();
+ ListBuffer<Type> 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<Type> typeVars = new ListBuffer<Type>();
+ ListBuffer<Type> 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<CompoundAnnotationProxy> proxies =
- new ListBuffer<CompoundAnnotationProxy>();
+ ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
for (int i = 0; i<numAttributes; i++) {
CompoundAnnotationProxy proxy = readCompoundAnnotation();
if (proxy.type.tsym == syms.proprietaryType.tsym)
@@ -1489,12 +1488,11 @@
CompoundAnnotationProxy readCompoundAnnotation() {
Type t = readTypeOrClassSymbol(nextChar());
int numFields = nextChar();
- ListBuffer<Pair<Name,Attribute>> pairs =
- new ListBuffer<Pair<Name,Attribute>>();
+ ListBuffer<Pair<Name,Attribute>> pairs = new ListBuffer<>();
for (int i=0; i<numFields; i++) {
Name name = readName(nextChar());
Attribute value = readAttributeValue();
- pairs.append(new Pair<Name,Attribute>(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<Attribute> l = new ListBuffer<Attribute>();
+ ListBuffer<Attribute> l = new ListBuffer<>();
for (int i=0; i<n; i++)
l.append(readAttributeValue());
return new ArrayAttributeProxy(l.toList());
@@ -1726,8 +1724,7 @@
List<Attribute.Compound> deproxyCompoundList(List<CompoundAnnotationProxy> pl) {
// also must fill in types!!!!
- ListBuffer<Attribute.Compound> buf =
- new ListBuffer<Attribute.Compound>();
+ ListBuffer<Attribute.Compound> buf = new ListBuffer<>();
for (List<CompoundAnnotationProxy> l = pl; l.nonEmpty(); l=l.tail) {
buf.append(deproxyCompound(l.head));
}
@@ -1735,14 +1732,12 @@
}
Attribute.Compound deproxyCompound(CompoundAnnotationProxy a) {
- ListBuffer<Pair<Symbol.MethodSymbol,Attribute>> buf =
- new ListBuffer<Pair<Symbol.MethodSymbol,Attribute>>();
+ ListBuffer<Pair<Symbol.MethodSymbol,Attribute>> buf = new ListBuffer<>();
for (List<Pair<Name,Attribute>> l = a.values;
l.nonEmpty();
l = l.tail) {
MethodSymbol meth = findAccessMethod(a.type, l.head.fst);
- buf.append(new Pair<Symbol.MethodSymbol,Attribute>
- (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());
}
--- 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.</b>
*/
public class ClassWriter extends ClassFile {
- protected static final Context.Key<ClassWriter> classWriterKey =
- new Context.Key<ClassWriter>();
+ protected static final Context.Key<ClassWriter> 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<Attribute.Compound> buf = new ListBuffer<Attribute.Compound>();
+ ListBuffer<Attribute.Compound> 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<Attribute.Compound> buf = new ListBuffer<Attribute.Compound>();
+ ListBuffer<Attribute.Compound> 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<Attribute.Compound> attrs) {
if (attrs.isEmpty()) return 0;
- ListBuffer<Attribute.Compound> visibles = new ListBuffer<Attribute.Compound>();
- ListBuffer<Attribute.Compound> invisibles = new ListBuffer<Attribute.Compound>();
+ ListBuffer<Attribute.Compound> visibles = new ListBuffer<>();
+ ListBuffer<Attribute.Compound> 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<ClassSymbol>();
- innerClassesQueue = new ListBuffer<ClassSymbol>();
+ 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<DynamicMethod, MethodHandle>();
+ bootstrapMethods = new LinkedHashMap<>();
Type supertype = types.supertype(c.type);
List<Type> interfaces = types.interfaces(c.type);
--- 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<char[]> catchInfo = new ListBuffer<char[]>();
+ ListBuffer<char[]> 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;
--- 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.</b>
*/
public class Gen extends JCTree.Visitor {
- protected static final Context.Key<Gen> genKey =
- new Context.Key<Gen>();
+ protected static final Context.Key<Gen> 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<Type,Symbol>();
+ stringBufferAppend = new HashMap<>();
accessDollar = names.
fromString("access" + target.syntheticNameChar());
lower = Lower.instance(context);
@@ -475,11 +474,11 @@
* @param c The enclosing class.
*/
List<JCTree> normalizeDefs(List<JCTree> defs, ClassSymbol c) {
- ListBuffer<JCStatement> initCode = new ListBuffer<JCStatement>();
- ListBuffer<Attribute.TypeCompound> initTAs = new ListBuffer<Attribute.TypeCompound>();
- ListBuffer<JCStatement> clinitCode = new ListBuffer<JCStatement>();
- ListBuffer<Attribute.TypeCompound> clinitTAs = new ListBuffer<Attribute.TypeCompound>();
- ListBuffer<JCTree> methodDefs = new ListBuffer<JCTree>();
+ ListBuffer<JCStatement> initCode = new ListBuffer<>();
+ ListBuffer<Attribute.TypeCompound> initTAs = new ListBuffer<>();
+ ListBuffer<JCStatement> clinitCode = new ListBuffer<>();
+ ListBuffer<Attribute.TypeCompound> clinitTAs = new ListBuffer<>();
+ ListBuffer<JCTree> methodDefs = new ListBuffer<>();
// Sort definitions into three listbuffers:
// - initCode for instance initializers
// - clinitCode for class initializers
@@ -562,8 +561,8 @@
private List<Attribute.TypeCompound> getAndRemoveNonFieldTAs(VarSymbol sym) {
List<TypeCompound> tas = sym.getRawTypeAttributes();
- ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>();
- ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>();
+ ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<>();
+ ListBuffer<Attribute.TypeCompound> 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<JCStatement> stats = md.body.stats;
- ListBuffer<JCStatement> newstats = new ListBuffer<JCStatement>();
+ ListBuffer<JCStatement> newstats = new ListBuffer<>();
if (stats.nonEmpty()) {
// Copy initializers of synthetic variables generated in
@@ -1485,7 +1484,7 @@
}
}
};
- syncEnv.info.gaps = new ListBuffer<Integer>();
+ syncEnv.info.gaps = new ListBuffer<>();
genTry(tree.body, List.<JCCatch>nil(), syncEnv);
code.endScopes(limit);
}
@@ -1529,7 +1528,7 @@
return tree.finalizer != null;
}
};
- tryEnv.info.gaps = new ListBuffer<Integer>();
+ 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<GenContext> localEnv =
- new Env<GenContext>(cdef, new GenContext());
+ Env<GenContext> localEnv = new Env<>(cdef, new GenContext());
localEnv.toplevel = env.toplevel;
localEnv.enclClass = cdef;
--- 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.</b>
*/
public class JNIWriter {
- protected static final Context.Key<JNIWriter> jniWriterKey =
- new Context.Key<JNIWriter>();
+ protected static final Context.Key<JNIWriter> jniWriterKey = new Context.Key<>();
/** Access to files. */
private final JavaFileManager fileManager;
@@ -240,9 +239,9 @@
* Including super class fields.
*/
List<VariableElement> getAllFields(TypeElement subclazz) {
- List<VariableElement> fields = new ArrayList<VariableElement>();
+ List<VariableElement> fields = new ArrayList<>();
TypeElement cd = null;
- Stack<TypeElement> s = new Stack<TypeElement>();
+ Stack<TypeElement> s = new Stack<>();
cd = subclazz;
while (true) {
@@ -355,7 +354,7 @@
Mangle.Type.METHOD_JNI_SHORT));
print(out, " (JNIEnv *, ");
List<? extends VariableElement> paramargs = md.getParameters();
- List<TypeMirror> args = new ArrayList<TypeMirror>();
+ List<TypeMirror> 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<String> params = new ArrayList<String>(); //List of parameters.
+ List<String> 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.
--- 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<Object,Integer>(pool.length);
+ this.indices = new HashMap<>(pool.length);
for (int i = 1; i < pp; i++) {
if (pool[i] != null) indices.put(pool[i], i);
}
--- 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<Profile> profileKey =
- new Context.Key<Profile>();
+ private static final Context.Key<Profile> profileKey = new Context.Key<>();
public static Profile instance(Context context) {
Profile instance = context.get(profileKey);
--- 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<Target> targetKey =
- new Context.Key<Target>();
+ private static final Context.Key<Target> targetKey = new Context.Key<>();
public static Target instance(Context context) {
Target instance = context.get(targetKey);
--- 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<String> newArgs = new ListBuffer<String>();
+ ListBuffer<String> newArgs = new ListBuffer<>();
for (String arg : args) {
if (arg.length() > 1 && arg.charAt(0) == '@') {
arg = arg.substring(1);
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Dec 18 19:22:58 2013 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Dec 18 16:05:18 2013 -0500
@@ -81,8 +81,7 @@
*/
public class JavaCompiler {
/** The context key for the compiler. */
- protected static final Context.Key<JavaCompiler> compilerKey =
- new Context.Key<JavaCompiler>();
+ protected static final Context.Key<JavaCompiler> compilerKey = new Context.Key<>();
/** Get the JavaCompiler instance for this context. */
public static JavaCompiler instance(Context context) {
@@ -556,7 +555,7 @@
* we don't accidentally overwrite an input file when -s is set.
* initialized by `compile'.
*/
- protected Set<JavaFileObject> inputFiles = new HashSet<JavaFileObject>();
+ protected Set<JavaFileObject> inputFiles = new HashSet<>();
protected boolean shouldStop(CompileState cs) {
CompileState shouldStopPolicy = (errorCount() > 0 || unrecoverableError())
@@ -579,7 +578,7 @@
}
protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) {
- return shouldStop(cs) ? new ListBuffer<T>() : queue;
+ return shouldStop(cs) ? new ListBuffer<>() : queue;
}
protected final <T> List<T> stopIfError(CompileState cs, List<T> list) {
@@ -943,7 +942,7 @@
//parse all files
ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
- Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
+ Set<JavaFileObject> filesSoFar = new HashSet<>();
for (JavaFileObject fileObject : fileObjects) {
if (!filesSoFar.contains(fileObject)) {
filesSoFar.add(fileObject);
@@ -1352,8 +1351,7 @@
return stopIfError(CompileState.FLOW, results);
}
- HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>> desugaredEnvs =
- new HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>>();
+ HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>> desugaredEnvs = new HashMap<>();
/**
* Prepare attributed parse trees, in conjunction with their attribution contexts,
@@ -1383,7 +1381,7 @@
* already been added to C and its superclasses.
*/
class ScanNested extends TreeScanner {
- Set<Env<AttrContext>> dependencies = new LinkedHashSet<Env<AttrContext>>();
+ Set<Env<AttrContext>> dependencies = new LinkedHashSet<>();
protected boolean hasLambdas;
@Override
public void visitClassDef(JCClassDecl node) {
@@ -1456,7 +1454,7 @@
List<JCTree> pdef = lower.translateTopLevelClass(env, env.tree, localMake);
if (pdef.head != null) {
Assert.check(pdef.tail.isEmpty());
- results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, (JCClassDecl)pdef.head));
+ results.add(new Pair<>(env, (JCClassDecl)pdef.head));
}
}
return;
@@ -1470,7 +1468,7 @@
rootClasses.contains((JCClassDecl)untranslated) &&
((cdef.mods.flags & (Flags.PROTECTED|Flags.PUBLIC)) != 0 ||
cdef.sym.packge().getQualifiedName() == names.java_lang)) {
- results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, removeMethodBodies(cdef)));
+ results.add(new Pair<>(env, removeMethodBodies(cdef)));
}
return;
}
@@ -1498,7 +1496,7 @@
JCClassDecl cdef = (JCClassDecl)env.tree;
if (untranslated instanceof JCClassDecl &&
rootClasses.contains((JCClassDecl)untranslated)) {
- results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, cdef));
+ results.add(new Pair<>(env, cdef));
}
return;
}
@@ -1513,7 +1511,7 @@
//generate code for each class
for (List<JCTree> l = cdefs; l.nonEmpty(); l = l.tail) {
JCClassDecl cdef = (JCClassDecl)l.head;
- results.add(new Pair<Env<AttrContext>, JCClassDecl>(env, cdef));
+ results.add(new Pair<>(env, cdef));
}
}
finally {
@@ -1586,11 +1584,11 @@
// where
Map<JCCompilationUnit, Queue<Env<AttrContext>>> groupByFile(Queue<Env<AttrContext>> envs) {
// use a LinkedHashMap to preserve the order of the original list as much as possible
- Map<JCCompilationUnit, Queue<Env<AttrContext>>> map = new LinkedHashMap<JCCompilationUnit, Queue<Env<AttrContext>>>();
+ Map<JCCompilationUnit, Queue<Env<AttrContext>>> map = new LinkedHashMap<>();
for (Env<AttrContext> env: envs) {
Queue<Env<AttrContext>> sublist = map.get(env.toplevel);
if (sublist == null) {
- sublist = new ListBuffer<Env<AttrContext>>();
+ sublist = new ListBuffer<>();
map.put(env.toplevel, sublist);
}
sublist.add(env);
--- 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<File>();
- classnames = new ListBuffer<String>();
+ 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<Plugin> sl = ServiceLoader.load(Plugin.class, cl);
- Set<List<String>> pluginsToCall = new LinkedHashSet<List<String>>();
+ Set<List<String>> 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<String> doclintOpts = new LinkedHashSet<String>();
+ Set<String> doclintOpts = new LinkedHashSet<>();
if (xdoclint != null)
doclintOpts.add(DocLint.XMSGS_OPTION);
if (xdoclintCustom != null) {
--- 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<String,Boolean> createChoices(String... choices) {
- Map<String,Boolean> map = new LinkedHashMap<String,Boolean>();
+ Map<String,Boolean> map = new LinkedHashMap<>();
for (String c: choices)
map.put(c, false);
return map;
@@ -719,7 +719,7 @@
}
private static Map<String,Boolean> getXLintChoices() {
- Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>();
+ Map<String,Boolean> choices = new LinkedHashMap<>();
choices.put("all", false);
for (Lint.LintCategory c : Lint.LintCategory.values())
choices.put(c.option, c.hidden);
--- 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<String, Object> getAllReflectedValues() {
- Map<String, Object> res = new LinkedHashMap<String, Object>();
+ Map<String, Object> res = new LinkedHashMap<>();
for (Map.Entry<MethodSymbol, Attribute> entry :
getAllValues().entrySet()) {
@@ -115,8 +115,7 @@
* Includes all elements, whether explicit or defaulted.
*/
private Map<MethodSymbol, Attribute> getAllValues() {
- Map<MethodSymbol, Attribute> res =
- new LinkedHashMap<MethodSymbol, Attribute>();
+ Map<MethodSymbol, Attribute> 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<TypeMirror> elems = new ListBuffer<TypeMirror>();
+ ListBuffer<TypeMirror> elems = new ListBuffer<>();
for (Attribute value : a.values) {
Type elem = ((Attribute.Class) value).classType;
elems.append(elem);
--- 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<JCTree,JCCompilationUnit>(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<JCTree, JCCompilationUnit>(annoTree, elemTreeTop.snd);
+ return new Pair<>(annoTree, elemTreeTop.snd);
}
/**
--- 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<Type> targs = new ListBuffer<Type>();
+ ListBuffer<Type> 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<MethodSymbol> results = new LinkedHashSet<MethodSymbol>();
+ Set<MethodSymbol> results = new LinkedHashSet<>();
for (Type t : types.closure(origin.type)) {
if (t != origin.type) {
ClassSymbol c = (ClassSymbol) t.tsym;
--- 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<Location, PathsForLocation>();
- fileSystems = new HashMap<Path,FileSystem>();
+ pathsForLocation = new HashMap<>();
+ fileSystems = new HashMap<>();
setContext(context);
}
@@ -155,7 +155,7 @@
Iterable<? extends Path> path = getLocation(location);
if (path == null)
return null;
- ListBuffer<URL> lb = new ListBuffer<URL>();
+ ListBuffer<URL> lb = new ListBuffer<>();
for (Path p: path) {
try {
lb.append(p.toUri().toURL());
@@ -308,7 +308,7 @@
Iterable<? extends Path> paths = getLocation(location);
if (paths == null)
return List.nil();
- ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
+ ListBuffer<JavaFileObject> results = new ListBuffer<>();
for (Path path : paths)
list(path, packageName, kinds, recurse, results);
@@ -394,9 +394,9 @@
Iterable<? extends Path> paths) {
ArrayList<PathFileObject> result;
if (paths instanceof Collection<?>)
- result = new ArrayList<PathFileObject>(((Collection<?>)paths).size());
+ result = new ArrayList<>(((Collection<?>)paths).size());
else
- result = new ArrayList<PathFileObject>();
+ result = new ArrayList<>();
for (Path p: paths)
result.add(PathFileObject.createSimplePathFileObject(this, nullCheck(p)));
return result;
--- 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<DCTree> tags = blockTags();
// split body into first sentence and body
- ListBuffer<DCTree> fs = new ListBuffer<DCTree>();
+ ListBuffer<DCTree> fs = new ListBuffer<>();
loop:
for (; body.nonEmpty(); body = body.tail) {
DCTree t = body.head;
@@ -194,7 +194,7 @@
*/
@SuppressWarnings("fallthrough")
protected List<DCTree> blockContent() {
- ListBuffer<DCTree> trees = new ListBuffer<DCTree>();
+ ListBuffer<DCTree> trees = new ListBuffer<>();
textStart = -1;
loop:
@@ -265,7 +265,7 @@
* Non-standard tags are represented by {@link UnknownBlockTag}.
*/
protected List<DCTree> blockTags() {
- ListBuffer<DCTree> tags = new ListBuffer<DCTree>();
+ ListBuffer<DCTree> 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<JCTree> paramTypes = new ListBuffer<JCTree>();
+ ListBuffer<JCTree> paramTypes = new ListBuffer<>();
paramTypes.add(p.parseType());
if (p.token().kind == TokenKind.IDENTIFIER)
@@ -614,7 +614,7 @@
*/
@SuppressWarnings("fallthrough")
protected List<DCTree> inlineContent() {
- ListBuffer<DCTree> trees = new ListBuffer<DCTree>();
+ ListBuffer<DCTree> trees = new ListBuffer<>();
skipWhitespace();
int pos = bp;
@@ -792,7 +792,7 @@
* "value" may be unquoted, single-quoted, or double-quoted.
*/
protected List<DCTree> htmlAttrs() {
- ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
+ ListBuffer<DCTree> attrs = new ListBuffer<>();
skipWhitespace();
loop:
@@ -803,7 +803,7 @@
List<DCTree> value = null;
ValueKind vkind = ValueKind.EMPTY;
if (ch == '=') {
- ListBuffer<DCTree> v = new ListBuffer<DCTree>();
+ ListBuffer<DCTree> v = new ListBuffer<>();
nextChar();
skipWhitespace();
if (ch == '\'' || ch == '"') {
@@ -990,7 +990,7 @@
}
- Set<String> htmlBlockTags = new HashSet<String>(Arrays.asList(
+ Set<String> 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<Name,TagParser>();
+ tagParsers = new HashMap<>();
for (TagParser p: parsers)
tagParsers.put(names.fromString(p.getTreeKind().tagName), p);
--- 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<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
+ return new BasicComment<>(new UnicodeReader(fac, buf, buf.length), style);
}
/**
--- 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<JCExpression[]> odStackSupply = new ArrayList<JCExpression[]>();
- ArrayList<Token[]> opStackSupply = new ArrayList<Token[]>();
+ ArrayList<JCExpression[]> odStackSupply = new ArrayList<>();
+ ArrayList<Token[]> opStackSupply = new ArrayList<>();
private JCExpression[] newOdStack() {
if (odStackSupply.isEmpty())
@@ -1314,7 +1314,7 @@
//is a generic type i.e. A<S>::m
int pos1 = token.pos;
accept(LT);
- ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> 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.<JCTree>of(t), "array.dimension.missing");
}
} else {
- ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> dims = new ListBuffer<>();
// maintain array dimension type annotations
ListBuffer<List<JCAnnotation>> dimAnnotations = new ListBuffer<>();
@@ -2226,7 +2226,7 @@
*/
JCExpression arrayInitializer(int newpos, JCExpression t) {
accept(LBRACE);
- ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> elems = new ListBuffer<>();
if (token.kind == COMMA) {
nextToken();
} else if (token.kind != RBRACE) {
@@ -2288,7 +2288,7 @@
@SuppressWarnings("fallthrough")
List<JCStatement> blockStatements() {
//todo: skip to anchor on error(?)
- ListBuffer<JCStatement> stats = new ListBuffer<JCStatement>();
+ ListBuffer<JCStatement> stats = new ListBuffer<>();
while (true) {
List<JCStatement> stat = blockStatement();
if (stat.isEmpty()) {
@@ -2356,7 +2356,7 @@
} else {
JCExpression t = parseType();
ListBuffer<JCStatement> stats =
- variableDeclarators(mods, t, new ListBuffer<JCStatement>());
+ 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<JCStatement> stats =
- variableDeclarators(mods, t, new ListBuffer<JCStatement>());
+ 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<JCCatch> catchers = new ListBuffer<JCCatch>();
+ ListBuffer<JCCatch> 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<JCCase> switchBlockStatementGroups() {
- ListBuffer<JCCase> cases = new ListBuffer<JCCase>();
+ ListBuffer<JCCase> cases = new ListBuffer<>();
while (true) {
int pos = token.pos;
switch (token.kind) {
@@ -2730,7 +2730,7 @@
List<JCExpressionStatement> forUpdate() {
return moreStatementExpressions(token.pos,
parseExpression(),
- new ListBuffer<JCExpressionStatement>()).toList();
+ new ListBuffer<>()).toList();
}
/** AnnotationsOpt = { '@' Annotation }
@@ -2739,7 +2739,7 @@
*/
List<JCAnnotation> annotationsOpt(Tag kind) {
if (token.kind != MONKEYS_AT) return List.nil(); // optimization
- ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>();
+ ListBuffer<JCAnnotation> 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<JCAnnotation> annotations = new ListBuffer<JCAnnotation>();
+ ListBuffer<JCAnnotation> annotations = new ListBuffer<>();
int pos;
if (partial == null) {
flags = 0;
@@ -2868,7 +2868,7 @@
/** AnnotationFieldValues = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" */
List<JCExpression> annotationFieldValues() {
accept(LPAREN);
- ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> 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<JCExpression> buf = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> buf = new ListBuffer<>();
if (token.kind == COMMA) {
nextToken();
} else if (token.kind != RBRACE) {
@@ -3035,7 +3035,7 @@
/** Resources = Resource { ";" Resources }
*/
List<JCTree> resources() {
- ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+ ListBuffer<JCTree> 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<JCTree> defs = new ListBuffer<JCTree>();
+ ListBuffer<JCTree> defs = new ListBuffer<>();
boolean checkForImports = true;
boolean firstTypeDecl = true;
while (token.kind != EOF) {
@@ -3294,7 +3294,7 @@
*/
List<JCTree> enumBody(Name enumName) {
accept(LBRACE);
- ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+ ListBuffer<JCTree> defs = new ListBuffer<>();
if (token.kind == COMMA) {
nextToken();
} else if (token.kind != RBRACE && token.kind != SEMI) {
@@ -3363,7 +3363,7 @@
/** TypeList = Type {"," Type}
*/
List<JCExpression> typeList() {
- ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> ts = new ListBuffer<>();
ts.append(parseType());
while (token.kind == COMMA) {
nextToken();
@@ -3383,7 +3383,7 @@
if (token.kind == LBRACE)
nextToken();
}
- ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
+ ListBuffer<JCTree> 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<JCExpression> qualidentList() {
- ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> ts = new ListBuffer<>();
List<JCAnnotation> typeAnnos = typeAnnotationsOpt();
JCExpression qi = qualident(true);
@@ -3591,7 +3591,7 @@
List<JCTypeParameter> typeParametersOpt() {
if (token.kind == LT) {
checkGenerics();
- ListBuffer<JCTypeParameter> typarams = new ListBuffer<JCTypeParameter>();
+ ListBuffer<JCTypeParameter> typarams = new ListBuffer<>();
nextToken();
typarams.append(typeParameter());
while (token.kind == COMMA) {
@@ -3616,7 +3616,7 @@
int pos = token.pos;
List<JCAnnotation> annos = typeAnnotationsOpt();
Name name = ident();
- ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> bounds = new ListBuffer<>();
if (token.kind == EXTENDS) {
nextToken();
bounds.append(parseType());
@@ -3636,7 +3636,7 @@
return formalParameters(false);
}
List<JCVariableDecl> formalParameters(boolean lambdaParameters) {
- ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+ ListBuffer<JCVariableDecl> params = new ListBuffer<>();
JCVariableDecl lastParam;
accept(LPAREN);
if (token.kind != RPAREN) {
@@ -3661,7 +3661,7 @@
if (hasParens) {
accept(LPAREN);
}
- ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+ ListBuffer<JCVariableDecl> 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<JCTree, Integer>();
+ endPosMap = new HashMap<>();
}
public void storeEnd(JCTree tree, int endpos) {
--- 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<JCTree, Entry>();
+ table = new HashMap<>();
}
public boolean hasComment(JCTree tree) {
--- 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<ParserFactory> parserFactoryKey = new Context.Key<ParserFactory>();
+ protected static final Context.Key<ParserFactory> parserFactoryKey = new Context.Key<>();
public static ParserFactory instance(Context context) {
ParserFactory instance = context.get(parserFactoryKey);
--- 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<Token> savedTokens = new ArrayList<Token>();
+ private List<Token> savedTokens = new ArrayList<>();
private JavaTokenizer tokenizer;
--- 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<ScannerFactory> scannerFactoryKey =
- new Context.Key<ScannerFactory>();
+ public static final Context.Key<ScannerFactory> scannerFactoryKey = new Context.Key<>();
/** Get the Factory instance for this context. */
public static ScannerFactory instance(Context context) {
--- 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<Tokens> tokensKey =
- new Context.Key<Tokens>();
+ public static final Context.Key<Tokens> 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 */
--- 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<FileObject>());
- generatedSourceNames = synchronizedSet(new LinkedHashSet<String>());
- generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<JavaFileObject>());
+ fileObjectHistory = synchronizedSet(new LinkedHashSet<>());
+ generatedSourceNames = synchronizedSet(new LinkedHashSet<>());
+ generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<>());
- generatedClasses = synchronizedMap(new LinkedHashMap<String, JavaFileObject>());
+ generatedClasses = synchronizedMap(new LinkedHashMap<>());
- openTypeNames = synchronizedSet(new LinkedHashSet<String>());
+ openTypeNames = synchronizedSet(new LinkedHashSet<>());
- aggregateGeneratedSourceNames = new LinkedHashSet<String>();
- aggregateGeneratedClassNames = new LinkedHashSet<String>();
+ aggregateGeneratedSourceNames = new LinkedHashSet<>();
+ aggregateGeneratedClassNames = new LinkedHashSet<>();
lint = (Lint.instance(context)).isEnabled(PROCESSING);
}
--- 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<String> initPlatformAnnotations() {
- Set<String> platformAnnotations = new HashSet<String>();
+ Set<String> 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<String, String> initProcessorOptions(Context context) {
Options options = Options.instance(context);
Set<String> keySet = options.keySet();
- Map<String, String> tempOptions = new LinkedHashMap<String, String>();
+ Map<String, String> tempOptions = new LinkedHashMap<>();
for(String key : keySet) {
if (key.startsWith("-A") && key.length() > 2) {
@@ -473,7 +473,7 @@
}
private Set<String> initUnmatchedProcessorOptions() {
- Set<String> unmatchedProcessorOptions = new HashSet<String>();
+ Set<String> unmatchedProcessorOptions = new HashSet<>();
unmatchedProcessorOptions.addAll(processorOptions.keySet());
return unmatchedProcessorOptions;
}
@@ -501,14 +501,14 @@
checkSourceVersionCompatibility(source, log);
- supportedAnnotationPatterns = new ArrayList<Pattern>();
+ supportedAnnotationPatterns = new ArrayList<>();
for (String importString : processor.getSupportedAnnotationTypes()) {
supportedAnnotationPatterns.add(importStringToPattern(importString,
processor,
log));
}
- supportedOptionNames = new ArrayList<String>();
+ supportedOptionNames = new ArrayList<>();
for (String optionName : processor.getSupportedOptions() ) {
if (checkOptionName(optionName, log))
supportedOptionNames.add(optionName);
@@ -639,7 +639,7 @@
DiscoveredProcessors(Iterator<? extends Processor> processorIterator) {
this.processorIterator = processorIterator;
- this.procStateList = new ArrayList<ProcessorState>();
+ this.procStateList = new ArrayList<>();
}
/**
@@ -657,8 +657,7 @@
Set<TypeElement> annotationsPresent,
List<ClassSymbol> topLevelClasses,
List<PackageSymbol> packageInfoFiles) {
- Map<String, TypeElement> unmatchedAnnotations =
- new HashMap<String, TypeElement>(annotationsPresent.size());
+ Map<String, TypeElement> 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<Element> rootElements = new LinkedHashSet<Element>();
+ Set<Element> 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<String> matchedNames = new HashSet<String>();
- Set<TypeElement> typeElements = new LinkedHashSet<TypeElement>();
+ Set<String> matchedNames = new HashSet<>();
+ Set<TypeElement> typeElements = new LinkedHashSet<>();
for (Map.Entry<String, TypeElement> 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<String,JavaFileObject>();
+ 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<TypeElement>();
+ 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<PackageSymbol> specifiedPackages = new LinkedHashSet<PackageSymbol>();
+ Set<PackageSymbol> 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<JavaFileObject>(filer.getGeneratedSourceFileObjects()),
- new LinkedHashMap<String,JavaFileObject>(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<JavaFileObject> newSourceFiles =
- new LinkedHashSet<JavaFileObject>(filer.getGeneratedSourceFileObjects());
+ new LinkedHashSet<>(filer.getGeneratedSourceFileObjects());
roots = cleanTrees(round.roots);
JavaCompiler compiler = round.finalCompiler();
--- 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<Set<Element>, DeclaredType> {
// Insertion-order preserving set
- Set<Element> annotatedElements = new LinkedHashSet<Element>();
+ Set<Element> annotatedElements = new LinkedHashSet<>();
Types typeUtil;
AnnotationSetScanner(Set<Element> defaultSet, Types typeUtil) {
--- 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<Element> enclosedElements =
- new ArrayList<Element>(e.getEnclosedElements());
+ List<Element> enclosedElements = new ArrayList<>(e.getEnclosedElements());
// Handle any enum constants specially before other entities.
- List<Element> enumConstants = new ArrayList<Element>();
+ List<Element> 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<Modifier> modifiers = new LinkedHashSet<Modifier>();
+ Set<Modifier> modifiers = new LinkedHashSet<>();
modifiers.addAll(e.getModifiers());
switch (kind) {
--- 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<String> getLegacyPackages() {
ResourceBundle legacyBundle
= ResourceBundle.getBundle("com.sun.tools.javac.resources.legacy");
- Set<String> keys = new HashSet<String>();
+ Set<String> keys = new HashSet<>();
for (Enumeration<String> e = legacyBundle.getKeys(); e.hasMoreElements(); )
keys.add(e.nextElement());
return keys;
@@ -129,7 +129,7 @@
void createSymbols() throws IOException {
Set<String> legacy = getLegacyPackages();
Set<String> legacyProprietary = getLegacyPackages();
- Set<String> documented = new HashSet<String>();
+ Set<String> documented = new HashSet<>();
Set<PackageSymbol> packages =
((JavacProcessingEnvironment)processingEnv).getSpecifiedPackages();
Map<String,String> pOptions = processingEnv.getOptions();
@@ -158,7 +158,7 @@
fm.setLocation(StandardLocation.CLASS_PATH, List.<File>nil());
fm.setLocation(StandardLocation.SOURCE_PATH, List.<File>nil());
{
- ArrayList<File> bootClassPath = new ArrayList<File>();
+ ArrayList<File> 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<String> hiddenPackages = new HashSet<String>();
- Set<String> crisp = new HashSet<String>();
+ Set<String> hiddenPackages = new HashSet<>();
+ Set<String> crisp = new HashSet<>();
List<String> 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.<Pair<Symbol.MethodSymbol, Attribute>>of(
- new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
+ List.<Pair<Symbol.MethodSymbol, Attribute>>of(new Pair<>(profileValue, new Attribute.Constant(syms.intType, i))));
}
Type.moreInfo = true;
--- 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<Integer,Set<String>> lists = new TreeMap<Integer,Set<String>>();
+ Map<Integer,Set<String>> lists = new TreeMap<>();
for (int i = 1; i <= 4; i++)
- lists.put(i, new TreeSet<String>());
+ 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<String, Package> subpackages = new TreeMap<String, Package>();
+ Map<String, Package> subpackages = new TreeMap<>();
int profile;
- Map<String, Integer> includedTypes = new TreeMap<String,Integer>();
- Map<String, Integer> excludedTypes = new TreeMap<String,Integer>();
+ Map<String, Integer> includedTypes = new TreeMap<>();
+ Map<String, Integer> excludedTypes = new TreeMap<>();
Package(Package parent, String name) {
this.parent = parent;
@@ -142,7 +142,7 @@
}
}
- final Map<String, Package> packages = new TreeMap<String, Package>();
+ final Map<String, Package> packages = new TreeMap<>();
final int maxProfile = 4; // Three compact profiles plus full JRE
@@ -191,7 +191,7 @@
@Override
public Set<String> getPackages(int profile) {
- Set<String> results = new TreeSet<String>();
+ Set<String> 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<String, Integer>();
+ map = new HashMap<>();
for (Map.Entry<Object,Object> e: p.entrySet()) {
String typeName = (String) e.getKey();
int profile = Integer.valueOf((String) e.getValue());
@@ -277,7 +277,7 @@
@Override
public Set<String> getPackages(int profile) {
- Set<String> results = new TreeSet<String>();
+ Set<String> results = new TreeSet<>();
for (Map.Entry<String,Integer> e: map.entrySet()) {
String tn = e.getKey();
int prf = e.getValue();
--- 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<DocTreeMaker> treeMakerKey =
- new Context.Key<DocTreeMaker>();
+ protected static final Context.Key<DocTreeMaker> treeMakerKey = new Context.Key<>();
/** Get the TreeMaker instance. */
public static DocTreeMaker instance(Context context) {
--- 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<JCImport> getImports() {
- ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
+ ListBuffer<JCImport> 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<JCVariableDecl> params;
@@ -1921,7 +1921,7 @@
public enum OverloadKind {
OVERLOADED,
- UNOVERLOADED;
+ UNOVERLOADED
}
/**
--- 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 <T extends JCTree> List<T> copy(List<T> trees, P p) {
if (trees == null)
return null;
- ListBuffer<T> lb = new ListBuffer<T>();
+ ListBuffer<T> lb = new ListBuffer<>();
for (T tree: trees)
lb.append(copy(tree, p));
return lb.toList();
--- 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.</b>
*/
public class TreeInfo {
- protected static final Context.Key<TreeInfo> treeInfoKey =
- new Context.Key<TreeInfo>();
+ protected static final Context.Key<TreeInfo> 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<Type> types(List<? extends JCTree> trees) {
- ListBuffer<Type> ts = new ListBuffer<Type>();
+ ListBuffer<Type> ts = new ListBuffer<>();
for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
ts.append(l.head.type);
return ts.toList();
--- 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<TreeMaker> treeMakerKey =
- new Context.Key<TreeMaker>();
+ protected static final Context.Key<TreeMaker> 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<JCExpression> Idents(List<JCVariableDecl> params) {
- ListBuffer<JCExpression> ids = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> ids = new ListBuffer<>();
for (List<JCVariableDecl> 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<JCExpression> Types(List<Type> ts) {
- ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> lb = new ListBuffer<>();
for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
lb.append(Type(l.head));
return lb.toList();
@@ -733,7 +732,7 @@
*/
public List<JCAnnotation> Annotations(List<Attribute.Compound> attributes) {
if (attributes == null) return List.nil();
- ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>();
+ ListBuffer<JCAnnotation> result = new ListBuffer<>();
for (List<Attribute.Compound> 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<JCExpression> args = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> args = new ListBuffer<>();
for (List<Pair<Symbol.MethodSymbol,Attribute>> values = compound.values; values.nonEmpty(); values=values.tail) {
Pair<MethodSymbol,Attribute> 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<JCExpression> args = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> args = new ListBuffer<>();
for (List<Pair<Symbol.MethodSymbol,Attribute>> values = compound.values; values.nonEmpty(); values=values.tail) {
Pair<MethodSymbol,Attribute> 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<JCExpression> elems = new ListBuffer<JCExpression>();
+ ListBuffer<JCExpression> elems = new ListBuffer<>();
for (int i = 0; i < array.values.length; i++)
elems.append(translate(array.values[i]));
result = NewArray(null, List.<JCExpression>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<JCTypeParameter> TypeParams(List<Type> typarams) {
- ListBuffer<JCTypeParameter> tparams = new ListBuffer<JCTypeParameter>();
+ ListBuffer<JCTypeParameter> tparams = new ListBuffer<>();
for (List<Type> 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<JCVariableDecl> Params(List<Type> argtypes, Symbol owner) {
- ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
+ ListBuffer<JCVariableDecl> 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)
--- 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<String> formatArguments(JCDiagnostic d, Locale l) {
- ListBuffer<String> buf = new ListBuffer<String>();
+ ListBuffer<String> buf = new ListBuffer<>();
for (Object o : d.getArgs()) {
buf.append(formatArgument(d, o, l));
}
@@ -389,7 +389,7 @@
protected boolean caretEnabled;
public SimpleConfiguration(Set<DiagnosticPart> parts) {
- multilineLimits = new HashMap<MultilineLimit, Integer>();
+ multilineLimits = new HashMap<>();
setVisible(parts);
setMultilineLimit(MultilineLimit.DEPTH, -1);
setMultilineLimit(MultilineLimit.LENGTH, -1);
--- 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.</b>
*/
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<JavaFileObject, DiagnosticSource> sourceMap;
+
AbstractLog(JCDiagnostic.Factory diags) {
this.diags = diags;
- sourceMap = new HashMap<JavaFileObject, DiagnosticSource>();
+ 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<JavaFileObject, DiagnosticSource> sourceMap;
}
--- 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<? extends ClassLoader> 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<JavaFileObject, ContentCacheEntry> contentCache
- = new HashMap<JavaFileObject, ContentCacheEntry>();
+ protected final Map<JavaFileObject, ContentCacheEntry> 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<CharBuffer>(cb);
+ this.ref = new SoftReference<>(cb);
}
boolean isValid(JavaFileObject file) {
--- 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, String>(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<DiagnosticPart, Integer>();
+ 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
}
}
}
--- 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> {
T make(Context c);
- };
+ }
/**
* The underlying map storing the data.
@@ -119,7 +119,7 @@
* or
* {@literal Key<T> -> Factory<T> }
*/
- private Map<Key<?>,Object> ht = new HashMap<Key<?>,Object>();
+ private Map<Key<?>,Object> ht = new HashMap<>();
/** Set the factory for the key in this context. */
public <T> void put(Key<T> key, Factory<T> fac) {
@@ -166,7 +166,7 @@
/**
* The table of preregistered factories.
*/
- private Map<Key<?>,Factory<?>> ft = new HashMap<Key<?>,Factory<?>>();
+ private Map<Key<?>,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<T> for each Class<T>.
*/
- private Map<Class<?>, Key<?>> kt = new HashMap<Class<?>, Key<?>>();
+ private Map<Class<?>, Key<?>> kt = new HashMap<>();
private <T> Key<T> key(Class<T> clss) {
checkState(kt);
Key<T> k = uncheckedCast(kt.get(clss));
if (k == null) {
- k = new Key<T>();
+ k = new Key<>();
kt.put(clss, k);
}
return k;
--- 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<char[]>(buf);
+ refBuf = new SoftReference<>(buf);
return buf;
}
--- 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<JCDiagnostic.Factory> diagnosticFactoryKey =
- new Context.Key<JCDiagnostic.Factory>();
+ protected static final Context.Key<JCDiagnostic.Factory> 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
--- 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<JavacMessages> messagesKey =
- new Context.Key<JavacMessages>();
+ public static final Context.Key<JavacMessages> 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<Locale, SoftReference<List<ResourceBundle>>>();
+ 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<List<ResourceBundle>>(bundleList));
+ bundleCache.put(locale, new SoftReference<>(bundleList));
}
return bundleList;
}
--- 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 <A> List<A> of(A x1) {
- return new List<A>(x1, List.<A>nil());
+ return new List<>(x1, List.<A>nil());
}
/** Construct a list consisting of given elements.
*/
public static <A> List<A> of(A x1, A x2) {
- return new List<A>(x1, of(x2));
+ return new List<>(x1, of(x2));
}
/** Construct a list consisting of given elements.
*/
public static <A> List<A> of(A x1, A x2, A x3) {
- return new List<A>(x1, of(x2, x3));
+ return new List<>(x1, of(x2, x3));
}
/** Construct a list consisting of given elements.
*/
@SuppressWarnings({"varargs", "unchecked"})
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
- return new List<A>(x1, new List<A>(x2, new List<A>(x3, from(rest))));
+ return new List<>(x1, new List<>(x2, new List<>(x3, from(rest))));
}
/**
@@ -162,7 +162,7 @@
List<A> xs = nil();
if (array != null)
for (int i = array.length - 1; i >= 0; i--)
- xs = new List<A>(array[i], xs);
+ xs = new List<>(array[i], xs);
return xs;
}
@@ -181,7 +181,7 @@
@Deprecated
public static <A> List<A> fill(int len, A init) {
List<A> l = nil();
- for (int i = 0; i < len; i++) l = new List<A>(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<A> prepend(A x) {
- return new List<A>(x, this);
+ return new List<>(x, this);
}
/** Prepend given list of elements to front of list, forming and returning
@@ -261,7 +261,7 @@
List<A> rev = nil();
for (List<A> l = this; l.nonEmpty(); l = l.tail)
- rev = new List<A>(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> a = new ArrayList<A>(toIndex - fromIndex);
+ ArrayList<A> a = new ArrayList<>(toIndex - fromIndex);
int i = 0;
for (List<A> l = this; l.tail != null; l = l.tail, i++) {
if (i == toIndex)
--- 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<A> extends AbstractQueue<A> {
public static <T> ListBuffer<T> of(T x) {
- ListBuffer<T> lb = new ListBuffer<T>();
+ ListBuffer<T> lb = new ListBuffer<>();
lb.add(x);
return lb;
}
--- 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<Log> logKey
- = new Context.Key<Log>();
+ public static final Context.Key<Log> logKey = new Context.Key<>();
/** The context key for the output PrintWriter. */
- public static final Context.Key<PrintWriter> outKey =
- new Context.Key<PrintWriter>();
+ public static final Context.Key<PrintWriter> 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<String>(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<Pair<JavaFileObject, Integer>> recorded = new HashSet<Pair<JavaFileObject,Integer>>();
+ private Set<Pair<JavaFileObject, Integer>> recorded = new HashSet<>();
public boolean hasDiagnosticListener() {
return diagListener != null;
@@ -435,7 +433,7 @@
if (multipleErrors || file == null)
return true;
- Pair<JavaFileObject,Integer> coords = new Pair<JavaFileObject,Integer>(file, pos);
+ Pair<JavaFileObject,Integer> coords = new Pair<>(file, pos);
boolean shouldReport = !recorded.contains(coords);
if (shouldReport)
recorded.add(coords);
--- 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<JavaFileObject>();
+ sourcesWithReportedWarnings = new HashSet<>();
if (log.nwarnings < log.MaxWarnings) {
// generate message and remember the source file
--- 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<Names> namesKey = new Context.Key<Names>();
+ public static final Context.Key<Names> namesKey = new Context.Key<>();
public static Names instance(Context context) {
Names instance = context.get(namesKey);
--- 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<Options> optionsKey =
- new Context.Key<Options>();
+ public static final Context.Key<Options> optionsKey = new Context.Key<>();
private LinkedHashMap<String,String> values;
@@ -57,7 +56,7 @@
protected Options(Context context) {
// DEBUGGING -- Use LinkedHashMap for reproducability
- values = new LinkedHashMap<String,String>();
+ values = new LinkedHashMap<>();
context.put(optionsKey, this);
}
--- 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 <A,B> Pair<A,B> of(A a, B b) {
- return new Pair<A,B>(a,b);
+ return new Pair<>(a,b);
}
}
--- 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, Map<Type, JCDiagnostic>>(WhereClauseKind.class);
+ whereClauses = new EnumMap<>(WhereClauseKind.class);
configuration = new RichConfiguration(Options.instance(context), formatter);
for (WhereClauseKind kind : WhereClauseKind.values())
- whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
+ whereClauses.put(kind, new LinkedHashMap<>());
}
@Override
@@ -279,7 +279,7 @@
protected class ClassNameSimplifier {
/* table for keeping track of all short name usages */
- Map<Name, List<Symbol>> nameClashes = new HashMap<Name, List<Symbol>>();
+ Map<Name, List<Symbol>> nameClashes = new HashMap<>();
/**
* Add a name usage to the simplifier's internal cache
@@ -322,7 +322,7 @@
}
return name;
}
- };
+ }
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="rich printer">
@@ -437,7 +437,7 @@
return ms;
}
}
- };
+ }
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="type scanner">
@@ -704,7 +704,7 @@
/** full class names simplification (where possible) */
SIMPLE_NAMES,
/** type-variable names disambiguation */
- UNIQUE_TYPEVAR_NAMES;
+ UNIQUE_TYPEVAR_NAMES
}
}
}
--- 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<SharedNameTable>(t));
+ freelist = freelist.prepend(new SoftReference<>(t));
}
/** The hash table for names.
--- 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<ClassDocImpl> ta = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<ClassDocImpl> innerClasses = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<ClassDocImpl>());
+ 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<ClassDocImpl>());
+ return searchField(fieldName, new HashSet<>());
}
private FieldDocImpl searchField(String fieldName, Set<ClassDocImpl> searched) {
@@ -1106,7 +1106,7 @@
// information is not available for binary classfiles
if (tsym.sourcefile == null) return new ClassDoc[0];
- ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> importedClasses = new ListBuffer<>();
Env<AttrContext> 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<PackageDocImpl> importedPackages = new ListBuffer<PackageDocImpl>();
+ ListBuffer<PackageDocImpl> importedPackages = new ListBuffer<>();
//### Add the implicit "import java.lang.*" to the result
Names names = tsym.name.table.names;
--- 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<Tag> tagList = new ListBuffer<Tag>();
+ private final ListBuffer<Tag> 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<Tag> found = new ListBuffer<Tag>();
+ ListBuffer<Tag> 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<ThrowsTag> found = new ListBuffer<ThrowsTag>();
+ ListBuffer<ThrowsTag> 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<ParamTag> found = new ListBuffer<ParamTag>();
+ ListBuffer<ParamTag> 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<SeeTag> found = new ListBuffer<SeeTag>();
+ ListBuffer<SeeTag> 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<SerialFieldTag> found = new ListBuffer<SerialFieldTag>();
+ ListBuffer<SerialFieldTag> 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<Tag> taglist = new ListBuffer<Tag>();
+ ListBuffer<Tag> taglist = new ListBuffer<>();
int delimend = 0, textstart = 0, len = inlinetext.length();
boolean inPre = false;
DocEnv docenv = holder.env;
--- 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<DocEnv> docEnvKey =
- new Context.Key<DocEnv>();
+ protected static final Context.Key<DocEnv> docEnvKey = new Context.Key<>();
public static DocEnv instance(Context context) {
DocEnv instance = context.get(docEnvKey);
@@ -110,7 +109,7 @@
Context context;
DocLint doclint;
- WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<JCTree, TreePath>();
+ WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<>();
/** Allow documenting from class files? */
boolean docClasses = false;
@@ -544,8 +543,7 @@
messager.exit();
}
- protected Map<PackageSymbol, PackageDocImpl> packageMap =
- new HashMap<PackageSymbol, PackageDocImpl>();
+ protected Map<PackageSymbol, PackageDocImpl> packageMap = new HashMap<>();
/**
* Return the PackageDoc of this package symbol.
*/
@@ -571,8 +569,7 @@
}
- protected Map<ClassSymbol, ClassDocImpl> classMap =
- new HashMap<ClassSymbol, ClassDocImpl>();
+ protected Map<ClassSymbol, ClassDocImpl> 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<VarSymbol, FieldDocImpl> fieldMap =
- new HashMap<VarSymbol, FieldDocImpl>();
+ protected Map<VarSymbol, FieldDocImpl> fieldMap = new HashMap<>();
/**
* Return the FieldDoc of this var symbol.
*/
@@ -638,8 +634,7 @@
}
}
- protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap =
- new HashMap<MethodSymbol, ExecutableMemberDocImpl>();
+ protected Map<MethodSymbol, ExecutableMemberDocImpl> methodMap = new HashMap<>();
/**
* Create a MethodDoc for this MethodSymbol.
* Should be called only on symbols representing methods.
@@ -805,7 +800,7 @@
}
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
- ArrayList<String> doclintOpts = new ArrayList<String>();
+ ArrayList<String> doclintOpts = new ArrayList<>();
for (String opt: opts) {
doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
--- 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<ClassDocImpl> l = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> l = new ListBuffer<>();
for (Type ex : sym.type.getThrownTypes()) {
ex = env.types.erasure(ex);
//### Will these casts succeed in the face of static semantic
--- 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<String> names = new ListBuffer<String>();
- ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<JCCompilationUnit>();
- ListBuffer<JCCompilationUnit> packTrees = new ListBuffer<JCCompilationUnit>();
+ ListBuffer<String> names = new ListBuffer<>();
+ ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<>();
+ ListBuffer<JCCompilationUnit> 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<JavaFileObject> lb = new ListBuffer<JavaFileObject>();
+ ListBuffer<JavaFileObject> 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<String> packages,
List<String> excludedPackages)
throws IOException {
- Map<String,List<JavaFileObject>> packageFiles =
- new HashMap<String,List<JavaFileObject>>();
+ Map<String,List<JavaFileObject>> packageFiles = new HashMap<>();
- Map<String,Boolean> includedPackages = new HashMap<String,Boolean>();
+ Map<String,Boolean> 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<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {
- ListBuffer<JCClassDecl> result = new ListBuffer<JCClassDecl>();
+ ListBuffer<JCClassDecl> result = new ListBuffer<>();
for (JCCompilationUnit t : trees) {
for (JCTree def : t.defs) {
if (def.hasTag(JCTree.Tag.CLASSDEF))
--- 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<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<AnnotationTypeDocImpl> ret =
- new ListBuffer<AnnotationTypeDocImpl>();
+ ListBuffer<AnnotationTypeDocImpl> ret = new ListBuffer<>();
for (ClassDocImpl c : getClasses(true)) {
if (c.isAnnotationType()) {
ret.append((AnnotationTypeDocImpl)c);
--- 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<ClassDocImpl> classList = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<JCClassDecl> classes) {
- ListBuffer<ClassDocImpl> result = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> 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<String> packages) {
- ListBuffer<PackageDocImpl> packlist = new ListBuffer<PackageDocImpl>();
+ ListBuffer<PackageDocImpl> 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<ClassDocImpl> classesToDocument = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
for (ClassDocImpl cd : cmdLineClasses) {
cd.addAllClasses(classesToDocument, true);
}
@@ -195,7 +195,7 @@
* packages) to be documented.
*/
public ClassDoc[] classes() {
- ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<ClassDocImpl>();
+ ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<>();
for (ClassDocImpl cd : cmdLineClasses) {
cd.addAllClasses(classesToDocument, true);
}
--- 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<String>();
+ this.paramList = new ListBuffer<>();
typeId = new StringBuilder();
}
--- 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<MethodDoc> methods = new ListBuffer<MethodDoc>();
+ ListBuffer<MethodDoc> 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<FieldDocImpl> fields = new ListBuffer<FieldDocImpl>();
+ private final ListBuffer<FieldDocImpl> fields = new ListBuffer<>();
/* True if class specifies serializable fields explicitly.
* using special static member, serialPersistentFields.
--- 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<String> options, Iterable<? extends JavaFileObject> fileObjects) {
- Collection<String> opts = new ArrayList<String>();
+ Collection<String> 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<? extends JavaFileObject> fileObjects) throws IOException {
long tm = System.currentTimeMillis();
- ListBuffer<String> javaNames = new ListBuffer<String>();
+ ListBuffer<String> javaNames = new ListBuffer<>();
// Preprocess @file arguments
try {
@@ -314,7 +314,7 @@
if ((i + optionLength) > argv.length) {
usageError("main.requires_argument", arg);
}
- ListBuffer<String> args = new ListBuffer<String>();
+ ListBuffer<String> args = new ListBuffer<>();
for (int j = 0; j < optionLength-1; ++j) {
args.append(argv[++i]);
}
--- 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<String[]> options = new ListBuffer<String[]>();
+ final ListBuffer<String[]> options = new ListBuffer<>();
/** Selected packages, from -subpackages. */
- final ListBuffer<String> subPackages = new ListBuffer<String>();
+ final ListBuffer<String> subPackages = new ListBuffer<>();
/** Excluded packages, from -exclude. */
- final ListBuffer<String> excludedPackages = new ListBuffer<String>();
+ final ListBuffer<String> excludedPackages = new ListBuffer<>();
/** javac options, set by various options. */
Options compOpts; // = Options.instance(context)
--- 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<VariableElement> getAllFields(TypeElement subclazz) {
- List<VariableElement> fields = new ArrayList<VariableElement>();
+ List<VariableElement> fields = new ArrayList<>();
TypeElement cd = null;
- Stack<TypeElement> s = new Stack<TypeElement>();
+ Stack<TypeElement> s = new Stack<>();
cd = subclazz;
while (true) {
--- 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<? extends VariableElement> paramargs = md.getParameters();
- List<TypeMirror> args = new ArrayList<TypeMirror>();
+ List<TypeMirror> args = new ArrayList<>();
for (VariableElement p: paramargs) {
args.add(types.erasure(p.asType()));
}
--- 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<String>();
+ 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<String>();
+ classes = new ArrayList<>();
classes.add(arg);
while (iter.hasNext())
classes.add(iter.next());
@@ -414,7 +414,7 @@
private Iterable<String> expandAtArgs(Iterable<String> args) throws BadArgs {
try {
- List<String> l = new ArrayList<String>();
+ List<String> 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<String> opts = new ArrayList<String>();
+ List<String> 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<File> pathToFiles(String path) {
- List<File> files = new ArrayList<File>();
+ List<File> 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<Locale,SoftReference<ResourceBundle>>
// and for efficiency, keep a hard reference to the bundle for the task
// locale
- bundles = new HashMap<Locale, ResourceBundle>();
+ bundles = new HashMap<>();
}
if (locale == null)
@@ -657,7 +657,7 @@
boolean llni;
boolean doubleAlign;
boolean force;
- Set<String> javac_extras = new LinkedHashSet<String>();
+ Set<String> javac_extras = new LinkedHashSet<>();
PrintWriter log;
JavaFileManager fileManager;
@@ -711,7 +711,7 @@
}
private Set<TypeElement> getAllClasses(Set<? extends TypeElement> classes) {
- Set<TypeElement> allClasses = new LinkedHashSet<TypeElement>();
+ Set<TypeElement> allClasses = new LinkedHashSet<>();
getAllClasses0(classes, allClasses);
return allClasses;
}
--- 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<String>();
+ 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<? extends VariableElement> params = method.getParameters();
- List<TypeMirror> argTypes = new ArrayList<TypeMirror>();
+ List<TypeMirror> 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<? extends VariableElement> params = method.getParameters();
- List<TypeMirror> argTypes = new ArrayList<TypeMirror>();
+ List<TypeMirror> argTypes = new ArrayList<>();
for (VariableElement param: params) {
argTypes.add(types.erasure(param.asType()));
}
--- 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;
}
}
--- 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<String> params = new ArrayList<String>(); //List of parameters.
+ List<String> 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.
--- 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<InstructionDetailWriter> getDetailWriters(Code_attribute attr) {
- List<InstructionDetailWriter> detailWriters =
- new ArrayList<InstructionDetailWriter>();
+ List<InstructionDetailWriter> detailWriters = new ArrayList<>();
if (options.details.contains(InstructionDetailWriter.Kind.SOURCE)) {
sourceWriter.reset(classWriter.getClassFile(), attr);
if (sourceWriter.hasSource())
--- 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.</b>
*/
public class Context {
+
+ Map<Class<?>, Object> map;
+
public Context() {
- map = new HashMap<Class<?>, Object>();
+ map = new HashMap<>();
}
@SuppressWarnings("unchecked")
@@ -50,6 +53,4 @@
public <T> T put(Class<T> key, T value) {
return (T) map.put(key, value);
}
-
- Map<Class<?>, Object> map;
}
--- 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<String> classes) {
this(out, fileManager, diagnosticListener);
- this.classes = new ArrayList<String>();
+ 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<String>();
+ classes = new ArrayList<>();
classes.add(arg);
while (iter.hasNext())
classes.add(iter.next());
@@ -988,7 +988,7 @@
// could make this a HashMap<Locale,SoftReference<ResourceBundle>>
// and for efficiency, keep a hard reference to the bundle for the task
// locale
- bundles = new HashMap<Locale, ResourceBundle>();
+ bundles = new HashMap<>();
}
if (locale == null)
--- 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<Integer, List<LocalVariableTable_attribute.Entry>>();
+ 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<LocalVariableTable_attribute.Entry> list = pcMap.get(pc);
if (list == null) {
- list = new ArrayList<LocalVariableTable_attribute.Entry>();
+ list = new ArrayList<>();
pcMap.put(pc, list);
}
if (!list.contains(entry))
--- 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<Integer, List<LocalVariableTypeTable_attribute.Entry>>();
+ 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<LocalVariableTypeTable_attribute.Entry> list = pcMap.get(pc);
if (list == null) {
- list = new ArrayList<LocalVariableTypeTable_attribute.Entry>();
+ list = new ArrayList<>();
pcMap.put(pc, list);
}
if (!list.contains(entry))
--- 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<String> accessOptions = new HashSet<String>();
+ public Set<String> accessOptions = new HashSet<>();
public Set<InstructionDetailWriter.Kind> details = EnumSet.noneOf(InstructionDetailWriter.Kind.class);
public boolean showDisassembled;
public boolean showDescriptors;
--- 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<Integer, SortedSet<Integer>> map =
- new TreeMap<Integer, SortedSet<Integer>>();
- SortedSet<Integer> allLines = new TreeSet<Integer>();
+ SortedMap<Integer, SortedSet<Integer>> map = new TreeMap<>();
+ SortedSet<Integer> 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<Integer> pcLines = map.get(start_pc);
if (pcLines == null) {
- pcLines = new TreeSet<Integer>();
+ pcLines = new TreeSet<>();
map.put(start_pc, pcLines);
}
pcLines.add(line);
@@ -126,7 +125,7 @@
}
}
lineMap = map;
- lineList = new ArrayList<Integer>(allLines);
+ lineList = new ArrayList<>(allLines);
}
private void setSource(ClassFile cf) {
@@ -186,7 +185,7 @@
if (text == null)
return new String[0];
- List<String> lines = new ArrayList<String>();
+ List<String> lines = new ArrayList<>();
lines.add(""); // dummy line 0
try {
BufferedReader r = new BufferedReader(new StringReader(text));
--- 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<Integer, StackMap>();
+ map = new HashMap<>();
StackMapBuilder builder = new StackMapBuilder();
// using -1 as the pc for the initial frame effectively compensates for
--- 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<Exception_data, Integer>();
- pcMap = new HashMap<Integer, List<Exception_data>>();
+ 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<Exception_data> list = pcMap.get(pc);
if (list == null) {
- list = new ArrayList<Exception_data>();
+ list = new ArrayList<>();
pcMap.put(pc, list);
}
if (!list.contains(entry))
--- 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.</b>
*/
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<Integer, List<Note>>();
+ 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<Note> list = pcMap.get(pc);
if (list == null)
- pcMap.put(pc, list = new ArrayList<Note>());
+ pcMap.put(pc, list = new ArrayList<>());
list.add(note);
}
--- 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<Archive, ArchiveDeps> results = new HashMap<>();
--- 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<Path> walkTree(Path dir) throws IOException {
- final List<Path> files = new ArrayList<Path>();
+ final List<Path> files = new ArrayList<>();
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
--- 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<String> classes = new ArrayList<String>();
+ private final List<String> classes = new ArrayList<>();
private PrintWriter log;
void setLog(PrintWriter out) {
@@ -614,7 +614,7 @@
}
private List<Archive> getArchives(List<String> filenames) throws IOException {
- List<Archive> result = new ArrayList<Archive>();
+ List<Archive> result = new ArrayList<>();
for (String s : filenames) {
Path p = Paths.get(s);
if (Files.exists(p)) {
--- 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.</b></p>
*/
public class BuildState {
- private Map<String,Module> modules = new HashMap<String,Module>();
- private Map<String,Package> packages = new HashMap<String,Package>();
- private Map<String,Source> sources = new HashMap<String,Source>();
- private Map<String,File> artifacts = new HashMap<String,File>();
+ private Map<String,Module> modules = new HashMap<>();
+ private Map<String,Package> packages = new HashMap<>();
+ private Map<String,Source> sources = new HashMap<>();
+ private Map<String,File> artifacts = new HashMap<>();
// Map from package to a set of packages that depend on said package.
- private Map<String,Set<String>> dependents = new HashMap<String,Set<String>>();
+ private Map<String,Set<String>> dependents = new HashMap<>();
public Map<String,Module> modules() { return modules; }
public Map<String,Package> packages() { return packages; }
@@ -151,13 +151,13 @@
* Calculate the package dependents (ie the reverse of the dependencies).
*/
public void calculateDependents() {
- dependents = new HashMap<String,Set<String>>();
+ dependents = new HashMap<>();
for (String s : packages.keySet()) {
Package p = packages.get(s);
for (String d : p.dependencies()) {
Set<String> ss = dependents.get(d);
if (ss == null) {
- ss = new HashSet<String>();
+ 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<String,Source> srcs) {
boolean baad = false;
- Map<String,Source> original = new HashMap<String,Source>();
- Map<String,Source> calculated = new HashMap<String,Source>();
+ Map<String,Source> original = new HashMap<>();
+ Map<String,Source> calculated = new HashMap<>();
for (String s : sources.keySet()) {
Source ss = sources.get(s);
--- 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<String> sortedKeys = new ArrayList<String>();
+ List<String> sortedKeys = new ArrayList<>();
for (Object key : p.keySet()) {
sortedKeys.add((String)key);
}
Collections.sort(sortedKeys);
- Iterator<String> 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<URI> as = packageArtifacts.get(pkgName);
if (as == null) {
- as = new HashSet<URI>();
+ as = new HashSet<>();
packageArtifacts.put(pkgName, as);
}
as.add(dest.toURI());
--- 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<CompileChunk> {
public int numPackages;
public int numDependents;
- public Set<URI> srcs = new HashSet<URI>();
+ public Set<URI> srcs = new HashSet<>();
public StringBuilder pkgNames = new StringBuilder();
public String pkgFromTos = "";
--- 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<String> sortedKeys = new ArrayList<String>();
+ List<String> sortedKeys = new ArrayList<>();
for (Object key : p.keySet()) {
sortedKeys.add((String)key);
}
@@ -140,7 +140,7 @@
Set<URI> as = packageArtifacts.get(pkgName);
if (as == null) {
- as = new HashSet<URI>();
+ as = new HashSet<>();
packageArtifacts.put(pkgName, as);
}
as.add(dest.toURI());
--- 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<URI> as = packageArtifacts.get(pkgName);
if (as == null) {
- as = new HashSet<URI>();
+ as = new HashSet<>();
packageArtifacts.put(pkgName, as);
}
as.add(dest.toURI());
--- 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<String>();
- recompiledPackages = new HashSet<String>();
- packagesWithChangedPublicApis = new HashSet<String>();
+ 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<String,Source> vs) {
- visibleSrcs = new HashSet<URI>();
+ 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<String,Source> vs) {
- visibleSrcs = new HashSet<URI>();
+ 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<String,File>();
+ 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<String>());
+ 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<String>();
+ taintedPackages = new HashSet<>();
}
/**
@@ -462,7 +462,7 @@
* Acquire the compile_java_packages suffix rule for .java files.
*/
public Map<String,Transformer> getJavaSuffixRule() {
- Map<String,Transformer> sr = new HashMap<String,Transformer>();
+ Map<String,Transformer> 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<File> allKnownArtifacts = new HashSet<File>();
+ Set<File> 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<Source> calculateRemovedSources() {
- Set<Source> removed = new HashSet<Source>();
+ Set<Source> 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<Source> calculateAddedSources() {
- Set<Source> added = new HashSet<Source>();
+ Set<Source> 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<Source> calculateModifiedSources() {
- Set<Source> modified = new HashSet<Source>();
+ Set<Source> 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<String,Transformer> suffixRules) {
- Map<String,Transformer> sr = new HashMap<String,Transformer>();
+ Map<String,Transformer> sr = new HashMap<>();
for (Map.Entry<String,Transformer> 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<String,Transformer> suffixRules) {
- Map<String,Transformer> sr = new HashMap<String,Transformer>();
+ Map<String,Transformer> sr = new HashMap<>();
for (Map.Entry<String,Transformer> e : suffixRules.entrySet()) {
if (e.getValue() != copyFiles &&
e.getValue() != compileJavaPackages) {
@@ -659,7 +659,7 @@
String[] args,
Set<String> recentlyCompiled,
boolean[] rcValue) {
- Map<String,Transformer> suffixRules = new HashMap<String,Transformer>();
+ Map<String,Transformer> 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<String>();
+ packagesWithChangedPublicApis = new HashSet<>();
return again && rcValue[0];
}
@@ -679,12 +679,12 @@
private void addFileToTransform(Map<Transformer,Map<String,Set<URI>>> gs, Transformer t, Source s) {
Map<String,Set<URI>> fs = gs.get(t);
if (fs == null) {
- fs = new HashMap<String,Set<URI>>();
+ fs = new HashMap<>();
gs.put(t, fs);
}
Set<URI> ss = fs.get(s.pkg().name());
if (ss == null) {
- ss = new HashSet<URI>();
+ 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<Transformer,Map<String,Set<URI>>> groupedSources = new HashMap<Transformer,Map<String,Set<URI>>>();
+ Map<Transformer,Map<String,Set<URI>>> 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<String,Set<URI>> srcs = e.getValue();
// These maps need to be synchronized since multiple threads will be writing results into them.
- Map<String,Set<URI>> packageArtifacts = Collections.synchronizedMap(new HashMap<String,Set<URI>>());
- Map<String,Set<String>> packageDependencies = Collections.synchronizedMap(new HashMap<String,Set<String>>());
- Map<String,String> packagePublicApis = Collections.synchronizedMap(new HashMap<String,String>());
+ Map<String,Set<URI>> packageArtifacts = Collections.synchronizedMap(new HashMap<>());
+ Map<String,Set<String>> packageDependencies = Collections.synchronizedMap(new HashMap<>());
+ Map<String,String> packagePublicApis = Collections.synchronizedMap(new HashMap<>());
boolean r = t.transform(srcs,
visibleSrcs,
@@ -770,7 +770,7 @@
* Utility method to recursively find all files below a directory.
*/
private static Set<File> findAllFiles(File dir) {
- Set<File> foundFiles = new HashSet<File>();
+ Set<File> foundFiles = new HashSet<>();
if (dir == null) {
return foundFiles;
}
@@ -803,8 +803,8 @@
if (makefileSourceList == null) return;
- Set<String> calculatedSources = new HashSet<String>();
- Set<String> listedSources = new HashSet<String>();
+ Set<String> calculatedSources = new HashSet<>();
+ Set<String> listedSources = new HashSet<>();
// Create a set of filenames with full paths.
for (Source s : now.sources().values()) {
--- 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<String,Module> modules = new HashMap<String,Module>();
+ Map<String,Module> 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<String,Source> sources = new HashMap<String,Source>();
+ Map<String,Source> 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<String,Source> sources_to_link_to = new HashMap<String,Source>();
+ Map<String,Source> 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<String,Source> generated_sources = new HashMap<String,Source>();
+ Map<String,Source> 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<String> recently_compiled = new HashSet<String>();
+ Set<String> 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<String> newargs = new ArrayList<String>();
+ List<String> newargs = new ArrayList<>();
for (int i = 0; i<args.length; ++i) {
File dir = new File(args[i]);
if (dir.exists() && dir.isDirectory()) {
@@ -688,7 +688,7 @@
*/
private static void checkSrcOption(String[] args)
throws ProblemException {
- Set<File> dirs = new HashSet<File>();
+ Set<File> dirs = new HashSet<>();
for (int i = 0; i<args.length; ++i) {
if (args[i].equals("-src")) {
if (i+1 >= args.length) {
@@ -870,15 +870,15 @@
throws ProblemException, ProblemException
{
// Track which source roots, source path roots and class path roots have been added.
- Set<File> roots = new HashSet<File>();
+ Set<File> 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<String> includes = new LinkedList<String>();
- List<String> excludes = new LinkedList<String>();
- List<String> excludefiles = new LinkedList<String>();
- List<String> includefiles = new LinkedList<String>();
+ List<String> includes = new LinkedList<>();
+ List<String> excludes = new LinkedList<>();
+ List<String> excludefiles = new LinkedList<>();
+ List<String> includefiles = new LinkedList<>();
// This include is used to find all modules in the source.
- List<String> moduleinfo = new LinkedList<String>();
+ List<String> moduleinfo = new LinkedList<>();
moduleinfo.add("module-info.java");
for (int i = 0; i<args.length; ++i) {
@@ -957,10 +957,10 @@
args[i].equals("-cp"))
{
// Reset the includes,excludes and excludefiles after they have been used.
- includes = new LinkedList<String>();
- excludes = new LinkedList<String>();
- excludefiles = new LinkedList<String>();
- includefiles = new LinkedList<String>();
+ includes = new LinkedList<>();
+ excludes = new LinkedList<>();
+ excludefiles = new LinkedList<>();
+ includefiles = new LinkedList<>();
}
}
return true;
--- 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<Module> {
private String name;
private String dirname;
- private Map<String,Package> packages = new HashMap<String,Package>();
- private Map<String,Source> sources = new HashMap<String,Source>();
- private Map<String,File> artifacts = new HashMap<String,File>();
+ private Map<String,Package> packages = new HashMap<>();
+ private Map<String,Source> sources = new HashMap<>();
+ private Map<String,File> artifacts = new HashMap<>();
public Module(String n, String dn) {
name = n;
--- 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<String> dependencies = new HashSet<String>();
+ private Set<String> dependencies = new HashSet<>();
// This package has the following dependents, that depend on this package.
- private Set<String> dependents = new HashSet<String>();
+ private Set<String> dependents = new HashSet<>();
// This is the public api of this package.
- private List<String> pubapi = new ArrayList<String>();
+ private List<String> pubapi = new ArrayList<>();
// Map from source file name to Source info object.
- private Map<String,Source> sources = new HashMap<String,Source>();
+ private Map<String,Source> sources = new HashMap<>();
// This package generated these artifacts.
- private Map<String,File> artifacts = new HashMap<String,File>();
+ private Map<String,File> artifacts = new HashMap<>();
public Package(Module m, String n) {
int c = n.indexOf(":");
@@ -146,7 +146,7 @@
public static List<String> pubapiToList(String ps)
{
String[] lines = ps.split("\n");
- List<String> r = new ArrayList<String>();
+ List<String> r = new ArrayList<>();
for (String l : lines) {
r.add(l);
}
@@ -213,7 +213,7 @@
}
public void saveDependencies(StringBuilder b) {
- List<String> sorted_dependencies = new ArrayList<String>();
+ List<String> sorted_dependencies = new ArrayList<>();
for (String key : dependencies) {
sorted_dependencies.add(key);
}
@@ -230,7 +230,7 @@
}
public static void savePackages(Map<String,Package> packages, StringBuilder b) {
- List<String> sorted_packages = new ArrayList<String>();
+ List<String> sorted_packages = new ArrayList<>();
for (String key : packages.keySet() ) {
sorted_packages.add(key);
}
@@ -257,7 +257,7 @@
public void setArtifacts(Set<URI> as) {
assert(!artifacts.isEmpty());
- artifacts = new HashMap<String,File>();
+ artifacts = new HashMap<>();
addArtifacts(as);
}
@@ -279,7 +279,7 @@
}
public void saveArtifacts(StringBuilder b) {
- List<File> sorted_artifacts = new ArrayList<File>();
+ List<File> sorted_artifacts = new ArrayList<>();
for (File f : artifacts.values()) {
sorted_artifacts.add(f);
}
--- 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<String,Source> sources, StringBuilder b) {
- List<String> sorted_sources = new ArrayList<String>();
+ List<String> sorted_sources = new ArrayList<>();
for (String key : sources.keySet()) {
sorted_sources.add(key);
}
--- 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<String> set(String... ss) {
- Set<String> set = new HashSet<String>();
+ Set<String> set = new HashSet<>();
set.addAll(Arrays.asList(ss));
return set;
}
--- 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.</b></p>
*/
public class Dependencies {
- protected static final Context.Key<Dependencies> dependenciesKey =
- new Context.Key<Dependencies>();
+ protected static final Context.Key<Dependencies> 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<Name, Set<Name>>();
- explicitPackages = new HashSet<Name>();
- publicApiPerClass = new HashMap<Name,StringBuffer>();
+ deps = new HashMap<>();
+ explicitPackages = new HashSet<>();
+ publicApiPerClass = new HashMap<>();
}
/**
@@ -89,14 +88,14 @@
* @return
*/
public Map<String,Set<String>> getDependencies() {
- Map<String,Set<String>> new_deps = new HashMap<String,Set<String>>();
+ Map<String,Set<String>> new_deps = new HashMap<>();
if (explicitPackages == null) return new_deps;
for (Name pkg : explicitPackages) {
Set<Name> set = deps.get(pkg);
if (set != null) {
Set<String> new_set = new_deps.get(pkg.toString());
if (new_set == null) {
- new_set = new HashSet<String>();
+ new_set = new HashSet<>();
// Modules beware....
new_deps.put(":"+pkg.toString(), new_set);
}
@@ -121,7 +120,7 @@
* of all the class pubapis)
*/
public Map<String,String> getPubapis() {
- Map<String,String> publicApiPerPackage = new HashMap<String,String>();
+ Map<String,String> 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<Name> theset = deps.get(currPkg);
if (theset==null) {
- theset = new HashSet<Name>();
+ theset = new HashSet<>();
deps.put(currPkg, theset);
}
theset.add(depPkg);
--- 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<JavaFileManager> {
// Set of sources that can be seen by javac.
- Set<URI> visibleSources = new HashSet<URI>();
+ Set<URI> visibleSources = new HashSet<>();
// Map from modulename:packagename to artifacts.
- Map<String,Set<URI>> packageArtifacts = new HashMap<String,Set<URI>>();
+ Map<String,Set<URI>> packageArtifacts = new HashMap<>();
// Where to print informational messages.
PrintWriter stdout;
@@ -69,7 +69,7 @@
}
public void cleanArtifacts() {
- packageArtifacts = new HashMap<String,Set<URI>>();
+ packageArtifacts = new HashMap<>();
}
public void setLog(PrintWriter pw) {
@@ -93,7 +93,7 @@
return files;
}
// Now filter!
- ListBuffer<JavaFileObject> filteredFiles = new ListBuffer<JavaFileObject>();
+ ListBuffer<JavaFileObject> 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<URI> s = packageArtifacts.get(pkgName);
if (s == null) {
- s = new HashSet<URI>();
+ s = new HashSet<>();
packageArtifacts.put(pkgName, s);
}
s.add(art);
--- 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<CompilerThread> compilers = new Stack<CompilerThread>();
+ private Stack<CompilerThread> compilers = new Stack<>();
// And the executor server to spawn threads.
private final ExecutorService executorPool;
// How many requests are active right now?
--- 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<Future<?>>();
+ subTasks = new ArrayList<>();
}
/**
@@ -218,8 +219,8 @@
if (!expect(in, JavacServer.PROTOCOL_ARGS)) {
return;
}
- ArrayList<String> the_options = new ArrayList<String>();
- ArrayList<File> the_classes = new ArrayList<File>();
+ ArrayList<String> the_options = new ArrayList<>();
+ ArrayList<File> the_classes = new ArrayList<>();
Iterable<File> path = Arrays.<File> asList(new File(cwd));
for (;;) {
@@ -240,7 +241,7 @@
}
// Load sources to compile
- Set<URI> sourcesToCompile = new HashSet<URI>();
+ Set<URI> sourcesToCompile = new HashSet<>();
for (;;) {
String l = in.readLine();
if (l == null)
@@ -255,7 +256,7 @@
}
}
// Load visible sources
- Set<URI> visibleSources = new HashSet<URI>();
+ Set<URI> 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<JavaFileObject> compilationUnits =
- new com.sun.tools.javac.util.ListBuffer<JavaFileObject>();
+ ListBuffer<JavaFileObject> 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<File> sourcesToCompileFiles =
- new com.sun.tools.javac.util.ListBuffer<File>();
+ ListBuffer<File> sourcesToCompileFiles = new ListBuffer<>();
for (URI u : sourcesToCompile) {
sourcesToCompileFiles.append(new File(u));
}
--- 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<String, PortFile>();
+ 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<String> wincmd = new ArrayList<String>();
+ ArrayList<String> 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<URI>();
+ 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<String>();
+ lastPackageSet = new HashSet<>();
packageDependencies.put(pkg, lastPackageSet);
} else if (l.length() > 1 && lastPackageSet != null) {
lastPackageSet.add(l.substring(1));
}
}
// Load package pubapis
- Map<String, StringBuffer> tmp = new HashMap<String, StringBuffer>();
+ Map<String, StringBuffer> tmp = new HashMap<>();
StringBuffer lastPublicApi = null;
for (;;) {
String l = in.readLine();
--- 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<String> arrayToSet(String[] array) {
assert array != null;
- Set<String> set = new HashSet<String>(array.length);
+ Set<String> set = new HashSet<>(array.length);
for (String s : array)
set.add(s);
return Collections.unmodifiableSet(set);
--- 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<String> keywords;
static {
- Set<String> s = new HashSet<String>();
+ Set<String> s = new HashSet<>();
String [] kws = {
"abstract", "continue", "for", "new", "switch",
"assert", "default", "if", "package", "synchronized",
--- 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<TypeMirror> tmp = (new ArrayList<TypeMirror>());
+ List<TypeMirror> tmp = (new ArrayList<>());
tmp.add(type);
types = Collections.unmodifiableList(tmp);
}
@@ -68,7 +68,7 @@
public MirroredTypesException(List<? extends TypeMirror> types) {
super("Attempt to access Class objects for TypeMirrors " +
(types = // defensive copy
- new ArrayList<TypeMirror>(types)).toString() );
+ new ArrayList<>(types)).toString() );
this.types = Collections.unmodifiableList(types);
}
--- 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 <E extends Element> List<E> listFilter(Iterable<? extends Element> elements,
Set<ElementKind> targetKinds,
Class<E> clazz) {
- List<E> list = new ArrayList<E>();
+ List<E> list = new ArrayList<>();
for (Element e : elements) {
if (targetKinds.contains(e.getKind()))
list.add(clazz.cast(e));
@@ -200,7 +200,7 @@
Set<ElementKind> targetKinds,
Class<E> clazz) {
// Return set preserving iteration order of input set.
- Set<E> set = new LinkedHashSet<E>();
+ Set<E> set = new LinkedHashSet<>();
for (Element e : elements) {
if (targetKinds.contains(e.getKind()))
set.add(clazz.cast(e));
--- 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<S> implements DiagnosticListener<S> {
- private List<Diagnostic<? extends S>> diagnostics =
- Collections.synchronizedList(new ArrayList<Diagnostic<? extends S>>());
+ private List<Diagnostic<? extends S>> diagnostics = Collections.synchronizedList(new ArrayList<>());
public void report(Diagnostic<? extends S> diagnostic) {
diagnostic.getClass(); // null check
--- 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.
--- 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<String,Location> locations
- = new ConcurrentHashMap<String,Location>();
+ = new ConcurrentHashMap<>();
public String getName() { return name(); }
--- 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<String, Reference<Class<?>>> toolClasses = new HashMap<String, Reference<Class<?>>>();
+ private Map<String, Reference<Class<?>>> 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<Class<?>>(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<ClassLoader>(cl);
+ refToolClassLoader = new WeakReference<>(cl);
}
return Class.forName(toolClassName, false, cl);