From 504b3c4c65c6a2ccfeeb1501eff7a29f5a3dbec3 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 5 Sep 2016 12:33:39 +0300 Subject: Use diamond operator where it can be used Does not modify compatibility packages to keep to closer to Vaadin 7.7 Change-Id: Ic9c4944eb90218290545a04ecd7455eb63910012 --- .../java/com/vaadin/sass/linker/SassLinker.java | 2 +- .../ConnectorBundleLoaderFactory.java | 20 ++++----- .../widgetsetutils/metadata/ConnectorBundle.java | 50 +++++++++++----------- .../widgetsetutils/metadata/FieldProperty.java | 6 +-- .../widgetsetutils/metadata/MethodProperty.java | 6 +-- .../java/com/vaadin/tools/CvalAddonsChecker.java | 2 +- 6 files changed, 43 insertions(+), 43 deletions(-) (limited to 'client-compiler') diff --git a/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java b/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java index df87cbcba1..e411b27d00 100644 --- a/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java +++ b/client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java @@ -63,7 +63,7 @@ public class SassLinker extends AbstractLinker { ArtifactSet toReturn = new ArtifactSet(artifacts); // The temporary scss files provided from the artefacts - List scssFiles = new ArrayList(); + List scssFiles = new ArrayList<>(); // The public files are provided as inputstream, but the compiler // needs real files, as they can contain references to other diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java index 50b9bf4b05..7e8da70ac8 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java @@ -100,7 +100,7 @@ public class ConnectorBundleLoaderFactory extends Generator { this.target = target; this.baseName = baseName; this.splitSize = splitSize; - methodNames = new ArrayList(); + methodNames = new ArrayList<>(); methodNames.add(baseName); } @@ -421,13 +421,13 @@ public class ConnectorBundleLoaderFactory extends Generator { private void detectBadProperties(ConnectorBundle bundle, TreeLogger logger) throws UnableToCompleteException { - Map> definedProperties = new HashMap>(); + Map> definedProperties = new HashMap<>(); for (Property property : bundle.getNeedsProperty()) { JClassType beanType = property.getBeanType(); Set usedPropertyNames = definedProperties.get(beanType); if (usedPropertyNames == null) { - usedPropertyNames = new HashSet(); + usedPropertyNames = new HashSet<>(); definedProperties.put(beanType, usedPropertyNames); } @@ -532,7 +532,7 @@ public class ConnectorBundleLoaderFactory extends Generator { + connector.getName()); // Build map to speed up error checking - HashMap stateProperties = new HashMap(); + HashMap stateProperties = new HashMap<>(); JClassType stateType = ConnectorBundle .findInheritedMethod(connector, "getState").getReturnType() .isClassOrInterface(); @@ -603,7 +603,7 @@ public class ConnectorBundleLoaderFactory extends Generator { private void writeSuperClasses(SplittingSourceWriter w, ConnectorBundle bundle) { - List needsSuperclass = new ArrayList( + List needsSuperclass = new ArrayList<>( bundle.getNeedsSuperclass()); // Emit in hierarchy order to ensure superclass is defined when // referenced @@ -1092,7 +1092,7 @@ public class ConnectorBundleLoaderFactory extends Generator { TypeOracle typeOracle) throws NotFoundException, UnableToCompleteException { - Map> connectorsByLoadStyle = new HashMap>(); + Map> connectorsByLoadStyle = new HashMap<>(); for (LoadStyle loadStyle : LoadStyle.values()) { connectorsByLoadStyle.put(loadStyle, new ArrayList()); } @@ -1109,7 +1109,7 @@ public class ConnectorBundleLoaderFactory extends Generator { } } - List bundles = new ArrayList(); + List bundles = new ArrayList<>(); Collection visitors = getVisitors(typeOracle); @@ -1187,10 +1187,10 @@ public class ConnectorBundleLoaderFactory extends Generator { JClassType[] types = serverConnectorType.getSubtypes(); - Map mappings = new TreeMap(); + Map mappings = new TreeMap<>(); // Keep track of what has happened to avoid logging intermediate state - Map> replaced = new TreeMap>( + Map> replaced = new TreeMap<>( ConnectorBundle.jClassComparator); for (JClassType type : types) { @@ -1229,7 +1229,7 @@ public class ConnectorBundleLoaderFactory extends Generator { List previousReplacements = replaced .remove(superclass); if (previousReplacements == null) { - previousReplacements = new ArrayList(); + previousReplacements = new ArrayList<>(); } previousReplacements.add(superclass); diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java index f26aa14ead..7428c643c9 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java @@ -80,10 +80,10 @@ public class ConnectorBundle { private final Collection visitors; private final Map customSerializers; - private final Set hasSerializeSupport = new HashSet(); - private final Set needsSerializeSupport = new HashSet(); + private final Set hasSerializeSupport = new HashSet<>(); + private final Set needsSerializeSupport = new HashSet<>(); - private final Map serializers = new TreeMap( + private final Map serializers = new TreeMap<>( new Comparator() { @Override public int compare(JType o1, JType o2) { @@ -91,32 +91,32 @@ public class ConnectorBundle { } }); - private final Map>> methodAttributes = new TreeMap>>( + private final Map>> methodAttributes = new TreeMap<>( jClassComparator); - private final Set needsSuperClass = new TreeSet( + private final Set needsSuperClass = new TreeSet<>( jClassComparator); - private final Set needsGwtConstructor = new TreeSet( + private final Set needsGwtConstructor = new TreeSet<>( jClassComparator); - private final Set visitedTypes = new HashSet(); + private final Set visitedTypes = new HashSet<>(); - private final Set needsProxySupport = new TreeSet( + private final Set needsProxySupport = new TreeSet<>( jClassComparator); - private final Map presentationTypes = new TreeMap( + private final Map presentationTypes = new TreeMap<>( jClassComparator); - private final Map> identifiers = new TreeMap>( + private final Map> identifiers = new TreeMap<>( jClassComparator); - private final Map> needsReturnType = new TreeMap>( + private final Map> needsReturnType = new TreeMap<>( jClassComparator); - private final Map> needsInvoker = new TreeMap>( + private final Map> needsInvoker = new TreeMap<>( jClassComparator); - private final Map> needsParamTypes = new TreeMap>( + private final Map> needsParamTypes = new TreeMap<>( jClassComparator); - private final Map> needsOnStateChange = new TreeMap>( + private final Map> needsOnStateChange = new TreeMap<>( jClassComparator); - private final Set needsProperty = new TreeSet(); - private final Map> needsDelegateToWidget = new TreeMap>( + private final Set needsProperty = new TreeSet<>(); + private final Map> needsDelegateToWidget = new TreeMap<>( jClassComparator); private ConnectorBundle(String name, ConnectorBundle previousBundle, @@ -140,7 +140,7 @@ public class ConnectorBundle { private static Map findCustomSerializers( TypeOracle oracle) throws NotFoundException { - Map serializers = new HashMap(); + Map serializers = new HashMap<>(); JClassType serializerInterface = oracle .findType(JSONSerializer.class.getName()); @@ -406,7 +406,7 @@ public class ConnectorBundle { } public Collection getProperties(JClassType type) { - Set properties = new TreeSet(); + Set properties = new TreeSet<>(); properties.addAll(MethodProperty.findProperties(type)); properties.addAll(FieldProperty.findProperties(type)); @@ -518,7 +518,7 @@ public class ConnectorBundle { private void addMapping(Map> map, K key, String value) { Set set = map.get(key); if (set == null) { - set = new TreeSet(); + set = new TreeSet<>(); map.put(key, set); } set.add(value); @@ -528,7 +528,7 @@ public class ConnectorBundle { JMethod value) { Set set = map.get(key); if (set == null) { - set = new TreeSet(jMethodComparator); + set = new TreeSet<>(jMethodComparator); map.put(key, set); } set.add(value); @@ -595,7 +595,7 @@ public class ConnectorBundle { Map> typeData = methodAttributes .get(type); if (typeData == null) { - typeData = new TreeMap>( + typeData = new TreeMap<>( jMethodComparator); methodAttributes.put(type, typeData); } @@ -603,14 +603,14 @@ public class ConnectorBundle { Map> methods = methodAttributes .get(type); if (methods == null) { - methods = new TreeMap>( + methods = new TreeMap<>( jMethodComparator); methodAttributes.put(type, methods); } Set attributes = methods.get(method); if (attributes == null) { - attributes = new TreeSet(); + attributes = new TreeSet<>(); methods.put(method, attributes); } @@ -640,7 +640,7 @@ public class ConnectorBundle { } } - private static Set> frameworkHandledTypes = new LinkedHashSet>(); + private static Set> frameworkHandledTypes = new LinkedHashSet<>(); { frameworkHandledTypes.add(String.class); frameworkHandledTypes.add(Boolean.class); @@ -687,7 +687,7 @@ public class ConnectorBundle { public void setNeedsDelegateToWidget(Property property, JClassType type) { if (!isNeedsDelegateToWidget(type)) { - TreeSet set = new TreeSet(); + TreeSet set = new TreeSet<>(); set.add(property); needsDelegateToWidget.put(type, set); } else if (!needsDelegateToWidget.get(type).contains(property)) { diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java index ee328354d4..a001f591c1 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java @@ -61,7 +61,7 @@ public class FieldProperty extends Property { } public static Collection findProperties(JClassType type) { - Collection properties = new ArrayList(); + Collection properties = new ArrayList<>(); List fields = getPublicFields(type); for (JField field : fields) { @@ -72,8 +72,8 @@ public class FieldProperty extends Property { } private static List getPublicFields(JClassType type) { - Set names = new HashSet(); - ArrayList fields = new ArrayList(); + Set names = new HashSet<>(); + ArrayList fields = new ArrayList<>(); for (JClassType subType : type.getFlattenedSupertypeHierarchy()) { JField[] subFields = subType.getFields(); for (JField field : subFields) { diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java index 65ccef8149..bd8e487cbf 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java @@ -48,9 +48,9 @@ public class MethodProperty extends Property { } public static Collection findProperties(JClassType type) { - Collection properties = new ArrayList(); + Collection properties = new ArrayList<>(); - Set getters = new HashSet(); + Set getters = new HashSet<>(); List setters = getSetters(type, getters); for (JMethod setter : setters) { String getter = findGetter(type, setter); @@ -72,7 +72,7 @@ public class MethodProperty extends Property { */ private static List getSetters(JClassType beanType, Set getters) { - List setterMethods = new ArrayList(); + List setterMethods = new ArrayList<>(); while (beanType != null && !beanType.getQualifiedSourceName() .equals(Object.class.getName())) { diff --git a/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java b/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java index 8f6e7130c3..027747fd09 100644 --- a/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java +++ b/client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java @@ -84,7 +84,7 @@ public final class CvalAddonsChecker { * generate nag messages in the UI. */ public List run() throws InvalidCvalException { - List ret = new ArrayList(); + List ret = new ArrayList<>(); try { // Visit all MANIFEST in our classpath Enumeration manifests = Thread.currentThread() -- cgit v1.2.3