diff options
author | Artur Signell <artur@vaadin.com> | 2016-09-05 12:33:39 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2016-09-05 10:02:48 +0000 |
commit | 504b3c4c65c6a2ccfeeb1501eff7a29f5a3dbec3 (patch) | |
tree | e65c1813439a25bbab6c81e71c27ba8ccf69970b | |
parent | 6941d683eb15a8ae10e0d302bcf9608be8825f8a (diff) | |
download | vaadin-framework-504b3c4c65c6a2ccfeeb1501eff7a29f5a3dbec3.tar.gz vaadin-framework-504b3c4c65c6a2ccfeeb1501eff7a29f5a3dbec3.zip |
Use diamond operator where it can be used
Does not modify compatibility packages to keep to closer to Vaadin 7.7
Change-Id: Ic9c4944eb90218290545a04ecd7455eb63910012
456 files changed, 1039 insertions, 1039 deletions
diff --git a/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java b/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java index 5d92b499fe..72c10e892f 100644 --- a/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java +++ b/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java @@ -56,7 +56,7 @@ public class FetchReleaseNotesAuthors { new InputStreamReader(p.getInputStream())); String line = ""; - List<String> authors = new ArrayList<String>(); + List<String> authors = new ArrayList<>(); while ((line = b.readLine()) != null) { String author = line; if (authorMap.containsKey(author)) { diff --git a/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java b/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java index 9f51bbf47f..7865770be8 100644 --- a/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java +++ b/all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java @@ -39,7 +39,7 @@ public class FetchReleaseNotesTickets { } String milestone = ""; - List<String> versions = new ArrayList<String>(); + List<String> versions = new ArrayList<>(); for (String version : versionsProperty.split(" ")) { if (version.endsWith(".0") || version.matches(".*\\.rc\\d+")) { // Find all prerelease versions for final or rc @@ -63,7 +63,7 @@ public class FetchReleaseNotesTickets { } private static List<String> findPrereleaseVersions(String baseVersion) { - List<String> versions = new ArrayList<String>(); + List<String> versions = new ArrayList<>(); for (int i = 0; i < 50; i++) { versions.add(baseVersion + ".alpha" + i); diff --git a/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java b/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java index 0db7609f69..9717c35353 100644 --- a/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java +++ b/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java @@ -62,7 +62,7 @@ public class GeneratePackageExports { } // Accepted packages - List<String> acceptedPackagePrefixes = new ArrayList<String>(); + List<String> acceptedPackagePrefixes = new ArrayList<>(); for (int i = 1; i < args.length; i++) { acceptedPackagePrefixes.add(args[i]); } @@ -179,7 +179,7 @@ public class GeneratePackageExports { private static HashSet<String> getPackages(JarFile jar, List<String> acceptedPackagePrefixes, boolean includeNumberPackages) { - HashSet<String> packages = new HashSet<String>(); + HashSet<String> packages = new HashSet<>(); Pattern startsWithNumber = Pattern.compile("\\.\\d"); 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<FileInfo> scssFiles = new ArrayList<FileInfo>(); + List<FileInfo> 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<String>(); + 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<JClassType, Set<String>> definedProperties = new HashMap<JClassType, Set<String>>(); + Map<JClassType, Set<String>> definedProperties = new HashMap<>(); for (Property property : bundle.getNeedsProperty()) { JClassType beanType = property.getBeanType(); Set<String> usedPropertyNames = definedProperties.get(beanType); if (usedPropertyNames == null) { - usedPropertyNames = new HashSet<String>(); + 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<String, Property> stateProperties = new HashMap<String, Property>(); + HashMap<String, Property> 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<JClassType> needsSuperclass = new ArrayList<JClassType>( + List<JClassType> 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<LoadStyle, Collection<JClassType>> connectorsByLoadStyle = new HashMap<LoadStyle, Collection<JClassType>>(); + Map<LoadStyle, Collection<JClassType>> connectorsByLoadStyle = new HashMap<>(); for (LoadStyle loadStyle : LoadStyle.values()) { connectorsByLoadStyle.put(loadStyle, new ArrayList<JClassType>()); } @@ -1109,7 +1109,7 @@ public class ConnectorBundleLoaderFactory extends Generator { } } - List<ConnectorBundle> bundles = new ArrayList<ConnectorBundle>(); + List<ConnectorBundle> bundles = new ArrayList<>(); Collection<TypeVisitor> visitors = getVisitors(typeOracle); @@ -1187,10 +1187,10 @@ public class ConnectorBundleLoaderFactory extends Generator { JClassType[] types = serverConnectorType.getSubtypes(); - Map<String, JClassType> mappings = new TreeMap<String, JClassType>(); + Map<String, JClassType> mappings = new TreeMap<>(); // Keep track of what has happened to avoid logging intermediate state - Map<JClassType, List<JClassType>> replaced = new TreeMap<JClassType, List<JClassType>>( + Map<JClassType, List<JClassType>> replaced = new TreeMap<>( ConnectorBundle.jClassComparator); for (JClassType type : types) { @@ -1229,7 +1229,7 @@ public class ConnectorBundleLoaderFactory extends Generator { List<JClassType> previousReplacements = replaced .remove(superclass); if (previousReplacements == null) { - previousReplacements = new ArrayList<JClassType>(); + 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<TypeVisitor> visitors; private final Map<JType, JClassType> customSerializers; - private final Set<JType> hasSerializeSupport = new HashSet<JType>(); - private final Set<JType> needsSerializeSupport = new HashSet<JType>(); + private final Set<JType> hasSerializeSupport = new HashSet<>(); + private final Set<JType> needsSerializeSupport = new HashSet<>(); - private final Map<JType, GeneratedSerializer> serializers = new TreeMap<JType, GeneratedSerializer>( + private final Map<JType, GeneratedSerializer> serializers = new TreeMap<>( new Comparator<JType>() { @Override public int compare(JType o1, JType o2) { @@ -91,32 +91,32 @@ public class ConnectorBundle { } }); - private final Map<JClassType, Map<JMethod, Set<MethodAttribute>>> methodAttributes = new TreeMap<JClassType, Map<JMethod, Set<MethodAttribute>>>( + private final Map<JClassType, Map<JMethod, Set<MethodAttribute>>> methodAttributes = new TreeMap<>( jClassComparator); - private final Set<JClassType> needsSuperClass = new TreeSet<JClassType>( + private final Set<JClassType> needsSuperClass = new TreeSet<>( jClassComparator); - private final Set<JClassType> needsGwtConstructor = new TreeSet<JClassType>( + private final Set<JClassType> needsGwtConstructor = new TreeSet<>( jClassComparator); - private final Set<JClassType> visitedTypes = new HashSet<JClassType>(); + private final Set<JClassType> visitedTypes = new HashSet<>(); - private final Set<JClassType> needsProxySupport = new TreeSet<JClassType>( + private final Set<JClassType> needsProxySupport = new TreeSet<>( jClassComparator); - private final Map<JClassType, JType> presentationTypes = new TreeMap<JClassType, JType>( + private final Map<JClassType, JType> presentationTypes = new TreeMap<>( jClassComparator); - private final Map<JClassType, Set<String>> identifiers = new TreeMap<JClassType, Set<String>>( + private final Map<JClassType, Set<String>> identifiers = new TreeMap<>( jClassComparator); - private final Map<JClassType, Set<JMethod>> needsReturnType = new TreeMap<JClassType, Set<JMethod>>( + private final Map<JClassType, Set<JMethod>> needsReturnType = new TreeMap<>( jClassComparator); - private final Map<JClassType, Set<JMethod>> needsInvoker = new TreeMap<JClassType, Set<JMethod>>( + private final Map<JClassType, Set<JMethod>> needsInvoker = new TreeMap<>( jClassComparator); - private final Map<JClassType, Set<JMethod>> needsParamTypes = new TreeMap<JClassType, Set<JMethod>>( + private final Map<JClassType, Set<JMethod>> needsParamTypes = new TreeMap<>( jClassComparator); - private final Map<JClassType, Set<JMethod>> needsOnStateChange = new TreeMap<JClassType, Set<JMethod>>( + private final Map<JClassType, Set<JMethod>> needsOnStateChange = new TreeMap<>( jClassComparator); - private final Set<Property> needsProperty = new TreeSet<Property>(); - private final Map<JClassType, Set<Property>> needsDelegateToWidget = new TreeMap<JClassType, Set<Property>>( + private final Set<Property> needsProperty = new TreeSet<>(); + private final Map<JClassType, Set<Property>> needsDelegateToWidget = new TreeMap<>( jClassComparator); private ConnectorBundle(String name, ConnectorBundle previousBundle, @@ -140,7 +140,7 @@ public class ConnectorBundle { private static Map<JType, JClassType> findCustomSerializers( TypeOracle oracle) throws NotFoundException { - Map<JType, JClassType> serializers = new HashMap<JType, JClassType>(); + Map<JType, JClassType> serializers = new HashMap<>(); JClassType serializerInterface = oracle .findType(JSONSerializer.class.getName()); @@ -406,7 +406,7 @@ public class ConnectorBundle { } public Collection<Property> getProperties(JClassType type) { - Set<Property> properties = new TreeSet<Property>(); + Set<Property> properties = new TreeSet<>(); properties.addAll(MethodProperty.findProperties(type)); properties.addAll(FieldProperty.findProperties(type)); @@ -518,7 +518,7 @@ public class ConnectorBundle { private <K> void addMapping(Map<K, Set<String>> map, K key, String value) { Set<String> set = map.get(key); if (set == null) { - set = new TreeSet<String>(); + set = new TreeSet<>(); map.put(key, set); } set.add(value); @@ -528,7 +528,7 @@ public class ConnectorBundle { JMethod value) { Set<JMethod> set = map.get(key); if (set == null) { - set = new TreeSet<JMethod>(jMethodComparator); + set = new TreeSet<>(jMethodComparator); map.put(key, set); } set.add(value); @@ -595,7 +595,7 @@ public class ConnectorBundle { Map<JMethod, Set<MethodAttribute>> typeData = methodAttributes .get(type); if (typeData == null) { - typeData = new TreeMap<JMethod, Set<MethodAttribute>>( + typeData = new TreeMap<>( jMethodComparator); methodAttributes.put(type, typeData); } @@ -603,14 +603,14 @@ public class ConnectorBundle { Map<JMethod, Set<MethodAttribute>> methods = methodAttributes .get(type); if (methods == null) { - methods = new TreeMap<JMethod, Set<MethodAttribute>>( + methods = new TreeMap<>( jMethodComparator); methodAttributes.put(type, methods); } Set<MethodAttribute> attributes = methods.get(method); if (attributes == null) { - attributes = new TreeSet<MethodAttribute>(); + attributes = new TreeSet<>(); methods.put(method, attributes); } @@ -640,7 +640,7 @@ public class ConnectorBundle { } } - private static Set<Class<?>> frameworkHandledTypes = new LinkedHashSet<Class<?>>(); + private static Set<Class<?>> 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<Property> set = new TreeSet<Property>(); + TreeSet<Property> 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<FieldProperty> findProperties(JClassType type) { - Collection<FieldProperty> properties = new ArrayList<FieldProperty>(); + Collection<FieldProperty> properties = new ArrayList<>(); List<JField> fields = getPublicFields(type); for (JField field : fields) { @@ -72,8 +72,8 @@ public class FieldProperty extends Property { } private static List<JField> getPublicFields(JClassType type) { - Set<String> names = new HashSet<String>(); - ArrayList<JField> fields = new ArrayList<JField>(); + Set<String> names = new HashSet<>(); + ArrayList<JField> 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<MethodProperty> findProperties(JClassType type) { - Collection<MethodProperty> properties = new ArrayList<MethodProperty>(); + Collection<MethodProperty> properties = new ArrayList<>(); - Set<String> getters = new HashSet<String>(); + Set<String> getters = new HashSet<>(); List<JMethod> 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<JMethod> getSetters(JClassType beanType, Set<String> getters) { - List<JMethod> setterMethods = new ArrayList<JMethod>(); + List<JMethod> 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<CValUiInfo> run() throws InvalidCvalException { - List<CValUiInfo> ret = new ArrayList<CValUiInfo>(); + List<CValUiInfo> ret = new ArrayList<>(); try { // Visit all MANIFEST in our classpath Enumeration<URL> manifests = Thread.currentThread() diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java index 2221f045b2..db7900fd15 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java @@ -249,20 +249,20 @@ public class ApplicationConfiguration implements EntryPoint { private HashMap<Integer, String> unknownComponents; - private Map<Integer, Class<? extends ServerConnector>> classes = new HashMap<Integer, Class<? extends ServerConnector>>(); + private Map<Integer, Class<? extends ServerConnector>> classes = new HashMap<>(); private boolean widgetsetVersionSent = false; private static boolean moduleLoaded = false; static// TODO consider to make this hashmap per application - LinkedList<Command> callbacks = new LinkedList<Command>(); + LinkedList<Command> callbacks = new LinkedList<>(); private static int dependenciesLoading; - private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<ApplicationConnection>(); + private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<>(); - private Map<Integer, Integer> componentInheritanceMap = new HashMap<Integer, Integer>(); - private Map<Integer, String> tagToServerSideClassName = new HashMap<Integer, String>(); + private Map<Integer, Integer> componentInheritanceMap = new HashMap<>(); + private Map<Integer, String> tagToServerSideClassName = new HashMap<>(); /** * Checks whether path info in requests to the server-side service should be @@ -528,7 +528,7 @@ public class ApplicationConfiguration implements EntryPoint { if (type == null) { type = UnknownComponentConnector.class; if (unknownComponents == null) { - unknownComponents = new HashMap<Integer, String>(); + unknownComponents = new HashMap<>(); } unknownComponents.put(tag, getServerSideClassNameForTag(tag)); } @@ -572,7 +572,7 @@ public class ApplicationConfiguration implements EntryPoint { * @return Integer array of tags pointing to this classname */ public Integer[] getTagsForServerSideClassName(String classname) { - List<Integer> tags = new ArrayList<Integer>(); + List<Integer> tags = new ArrayList<>(); for (Map.Entry<Integer, String> entry : tagToServerSideClassName .entrySet()) { diff --git a/client/src/main/java/com/vaadin/client/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java index 8bc6a7460f..1fe1f83cb1 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java @@ -117,7 +117,7 @@ public class ApplicationConnection implements HasHandlers { */ public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh"; - private final HashMap<String, String> resourcesMap = new HashMap<String, String>(); + private final HashMap<String, String> resourcesMap = new HashMap<>(); private WidgetSet widgetSet; @@ -159,7 +159,7 @@ public class ApplicationConnection implements HasHandlers { public static class RequestStartingEvent extends ApplicationConnectionEvent { - public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>(); + public static Type<CommunicationHandler> TYPE = new Type<>(); public RequestStartingEvent(ApplicationConnection connection) { super(connection); @@ -179,7 +179,7 @@ public class ApplicationConnection implements HasHandlers { public static class ResponseHandlingEndedEvent extends ApplicationConnectionEvent { - public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>(); + public static Type<CommunicationHandler> TYPE = new Type<>(); public ResponseHandlingEndedEvent(ApplicationConnection connection) { super(connection); @@ -218,7 +218,7 @@ public class ApplicationConnection implements HasHandlers { super(connection); } - public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>(); + public static Type<CommunicationHandler> TYPE = new Type<>(); @Override public Type<CommunicationHandler> getAssociatedType() { @@ -246,7 +246,7 @@ public class ApplicationConnection implements HasHandlers { public static class ApplicationStoppedEvent extends GwtEvent<ApplicationStoppedHandler> { - public static Type<ApplicationStoppedHandler> TYPE = new Type<ApplicationStoppedHandler>(); + public static Type<ApplicationStoppedHandler> TYPE = new Type<>(); @Override public Type<ApplicationStoppedHandler> getAssociatedType() { diff --git a/client/src/main/java/com/vaadin/client/ComponentDetail.java b/client/src/main/java/com/vaadin/client/ComponentDetail.java index 43874a1922..ebdcc4414c 100644 --- a/client/src/main/java/com/vaadin/client/ComponentDetail.java +++ b/client/src/main/java/com/vaadin/client/ComponentDetail.java @@ -61,7 +61,7 @@ class ComponentDetail { additionalTooltips.remove(key); } else { if (additionalTooltips == null) { - additionalTooltips = new HashMap<Object, TooltipInfo>(); + additionalTooltips = new HashMap<>(); } additionalTooltips.put(key, tooltip); } diff --git a/client/src/main/java/com/vaadin/client/ComponentDetailMap.java b/client/src/main/java/com/vaadin/client/ComponentDetailMap.java index bed3ae9387..f95c1c1a83 100644 --- a/client/src/main/java/com/vaadin/client/ComponentDetailMap.java +++ b/client/src/main/java/com/vaadin/client/ComponentDetailMap.java @@ -80,7 +80,7 @@ final class ComponentDetailMap extends JavaScriptObject { }-*/; final Collection<ComponentDetail> values() { - ArrayList<ComponentDetail> list = new ArrayList<ComponentDetail>(); + ArrayList<ComponentDetail> list = new ArrayList<>(); fillWithValues(list); return list; } diff --git a/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java b/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java index f63a509161..516cd808b5 100644 --- a/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java @@ -39,7 +39,7 @@ public class ConnectorHierarchyChangeEvent /** * Type of this event, used by the event bus. */ - public static final Type<ConnectorHierarchyChangeHandler> TYPE = new Type<ConnectorHierarchyChangeHandler>(); + public static final Type<ConnectorHierarchyChangeHandler> TYPE = new Type<>(); List<ComponentConnector> oldChildren; diff --git a/client/src/main/java/com/vaadin/client/ConnectorMap.java b/client/src/main/java/com/vaadin/client/ConnectorMap.java index 8ac9fe5c8f..ab31f0c1cb 100644 --- a/client/src/main/java/com/vaadin/client/ConnectorMap.java +++ b/client/src/main/java/com/vaadin/client/ConnectorMap.java @@ -217,7 +217,7 @@ public class ConnectorMap { */ @Deprecated public ComponentConnector[] getComponentConnectors() { - ArrayList<ComponentConnector> result = new ArrayList<ComponentConnector>(); + ArrayList<ComponentConnector> result = new ArrayList<>(); JsArrayObject<ServerConnector> connectors = getConnectorsAsJsArray(); int size = connectors.size(); @@ -267,7 +267,7 @@ public class ConnectorMap { @Deprecated public Collection<? extends ServerConnector> getConnectors() { Collection<ComponentDetail> values = idToComponentDetail.values(); - ArrayList<ServerConnector> arrayList = new ArrayList<ServerConnector>( + ArrayList<ServerConnector> arrayList = new ArrayList<>( values.size()); for (ComponentDetail componentDetail : values) { arrayList.add(componentDetail.getConnector()); diff --git a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java index 04d316a4e9..4a6e474a59 100644 --- a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java +++ b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java @@ -45,9 +45,9 @@ public class JavaScriptConnectorHelper { .createObject(); private final JavaScriptObject rpcMap = JavaScriptObject.createObject(); - private final Map<String, JavaScriptObject> rpcObjects = new HashMap<String, JavaScriptObject>(); - private final Map<String, Set<String>> rpcMethods = new HashMap<String, Set<String>>(); - private final Map<Element, Map<JavaScriptObject, ElementResizeListener>> resizeListeners = new HashMap<Element, Map<JavaScriptObject, ElementResizeListener>>(); + private final Map<String, JavaScriptObject> rpcObjects = new HashMap<>(); + private final Map<String, Set<String>> rpcMethods = new HashMap<>(); + private final Map<Element, Map<JavaScriptObject, ElementResizeListener>> resizeListeners = new HashMap<>(); private JavaScriptObject connectorWrapper; private int tag; @@ -120,7 +120,7 @@ public class JavaScriptConnectorHelper { JavaScriptObject wildcardRpcObject = rpcObjects.get(""); Set<String> interfaces = rpcMethods.get(method); if (interfaces == null) { - interfaces = new HashSet<String>(); + interfaces = new HashSet<>(); rpcMethods.put(method, interfaces); attachRpcMethod(wildcardRpcObject, null, method); } @@ -155,7 +155,7 @@ public class JavaScriptConnectorHelper { protected boolean initJavaScript() { ApplicationConfiguration conf = connector.getConnection() .getConfiguration(); - ArrayList<String> attemptedNames = new ArrayList<String>(); + ArrayList<String> attemptedNames = new ArrayList<>(); Integer tag = Integer.valueOf(this.tag); while (tag != null) { String serverSideClassName = conf.getServerSideClassNameForTag(tag); @@ -260,7 +260,7 @@ public class JavaScriptConnectorHelper { Map<JavaScriptObject, ElementResizeListener> elementListeners = resizeListeners .get(element); if (elementListeners == null) { - elementListeners = new HashMap<JavaScriptObject, ElementResizeListener>(); + elementListeners = new HashMap<>(); resizeListeners.put(element, elementListeners); } diff --git a/client/src/main/java/com/vaadin/client/LayoutManager.java b/client/src/main/java/com/vaadin/client/LayoutManager.java index 48a5ae10e5..841eead561 100644 --- a/client/src/main/java/com/vaadin/client/LayoutManager.java +++ b/client/src/main/java/com/vaadin/client/LayoutManager.java @@ -46,7 +46,7 @@ public class LayoutManager { private static final boolean debugLogging = false; private ApplicationConnection connection; - private final Set<Element> measuredNonConnectorElements = new HashSet<Element>(); + private final Set<Element> measuredNonConnectorElements = new HashSet<>(); private final MeasuredSize nullSize = new MeasuredSize(); private LayoutDependencyTree currentDependencyTree; @@ -58,8 +58,8 @@ public class LayoutManager { private FastStringSet pendingOverflowFixes = FastStringSet.create(); - private final Map<Element, Collection<ElementResizeListener>> elementResizeListeners = new HashMap<Element, Collection<ElementResizeListener>>(); - private final Set<Element> listenersToFire = new HashSet<Element>(); + private final Map<Element, Collection<ElementResizeListener>> elementResizeListeners = new HashMap<>(); + private final Set<Element> listenersToFire = new HashSet<>(); private boolean layoutPending = false; private Timer layoutTimer = new Timer() { @@ -618,7 +618,7 @@ public class LayoutManager { int pendingOverflowCount = pendingOverflowConnectorsIds.length(); ConnectorMap connectorMap = ConnectorMap.get(connection); if (pendingOverflowCount > 0) { - HashMap<Element, String> originalOverflows = new HashMap<Element, String>(); + HashMap<Element, String> originalOverflows = new HashMap<>(); FastStringSet delayedOverflowFixes = FastStringSet.create(); @@ -1724,7 +1724,7 @@ public class LayoutManager { Collection<ElementResizeListener> listeners = elementResizeListeners .get(element); if (listeners == null) { - listeners = new HashSet<ElementResizeListener>(); + listeners = new HashSet<>(); elementResizeListeners.put(element, listeners); ensureMeasured(element); } diff --git a/client/src/main/java/com/vaadin/client/LocaleService.java b/client/src/main/java/com/vaadin/client/LocaleService.java index 661c885c9f..01fbeb4d2c 100644 --- a/client/src/main/java/com/vaadin/client/LocaleService.java +++ b/client/src/main/java/com/vaadin/client/LocaleService.java @@ -33,7 +33,7 @@ import com.vaadin.shared.ui.ui.UIState.LocaleData; */ public class LocaleService { - private static Map<String, LocaleData> cache = new HashMap<String, LocaleData>(); + private static Map<String, LocaleData> cache = new HashMap<>(); private static String defaultLocale; diff --git a/client/src/main/java/com/vaadin/client/Profiler.java b/client/src/main/java/com/vaadin/client/Profiler.java index 223f19b1b0..290ec8a4a9 100644 --- a/client/src/main/java/com/vaadin/client/Profiler.java +++ b/client/src/main/java/com/vaadin/client/Profiler.java @@ -89,7 +89,7 @@ public class Profiler { */ public static class Node { private final String name; - private final LinkedHashMap<String, Node> children = new LinkedHashMap<String, Node>(); + private final LinkedHashMap<String, Node> children = new LinkedHashMap<>(); private double time = 0; private int count = 0; private double enterTime = 0; @@ -462,7 +462,7 @@ public class Profiler { return; } - LinkedList<Node> stack = new LinkedList<Node>(); + LinkedList<Node> stack = new LinkedList<>(); Node rootNode = new Node(null); stack.add(rootNode); JsArray<GwtStatsEvent> gwtStatsEvents = getGwtStatsEvents(); @@ -472,7 +472,7 @@ public class Profiler { return; } - Set<Node> extendedTimeNodes = new HashSet<Node>(); + Set<Node> extendedTimeNodes = new HashSet<>(); for (int i = 0; i < gwtStatsEvents.length(); i++) { GwtStatsEvent gwtStatsEvent = gwtStatsEvents.get(i); String eventName = gwtStatsEvent.getEventName(); @@ -540,10 +540,10 @@ public class Profiler { return; } - Map<String, Node> totals = new HashMap<String, Node>(); + Map<String, Node> totals = new HashMap<>(); rootNode.sumUpTotals(totals); - ArrayList<Node> totalList = new ArrayList<Node>(totals.values()); + ArrayList<Node> totalList = new ArrayList<>(totals.values()); Collections.sort(totalList, new Comparator<Node>() { @Override public int compare(Node o1, Node o2) { @@ -584,7 +584,7 @@ public class Profiler { "domContentLoadedEventStart", "domContentLoadedEventEnd", "domComplete", "loadEventStart", "loadEventEnd" }; - LinkedHashMap<String, Double> timings = new LinkedHashMap<String, Double>(); + LinkedHashMap<String, Double> timings = new LinkedHashMap<>(); for (String key : keys) { double value = getPerformanceTiming(key); diff --git a/client/src/main/java/com/vaadin/client/ResourceLoader.java b/client/src/main/java/com/vaadin/client/ResourceLoader.java index 72274c8d42..37f6f51a4c 100644 --- a/client/src/main/java/com/vaadin/client/ResourceLoader.java +++ b/client/src/main/java/com/vaadin/client/ResourceLoader.java @@ -142,11 +142,11 @@ public class ResourceLoader { private ApplicationConnection connection; - private final Set<String> loadedResources = new HashSet<String>(); - private final Set<String> preloadedResources = new HashSet<String>(); + private final Set<String> loadedResources = new HashSet<>(); + private final Set<String> preloadedResources = new HashSet<>(); - private final Map<String, Collection<ResourceLoadListener>> loadListeners = new HashMap<String, Collection<ResourceLoadListener>>(); - private final Map<String, Collection<ResourceLoadListener>> preloadListeners = new HashMap<String, Collection<ResourceLoadListener>>(); + private final Map<String, Collection<ResourceLoadListener>> loadListeners = new HashMap<>(); + private final Map<String, Collection<ResourceLoadListener>> preloadListeners = new HashMap<>(); private final Element head; @@ -555,7 +555,7 @@ public class ResourceLoader { Map<String, Collection<ResourceLoadListener>> listenerMap) { Collection<ResourceLoadListener> listeners = listenerMap.get(url); if (listeners == null) { - listeners = new HashSet<ResourceLoader.ResourceLoadListener>(); + listeners = new HashSet<>(); listeners.add(listener); listenerMap.put(url, listeners); return true; diff --git a/client/src/main/java/com/vaadin/client/UIDL.java b/client/src/main/java/com/vaadin/client/UIDL.java index dd546eb4bb..165f0c6b05 100644 --- a/client/src/main/java/com/vaadin/client/UIDL.java +++ b/client/src/main/java/com/vaadin/client/UIDL.java @@ -121,7 +121,7 @@ public final class UIDL extends JavaScriptObject { */ public Set<String> getVariableNames() { if (!hasVariables()) { - return new HashSet<String>(); + return new HashSet<>(); } else { Set<String> keySet = var().getKeySet(); return keySet; @@ -453,7 +453,7 @@ public final class UIDL extends JavaScriptObject { * @return the value of the variable */ public Set<String> getStringArrayVariableAsSet(final String name) { - final HashSet<String> s = new HashSet<String>(); + final HashSet<String> s = new HashSet<>(); JsArrayString a = var().getJSStringArray(name); for (int i = 0; i < a.length(); i++) { s.add(a.get(i)); diff --git a/client/src/main/java/com/vaadin/client/Util.java b/client/src/main/java/com/vaadin/client/Util.java index 7d7a6483e3..553911b7b8 100644 --- a/client/src/main/java/com/vaadin/client/Util.java +++ b/client/src/main/java/com/vaadin/client/Util.java @@ -777,7 +777,7 @@ public class Util { try { getLogger().info("RPC invocations to be sent to the server:"); String curId = null; - ArrayList<MethodInvocation> invocations = new ArrayList<MethodInvocation>(); + ArrayList<MethodInvocation> invocations = new ArrayList<>(); for (MethodInvocation methodInvocation : methodInvocations) { String id = methodInvocation.getConnectorId(); diff --git a/client/src/main/java/com/vaadin/client/ValueMap.java b/client/src/main/java/com/vaadin/client/ValueMap.java index ebc387a486..119e169e82 100644 --- a/client/src/main/java/com/vaadin/client/ValueMap.java +++ b/client/src/main/java/com/vaadin/client/ValueMap.java @@ -62,7 +62,7 @@ public final class ValueMap extends JavaScriptObject { }-*/; public Set<String> getKeySet() { - final HashSet<String> attrs = new HashSet<String>(); + final HashSet<String> attrs = new HashSet<>(); JsArrayString attributeNamesArray = getKeyArray(); for (int i = 0; i < attributeNamesArray.length(); i++) { attrs.add(attributeNamesArray.get(i)); diff --git a/client/src/main/java/com/vaadin/client/WidgetMap.java b/client/src/main/java/com/vaadin/client/WidgetMap.java index 6e002b6fc2..5a2fb06a69 100644 --- a/client/src/main/java/com/vaadin/client/WidgetMap.java +++ b/client/src/main/java/com/vaadin/client/WidgetMap.java @@ -26,7 +26,7 @@ import java.util.HashMap; */ abstract class WidgetMap { - protected static HashMap<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<Class<? extends ServerConnector>, WidgetInstantiator>(); + protected static HashMap<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<>(); /** * Create a new instance of a connector based on its type. diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java index 8ba678e429..5a679e897d 100644 --- a/client/src/main/java/com/vaadin/client/WidgetUtil.java +++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java @@ -1387,7 +1387,7 @@ public class WidgetUtil { /* * Map the size units with their type. */ - private static Map<String, Unit> type2Unit = new HashMap<String, Style.Unit>(); + private static Map<String, Unit> type2Unit = new HashMap<>(); static { for (Unit unit : Unit.values()) { type2Unit.put(unit.getType(), unit); diff --git a/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java b/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java index 4de251a411..9a0eb60983 100644 --- a/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java +++ b/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java @@ -203,7 +203,7 @@ public class JsonDecoder { if (jsonMap.getType() == JsonType.ARRAY) { JsonArray array = (JsonArray) jsonMap; if (array.length() == 0) { - return new HashMap<Object, Object>(); + return new HashMap<>(); } } @@ -228,7 +228,7 @@ public class JsonDecoder { private static Map<Object, Object> decodeObjectMap(Type keyType, Type valueType, JsonArray jsonValue, ApplicationConnection connection) { - Map<Object, Object> map = new HashMap<Object, Object>(); + Map<Object, Object> map = new HashMap<>(); JsonArray keys = jsonValue.get(0); JsonArray values = jsonValue.get(1); @@ -249,7 +249,7 @@ public class JsonDecoder { private static Map<Object, Object> decodeConnectorMap(Type valueType, JsonObject jsonMap, ApplicationConnection connection) { - Map<Object, Object> map = new HashMap<Object, Object>(); + Map<Object, Object> map = new HashMap<>(); ConnectorMap connectorMap = ConnectorMap.get(connection); @@ -264,7 +264,7 @@ public class JsonDecoder { private static Map<Object, Object> decodeStringMap(Type valueType, JsonObject jsonMap, ApplicationConnection connection) { - Map<Object, Object> map = new HashMap<Object, Object>(); + Map<Object, Object> map = new HashMap<>(); for (String key : jsonMap.keys()) { Object value = decodeValue(valueType, jsonMap.get(key), null, @@ -277,7 +277,7 @@ public class JsonDecoder { private static List<Object> decodeList(Type type, JsonArray jsonArray, ApplicationConnection connection) { - List<Object> tokens = new ArrayList<Object>(); + List<Object> tokens = new ArrayList<>(); decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection, tokens); return tokens; @@ -285,7 +285,7 @@ public class JsonDecoder { private static Set<Object> decodeSet(Type type, JsonArray jsonArray, ApplicationConnection connection) { - Set<Object> tokens = new HashSet<Object>(); + Set<Object> tokens = new HashSet<>(); decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection, tokens); return tokens; diff --git a/client/src/main/java/com/vaadin/client/communication/MessageHandler.java b/client/src/main/java/com/vaadin/client/communication/MessageHandler.java index f3c84c39c3..a8e22ea53b 100644 --- a/client/src/main/java/com/vaadin/client/communication/MessageHandler.java +++ b/client/src/main/java/com/vaadin/client/communication/MessageHandler.java @@ -123,12 +123,12 @@ public class MessageHandler { * If responseHandlingLocks contains any objects, response handling is * suspended until the collection is empty or a timeout has occurred. */ - private Set<Object> responseHandlingLocks = new HashSet<Object>(); + private Set<Object> responseHandlingLocks = new HashSet<>(); /** * Contains all UIDL messages received while response handling is suspended */ - private List<PendingUIDLMessage> pendingUIDLMessages = new ArrayList<PendingUIDLMessage>(); + private List<PendingUIDLMessage> pendingUIDLMessages = new ArrayList<>(); // will hold the CSRF token once received private String csrfToken = ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE; @@ -1227,8 +1227,8 @@ public class MessageHandler { Profiler.enter( "updateConnectorHierarchy find new connectors"); - List<ServerConnector> newChildren = new ArrayList<ServerConnector>(); - List<ComponentConnector> newComponents = new ArrayList<ComponentConnector>(); + List<ServerConnector> newChildren = new ArrayList<>(); + List<ComponentConnector> newComponents = new ArrayList<>(); for (int connectorIndex = 0; connectorIndex < childConnectorSize; connectorIndex++) { String childConnectorId = childConnectorIds .get(connectorIndex); diff --git a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java index dfea30eb86..35d6f48565 100644 --- a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java +++ b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java @@ -53,7 +53,7 @@ public class ServerRpcQueue { * invocation. Without lastonly, an incremental id based on * {@link #lastInvocationTag} is used to get unique values. */ - private LinkedHashMap<String, MethodInvocation> pendingInvocations = new LinkedHashMap<String, MethodInvocation>(); + private LinkedHashMap<String, MethodInvocation> pendingInvocations = new LinkedHashMap<>(); private int lastInvocationTag = 0; diff --git a/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java b/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java index c5872866a9..0795d69b32 100644 --- a/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java @@ -38,7 +38,7 @@ public class StateChangeEvent /** * Type of this event, used by the event bus. */ - public static final Type<StateChangeHandler> TYPE = new Type<StateChangeHandler>(); + public static final Type<StateChangeHandler> TYPE = new Type<>(); /** * Used to cache a FastStringSet representation of the properties that have @@ -158,7 +158,7 @@ public class StateChangeEvent public Set<String> getChangedProperties() { if (changedPropertiesSet == null) { Profiler.enter("StateChangeEvent.getChangedProperties populate"); - changedPropertiesSet = new HashSet<String>(); + changedPropertiesSet = new HashSet<>(); getChangedPropertiesFastSet().addAllTo(changedPropertiesSet); Profiler.leave("StateChangeEvent.getChangedProperties populate"); } diff --git a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java index 9f34c3468b..2e56918ab3 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java @@ -242,7 +242,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { @Override public List<Element> getElementsByPath(String path) { // This type of search is not supported in LegacyLocator - List<Element> array = new ArrayList<Element>(); + List<Element> array = new ArrayList<>(); Element e = getElementByPath(path); if (e != null) { array.add(e); @@ -257,7 +257,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { public List<Element> getElementsByPathStartingAt(String path, Element root) { // This type of search is not supported in LegacyLocator - List<Element> array = new ArrayList<Element>(); + List<Element> array = new ArrayList<>(); Element e = getElementByPathStartingAt(path, root); if (e != null) { array.add(e); @@ -647,7 +647,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { if (widgetClassName.equals("VWindow")) { List<WindowConnector> windows = client.getUIConnector() .getSubWindows(); - List<VWindow> windowWidgets = new ArrayList<VWindow>( + List<VWindow> windowWidgets = new ArrayList<>( windows.size()); for (WindowConnector wc : windows) { windowWidgets.add(wc.getWidget()); diff --git a/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java b/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java index f76a0bc34c..f01c693c4c 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java @@ -38,7 +38,7 @@ public class SelectorPredicate { if (path.startsWith("(")) { return extractPredicates(path.substring(path.lastIndexOf(')'))); } - return new ArrayList<SelectorPredicate>(); + return new ArrayList<>(); } /** @@ -49,7 +49,7 @@ public class SelectorPredicate { * @return a List of Predicate objects */ public static List<SelectorPredicate> extractPredicates(String path) { - List<SelectorPredicate> predicates = new ArrayList<SelectorPredicate>(); + List<SelectorPredicate> predicates = new ArrayList<>(); String predicateStr = extractPredicateString(path); if (null == predicateStr || predicateStr.length() == 0) { @@ -114,7 +114,7 @@ public class SelectorPredicate { * @return List of predicate strings */ private static List<String> readPredicatesFromString(String predicateStr) { - List<String> predicates = new ArrayList<String>(); + List<String> predicates = new ArrayList<>(); int prevIdx = 0; int idx = LocatorUtil.indexOfIgnoringQuoted(predicateStr, ',', prevIdx); diff --git a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java index 3e1387b314..3ba6284cf2 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java @@ -98,7 +98,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { List<ConnectorPath> hierarchy = getConnectorHierarchyForElement( targetElement); - List<String> path = new ArrayList<String>(); + List<String> path = new ArrayList<>(); // Assemble longname path components back-to-forth with useful // predicates - first try ID, then caption. @@ -182,7 +182,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { */ private List<String> generateQueries(List<String> components) { // Prepare to loop through all the elements. - List<String> paths = new ArrayList<String>(); + List<String> paths = new ArrayList<>(); int compIdx = 0; String basePath = components.get(compIdx).replace("com.vaadin.ui.", ""); // Add a basic search for the first element (eg. //Button) @@ -243,7 +243,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { private List<ConnectorPath> getConnectorHierarchyForElement(Element elem) { Element e = elem; ComponentConnector c = Util.findPaintable(client, e); - List<ConnectorPath> connectorHierarchy = new ArrayList<ConnectorPath>(); + List<ConnectorPath> connectorHierarchy = new ArrayList<>(); while (c != null) { @@ -281,7 +281,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { path = path.substring(1, path.lastIndexOf(')')); } - List<Element> elements = new ArrayList<Element>(); + List<Element> elements = new ArrayList<>(); if (LocatorUtil.isNotificationElement(path)) { for (VNotification n : findNotificationsByPath(path)) { @@ -385,7 +385,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { */ private List<VNotification> findNotificationsByPath(String path) { - List<VNotification> notifications = new ArrayList<VNotification>(); + List<VNotification> notifications = new ArrayList<>(); for (Widget w : RootPanel.get()) { if (w instanceof VNotification) { notifications.add((VNotification) w); @@ -431,7 +431,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { connectors = Arrays.asList(root); } - List<Element> output = new ArrayList<Element>(); + List<Element> output = new ArrayList<>(); if (null != connectors && !connectors.isEmpty()) { for (ComponentConnector connector : connectors) { if (!actualRoot @@ -474,7 +474,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { String[] fragments = splitFirstFragmentFromTheRest(path); - List<ComponentConnector> connectors = new ArrayList<ComponentConnector>(); + List<ComponentConnector> connectors = new ArrayList<>(); for (ComponentConnector parent : parents) { connectors.addAll(filterMatches( collectPotentialMatches(parent, fragments[0], @@ -557,7 +557,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { private List<ComponentConnector> collectPotentialMatches( ComponentConnector parent, String pathFragment, boolean collectRecursively) { - ArrayList<ComponentConnector> potentialMatches = new ArrayList<ComponentConnector>(); + ArrayList<ComponentConnector> potentialMatches = new ArrayList<>(); String widgetName = getWidgetName(pathFragment); // Special case when searching for UIElement. if (LocatorUtil.isUIElement(pathFragment)) { @@ -585,7 +585,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { private List<String> getIDsForConnector(ComponentConnector connector) { Class<?> connectorClass = connector.getClass(); - List<String> ids = new ArrayList<String>(); + List<String> ids = new ArrayList<>(); TypeDataStore.get().findIdentifiersFor(connectorClass).addAllTo(ids); @@ -732,7 +732,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { */ private final <T> List<T> eliminateDuplicates(List<T> list) { - LinkedHashSet<T> set = new LinkedHashSet<T>(list); + LinkedHashSet<T> set = new LinkedHashSet<>(list); list.clear(); list.addAll(set); return list; diff --git a/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java b/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java index b2b3372764..d3e381f0c3 100644 --- a/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java @@ -48,7 +48,7 @@ public class DataCommunicatorConnector extends AbstractExtensionConnector { */ public class VaadinDataSource extends AbstractRemoteDataSource<JsonObject> { - private Set<String> droppedKeys = new HashSet<String>(); + private Set<String> droppedKeys = new HashSet<>(); protected VaadinDataSource() { registerRpc(DataCommunicatorClientRpc.class, @@ -61,7 +61,7 @@ public class DataCommunicatorConnector extends AbstractExtensionConnector { @Override public void setData(int firstIndex, JsonArray data) { - ArrayList<JsonObject> rows = new ArrayList<JsonObject>( + ArrayList<JsonObject> rows = new ArrayList<>( data.length()); for (int i = 0; i < data.length(); i++) { JsonObject rowObject = data.getObject(i); diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java index 9f2b8971c1..2259f47647 100644 --- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java @@ -66,7 +66,7 @@ public class GridConnector extends AbstractListingConnector protected void init() { super.init(); - new ClickSelectHandler<JsonObject>(getWidget()); + new ClickSelectHandler<>(getWidget()); getWidget().addSortHandler(this::handleSortEvent); layout(); diff --git a/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java b/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java index 71568cac7a..9cc32998b2 100644 --- a/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java +++ b/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java @@ -178,8 +178,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { private Range cached = Range.between(0, 0); - private final HashMap<Integer, T> indexToRowMap = new HashMap<Integer, T>(); - private final HashMap<Object, Integer> keyToIndexMap = new HashMap<Object, Integer>(); + private final HashMap<Integer, T> indexToRowMap = new HashMap<>(); + private final HashMap<Object, Integer> keyToIndexMap = new HashMap<>(); private Set<DataChangeHandler> dataChangeHandlers = new LinkedHashSet<>(); @@ -193,8 +193,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { } }; - private Map<Object, Integer> pinnedCounts = new HashMap<Object, Integer>(); - private Map<Object, RowHandleImpl> pinnedRows = new HashMap<Object, RowHandleImpl>(); + private Map<Object, Integer> pinnedCounts = new HashMap<>(); + private Map<Object, RowHandleImpl> pinnedRows = new HashMap<>(); // Size not yet known private int size = -1; @@ -374,7 +374,7 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { if (range.isEmpty()) { return; } - currentRequestCallback = new RequestRowsCallback<T>(this, range); + currentRequestCallback = new RequestRowsCallback<>(this, range); requestRows(range.getStart(), range.length(), currentRequestCallback); } diff --git a/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java b/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java index a33f7f8ceb..a1bcae5524 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java @@ -49,7 +49,7 @@ import com.vaadin.client.ValueMap; */ public class AnalyzeLayoutsPanel extends FlowPanel { - private List<SelectConnectorListener> listeners = new ArrayList<SelectConnectorListener>(); + private List<SelectConnectorListener> listeners = new ArrayList<>(); public void update() { clear(); @@ -79,8 +79,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel { add(new Label("Layouts analyzed, no top level problems")); } - Set<ComponentConnector> zeroHeightComponents = new HashSet<ComponentConnector>(); - Set<ComponentConnector> zeroWidthComponents = new HashSet<ComponentConnector>(); + Set<ComponentConnector> zeroHeightComponents = new HashSet<>(); + Set<ComponentConnector> zeroWidthComponents = new HashSet<>(); findZeroSizeComponents(zeroHeightComponents, zeroWidthComponents, ac.getUIConnector()); if (zeroHeightComponents.size() > 0 || zeroWidthComponents.size() > 0) { @@ -106,7 +106,7 @@ public class AnalyzeLayoutsPanel extends FlowPanel { Set<ComponentConnector> zeroSized, ApplicationConnection ac) { // keep track of already highlighted parents - HashSet<String> parents = new HashSet<String>(); + HashSet<String> parents = new HashSet<>(); for (final ComponentConnector connector : zeroSized) { final ServerConnector parent = connector.getParent(); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java b/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java index c724b95b4e..89d50a39b3 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java @@ -48,7 +48,7 @@ public class ConnectorInfoPanel extends FlowPanel { public void update(ServerConnector connector) { SharedState state = connector.getState(); - Set<String> ignoreProperties = new HashSet<String>(); + Set<String> ignoreProperties = new HashSet<>(); ignoreProperties.add("id"); String html = getRowHTML("Id", connector.getConnectorId()); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/HierarchyPanel.java b/client/src/main/java/com/vaadin/client/debug/internal/HierarchyPanel.java index d3322b64a5..e70da1188c 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/HierarchyPanel.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/HierarchyPanel.java @@ -45,7 +45,7 @@ import com.vaadin.client.Util; public class HierarchyPanel extends FlowPanel { // TODO separate click listeners for simple selection and doubleclick - private List<SelectConnectorListener> listeners = new ArrayList<SelectConnectorListener>(); + private List<SelectConnectorListener> listeners = new ArrayList<>(); public void update() { // Try to keep track of currently open nodes and reopen them diff --git a/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java b/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java index 502949d4c8..7601a39289 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java @@ -180,7 +180,7 @@ public class Highlight { static Element show(Element element, String color) { if (element != null) { if (highlights == null) { - highlights = new HashSet<Element>(); + highlights = new HashSet<>(); } Element highlight = DOM.createDiv(); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java b/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java index 5db2611b18..807b6e65bb 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java @@ -76,7 +76,7 @@ public class OptimizedWidgetsetPanel extends FlowPanel { private Set<String> getUsedConnectorNames( ApplicationConfiguration configuration) { int tag = 0; - Set<String> usedConnectors = new HashSet<String>(); + Set<String> usedConnectors = new HashSet<>(); while (true) { String serverSideClass = configuration .getServerSideClassNameForTag(tag); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java b/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java index 3291e64973..be6bd231e8 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/SelectorPath.java @@ -38,8 +38,8 @@ public class SelectorPath { private final String path; private final Element element; private final ComponentLocator locator; - private static Map<String, Integer> counter = new HashMap<String, Integer>(); - private static Map<String, String> legacyNames = new HashMap<String, String>(); + private static Map<String, Integer> counter = new HashMap<>(); + private static Map<String, String> legacyNames = new HashMap<>(); static { legacyNames.put("FilterSelect", "ComboBox"); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java b/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java index 644fde4f0c..e838c417ba 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java @@ -94,7 +94,7 @@ public class TestBenchSection implements Section { private final FlowPanel selectorPanel = new FlowPanel(); // map from full path to SelectorWidget to enable reuse of old selectors - private Map<SelectorPath, SelectorWidget> selectorWidgets = new HashMap<SelectorPath, SelectorWidget>(); + private Map<SelectorPath, SelectorWidget> selectorWidgets = new HashMap<>(); private final FlowPanel controls = new FlowPanel(); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java b/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java index 12ff06dd8b..3abc848187 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java @@ -133,7 +133,7 @@ public final class VDebugWindow extends VOverlay { protected SimplePanel content = new SimplePanel(); // sections - protected ArrayList<Section> sections = new ArrayList<Section>(); + protected ArrayList<Section> sections = new ArrayList<>(); // handles resize/move protected HandlerRegistration mouseDownHandler = null; diff --git a/client/src/main/java/com/vaadin/client/event/InputEvent.java b/client/src/main/java/com/vaadin/client/event/InputEvent.java index 762c916741..b8e14dc756 100644 --- a/client/src/main/java/com/vaadin/client/event/InputEvent.java +++ b/client/src/main/java/com/vaadin/client/event/InputEvent.java @@ -28,7 +28,7 @@ public class InputEvent extends DomEvent<InputHandler> { * Event type for InputEvent. Represents the meta-data associated with this * event. */ - private static final Type<InputHandler> TYPE = new Type<InputHandler>( + private static final Type<InputHandler> TYPE = new Type<>( "input", new InputEvent()); protected InputEvent() { diff --git a/client/src/main/java/com/vaadin/client/event/PointerCancelEvent.java b/client/src/main/java/com/vaadin/client/event/PointerCancelEvent.java index ba11b88831..921b030f60 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerCancelEvent.java +++ b/client/src/main/java/com/vaadin/client/event/PointerCancelEvent.java @@ -28,7 +28,7 @@ public class PointerCancelEvent extends PointerEvent<PointerCancelHandler> { * Event type for PointerCancelEvent. Represents the meta-data associated * with this event. */ - private static final Type<PointerCancelHandler> TYPE = new Type<PointerCancelHandler>( + private static final Type<PointerCancelHandler> TYPE = new Type<>( EventType.PointerCancel.getNativeEventName(), new PointerCancelEvent()); diff --git a/client/src/main/java/com/vaadin/client/event/PointerDownEvent.java b/client/src/main/java/com/vaadin/client/event/PointerDownEvent.java index ae8fb1f6b7..77c146cf4b 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerDownEvent.java +++ b/client/src/main/java/com/vaadin/client/event/PointerDownEvent.java @@ -28,7 +28,7 @@ public class PointerDownEvent extends PointerEvent<PointerDownHandler> { * Event type for PointerDownEvent. Represents the meta-data associated with * this event. */ - private static final Type<PointerDownHandler> TYPE = new Type<PointerDownHandler>( + private static final Type<PointerDownHandler> TYPE = new Type<>( EventType.PointerDown.getNativeEventName(), new PointerDownEvent()); /** diff --git a/client/src/main/java/com/vaadin/client/event/PointerMoveEvent.java b/client/src/main/java/com/vaadin/client/event/PointerMoveEvent.java index c957ef9e7f..b58bf66e19 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerMoveEvent.java +++ b/client/src/main/java/com/vaadin/client/event/PointerMoveEvent.java @@ -28,7 +28,7 @@ public class PointerMoveEvent extends PointerEvent<PointerMoveHandler> { * Event type for PointerMoveEvent. Represents the meta-data associated with * this event. */ - private static final Type<PointerMoveHandler> TYPE = new Type<PointerMoveHandler>( + private static final Type<PointerMoveHandler> TYPE = new Type<>( EventType.PointerMove.getNativeEventName(), new PointerMoveEvent()); /** diff --git a/client/src/main/java/com/vaadin/client/event/PointerUpEvent.java b/client/src/main/java/com/vaadin/client/event/PointerUpEvent.java index 67d64c70e8..52588c83ed 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerUpEvent.java +++ b/client/src/main/java/com/vaadin/client/event/PointerUpEvent.java @@ -28,7 +28,7 @@ public class PointerUpEvent extends PointerEvent<PointerUpHandler> { * Event type for PointerUpEvent. Represents the meta-data associated with * this event. */ - private static final Type<PointerUpHandler> TYPE = new Type<PointerUpHandler>( + private static final Type<PointerUpHandler> TYPE = new Type<>( EventType.PointerUp.getNativeEventName(), new PointerUpEvent()); /** diff --git a/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java b/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java index 9c415f5c5d..d303a549be 100644 --- a/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java @@ -34,7 +34,7 @@ import com.vaadin.ui.JavaScript; @Connect(JavaScript.class) public class JavaScriptManagerConnector extends AbstractExtensionConnector { - private Set<String> currentNames = new HashSet<String>(); + private Set<String> currentNames = new HashSet<>(); @Override protected void init() { @@ -59,7 +59,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector { removeCallback(name); } - currentNames = new HashSet<String>(newNames); + currentNames = new HashSet<>(newNames); for (String name : newNames) { addCallback(name); } diff --git a/client/src/main/java/com/vaadin/client/metadata/AsyncBundleLoader.java b/client/src/main/java/com/vaadin/client/metadata/AsyncBundleLoader.java index e9aebbd583..7217a291f8 100644 --- a/client/src/main/java/com/vaadin/client/metadata/AsyncBundleLoader.java +++ b/client/src/main/java/com/vaadin/client/metadata/AsyncBundleLoader.java @@ -30,7 +30,7 @@ public abstract class AsyncBundleLoader { private Throwable error = null; - private List<BundleLoadCallback> callbacks = new ArrayList<BundleLoadCallback>(); + private List<BundleLoadCallback> callbacks = new ArrayList<>(); private final String packageName; diff --git a/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java b/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java index b6e1cc37fc..91e85305ca 100644 --- a/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java +++ b/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java @@ -143,7 +143,7 @@ public abstract class ConnectorBundleLoader { public abstract void init(); - protected List<CValUiInfo> cvals = new ArrayList<CValUiInfo>(); + protected List<CValUiInfo> cvals = new ArrayList<>(); public void cval(String typeName) { if (!cvals.isEmpty()) { diff --git a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java index 35e73082e1..f8d6475ed7 100644 --- a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java +++ b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java @@ -260,7 +260,7 @@ public class TypeDataStore { throws NoDataException { JsArrayObject<Property> propertiesArray = getPropertiesAsArray(type); int size = propertiesArray.size(); - ArrayList<Property> properties = new ArrayList<Property>(size); + ArrayList<Property> properties = new ArrayList<>(size); for (int i = 0; i < size; i++) { properties.add(propertiesArray.get(i)); } diff --git a/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java b/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java index 4fbc39b1d8..95eff8ba5e 100644 --- a/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java +++ b/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java @@ -152,7 +152,7 @@ public abstract class ClickableRenderer<T, W extends Widget> return null; } Cell cell = container.getCell(e); - EventCellReference<T> cellReference = new EventCellReference<T>( + EventCellReference<T> cellReference = new EventCellReference<>( grid); // FIXME: Section is currently always body. Might be useful for the // future to have an actual check. diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java index 77b9e4d07d..552e4eb424 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java @@ -306,7 +306,7 @@ public abstract class AbstractConnector if (handlers != null) { Profiler.enter("AbstractConnector.onStateChanged @OnStateChange"); - HashSet<OnStateChangeMethod> invokedMethods = new HashSet<OnStateChangeMethod>(); + HashSet<OnStateChangeMethod> invokedMethods = new HashSet<>(); JsArrayString propertyNames = handlers.getKeys(); for (int i = 0; i < propertyNames.length(); i++) { diff --git a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java index b3838d54f0..703df0b96d 100644 --- a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java @@ -58,7 +58,7 @@ public class ShortcutActionHandler { ShortcutActionHandler getShortcutActionHandler(); } - private final ArrayList<ShortcutAction> actions = new ArrayList<ShortcutAction>(); + private final ArrayList<ShortcutAction> actions = new ArrayList<>(); private ApplicationConnection client; private String paintableId; diff --git a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java index 3eeffebaf8..7b22442474 100644 --- a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java +++ b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java @@ -419,7 +419,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { public static ArrayList<Element> getElements(Element scrolledElement2) { NodeList<Node> childNodes = scrolledElement2.getChildNodes(); - ArrayList<Element> l = new ArrayList<Element>(); + ArrayList<Element> l = new ArrayList<>(); for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.getItem(i); if (item.getNodeType() == Node.ELEMENT_NODE) { @@ -707,7 +707,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { } public void setElements(Element[] elements) { - scrollableElements = new HashSet<Element>(Arrays.asList(elements)); + scrollableElements = new HashSet<>(Arrays.asList(elements)); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java index ee0ba7e6ff..837b185f35 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java @@ -736,7 +736,7 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { public static class SplitterMoveEvent extends GwtEvent<SplitterMoveHandler> { - public static final Type<SplitterMoveHandler> TYPE = new Type<SplitterMoveHandler>(); + public static final Type<SplitterMoveHandler> TYPE = new Type<>(); private Widget splitPanel; diff --git a/client/src/main/java/com/vaadin/client/ui/VAccordion.java b/client/src/main/java/com/vaadin/client/ui/VAccordion.java index f726eea594..73f48639f3 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAccordion.java +++ b/client/src/main/java/com/vaadin/client/ui/VAccordion.java @@ -42,7 +42,7 @@ public class VAccordion extends VTabsheetBase { public static final String CLASSNAME = AccordionState.PRIMARY_STYLE_NAME; - private Set<Widget> widgets = new HashSet<Widget>(); + private Set<Widget> widgets = new HashSet<>(); private StackItem openTab; diff --git a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java index 82140a12fe..fa42637b55 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java @@ -50,13 +50,13 @@ public class VCustomLayout extends ComplexPanel { public static final String CLASSNAME = "v-customlayout"; /** Location-name to containing element in DOM map */ - private final HashMap<String, Element> locationToElement = new HashMap<String, Element>(); + private final HashMap<String, Element> locationToElement = new HashMap<>(); /** Location-name to contained widget map */ - final HashMap<String, Widget> locationToWidget = new HashMap<String, Widget>(); + final HashMap<String, Widget> locationToWidget = new HashMap<>(); /** Widget to captionwrapper map */ - private final HashMap<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<Widget, VCaptionWrapper>(); + private final HashMap<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<>(); /** * Unexecuted scripts loaded from the template. diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java index 615a5da2f5..2b70569234 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java @@ -477,10 +477,10 @@ public class VDragAndDropWrapper extends VCustomComponent } /** For internal use only. May be removed or replaced in the future. */ - public List<Integer> fileIds = new ArrayList<Integer>(); + public List<Integer> fileIds = new ArrayList<>(); /** For internal use only. May be removed or replaced in the future. */ - public List<VHtml5File> files = new ArrayList<VHtml5File>(); + public List<VHtml5File> files = new ArrayList<>(); private void queueFilePost(final int fileId, final VHtml5File file) { fileIds.add(fileId); diff --git a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java index ddd2f85d5f..45037f72a8 100644 --- a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java +++ b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java @@ -206,7 +206,7 @@ public class VEmbedded extends HTML { * @return */ public static Map<String, String> getParameters(UIDL uidl) { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); Iterator<Object> childIterator = uidl.getChildIterator(); while (childIterator.hasNext()) { diff --git a/client/src/main/java/com/vaadin/client/ui/VFlash.java b/client/src/main/java/com/vaadin/client/ui/VFlash.java index 4817552bae..650d4a05fc 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFlash.java +++ b/client/src/main/java/com/vaadin/client/ui/VFlash.java @@ -32,7 +32,7 @@ public class VFlash extends HTML { protected String codetype; protected String standby; protected String archive; - protected Map<String, String> embedParams = new HashMap<String, String>(); + protected Map<String, String> embedParams = new HashMap<>(); protected boolean needsRebuild = false; protected String width; protected String height; @@ -131,7 +131,7 @@ public class VFlash extends HTML { } if (!embedParams.equals(params)) { - embedParams = new HashMap<String, String>(params); + embedParams = new HashMap<>(params); needsRebuild = true; } } diff --git a/client/src/main/java/com/vaadin/client/ui/VFormLayout.java b/client/src/main/java/com/vaadin/client/ui/VFormLayout.java index 013fcbbc68..18d7d76d74 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFormLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VFormLayout.java @@ -68,7 +68,7 @@ public class VFormLayout extends SimplePanel { */ private String[] getStylesFromState(AbstractComponentState state, boolean enabled) { - List<String> styles = new ArrayList<String>(); + List<String> styles = new ArrayList<>(); if (ComponentStateUtil.hasStyles(state)) { for (String name : state.styles) { styles.add(name); @@ -88,8 +88,8 @@ public class VFormLayout extends SimplePanel { private static final int COLUMN_ERRORFLAG = 1; public static final int COLUMN_WIDGET = 2; - private HashMap<Widget, Caption> widgetToCaption = new HashMap<Widget, Caption>(); - private HashMap<Widget, ErrorFlag> widgetToError = new HashMap<Widget, ErrorFlag>(); + private HashMap<Widget, Caption> widgetToCaption = new HashMap<>(); + private HashMap<Widget, ErrorFlag> widgetToError = new HashMap<>(); public VFormLayoutTable() { DOM.setElementProperty(getElement(), "cellPadding", "0"); diff --git a/client/src/main/java/com/vaadin/client/ui/VGridLayout.java b/client/src/main/java/com/vaadin/client/ui/VGridLayout.java index 2d084f8ca0..f34c7eabde 100644 --- a/client/src/main/java/com/vaadin/client/ui/VGridLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VGridLayout.java @@ -52,7 +52,7 @@ public class VGridLayout extends ComplexPanel { public ApplicationConnection client; /** For internal use only. May be removed or replaced in the future. */ - public HashMap<Widget, Cell> widgetToCell = new HashMap<Widget, Cell>(); + public HashMap<Widget, Cell> widgetToCell = new HashMap<>(); /** For internal use only. May be removed or replaced in the future. */ public int[] columnWidths; @@ -586,12 +586,12 @@ public class VGridLayout extends ComplexPanel { } } - private LinkedList<SpanList> colSpans = new LinkedList<SpanList>(); - private LinkedList<SpanList> rowSpans = new LinkedList<SpanList>(); + private LinkedList<SpanList> colSpans = new LinkedList<>(); + private LinkedList<SpanList> rowSpans = new LinkedList<>(); private class SpanList { final int span; - List<Cell> cells = new LinkedList<Cell>(); + List<Cell> cells = new LinkedList<>(); public SpanList(int span) { this.span = span; diff --git a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java index f5e83d8550..d08301ec93 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -138,7 +138,7 @@ public class VMenuBar extends SimpleFocusablePanel public VMenuBar(boolean subMenu, VMenuBar parentMenu) { - items = new ArrayList<CustomMenuItem>(); + items = new ArrayList<>(); popup = null; visibleChildMenu = null; this.subMenu = subMenu; @@ -928,7 +928,7 @@ public class VMenuBar extends SimpleFocusablePanel } String currentStyles = super.getStyleName(); - List<String> customStyles = new ArrayList<String>(); + List<String> customStyles = new ArrayList<>(); for (String style : currentStyles.split(" ")) { if (!style.isEmpty() && !style.startsWith(primaryStyleName)) { customStyles.add(style); @@ -1594,7 +1594,7 @@ public class VMenuBar extends SimpleFocusablePanel return item.getElement(); } else { - Queue<CustomMenuItem> submenuItems = new LinkedList<CustomMenuItem>(); + Queue<CustomMenuItem> submenuItems = new LinkedList<>(); for (CustomMenuItem item : getItems()) { if (isItemNamed(item, subPart)) { return item.getElement(); diff --git a/client/src/main/java/com/vaadin/client/ui/VNotification.java b/client/src/main/java/com/vaadin/client/ui/VNotification.java index 1b530fe237..6042ff11d6 100644 --- a/client/src/main/java/com/vaadin/client/ui/VNotification.java +++ b/client/src/main/java/com/vaadin/client/ui/VNotification.java @@ -81,7 +81,7 @@ public class VNotification extends VOverlay { private static final int Z_INDEX_BASE = 20000; public static final String STYLE_SYSTEM = "system"; - private static final ArrayList<VNotification> notifications = new ArrayList<VNotification>(); + private static final ArrayList<VNotification> notifications = new ArrayList<>(); private boolean infiniteDelay = false; private int hideDelay = 0; @@ -464,7 +464,7 @@ public class VNotification extends VOverlay { public void addEventListener(EventListener listener) { if (listeners == null) { - listeners = new ArrayList<EventListener>(); + listeners = new ArrayList<>(); } listeners.add(listener); } diff --git a/client/src/main/java/com/vaadin/client/ui/VPopupView.java b/client/src/main/java/com/vaadin/client/ui/VPopupView.java index e8499a96c1..296cde28bc 100644 --- a/client/src/main/java/com/vaadin/client/ui/VPopupView.java +++ b/client/src/main/java/com/vaadin/client/ui/VPopupView.java @@ -240,7 +240,7 @@ public class VPopupView extends HTML private boolean hasHadMouseOver = false; private boolean hideOnMouseOut = true; - private final Set<Element> activeChildren = new HashSet<Element>(); + private final Set<Element> activeChildren = new HashSet<>(); private ShortcutActionHandler shortcutActionHandler; diff --git a/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java b/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java index 4ec65e889b..d52362afcc 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java +++ b/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java @@ -35,9 +35,9 @@ public abstract class VTabsheetBase extends ComplexPanel implements HasEnabled { protected ApplicationConnection client; /** For internal use only. May be removed or replaced in the future. */ - protected final ArrayList<String> tabKeys = new ArrayList<String>(); + protected final ArrayList<String> tabKeys = new ArrayList<>(); /** For internal use only. May be removed or replaced in the future. */ - protected Set<String> disabledTabKeys = new HashSet<String>(); + protected Set<String> disabledTabKeys = new HashSet<>(); /** For internal use only. May be removed or replaced in the future. */ protected int activeTabIndex = 0; diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java index c3d9e7eddf..e9767a6bac 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -77,7 +77,7 @@ import com.vaadin.shared.ui.window.WindowRole; public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, ScrollHandler, KeyDownHandler, FocusHandler, BlurHandler, Focusable { - private static ArrayList<VWindow> windowOrder = new ArrayList<VWindow>(); + private static ArrayList<VWindow> windowOrder = new ArrayList<>(); private static boolean orderingDefered; diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java index 211d5ab322..7d281186c4 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java @@ -52,7 +52,7 @@ public class VDragEvent { private int id; - private HashMap<String, Object> dropDetails = new HashMap<String, Object>(); + private HashMap<String, Object> dropDetails = new HashMap<>(); private Element elementOver; diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VLazyInitItemIdentifiers.java b/client/src/main/java/com/vaadin/client/ui/dd/VLazyInitItemIdentifiers.java index 5f25f935ce..646853bca1 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VLazyInitItemIdentifiers.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VLazyInitItemIdentifiers.java @@ -48,7 +48,7 @@ public class VLazyInitItemIdentifiers extends VAcceptCriterion { @Override public void handleResponse(boolean accepted, UIDL response) { - hashSet = new HashSet<String>(); + hashSet = new HashSet<>(); String[] stringArrayAttribute = response .getStringArrayAttribute("allowedIds"); for (int i = 0; i < stringArrayAttribute.length; i++) { diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java b/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java index 098811bb46..804d9c1bcb 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java @@ -30,7 +30,7 @@ public class VTransferable { private ComponentConnector component; - private final Map<String, Object> variables = new HashMap<String, Object>(); + private final Map<String, Object> variables = new HashMap<>(); /** * Returns the component from which the transferable is created (eg. a tree diff --git a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java index 25908910cb..038d58afd0 100644 --- a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java @@ -63,7 +63,7 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector String receiverUrl = uidl.getStringVariable(fileId); fileId = fileId.substring(4); if (getWidget().fileIdToReceiver == null) { - getWidget().fileIdToReceiver = new HashMap<String, String>(); + getWidget().fileIdToReceiver = new HashMap<>(); } if ("".equals(receiverUrl)) { Integer id = Integer.parseInt(fileId); diff --git a/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java index eccec23877..ba1d79c776 100644 --- a/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java @@ -121,7 +121,7 @@ public class FormLayoutConnector extends AbstractLayoutConnector targetWidth = Math.max(0, targetWidth); if (oldMaxWidths == null) { - oldMaxWidths = new HashMap<ComponentConnector, String>(); + oldMaxWidths = new HashMap<>(); } for (ComponentConnector child : getChildComponents()) { diff --git a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java index e80a6ee77f..03c7693979 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java @@ -725,7 +725,7 @@ public class LayoutDependencyTree { public Collection<ComponentConnector> getMeasureTargets() { JsArrayString targetIds = getMeasureTargetsJsArray(); int length = targetIds.length(); - ArrayList<ComponentConnector> targets = new ArrayList<ComponentConnector>( + ArrayList<ComponentConnector> targets = new ArrayList<>( length); ConnectorMap connectorMap = ConnectorMap.get(connection); diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java index d410a07305..61ecb051d9 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java @@ -76,7 +76,7 @@ public class MenuBar extends Widget implements PopupListener { private final Element table; private final Element outer; - private final ArrayList<MenuItem> items = new ArrayList<MenuItem>(); + private final ArrayList<MenuItem> items = new ArrayList<>(); private MenuBar parentMenu; private PopupPanel popup; private MenuItem selectedItem; diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java index 6977ec7d61..cc8e3872ad 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java @@ -102,8 +102,8 @@ public class MenuBarConnector extends AbstractComponentConnector UIDL uidlItems = uidl.getChildUIDL(1); Iterator<Object> itr = uidlItems.getChildIterator(); - Stack<Iterator<Object>> iteratorStack = new Stack<Iterator<Object>>(); - Stack<VMenuBar> menuStack = new Stack<VMenuBar>(); + Stack<Iterator<Object>> iteratorStack = new Stack<>(); + Stack<VMenuBar> menuStack = new Stack<>(); VMenuBar currentMenu = getWidget(); while (itr.hasNext()) { diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index 8a98f95e0c..1148ab90ad 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -47,7 +47,7 @@ public class VAbstractOrderedLayout extends FlowPanel { protected boolean definedHeight = false; - private Map<Widget, Slot> widgetToSlot = new HashMap<Widget, Slot>(); + private Map<Widget, Slot> widgetToSlot = new HashMap<>(); private Element expandWrapper; diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java index 1ee6e9b9f7..f0b42f76d9 100644 --- a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java @@ -40,7 +40,7 @@ public class PopupViewConnector extends AbstractHasComponentsConnector private boolean centerAfterLayout = false; - private final List<HandlerRegistration> handlerRegistration = new ArrayList<HandlerRegistration>(); + private final List<HandlerRegistration> handlerRegistration = new ArrayList<>(); @Override protected void init() { diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java index 896ba82130..06380eef28 100644 --- a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java @@ -38,7 +38,7 @@ public class VisibilityChangeEvent extends GwtEvent<VisibilityChangeHandler> { public static Type<VisibilityChangeHandler> getType() { if (TYPE == null) { - TYPE = new Type<VisibilityChangeHandler>(); + TYPE = new Type<>(); } return TYPE; } diff --git a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java index fe9c119829..ec6b86880b 100644 --- a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -133,7 +133,7 @@ public abstract class AbstractSplitPanelConnector extends if (ComponentStateUtil.hasStyles(getState())) { getWidget().componentStyleNames = getState().styles; } else { - getWidget().componentStyleNames = new LinkedList<String>(); + getWidget().componentStyleNames = new LinkedList<>(); } // Splitter updates diff --git a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java index a5301abdf1..1bd721787c 100644 --- a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java @@ -56,7 +56,7 @@ public abstract class TabsheetBaseConnector getWidget().setEnabled(isEnabled()); // Widgets in the TabSheet before update - ArrayList<Widget> oldWidgets = new ArrayList<Widget>(); + ArrayList<Widget> oldWidgets = new ArrayList<>(); for (Iterator<Widget> iterator = getWidget() .getWidgetIterator(); iterator.hasNext();) { oldWidgets.add(iterator.next()); diff --git a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java index 7c0df8761d..26f99bfb94 100644 --- a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java @@ -625,7 +625,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector * @return */ public List<WindowConnector> getSubWindows() { - ArrayList<WindowConnector> windows = new ArrayList<WindowConnector>(); + ArrayList<WindowConnector> windows = new ArrayList<>(); for (ComponentConnector child : getChildComponents()) { if (child instanceof WindowConnector) { windows.add((WindowConnector) child); diff --git a/client/src/main/java/com/vaadin/client/ui/window/WindowMoveEvent.java b/client/src/main/java/com/vaadin/client/ui/window/WindowMoveEvent.java index f5602f673e..c105b91a6c 100644 --- a/client/src/main/java/com/vaadin/client/ui/window/WindowMoveEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/window/WindowMoveEvent.java @@ -25,7 +25,7 @@ import com.google.gwt.event.shared.GwtEvent; */ public class WindowMoveEvent extends GwtEvent<WindowMoveHandler> { - private static final Type<WindowMoveHandler> TYPE = new Type<WindowMoveHandler>(); + private static final Type<WindowMoveHandler> TYPE = new Type<>(); private final int newX; private final int newY; diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java b/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java index a8bcf4d809..0105560a00 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java @@ -71,7 +71,7 @@ public class FlyweightRow implements Row { private CellIterator(final Collection<FlyweightCell> cells, final boolean attached) { - this.cells = new ArrayList<FlyweightCell>(cells); + this.cells = new ArrayList<>(cells); cellsAttached = attached; } @@ -142,7 +142,7 @@ public class FlyweightRow implements Row { private int row; private TableRowElement element; private double[] columnWidths = null; - private final List<FlyweightCell> cells = new ArrayList<FlyweightCell>(); + private final List<FlyweightCell> cells = new ArrayList<>(); public void setup(final TableRowElement e, final int row, double[] columnWidths) { diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java b/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java index a36b591fd0..0bd2ed0b9c 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java @@ -30,7 +30,7 @@ public class RowVisibilityChangeEvent /** * The type of this event. */ - public static final Type<RowVisibilityChangeHandler> TYPE = new Type<RowVisibilityChangeHandler>(); + public static final Type<RowVisibilityChangeHandler> TYPE = new Type<>(); private final Range visibleRows; diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedEvent.java b/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedEvent.java index d6657b08d3..846b0ce723 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedEvent.java @@ -29,7 +29,7 @@ public class RowHeightChangedEvent extends GwtEvent<RowHeightChangedHandler> { /** * Handler type. */ - public final static Type<RowHeightChangedHandler> TYPE = new Type<RowHeightChangedHandler>(); + public final static Type<RowHeightChangedHandler> TYPE = new Type<>(); public static final Type<RowHeightChangedHandler> getType() { return TYPE; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/DataAvailableEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/DataAvailableEvent.java index 8441a16bc5..b1ed8757d2 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/DataAvailableEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/DataAvailableEvent.java @@ -27,7 +27,7 @@ import com.vaadin.shared.Range; public class DataAvailableEvent extends GwtEvent<DataAvailableHandler> { private Range rowsAvailable; - public static final Type<DataAvailableHandler> TYPE = new Type<DataAvailableHandler>(); + public static final Type<DataAvailableHandler> TYPE = new Type<>(); public DataAvailableEvent(Range rowsAvailable) { this.rowsAvailable = rowsAvailable; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/EventCellReference.java b/client/src/main/java/com/vaadin/client/widget/grid/EventCellReference.java index 3fb266586b..a77f4ec86a 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/EventCellReference.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/EventCellReference.java @@ -38,7 +38,7 @@ public class EventCellReference<T> extends CellReference<T> { private TableCellElement element; public EventCellReference(Grid<T> grid) { - super(new RowReference<T>(grid)); + super(new RowReference<>(grid)); } /** diff --git a/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListDataSource.java b/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListDataSource.java index 584e765127..b5b6f42f3a 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListDataSource.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListDataSource.java @@ -344,7 +344,7 @@ public class ListDataSource<T> implements DataSource<T> { if (datasource == null) { throw new IllegalArgumentException("datasource cannot be null"); } - ds = new ArrayList<T>(datasource); + ds = new ArrayList<>(datasource); wrapper = new ListWrapper(); } @@ -358,9 +358,9 @@ public class ListDataSource<T> implements DataSource<T> { */ public ListDataSource(T... rows) { if (rows == null) { - ds = new ArrayList<T>(); + ds = new ArrayList<>(); } else { - ds = new ArrayList<T>(Arrays.asList(rows)); + ds = new ArrayList<>(Arrays.asList(rows)); } wrapper = new ListWrapper(); } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java b/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java index ad68e94b87..14cb2e6523 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java @@ -50,7 +50,7 @@ public class ListSorter<T> { } this.grid = grid; - comparators = new HashMap<Grid.Column<?, T>, Comparator<?>>(); + comparators = new HashMap<>(); sortHandlerRegistration = grid.addSortHandler(new SortHandler<T>() { @Override diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnReorderEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnReorderEvent.java index d1e5e6fb99..72c0eb5878 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnReorderEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnReorderEvent.java @@ -31,7 +31,7 @@ public class ColumnReorderEvent<T> extends GwtEvent<ColumnReorderHandler<T>> { /** * Handler type. */ - private final static Type<ColumnReorderHandler<?>> TYPE = new Type<ColumnReorderHandler<?>>(); + private final static Type<ColumnReorderHandler<?>> TYPE = new Type<>(); public static final Type<ColumnReorderHandler<?>> getType() { return TYPE; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnResizeEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnResizeEvent.java index bedec89519..abd369b175 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnResizeEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnResizeEvent.java @@ -32,7 +32,7 @@ public class ColumnResizeEvent<T> extends GwtEvent<ColumnResizeHandler<T>> { /** * Handler type. */ - private final static Type<ColumnResizeHandler<?>> TYPE = new Type<ColumnResizeHandler<?>>(); + private final static Type<ColumnResizeHandler<?>> TYPE = new Type<>(); private Column<?, T> column; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java index 7033c4c24b..5c7b88cc91 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java @@ -31,7 +31,7 @@ import com.vaadin.client.widgets.Grid.Column; public class ColumnVisibilityChangeEvent<T> extends GwtEvent<ColumnVisibilityChangeHandler<T>> { - private final static Type<ColumnVisibilityChangeHandler<?>> TYPE = new Type<ColumnVisibilityChangeHandler<?>>(); + private final static Type<ColumnVisibilityChangeHandler<?>> TYPE = new Type<>(); public static final Type<ColumnVisibilityChangeHandler<?>> getType() { return TYPE; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/GridEnabledEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/GridEnabledEvent.java index bb31a4d6a0..86c8e66af2 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/GridEnabledEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/GridEnabledEvent.java @@ -27,7 +27,7 @@ public class GridEnabledEvent extends GwtEvent<GridEnabledHandler> { /** * The type of this event */ - public static final Type<GridEnabledHandler> TYPE = new Type<GridEnabledHandler>(); + public static final Type<GridEnabledHandler> TYPE = new Type<>(); private final boolean enabled; public GridEnabledEvent(boolean enabled) { diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/ScrollEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/ScrollEvent.java index 37e1125bb4..97cae2f890 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/ScrollEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/ScrollEvent.java @@ -26,7 +26,7 @@ import com.google.gwt.event.shared.GwtEvent; public class ScrollEvent extends GwtEvent<ScrollHandler> { /** The type of this event */ - public static final Type<ScrollHandler> TYPE = new Type<ScrollHandler>(); + public static final Type<ScrollHandler> TYPE = new Type<>(); @Override public Type<ScrollHandler> getAssociatedType() { diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java index 09885064ae..a21adfd2a8 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/SelectAllEvent.java @@ -30,7 +30,7 @@ public class SelectAllEvent<T> extends GwtEvent<SelectAllHandler<T>> { /** * Handler type. */ - private final static Type<SelectAllHandler<?>> TYPE = new Type<SelectAllHandler<?>>();; + private final static Type<SelectAllHandler<?>> TYPE = new Type<>();; private SelectionModel.Multi<T> selectionModel; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java index 293a0a62d4..2ae8b0579d 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java @@ -639,7 +639,7 @@ public class MultiSelectionRenderer<T> @Override public Collection<String> getConsumedEvents() { - final HashSet<String> events = new HashSet<String>(); + final HashSet<String> events = new HashSet<>(); /* * this column's first interest is only to attach a NativePreventHandler diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java index 9d016d2634..8219b8998c 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java @@ -32,7 +32,7 @@ import com.vaadin.client.widgets.Grid; @SuppressWarnings("rawtypes") public class SelectionEvent<T> extends GwtEvent<SelectionHandler> { - private static final Type<SelectionHandler> eventType = new Type<SelectionHandler>(); + private static final Type<SelectionHandler> eventType = new Type<>(); private final Grid<T> grid; private final List<T> added; @@ -92,13 +92,13 @@ public class SelectionEvent<T> extends GwtEvent<SelectionHandler> { this.batched = batched; if (added != null) { - this.added = new ArrayList<T>(added); + this.added = new ArrayList<>(added); } else { this.added = Collections.emptyList(); } if (removed != null) { - this.removed = new ArrayList<T>(removed); + this.removed = new ArrayList<>(removed); } else { this.removed = Collections.emptyList(); } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelMulti.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelMulti.java index 213bd24b67..3c395560a7 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelMulti.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelMulti.java @@ -40,8 +40,8 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> private Grid<T> grid; private boolean batchStarted = false; - private final LinkedHashSet<RowHandle<T>> selectionBatch = new LinkedHashSet<RowHandle<T>>(); - private final LinkedHashSet<RowHandle<T>> deselectionBatch = new LinkedHashSet<RowHandle<T>>(); + private final LinkedHashSet<RowHandle<T>> selectionBatch = new LinkedHashSet<>(); + private final LinkedHashSet<RowHandle<T>> deselectionBatch = new LinkedHashSet<>(); /* Event handling for selection with space key */ private SpaceSelectHandler<T> spaceSelectHandler; @@ -49,7 +49,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> public SelectionModelMulti() { grid = null; renderer = null; - selectedRows = new LinkedHashSet<RowHandle<T>>(); + selectedRows = new LinkedHashSet<>(); } @Override @@ -74,8 +74,8 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> this.grid = grid; if (this.grid != null) { - spaceSelectHandler = new SpaceSelectHandler<T>(grid); - this.renderer = new MultiSelectionRenderer<T>(grid); + spaceSelectHandler = new SpaceSelectHandler<>(grid); + this.renderer = new MultiSelectionRenderer<>(grid); } else { spaceSelectHandler.removeHandler(); spaceSelectHandler = null; @@ -107,7 +107,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> @SuppressWarnings("unchecked") final LinkedHashSet<RowHandle<T>> selectedRowsClone = (LinkedHashSet<RowHandle<T>>) selectedRows .clone(); - SelectionEvent<T> event = new SelectionEvent<T>(grid, null, + SelectionEvent<T> event = new SelectionEvent<>(grid, null, getSelectedRows(), isBeingBatchSelected()); selectedRows.clear(); @@ -129,7 +129,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> throw new IllegalArgumentException("Rows cannot be null"); } - Set<T> added = new LinkedHashSet<T>(); + Set<T> added = new LinkedHashSet<>(); for (T row : rows) { RowHandle<T> handle = grid.getDataSource().getHandle(row); @@ -139,7 +139,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> } if (added.size() > 0) { - grid.fireEvent(new SelectionEvent<T>(grid, added, null, + grid.fireEvent(new SelectionEvent<>(grid, added, null, isBeingBatchSelected())); return true; @@ -153,7 +153,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> throw new IllegalArgumentException("Rows cannot be null"); } - Set<T> removed = new LinkedHashSet<T>(); + Set<T> removed = new LinkedHashSet<>(); for (T row : rows) { RowHandle<T> handle = grid.getDataSource().getHandle(row); @@ -163,7 +163,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> } if (removed.size() > 0) { - grid.fireEvent(new SelectionEvent<T>(grid, null, removed, + grid.fireEvent(new SelectionEvent<>(grid, null, removed, isBeingBatchSelected())); return true; } @@ -206,7 +206,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> @Override public Collection<T> getSelectedRows() { - Set<T> selected = new LinkedHashSet<T>(); + Set<T> selected = new LinkedHashSet<>(); for (RowHandle<T> handle : selectedRows) { selected.add(handle.getRow()); } @@ -244,7 +244,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> } deselectionBatch.clear(); - grid.fireEvent(new SelectionEvent<T>(grid, added, removed, + grid.fireEvent(new SelectionEvent<>(grid, added, removed, isBeingBatchSelected())); } @@ -264,7 +264,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> } private ArrayList<T> rowHandlesToRows(Collection<RowHandle<T>> rowHandles) { - ArrayList<T> rows = new ArrayList<T>(rowHandles.size()); + ArrayList<T> rows = new ArrayList<>(rowHandles.size()); for (RowHandle<T> handle : rowHandles) { rows.add(handle.getRow()); } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelSingle.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelSingle.java index 1e4d4538a8..1214e3f72b 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelSingle.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelSingle.java @@ -66,8 +66,8 @@ public class SelectionModelSingle<T> extends AbstractRowHandleSelectionModel<T> this.grid = grid; if (this.grid != null) { - spaceSelectHandler = new SpaceSelectHandler<T>(grid); - clickSelectHandler = new ClickSelectHandler<T>(grid); + spaceSelectHandler = new SpaceSelectHandler<>(grid); + clickSelectHandler = new ClickSelectHandler<>(grid); updateHandlerDeselectAllowed(); } else { spaceSelectHandler.removeHandler(); @@ -86,7 +86,7 @@ public class SelectionModelSingle<T> extends AbstractRowHandleSelectionModel<T> T removed = getSelectedRow(); if (selectByHandle(grid.getDataSource().getHandle(row))) { - grid.fireEvent(new SelectionEvent<T>(grid, row, removed, false)); + grid.fireEvent(new SelectionEvent<>(grid, row, removed, false)); return true; } @@ -102,7 +102,7 @@ public class SelectionModelSingle<T> extends AbstractRowHandleSelectionModel<T> if (isSelected(row)) { deselectByHandle(selectedRow); - grid.fireEvent(new SelectionEvent<T>(grid, null, row, false)); + grid.fireEvent(new SelectionEvent<>(grid, null, row, false)); return true; } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/sort/Sort.java b/client/src/main/java/com/vaadin/client/widget/grid/sort/Sort.java index cc42c61851..043bcfa4c7 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/sort/Sort.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/sort/Sort.java @@ -141,7 +141,7 @@ public class Sort { */ public List<SortOrder> build() { - List<SortOrder> order = new ArrayList<SortOrder>(count); + List<SortOrder> order = new ArrayList<>(count); Sort s = this; for (int i = count - 1; i >= 0; --i) { diff --git a/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java index 6ccb88c134..660b635eb6 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java @@ -29,7 +29,7 @@ import com.vaadin.client.widgets.Grid; */ public class SortEvent<T> extends GwtEvent<SortHandler<?>> { - private static final Type<SortHandler<?>> TYPE = new Type<SortHandler<?>>(); + private static final Type<SortHandler<?>> TYPE = new Type<>(); private final Grid<T> grid; private final List<SortOrder> order; diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index 35978b7cb0..564496e00a 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -388,7 +388,7 @@ public class Escalator extends Widget // The object to deal with one direction scrolling private class Movement { - final List<Double> speeds = new ArrayList<Double>(); + final List<Double> speeds = new ArrayList<>(); final ScrollbarBundle scroll; double position, offset, velocity, prevPos, prevTime, delta; boolean run, vertical; @@ -1277,7 +1277,7 @@ public class Escalator extends Widget * potentially need to set the widths for the cells for the * first time. */ - Map<Integer, Double> colWidths = new HashMap<Integer, Double>(); + Map<Integer, Double> colWidths = new HashMap<>(); for (int i = 0; i < getColumnConfiguration() .getColumnCount(); i++) { Double width = Double.valueOf( @@ -1307,7 +1307,7 @@ public class Escalator extends Widget final int visualIndex, final int numberOfRows) { assert isAttached() : "Can't paint rows if Escalator is not attached"; - final List<TableRowElement> addedRows = new ArrayList<TableRowElement>(); + final List<TableRowElement> addedRows = new ArrayList<>(); if (numberOfRows < 1) { return addedRows; @@ -2325,7 +2325,7 @@ public class Escalator extends Widget * * @see #sortDomElements() */ - private final LinkedList<TableRowElement> visualRowOrder = new LinkedList<TableRowElement>(); + private final LinkedList<TableRowElement> visualRowOrder = new LinkedList<>(); /** * The logical index of the topmost row. @@ -2792,7 +2792,7 @@ public class Escalator extends Widget * it's faster to just move idx[9] to the beginning. */ - final List<TableRowElement> removedRows = new ArrayList<TableRowElement>( + final List<TableRowElement> removedRows = new ArrayList<>( visualSourceRange.length()); for (int i = 0; i < visualSourceRange.length(); i++) { final TableRowElement tr = visualRowOrder @@ -3756,7 +3756,7 @@ public class Escalator extends Widget * the first child. */ - List<TableRowElement> orderedBodyRows = new ArrayList<TableRowElement>( + List<TableRowElement> orderedBodyRows = new ArrayList<>( visualRowOrder); Map<Integer, SpacerContainer.SpacerImpl> spacers = body.spacerContainer .getSpacers(); @@ -4011,7 +4011,7 @@ public class Escalator extends Widget } } - private final List<Column> columns = new ArrayList<Column>(); + private final List<Column> columns = new ArrayList<>(); private int frozenColumns = 0; /* @@ -4209,7 +4209,7 @@ public class Escalator extends Widget if (header.getRowCount() > 0 || body.getRowCount() > 0 || footer.getRowCount() > 0) { - Map<Integer, Double> colWidths = new HashMap<Integer, Double>(); + Map<Integer, Double> colWidths = new HashMap<>(); Double width = Double.valueOf(Column.DEFAULT_COLUMN_WIDTH_PX); for (int i = index; i < index + numberOfColumns; i++) { Integer col = Integer.valueOf(i); @@ -4747,7 +4747,7 @@ public class Escalator extends Widget } } - private final TreeMap<Integer, SpacerImpl> rowIndexToSpacer = new TreeMap<Integer, SpacerImpl>(); + private final TreeMap<Integer, SpacerImpl> rowIndexToSpacer = new TreeMap<>(); private SpacerUpdater spacerUpdater = SpacerUpdater.NULL; @@ -4885,7 +4885,7 @@ public class Escalator extends Widget } public Map<Integer, SpacerImpl> getSpacers() { - return new HashMap<Integer, SpacerImpl>(rowIndexToSpacer); + return new HashMap<>(rowIndexToSpacer); } /** @@ -4908,7 +4908,7 @@ public class Escalator extends Widget @SuppressWarnings("boxing") public Collection<SpacerImpl> getSpacersForRowAndAfter( int logicalRowIndex) { - return new ArrayList<SpacerImpl>( + return new ArrayList<>( rowIndexToSpacer.tailMap(logicalRowIndex, true).values()); } @@ -4936,7 +4936,7 @@ public class Escalator extends Widget public Collection<SpacerImpl> getSpacersAfterPx(final double px, final SpacerInclusionStrategy strategy) { - ArrayList<SpacerImpl> spacers = new ArrayList<SpacerImpl>( + ArrayList<SpacerImpl> spacers = new ArrayList<>( rowIndexToSpacer.values()); for (int i = 0; i < spacers.size(); i++) { @@ -5344,8 +5344,8 @@ public class Escalator extends Widget /** * A map containing cached values of an element's current top position. */ - private final Map<Element, Double> elementTopPositionMap = new HashMap<Element, Double>(); - private final Map<Element, Double> elementLeftPositionMap = new HashMap<Element, Double>(); + private final Map<Element, Double> elementTopPositionMap = new HashMap<>(); + private final Map<Element, Double> elementLeftPositionMap = new HashMap<>(); public void set(final Element e, final double x, final double y) { assert e != null : "Element was null"; diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 85c6d48942..92dc0d7043 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -441,14 +441,14 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, */ public abstract static class StaticRow<CELLTYPE extends StaticCell> { - private Map<Column<?, ?>, CELLTYPE> cells = new HashMap<Column<?, ?>, CELLTYPE>(); + private Map<Column<?, ?>, CELLTYPE> cells = new HashMap<>(); private StaticSection<?> section; /** * Map from set of spanned columns to cell meta data. */ - private Map<Set<Column<?, ?>>, CELLTYPE> cellGroups = new HashMap<Set<Column<?, ?>>, CELLTYPE>(); + private Map<Set<Column<?, ?>>, CELLTYPE> cellGroups = new HashMap<>(); /** * A custom style name for the row or null if none is set. @@ -496,7 +496,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, "You can't merge less than 2 columns together."); } - HashSet<Column<?, ?>> columnGroup = new HashSet<Column<?, ?>>(); + HashSet<Column<?, ?>> columnGroup = new HashSet<>(); // NOTE: this doesn't care about hidden columns, those are // filtered in calculateColspans() for (Column<?, ?> column : columns) { @@ -590,7 +590,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private boolean checkMergedCellIsContinuous( Set<Column<?, ?>> mergedCell) { // no matter if hidden or not, just check for continuous order - final List<Column<?, ?>> columnOrder = new ArrayList<Column<?, ?>>( + final List<Column<?, ?>> columnOrder = new ArrayList<>( section.grid.getColumns()); if (!columnOrder.containsAll(mergedCell)) { @@ -660,7 +660,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, */ void detach() { // Avoid calling detach twice for a merged cell - HashSet<CELLTYPE> cells = new HashSet<CELLTYPE>(); + HashSet<CELLTYPE> cells = new HashSet<>(); for (Column<?, ?> column : getSection().grid.getColumns()) { cells.add(getCell(column)); } @@ -672,7 +672,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private Grid<?> grid; - private List<ROWTYPE> rows = new ArrayList<ROWTYPE>(); + private List<ROWTYPE> rows = new ArrayList<>(); private boolean visible = true; @@ -1336,8 +1336,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, // Should only be added to the DOM when there's a message to show private DivElement message = DivElement.as(DOM.createDiv()); - private Map<Column<?, T>, Widget> columnToWidget = new HashMap<Column<?, T>, Widget>(); - private List<HandlerRegistration> focusHandlers = new ArrayList<HandlerRegistration>(); + private Map<Column<?, T>, Widget> columnToWidget = new HashMap<>(); + private List<HandlerRegistration> focusHandlers = new ArrayList<>(); private boolean enabled = false; private State state = State.INACTIVE; @@ -1432,7 +1432,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, }; /** A set of all the columns that display an error flag. */ - private final Set<Column<?, T>> columnErrors = new HashSet<Grid.Column<?, T>>(); + private final Set<Column<?, T>> columnErrors = new HashSet<>(); private boolean buffered = true; /** Original position of editor */ @@ -1628,7 +1628,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, throw new IllegalStateException( "Cannot cancel edit: editor is not in edit mode"); } - handler.cancel(new EditorRequestImpl<T>(grid, rowIndex, + handler.cancel(new EditorRequestImpl<>(grid, rowIndex, focusedColumnIndex, null)); doCancel(); } @@ -1674,7 +1674,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, state = State.SAVING; setButtonsEnabled(false); saveTimeout.schedule(SAVE_TIMEOUT_MS); - EditorRequest<T> request = new EditorRequestImpl<T>(grid, rowIndex, + EditorRequest<T> request = new EditorRequestImpl<>(grid, rowIndex, focusedColumnIndex, saveRequestCallback); handler.save(request); updateSelectionCheckboxesAsNeeded(true); @@ -1738,7 +1738,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (state == State.ACTIVATING) { state = State.BINDING; bindTimeout.schedule(BIND_TIMEOUT_MS); - EditorRequest<T> request = new EditorRequestImpl<T>(grid, + EditorRequest<T> request = new EditorRequestImpl<>(grid, rowIndex, columnIndex, bindRequestCallback); handler.bind(request); grid.getEscalator().setScrollLocked(Direction.VERTICAL, @@ -2269,7 +2269,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, extends KeyEvent<HANDLER> { private Grid<?> grid; - private final Type<HANDLER> associatedType = new Type<HANDLER>( + private final Type<HANDLER> associatedType = new Type<>( getBrowserEventType(), this); private final CellReference<?> targetCell; @@ -2329,7 +2329,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private Grid<?> grid; private final CellReference<?> targetCell; - private final Type<HANDLER> associatedType = new Type<HANDLER>( + private final Type<HANDLER> associatedType = new Type<>( getBrowserEventType(), this); public AbstractGridMouseEvent(Grid<?> grid, @@ -2407,7 +2407,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, */ private static final double DETAILS_ROW_INITIAL_HEIGHT = 50; - private EventCellReference<T> eventCell = new EventCellReference<T>(this); + private EventCellReference<T> eventCell = new EventCellReference<>(this); private GridKeyDownEvent keyDown = new GridKeyDownEvent(this, eventCell); private GridKeyUpEvent keyUp = new GridKeyUpEvent(this, eventCell); private GridKeyPressEvent keyPress = new GridKeyPressEvent(this, eventCell); @@ -2881,7 +2881,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, public void onValueChange( ValueChangeEvent<Boolean> event) { if (event.getValue()) { - fireEvent(new SelectAllEvent<T>(model)); + fireEvent(new SelectAllEvent<>(model)); selected = true; } else { model.deselectAll(); @@ -3231,7 +3231,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, /* Step 1: Apply all column widths as they are. */ - Map<Integer, Double> selfWidths = new LinkedHashMap<Integer, Double>(); + Map<Integer, Double> selfWidths = new LinkedHashMap<>(); List<Column<?, T>> columns = getVisibleColumns(); for (int index = 0; index < columns.size(); index++) { selfWidths.put(index, columns.get(index).getWidth()); @@ -3245,7 +3245,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * violated, fix it. */ - Map<Integer, Double> constrainedWidths = new LinkedHashMap<Integer, Double>(); + Map<Integer, Double> constrainedWidths = new LinkedHashMap<>(); for (int index = 0; index < columns.size(); index++) { Column<?, T> column = columns.get(index); @@ -3270,9 +3270,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, boolean defaultExpandRatios = true; int totalRatios = 0; double reservedPixels = 0; - final Set<Column<?, T>> columnsToExpand = new HashSet<Column<?, T>>(); - List<Column<?, T>> nonFixedColumns = new ArrayList<Column<?, T>>(); - Map<Integer, Double> columnSizes = new HashMap<Integer, Double>(); + final Set<Column<?, T>> columnsToExpand = new HashSet<>(); + List<Column<?, T>> nonFixedColumns = new ArrayList<>(); + Map<Integer, Double> columnSizes = new HashMap<>(); final List<Column<?, T>> visibleColumns = getVisibleColumns(); /* @@ -3535,7 +3535,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private static final String STRIPE_CLASSNAME = "stripe"; - private final Map<Element, Widget> elementToWidgetMap = new HashMap<Element, Widget>(); + private final Map<Element, Widget> elementToWidgetMap = new HashMap<>(); @Override public void init(Spacer spacer) { @@ -3917,7 +3917,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private final class ColumnHider { /** Map from columns to their hiding toggles, component might change */ - private HashMap<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<Grid.Column<?, T>, MenuItem>(); + private HashMap<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<>(); /** * When column is being hidden with a toggle, do not refresh toggles for @@ -4016,7 +4016,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, /** * List of columns in the grid. Order defines the visible order. */ - private List<Column<?, T>> columns = new ArrayList<Column<?, T>>(); + private List<Column<?, T>> columns = new ArrayList<>(); /** * The datasource currently in use. <em>Note:</em> it is <code>null</code> @@ -4040,7 +4040,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * Current sort order. The (private) sort() method reads this list to * determine the order in which to present rows. */ - private List<SortOrder> sortOrder = new ArrayList<SortOrder>(); + private List<SortOrder> sortOrder = new ArrayList<>(); private Renderer<Boolean> selectColumnRenderer = null; @@ -4098,7 +4098,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private DetailsGenerator detailsGenerator = DetailsGenerator.NULL; private GridSpacerUpdater gridSpacerUpdater = new GridSpacerUpdater(); /** A set keeping track of the indices of all currently open details */ - private Set<Integer> visibleDetails = new HashSet<Integer>(); + private Set<Integer> visibleDetails = new HashSet<>(); private boolean columnReorderingAllowed; @@ -4148,7 +4148,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * Map of possible drop positions for the column and the corresponding * column index. */ - private final TreeMap<Double, Integer> possibleDropPositions = new TreeMap<Double, Integer>(); + private final TreeMap<Double, Integer> possibleDropPositions = new TreeMap<>(); /** * Makes sure that drag cancel doesn't cause anything unwanted like sort */ @@ -4347,7 +4347,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, && latestColumnDropIndex != (draggedColumnIndex + colspan)) { List<Column<?, T>> columns = getColumns(); - List<Column<?, T>> reordered = new ArrayList<Column<?, T>>(); + List<Column<?, T>> reordered = new ArrayList<>(); if (draggedColumnIndex < latestColumnDropIndex) { reordered.addAll(columns.subList(0, draggedColumnIndex)); reordered.addAll( @@ -4475,8 +4475,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, int leftBound = -1; int rightBound = getColumnCount() + 1; - final HashSet<Integer> unavailableColumnDropIndices = new HashSet<Integer>(); - final List<StaticRow<?>> rows = new ArrayList<StaticRow<?>>(); + final HashSet<Integer> unavailableColumnDropIndices = new HashSet<>(); + final List<StaticRow<?>> rows = new ArrayList<>(); rows.addAll(header.getRows()); rows.addAll(footer.getRows()); for (StaticRow<?> row : rows) { @@ -5062,7 +5062,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, grid.header.updateColSpans(); grid.footer.updateColSpans(); scheduleColumnWidthRecalculator(); - this.grid.fireEvent(new ColumnVisibilityChangeEvent<T>(this, + this.grid.fireEvent(new ColumnVisibilityChangeEvent<>(this, hidden, userOriginated)); } } @@ -5725,7 +5725,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (c.getWidth() < 0) { c.setWidth(c.getWidthActual()); - fireEvent(new ColumnResizeEvent<T>( + fireEvent(new ColumnResizeEvent<>( c)); } } @@ -5736,7 +5736,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, @Override public void onComplete() { - fireEvent(new ColumnResizeEvent<T>(col)); + fireEvent(new ColumnResizeEvent<>(col)); WidgetUtil.setTextSelectionEnabled( getElement(), true); @@ -5818,7 +5818,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, escalator.getColumnConfiguration().setColumnWidth(colIndex, minWidth); - fireEvent(new ColumnResizeEvent<T>(column)); + fireEvent(new ColumnResizeEvent<>(column)); } } @@ -6228,7 +6228,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, column.reapplyWidth(); // Sink all renderer events - Set<String> events = new HashSet<String>(); + Set<String> events = new HashSet<>(); events.addAll(getConsumedEventsForRenderer(column.getRenderer())); if (column.isHidable()) { @@ -6321,7 +6321,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, */ public List<Column<?, T>> getColumns() { return Collections - .unmodifiableList(new ArrayList<Column<?, T>>(columns)); + .unmodifiableList(new ArrayList<>(columns)); } /** @@ -6333,7 +6333,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * @return A unmodifiable list of the currently visible columns in the grid */ public List<Column<?, T>> getVisibleColumns() { - ArrayList<Column<?, T>> visible = new ArrayList<Column<?, T>>(); + ArrayList<Column<?, T>> visible = new ArrayList<>(); for (Column<?, T> c : columns) { if (!c.isHidden()) { visible.add(c); @@ -6748,7 +6748,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, int oldSize = body.getRowCount(); // Hide all details. - Set<Integer> oldDetails = new HashSet<Integer>( + Set<Integer> oldDetails = new HashSet<>( visibleDetails); for (int i : oldDetails) { setDetailsVisible(i, false); @@ -7122,7 +7122,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, } private Set<String> getConsumedEventsForRenderer(Renderer<?> renderer) { - Set<String> events = new HashSet<String>(); + Set<String> events = new HashSet<>(); if (renderer instanceof ComplexRenderer) { Collection<String> consumedEvents = ((ComplexRenderer<?>) renderer) .getConsumedEvents(); @@ -7294,7 +7294,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, w = editor.getWidget(getColumn(editor.focusedColumnIndex)); } - EditorDomEvent<T> editorEvent = new EditorDomEvent<T>(event, + EditorDomEvent<T> editorEvent = new EditorDomEvent<>(event, getEventCell(), w); return getEditor().getEventHandler().handleEvent(editorEvent); @@ -7365,8 +7365,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private Point rowEventTouchStartingPoint; private CellStyleGenerator<T> cellStyleGenerator; private RowStyleGenerator<T> rowStyleGenerator; - private RowReference<T> rowReference = new RowReference<T>(this); - private CellReference<T> cellReference = new CellReference<T>(rowReference); + private RowReference<T> rowReference = new RowReference<>(this); + private CellReference<T> cellReference = new CellReference<>(rowReference); private RendererCellReference rendererCellReference = new RendererCellReference( (RowReference<Object>) rowReference); @@ -8187,7 +8187,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, */ private void sort(boolean userOriginated) { refreshHeader(); - fireEvent(new SortEvent<T>(this, + fireEvent(new SortEvent<>(this, Collections.unmodifiableList(sortOrder), userOriginated)); } @@ -8269,7 +8269,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, // Trigger ComplexRenderer.destroy for old content conf.removeColumns(0, conf.getColumnCount()); - List<Column<?, T>> newOrder = new ArrayList<Column<?, T>>(); + List<Column<?, T>> newOrder = new ArrayList<>(); if (selectionColumn != null) { newOrder.add(selectionColumn); } @@ -8547,7 +8547,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, @Override protected void onDetach() { - Set<Integer> details = new HashSet<Integer>(visibleDetails); + Set<Integer> details = new HashSet<>(visibleDetails); for (int row : details) { setDetailsVisible(row, false); } @@ -8957,7 +8957,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (container != null) { Cell cell = container.getCell(element); if (cell != null) { - EventCellReference<T> cellRef = new EventCellReference<T>(this); + EventCellReference<T> cellRef = new EventCellReference<>(this); cellRef.set(cell, getSectionFromContainer(container)); return cellRef; } diff --git a/client/src/main/java/com/vaadin/client/widgets/Overlay.java b/client/src/main/java/com/vaadin/client/widgets/Overlay.java index 0b1d317a05..e6ce34b8a7 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Overlay.java +++ b/client/src/main/java/com/vaadin/client/widgets/Overlay.java @@ -175,7 +175,7 @@ public class Overlay extends PopupPanel { */ private static final int POPUP_PANEL_ANIMATION_DURATION = 200; - private List<Command> runOnClose = new ArrayList<Command>(); + private List<Command> runOnClose = new ArrayList<>(); public Overlay() { super(); diff --git a/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java b/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java index 912abc412a..1329b7fdc9 100755 --- a/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java +++ b/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java @@ -12,7 +12,7 @@ public class DateTimeServiceTest { final long MILLISECONDS_PER_DAY = 24 * 3600 * 1000; - static Map<Date, Integer> isoWeekNumbers = new HashMap<Date, Integer>(); + static Map<Date, Integer> isoWeekNumbers = new HashMap<>(); static { isoWeekNumbers.put(getDate(2005, 02, 02), 5); diff --git a/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java b/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java index b3a4f24ebb..7d9bf530ce 100644 --- a/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java +++ b/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java @@ -32,7 +32,7 @@ public class ListDataSourceTest { @Test public void testDataSourceConstruction() throws Exception { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); assertEquals(4, ds.size()); assertEquals(0, (int) ds.getRow(0)); @@ -40,7 +40,7 @@ public class ListDataSourceTest { assertEquals(2, (int) ds.getRow(2)); assertEquals(3, (int) ds.getRow(3)); - ds = new ListDataSource<Integer>(Arrays.asList(0, 1, 2, 3)); + ds = new ListDataSource<>(Arrays.asList(0, 1, 2, 3)); assertEquals(4, ds.size()); assertEquals(0, (int) ds.getRow(0)); @@ -52,7 +52,7 @@ public class ListDataSourceTest { @Test public void testListAddOperation() throws Exception { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); DataChangeHandler handler = EasyMock .createNiceMock(DataChangeHandler.class); @@ -76,7 +76,7 @@ public class ListDataSourceTest { @Test public void testListAddAllOperation() throws Exception { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); DataChangeHandler handler = EasyMock .createNiceMock(DataChangeHandler.class); @@ -102,7 +102,7 @@ public class ListDataSourceTest { @Test public void testListRemoveOperation() throws Exception { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); DataChangeHandler handler = EasyMock .createNiceMock(DataChangeHandler.class); @@ -124,7 +124,7 @@ public class ListDataSourceTest { @Test public void testListRemoveAllOperation() throws Exception { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); DataChangeHandler handler = EasyMock .createNiceMock(DataChangeHandler.class); @@ -144,7 +144,7 @@ public class ListDataSourceTest { @Test public void testListClearOperation() throws Exception { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); DataChangeHandler handler = EasyMock .createNiceMock(DataChangeHandler.class); @@ -162,19 +162,19 @@ public class ListDataSourceTest { @Test(expected = IllegalStateException.class) public void testFetchingNonExistantItem() { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); ds.ensureAvailability(5, 1); } @Test(expected = UnsupportedOperationException.class) public void testUnsupportedIteratorRemove() { - ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); + ListDataSource<Integer> ds = new ListDataSource<>(0, 1, 2, 3); ds.asList().iterator().remove(); } @Test public void sortColumn() { - ListDataSource<Integer> ds = new ListDataSource<Integer>(3, 4, 2, 3, 1); + ListDataSource<Integer> ds = new ListDataSource<>(3, 4, 2, 3, 1); // TODO Should be simplified to sort(). No point in providing these // trivial comparators. diff --git a/server/src/main/java/com/vaadin/data/Result.java b/server/src/main/java/com/vaadin/data/Result.java index 7fb25bf9af..b82b3ff4e7 100644 --- a/server/src/main/java/com/vaadin/data/Result.java +++ b/server/src/main/java/com/vaadin/data/Result.java @@ -62,7 +62,7 @@ public interface Result<R> extends Serializable { */ public static <R> Result<R> error(String message) { Objects.requireNonNull(message, "message cannot be null"); - return new SimpleResult<R>(null, message); + return new SimpleResult<>(null, message); } /** diff --git a/server/src/main/java/com/vaadin/data/sort/Sort.java b/server/src/main/java/com/vaadin/data/sort/Sort.java index 63d152b001..fe082149e9 100644 --- a/server/src/main/java/com/vaadin/data/sort/Sort.java +++ b/server/src/main/java/com/vaadin/data/sort/Sort.java @@ -140,7 +140,7 @@ public class Sort implements Serializable { ++count; } - List<SortOrder> order = new ArrayList<SortOrder>(count); + List<SortOrder> order = new ArrayList<>(count); s = this; do { diff --git a/server/src/main/java/com/vaadin/event/ActionManager.java b/server/src/main/java/com/vaadin/event/ActionManager.java index 98b1359337..b221d17511 100644 --- a/server/src/main/java/com/vaadin/event/ActionManager.java +++ b/server/src/main/java/com/vaadin/event/ActionManager.java @@ -98,7 +98,7 @@ public class ActionManager @Override public <T extends Action & Action.Listener> void addAction(T action) { if (ownActions == null) { - ownActions = new LinkedHashSet<Action>(); + ownActions = new LinkedHashSet<>(); } if (ownActions.add(action)) { requestRepaint(); @@ -123,7 +123,7 @@ public class ActionManager if (actionHandler != null) { if (actionHandlers == null) { - actionHandlers = new LinkedHashSet<Handler>(); + actionHandlers = new LinkedHashSet<>(); } if (actionHandlers.add(actionHandler)) { @@ -165,7 +165,7 @@ public class ActionManager * removed but still exist on client side */ if (!actions.isEmpty() || clientHasActions) { - actionMapper = new KeyMapper<Action>(); + actionMapper = new KeyMapper<>(); paintTarget.addVariable((VariableOwner) viewer, "action", ""); paintTarget.startTag("actions"); @@ -240,7 +240,7 @@ public class ActionManager } private LinkedHashSet<Action> getActionSet(Object target, Object sender) { - LinkedHashSet<Action> actions = new LinkedHashSet<Action>(); + LinkedHashSet<Action> actions = new LinkedHashSet<>(); if (ownActions != null) { actions.addAll(ownActions); diff --git a/server/src/main/java/com/vaadin/event/EventRouter.java b/server/src/main/java/com/vaadin/event/EventRouter.java index 9e8051fed3..9ef6c8123b 100644 --- a/server/src/main/java/com/vaadin/event/EventRouter.java +++ b/server/src/main/java/com/vaadin/event/EventRouter.java @@ -52,7 +52,7 @@ public class EventRouter implements MethodEventSource { @Override public void addListener(Class<?> eventType, Object object, Method method) { if (listenerList == null) { - listenerList = new LinkedHashSet<ListenerMethod>(); + listenerList = new LinkedHashSet<>(); } listenerList.add(new ListenerMethod(eventType, object, method)); } @@ -66,7 +66,7 @@ public class EventRouter implements MethodEventSource { public void addListener(Class<?> eventType, Object object, String methodName) { if (listenerList == null) { - listenerList = new LinkedHashSet<ListenerMethod>(); + listenerList = new LinkedHashSet<>(); } listenerList.add(new ListenerMethod(eventType, object, methodName)); } @@ -232,7 +232,7 @@ public class EventRouter implements MethodEventSource { * are found. */ public Collection<?> getListeners(Class<?> eventType) { - List<Object> listeners = new ArrayList<Object>(); + List<Object> listeners = new ArrayList<>(); if (listenerList != null) { for (ListenerMethod lm : listenerList) { if (lm.isOrExtendsType(eventType)) { diff --git a/server/src/main/java/com/vaadin/event/SelectionEvent.java b/server/src/main/java/com/vaadin/event/SelectionEvent.java index f22f499893..b5a4d587e6 100644 --- a/server/src/main/java/com/vaadin/event/SelectionEvent.java +++ b/server/src/main/java/com/vaadin/event/SelectionEvent.java @@ -37,8 +37,8 @@ public class SelectionEvent extends EventObject { public SelectionEvent(Object source, Collection<Object> oldSelection, Collection<Object> newSelection) { super(source); - this.oldSelection = new LinkedHashSet<Object>(oldSelection); - this.newSelection = new LinkedHashSet<Object>(newSelection); + this.oldSelection = new LinkedHashSet<>(oldSelection); + this.newSelection = new LinkedHashSet<>(newSelection); } /** @@ -79,7 +79,7 @@ public class SelectionEvent extends EventObject { if (set2.isEmpty()) { return set1; } else { - LinkedHashSet<T> set = new LinkedHashSet<T>(set1); + LinkedHashSet<T> set = new LinkedHashSet<>(set1); set.removeAll(set2); return set; } diff --git a/server/src/main/java/com/vaadin/event/TransferableImpl.java b/server/src/main/java/com/vaadin/event/TransferableImpl.java index fad6adf2eb..4da28176fc 100644 --- a/server/src/main/java/com/vaadin/event/TransferableImpl.java +++ b/server/src/main/java/com/vaadin/event/TransferableImpl.java @@ -27,7 +27,7 @@ import com.vaadin.ui.Component; * @since 6.3 */ public class TransferableImpl implements Transferable { - private Map<String, Object> rawVariables = new HashMap<String, Object>(); + private Map<String, Object> rawVariables = new HashMap<>(); private Component sourceComponent; public TransferableImpl(Component sourceComponent, diff --git a/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java b/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java index cce6029159..42bff9c007 100644 --- a/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java +++ b/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java @@ -30,7 +30,7 @@ import com.vaadin.shared.MouseEventDetails; @SuppressWarnings("serial") public class TargetDetailsImpl implements TargetDetails { - private HashMap<String, Object> data = new HashMap<String, Object>(); + private HashMap<String, Object> data = new HashMap<>(); private DropTarget dropTarget; protected TargetDetailsImpl(Map<String, Object> rawDropData) { diff --git a/server/src/main/java/com/vaadin/navigator/Navigator.java b/server/src/main/java/com/vaadin/navigator/Navigator.java index 5704457f72..13e3b4c2e7 100644 --- a/server/src/main/java/com/vaadin/navigator/Navigator.java +++ b/server/src/main/java/com/vaadin/navigator/Navigator.java @@ -374,8 +374,8 @@ public class Navigator implements Serializable { private NavigationStateManager stateManager; private ViewDisplay display; private View currentView = null; - private List<ViewChangeListener> listeners = new LinkedList<ViewChangeListener>(); - private List<ViewProvider> providers = new LinkedList<ViewProvider>(); + private List<ViewChangeListener> listeners = new LinkedList<>(); + private List<ViewProvider> providers = new LinkedList<>(); private String currentNavigationState = null; private ViewProvider errorProvider; @@ -722,7 +722,7 @@ public class Navigator implements Serializable { // a copy of the listener list is needed to avoid // ConcurrentModificationException as a listener can add/remove // listeners - for (ViewChangeListener l : new ArrayList<ViewChangeListener>( + for (ViewChangeListener l : new ArrayList<>( listeners)) { if (!l.beforeViewChange(event)) { return false; @@ -786,7 +786,7 @@ public class Navigator implements Serializable { // a copy of the listener list is needed to avoid // ConcurrentModificationException as a listener can add/remove // listeners - for (ViewChangeListener l : new ArrayList<ViewChangeListener>( + for (ViewChangeListener l : new ArrayList<>( listeners)) { l.afterViewChange(event); } diff --git a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java index 676256fb5d..ea969bea2b 100644 --- a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java @@ -60,13 +60,13 @@ public abstract class AbstractClientConnector * A map from client to server RPC interface class name to the RPC call * manager that handles incoming RPC calls for that interface. */ - private Map<String, ServerRpcManager<?>> rpcManagerMap = new HashMap<String, ServerRpcManager<?>>(); + private Map<String, ServerRpcManager<?>> rpcManagerMap = new HashMap<>(); /** * A map from server to client RPC interface class to the RPC proxy that * sends ourgoing RPC calls for that interface. */ - private Map<Class<?>, ClientRpc> rpcProxyMap = new HashMap<Class<?>, ClientRpc>(); + private Map<Class<?>, ClientRpc> rpcProxyMap = new HashMap<>(); /** * Shared state object to be communicated from the server to the client when @@ -79,11 +79,11 @@ public abstract class AbstractClientConnector /** * Pending RPC method invocations to be sent. */ - private ArrayList<ClientMethodInvocation> pendingInvocations = new ArrayList<ClientMethodInvocation>(); + private ArrayList<ClientMethodInvocation> pendingInvocations = new ArrayList<>(); private String connectorId; - private ArrayList<Extension> extensions = new ArrayList<Extension>(); + private ArrayList<Extension> extensions = new ArrayList<>(); /** * The EventRouter used for the event model. @@ -92,7 +92,7 @@ public abstract class AbstractClientConnector private ErrorHandler errorHandler = null; - private static final ConcurrentHashMap<Class<? extends AbstractClientConnector>, Class<? extends SharedState>> stateTypeCache = new ConcurrentHashMap<Class<? extends AbstractClientConnector>, Class<? extends SharedState>>(); + private static final ConcurrentHashMap<Class<? extends AbstractClientConnector>, Class<? extends SharedState>> stateTypeCache = new ConcurrentHashMap<>(); @Override public void addAttachListener(AttachListener listener) { @@ -170,7 +170,7 @@ public abstract class AbstractClientConnector protected <T extends ServerRpc> void registerRpc(T implementation, Class<T> rpcInterfaceType) { rpcManagerMap.put(rpcInterfaceType.getName(), - new ServerRpcManager<T>(implementation, rpcInterfaceType)); + new ServerRpcManager<>(implementation, rpcInterfaceType)); } /** @@ -425,7 +425,7 @@ public abstract class AbstractClientConnector return Collections.emptyList(); } else { List<ClientMethodInvocation> result = pendingInvocations; - pendingInvocations = new ArrayList<ClientMethodInvocation>(); + pendingInvocations = new ArrayList<>(); return Collections.unmodifiableList(result); } } diff --git a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java index 0bd00bae86..491462b53d 100644 --- a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java +++ b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java @@ -63,7 +63,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage { */ private ErrorLevel level = ErrorLevel.ERROR; - private List<ErrorMessage> causes = new ArrayList<ErrorMessage>(); + private List<ErrorMessage> causes = new ArrayList<>(); protected AbstractErrorMessage(String message) { this.message = message; diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java index 359f878ad1..84ee3c2334 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java @@ -303,7 +303,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { .getBootstrapResponse(); if (vaadinService.isStandalone(request)) { - Map<String, Object> headers = new LinkedHashMap<String, Object>(); + Map<String, Object> headers = new LinkedHashMap<>(); Document document = Document.createShell(""); BootstrapPageResponse pageResponse = new BootstrapPageResponse(this, request, context.getSession(), context.getUIClass(), diff --git a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java index dcf47ba438..241aea2078 100644 --- a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java +++ b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java @@ -70,7 +70,7 @@ public class ComponentSizeValidator implements Serializable { parent.addError(error); } else { if (errors == null) { - errors = new LinkedList<InvalidLayout>(); + errors = new LinkedList<>(); } errors.add(error); } @@ -168,7 +168,7 @@ public class ComponentSizeValidator implements Serializable { private final boolean invalidHeight; private final boolean invalidWidth; - private final Vector<InvalidLayout> subErrors = new Vector<InvalidLayout>(); + private final Vector<InvalidLayout> subErrors = new Vector<>(); public InvalidLayout(Component component, boolean height, boolean width) { @@ -281,7 +281,7 @@ public class ComponentSizeValidator implements Serializable { private static Stack<ComponentInfo> getHeightAttributes( Component component) { - Stack<ComponentInfo> attributes = new Stack<ComponentInfo>(); + Stack<ComponentInfo> attributes = new Stack<>(); attributes .add(new ComponentInfo(component, getHeightString(component))); Component parent = component.getParent(); @@ -296,7 +296,7 @@ public class ComponentSizeValidator implements Serializable { private static Stack<ComponentInfo> getWidthAttributes( Component component) { - Stack<ComponentInfo> attributes = new Stack<ComponentInfo>(); + Stack<ComponentInfo> attributes = new Stack<>(); attributes.add(new ComponentInfo(component, getWidthString(component))); Component parent = component.getParent(); attributes.add(new ComponentInfo(parent, getWidthString(parent))); @@ -581,9 +581,9 @@ public class ComponentSizeValidator implements Serializable { } - private static Map<Object, FileLocation> creationLocations = new HashMap<Object, FileLocation>(); - private static Map<Object, FileLocation> widthLocations = new HashMap<Object, FileLocation>(); - private static Map<Object, FileLocation> heightLocations = new HashMap<Object, FileLocation>(); + private static Map<Object, FileLocation> creationLocations = new HashMap<>(); + private static Map<Object, FileLocation> widthLocations = new HashMap<>(); + private static Map<Object, FileLocation> heightLocations = new HashMap<>(); public static class FileLocation implements Serializable { public String method; diff --git a/server/src/main/java/com/vaadin/server/DownloadStream.java b/server/src/main/java/com/vaadin/server/DownloadStream.java index d67fbda8c2..a0a1334135 100644 --- a/server/src/main/java/com/vaadin/server/DownloadStream.java +++ b/server/src/main/java/com/vaadin/server/DownloadStream.java @@ -148,7 +148,7 @@ public class DownloadStream implements Serializable { */ public void setParameter(String name, String value) { if (params == null) { - params = new HashMap<String, String>(); + params = new HashMap<>(); } params.put(name, value); } diff --git a/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java b/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java index aa3bccdb93..93a43829b3 100644 --- a/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java @@ -428,7 +428,7 @@ public class GAEVaadinServlet extends VaadinServlet { getLogger().log(Level.INFO, "Vaadin cleanup deleting {0} expired Vaadin sessions.", entities.size()); - List<Key> keys = new ArrayList<Key>(); + List<Key> keys = new ArrayList<>(); for (Entity e : entities) { keys.add(e.getKey()); } @@ -448,7 +448,7 @@ public class GAEVaadinServlet extends VaadinServlet { getLogger().log(Level.INFO, "Vaadin cleanup deleting {0} expired appengine sessions.", entities.size()); - List<Key> keys = new ArrayList<Key>(); + List<Key> keys = new ArrayList<>(); for (Entity e : entities) { keys.add(e.getKey()); } diff --git a/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java b/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java index 62f3d33014..975d5475d1 100644 --- a/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java @@ -49,15 +49,15 @@ public class GlobalResourceHandler implements RequestHandler { /** * Used to detect when a resource is no longer used by any connector. */ - private final Map<Resource, Set<ClientConnector>> resourceUsers = new HashMap<Resource, Set<ClientConnector>>(); + private final Map<Resource, Set<ClientConnector>> resourceUsers = new HashMap<>(); /** * Used to find the resources that might not be needed any more when a * connector is unregistered. */ - private final Map<ClientConnector, Set<Resource>> usedResources = new HashMap<ClientConnector, Set<Resource>>(); + private final Map<ClientConnector, Set<Resource>> usedResources = new HashMap<>(); - private final Map<ConnectorResource, String> legacyResourceKeys = new HashMap<ConnectorResource, String>(); - private final Map<String, ConnectorResource> legacyResources = new HashMap<String, ConnectorResource>(); + private final Map<ConnectorResource, String> legacyResourceKeys = new HashMap<>(); + private final Map<String, ConnectorResource> legacyResources = new HashMap<>(); private int nextLegacyId = 0; // APP/global/[uiid]/[type]/[id] @@ -173,7 +173,7 @@ public class GlobalResourceHandler implements RequestHandler { private <K, V> void ensureInSet(Map<K, Set<V>> map, K key, V value) { Set<V> set = map.get(key); if (set == null) { - set = new HashSet<V>(); + set = new HashSet<>(); map.put(key, set); } set.add(value); diff --git a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java index f4b8556385..cdd42c19da 100644 --- a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java +++ b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java @@ -49,7 +49,7 @@ public class JavaScriptCallbackHelper implements Serializable { JavaScriptCallbackRpc.class, "call", String.class, JsonArray.class); private AbstractClientConnector connector; - private Map<String, JavaScriptFunction> callbacks = new HashMap<String, JavaScriptFunction>(); + private Map<String, JavaScriptFunction> callbacks = new HashMap<>(); private JavaScriptCallbackRpc javascriptCallbackRpc; public JavaScriptCallbackHelper(AbstractClientConnector connector) { @@ -109,7 +109,7 @@ public class JavaScriptCallbackHelper implements Serializable { .getRpcInterfaces(); String interfaceName = rpcInterfaceType.getName(); if (!rpcInterfaces.containsKey(interfaceName)) { - Set<String> methodNames = new HashSet<String>(); + Set<String> methodNames = new HashSet<>(); for (Method method : rpcInterfaceType.getMethods()) { methodNames.add(method.getName()); diff --git a/server/src/main/java/com/vaadin/server/JsonCodec.java b/server/src/main/java/com/vaadin/server/JsonCodec.java index 2dae3ed03e..adf3e029ee 100644 --- a/server/src/main/java/com/vaadin/server/JsonCodec.java +++ b/server/src/main/java/com/vaadin/server/JsonCodec.java @@ -137,7 +137,7 @@ public class JsonCodec implements Serializable { public static Collection<FieldProperty> find(Class<?> type) throws IntrospectionException { Field[] fields = type.getFields(); - Collection<FieldProperty> properties = new ArrayList<FieldProperty>( + Collection<FieldProperty> properties = new ArrayList<>( fields.length); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { @@ -178,7 +178,7 @@ public class JsonCodec implements Serializable { public static Collection<MethodProperty> find(Class<?> type) throws IntrospectionException { - Collection<MethodProperty> properties = new ArrayList<MethodProperty>(); + Collection<MethodProperty> properties = new ArrayList<>(); for (PropertyDescriptor pd : Introspector.getBeanInfo(type) .getPropertyDescriptors()) { @@ -204,17 +204,17 @@ public class JsonCodec implements Serializable { * happens to process Vaadin requests, so it must be protected from * corruption caused by concurrent access. */ - private static ConcurrentMap<Class<?>, Collection<BeanProperty>> typePropertyCache = new ConcurrentHashMap<Class<?>, Collection<BeanProperty>>(); + private static ConcurrentMap<Class<?>, Collection<BeanProperty>> typePropertyCache = new ConcurrentHashMap<>(); - private static Map<Class<?>, String> typeToTransportType = new HashMap<Class<?>, String>(); + private static Map<Class<?>, String> typeToTransportType = new HashMap<>(); /** * Note! This does not contain primitives. * <p> */ - private static Map<String, Class<?>> transportTypeToType = new HashMap<String, Class<?>>(); + private static Map<String, Class<?>> transportTypeToType = new HashMap<>(); - private static Map<Class<?>, JSONSerializer<?>> customSerializers = new HashMap<Class<?>, JSONSerializer<?>>(); + private static Map<Class<?>, JSONSerializer<?>> customSerializers = new HashMap<>(); static { customSerializers.put(Date.class, new DateSerializer()); } @@ -464,7 +464,7 @@ public class JsonCodec implements Serializable { // See #8906. JsonArray jsonArray = (JsonArray) jsonMap; if (jsonArray.length() == 0) { - return new HashMap<Object, Object>(); + return new HashMap<>(); } } @@ -499,7 +499,7 @@ public class JsonCodec implements Serializable { assert (keys.length() == values.length()); - Map<Object, Object> map = new HashMap<Object, Object>( + Map<Object, Object> map = new HashMap<>( keys.length() * 2); for (int i = 0; i < keys.length(); i++) { Object key = decodeInternalOrCustomType(keyType, keys.get(i), @@ -515,7 +515,7 @@ public class JsonCodec implements Serializable { private static Map<Object, Object> decodeConnectorMap(Type valueType, JsonObject jsonMap, ConnectorTracker connectorTracker) { - Map<Object, Object> map = new HashMap<Object, Object>(); + Map<Object, Object> map = new HashMap<>(); for (String key : jsonMap.keys()) { Object value = decodeInternalOrCustomType(valueType, @@ -531,7 +531,7 @@ public class JsonCodec implements Serializable { private static Map<Object, Object> decodeStringMap(Type valueType, JsonObject jsonMap, ConnectorTracker connectorTracker) { - Map<Object, Object> map = new HashMap<Object, Object>(); + Map<Object, Object> map = new HashMap<>(); for (String key : jsonMap.keys()) { Object value = decodeInternalOrCustomType(valueType, @@ -590,7 +590,7 @@ public class JsonCodec implements Serializable { boolean restrictToInternalTypes, JsonArray jsonArray, ConnectorTracker connectorTracker) { int arrayLength = jsonArray.length(); - List<Object> list = new ArrayList<Object>(arrayLength); + List<Object> list = new ArrayList<>(arrayLength); for (int i = 0; i < arrayLength; ++i) { // each entry always has two elements: type and value JsonValue encodedValue = jsonArray.get(i); @@ -604,7 +604,7 @@ public class JsonCodec implements Serializable { private static Set<Object> decodeSet(Type targetType, boolean restrictToInternalTypes, JsonArray jsonArray, ConnectorTracker connectorTracker) { - HashSet<Object> set = new HashSet<Object>(); + HashSet<Object> set = new HashSet<>(); set.addAll(decodeList(targetType, restrictToInternalTypes, jsonArray, connectorTracker)); return set; @@ -702,7 +702,7 @@ public class JsonCodec implements Serializable { if (cachedProperties != null) { return cachedProperties; } - Collection<BeanProperty> properties = new ArrayList<BeanProperty>(); + Collection<BeanProperty> properties = new ArrayList<>(); properties.addAll(MethodProperty.find(type)); properties.addAll(FieldProperty.find(type)); diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java index 19f79b6507..4463fd1ab5 100644 --- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java +++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java @@ -65,7 +65,7 @@ public class JsonPaintTarget implements PaintTarget { private int changes = 0; - private final Set<Object> usedResources = new HashSet<Object>(); + private final Set<Object> usedResources = new HashSet<>(); private boolean customLayoutArgumentsOpen = false; @@ -73,7 +73,7 @@ public class JsonPaintTarget implements PaintTarget { private boolean cacheEnabled = false; - private final Set<Class<? extends ClientConnector>> usedClientConnectors = new HashSet<Class<? extends ClientConnector>>(); + private final Set<Class<? extends ClientConnector>> usedClientConnectors = new HashSet<>(); /** * Creates a new JsonPaintTarget. @@ -96,11 +96,11 @@ public class JsonPaintTarget implements PaintTarget { uidlBuffer = new PrintWriter(outWriter); // Initialize tag-writing - mOpenTags = new Stack<String>(); - openJsonTags = new Stack<JsonTag>(); + mOpenTags = new Stack<>(); + openJsonTags = new Stack<>(); - openPaintables = new Stack<ClientConnector>(); - openPaintableTags = new Stack<String>(); + openPaintables = new Stack<>(); + openPaintableTags = new Stack<>(); cacheEnabled = cachingRequired; } @@ -728,11 +728,11 @@ public class JsonPaintTarget implements PaintTarget { class JsonTag implements Serializable { boolean firstField = false; - Vector<Object> variables = new Vector<Object>(); + Vector<Object> variables = new Vector<>(); - Vector<Object> children = new Vector<Object>(); + Vector<Object> children = new Vector<>(); - Vector<Object> attr = new Vector<Object>(); + Vector<Object> attr = new Vector<>(); StringBuilder data = new StringBuilder(); diff --git a/server/src/main/java/com/vaadin/server/KeyMapper.java b/server/src/main/java/com/vaadin/server/KeyMapper.java index 389fcd8b66..54d85c4bce 100644 --- a/server/src/main/java/com/vaadin/server/KeyMapper.java +++ b/server/src/main/java/com/vaadin/server/KeyMapper.java @@ -32,9 +32,9 @@ public class KeyMapper<V> implements DataKeyMapper<V>, Serializable { private int lastKey = 0; - private final HashMap<V, String> objectKeyMap = new HashMap<V, String>(); + private final HashMap<V, String> objectKeyMap = new HashMap<>(); - private final HashMap<String, V> keyObjectMap = new HashMap<String, V>(); + private final HashMap<String, V> keyObjectMap = new HashMap<>(); /** * Gets key for an object. diff --git a/server/src/main/java/com/vaadin/server/LegacyApplication.java b/server/src/main/java/com/vaadin/server/LegacyApplication.java index 93f3da3d8f..210520cfaa 100644 --- a/server/src/main/java/com/vaadin/server/LegacyApplication.java +++ b/server/src/main/java/com/vaadin/server/LegacyApplication.java @@ -42,7 +42,7 @@ public abstract class LegacyApplication implements ErrorHandler { private LegacyWindow mainWindow; private String theme; - private Map<String, LegacyWindow> legacyUINames = new HashMap<String, LegacyWindow>(); + private Map<String, LegacyWindow> legacyUINames = new HashMap<>(); private boolean isRunning = true; diff --git a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java index 513f598b21..858f61d0c7 100644 --- a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java +++ b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java @@ -56,7 +56,7 @@ import elemental.json.JsonValue; public class LegacyCommunicationManager implements Serializable { // TODO Refactor (#11410) - private final HashMap<Integer, ClientCache> uiToClientCache = new HashMap<Integer, ClientCache>(); + private final HashMap<Integer, ClientCache> uiToClientCache = new HashMap<>(); /** * The session this communication manager is used for @@ -67,7 +67,7 @@ public class LegacyCommunicationManager implements Serializable { private String requestThemeName; // TODO Refactor (#11413) - private Map<String, Class<?>> publishedFileContexts = new HashMap<String, Class<?>>(); + private Map<String, Class<?>> publishedFileContexts = new HashMap<>(); /** * TODO New constructor - document me! @@ -82,7 +82,7 @@ public class LegacyCommunicationManager implements Serializable { return session; } - private static final ConcurrentHashMap<Class<? extends SharedState>, JsonValue> referenceDiffStates = new ConcurrentHashMap<Class<? extends SharedState>, JsonValue>(); + private static final ConcurrentHashMap<Class<? extends SharedState>, JsonValue> referenceDiffStates = new ConcurrentHashMap<>(); /** * @deprecated As of 7.1. See #11411. @@ -307,7 +307,7 @@ public class LegacyCommunicationManager implements Serializable { } } - private final HashMap<Class<? extends ClientConnector>, Integer> typeToKey = new HashMap<Class<? extends ClientConnector>, Integer>(); + private final HashMap<Class<? extends ClientConnector>, Integer> typeToKey = new HashMap<>(); private int nextTypeKey = 0; /** @@ -338,7 +338,7 @@ public class LegacyCommunicationManager implements Serializable { @Deprecated public class ClientCache implements Serializable { - private final Set<Object> res = new HashSet<Object>(); + private final Set<Object> res = new HashSet<>(); /** * diff --git a/server/src/main/java/com/vaadin/server/Page.java b/server/src/main/java/com/vaadin/server/Page.java index 7142659fca..9330c08a28 100644 --- a/server/src/main/java/com/vaadin/server/Page.java +++ b/server/src/main/java/com/vaadin/server/Page.java @@ -273,7 +273,7 @@ public class Page implements Serializable { * Resources to be opened automatically on next repaint. The list is * automatically cleared when it has been sent to the client. */ - private final LinkedList<OpenResource> openList = new LinkedList<OpenResource>(); + private final LinkedList<OpenResource> openList = new LinkedList<>(); /** * A list of notifications that are waiting to be sent to the client. @@ -388,9 +388,9 @@ public class Page implements Serializable { */ public static class Styles implements Serializable { - private LinkedHashSet<InjectedStyle> injectedStyles = new LinkedHashSet<InjectedStyle>(); + private LinkedHashSet<InjectedStyle> injectedStyles = new LinkedHashSet<>(); - private LinkedHashSet<InjectedStyle> pendingInjections = new LinkedHashSet<InjectedStyle>(); + private LinkedHashSet<InjectedStyle> pendingInjections = new LinkedHashSet<>(); private final UI ui; @@ -440,7 +440,7 @@ public class Page implements Serializable { if (target.isFullRepaint()) { injectedStyles.addAll(pendingInjections); pendingInjections = injectedStyles; - injectedStyles = new LinkedHashSet<InjectedStyle>(); + injectedStyles = new LinkedHashSet<>(); } if (!pendingInjections.isEmpty()) { @@ -1161,7 +1161,7 @@ public class Page implements Serializable { */ private void addNotification(Notification notification) { if (notifications == null) { - notifications = new LinkedList<Notification>(); + notifications = new LinkedList<>(); } notifications.add(notification); uI.markAsDirty(); diff --git a/server/src/main/java/com/vaadin/server/ServerRpcManager.java b/server/src/main/java/com/vaadin/server/ServerRpcManager.java index e1f5f79860..e9f8d9543e 100644 --- a/server/src/main/java/com/vaadin/server/ServerRpcManager.java +++ b/server/src/main/java/com/vaadin/server/ServerRpcManager.java @@ -69,7 +69,7 @@ public class ServerRpcManager<T extends ServerRpc> implements Serializable { } - private static final Map<Class<?>, Class<?>> boxedTypes = new HashMap<Class<?>, Class<?>>(); + private static final Map<Class<?>, Class<?>> boxedTypes = new HashMap<>(); static { try { Class<?>[] boxClasses = new Class<?>[] { Boolean.class, Byte.class, diff --git a/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java b/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java index 22bcd1bf6b..f4e2b4064d 100644 --- a/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java +++ b/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java @@ -24,7 +24,7 @@ import com.vaadin.shared.communication.ServerRpc; public class ServerRpcMethodInvocation extends MethodInvocation { - private static final Map<String, Method> invocationMethodCache = new ConcurrentHashMap<String, Method>( + private static final Map<String, Method> invocationMethodCache = new ConcurrentHashMap<>( 128, 0.75f, 1); private final Method method; diff --git a/server/src/main/java/com/vaadin/server/VaadinPortletSession.java b/server/src/main/java/com/vaadin/server/VaadinPortletSession.java index f431d08b7e..6a6cb429d3 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortletSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortletSession.java @@ -64,13 +64,13 @@ import com.vaadin.util.CurrentInstance; @SuppressWarnings("serial") public class VaadinPortletSession extends VaadinSession { - private final Set<PortletListener> portletListeners = new LinkedHashSet<PortletListener>(); + private final Set<PortletListener> portletListeners = new LinkedHashSet<>(); - private final Map<String, QName> eventActionDestinationMap = new HashMap<String, QName>(); - private final Map<String, Serializable> eventActionValueMap = new HashMap<String, Serializable>(); + private final Map<String, QName> eventActionDestinationMap = new HashMap<>(); + private final Map<String, Serializable> eventActionValueMap = new HashMap<>(); - private final Map<String, String> sharedParameterActionNameMap = new HashMap<String, String>(); - private final Map<String, String> sharedParameterActionValueMap = new HashMap<String, String>(); + private final Map<String, String> sharedParameterActionNameMap = new HashMap<>(); + private final Map<String, String> sharedParameterActionValueMap = new HashMap<>(); /** * Create a portlet service session for the given portlet service @@ -143,7 +143,7 @@ public class VaadinPortletSession extends VaadinSession { */ public void firePortletRenderRequest(UI uI, RenderRequest request, RenderResponse response) { - for (PortletListener l : new ArrayList<PortletListener>( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleRenderRequest(request, new RestrictedRenderResponse(response), uI); @@ -172,7 +172,7 @@ public class VaadinPortletSession extends VaadinSession { sharedParameterActionValueMap.remove(key); } else { // normal action request, notify listeners - for (PortletListener l : new ArrayList<PortletListener>( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleActionRequest(request, response, uI); } @@ -184,7 +184,7 @@ public class VaadinPortletSession extends VaadinSession { */ public void firePortletEventRequest(UI uI, EventRequest request, EventResponse response) { - for (PortletListener l : new ArrayList<PortletListener>( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleEventRequest(request, response, uI); } @@ -195,7 +195,7 @@ public class VaadinPortletSession extends VaadinSession { */ public void firePortletResourceRequest(UI uI, ResourceRequest request, ResourceResponse response) { - for (PortletListener l : new ArrayList<PortletListener>( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleResourceRequest(request, response, uI); } diff --git a/server/src/main/java/com/vaadin/server/VaadinService.java b/server/src/main/java/com/vaadin/server/VaadinService.java index 50e20a0389..922c7cfe52 100644 --- a/server/src/main/java/com/vaadin/server/VaadinService.java +++ b/server/src/main/java/com/vaadin/server/VaadinService.java @@ -209,7 +209,7 @@ public abstract class VaadinService implements Serializable { */ protected List<RequestHandler> createRequestHandlers() throws ServiceException { - ArrayList<RequestHandler> handlers = new ArrayList<RequestHandler>(); + ArrayList<RequestHandler> handlers = new ArrayList<>(); handlers.add(new SessionRequestHandler()); handlers.add(new PublishedFileHandler()); handlers.add(new HeartbeatHandler()); @@ -466,7 +466,7 @@ public abstract class VaadinService implements Serializable { if (session.getState() == State.OPEN) { closeSession(session); } - ArrayList<UI> uis = new ArrayList<UI>(session.getUIs()); + ArrayList<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { ui.accessSynchronously(new Runnable() { @Override @@ -1050,7 +1050,7 @@ public abstract class VaadinService implements Serializable { // Stores all attributes (security key, reference to this context // instance) so they can be added to the new session Set<String> attributeNames = oldSession.getAttributeNames(); - HashMap<String, Object> attrs = new HashMap<String, Object>( + HashMap<String, Object> attrs = new HashMap<>( attributeNames.size() * 2); for (String name : attributeNames) { Object value = oldSession.getAttribute(name); @@ -1190,7 +1190,7 @@ public abstract class VaadinService implements Serializable { * @param session */ private void removeClosedUIs(final VaadinSession session) { - ArrayList<UI> uis = new ArrayList<UI>(session.getUIs()); + ArrayList<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { if (ui.isClosing()) { ui.accessSynchronously(new Runnable() { diff --git a/server/src/main/java/com/vaadin/server/VaadinServlet.java b/server/src/main/java/com/vaadin/server/VaadinServlet.java index e3402f6937..03d47b6693 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServlet.java +++ b/server/src/main/java/com/vaadin/server/VaadinServlet.java @@ -87,7 +87,7 @@ public class VaadinServlet extends HttpServlet implements Constants { css = json.getString("css"); timestamp = Long.parseLong(json.getString("timestamp")); - sourceUris = new ArrayList<String>(); + sourceUris = new ArrayList<>(); JsonArray uris = json.getArray("uris"); for (int i = 0; i < uris.length(); i++) { @@ -661,7 +661,7 @@ public class VaadinServlet extends HttpServlet implements Constants { return sb.toString(); } - private static final Collection<Character> CHAR_BLACKLIST = new HashSet<Character>( + private static final Collection<Character> CHAR_BLACKLIST = new HashSet<>( Arrays.asList(new Character[] { '&', '"', '\'', '<', '>', '(', ')', ';' })); @@ -678,7 +678,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * Global cache of scss compilation results. This map is protected from * concurrent access by {@link #SCSS_MUTEX}. */ - private final Map<String, ScssCacheEntry> scssCache = new HashMap<String, ScssCacheEntry>(); + private final Map<String, ScssCacheEntry> scssCache = new HashMap<>(); /** * Keeps track of whether a warning about not being able to persist cache diff --git a/server/src/main/java/com/vaadin/server/VaadinSession.java b/server/src/main/java/com/vaadin/server/VaadinSession.java index 8b503b9b37..d2cf4e740a 100644 --- a/server/src/main/java/com/vaadin/server/VaadinSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinSession.java @@ -226,12 +226,12 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { @Deprecated private Object converterFactory; - private LinkedList<RequestHandler> requestHandlers = new LinkedList<RequestHandler>(); + private LinkedList<RequestHandler> requestHandlers = new LinkedList<>(); private int nextUIId = 0; - private Map<Integer, UI> uIs = new HashMap<Integer, UI>(); + private Map<Integer, UI> uIs = new HashMap<>(); - private final Map<String, Integer> embedIdMap = new HashMap<String, Integer>(); + private final Map<String, Integer> embedIdMap = new HashMap<>(); private final EventRouter eventRouter = new EventRouter(); @@ -253,9 +253,9 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { private transient WrappedSession session; - private final Map<String, Object> attributes = new HashMap<String, Object>(); + private final Map<String, Object> attributes = new HashMap<>(); - private LinkedList<UIProvider> uiProviders = new LinkedList<UIProvider>(); + private LinkedList<UIProvider> uiProviders = new LinkedList<>(); private transient VaadinService service; @@ -266,7 +266,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * session is serialized as long as it doesn't happen while some other * thread has the lock. */ - private transient ConcurrentLinkedQueue<FutureAccess> pendingAccessQueue = new ConcurrentLinkedQueue<FutureAccess>(); + private transient ConcurrentLinkedQueue<FutureAccess> pendingAccessQueue = new ConcurrentLinkedQueue<>(); /** * Creates a new VaadinSession tied to a VaadinService. @@ -465,7 +465,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { */ public static Collection<VaadinSession> getAllSessions( HttpSession httpSession) { - Set<VaadinSession> sessions = new HashSet<VaadinSession>(); + Set<VaadinSession> sessions = new HashSet<>(); Enumeration<String> attributeNames = httpSession.getAttributeNames(); while (attributeNames.hasMoreElements()) { @@ -1426,7 +1426,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { Map<Class<?>, CurrentInstance> old = CurrentInstance.setCurrent(this); try { stream.defaultReadObject(); - pendingAccessQueue = new ConcurrentLinkedQueue<FutureAccess>(); + pendingAccessQueue = new ConcurrentLinkedQueue<>(); } finally { CurrentInstance.restoreInstances(old); } diff --git a/server/src/main/java/com/vaadin/server/WrappedHttpSession.java b/server/src/main/java/com/vaadin/server/WrappedHttpSession.java index 781cdedc5c..39944fc7da 100644 --- a/server/src/main/java/com/vaadin/server/WrappedHttpSession.java +++ b/server/src/main/java/com/vaadin/server/WrappedHttpSession.java @@ -76,7 +76,7 @@ public class WrappedHttpSession implements WrappedSession { // Helper shared with WrappedPortletSession static <T> Set<T> enumerationToSet(Enumeration<T> values) { - HashSet<T> set = new HashSet<T>(); + HashSet<T> set = new HashSet<>(); while (values.hasMoreElements()) { set.add(values.nextElement()); } diff --git a/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java b/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java index 94755385eb..efa8cc3be9 100644 --- a/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java @@ -116,7 +116,7 @@ public class ClientRpcWriter implements Serializable { */ private Collection<ClientMethodInvocation> collectPendingRpcCalls( Collection<ClientConnector> rpcPendingQueue) { - List<ClientMethodInvocation> pendingInvocations = new ArrayList<ClientMethodInvocation>(); + List<ClientMethodInvocation> pendingInvocations = new ArrayList<>(); for (ClientConnector connector : rpcPendingQueue) { List<ClientMethodInvocation> paintablePendingRpc = connector .retrievePendingRpcCalls(); @@ -124,7 +124,7 @@ public class ClientRpcWriter implements Serializable { List<ClientMethodInvocation> oldPendingRpc = pendingInvocations; int totalCalls = pendingInvocations.size() + paintablePendingRpc.size(); - pendingInvocations = new ArrayList<ClientMethodInvocation>( + pendingInvocations = new ArrayList<>( totalCalls); // merge two ordered comparable lists diff --git a/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java b/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java index 041c5e9e8b..498dcf5bf4 100644 --- a/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java @@ -60,7 +60,7 @@ public class LegacyUidlWriter implements Serializable { Collection<ClientConnector> dirtyVisibleConnectors = ui .getConnectorTracker().getDirtyVisibleConnectors(); - List<Component> legacyComponents = new ArrayList<Component>( + List<Component> legacyComponents = new ArrayList<>( dirtyVisibleConnectors.size()); for (ClientConnector connector : dirtyVisibleConnectors) { // All Components that want to use paintContent must implement diff --git a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java index c4160a92dd..8ec3503be0 100644 --- a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java @@ -334,7 +334,7 @@ public class ServerRpcHandler implements Serializable { try { ConnectorTracker connectorTracker = ui.getConnectorTracker(); - Set<Connector> enabledConnectors = new HashSet<Connector>(); + Set<Connector> enabledConnectors = new HashSet<>(); List<MethodInvocation> invocations = parseInvocations( ui.getConnectorTracker(), invocationsData, @@ -491,7 +491,7 @@ public class ServerRpcHandler implements Serializable { ConnectorTracker connectorTracker, JsonArray invocationsJson, int lastSyncIdSeenByClient) { int invocationCount = invocationsJson.length(); - ArrayList<MethodInvocation> invocations = new ArrayList<MethodInvocation>( + ArrayList<MethodInvocation> invocations = new ArrayList<>( invocationCount); MethodInvocation previousInvocation = null; diff --git a/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java b/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java index 0a890282cd..85b1fda1bf 100644 --- a/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java @@ -54,7 +54,7 @@ public class SessionRequestHandler implements RequestHandler { session.lock(); ArrayList<RequestHandler> requestHandlers; try { - requestHandlers = new ArrayList<RequestHandler>( + requestHandlers = new ArrayList<>( session.getRequestHandlers()); } finally { session.unlock(); diff --git a/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java b/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java index 1e0efb88ff..73b82fc877 100644 --- a/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java @@ -58,7 +58,7 @@ public class SharedStateWriter implements Serializable { Collection<ClientConnector> dirtyVisibleConnectors = ui .getConnectorTracker().getDirtyVisibleConnectors(); - Set<String> writtenConnectors = new HashSet<String>(); + Set<String> writtenConnectors = new HashSet<>(); JsonObject sharedStates = Json.createObject(); for (ClientConnector connector : dirtyVisibleConnectors) { // encode and send shared state diff --git a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java index 3028475d1b..7132433963 100644 --- a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java @@ -80,7 +80,7 @@ public class UidlWriter implements Serializable { // to write out service.runPendingAccessTasks(session); - Set<ClientConnector> processedConnectors = new HashSet<ClientConnector>(); + Set<ClientConnector> processedConnectors = new HashSet<>(); LegacyCommunicationManager manager = session.getCommunicationManager(); ClientCache clientCache = manager.getClientCache(ui); @@ -90,7 +90,7 @@ public class UidlWriter implements Serializable { getLogger().log(Level.FINE, "* Creating response to client"); while (true) { - ArrayList<ClientConnector> connectorsToProcess = new ArrayList<ClientConnector>(); + ArrayList<ClientConnector> connectorsToProcess = new ArrayList<>(); for (ClientConnector c : uiConnectorTracker.getDirtyConnectors()) { if (!processedConnectors.contains(c) && LegacyCommunicationManager @@ -209,7 +209,7 @@ public class UidlWriter implements Serializable { .getUsedClientConnectors(); boolean typeMappingsOpen = false; - List<Class<? extends ClientConnector>> newConnectorTypes = new ArrayList<Class<? extends ClientConnector>>(); + List<Class<? extends ClientConnector>> newConnectorTypes = new ArrayList<>(); for (Class<? extends ClientConnector> class1 : usedClientConnectors) { if (clientCache.cache(class1)) { @@ -284,8 +284,8 @@ public class UidlWriter implements Serializable { } }); - List<String> scriptDependencies = new ArrayList<String>(); - List<String> styleDependencies = new ArrayList<String>(); + List<String> scriptDependencies = new ArrayList<>(); + List<String> styleDependencies = new ArrayList<>(); for (Class<? extends ClientConnector> class1 : newConnectorTypes) { JavaScript jsAnnotation = class1 diff --git a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java index 2bb44f65dd..fe950b4318 100644 --- a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java +++ b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java @@ -100,7 +100,7 @@ public class SASSAddonImportFileCreator { // Sort addon styles so that CSS imports are first and SCSS import // last - List<String> paths = new ArrayList<String>(addonThemes.keySet()); + List<String> paths = new ArrayList<>(addonThemes.keySet()); Collections.sort(paths, new Comparator<String>() { @Override @@ -117,7 +117,7 @@ public class SASSAddonImportFileCreator { } }); - List<String> mixins = new ArrayList<String>(); + List<String> mixins = new ArrayList<>(); for (String path : paths) { mixins.addAll( addImport(printStream, path, addonThemes.get(path))); @@ -142,7 +142,7 @@ public class SASSAddonImportFileCreator { // Add import comment printImportComment(stream, location); - List<String> foundMixins = new ArrayList<String>(); + List<String> foundMixins = new ArrayList<>(); if (file.endsWith(".css")) { stream.print("@import url(\"../../../" + file + "\");\n"); diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java index da5b692533..5d1bbbfa5f 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -145,8 +145,8 @@ public class ClassPathExplorer { */ public static LocationInfo getAvailableWidgetSetsAndStylesheets() { long start = System.currentTimeMillis(); - Map<String, URL> widgetsets = new HashMap<String, URL>(); - Map<String, URL> themes = new HashMap<String, URL>(); + Map<String, URL> widgetsets = new HashMap<>(); + Map<String, URL> themes = new HashMap<>(); Set<String> keySet = classpathLocations.keySet(); for (String location : keySet) { searchForWidgetSetsAndAddonStyles(location, widgetsets, themes); @@ -298,7 +298,7 @@ public class ClassPathExplorer { */ private final static List<String> getRawClasspathEntries() { // try to keep the order of the classpath - List<String> locations = new ArrayList<String>(); + List<String> locations = new ArrayList<>(); String pathSep = System.getProperty("path.separator"); String classpath = System.getProperty("java.class.path"); @@ -338,7 +338,7 @@ public class ClassPathExplorer { List<String> rawClasspathEntries) { long start = System.currentTimeMillis(); // try to keep the order of the classpath - Map<String, URL> locations = new LinkedHashMap<String, URL>(); + Map<String, URL> locations = new LinkedHashMap<>(); for (String classpathEntry : rawClasspathEntries) { File file = new File(classpathEntry); include(null, file, locations); @@ -520,7 +520,7 @@ public class ClassPathExplorer { public static URL getWidgetsetSourceDirectory(String widgetsetFileName) { if (debug) { debug("classpathLocations values:"); - ArrayList<String> locations = new ArrayList<String>( + ArrayList<String> locations = new ArrayList<>( classpathLocations.keySet()); for (String location : locations) { debug(String.valueOf(classpathLocations.get(location))); diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java index 645c15fc1a..f64b43092f 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java @@ -168,7 +168,7 @@ public class WidgetSetBuilder { private static Collection<String> getCurrentInheritedWidgetsets( String content) { - HashSet<String> hashSet = new HashSet<String>(); + HashSet<String> hashSet = new HashSet<>(); Pattern inheritsPattern = Pattern.compile(" name=\"([^\"]*)\""); Matcher matcher = inheritsPattern.matcher(content); diff --git a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java index 59221fcd83..d435bc806b 100644 --- a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java @@ -63,7 +63,7 @@ public class AbsoluteLayout extends AbstractLayout } }; // Maps each component to a position - private LinkedHashMap<Component, ComponentPosition> componentToCoordinates = new LinkedHashMap<Component, ComponentPosition>(); + private LinkedHashMap<Component, ComponentPosition> componentToCoordinates = new LinkedHashMap<>(); /** * Creates an AbsoluteLayout with full size. @@ -191,7 +191,7 @@ public class AbsoluteLayout extends AbstractLayout // Map<Connector,String> was supported. We cannot get the child // connectorId unless the component is attached to the application so // the String->String map cannot be populated in internal* either. - Map<String, String> connectorToPosition = new HashMap<String, String>(); + Map<String, String> connectorToPosition = new HashMap<>(); for (Iterator<Component> ci = getComponentIterator(); ci.hasNext();) { Component c = ci.next(); connectorToPosition.put(c.getConnectorId(), diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index 536e831d87..a34b09e9d8 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -197,7 +197,7 @@ public abstract class AbstractComponent extends AbstractClientConnector return; } if (getState().styles == null) { - getState().styles = new ArrayList<String>(); + getState().styles = new ArrayList<>(); } List<String> styles = getState().styles; styles.clear(); @@ -232,7 +232,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } if (getState().styles == null) { - getState().styles = new ArrayList<String>(); + getState().styles = new ArrayList<>(); } List<String> styles = getState().styles; if (!styles.contains(style)) { @@ -1027,7 +1027,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } // check for unsupported attributes - Set<String> supported = new HashSet<String>(); + Set<String> supported = new HashSet<>(); supported.addAll(getDefaultAttributes()); supported.addAll(getCustomAttributes()); for (Attribute a : attr) { @@ -1084,7 +1084,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } } else { // remove responsive extensions - List<Extension> extensions = new ArrayList<Extension>( + List<Extension> extensions = new ArrayList<>( getExtensions()); for (Extension e : extensions) { if (e instanceof Responsive) { @@ -1263,7 +1263,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * implementation */ protected Collection<String> getCustomAttributes() { - ArrayList<String> l = new ArrayList<String>( + ArrayList<String> l = new ArrayList<>( Arrays.asList(customAttributes)); if (this instanceof Focusable) { l.add("tab-index"); diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java index 4dacf2c64a..b5fe4e9bcd 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java @@ -62,7 +62,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent */ @Override public void removeAllComponents() { - final LinkedList<Component> l = new LinkedList<Component>(); + final LinkedList<Component> l = new LinkedList<>(); // Adds all components for (final Iterator<Component> i = getComponentIterator(); i @@ -83,7 +83,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent */ @Override public void moveComponentsFrom(ComponentContainer source) { - final LinkedList<Component> components = new LinkedList<Component>(); + final LinkedList<Component> components = new LinkedList<>(); for (final Iterator<Component> i = source.getComponentIterator(); i .hasNext();) { components.add(i.next()); @@ -301,7 +301,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent : ComponentSizeValidator.checkWidths(component); if (!valid) { if (components == null) { - components = new HashSet<Component>(); + components = new HashSet<>(); } components.add(component); } diff --git a/server/src/main/java/com/vaadin/ui/AbstractMedia.java b/server/src/main/java/com/vaadin/ui/AbstractMedia.java index f24c3e5e08..f56f6a7f27 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMedia.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMedia.java @@ -152,7 +152,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @return The sources pointed to in this media. */ public List<Resource> getSources() { - ArrayList<Resource> sources = new ArrayList<Resource>(); + ArrayList<Resource> sources = new ArrayList<>(); for (URLReference ref : getState(false).sources) { sources.add(((ResourceReference) ref).getResource()); } diff --git a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java index 453adb2579..331a0e72be 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java @@ -58,7 +58,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout /** * Custom layout slots containing the components. */ - protected LinkedList<Component> components = new LinkedList<Component>(); + protected LinkedList<Component> components = new LinkedList<>(); private Alignment defaultComponentAlignment = Alignment.TOP_LEFT; diff --git a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java index d92d554cf5..fd2c0029d1 100644 --- a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java @@ -67,21 +67,21 @@ import elemental.json.JsonObject; */ public class ConnectorTracker implements Serializable { - private final HashMap<String, ClientConnector> connectorIdToConnector = new HashMap<String, ClientConnector>(); - private Set<ClientConnector> dirtyConnectors = new HashSet<ClientConnector>(); - private Set<ClientConnector> uninitializedConnectors = new HashSet<ClientConnector>(); + private final HashMap<String, ClientConnector> connectorIdToConnector = new HashMap<>(); + private Set<ClientConnector> dirtyConnectors = new HashSet<>(); + private Set<ClientConnector> uninitializedConnectors = new HashSet<>(); /** * Connectors that have been unregistered and should be cleaned up the next * time {@link #cleanConnectorMap()} is invoked unless they have been * registered again. */ - private final Set<ClientConnector> unregisteredConnectors = new HashSet<ClientConnector>(); + private final Set<ClientConnector> unregisteredConnectors = new HashSet<>(); private boolean writingResponse = false; private UI uI; - private transient Map<ClientConnector, JsonObject> diffStates = new HashMap<ClientConnector, JsonObject>(); + private transient Map<ClientConnector, JsonObject> diffStates = new HashMap<>(); /** Maps connectorIds to a map of named StreamVariables */ private Map<String, Map<String, StreamVariable>> pidToNameToStreamVariable; @@ -96,7 +96,7 @@ public class ConnectorTracker implements Serializable { * @see #getCurrentSyncId() * @see #cleanConcurrentlyRemovedConnectorIds(long) */ - private TreeMap<Integer, Set<String>> syncIdToUnregisteredConnectorIds = new TreeMap<Integer, Set<String>>(); + private TreeMap<Integer, Set<String>> syncIdToUnregisteredConnectorIds = new TreeMap<>(); /** * Gets a logger for this class @@ -185,7 +185,7 @@ public class ConnectorTracker implements Serializable { Set<String> unregisteredConnectorIds = syncIdToUnregisteredConnectorIds .get(currentSyncId); if (unregisteredConnectorIds == null) { - unregisteredConnectorIds = new HashSet<String>(); + unregisteredConnectorIds = new HashSet<>(); syncIdToUnregisteredConnectorIds.put(currentSyncId, unregisteredConnectorIds); } @@ -438,10 +438,10 @@ public class ConnectorTracker implements Serializable { private boolean isHierarchyComplete() { boolean noErrors = true; - Set<ClientConnector> danglingConnectors = new HashSet<ClientConnector>( + Set<ClientConnector> danglingConnectors = new HashSet<>( connectorIdToConnector.values()); - LinkedList<ClientConnector> stack = new LinkedList<ClientConnector>(); + LinkedList<ClientConnector> stack = new LinkedList<>(); stack.add(uI); while (!stack.isEmpty()) { ClientConnector connector = stack.pop(); @@ -623,7 +623,7 @@ public class ConnectorTracker implements Serializable { */ public ArrayList<ClientConnector> getDirtyVisibleConnectors() { Collection<ClientConnector> dirtyConnectors = getDirtyConnectors(); - ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<ClientConnector>( + ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<>( dirtyConnectors.size()); for (ClientConnector c : dirtyConnectors) { if (LegacyCommunicationManager.isConnectorVisibleToClient(c)) { @@ -706,7 +706,7 @@ public class ConnectorTracker implements Serializable { out.defaultWriteObject(); // Convert JsonObjects in diff state to String representation as // JsonObject is not serializable - HashMap<ClientConnector, String> stringDiffStates = new HashMap<ClientConnector, String>( + HashMap<ClientConnector, String> stringDiffStates = new HashMap<>( diffStates.size() * 2); for (ClientConnector key : diffStates.keySet()) { stringDiffStates.put(key, diffStates.get(key).toString()); @@ -721,11 +721,11 @@ public class ConnectorTracker implements Serializable { // Read String versions of JsonObjects and parse into JsonObjects as // JsonObject is not serializable - diffStates = new HashMap<ClientConnector, JsonObject>(); + diffStates = new HashMap<>(); @SuppressWarnings("unchecked") HashMap<ClientConnector, String> stringDiffStates = (HashMap<ClientConnector, String>) in .readObject(); - diffStates = new HashMap<ClientConnector, JsonObject>( + diffStates = new HashMap<>( stringDiffStates.size() * 2); for (ClientConnector key : stringDiffStates.keySet()) { try { @@ -770,18 +770,18 @@ public class ConnectorTracker implements Serializable { StreamVariable variable) { assert getConnector(connectorId) != null; if (pidToNameToStreamVariable == null) { - pidToNameToStreamVariable = new HashMap<String, Map<String, StreamVariable>>(); + pidToNameToStreamVariable = new HashMap<>(); } Map<String, StreamVariable> nameToStreamVariable = pidToNameToStreamVariable .get(connectorId); if (nameToStreamVariable == null) { - nameToStreamVariable = new HashMap<String, StreamVariable>(); + nameToStreamVariable = new HashMap<>(); pidToNameToStreamVariable.put(connectorId, nameToStreamVariable); } nameToStreamVariable.put(variableName, variable); if (streamVariableToSeckey == null) { - streamVariableToSeckey = new HashMap<StreamVariable, String>(); + streamVariableToSeckey = new HashMap<>(); } String seckey = streamVariableToSeckey.get(variable); if (seckey == null) { diff --git a/server/src/main/java/com/vaadin/ui/CssLayout.java b/server/src/main/java/com/vaadin/ui/CssLayout.java index 982c55cab2..381e7aa463 100644 --- a/server/src/main/java/com/vaadin/ui/CssLayout.java +++ b/server/src/main/java/com/vaadin/ui/CssLayout.java @@ -85,7 +85,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { /** * Custom layout slots containing the components. */ - protected LinkedList<Component> components = new LinkedList<Component>(); + protected LinkedList<Component> components = new LinkedList<>(); /** * Constructs an empty CssLayout. diff --git a/server/src/main/java/com/vaadin/ui/CustomLayout.java b/server/src/main/java/com/vaadin/ui/CustomLayout.java index 11ab9c2f0e..179969765d 100644 --- a/server/src/main/java/com/vaadin/ui/CustomLayout.java +++ b/server/src/main/java/com/vaadin/ui/CustomLayout.java @@ -67,7 +67,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { /** * Custom layout slots containing the components. */ - private final HashMap<String, Component> slots = new HashMap<String, Component>(); + private final HashMap<String, Component> slots = new HashMap<>(); /** * Default constructor only used by subclasses. Subclasses are responsible diff --git a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java index 280f80ee21..deffa06631 100644 --- a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java +++ b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java @@ -120,7 +120,7 @@ public class DragAndDropWrapper extends CustomComponent } }; - private Map<String, ProxyReceiver> receivers = new HashMap<String, ProxyReceiver>(); + private Map<String, ProxyReceiver> receivers = new HashMap<>(); public class WrapperTargetDetails extends TargetDetailsImpl { @@ -191,11 +191,11 @@ public class DragAndDropWrapper extends CustomComponent COMPONENT_OTHER, } - private final Map<String, Object> html5DataFlavors = new LinkedHashMap<String, Object>(); + private final Map<String, Object> html5DataFlavors = new LinkedHashMap<>(); private DragStartMode dragStartMode = DragStartMode.NONE; private Component dragImageComponent = null; - private Set<String> sentIds = new HashSet<String>(); + private Set<String> sentIds = new HashSet<>(); /** * This is an internal constructor. Use diff --git a/server/src/main/java/com/vaadin/ui/Embedded.java b/server/src/main/java/com/vaadin/ui/Embedded.java index 382b0d47c3..b0c7f1725b 100644 --- a/server/src/main/java/com/vaadin/ui/Embedded.java +++ b/server/src/main/java/com/vaadin/ui/Embedded.java @@ -88,7 +88,7 @@ public class Embedded extends AbstractComponent implements LegacyComponent { /** * Hash of object parameters. */ - private final Map<String, String> parameters = new HashMap<String, String>(); + private final Map<String, String> parameters = new HashMap<>(); /** * Applet or other client side runnable properties. diff --git a/server/src/main/java/com/vaadin/ui/Flash.java b/server/src/main/java/com/vaadin/ui/Flash.java index c6eac450ef..faec5a83d9 100644 --- a/server/src/main/java/com/vaadin/ui/Flash.java +++ b/server/src/main/java/com/vaadin/ui/Flash.java @@ -201,7 +201,7 @@ public class Flash extends AbstractEmbedded { */ public void setParameter(String name, String value) { if (getState().embedParams == null) { - getState().embedParams = new HashMap<String, String>(); + getState().embedParams = new HashMap<>(); } getState().embedParams.put(name, value); requestRepaint(); @@ -238,7 +238,7 @@ public class Flash extends AbstractEmbedded { super.writeDesign(design, designContext); // Parameters, in alphabetic order - ArrayList<String> paramNames = new ArrayList<String>(); + ArrayList<String> paramNames = new ArrayList<>(); for (String param : getParameterNames()) { paramNames.add(param); } diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java index 546a89cdfc..6e74071f65 100644 --- a/server/src/main/java/com/vaadin/ui/GridLayout.java +++ b/server/src/main/java/com/vaadin/ui/GridLayout.java @@ -97,10 +97,10 @@ public class GridLayout extends AbstractLayout */ private int cursorY = 0; - private final LinkedList<Component> components = new LinkedList<Component>(); + private final LinkedList<Component> components = new LinkedList<>(); - private Map<Integer, Float> columnExpandRatio = new HashMap<Integer, Float>(); - private Map<Integer, Float> rowExpandRatio = new HashMap<Integer, Float>(); + private Map<Integer, Float> columnExpandRatio = new HashMap<>(); + private Map<Integer, Float> rowExpandRatio = new HashMap<>(); private Alignment defaultComponentAlignment = Alignment.TOP_LEFT; /** @@ -1290,8 +1290,8 @@ public class GridLayout extends AbstractLayout setMargin(readMargin(design, getMargin(), designContext)); - List<Element> rowElements = new ArrayList<Element>(); - List<Map<Integer, Component>> rows = new ArrayList<Map<Integer, Component>>(); + List<Element> rowElements = new ArrayList<>(); + List<Map<Integer, Component>> rows = new ArrayList<>(); // Prepare a 2D map for reading column contents for (Element e : design.children()) { if (e.tagName().equalsIgnoreCase("row")) { @@ -1301,8 +1301,8 @@ public class GridLayout extends AbstractLayout } } setRows(Math.max(rows.size(), 1)); - Map<Component, Alignment> alignments = new HashMap<Component, Alignment>(); - List<Integer> columnExpandRatios = new ArrayList<Integer>(); + Map<Component, Alignment> alignments = new HashMap<>(); + List<Integer> columnExpandRatios = new ArrayList<>(); for (int row = 0; row < rowElements.size(); ++row) { Element rowElement = rowElements.get(row); @@ -1386,7 +1386,7 @@ public class GridLayout extends AbstractLayout } // Reiterate through the 2D map and add components to GridLayout - Set<Component> visited = new HashSet<Component>(); + Set<Component> visited = new HashSet<>(); // Ignore any missing components visited.add(null); @@ -1457,7 +1457,7 @@ public class GridLayout extends AbstractLayout } // Go through the map and write only needed column tags - Set<Connector> visited = new HashSet<Connector>(); + Set<Connector> visited = new HashSet<>(); // Skip the dummy placeholder visited.add(dummyComponent); diff --git a/server/src/main/java/com/vaadin/ui/JavaScript.java b/server/src/main/java/com/vaadin/ui/JavaScript.java index b51577c4ac..92320c6df1 100644 --- a/server/src/main/java/com/vaadin/ui/JavaScript.java +++ b/server/src/main/java/com/vaadin/ui/JavaScript.java @@ -38,7 +38,7 @@ import elemental.json.JsonException; * @since 7.0.0 */ public class JavaScript extends AbstractExtension { - private Map<String, JavaScriptFunction> functions = new HashMap<String, JavaScriptFunction>(); + private Map<String, JavaScriptFunction> functions = new HashMap<>(); // Can not be defined in client package as this JSONArray is not available // in GWT diff --git a/server/src/main/java/com/vaadin/ui/LoginForm.java b/server/src/main/java/com/vaadin/ui/LoginForm.java index 9e986d34fb..fe31eb3d75 100644 --- a/server/src/main/java/com/vaadin/ui/LoginForm.java +++ b/server/src/main/java/com/vaadin/ui/LoginForm.java @@ -353,7 +353,7 @@ public class LoginForm extends AbstractSingleComponentContainer { * URL in the method or the password manager will not be triggered. */ private void login() { - HashMap<String, String> params = new HashMap<String, String>(); + HashMap<String, String> params = new HashMap<>(); params.put("username", getUsernameField().getValue()); params.put("password", getPasswordField().getValue()); LoginEvent event = new LoginEvent(LoginForm.this, params); diff --git a/server/src/main/java/com/vaadin/ui/MenuBar.java b/server/src/main/java/com/vaadin/ui/MenuBar.java index db252b0619..24f2dd89b3 100644 --- a/server/src/main/java/com/vaadin/ui/MenuBar.java +++ b/server/src/main/java/com/vaadin/ui/MenuBar.java @@ -162,7 +162,7 @@ public class MenuBar extends AbstractComponent /** Deserialize changes received from client. */ @Override public void changeVariables(Object source, Map<String, Object> variables) { - Stack<MenuItem> items = new Stack<MenuItem>(); + Stack<MenuItem> items = new Stack<>(); boolean found = false; if (variables.containsKey("clickedId")) { @@ -205,7 +205,7 @@ public class MenuBar extends AbstractComponent * Constructs an empty, horizontal menu */ public MenuBar() { - menuItems = new ArrayList<MenuItem>(); + menuItems = new ArrayList<>(); setMoreMenuItem(null); } @@ -554,7 +554,7 @@ public class MenuBar extends AbstractComponent } if (itsChildren == null) { - itsChildren = new ArrayList<MenuItem>(); + itsChildren = new ArrayList<>(); } MenuItem newItem = new MenuItem(caption, icon, command); @@ -1005,7 +1005,7 @@ public class MenuBar extends AbstractComponent } String caption = ""; - List<Element> subMenus = new ArrayList<Element>(); + List<Element> subMenus = new ArrayList<>(); for (Node node : menuElement.childNodes()) { if (node instanceof Element && ((Element) node).tagName().equals("menu")) { @@ -1051,7 +1051,7 @@ public class MenuBar extends AbstractComponent } if (!subMenus.isEmpty()) { - menu.itsChildren = new ArrayList<MenuItem>(); + menu.itsChildren = new ArrayList<>(); } for (Element subMenu : subMenus) { diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index ff9e1813f6..a03b342ba0 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -106,12 +106,12 @@ public class TabSheet extends AbstractComponentContainer * there is a {@link Tab} object in tabs for each tab with meta-data about * the tab. */ - private final ArrayList<Component> components = new ArrayList<Component>(); + private final ArrayList<Component> components = new ArrayList<>(); /** * Map containing information related to the tabs (caption, icon etc). */ - private final HashMap<Component, Tab> tabs = new HashMap<Component, Tab>(); + private final HashMap<Component, Tab> tabs = new HashMap<>(); /** * Selected tab content component. @@ -122,7 +122,7 @@ public class TabSheet extends AbstractComponentContainer * Mapper between server-side component instances (tab contents) and keys * given to the client that identify tabs. */ - private final KeyMapper<Component> keyMapper = new KeyMapper<Component>(); + private final KeyMapper<Component> keyMapper = new KeyMapper<>(); /** * Handler to be called when a tab is closed. diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java index 4454f96596..82bbea7039 100644 --- a/server/src/main/java/com/vaadin/ui/UI.java +++ b/server/src/main/java/com/vaadin/ui/UI.java @@ -116,7 +116,7 @@ public abstract class UI extends AbstractSingleComponentContainer /** * List of windows in this UI. */ - private final LinkedHashSet<Window> windows = new LinkedHashSet<Window>(); + private final LinkedHashSet<Window> windows = new LinkedHashSet<>(); /** * The component that should be scrolled into view after the next repaint. @@ -415,7 +415,7 @@ public abstract class UI extends AbstractSingleComponentContainer public Iterator<Component> iterator() { // TODO could directly create some kind of combined iterator instead of // creating a new ArrayList - ArrayList<Component> components = new ArrayList<Component>(); + ArrayList<Component> components = new ArrayList<>(); if (getContent() != null) { components.add(getContent()); diff --git a/server/src/main/java/com/vaadin/ui/Upload.java b/server/src/main/java/com/vaadin/ui/Upload.java index 915e2035fa..9077a35b95 100644 --- a/server/src/main/java/com/vaadin/ui/Upload.java +++ b/server/src/main/java/com/vaadin/ui/Upload.java @@ -783,7 +783,7 @@ public class Upload extends AbstractComponent */ public void addProgressListener(ProgressListener listener) { if (progressListeners == null) { - progressListeners = new LinkedHashSet<ProgressListener>(); + progressListeners = new LinkedHashSet<>(); } progressListeners.add(listener); } diff --git a/server/src/main/java/com/vaadin/ui/Window.java b/server/src/main/java/com/vaadin/ui/Window.java index 6ad8ef500b..c0eac75970 100644 --- a/server/src/main/java/com/vaadin/ui/Window.java +++ b/server/src/main/java/com/vaadin/ui/Window.java @@ -106,7 +106,7 @@ public class Window extends Panel /** * Holds registered CloseShortcut instances for query and later removal */ - private List<CloseShortcut> closeShortcuts = new ArrayList<CloseShortcut>( + private List<CloseShortcut> closeShortcuts = new ArrayList<>( 4); /** @@ -1398,7 +1398,7 @@ public class Window extends Panel @Override protected void readDesignChildren(Elements children, DesignContext context) { - List<Component> descriptions = new ArrayList<Component>(); + List<Component> descriptions = new ArrayList<>(); Elements content = new Elements(); for (Element child : children) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java index ba5c279ed1..a70ab256e1 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -55,7 +55,7 @@ public class DesignAttributeHandler implements Serializable { return Logger.getLogger(DesignAttributeHandler.class.getName()); } - private static Map<Class<?>, AttributeCacheEntry> cache = new ConcurrentHashMap<Class<?>, AttributeCacheEntry>(); + private static Map<Class<?>, AttributeCacheEntry> cache = new ConcurrentHashMap<>(); // translates string <-> object private static DesignFormatter FORMATTER = new DesignFormatter(); @@ -81,7 +81,7 @@ public class DesignAttributeHandler implements Serializable { for (Attribute a : attr.asList()) { attr.remove(a.getKey()); } - List<Node> children = new ArrayList<Node>(); + List<Node> children = new ArrayList<>(); children.addAll(design.childNodes()); for (Node node : children) { node.remove(); @@ -428,7 +428,7 @@ public class DesignAttributeHandler implements Serializable { * @author Vaadin Ltd */ private static class AttributeCacheEntry implements Serializable { - private Map<String, Method[]> accessMethods = new ConcurrentHashMap<String, Method[]>(); + private Map<String, Method[]> accessMethods = new ConcurrentHashMap<>(); private void addAttribute(String attribute, Method getter, Method setter) { @@ -439,7 +439,7 @@ public class DesignAttributeHandler implements Serializable { } private Collection<String> getAttributes() { - ArrayList<String> attributes = new ArrayList<String>(); + ArrayList<String> attributes = new ArrayList<>(); attributes.addAll(accessMethods.keySet()); return attributes; } diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java index 505437d778..35145c45fb 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java @@ -64,7 +64,7 @@ public class DesignContext implements Serializable { private static final String VAADIN7_UI_PACKAGE = "com.vaadin.v7.ui"; // cache for object instances - private static Map<Class<?>, Component> instanceCache = new ConcurrentHashMap<Class<?>, Component>(); + private static Map<Class<?>, Component> instanceCache = new ConcurrentHashMap<>(); // The root component of the component hierarchy private Component rootComponent = null; @@ -74,20 +74,20 @@ public class DesignContext implements Serializable { public static final String CAPTION_ATTRIBUTE = "caption"; public static final String LOCAL_ID_ATTRIBUTE = "_id"; // Mappings from ids to components. Modified when reading from design. - private Map<String, Component> idToComponent = new HashMap<String, Component>(); - private Map<String, Component> localIdToComponent = new HashMap<String, Component>(); - private Map<String, Component> captionToComponent = new HashMap<String, Component>(); + private Map<String, Component> idToComponent = new HashMap<>(); + private Map<String, Component> localIdToComponent = new HashMap<>(); + private Map<String, Component> captionToComponent = new HashMap<>(); // Mapping from components to local ids. Accessed when writing to // design. Modified when reading from design. - private Map<Component, String> componentToLocalId = new HashMap<Component, String>(); + private Map<Component, String> componentToLocalId = new HashMap<>(); private Document doc; // required for calling createElement(String) // namespace mappings - private Map<String, String> packageToPrefix = new HashMap<String, String>(); - private Map<String, String> prefixToPackage = new HashMap<String, String>(); - private final Map<Component, Map<String, String>> customAttributes = new HashMap<Component, Map<String, String>>(); + private Map<String, String> packageToPrefix = new HashMap<>(); + private Map<String, String> prefixToPackage = new HashMap<>(); + private final Map<Component, Map<String, String>> customAttributes = new HashMap<>(); // component creation listeners - private List<ComponentCreationListener> listeners = new ArrayList<ComponentCreationListener>(); + private List<ComponentCreationListener> listeners = new ArrayList<>(); private ShouldWriteDataDelegate shouldWriteDataDelegate = ShouldWriteDataDelegate.DEFAULT; @@ -828,7 +828,7 @@ public class DesignContext implements Serializable { Map<String, String> map = customAttributes.get(component); if (map == null) { customAttributes.put(component, - map = new HashMap<String, String>()); + map = new HashMap<>()); } map.put(attribute, value); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java index 0fcefe0a27..203954dd27 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java @@ -55,7 +55,7 @@ import com.vaadin.ui.declarative.converters.DesignToStringConverter; */ public class DesignFormatter implements Serializable { - private final Map<Class<?>, Converter<String, ?>> converterMap = new ConcurrentHashMap<Class<?>, Converter<String, ?>>(); + private final Map<Class<?>, Converter<String, ?>> converterMap = new ConcurrentHashMap<>(); private final Converter<String, Object> stringObjectConverter = new DesignObjectConverter(); /** diff --git a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java index 25469b8cde..3d7dcc20d9 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java +++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java @@ -40,7 +40,7 @@ public class FieldBinder implements Serializable { // the instance containing the bound fields private Object bindTarget; // mapping between field names and Fields - private Map<String, Field> fieldMap = new HashMap<String, Field>(); + private Map<String, Field> fieldMap = new HashMap<>(); /** * Creates a new instance of LayoutFieldBinder. @@ -79,7 +79,7 @@ public class FieldBinder implements Serializable { * @return a collection of fields assignable to Component that are not bound */ public Collection<String> getUnboundFields() throws FieldBindingException { - List<String> unboundFields = new ArrayList<String>(); + List<String> unboundFields = new ArrayList<>(); for (Field f : fieldMap.values()) { try { Object value = getFieldValue(bindTarget, f); @@ -252,7 +252,7 @@ public class FieldBinder implements Serializable { */ protected static List<java.lang.reflect.Field> getFields( Class<?> searchClass) { - ArrayList<java.lang.reflect.Field> memberFields = new ArrayList<java.lang.reflect.Field>(); + ArrayList<java.lang.reflect.Field> memberFields = new ArrayList<>(); for (java.lang.reflect.Field memberField : searchClass .getDeclaredFields()) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index cc9d6ac655..1efc382fcc 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -169,7 +169,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { return ((ExternalResource) value).getURL(); } - private static Map<Class<? extends Resource>, ResourceConverterByProtocol> typeToConverter = new HashMap<Class<? extends Resource>, ResourceConverterByProtocol>(); + private static Map<Class<? extends Resource>, ResourceConverterByProtocol> typeToConverter = new HashMap<>(); static { typeToConverter.put(ExternalResource.class, HTTP); // ^ any of non-specialized would actually work diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java index fdd61f0489..2468c29c8c 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java @@ -40,7 +40,7 @@ public class DesignShortcutActionConverter private final Map<String, Integer> presentationMap; public DesignShortcutActionConverter() { - HashMap<Integer, String> codes = new HashMap<Integer, String>(); + HashMap<Integer, String> codes = new HashMap<>(); // map modifiers codes.put(ModifierKey.ALT, "alt"); codes.put(ModifierKey.CTRL, "ctrl"); @@ -112,7 +112,7 @@ public class DesignShortcutActionConverter keyCodeMap = Collections.unmodifiableMap(codes); - HashMap<String, Integer> presentations = new HashMap<String, Integer>(); + HashMap<String, Integer> presentations = new HashMap<>(); for (Entry<Integer, String> entry : keyCodeMap.entrySet()) { presentations.put(entry.getValue(), entry.getKey()); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java b/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java index 1862173aba..b1010d811d 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java @@ -54,8 +54,8 @@ public interface ShortcutKeyMapper extends Serializable { */ public static final ShortcutKeyMapper DEFAULT = new ShortcutKeyMapper() { - private final Map<Integer, String> keyCodeMap = new ConcurrentHashMap<Integer, String>(); - private final Map<String, Integer> presentationMap = new ConcurrentHashMap<String, Integer>(); + private final Map<Integer, String> keyCodeMap = new ConcurrentHashMap<>(); + private final Map<String, Integer> presentationMap = new ConcurrentHashMap<>(); { // map modifiers diff --git a/server/src/main/java/com/vaadin/util/ConnectorHelper.java b/server/src/main/java/com/vaadin/util/ConnectorHelper.java index 3cb6a1c425..5b5958175b 100644 --- a/server/src/main/java/com/vaadin/util/ConnectorHelper.java +++ b/server/src/main/java/com/vaadin/util/ConnectorHelper.java @@ -66,7 +66,7 @@ public class ConnectorHelper { */ public static void writeHierarchyInformation(ClientConnector connector, StringBuilder builder) { - LinkedList<ClientConnector> h = new LinkedList<ClientConnector>(); + LinkedList<ClientConnector> h = new LinkedList<>(); h.add(connector); ClientConnector parent = connector.getParent(); while (parent != null) { diff --git a/server/src/main/java/com/vaadin/util/CurrentInstance.java b/server/src/main/java/com/vaadin/util/CurrentInstance.java index be5300e915..f8d6af2a4c 100644 --- a/server/src/main/java/com/vaadin/util/CurrentInstance.java +++ b/server/src/main/java/com/vaadin/util/CurrentInstance.java @@ -72,7 +72,7 @@ public class CurrentInstance implements Serializable { return null; } - Map<Class<?>, CurrentInstance> value = new HashMap<Class<?>, CurrentInstance>(); + Map<Class<?>, CurrentInstance> value = new HashMap<>(); // Copy all inheritable values to child map for (Entry<Class<?>, CurrentInstance> e : parentValue.entrySet()) { @@ -86,7 +86,7 @@ public class CurrentInstance implements Serializable { }; private CurrentInstance(Object instance, boolean inheritable) { - this.instance = new WeakReference<Object>(instance); + this.instance = new WeakReference<>(instance); this.inheritable = inheritable; } @@ -200,7 +200,7 @@ public class CurrentInstance implements Serializable { } else { assert type.isInstance(instance) : "Invald instance type"; if (map == null) { - map = new HashMap<Class<?>, CurrentInstance>(); + map = new HashMap<>(); instances.set(map); } @@ -286,7 +286,7 @@ public class CurrentInstance implements Serializable { if (map == null) { return Collections.emptyMap(); } else { - Map<Class<?>, CurrentInstance> copy = new HashMap<Class<?>, CurrentInstance>(); + Map<Class<?>, CurrentInstance> copy = new HashMap<>(); boolean removeStale = false; for (Class<?> c : map.keySet()) { CurrentInstance ci = map.get(c); @@ -338,7 +338,7 @@ public class CurrentInstance implements Serializable { */ public static Map<Class<?>, CurrentInstance> setCurrent( VaadinSession session) { - Map<Class<?>, CurrentInstance> old = new HashMap<Class<?>, CurrentInstance>(); + Map<Class<?>, CurrentInstance> old = new HashMap<>(); old.put(VaadinSession.class, set(VaadinSession.class, session, true)); VaadinService service = null; if (session != null) { diff --git a/server/src/main/java/com/vaadin/util/FileTypeResolver.java b/server/src/main/java/com/vaadin/util/FileTypeResolver.java index 7700ff9563..305bc1c5d7 100644 --- a/server/src/main/java/com/vaadin/util/FileTypeResolver.java +++ b/server/src/main/java/com/vaadin/util/FileTypeResolver.java @@ -210,12 +210,12 @@ public class FileTypeResolver implements Serializable { /** * File extension to MIME type mapping. All extensions are in lower case. */ - static private Hashtable<String, String> extToMIMEMap = new Hashtable<String, String>(); + static private Hashtable<String, String> extToMIMEMap = new Hashtable<>(); /** * MIME type to Icon mapping. */ - static private Hashtable<String, Resource> MIMEToIconMap = new Hashtable<String, Resource>(); + static private Hashtable<String, Resource> MIMEToIconMap = new Hashtable<>(); static { diff --git a/server/src/test/java/com/vaadin/data/ResultTest.java b/server/src/test/java/com/vaadin/data/ResultTest.java index 4ab9f8e291..2868f74565 100644 --- a/server/src/test/java/com/vaadin/data/ResultTest.java +++ b/server/src/test/java/com/vaadin/data/ResultTest.java @@ -91,7 +91,7 @@ public class ResultTest { @Override public <S> Result<S> flatMap(Function<String, Result<S>> mapper) { - return new SimpleResult<S>(null, "bar"); + return new SimpleResult<>(null, "bar"); } }; Result<String> mapResult = result.map(value -> { diff --git a/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java b/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java index 167606e19e..71e3782fcd 100644 --- a/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java +++ b/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java @@ -41,7 +41,7 @@ public class DragAndDropServiceTest { @Test public void changeVariables_isSourceConnectorEnabledCalled() { - final List<Level> levels = new ArrayList<Level>(); + final List<Level> levels = new ArrayList<>(); Logger.getLogger(DragAndDropService.class.getName()) .addHandler(new StreamHandler() { @Override @@ -49,7 +49,7 @@ public class DragAndDropServiceTest { levels.add(record.getLevel()); } }); - Map<String, Object> variables = new HashMap<String, Object>(); + Map<String, Object> variables = new HashMap<>(); final boolean[] isConnectorEnabledCalled = new boolean[1]; AbstractComponent component = new AbstractComponent() { @Override @@ -73,7 +73,7 @@ public class DragAndDropServiceTest { @Test public void changeVariables_isTargetConnectorEnabledCalled() { - final List<Level> levels = new ArrayList<Level>(); + final List<Level> levels = new ArrayList<>(); Logger.getLogger(DragAndDropService.class.getName()) .addHandler(new StreamHandler() { @Override @@ -81,7 +81,7 @@ public class DragAndDropServiceTest { levels.add(record.getLevel()); } }); - Map<String, Object> variables = new HashMap<String, Object>(); + Map<String, Object> variables = new HashMap<>(); TestDropTarget target = new TestDropTarget(); variables.put("dhowner", target); diff --git a/server/src/test/java/com/vaadin/server/JSONSerializerTest.java b/server/src/test/java/com/vaadin/server/JSONSerializerTest.java index d145c15329..bd60f8f6aa 100644 --- a/server/src/test/java/com/vaadin/server/JSONSerializerTest.java +++ b/server/src/test/java/com/vaadin/server/JSONSerializerTest.java @@ -48,7 +48,7 @@ public class JSONSerializerTest { public void testStringToBeanMapSerialization() throws Exception { Type mapType = getClass().getDeclaredField("stringToStateMap") .getGenericType(); - stringToStateMap = new HashMap<String, AbstractSplitPanelState>(); + stringToStateMap = new HashMap<>(); AbstractSplitPanelState s = new AbstractSplitPanelState(); AbstractSplitPanelState s2 = new AbstractSplitPanelState(); s.caption = "State 1"; @@ -69,7 +69,7 @@ public class JSONSerializerTest { public void testBeanToStringMapSerialization() throws Exception { Type mapType = getClass().getDeclaredField("stateToStringMap") .getGenericType(); - stateToStringMap = new HashMap<AbstractSplitPanelState, String>(); + stateToStringMap = new HashMap<>(); AbstractSplitPanelState s = new AbstractSplitPanelState(); AbstractSplitPanelState s2 = new AbstractSplitPanelState(); s.caption = "State 1"; diff --git a/server/src/test/java/com/vaadin/server/MockVaadinSession.java b/server/src/test/java/com/vaadin/server/MockVaadinSession.java index 1a3f949a46..04d516ecb4 100644 --- a/server/src/test/java/com/vaadin/server/MockVaadinSession.java +++ b/server/src/test/java/com/vaadin/server/MockVaadinSession.java @@ -31,7 +31,7 @@ public class MockVaadinSession extends VaadinSession { * chance of leaking memory if the session is not unlocked in the right way, * but it should be acceptable for testing use. */ - private static final ThreadLocal<MockVaadinSession> referenceKeeper = new ThreadLocal<MockVaadinSession>(); + private static final ThreadLocal<MockVaadinSession> referenceKeeper = new ThreadLocal<>(); public MockVaadinSession(VaadinService service) { super(service); diff --git a/server/src/test/java/com/vaadin/server/data/datasource/StrBean.java b/server/src/test/java/com/vaadin/server/data/datasource/StrBean.java index 6bb1e1bd1a..52d58be310 100644 --- a/server/src/test/java/com/vaadin/server/data/datasource/StrBean.java +++ b/server/src/test/java/com/vaadin/server/data/datasource/StrBean.java @@ -32,7 +32,7 @@ class StrBean implements Serializable { } public static List<StrBean> generateRandomBeans(int max) { - List<StrBean> data = new ArrayList<StrBean>(); + List<StrBean> data = new ArrayList<>(); Random r = new Random(13337); data.add(new StrBean("Xyz", 10, max)); for (int i = 0; i < max - 1; ++i) { diff --git a/server/src/test/java/com/vaadin/tests/VaadinClasses.java b/server/src/test/java/com/vaadin/tests/VaadinClasses.java index ba56fcee35..8c8fbaf7f1 100644 --- a/server/src/test/java/com/vaadin/tests/VaadinClasses.java +++ b/server/src/test/java/com/vaadin/tests/VaadinClasses.java @@ -133,7 +133,7 @@ public class VaadinClasses { private static <T> List<Class<? extends T>> findClasses(Class<T> baseClass, String basePackage, String[] ignoredPackages) throws IOException { - List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>(); + List<Class<? extends T>> classes = new ArrayList<>(); String basePackageDirName = "/" + basePackage.replace('.', '/'); URL location = VaadinSession.class.getResource(basePackageDirName); if (location.getProtocol().equals("file")) { @@ -169,7 +169,7 @@ public class VaadinClasses { throws IOException { List<Class<? extends T>> classes = findClasses(baseClass, basePackage, ignoredPackages); - List<Class<? extends T>> classesNoTests = new ArrayList<Class<? extends T>>(); + List<Class<? extends T>> classesNoTests = new ArrayList<>(); for (Class<? extends T> clazz : classes) { if (!clazz.getName().contains("Test")) { boolean testPresent = false; diff --git a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java index d978444c45..977a96f245 100644 --- a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java +++ b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java @@ -36,7 +36,7 @@ public class ComponentFactoryTest { private static final ComponentFactory defaultFactory = Design .getComponentFactory(); - private static final ThreadLocal<ComponentFactory> currentComponentFactory = new ThreadLocal<ComponentFactory>(); + private static final ThreadLocal<ComponentFactory> currentComponentFactory = new ThreadLocal<>(); // Set static component factory that delegate to a thread local factory static { @@ -62,7 +62,7 @@ public class ComponentFactoryTest { @Test public void testComponentFactoryLogging() { - final List<String> messages = new ArrayList<String>(); + final List<String> messages = new ArrayList<>(); currentComponentFactory.set(new ComponentFactory() { @Override public Component createComponent(String fullyQualifiedClassName, @@ -111,7 +111,7 @@ public class ComponentFactoryTest { @Test public void testGetDefaultInstanceUsesComponentFactory() { - final List<String> classes = new ArrayList<String>(); + final List<String> classes = new ArrayList<>(); currentComponentFactory.set(new ComponentFactory() { @Override public Component createComponent(String fullyQualifiedClassName, diff --git a/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java b/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java index 5b4d2344e6..25062f76f4 100644 --- a/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java +++ b/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java @@ -33,7 +33,7 @@ public class ComponentMapperTest { private static final ComponentMapper defaultMapper = Design .getComponentMapper(); - private static final ThreadLocal<ComponentMapper> currentMapper = new ThreadLocal<ComponentMapper>(); + private static final ThreadLocal<ComponentMapper> currentMapper = new ThreadLocal<>(); static { Design.setComponentMapper(new ComponentMapper() { diff --git a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBase.java b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBase.java index bfa0a61a49..e488c2f964 100644 --- a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBase.java +++ b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBase.java @@ -33,7 +33,7 @@ public abstract class DeclarativeTestBase<T extends Component> private static boolean debug = false; - private final Map<Class<?>, EqualsAsserter<?>> comparators = new HashMap<Class<?>, EqualsAsserter<?>>(); + private final Map<Class<?>, EqualsAsserter<?>> comparators = new HashMap<>(); private static EqualsAsserter standardEqualsComparator = new EqualsAsserter<Object>() { @Override diff --git a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java index b01c1dc7a4..f0bcc8887a 100644 --- a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java +++ b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java @@ -136,7 +136,7 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { } private List<EqualsAsserter<Object>> getComparators(Object o1) { - List<EqualsAsserter<Object>> result = new ArrayList<EqualsAsserter<Object>>(); + List<EqualsAsserter<Object>> result = new ArrayList<>(); getComparators(o1.getClass(), result); return result; } @@ -169,7 +169,7 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { } public static class TestLogHandler { - final List<String> messages = new ArrayList<String>(); + final List<String> messages = new ArrayList<>(); Handler handler = new Handler() { @Override public void publish(LogRecord record) { @@ -258,8 +258,8 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { * include close tags */ private String elementToHtml(Element producedElem, StringBuilder sb) { - HashSet<String> booleanAttributes = new HashSet<String>(); - ArrayList<String> names = new ArrayList<String>(); + HashSet<String> booleanAttributes = new HashSet<>(); + ArrayList<String> names = new ArrayList<>(); for (Attribute a : producedElem.attributes().asList()) { names.add(a.getKey()); if (a instanceof BooleanAttribute) { diff --git a/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java b/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java index b29ddcba7c..6b7ba963cc 100644 --- a/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java +++ b/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java @@ -361,7 +361,7 @@ public class DesignFormatterTest { && SharedUtil.equals(other.getIcon(), act.getIcon()) && act.getKeyCode() == other.getKeyCode() && act.getModifiers().length == other.getModifiers().length) { - HashSet<Integer> thisSet = new HashSet<Integer>( + HashSet<Integer> thisSet = new HashSet<>( act.getModifiers().length); // this is a bit tricky comparison, but there is no nice way of // making int[] into a Set diff --git a/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java b/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java index 6c542a411e..86fb273841 100644 --- a/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java +++ b/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java @@ -55,7 +55,7 @@ public class DesignReadInConstructorTest { private void assertJsoupTreeEquals(Element expected, Element actual) { Assert.assertEquals(expected.tagName(), actual.tagName()); - Set<String> keys = new HashSet<String>(); + Set<String> keys = new HashSet<>(); for (Attribute attr : expected.attributes().asList()) { keys.add(attr.getKey()); diff --git a/server/src/test/java/com/vaadin/tests/event/ShortcutActionTest.java b/server/src/test/java/com/vaadin/tests/event/ShortcutActionTest.java index 5b5028c81a..90bc775efa 100644 --- a/server/src/test/java/com/vaadin/tests/event/ShortcutActionTest.java +++ b/server/src/test/java/com/vaadin/tests/event/ShortcutActionTest.java @@ -39,7 +39,7 @@ public class ShortcutActionTest { @Test public void testHashCodeUniqueness() { - HashSet<ShortcutAction> set = new HashSet<ShortcutAction>(); + HashSet<ShortcutAction> set = new HashSet<>(); for (String modifier : new String[] { "^", "&", "_", "&^", "&_", "_^", "&^_" }) { for (String key : KEYS) { @@ -98,7 +98,7 @@ public class ShortcutActionTest { && SharedUtil.equals(other.getIcon(), act.getIcon()) && act.getKeyCode() == other.getKeyCode() && act.getModifiers().length == other.getModifiers().length) { - HashSet<Integer> thisSet = new HashSet<Integer>( + HashSet<Integer> thisSet = new HashSet<>( act.getModifiers().length); // this is a bit tricky comparison, but there is no nice way of // making int[] into a Set diff --git a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java index 02e2e220a6..964ba585eb 100644 --- a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java +++ b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java @@ -93,12 +93,12 @@ public class ClassesSerializableTest { public void testClassesSerializable() throws Exception { List<String> rawClasspathEntries = getRawClasspathEntries(); - List<String> classes = new ArrayList<String>(); + List<String> classes = new ArrayList<>(); for (String location : rawClasspathEntries) { classes.addAll(findServerClasses(location)); } - ArrayList<Class<?>> nonSerializableClasses = new ArrayList<Class<?>>(); + ArrayList<Class<?>> nonSerializableClasses = new ArrayList<>(); for (String className : classes) { Class<?> cls = Class.forName(className); // skip annotations and synthetic classes @@ -183,7 +183,7 @@ public class ClassesSerializableTest { // private final static List<String> getRawClasspathEntries() { // try to keep the order of the classpath - List<String> locations = new ArrayList<String>(); + List<String> locations = new ArrayList<>(); String pathSep = System.getProperty("path.separator"); String classpath = System.getProperty("java.class.path"); @@ -217,7 +217,7 @@ public class ClassesSerializableTest { */ private List<String> findServerClasses(String classpathEntry) throws IOException { - Collection<String> classes = new ArrayList<String>(); + Collection<String> classes = new ArrayList<>(); File file = new File(classpathEntry); if (file.isDirectory()) { @@ -229,7 +229,7 @@ public class ClassesSerializableTest { return Collections.emptyList(); } - List<String> filteredClasses = new ArrayList<String>(); + List<String> filteredClasses = new ArrayList<>(); for (String className : classes) { boolean ok = false; for (String basePackage : BASE_PACKAGES) { @@ -267,7 +267,7 @@ public class ClassesSerializableTest { * @throws IOException */ private Collection<String> findClassesInJar(File file) throws IOException { - Collection<String> classes = new ArrayList<String>(); + Collection<String> classes = new ArrayList<>(); JarFile jar = new JarFile(file); Enumeration<JarEntry> e = jar.entries(); @@ -307,7 +307,7 @@ public class ClassesSerializableTest { parentPackage += "."; } - Collection<String> classNames = new ArrayList<String>(); + Collection<String> classNames = new ArrayList<>(); // add all directories recursively File[] files = parent.listFiles(); diff --git a/server/src/test/java/com/vaadin/tests/server/KeyMapperTest.java b/server/src/test/java/com/vaadin/tests/server/KeyMapperTest.java index 7ca3c61a55..5b882ac7b3 100644 --- a/server/src/test/java/com/vaadin/tests/server/KeyMapperTest.java +++ b/server/src/test/java/com/vaadin/tests/server/KeyMapperTest.java @@ -15,7 +15,7 @@ public class KeyMapperTest { @Test public void testAdd() { - KeyMapper<Object> mapper = new KeyMapper<Object>(); + KeyMapper<Object> mapper = new KeyMapper<>(); Object o1 = new Object(); Object o2 = new Object(); Object o3 = new Object(); @@ -47,7 +47,7 @@ public class KeyMapperTest { @Test public void testRemoveAll() { - KeyMapper<Object> mapper = new KeyMapper<Object>(); + KeyMapper<Object> mapper = new KeyMapper<>(); Object o1 = new Object(); Object o2 = new Object(); Object o3 = new Object(); @@ -65,7 +65,7 @@ public class KeyMapperTest { @Test public void testRemove() { - KeyMapper<Object> mapper = new KeyMapper<Object>(); + KeyMapper<Object> mapper = new KeyMapper<>(); Object o1 = new Object(); Object o2 = new Object(); Object o3 = new Object(); diff --git a/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java b/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java index e437708992..75ab52370d 100644 --- a/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java +++ b/server/src/test/java/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java @@ -174,7 +174,7 @@ public class AttachDetachListenersTest { } public static <E extends ConnectorEvent> E eventEquals(E expected) { - EasyMock.reportMatcher(new EventEquals<E>(expected)); + EasyMock.reportMatcher(new EventEquals<>(expected)); return null; } diff --git a/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java b/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java index b3a2842656..8f1c54ff6f 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java +++ b/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java @@ -19,7 +19,7 @@ public abstract class AbstractListenerMethodsTestBase { } private static void findAllListenerMethods() { - Set<Class<?>> classes = new HashSet<Class<?>>(); + Set<Class<?>> classes = new HashSet<>(); for (Class<?> c : VaadinClasses.getAllServerSideClasses()) { while (c != null && c.getName().startsWith("com.vaadin.")) { classes.add(c); diff --git a/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java b/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java index 6dd451ac2a..5519163012 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java @@ -22,7 +22,7 @@ public class FinalMethodTest { @Test public void testThatComponentsHaveNoFinalMethods() { - HashSet<Class<?>> tested = new HashSet<Class<?>>(); + HashSet<Class<?>> tested = new HashSet<>(); for (Class<? extends Component> c : VaadinClasses.getComponents()) { ensureNoFinalMethods(c, tested); } diff --git a/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java b/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java index 07a7afbfe5..57647f1e6a 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java @@ -19,7 +19,7 @@ import com.vaadin.ui.UI; public class StateGetDoesNotMarkDirtyTest { - private Set<String> excludedMethods = new HashSet<String>(); + private Set<String> excludedMethods = new HashSet<>(); @Before public void setUp() { @@ -33,7 +33,7 @@ public class StateGetDoesNotMarkDirtyTest { Component newInstance = construct(c); prepareMockUI(newInstance); - Set<Method> methods = new HashSet<Method>(); + Set<Method> methods = new HashSet<>(); methods.addAll(Arrays.asList(c.getMethods())); methods.addAll(Arrays.asList(c.getDeclaredMethods())); for (Method method : methods) { diff --git a/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java index 0f1905ea02..1c3b68e5fc 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java @@ -60,7 +60,7 @@ public class CustomLayoutTest { private Integer getBufferSize() throws IllegalAccessException { Field[] fields = CustomLayout.class.getDeclaredFields(); - List<Field> list = new ArrayList<Field>(fields.length); + List<Field> list = new ArrayList<>(fields.length); for (Field field : fields) { if ((field.getModifiers() & Modifier.STATIC) > 0) { list.add(field); diff --git a/server/src/test/java/com/vaadin/tests/server/component/datefield/ResolutionTest.java b/server/src/test/java/com/vaadin/tests/server/component/datefield/ResolutionTest.java index a23c60b106..2fb7702aeb 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/datefield/ResolutionTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/datefield/ResolutionTest.java @@ -13,7 +13,7 @@ public class ResolutionTest { public void testResolutionHigherOrEqualToYear() { Iterable<Resolution> higherOrEqual = Resolution .getResolutionsHigherOrEqualTo(Resolution.YEAR); - ArrayList<Resolution> expected = new ArrayList<Resolution>(); + ArrayList<Resolution> expected = new ArrayList<>(); expected.add(Resolution.YEAR); TestUtil.assertIterableEquals(expected, higherOrEqual); } @@ -22,7 +22,7 @@ public class ResolutionTest { public void testResolutionHigherOrEqualToDay() { Iterable<Resolution> higherOrEqual = Resolution .getResolutionsHigherOrEqualTo(Resolution.DAY); - ArrayList<Resolution> expected = new ArrayList<Resolution>(); + ArrayList<Resolution> expected = new ArrayList<>(); expected.add(Resolution.DAY); expected.add(Resolution.MONTH); expected.add(Resolution.YEAR); @@ -34,7 +34,7 @@ public class ResolutionTest { public void testResolutionLowerThanDay() { Iterable<Resolution> higherOrEqual = Resolution .getResolutionsLowerThan(Resolution.DAY); - ArrayList<Resolution> expected = new ArrayList<Resolution>(); + ArrayList<Resolution> expected = new ArrayList<>(); expected.add(Resolution.HOUR); expected.add(Resolution.MINUTE); expected.add(Resolution.SECOND); @@ -46,7 +46,7 @@ public class ResolutionTest { public void testResolutionLowerThanSecond() { Iterable<Resolution> higherOrEqual = Resolution .getResolutionsLowerThan(Resolution.SECOND); - ArrayList<Resolution> expected = new ArrayList<Resolution>(); + ArrayList<Resolution> expected = new ArrayList<>(); TestUtil.assertIterableEquals(expected, higherOrEqual); } @@ -54,7 +54,7 @@ public class ResolutionTest { public void testResolutionLowerThanYear() { Iterable<Resolution> higherOrEqual = Resolution .getResolutionsLowerThan(Resolution.YEAR); - ArrayList<Resolution> expected = new ArrayList<Resolution>(); + ArrayList<Resolution> expected = new ArrayList<>(); expected.add(Resolution.MONTH); expected.add(Resolution.DAY); expected.add(Resolution.HOUR); diff --git a/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java b/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java index 105cf6660a..f42b9a5683 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java @@ -23,7 +23,7 @@ public class MenuBarIdsTest implements Command { private MenuItem menuFileOpen; private MenuItem menuFileSave; private MenuItem menuFileExit; - private Set<MenuItem> menuItems = new HashSet<MenuItem>(); + private Set<MenuItem> menuItems = new HashSet<>(); private MenuBar menuBar; @@ -71,7 +71,7 @@ public class MenuBarIdsTest implements Command { private static void assertUniqueIds(MenuBar menuBar) { - Set<Object> ids = new HashSet<Object>(); + Set<Object> ids = new HashSet<>(); for (MenuItem item : menuBar.getItems()) { assertUniqueIds(ids, item); diff --git a/server/src/test/java/com/vaadin/tests/server/component/ui/CustomUIClassLoaderTest.java b/server/src/test/java/com/vaadin/tests/server/component/ui/CustomUIClassLoaderTest.java index a7392be3da..f7a78b34ec 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/ui/CustomUIClassLoaderTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/ui/CustomUIClassLoaderTest.java @@ -37,7 +37,7 @@ public class CustomUIClassLoaderTest { */ public class LoggingClassLoader extends ClassLoader { - private List<String> requestedClasses = new ArrayList<String>(); + private List<String> requestedClasses = new ArrayList<>(); @Override protected synchronized Class<?> loadClass(String name, boolean resolve) diff --git a/server/src/test/java/com/vaadin/tests/server/components/WindowTest.java b/server/src/test/java/com/vaadin/tests/server/components/WindowTest.java index ed22870b59..a38ba9b0f9 100644 --- a/server/src/test/java/com/vaadin/tests/server/components/WindowTest.java +++ b/server/src/test/java/com/vaadin/tests/server/components/WindowTest.java @@ -80,14 +80,14 @@ public class WindowTest { } private void sendResize(Window window2) { - Map<String, Object> variables = new HashMap<String, Object>(); + Map<String, Object> variables = new HashMap<>(); variables.put("height", 1234); window.changeVariables(window, variables); } private static void sendClose(Window window) { - Map<String, Object> variables = new HashMap<String, Object>(); + Map<String, Object> variables = new HashMap<>(); variables.put("close", true); window.changeVariables(window, variables); } diff --git a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java index 5f676cbcbd..c7bb725cc9 100644 --- a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java +++ b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java @@ -114,9 +114,9 @@ public class NavigatorTest { } public static class ViewChangeTestListener implements ViewChangeListener { - private final LinkedList<ViewChangeEvent> referenceEvents = new LinkedList<ViewChangeListener.ViewChangeEvent>(); - private final LinkedList<Boolean> referenceIsCheck = new LinkedList<Boolean>(); - private final LinkedList<Boolean> checkReturnValues = new LinkedList<Boolean>(); + private final LinkedList<ViewChangeEvent> referenceEvents = new LinkedList<>(); + private final LinkedList<Boolean> referenceIsCheck = new LinkedList<>(); + private final LinkedList<Boolean> checkReturnValues = new LinkedList<>(); public void addExpectedIsViewChangeAllowed(ViewChangeEvent event, boolean returnValue) { diff --git a/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java b/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java index d621c0d2b4..c322eb7ed8 100644 --- a/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java +++ b/server/src/test/java/com/vaadin/tests/util/GraphVizClassHierarchyCreator.java @@ -26,12 +26,12 @@ public class GraphVizClassHierarchyCreator { StringBuilder sb = new StringBuilder(); - Set<Class> classesAndParents = new HashSet<Class>(); + Set<Class> classesAndParents = new HashSet<>(); for (Class<?> cls : classes) { addClassAndParents(classesAndParents, cls, packageToInclude); } - Set<Class> interfaces = new HashSet<Class>(); + Set<Class> interfaces = new HashSet<>(); for (Object cls : classesAndParents.toArray()) { for (Class<?> c : ((Class) cls).getInterfaces()) { addClassAndParentInterfaces(classesAndParents, c, diff --git a/server/src/test/java/com/vaadin/tests/util/MockDeploymentConfiguration.java b/server/src/test/java/com/vaadin/tests/util/MockDeploymentConfiguration.java index b4bf571fd0..e4665adf52 100644 --- a/server/src/test/java/com/vaadin/tests/util/MockDeploymentConfiguration.java +++ b/server/src/test/java/com/vaadin/tests/util/MockDeploymentConfiguration.java @@ -18,7 +18,7 @@ public class MockDeploymentConfiguration private boolean closeIdleSessions = false; private PushMode pushMode = PushMode.DISABLED; private Properties initParameters = new Properties(); - private Map<String, String> applicationOrSystemProperty = new HashMap<String, String>(); + private Map<String, String> applicationOrSystemProperty = new HashMap<>(); private boolean syncIdCheckEnabled = true; private boolean sendUrlsAsParameters = true; diff --git a/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java b/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java index fefa615a91..0d698b19e8 100644 --- a/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java +++ b/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java @@ -223,7 +223,7 @@ public class CurrentInstanceTest { .setCurrent(session2); // Use weak ref to verify object is collected - WeakReference<VaadinSession> ref = new WeakReference<VaadinSession>( + WeakReference<VaadinSession> ref = new WeakReference<>( session1); session1 = null; diff --git a/shared/src/main/java/com/vaadin/shared/JavaScriptExtensionState.java b/shared/src/main/java/com/vaadin/shared/JavaScriptExtensionState.java index 52b8ce895d..a37e453835 100644 --- a/shared/src/main/java/com/vaadin/shared/JavaScriptExtensionState.java +++ b/shared/src/main/java/com/vaadin/shared/JavaScriptExtensionState.java @@ -26,8 +26,8 @@ import com.vaadin.shared.communication.SharedState; public class JavaScriptExtensionState extends SharedState implements JavaScriptConnectorState { - private Set<String> callbackNames = new HashSet<String>(); - private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>(); + private Set<String> callbackNames = new HashSet<>(); + private Map<String, Set<String>> rpcInterfaces = new HashMap<>(); @Override public Set<String> getCallbackNames() { diff --git a/shared/src/main/java/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java b/shared/src/main/java/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java index 818c292fa4..0e2dc2c841 100644 --- a/shared/src/main/java/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java +++ b/shared/src/main/java/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java @@ -21,7 +21,7 @@ import java.util.Map; import com.vaadin.shared.ApplicationConstants; public class LegacyChangeVariablesInvocation extends MethodInvocation { - private Map<String, Object> variableChanges = new HashMap<String, Object>(); + private Map<String, Object> variableChanges = new HashMap<>(); public LegacyChangeVariablesInvocation(String connectorId, String variableName, Object value) { diff --git a/shared/src/main/java/com/vaadin/shared/communication/SharedState.java b/shared/src/main/java/com/vaadin/shared/communication/SharedState.java index 6506d0a7ca..6b9c1045c5 100644 --- a/shared/src/main/java/com/vaadin/shared/communication/SharedState.java +++ b/shared/src/main/java/com/vaadin/shared/communication/SharedState.java @@ -59,7 +59,7 @@ public class SharedState implements Serializable { * com.vaadin.server.Resource) * @see com.vaadin.client.ui.AbstractConnector#getResourceUrl(String) */ - public Map<String, URLReference> resources = new HashMap<String, URLReference>(); + public Map<String, URLReference> resources = new HashMap<>(); public boolean enabled = true; /** diff --git a/shared/src/main/java/com/vaadin/shared/extension/javascriptmanager/JavaScriptManagerState.java b/shared/src/main/java/com/vaadin/shared/extension/javascriptmanager/JavaScriptManagerState.java index 15a89a6699..5abf858f42 100644 --- a/shared/src/main/java/com/vaadin/shared/extension/javascriptmanager/JavaScriptManagerState.java +++ b/shared/src/main/java/com/vaadin/shared/extension/javascriptmanager/JavaScriptManagerState.java @@ -22,5 +22,5 @@ import java.util.Set; import com.vaadin.shared.communication.SharedState; public class JavaScriptManagerState extends SharedState { - public Set<String> names = new HashSet<String>(); + public Set<String> names = new HashSet<>(); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java b/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java index 54ec61f93a..d7cddf566a 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/AbstractMediaState.java @@ -36,7 +36,7 @@ public class AbstractMediaState extends AbstractComponentState { @NoLayout public boolean muted; - public List<URLReference> sources = new ArrayList<URLReference>(); + public List<URLReference> sources = new ArrayList<>(); - public List<String> sourceTypes = new ArrayList<String>(); + public List<String> sourceTypes = new ArrayList<>(); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/BrowserWindowOpenerState.java b/shared/src/main/java/com/vaadin/shared/ui/BrowserWindowOpenerState.java index 25cee8a587..f1a4ea9be3 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/BrowserWindowOpenerState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/BrowserWindowOpenerState.java @@ -30,6 +30,6 @@ public class BrowserWindowOpenerState extends AbstractComponentState { public String uriFragment; - public Map<String, String> parameters = new HashMap<String, String>(); + public Map<String, String> parameters = new HashMap<>(); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java b/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java index e18060e3bc..a38b828471 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java +++ b/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java @@ -78,7 +78,7 @@ public final class ComponentStateUtil implements Serializable { public static final void addRegisteredEventListener(SharedState state, String eventListenerId) { if (state.registeredEventListeners == null) { - state.registeredEventListeners = new HashSet<String>(); + state.registeredEventListeners = new HashSet<>(); } state.registeredEventListeners.add(eventListenerId); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/JavaScriptComponentState.java b/shared/src/main/java/com/vaadin/shared/ui/JavaScriptComponentState.java index 0cfecee087..cb65592516 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/JavaScriptComponentState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/JavaScriptComponentState.java @@ -27,8 +27,8 @@ import com.vaadin.shared.JavaScriptConnectorState; public class JavaScriptComponentState extends AbstractComponentState implements JavaScriptConnectorState { - private Set<String> callbackNames = new HashSet<String>(); - private Map<String, Set<String>> rpcInterfaces = new HashMap<String, Set<String>>(); + private Set<String> callbackNames = new HashSet<>(); + private Map<String, Set<String>> rpcInterfaces = new HashMap<>(); @Override public Set<String> getCallbackNames() { diff --git a/shared/src/main/java/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java b/shared/src/main/java/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java index a30482b4e7..f304ccad12 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java @@ -26,5 +26,5 @@ public class AbsoluteLayoutState extends AbstractLayoutState { } // Maps each component to a position - public Map<String, String> connectorToCssPosition = new HashMap<String, String>(); + public Map<String, String> connectorToCssPosition = new HashMap<>(); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/csslayout/CssLayoutState.java b/shared/src/main/java/com/vaadin/shared/ui/csslayout/CssLayoutState.java index 21c97a93f9..eefc280649 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/csslayout/CssLayoutState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/csslayout/CssLayoutState.java @@ -25,5 +25,5 @@ public class CssLayoutState extends AbstractLayoutState { { primaryStyleName = "v-csslayout"; } - public Map<Connector, String> childCss = new HashMap<Connector, String>(); + public Map<Connector, String> childCss = new HashMap<>(); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/customlayout/CustomLayoutState.java b/shared/src/main/java/com/vaadin/shared/ui/customlayout/CustomLayoutState.java index 982393b21b..184346b9b7 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/customlayout/CustomLayoutState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/customlayout/CustomLayoutState.java @@ -25,7 +25,7 @@ public class CustomLayoutState extends AbstractLayoutState { { primaryStyleName = "v-customlayout"; } - public Map<Connector, String> childLocations = new HashMap<Connector, String>(); + public Map<Connector, String> childLocations = new HashMap<>(); public String templateContents; public String templateName; } diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java index 344953d591..93dbb7ab83 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java +++ b/shared/src/main/java/com/vaadin/shared/ui/datefield/Resolution.java @@ -56,7 +56,7 @@ public enum Resolution { */ public static Iterable<Resolution> getResolutionsHigherOrEqualTo( Resolution r) { - List<Resolution> resolutions = new ArrayList<Resolution>(); + List<Resolution> resolutions = new ArrayList<>(); Resolution[] values = Resolution.values(); for (int i = r.ordinal(); i < values.length; i++) { resolutions.add(values[i]); @@ -74,7 +74,7 @@ public enum Resolution { * @return An iterable for the resolutions lower than r */ public static List<Resolution> getResolutionsLowerThan(Resolution r) { - List<Resolution> resolutions = new ArrayList<Resolution>(); + List<Resolution> resolutions = new ArrayList<>(); Resolution[] values = Resolution.values(); for (int i = r.ordinal() - 1; i >= 0; i--) { resolutions.add(values[i]); diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java index add8eb8938..15e17b5ab8 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/GridState.java @@ -102,7 +102,7 @@ public class GridState extends TabIndexState { /** * Column order in grid. */ - public List<String> columnOrder = new ArrayList<String>(); + public List<String> columnOrder = new ArrayList<>(); /** The number of frozen columns. */ @DelegateToWidget diff --git a/shared/src/main/java/com/vaadin/shared/ui/gridlayout/GridLayoutState.java b/shared/src/main/java/com/vaadin/shared/ui/gridlayout/GridLayoutState.java index 000e396e12..c38c76852a 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/gridlayout/GridLayoutState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/gridlayout/GridLayoutState.java @@ -36,9 +36,9 @@ public class GridLayoutState extends AbstractLayoutState { public int columns = 0; public int marginsBitmask = 0; // Set of indexes of implicitly Ratios rows and columns - public Set<Integer> explicitRowRatios = new HashSet<Integer>();; - public Set<Integer> explicitColRatios = new HashSet<Integer>(); - public Map<Connector, ChildComponentData> childData = new HashMap<Connector, GridLayoutState.ChildComponentData>(); + public Set<Integer> explicitRowRatios = new HashSet<>();; + public Set<Integer> explicitColRatios = new HashSet<>(); + public Map<Connector, ChildComponentData> childData = new HashMap<>(); public boolean hideEmptyRowsAndColumns = false; public float[] rowExpand; public float[] colExpand; diff --git a/shared/src/main/java/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java b/shared/src/main/java/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java index a5d2d3a89c..fb8d4b9301 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java @@ -25,7 +25,7 @@ import com.vaadin.shared.ui.AlignmentInfo; public class AbstractOrderedLayoutState extends AbstractLayoutState { public boolean spacing = false; - public HashMap<Connector, ChildComponentData> childData = new HashMap<Connector, ChildComponentData>(); + public HashMap<Connector, ChildComponentData> childData = new HashMap<>(); public int marginsBitmask = 0; diff --git a/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java b/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java index de39a63438..f1b01fc076 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java @@ -36,7 +36,7 @@ public class TabsheetState extends AbstractComponentState { @NoLayout public int tabIndex; - public List<TabState> tabs = new ArrayList<TabState>(); + public List<TabState> tabs = new ArrayList<>(); /** true to show the tab bar, false to only show the contained component */ public boolean tabsVisible = true; diff --git a/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java b/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java index cc43ddb938..82054e1d30 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java @@ -32,7 +32,7 @@ public class UIState extends TabIndexState { // Informing users of assistive devices, that the content of this container // is announced automatically and does not need to be navigated into public String overlayContainerLabel = "This content is announced automatically and does not need to be navigated into."; - public Map<String, NotificationTypeConfiguration> notificationConfigurations = new HashMap<String, NotificationTypeConfiguration>(); + public Map<String, NotificationTypeConfiguration> notificationConfigurations = new HashMap<>(); { notificationConfigurations.put("error", new NotificationTypeConfiguration("Error: ", @@ -117,7 +117,7 @@ public class UIState extends TabIndexState { public boolean alwaysUseXhrForServerRequests = false; public PushMode mode = PushMode.DISABLED; public String pushUrl = null; - public Map<String, String> parameters = new HashMap<String, String>(); + public Map<String, String> parameters = new HashMap<>(); { parameters.put(TRANSPORT_PARAM, Transport.WEBSOCKET.getIdentifier()); @@ -137,7 +137,7 @@ public class UIState extends TabIndexState { } public static class LocaleServiceState implements Serializable { - public List<LocaleData> localeData = new ArrayList<LocaleData>(); + public List<LocaleData> localeData = new ArrayList<>(); } public static class LocaleData implements Serializable { diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java index 1c9982886d..dbfda17bfd 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -260,7 +260,7 @@ public abstract class AbstractTB3Test extends ParallelTest { * {@link #isPush()}. */ protected void openTestURL(Class<?> uiClass, String... parameters) { - openTestURL(uiClass, new HashSet<String>(Arrays.asList(parameters))); + openTestURL(uiClass, new HashSet<>(Arrays.asList(parameters))); } private void openTestURL(Class<?> uiClass, Set<String> parameters) { @@ -979,7 +979,7 @@ public abstract class AbstractTB3Test extends ParallelTest { protected List<String> getLogs() { VerticalLayoutElement log = $(VerticalLayoutElement.class).id("Log"); List<LabelElement> logLabels = log.$(LabelElement.class).all(); - List<String> logTexts = new ArrayList<String>(); + List<String> logTexts = new ArrayList<>(); for (LabelElement label : logLabels) { logTexts.add(label.getText()); diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/MultiBrowserTest.java index cef11a69bd..1193ba9334 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/MultiBrowserTest.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/MultiBrowserTest.java @@ -97,7 +97,7 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { protected List<DesiredCapabilities> getBrowserCapabilities( Browser... browsers) { - List<DesiredCapabilities> capabilities = new ArrayList<DesiredCapabilities>(); + List<DesiredCapabilities> capabilities = new ArrayList<>(); for (Browser browser : browsers) { capabilities.add(browser.getDesiredCapabilities()); } diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/ParallelScheduler.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/ParallelScheduler.java index 100ee83918..e270e26c53 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/ParallelScheduler.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/ParallelScheduler.java @@ -31,7 +31,7 @@ import org.junit.runners.model.RunnerScheduler; * @author Vaadin Ltd */ public class ParallelScheduler implements RunnerScheduler { - private final List<Future<Object>> fResults = new ArrayList<Future<Object>>(); + private final List<Future<Object>> fResults = new ArrayList<>(); private ExecutorService fService; /** diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java index 83aba8a3f9..25261584d2 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java @@ -48,7 +48,7 @@ public class ParameterizedTB3Runner extends TB3Runner { protected List<FrameworkMethod> computeTestMethods() { List<FrameworkMethod> methods = super.computeTestMethods(); - Map<Method, Collection<String>> parameters = new LinkedHashMap<Method, Collection<String>>(); + Map<Method, Collection<String>> parameters = new LinkedHashMap<>(); // Find all @Parameters methods and invoke them to find out permutations @@ -108,7 +108,7 @@ public class ParameterizedTB3Runner extends TB3Runner { // Add method permutations for all @Parameters for (Method setter : parameters.keySet()) { - List<FrameworkMethod> newMethods = new ArrayList<FrameworkMethod>(); + List<FrameworkMethod> newMethods = new ArrayList<>(); for (FrameworkMethod m : methods) { if (!(m instanceof TBMethod)) { diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java index aea24c6727..ffc4ec9043 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java @@ -98,7 +98,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { */ @Before public void setupScreenComparisonParameters() { - screenshotFailures = new ArrayList<String>(); + screenshotFailures = new ArrayList<>(); Parameters.setScreenshotErrorDirectory(getScreenshotErrorDirectory()); Parameters.setScreenshotReferenceDirectory( @@ -133,7 +133,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { File mainReference = getScreenshotReferenceFile(identifier); List<File> referenceFiles = findReferenceAndAlternatives(mainReference); - List<File> failedReferenceFiles = new ArrayList<File>(); + List<File> failedReferenceFiles = new ArrayList<>(); for (File referenceFile : referenceFiles) { boolean match = false; @@ -275,7 +275,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { * given files, including the given reference */ private List<File> findReferenceAndAlternatives(File reference) { - List<File> files = new ArrayList<File>(); + List<File> files = new ArrayList<>(); files.add(reference); File screenshotDir = reference.getParentFile(); diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/TB3TestLocator.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/TB3TestLocator.java index 5733ac4f27..8635477491 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/TB3TestLocator.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/TB3TestLocator.java @@ -67,7 +67,7 @@ public class TB3TestLocator { */ protected <T> List<Class<? extends T>> findClasses(Class<T> baseClass, String basePackage, String[] ignoredPackages) throws IOException { - List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>(); + List<Class<? extends T>> classes = new ArrayList<>(); String basePackageDirName = "/" + basePackage.replace('.', '/'); URL location = baseClass.getResource(basePackageDirName); if (location.getProtocol().equals("file")) { diff --git a/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java index b4ac8d5425..6108755058 100644 --- a/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -100,9 +100,9 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { * The name of the application class currently used. Only valid within one * request. */ - private LinkedHashSet<String> defaultPackages = new LinkedHashSet<String>(); + private LinkedHashSet<String> defaultPackages = new LinkedHashSet<>(); - private transient final ThreadLocal<HttpServletRequest> request = new ThreadLocal<HttpServletRequest>(); + private transient final ThreadLocal<HttpServletRequest> request = new ThreadLocal<>(); @Override public void init(ServletConfig servletConfig) throws ServletException { @@ -339,7 +339,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { File uitestDir = new File("uitest/src"); if (uitestDir.isDirectory()) { - LinkedList<File> stack = new LinkedList<File>(); + LinkedList<File> stack = new LinkedList<>(); stack.add(uitestDir); long lastModifiedTimestamp = Long.MIN_VALUE; diff --git a/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java index d8319e6516..63ecc3c8db 100644 --- a/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -217,7 +217,7 @@ public class DevelopmentServerLauncher { interval = Integer.parseInt(serverArgs.get("scaninterval")); } - List<File> classFolders = new ArrayList<File>(); + List<File> classFolders = new ArrayList<>(); String[] paths = serverArgs.get("autoreload").split(","); if (paths.length == 1 && "all".equals(paths[0])) { ClassLoader cl = server.getClass().getClassLoader(); @@ -370,7 +370,7 @@ public class DevelopmentServerLauncher { * @return map of arguments key value pairs. */ protected static Map<String, String> parseArguments(String[] args) { - final Map<String, String> map = new HashMap<String, String>(); + final Map<String, String> map = new HashMap<>(); for (int i = 0; i < args.length; i++) { final int d = args[i].indexOf("="); if (d > 0 && d < args[i].length() && args[i].startsWith("--")) { diff --git a/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java b/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java index 857966af9c..419fe1213c 100644 --- a/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java +++ b/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java @@ -385,7 +385,7 @@ public class ScreenshotBrowser extends UI { } }); - BeanItemContainer<ComparisonFailure> container = new BeanItemContainer<ComparisonFailure>( + BeanItemContainer<ComparisonFailure> container = new BeanItemContainer<>( ComparisonFailure.class); for (File failure : failures) { container.addBean(new ComparisonFailure(failure)); diff --git a/uitest/src/main/java/com/vaadin/tests/Components.java b/uitest/src/main/java/com/vaadin/tests/Components.java index d16afa1232..eea70f6ad1 100644 --- a/uitest/src/main/java/com/vaadin/tests/Components.java +++ b/uitest/src/main/java/com/vaadin/tests/Components.java @@ -33,13 +33,13 @@ import com.vaadin.v7.ui.Tree.ItemStyleGenerator; public class Components extends LegacyApplication { private static final Object CAPTION = "c"; - private Map<Class<? extends AbstractComponentTest>, String> tests = new HashMap<Class<? extends AbstractComponentTest>, String>(); + private Map<Class<? extends AbstractComponentTest>, String> tests = new HashMap<>(); private Tree naviTree; private HorizontalSplitPanel sp; private LegacyWindow mainWindow; private final Embedded applicationEmbedder = new Embedded(); private String baseUrl; - private List<Class<? extends Component>> componentsWithoutTests = new ArrayList<Class<? extends Component>>(); + private List<Class<? extends Component>> componentsWithoutTests = new ArrayList<>(); { for (Class<?> c : VaadinClasses.getBasicComponentTests()) { @@ -49,7 +49,7 @@ public class Components extends LegacyApplication { List<Class<? extends Component>> componentsWithoutTest = VaadinClasses .getComponents(); - Set<String> availableTests = new HashSet<String>(); + Set<String> availableTests = new HashSet<>(); for (String testName : tests.values()) { availableTests.add(testName); } diff --git a/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java b/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java index 915e120a7a..3e885f1078 100644 --- a/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java +++ b/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java @@ -24,7 +24,7 @@ public class ListenerOrder extends com.vaadin.server.LegacyApplication Select s1; - HashMap<String, Integer> buttonListeners = new HashMap<String, Integer>(); + HashMap<String, Integer> buttonListeners = new HashMap<>(); @Override public void init() { diff --git a/uitest/src/main/java/com/vaadin/tests/OrderedLayoutSwapComponents.java b/uitest/src/main/java/com/vaadin/tests/OrderedLayoutSwapComponents.java index e6f0405bf4..0dbe05fdee 100644 --- a/uitest/src/main/java/com/vaadin/tests/OrderedLayoutSwapComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/OrderedLayoutSwapComponents.java @@ -37,7 +37,7 @@ public class OrderedLayoutSwapComponents extends CustomComponent { private final AbstractOrderedLayout main; - ArrayList<MyComponent> order = new ArrayList<MyComponent>(); + ArrayList<MyComponent> order = new ArrayList<>(); public OrderedLayoutSwapComponents() { diff --git a/uitest/src/main/java/com/vaadin/tests/StressComponentsInTable.java b/uitest/src/main/java/com/vaadin/tests/StressComponentsInTable.java index 3b045eb50b..3e17dc99f1 100644 --- a/uitest/src/main/java/com/vaadin/tests/StressComponentsInTable.java +++ b/uitest/src/main/java/com/vaadin/tests/StressComponentsInTable.java @@ -43,7 +43,7 @@ public class StressComponentsInTable extends CustomComponent { } t.addContainerProperty("button", Button.class, null); for (int i = 0; i < rows; i++) { - final Vector<Object> content = new Vector<Object>(); + final Vector<Object> content = new Vector<>(); for (int j = 0; j < cols; j++) { content.add(rndString()); } diff --git a/uitest/src/main/java/com/vaadin/tests/TestBench.java b/uitest/src/main/java/com/vaadin/tests/TestBench.java index f904925f1d..2f77086ed7 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestBench.java +++ b/uitest/src/main/java/com/vaadin/tests/TestBench.java @@ -70,7 +70,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication VerticalLayout bodyLayout = new VerticalLayout(); // TODO this could probably be a simple Set - HashMap<Class<?>, String> itemCaptions = new HashMap<Class<?>, String>(); + HashMap<Class<?>, String> itemCaptions = new HashMap<>(); @Override public void init() { @@ -278,7 +278,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication */ public static List<Class<?>> getTestableClassesForPackage( String packageName) throws Exception { - final ArrayList<File> directories = new ArrayList<File>(); + final ArrayList<File> directories = new ArrayList<>(); try { final ClassLoader cld = Thread.currentThread() .getContextClassLoader(); @@ -297,7 +297,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication packageName + " does not appear to be a valid package."); } - final ArrayList<Class<?>> classes = new ArrayList<Class<?>>(); + final ArrayList<Class<?>> classes = new ArrayList<>(); // For every directory identified capture all the .class files for (final Iterator<File> it = directories.iterator(); it.hasNext();) { final File directory = it.next(); diff --git a/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java b/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java index 27c93ad426..ce044db4a5 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java @@ -93,7 +93,7 @@ public class TestForChildComponentRendering extends CustomComponent { public void randomReorder() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<Component>(); + final ArrayList<Component> components = new ArrayList<>(); while (it.hasNext()) { components.add(it.next()); } @@ -110,7 +110,7 @@ public class TestForChildComponentRendering extends CustomComponent { public void removeRandomComponent() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<Component>(); + final ArrayList<Component> components = new ArrayList<>(); while (it.hasNext()) { components.add(it.next()); } diff --git a/uitest/src/main/java/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java b/uitest/src/main/java/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java index 3757a13829..eec5bcd27d 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java @@ -94,7 +94,7 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent { public void randomReorder() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<Component>(); + final ArrayList<Component> components = new ArrayList<>(); while (it.hasNext()) { components.add(it.next()); } @@ -118,7 +118,7 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent { public void removeRandomComponent() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<Component>(); + final ArrayList<Component> components = new ArrayList<>(); while (it.hasNext()) { components.add(it.next()); } diff --git a/uitest/src/main/java/com/vaadin/tests/TestForMultipleStyleNames.java b/uitest/src/main/java/com/vaadin/tests/TestForMultipleStyleNames.java index c1face8492..47bc0413b7 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForMultipleStyleNames.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForMultipleStyleNames.java @@ -61,7 +61,7 @@ public class TestForMultipleStyleNames extends CustomComponent + " on the browser. Currently changes are" + " visible only by inspecting DOM.")); - styleNames2 = new ArrayList<String>(); + styleNames2 = new ArrayList<>(); styleNames2.add("red"); styleNames2.add("bold"); @@ -82,7 +82,7 @@ public class TestForMultipleStyleNames extends CustomComponent final String currentStyle = l.getStyleName(); final String[] tmp = currentStyle.split(" "); - final ArrayList<String> curStyles = new ArrayList<String>(); + final ArrayList<String> curStyles = new ArrayList<>(); for (int i = 0; i < tmp.length; i++) { if (tmp[i] != "") { curStyles.add(tmp[i]); diff --git a/uitest/src/main/java/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java b/uitest/src/main/java/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java index 0cb616d084..2d2131a235 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java @@ -135,7 +135,7 @@ public class TestForTablesInitialColumnWidthLogicRendering } t.addContainerProperty("button", Button.class, null); for (int i = 0; i < rows; i++) { - final Vector<Object> content = new Vector<Object>(); + final Vector<Object> content = new Vector<>(); for (int j = 0; j < cols; j++) { content.add(rndString()); } diff --git a/uitest/src/main/java/com/vaadin/tests/TestMethodProperty.java b/uitest/src/main/java/com/vaadin/tests/TestMethodProperty.java index 73da774a54..04e3104b79 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestMethodProperty.java +++ b/uitest/src/main/java/com/vaadin/tests/TestMethodProperty.java @@ -11,7 +11,7 @@ public class TestMethodProperty { MyTest myTest = new MyTest(); - MethodProperty<Integer> methodProperty2 = new MethodProperty<Integer>( + MethodProperty<Integer> methodProperty2 = new MethodProperty<>( Integer.TYPE, myTest, "getInt", "setInt", new Object[0], new Object[] { null }, 0); diff --git a/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java b/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java index 48287f6945..80dbee4cfb 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java +++ b/uitest/src/main/java/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java @@ -103,7 +103,7 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent { } private Collection<String> getSelectOptions() { - final Collection<String> opts = new Vector<String>(3); + final Collection<String> opts = new Vector<>(3); opts.add(getCaption("opt 1")); opts.add(getCaption("opt 2")); opts.add(getCaption("opt 3")); diff --git a/uitest/src/main/java/com/vaadin/tests/TestSizeableIncomponents.java b/uitest/src/main/java/com/vaadin/tests/TestSizeableIncomponents.java index 92dda09f97..6cde8350ed 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestSizeableIncomponents.java +++ b/uitest/src/main/java/com/vaadin/tests/TestSizeableIncomponents.java @@ -233,7 +233,7 @@ public class TestSizeableIncomponents extends LegacyApplication { class Testable { private Class<?> classToTest; - private ArrayList<Configuration> configurations = new ArrayList<Configuration>(); + private ArrayList<Configuration> configurations = new ArrayList<>(); Testable(Class<?> c) { classToTest = c; diff --git a/uitest/src/main/java/com/vaadin/tests/UsingObjectsInSelect.java b/uitest/src/main/java/com/vaadin/tests/UsingObjectsInSelect.java index d2058fd886..28cfabbc43 100644 --- a/uitest/src/main/java/com/vaadin/tests/UsingObjectsInSelect.java +++ b/uitest/src/main/java/com/vaadin/tests/UsingObjectsInSelect.java @@ -35,7 +35,7 @@ public class UsingObjectsInSelect extends com.vaadin.server.LegacyApplication private final Label selectedTask = new Label("Selected task", ContentMode.HTML); - public LinkedList<?> exampleTasks = new LinkedList<Object>(); + public LinkedList<?> exampleTasks = new LinkedList<>(); public static Random random = new Random(1); diff --git a/uitest/src/main/java/com/vaadin/tests/VaadinClasses.java b/uitest/src/main/java/com/vaadin/tests/VaadinClasses.java index dc09e7cc0c..bee83d8e01 100644 --- a/uitest/src/main/java/com/vaadin/tests/VaadinClasses.java +++ b/uitest/src/main/java/com/vaadin/tests/VaadinClasses.java @@ -90,7 +90,7 @@ public class VaadinClasses { private static <T> List<Class<? extends T>> findClasses(Class<T> baseClass, String basePackage, String[] ignoredPackages) throws IOException { - List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>(); + List<Class<? extends T>> classes = new ArrayList<>(); String basePackageDirName = "/" + basePackage.replace('.', '/'); URL location = VaadinSession.class.getResource(basePackageDirName); if (location.getProtocol().equals("file")) { diff --git a/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java b/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java index fae301860b..c2df4fe38e 100644 --- a/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java +++ b/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java @@ -31,7 +31,7 @@ import com.vaadin.ui.Window; * @author Vaadin Ltd */ public class WindowWaiAriaRoles extends AbstractTestUI { - Stack<Window> windows = new Stack<Window>(); + Stack<Window> windows = new Stack<>(); /* * (non-Javadoc) diff --git a/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java b/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java index 8ca03ca860..a93fadeba4 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java +++ b/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java @@ -54,7 +54,7 @@ public class DetachOldUIOnReload extends AbstractTestUIWithLog { List<String> messages = (List<String>) getSession() .getAttribute(PERSISTENT_MESSAGES_ATTRIBUTE); if (messages == null) { - messages = new ArrayList<String>(); + messages = new ArrayList<>(); if (storeIfNeeded) { getSession().setAttribute(PERSISTENT_MESSAGES_ATTRIBUTE, messages); diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java index 5720834bd1..ef0a273172 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentContainerTest.java @@ -294,7 +294,7 @@ public abstract class AbstractComponentContainerTest<T extends AbstractComponent String subCategory = "Add component"; createCategory(subCategory, category); - LinkedHashMap<String, Command<T, ComponentSize>> addCommands = new LinkedHashMap<String, AbstractComponentTestCase.Command<T, ComponentSize>>(); + LinkedHashMap<String, Command<T, ComponentSize>> addCommands = new LinkedHashMap<>(); addCommands.put("Button", addButtonCommand); addCommands.put("NativeButton", addNativeButtonCommand); addCommands.put("TextField", addTextFieldCommand); @@ -307,7 +307,7 @@ public abstract class AbstractComponentContainerTest<T extends AbstractComponent addCommands.put("VerticalSplitPanel", addVerticalSplitPanelCommand); addCommands.put("HorizontalSplitPanel", addHorizontalSplitPanelCommand); - HashSet<String> noVerticalSize = new HashSet<String>(); + HashSet<String> noVerticalSize = new HashSet<>(); noVerticalSize.add("TextField"); noVerticalSize.add("Button"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java index a3b432800c..2c51bd132d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java @@ -39,7 +39,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends private static final Resource SELECTED_ICON = new ThemeResource( "../runo/icons/16/ok.png"); - private static final LinkedHashMap<String, String> sizeOptions = new LinkedHashMap<String, String>(); + private static final LinkedHashMap<String, String> sizeOptions = new LinkedHashMap<>(); static { sizeOptions.put("auto", null); sizeOptions.put("50%", "50%"); @@ -61,13 +61,13 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends // Used to determine if a menuItem should be selected and the other // unselected on click - private Set<MenuItem> parentOfSelectableMenuItem = new HashSet<MenuItem>(); + private Set<MenuItem> parentOfSelectableMenuItem = new HashSet<>(); /** * Maps the category name to a menu item */ - private Map<String, MenuItem> categoryToMenuItem = new HashMap<String, MenuItem>(); - private Map<MenuItem, String> menuItemToCategory = new HashMap<MenuItem, String>(); + private Map<String, MenuItem> categoryToMenuItem = new HashMap<>(); + private Map<MenuItem, String> menuItemToCategory = new HashMap<>(); // Logging private Log log; @@ -292,7 +292,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends createBlurListener(CATEGORY_LISTENERS); } if (Focusable.class.isAssignableFrom(getTestClass())) { - LinkedHashMap<String, Integer> tabIndexes = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> tabIndexes = new LinkedHashMap<>(); tabIndexes.put("0", 0); tabIndexes.put("-1", -1); tabIndexes.put("10", 10); @@ -315,7 +315,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } private void createStyleNameSelect(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("Light blue background (background-lightblue)", "background-lightblue"); @@ -333,7 +333,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } private void createErrorMessageSelect(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put(TEXT_SHORT, TEXT_SHORT); options.put("Medium", TEXT_MEDIUM); @@ -345,7 +345,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } private void createDescriptionSelect(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put(TEXT_SHORT, TEXT_SHORT); options.put("Medium", TEXT_MEDIUM); @@ -363,7 +363,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } protected LinkedHashMap<String, String> createCaptionOptions() { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("Short", TEXT_SHORT); options.put("Medium", TEXT_MEDIUM); @@ -394,7 +394,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } private void createIconSelect(String category) { - LinkedHashMap<String, Resource> options = new LinkedHashMap<String, Resource>(); + LinkedHashMap<String, Resource> options = new LinkedHashMap<>(); options.put("-", null); options.put("16x16", ICON_16_USER_PNG_CACHEABLE); options.put("32x32", ICON_32_ATTENTION_PNG_CACHEABLE); @@ -404,7 +404,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } private void createLocaleSelect(String category) { - LinkedHashMap<String, Locale> options = new LinkedHashMap<String, Locale>(); + LinkedHashMap<String, Locale> options = new LinkedHashMap<>(); options.put("-", null); options.put("fi_FI", new Locale("fi", "FI")); options.put("en_US", Locale.US); @@ -605,7 +605,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends protected <TYPE extends Enum<TYPE>> void createSelectAction(String caption, String category, Class<TYPE> enumType, TYPE initialValue, com.vaadin.tests.components.ComponentTestCase.Command<T, TYPE> command) { - LinkedHashMap<String, TYPE> options = new LinkedHashMap<String, TYPE>(); + LinkedHashMap<String, TYPE> options = new LinkedHashMap<>(); for (TYPE value : EnumSet.allOf(enumType)) { options.put(value.toString(), value); } @@ -633,7 +633,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends com.vaadin.tests.components.ComponentTestCase.Command<T, Boolean> command, boolean defaultValue) { - LinkedHashMap<String, Boolean> defaultValues = new LinkedHashMap<String, Boolean>(); + LinkedHashMap<String, Boolean> defaultValues = new LinkedHashMap<>(); for (String option : options.keySet()) { defaultValues.put(option, defaultValue); @@ -677,7 +677,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } protected LinkedHashMap<String, Integer> createIntegerOptions(int max) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); for (int i = 0; i <= 9 && i <= max; i++) { options.put(String.valueOf(i), i); } @@ -695,7 +695,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends } protected LinkedHashMap<String, Double> createDoubleOptions(double max) { - LinkedHashMap<String, Double> options = new LinkedHashMap<String, Double>(); + LinkedHashMap<String, Double> options = new LinkedHashMap<>(); for (double d = 0; d <= max && d < 10; d += 0.5) { options.put(String.valueOf(d), d); } @@ -714,7 +714,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent> extends protected LinkedHashMap<String, Resource> createIconOptions( boolean cacheable) { - LinkedHashMap<String, Resource> options = new LinkedHashMap<String, Resource>(); + LinkedHashMap<String, Resource> options = new LinkedHashMap<>(); options.put("-", null); if (cacheable) { options.put("16x16", ICON_16_USER_PNG_CACHEABLE); diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java index 3e25b01893..bdb1ff3f83 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java @@ -35,7 +35,7 @@ public abstract class AbstractComponentTestCase<T extends AbstractComponent> protected static final ThemeResource ICON_64_EMAIL_REPLY_PNG_UNCACHEABLE = uncacheableThemeResource( "../runo/icons/64/email-reply.png"); - private List<T> testComponents = new ArrayList<T>(); + private List<T> testComponents = new ArrayList<>(); abstract protected Class<T> getTestClass(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractLayoutTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractLayoutTest.java index 525e28b41d..82fbaee568 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractLayoutTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractLayoutTest.java @@ -56,7 +56,7 @@ public abstract class AbstractLayoutTest<T extends AbstractLayout> } private void createMarginsSelect(String category) { - LinkedHashMap<String, MarginInfo> options = new LinkedHashMap<String, MarginInfo>(); + LinkedHashMap<String, MarginInfo> options = new LinkedHashMap<>(); options.put("off", new MarginInfo(false)); options.put("all", new MarginInfo(true)); options.put("left", new MarginInfo(false, false, false, true)); @@ -77,7 +77,7 @@ public abstract class AbstractLayoutTest<T extends AbstractLayout> String alignmentCategory = "Component alignment"; createCategory(alignmentCategory, category); - LinkedHashMap<String, Alignment> options = new LinkedHashMap<String, Alignment>(); + LinkedHashMap<String, Alignment> options = new LinkedHashMap<>(); options.put("Top left", Alignment.TOP_LEFT); options.put("Top center", Alignment.TOP_CENTER); options.put("Top right", Alignment.TOP_RIGHT); diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutTest.java index b345414459..0e91dd9109 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutTest.java @@ -55,7 +55,7 @@ public abstract class AbstractOrderedLayoutTest<T extends AbstractOrderedLayout> String expandRatioCategory = "Component expand ratio"; createCategory(expandRatioCategory, category); - LinkedHashMap<String, Float> options = new LinkedHashMap<String, Float>(); + LinkedHashMap<String, Float> options = new LinkedHashMap<>(); options.put("0", 0f); options.put("0.5", 0.5f); for (float f = 1; f <= 5; f++) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java b/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java index 5c73c851a5..2786eb8558 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java @@ -67,7 +67,7 @@ public abstract class ComponentTestCase<T extends AbstractComponent> * @return A List with actions to which more actions can be added. */ protected List<Component> createActions() { - ArrayList<Component> actions = new ArrayList<Component>(); + ArrayList<Component> actions = new ArrayList<>(); actions.add(createEnabledAction(true)); actions.add(createReadonlyAction(false)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/ErrorMessages.java b/uitest/src/main/java/com/vaadin/tests/components/ErrorMessages.java index 59b1e86483..898c1014fc 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ErrorMessages.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ErrorMessages.java @@ -14,7 +14,7 @@ public class ErrorMessages extends TestBase { @Override protected void setup() { Button bb = new Button("Button with CompositeError"); - List<UserError> errors = new ArrayList<UserError>(); + List<UserError> errors = new ArrayList<>(); errors.add(new UserError("Error 1")); errors.add(new UserError("Error 2")); bb.setComponentError(new CompositeErrorMessage(errors)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/FileDownloaderUI.java b/uitest/src/main/java/com/vaadin/tests/components/FileDownloaderUI.java index 29c8ab5eaa..141ef664b4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/FileDownloaderUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/FileDownloaderUI.java @@ -54,7 +54,7 @@ public class FileDownloaderUI extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - List<Class<? extends Component>> components = new ArrayList<Class<? extends Component>>(); + List<Class<? extends Component>> components = new ArrayList<>(); components.add(Button.class); components.add(NativeButton.class); components.add(CssLayout.class); diff --git a/uitest/src/main/java/com/vaadin/tests/components/HierarchicalContainerSorting.java b/uitest/src/main/java/com/vaadin/tests/components/HierarchicalContainerSorting.java index d42dce8512..7f633c307c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/HierarchicalContainerSorting.java +++ b/uitest/src/main/java/com/vaadin/tests/components/HierarchicalContainerSorting.java @@ -80,7 +80,7 @@ public class HierarchicalContainerSorting extends TestBase { } private static int index = 0; - private static Map<String, Integer> nameToId = new HashMap<String, Integer>(); + private static Map<String, Integer> nameToId = new HashMap<>(); public static void addItem(IndexedContainer container, String string, String parent) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java index 763d7752b8..db6479bb0e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java @@ -65,7 +65,7 @@ public abstract class AbstractComponentDataBindingTest extends TestBase protected abstract void createFields(); - private Set<Component> fields = new HashSet<Component>(); + private Set<Component> fields = new HashSet<>(); @Override protected void addComponent(Component c) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java index feaa1371ec..a9256e68e7 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java @@ -26,7 +26,7 @@ public class AbstractFieldCommitWithInvalidValues extends TestBase { @Override protected void setup() { tf = new TextField("A field, must contain 1-2 chars", - new ObjectProperty<String>("a")); + new ObjectProperty<>("a")); tf.addValidator( new StringLengthValidator("Invalid length", 1, 2, false)); tf.setBuffered(true); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java index 27f15cee3f..1f69c96be3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java @@ -10,7 +10,7 @@ import com.vaadin.v7.ui.TextField; public class AbstractFieldDataSourceReadOnly extends TestBase { private static class StateHolder { - private ObjectProperty<String> textField = new ObjectProperty<String>( + private ObjectProperty<String> textField = new ObjectProperty<>( ""); public ObjectProperty<String> getTextField() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBackedByString.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBackedByString.java index a3595b36b5..384b8be17a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBackedByString.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBackedByString.java @@ -11,7 +11,7 @@ public class DateFieldBackedByString extends AbstractComponentDataBindingTest { DateField df = new DateField("Date field"); addComponent(df); df.setPropertyDataSource( - new com.vaadin.v7.data.util.ObjectProperty<String>(s, + new com.vaadin.v7.data.util.ObjectProperty<>(s, String.class)); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java index b4a2906576..b9fb03ad8f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java @@ -16,7 +16,7 @@ public class DateFieldBasedOnLong extends AbstractComponentDataBindingTest { protected void createFields() { PopupDateField pdf = new PopupDateField("DateField"); addComponent(pdf); - property = new ObjectProperty<Long>(l, Long.class); + property = new ObjectProperty<>(l, Long.class); pdf.setPropertyDataSource(property); property.setValue(new Date(2011 - 1900, 4, 6).getTime()); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java index f436c4aca3..d5b8bdbb68 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java @@ -23,14 +23,14 @@ public class IntegerDoubleFieldsWithDataSource extends TestBase { tf = createIntegerTextField(); tf.setCaption("Enter a double"); - tf.setPropertyDataSource(new ObjectProperty<Double>(2.1)); + tf.setPropertyDataSource(new ObjectProperty<>(2.1)); tf.addValidator(new DoubleValidator("Must be a Double")); addComponent(tf); } private TextField createIntegerTextField() { final TextField tf = new TextField("Enter an integer"); - tf.setPropertyDataSource(new ObjectProperty<Integer>(new Integer(2))); + tf.setPropertyDataSource(new ObjectProperty<>(new Integer(2))); tf.setImmediate(true); tf.addListener(new ValueChangeListener() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/LegacyAbstractFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/LegacyAbstractFieldTest.java index 7829adf626..fd0e815ec9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/LegacyAbstractFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/LegacyAbstractFieldTest.java @@ -82,7 +82,7 @@ public abstract class LegacyAbstractFieldTest<T extends AbstractField> } private void createRequiredErrorSelect(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put(TEXT_SHORT, TEXT_SHORT); options.put("Medium", TEXT_MEDIUM); @@ -191,7 +191,7 @@ public abstract class LegacyAbstractFieldTest<T extends AbstractField> protected void createSetTextValueAction(String category) { String subCategory = "Set text value"; createCategory(subCategory, category); - List<String> values = new ArrayList<String>(); + List<String> values = new ArrayList<>(); values.add("Test"); values.add("A little longer value"); values.add( diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java index 6cacd68b59..f8a237417b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java @@ -18,7 +18,7 @@ import com.vaadin.v7.ui.Field; import com.vaadin.v7.ui.TextField; public class RequiredIndicatorForFieldsWithoutCaption extends AbstractTestUI { - private Set<Field> fields = new HashSet<Field>(); + private Set<Field> fields = new HashSet<>(); @Override protected void setup(VaadinRequest request) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java index 1158f677ff..4ee2eac6fd 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java @@ -33,7 +33,7 @@ public class TextFieldConversions extends AbstractComponentDataBindingTest { @Override public void valueChange(ValueChangeEvent event) { - tf.setPropertyDataSource(new ObjectProperty<Object>(o, + tf.setPropertyDataSource(new ObjectProperty<>(o, (Class<Object>) dataType.getValue())); } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java b/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java index e82336c1e8..7ca7185500 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java +++ b/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java @@ -109,7 +109,7 @@ public class RemoveTabs extends TestBase { AbstractComponentContainer container = accordion; if (container != null) { - List<Component> c = new ArrayList<Component>(); + List<Component> c = new ArrayList<>(); Iterator<Component> i = container.iterator(); while (i.hasNext()) { Component comp = i.next(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java b/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java index 2e5235c78b..6804983ed3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java +++ b/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java @@ -14,7 +14,7 @@ public class BeanItemContainerGenerator { public static BeanItemContainer<TestBean> createContainer(int size, long seed) { - BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>( + BeanItemContainer<TestBean> container = new BeanItemContainer<>( TestBean.class); PortableRandom r = new PortableRandom(seed); for (int i = 0; i < size; i++) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java b/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java index 8612e60475..36c086515f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java +++ b/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java @@ -24,12 +24,12 @@ public class TestBeanItemContainerUsage extends TestBase { Table t = new Table("Table containing Persons"); t.setPageLength(5); t.setWidth("100%"); - List<Person> persons = new ArrayList<Person>(); + List<Person> persons = new ArrayList<>(); persons.add(new Person("Jones", "Birchman", 35)); persons.add(new Person("Marc", "Smith", 30)); persons.add(new Person("Greg", "Sandman", 75)); - BeanItemContainer<Person> bic = new BeanItemContainer<Person>(persons); + BeanItemContainer<Person> bic = new BeanItemContainer<>(persons); t.setContainerDataSource(bic); addComponent(t); diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java index 0ca638fa19..e9d50a3a7e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java @@ -44,7 +44,7 @@ public class BeanItemContainerTestUI extends UI { private Table table; - private BeanItemContainer<BasicEvent> events = new BeanItemContainer<BasicEvent>( + private BeanItemContainer<BasicEvent> events = new BeanItemContainer<>( BasicEvent.class); @SuppressWarnings("deprecation") @@ -157,7 +157,7 @@ public class BeanItemContainerTestUI extends UI { fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY); fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY); - fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event, + fieldGroup.setItemDataSource(new BeanItem<>(event, Arrays.asList(ContainerEventProvider.CAPTION_PROPERTY, ContainerEventProvider.DESCRIPTION_PROPERTY, ContainerEventProvider.STARTDATE_PROPERTY, diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionEventSource.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionEventSource.java index 7218c29248..9eb409de45 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionEventSource.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionEventSource.java @@ -45,7 +45,7 @@ public class CalendarActionEventSource extends AbstractTestUI { public List<com.vaadin.v7.ui.components.calendar.event.CalendarEvent> getEvents( Date startDate, Date endDate) { - List<CalendarEvent> events = new ArrayList<CalendarEvent>(); + List<CalendarEvent> events = new ArrayList<>(); CalendarEvent event = null; try { diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java index 818eea0680..9fdf1e24d6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarActionsMenuTest.java @@ -49,7 +49,7 @@ public class CalendarActionsMenuTest extends AbstractTestUI { public List<com.vaadin.v7.ui.components.calendar.event.CalendarEvent> getEvents( Date startDate, Date endDate) { - List<CalendarEvent> events = new ArrayList<CalendarEvent>(); + List<CalendarEvent> events = new ArrayList<>(); CalendarEvent event = null; try { diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java index c3742e2797..8bb73fe14b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java @@ -72,7 +72,7 @@ public class CalendarHtmlInEvents extends AbstractTestUIWithLog { @Override public List<CalendarEvent> getEvents(Date startDate, Date endDate) { Date d = startDate; - ArrayList<CalendarEvent> events = new ArrayList<CalendarEvent>(); + ArrayList<CalendarEvent> events = new ArrayList<>(); while (d.before(endDate)) { BasicEvent ce = new BasicEvent(); ce.setAllDay(false); diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarNotifications.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarNotifications.java index 2ee8288ed3..7bd0bf1f88 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarNotifications.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarNotifications.java @@ -40,7 +40,7 @@ public class CalendarNotifications extends AbstractTestUIWithLog { private static class DummyEventProvider implements CalendarEventProvider { private int index; - private List<CalendarEvent> events = new ArrayList<CalendarEvent>(); + private List<CalendarEvent> events = new ArrayList<>(); public void addEvent(Date date) { BasicEvent e = new BasicEvent(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.java index ef9761afb7..b7c2780ed8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.java @@ -49,7 +49,7 @@ public class CalendarResizeOverlappingEvents extends AbstractTestUI { public List<CalendarEvent> getEvents(Date startDate, Date endDate) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd"); - List<CalendarEvent> events = new ArrayList<CalendarEvent>(); + List<CalendarEvent> events = new ArrayList<>(); try { java.util.Calendar today = java.util.Calendar.getInstance(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/NotificationTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/NotificationTestUI.java index 8c14211e18..a5648abf19 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/NotificationTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/NotificationTestUI.java @@ -39,7 +39,7 @@ public class NotificationTestUI extends UI { private static class DummyEventProvider implements CalendarEventProvider { private int index; - private List<CalendarEvent> events = new ArrayList<CalendarEvent>(); + private List<CalendarEvent> events = new ArrayList<>(); public void addEvent(Date date) { BasicEvent e = new BasicEvent(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxClickIcon.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxClickIcon.java index 7b47bed2c8..8cb6ab3ba8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxClickIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxClickIcon.java @@ -32,7 +32,7 @@ public class ComboBoxClickIcon extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - final List<String> items = new ArrayList<String>(); + final List<String> items = new ArrayList<>(); items.add("A"); items.add("B"); items.add("C"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java index c0316892d9..2a4d57c97f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java @@ -18,7 +18,7 @@ public class ComboBoxDuplicateCaption extends TestBase { @Override protected void setup() { - List<Person> list = new ArrayList<Person>(); + List<Person> list = new ArrayList<>(); Person p1 = new Person(); p1.setFirstName("John"); p1.setLastName("Doe"); @@ -29,7 +29,7 @@ public class ComboBoxDuplicateCaption extends TestBase { p2.setLastName("Doe"); list.add(p2); - BeanItemContainer<Person> container = new BeanItemContainer<Person>( + BeanItemContainer<Person> container = new BeanItemContainer<>( Person.class); container.addAll(list); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxes2.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxes2.java index b92b6c18a6..172d930cb3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxes2.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxes2.java @@ -68,7 +68,7 @@ public class ComboBoxes2<T extends ComboBox> extends AbstractSelectTestCase<T> { } private void createFilteringModeAction(String category) { - LinkedHashMap<String, FilteringMode> options = new LinkedHashMap<String, FilteringMode>(); + LinkedHashMap<String, FilteringMode> options = new LinkedHashMap<>(); options.put("Off", FilteringMode.OFF); options.put("Contains", FilteringMode.CONTAINS); options.put("Starts with", FilteringMode.STARTSWITH); @@ -79,7 +79,7 @@ public class ComboBoxes2<T extends ComboBox> extends AbstractSelectTestCase<T> { } private void createItemStyleGeneratorAction(String category) { - LinkedHashMap<String, ItemStyleGenerator> options = new LinkedHashMap<String, ItemStyleGenerator>(); + LinkedHashMap<String, ItemStyleGenerator> options = new LinkedHashMap<>(); options.put("-", null); options.put("Bold fives", new ItemStyleGenerator() { @Override @@ -96,7 +96,7 @@ public class ComboBoxes2<T extends ComboBox> extends AbstractSelectTestCase<T> { } private void createInputPromptAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("Enter a value", "Enter a value"); options.put("- Click here -", "- Click here -"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java index 84141e0785..17a0405690 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java @@ -20,7 +20,7 @@ public class ComboFocusBlurEvents extends TestBase { @Override protected void setup() { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); for (int i = 0; i < 100; i++) { list.add("Item " + i); } @@ -31,7 +31,7 @@ public class ComboFocusBlurEvents extends TestBase { cb.setDescription("Some Combobox"); addComponent(cb); - final ObjectProperty<String> log = new ObjectProperty<String>(""); + final ObjectProperty<String> log = new ObjectProperty<>(""); cb.addFocusListener(new FieldEvents.FocusListener() { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java index e6c70dafb6..18ac8ca8be 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java @@ -26,7 +26,7 @@ public class ComboPushTiming extends TestBase { @Override protected void setup() { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); for (int i = 0; i < 100; i++) { list.add("Item " + i); } @@ -37,7 +37,7 @@ public class ComboPushTiming extends TestBase { cb.setDescription("Some Combobox"); addComponent(cb); - final ObjectProperty<String> log = new ObjectProperty<String>(""); + final ObjectProperty<String> log = new ObjectProperty<>(""); cb.addFocusListener(new FieldEvents.FocusListener() { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopen.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopen.java index b60a08cd8b..83f94aac8b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopen.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboboxMenuBarAutoopen.java @@ -38,7 +38,7 @@ public class ComboboxMenuBarAutoopen extends AbstractTestUI { protected void setup(VaadinRequest request) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); - ArrayList<String> options = new ArrayList<String>(); + ArrayList<String> options = new ArrayList<>(); options.add("1"); options.add("2"); options.add("3"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/Comboboxes.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/Comboboxes.java index e2da8be910..e5c4a33992 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/Comboboxes.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/Comboboxes.java @@ -126,7 +126,7 @@ public class Comboboxes extends ComponentTestCase<ComboBox> { private Component createIconSelect() { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("<None>", null); options.put("16x16", "../runo/icons/16/user.png"); options.put("32x32", "../runo/icons/32/attention.png"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java index 2a231e6534..534c92d5f4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/CustomDateFormats.java @@ -132,7 +132,7 @@ public class CustomDateFormats extends TestBase { } - private Set<String> usedDebugIds = new HashSet<String>(); + private Set<String> usedDebugIds = new HashSet<>(); private void addDateField(GridLayout gridLayout, String pattern, Locale locale, String expectedDateFormat) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java index 2b660b8b0b..30a34e4fc4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java @@ -88,7 +88,7 @@ public class DateFieldEmptyValid extends TestBase { @SuppressWarnings("deprecation") public void buttonClick(ClickEvent event) { log.log("Setting new object property (5.6.2000) to datefield"); - ObjectProperty<Date> dfProp = new ObjectProperty<Date>( + ObjectProperty<Date> dfProp = new ObjectProperty<>( new Date(2000 - 1900, 6 - 1, 5), Date.class); df.setPropertyDataSource(dfProp); } @@ -105,7 +105,7 @@ public class DateFieldEmptyValid extends TestBase { @SuppressWarnings("deprecation") public void buttonClick(ClickEvent event) { log.log("Setting object property (with value null) to datefield and set value of property to 27.8.2005"); - ObjectProperty<Date> dfProp = new ObjectProperty<Date>(null, + ObjectProperty<Date> dfProp = new ObjectProperty<>(null, Date.class); df.setPropertyDataSource(dfProp); dfProp.setValue(new Date(2005 - 1900, 8 - 1, 27)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java index c6422891fb..7a1717cdb6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java @@ -61,7 +61,7 @@ public class DateFieldRangeValidation extends TestBase { @Override protected void setup() { - BeanItem<Range> bi = new BeanItem<Range>(range); + BeanItem<Range> bi = new BeanItem<>(range); range.setFrom(new Date(2011 - 1900, 12 - 1, 4)); range.setTo(new Date(2011 - 1900, 12 - 1, 15)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java index d8a165fa23..155ce35059 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java @@ -42,7 +42,7 @@ public class DateFieldTest<T extends DateField> } private void createSetValueAction(String category) { - LinkedHashMap<String, Date> options = new LinkedHashMap<String, Date>(); + LinkedHashMap<String, Date> options = new LinkedHashMap<>(); options.put("(null)", null); options.put("(current time)", new Date()); Calendar c = Calendar.getInstance(new Locale("fi", "FI")); @@ -58,7 +58,7 @@ public class DateFieldTest<T extends DateField> } private void createDateFormatSelectAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("d M yyyy", "d M yyyy"); @@ -98,7 +98,7 @@ public class DateFieldTest<T extends DateField> } private void createResolutionSelectAction(String category) { - LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>(); + LinkedHashMap<String, Resolution> options = new LinkedHashMap<>(); options.put("Year", Resolution.YEAR); options.put("Month", Resolution.MONTH); options.put("Day", Resolution.DAY); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java index 33d1c659f0..69b331287b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimezone.java @@ -29,7 +29,7 @@ public class DateFieldTimezone extends TestBase { protected void setup() { dateField.setResolution(Resolution.SECOND); - ArrayList<String> timeZoneCodes = new ArrayList<String>(); + ArrayList<String> timeZoneCodes = new ArrayList<>(); timeZoneCodes.add(nullValue); timeZoneCodes.addAll(Arrays.asList(TimeZone.getAvailableIDs())); ComboBox timezoneSelector = new ComboBox("Select time zone", diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java index 669d691634..8136097040 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/InlineDateFields.java @@ -70,7 +70,7 @@ public class InlineDateFields extends ComponentTestCase<InlineDateField> { } private Component createResolutionSelectAction() { - LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>(); + LinkedHashMap<String, Resolution> options = new LinkedHashMap<>(); options.put("Year", Resolution.YEAR); options.put("Month", Resolution.MONTH); options.put("Day", Resolution.DAY); @@ -90,7 +90,7 @@ public class InlineDateFields extends ComponentTestCase<InlineDateField> { } private Component createLocaleSelectAction() { - LinkedHashMap<String, Locale> options = new LinkedHashMap<String, Locale>(); + LinkedHashMap<String, Locale> options = new LinkedHashMap<>(); for (Locale locale : LOCALES) { options.put(locale.toString(), locale); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyDateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyDateFieldTest.java index 7f3b3872dc..8d42f1a561 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyDateFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyDateFieldTest.java @@ -42,7 +42,7 @@ public class LegacyDateFieldTest<T extends DateField> } private void createSetValueAction(String category) { - LinkedHashMap<String, Date> options = new LinkedHashMap<String, Date>(); + LinkedHashMap<String, Date> options = new LinkedHashMap<>(); options.put("(null)", null); options.put("(current time)", new Date()); Calendar c = Calendar.getInstance(new Locale("fi", "FI")); @@ -58,7 +58,7 @@ public class LegacyDateFieldTest<T extends DateField> } private void createDateFormatSelectAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("d M yyyy", "d M yyyy"); @@ -98,7 +98,7 @@ public class LegacyDateFieldTest<T extends DateField> } private void createResolutionSelectAction(String category) { - LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>(); + LinkedHashMap<String, Resolution> options = new LinkedHashMap<>(); options.put("Year", Resolution.YEAR); options.put("Month", Resolution.MONTH); options.put("Day", Resolution.DAY); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyPopupDateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyPopupDateFieldTest.java index 1ce55d97b7..bdc29c64bc 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyPopupDateFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/LegacyPopupDateFieldTest.java @@ -21,7 +21,7 @@ public class LegacyPopupDateFieldTest } private void createInputPromptSelectAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("<none>", null); options.put("Please enter date", "Please enter date"); options.put("åäöÅÄÖ", "åäöÅÄÖ"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTest.java index 6e3250a825..54a23b5666 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTest.java @@ -20,7 +20,7 @@ public class PopupDateFieldTest extends DateFieldTest<PopupDateField> { } private void createInputPromptSelectAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("<none>", null); options.put("Please enter date", "Please enter date"); options.put("åäöÅÄÖ", "åäöÅÄÖ"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFields.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFields.java index 9bc567c0fc..60e90a8f1b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFields.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFields.java @@ -66,7 +66,7 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { } private Component createResolutionSelectAction() { - LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>(); + LinkedHashMap<String, Resolution> options = new LinkedHashMap<>(); options.put("Year", Resolution.YEAR); options.put("Month", Resolution.MONTH); options.put("Day", Resolution.DAY); @@ -86,7 +86,7 @@ public class PopupDateFields extends ComponentTestCase<PopupDateField> { } private Component createInputPromptSelectAction() { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("<none>", null); options.put("Please enter date", "Please enter date"); options.put("åäöÅÄÖ", "åäöÅÄÖ"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/RequiredInvalidDateField.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/RequiredInvalidDateField.java index d4c48ac47e..29669e2a75 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/RequiredInvalidDateField.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/RequiredInvalidDateField.java @@ -54,7 +54,7 @@ public class RequiredInvalidDateField extends TestBase { }; // not required - Property<Date> dateProperty1 = new ObjectProperty<Date>(date); + Property<Date> dateProperty1 = new ObjectProperty<>(date); DateField dateField1 = new DateField("Not required", dateProperty1); dateField1.setLocale(new Locale("fi", "FI")); dateField1.setResolution(DateField.RESOLUTION_DAY); @@ -64,7 +64,7 @@ public class RequiredInvalidDateField extends TestBase { addComponent(dateField1); // required - Property<Date> dateProperty2 = new ObjectProperty<Date>(date); + Property<Date> dateProperty2 = new ObjectProperty<>(date); DateField dateField2 = new DateField("Required", dateProperty2); dateField2.setLocale(new Locale("fi", "FI")); dateField2.setResolution(DateField.RESOLUTION_DAY); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/ValueThroughProperty.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/ValueThroughProperty.java index 98e94c49ee..e12004b515 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/ValueThroughProperty.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/ValueThroughProperty.java @@ -16,7 +16,7 @@ import com.vaadin.v7.ui.Label; import com.vaadin.v7.ui.PopupDateField; public class ValueThroughProperty extends TestBase { - private final Property<Date> dateProperty = new ObjectProperty<Date>(null, + private final Property<Date> dateProperty = new ObjectProperty<>(null, Date.class); @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java index f7db90acd9..0c8d2d8dd8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java @@ -48,7 +48,7 @@ public class BasicJavaScriptComponent extends AbstractTestUI { } public static class TestState extends JavaScriptComponentState { - private List<String> messages = new ArrayList<String>(); + private List<String> messages = new ArrayList<>(); private URLReference url; public List<String> getMessages() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/label/LabelPropertySourceValue.java b/uitest/src/main/java/com/vaadin/tests/components/label/LabelPropertySourceValue.java index bbce7b7744..c51e24ceff 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/label/LabelPropertySourceValue.java +++ b/uitest/src/main/java/com/vaadin/tests/components/label/LabelPropertySourceValue.java @@ -19,7 +19,7 @@ public class LabelPropertySourceValue extends AbstractTestUI { button.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { - ObjectProperty<String> p = new ObjectProperty<String>( + ObjectProperty<String> p = new ObjectProperty<>( "This text should appear on the label after clicking the button."); label.setPropertyDataSource(p); diff --git a/uitest/src/main/java/com/vaadin/tests/components/label/LabelTest.java b/uitest/src/main/java/com/vaadin/tests/components/label/LabelTest.java index 0fe39fb6b1..f81ed25db9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/label/LabelTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/label/LabelTest.java @@ -41,7 +41,7 @@ public class LabelTest extends AbstractComponentTest<Label> { private void createValueSelect(String category) { String subCategory = "Set text value"; createCategory(subCategory, category); - List<String> values = new ArrayList<String>(); + List<String> values = new ArrayList<>(); values.add("Test"); values.add("A little longer value"); values.add( @@ -59,7 +59,7 @@ public class LabelTest extends AbstractComponentTest<Label> { @SuppressWarnings("deprecation") private void createContentModeSelect(String category) { - LinkedHashMap<String, ContentMode> options = new LinkedHashMap<String, ContentMode>(); + LinkedHashMap<String, ContentMode> options = new LinkedHashMap<>(); options.put("Text", ContentMode.TEXT); options.put("Preformatted", ContentMode.PREFORMATTED); options.put("XHTML", ContentMode.HTML); diff --git a/uitest/src/main/java/com/vaadin/tests/components/link/LinkTest.java b/uitest/src/main/java/com/vaadin/tests/components/link/LinkTest.java index f999d633cc..a0043b6649 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/link/LinkTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/link/LinkTest.java @@ -40,7 +40,7 @@ public class LinkTest extends AbstractComponentTest<Link> { } private void createTargetSelect(String category) { - LinkedHashMap<String, Resource> options = new LinkedHashMap<String, Resource>(); + LinkedHashMap<String, Resource> options = new LinkedHashMap<>(); options.put("-", null); options.put("https://vaadin.com", new ExternalResource("https://vaadin.com")); diff --git a/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectJump.java b/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectJump.java index 9c446befd9..e719b4f13e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectJump.java +++ b/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectJump.java @@ -22,7 +22,7 @@ public class ListSelectJump extends AbstractTestUI { + "<li>Leave the Option #10 visible in the scroll window</li><li>Press the button</li></ol>" + "You will see the <code>ListSelect</code> scroll window jump back to the top.", ContentMode.HTML)); - ArrayList<String> list = new ArrayList<String>(); + ArrayList<String> list = new ArrayList<>(); for (int i = 1; i <= 25; i++) { list.add("Option #" + i); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuBarTest.java b/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuBarTest.java index ada6622c98..99c84793fc 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuBarTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuBarTest.java @@ -67,7 +67,7 @@ public class MenuBarTest extends AbstractComponentTest<MenuBar> { } private void createMenuIconsSizeSelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("16x16", 16); options.put("32x32", 32); options.put("64x64", 64); @@ -75,7 +75,7 @@ public class MenuBarTest extends AbstractComponentTest<MenuBar> { } private void createMenuItemIconIntervalSelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("None", 0); options.put("All", 1); options.put("Every second", 2); @@ -85,7 +85,7 @@ public class MenuBarTest extends AbstractComponentTest<MenuBar> { } private void createSubMenuDensitySelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("All", 1); options.put("Every second", 2); options.put("Every third", 3); @@ -95,7 +95,7 @@ public class MenuBarTest extends AbstractComponentTest<MenuBar> { } private void createSubMenuSeparatorDensitySelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("No separators", null); options.put("Between all", 1); options.put("Between every second", 2); @@ -106,7 +106,7 @@ public class MenuBarTest extends AbstractComponentTest<MenuBar> { } private void createMenuItemDisabledDensitySelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("All enabled", null); options.put("All disabled", 1); options.put("Every second", 2); @@ -117,7 +117,7 @@ public class MenuBarTest extends AbstractComponentTest<MenuBar> { } private void createMenuItemInvisibleDensitySelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("All visible", null); options.put("All invisible", 1); options.put("Every second", 2); @@ -128,7 +128,7 @@ public class MenuBarTest extends AbstractComponentTest<MenuBar> { } private void createMenuItemCheckableDensitySelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("No items checkable", null); options.put("All checkable", 1); options.put("Every second", 2); diff --git a/uitest/src/main/java/com/vaadin/tests/components/menubar/Menubars.java b/uitest/src/main/java/com/vaadin/tests/components/menubar/Menubars.java index 40e566194a..90dba78ec0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/menubar/Menubars.java +++ b/uitest/src/main/java/com/vaadin/tests/components/menubar/Menubars.java @@ -78,7 +78,7 @@ public class Menubars extends ComponentTestCase<MenuBar> { @Override protected List<Component> createActions() { - ArrayList<Component> actions = new ArrayList<Component>(); + ArrayList<Component> actions = new ArrayList<>(); actions.add(createErrorIndicatorAction(false)); actions.add(createEnabledAction(true)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/optiongroup/OptionGroups.java b/uitest/src/main/java/com/vaadin/tests/components/optiongroup/OptionGroups.java index ea8893b230..48f168803b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/optiongroup/OptionGroups.java +++ b/uitest/src/main/java/com/vaadin/tests/components/optiongroup/OptionGroups.java @@ -31,7 +31,7 @@ public class OptionGroups extends AbstractSelectTestCase<OptionGroup> { } private void createIconToggle(String string) { - LinkedHashMap<String, ThemeResource> options = new LinkedHashMap<String, ThemeResource>(); + LinkedHashMap<String, ThemeResource> options = new LinkedHashMap<>(); options.put("-", null); options.put("16x16", ICON_16_USER_PNG_CACHEABLE); options.put("32x32", ICON_32_ATTENTION_PNG_CACHEABLE); diff --git a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java index 6339615104..79dc0a88ef 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java @@ -167,7 +167,7 @@ public class BoxLayoutTest extends AbstractTestUI { controls.addComponent(layout); layout.addComponent(new Label("Layout")); - ArrayList<String> sizes = new ArrayList<String>(); + ArrayList<String> sizes = new ArrayList<>(); sizes.addAll(Arrays.asList("100px", "30em", "100%")); final NativeSelect width = new NativeSelect(null, sizes); @@ -216,7 +216,7 @@ public class BoxLayoutTest extends AbstractTestUI { controls.addComponent(cell); cell.addComponent(new Label("Cell")); - ArrayList<Alignment> alignments = new ArrayList<Alignment>(); + ArrayList<Alignment> alignments = new ArrayList<>(); alignments.addAll(Arrays.asList(Alignment.TOP_LEFT, Alignment.MIDDLE_LEFT, Alignment.BOTTOM_LEFT, Alignment.TOP_CENTER, Alignment.MIDDLE_CENTER, @@ -260,7 +260,7 @@ public class BoxLayoutTest extends AbstractTestUI { root.addComponent(component); component.addComponent(new Label("Component")); - sizes = new ArrayList<String>(); + sizes = new ArrayList<>(); sizes.addAll(Arrays.asList("50px", "200px", "10em", "50%", "100%")); componentWidth = new NativeSelect(null, sizes); diff --git a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/HorizontalRelativeSizeWithoutExpand.java b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/HorizontalRelativeSizeWithoutExpand.java index 35ad29c1d2..3812b62ee1 100755 --- a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/HorizontalRelativeSizeWithoutExpand.java +++ b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/HorizontalRelativeSizeWithoutExpand.java @@ -26,7 +26,7 @@ public class HorizontalRelativeSizeWithoutExpand extends UI { Tree tree = new Tree(); tree.setSizeFull(); tree.setContainerDataSource( - new BeanItemContainer<String>(String.class)); + new BeanItemContainer<>(String.class)); String a = "aaaaaaaaaaaaaaaaaaaaaaaa"; String b = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; String c = "ccccccccccccccccccccccccccccccccccccccccccccccccc"; diff --git a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index e714e0dbd4..82b2102518 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -80,7 +80,7 @@ public class OrderedLayoutCases extends AbstractTestUI { // Why is Alignment not an enum? Now we have to use reflection just // to get the different values as hardcoding is never an option! ;) - List<String> alignmentValues = new ArrayList<String>(); + List<String> alignmentValues = new ArrayList<>(); Field[] fields = Alignment.class.getDeclaredFields(); for (Field field : fields) { if (field.getType() == Alignment.class) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java index 4d8f2f94fc..25a5e9fdb2 100755 --- a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java +++ b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java @@ -29,7 +29,7 @@ public class VerticalRelativeSizeWithoutExpand extends UI { Tree tree = new Tree(); tree.setSizeFull(); tree.setContainerDataSource( - new BeanItemContainer<String>(String.class)); + new BeanItemContainer<>(String.class)); String a = "aaaaaaaaaaaaaaaaaaaaaaaa"; String b = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; String c = "ccccccccccccccccccccccccccccccccccccccccccccccccc"; diff --git a/uitest/src/main/java/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java b/uitest/src/main/java/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java index e32347ab43..46ca309518 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java +++ b/uitest/src/main/java/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java @@ -74,7 +74,7 @@ public class PanelShouldRemoveActionHandler extends TestBase { actionHandlers.remove(actionHandlers.size() - 1)); } - private List<Handler> actionHandlers = new ArrayList<Handler>(); + private List<Handler> actionHandlers = new ArrayList<>(); public void add() { panel.setCaption(panel.getCaption() + " - Added handler"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewOffScreen.java b/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewOffScreen.java index 9e214e2598..06cc314cb8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewOffScreen.java +++ b/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewOffScreen.java @@ -19,7 +19,7 @@ import com.vaadin.ui.themes.BaseTheme; public class PopupViewOffScreen extends TestBase { - private List<PopupView> popupViews = new ArrayList<PopupView>(); + private List<PopupView> popupViews = new ArrayList<>(); @Override protected String getDescription() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java b/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java index e83a9d054e..7c0d8dc7fb 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java @@ -34,7 +34,7 @@ public class ProgressBarGenericTest * @since */ protected void createPrimaryStyleNameSelect() { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); String primaryStyle = getComponent().getPrimaryStyleName(); options.put(primaryStyle, primaryStyle); options.put(primaryStyle + "-foo", primaryStyle + "-foo"); @@ -45,7 +45,7 @@ public class ProgressBarGenericTest } private void createValueSelection(String categorySelection) { - LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> options = new LinkedHashMap<>(); options.put("null", null); for (float f = 0; f <= 1; f += 0.1) { options.put("" + f, f); diff --git a/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java b/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java index c8480d2898..b5dfbc704d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/progressindicator/ProgressIndicatorTest.java @@ -59,7 +59,7 @@ public class ProgressIndicatorTest } private void createPollingIntervalAction() { - LinkedHashMap<String, Integer> valueOptions = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> valueOptions = new LinkedHashMap<>(); for (int i = 100; i <= 3000; i += 200) { valueOptions.put(String.valueOf(i), i); } @@ -69,7 +69,7 @@ public class ProgressIndicatorTest } private void createSetValueAction() { - LinkedHashMap<String, Float> valueOptions = new LinkedHashMap<String, Float>(); + LinkedHashMap<String, Float> valueOptions = new LinkedHashMap<>(); for (float f = 0.0f; f <= 1.0f; f += 0.1) { valueOptions.put(String.valueOf(f), f); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java index 178bc28da8..376e84a1cb 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java @@ -44,7 +44,7 @@ public class RichTextAreaTest extends LegacyAbstractFieldTest<RichTextArea> { } private void createNullRepresentationAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("null", "null"); options.put("This is empty", "This is empty"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/select/AbstractSelectTestCase.java b/uitest/src/main/java/com/vaadin/tests/components/select/AbstractSelectTestCase.java index f1ef5d5bcb..a775092ab3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/select/AbstractSelectTestCase.java +++ b/uitest/src/main/java/com/vaadin/tests/components/select/AbstractSelectTestCase.java @@ -25,7 +25,7 @@ public abstract class AbstractSelectTestCase<T extends AbstractSelect> protected static class ContextMenu { - private List<Action> items = new ArrayList<Action>(); + private List<Action> items = new ArrayList<>(); public ContextMenu(String caption, Resource icon) { addItem(caption, icon); @@ -73,7 +73,7 @@ public abstract class AbstractSelectTestCase<T extends AbstractSelect> } protected void createNullSelectItemId(String category) { - LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> options = new LinkedHashMap<>(); options.put("- None -", null); for (Object id : (getComponent()).getContainerDataSource() .getContainerPropertyIds()) { @@ -110,7 +110,7 @@ public abstract class AbstractSelectTestCase<T extends AbstractSelect> } protected void createItemsInContainerSelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); for (int i = 0; i <= 10; i++) { options.put(String.valueOf(i), i); } @@ -125,7 +125,7 @@ public abstract class AbstractSelectTestCase<T extends AbstractSelect> } protected void createPropertiesInContainerSelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("0", 0); for (int i = 0; i <= 10; i++) { options.put(String.valueOf(i), i); diff --git a/uitest/src/main/java/com/vaadin/tests/components/select/SelectDisplaysOldValue.java b/uitest/src/main/java/com/vaadin/tests/components/select/SelectDisplaysOldValue.java index 54db9f4977..129445a2af 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/select/SelectDisplaysOldValue.java +++ b/uitest/src/main/java/com/vaadin/tests/components/select/SelectDisplaysOldValue.java @@ -27,9 +27,9 @@ public class SelectDisplaysOldValue extends TestBase { private Select controllerComboBox; private Select slaveComboBox; - private Map<Integer, String> controllerOptionMap = new HashMap<Integer, String>(); + private Map<Integer, String> controllerOptionMap = new HashMap<>(); - private Map<String, List<String>> slaveOptionMapping = new HashMap<String, List<String>>(); + private Map<String, List<String>> slaveOptionMapping = new HashMap<>(); private final Object NAME_PROPERTY_ID = "name"; public DynamicSelectTestCase() { @@ -46,7 +46,7 @@ public class SelectDisplaysOldValue extends TestBase { private void populateSlaveOptionMappings() { for (String controllerOption : controllerOptionMap.values()) { - List<String> slaveOptions = new ArrayList<String>(); + List<String> slaveOptions = new ArrayList<>(); for (int i = 1; i <= 3; i++) { slaveOptions.add(controllerOption + " - Slave " + i); diff --git a/uitest/src/main/java/com/vaadin/tests/components/slider/SliderTest.java b/uitest/src/main/java/com/vaadin/tests/components/slider/SliderTest.java index e8f3e0cfb8..9844961570 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/slider/SliderTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/slider/SliderTest.java @@ -57,7 +57,7 @@ public class SliderTest extends AbstractFieldTest<Slider, Double> { } private void createOrientationSelect(String category) { - LinkedHashMap<String, SliderOrientation> options = new LinkedHashMap<String, SliderOrientation>(); + LinkedHashMap<String, SliderOrientation> options = new LinkedHashMap<>(); options.put("Horizontal", SliderOrientation.HORIZONTAL); options.put("Vertical", SliderOrientation.VERTICAL); createSelectAction("Orientation", category, options, "Horizontal", diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ColumnWidthsAfterChangeTableColumnsCountOrOrder.java b/uitest/src/main/java/com/vaadin/tests/components/table/ColumnWidthsAfterChangeTableColumnsCountOrOrder.java index 1d962edafe..b140a64cab 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/ColumnWidthsAfterChangeTableColumnsCountOrOrder.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/ColumnWidthsAfterChangeTableColumnsCountOrOrder.java @@ -19,14 +19,14 @@ public class ColumnWidthsAfterChangeTableColumnsCountOrOrder @Override protected void setup(VaadinRequest request) { - List<TestBean> beanList = new ArrayList<TestBean>(); + List<TestBean> beanList = new ArrayList<>(); beanList.add(new TestBean(1, "name1", "descr1")); beanList.add(new TestBean(2, "name2", "descr2")); beanList.add(new TestBean(3, "name3", "descr3")); beanList.add(new TestBean(4, "name4", "descr4")); beanList.add(new TestBean(5, "name5", "descr5")); - BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>( + BeanItemContainer<TestBean> container = new BeanItemContainer<>( TestBean.class, beanList); VerticalLayout layout = new VerticalLayout(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ContextMenuSize.java b/uitest/src/main/java/com/vaadin/tests/components/table/ContextMenuSize.java index da04a1aac1..34cf62c055 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/ContextMenuSize.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/ContextMenuSize.java @@ -47,7 +47,7 @@ public class ContextMenuSize extends AbstractTestUI { new Action("action4") }; } }); - BeanItemContainer<Bean> container = new BeanItemContainer<Bean>( + BeanItemContainer<Bean> container = new BeanItemContainer<>( Bean.class); container.addBean(new Bean()); table.setContainerDataSource(container); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/DndTableTargetDetails.java b/uitest/src/main/java/com/vaadin/tests/components/table/DndTableTargetDetails.java index 0f64f4772b..e00d042ef0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/DndTableTargetDetails.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/DndTableTargetDetails.java @@ -42,7 +42,7 @@ public class DndTableTargetDetails extends AbstractTestUI { createSourceTable(); Table target = new Table(); - BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>( + BeanItemContainer<TestBean> container = new BeanItemContainer<>( TestBean.class); container.addBean(new TestBean("target-item")); target.setContainerDataSource(container); @@ -58,7 +58,7 @@ public class DndTableTargetDetails extends AbstractTestUI { table.setPageLength(1); table.setDragMode(TableDragMode.ROW); table.setWidth(100, Unit.PERCENTAGE); - BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>( + BeanItemContainer<TestBean> container = new BeanItemContainer<>( TestBean.class); container.addBean(new TestBean("item")); table.setContainerDataSource(container); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java b/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java index e68ce97fa4..923e5e0c43 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java @@ -21,7 +21,7 @@ import com.vaadin.v7.ui.ComboBox; import com.vaadin.v7.ui.Table; public class DoublesInTable extends TestBase { - BeanItemContainer<Person> personBeanItemContainer = new BeanItemContainer<Person>( + BeanItemContainer<Person> personBeanItemContainer = new BeanItemContainer<>( Person.class); private Table table; @@ -86,7 +86,7 @@ public class DoublesInTable extends TestBase { } private static BeanItemContainer<Person> createContainer(int nr) { - BeanItemContainer<Person> bic = new BeanItemContainer<Person>( + BeanItemContainer<Person> bic = new BeanItemContainer<>( Person.class); for (int i = 1; i <= nr; i++) { Person p = new Person(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java b/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java index ae4c83e789..1b142e5f6b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java @@ -58,7 +58,7 @@ public class EditableTableLeak extends TestBase { } private static class CachingFieldFactory extends DefaultFieldFactory { - private final HashMap<Object, HashMap<Object, Field<?>>> cache = new HashMap<Object, HashMap<Object, Field<?>>>(); + private final HashMap<Object, HashMap<Object, Field<?>>> cache = new HashMap<>(); @Override public Field<?> createField(Container container, Object itemId, diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java b/uitest/src/main/java/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java index 9bc61690f3..015a8c213a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java @@ -79,7 +79,7 @@ public class EmptyRowsWhenScrolling extends UI { setCompositionRoot(mainLayout); // Container with sample data - BeanContainer<Integer, SimpleBean> container = new BeanContainer<Integer, SimpleBean>( + BeanContainer<Integer, SimpleBean> container = new BeanContainer<>( SimpleBean.class); container.setBeanIdProperty("id"); for (int i = 1; i <= 50; ++i) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ExpandingContainer.java b/uitest/src/main/java/com/vaadin/tests/components/table/ExpandingContainer.java index af1e7b4e7a..35a7f4d446 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/ExpandingContainer.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/ExpandingContainer.java @@ -99,7 +99,7 @@ public class ExpandingContainer extends AbstractContainer implements return null; } final int index = ((Integer) itemId).intValue(); - return new BeanItem<MyBean>(new MyBean(index)); + return new BeanItem<>(new MyBean(index)); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java index c6cba16f91..8673a36ed6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java @@ -15,7 +15,7 @@ public class HeaderRightClickAfterDrag extends AbstractTestUI { protected void setup(VaadinRequest request) { Table table = new Table(); table.setContainerDataSource( - new BeanItemContainer<TestBean>(TestBean.class)); + new BeanItemContainer<>(TestBean.class)); for (int i = 0; i < 10; i++) { table.addItem(new TestBean(i)); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java b/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java index 98b8c0151f..eff7837299 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java @@ -15,11 +15,11 @@ public class KeyboardNavigationWithChangingContent extends TestBase { @Override protected void setup() { - ValueHolder<String> v1 = new ValueHolder<String>("test1"); - ValueHolder<String> v2 = new ValueHolder<String>("test2"); - ValueHolder<String> v3 = new ValueHolder<String>("test3"); + ValueHolder<String> v1 = new ValueHolder<>("test1"); + ValueHolder<String> v2 = new ValueHolder<>("test2"); + ValueHolder<String> v3 = new ValueHolder<>("test3"); @SuppressWarnings("unchecked") - final BeanItemContainer<ValueHolder<String>> bic = new BeanItemContainer<ValueHolder<String>>( + final BeanItemContainer<ValueHolder<String>> bic = new BeanItemContainer<>( Arrays.asList(v1, v2, v3)); final Table t = new Table(null, bic); t.setSelectable(true); @@ -40,7 +40,7 @@ public class KeyboardNavigationWithChangingContent extends TestBase { bic.removeAllItems(); ValueHolder<String> v4 = null; for (int i = 4; i < 30; i++) { - v4 = new ValueHolder<String>("test" + i); + v4 = new ValueHolder<>("test" + i); bic.addBean(v4); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java b/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java index 58ec0f765d..f28b27a858 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java @@ -51,7 +51,7 @@ public class LargeSelectionCausesNPE extends TestBase { Button button = new Button("Update the first item"); Label nameLabel = new Label(); - HashSet<Object> markedRows = new HashSet<Object>(); + HashSet<Object> markedRows = new HashSet<>(); Label selected = new Label(); public SelectionExample() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/LeftColumnAlignment.java b/uitest/src/main/java/com/vaadin/tests/components/table/LeftColumnAlignment.java index bd99a2d5dd..83958176fa 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/LeftColumnAlignment.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/LeftColumnAlignment.java @@ -37,7 +37,7 @@ public class LeftColumnAlignment extends AbstractTestUI { protected void setup(VaadinRequest request) { final Table table = new Table(); - BeanItemContainer<Bean> container = new BeanItemContainer<Bean>( + BeanItemContainer<Bean> container = new BeanItemContainer<>( Bean.class); Bean bean = new Bean(); bean.setName("property"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java b/uitest/src/main/java/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java index 783889c224..0fd201fc9a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/MultiSelectWithRemovedRow.java @@ -34,7 +34,7 @@ public class MultiSelectWithRemovedRow extends TestBase { final Log log = new Log(5); addComponent(log); - final BeanItemContainer<Person> container = new BeanItemContainer<Person>( + final BeanItemContainer<Person> container = new BeanItemContainer<>( Person.class, Arrays.asList(new Person("Joe"), new Person("William"), new Person("Jack"), new Person("Averell"), diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/NotselectablePaintSelections.java b/uitest/src/main/java/com/vaadin/tests/components/table/NotselectablePaintSelections.java index 85eafb9333..dda9e34594 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/NotselectablePaintSelections.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/NotselectablePaintSelections.java @@ -28,7 +28,7 @@ public class NotselectablePaintSelections extends TestBase { t.setMultiSelect(true); t.setPageLength(5); t.addContainerProperty("Name", String.class, null); - Set<Object> selected = new HashSet<Object>(); + Set<Object> selected = new HashSet<>(); for (int i = 0; i < 30; i++) { Item item = t.addItem(i); item.getItemProperty("Name").setValue("Name " + i); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ReloadWidgets.java b/uitest/src/main/java/com/vaadin/tests/components/table/ReloadWidgets.java index 525e2f2ecf..44a489d20c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/ReloadWidgets.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/ReloadWidgets.java @@ -16,7 +16,7 @@ public class ReloadWidgets extends AbstractTestUI { protected void setup(VaadinRequest request) { final Table table = new Table(null, - new BeanItemContainer<Bean>(Bean.class)); + new BeanItemContainer<>(Bean.class)); table.setId("table"); table.setSizeFull(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ScrollCausesRequestLoop.java b/uitest/src/main/java/com/vaadin/tests/components/table/ScrollCausesRequestLoop.java index d5c4a2ca4f..6678674dc6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/ScrollCausesRequestLoop.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/ScrollCausesRequestLoop.java @@ -55,7 +55,7 @@ public class ScrollCausesRequestLoop extends AbstractTestCase { private static List<Person> createData() { int count = 500; - List<Person> data = new ArrayList<Person>(count); + List<Person> data = new ArrayList<>(count); for (int i = 0; i < count; i++) { data.add(new Person("Person", "" + i, "Email", "Phone", "Street", 12345, "City")); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.java b/uitest/src/main/java/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.java index de5e4fef29..3d0d04bd40 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.java @@ -72,7 +72,7 @@ public class SetDataSourceWithPropertyIds extends AbstractTestUI { table.setVisibleColumns(new String[] { "jobId" }); label.setValue("no Exception"); } catch (CacheUpdateException e) { - ArrayList<String> propertyIds = new ArrayList<String>(); + ArrayList<String> propertyIds = new ArrayList<>(); propertyIds.add("jobId"); table.setContainerDataSource(jobContainer, propertyIds); label.setValue("Exception caught"); @@ -81,7 +81,7 @@ public class SetDataSourceWithPropertyIds extends AbstractTestUI { private List<JobsBean> getBeanList() { - List<JobsBean> list = new ArrayList<JobsBean>(); + List<JobsBean> list = new ArrayList<>(); JobsBean jobsBean = new JobsBean(); jobsBean.setJobId("1"); list.add(jobsBean); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableJumpUI.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableJumpUI.java index dc824c60ec..c623c00a4a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableJumpUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableJumpUI.java @@ -53,7 +53,7 @@ public class TableJumpUI extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - BeanItemContainer<TestObj> container = new BeanItemContainer<TestObj>( + BeanItemContainer<TestObj> container = new BeanItemContainer<>( TestObj.class); for (int i = 0; i < 2; i++) { container.addBean(new TestObj(i)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java index 4c3a599704..d148dbb569 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableMoveFocusWithSelection.java @@ -57,7 +57,7 @@ public class TableMoveFocusWithSelection extends AbstractTestUI { @Override public void layoutClick(LayoutClickEvent event) { if (t.isMultiSelect()) { - Set<Object> values = new HashSet<Object>( + Set<Object> values = new HashSet<>( (Set<Object>) t.getValue()); values.add(l.getData()); t.setValue(values); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableReduceContainerSize.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableReduceContainerSize.java index 0439d15fe2..93bd94b774 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableReduceContainerSize.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableReduceContainerSize.java @@ -105,7 +105,7 @@ public class TableReduceContainerSize extends TestBase { } private static List<TestObject> createData(int count) { - ArrayList<TestObject> data = new ArrayList<TestObject>(count); + ArrayList<TestObject> data = new ArrayList<>(count); for (int i = 0; i < count; i++) { data.add(new TestObject("string-" + i, new Date(), i)); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableRepairsScrollPositionOnReAddingAllRows.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableRepairsScrollPositionOnReAddingAllRows.java index a1177b7db3..87a1d5c296 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableRepairsScrollPositionOnReAddingAllRows.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableRepairsScrollPositionOnReAddingAllRows.java @@ -24,9 +24,9 @@ public class TableRepairsScrollPositionOnReAddingAllRows @Override protected void setup(VaadinRequest request) { - final BeanItemContainer<TableItem> cont = new BeanItemContainer<TableItem>( + final BeanItemContainer<TableItem> cont = new BeanItemContainer<>( TableItem.class); - final List<TableItem> restoringItemList = new ArrayList<TableItem>(); + final List<TableItem> restoringItemList = new ArrayList<>(); final Table table = new Table(); table.setWidth("400px"); @@ -51,7 +51,7 @@ public class TableRepairsScrollPositionOnReAddingAllRows @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { - List<TableItem> originalItemIds = new ArrayList<TableItem>( + List<TableItem> originalItemIds = new ArrayList<>( cont.getItemIds()); cont.removeAllItems(); cont.addAll(originalItemIds); @@ -71,7 +71,7 @@ public class TableRepairsScrollPositionOnReAddingAllRows cont.removeAllItems(); // create new collection (of different items) with other // size - List<TableItem> itemList = new ArrayList<TableItem>(); + List<TableItem> itemList = new ArrayList<>(); for (int i = 0; i < 79; i++) { TableItem ti = new TableItem(); ti.setName("AnotherItem1_" + i); @@ -128,7 +128,7 @@ public class TableRepairsScrollPositionOnReAddingAllRows com.vaadin.ui.Button.ClickEvent event) { cont.removeAllItems(); - List<TableItem> list = new ArrayList<TableItem>( + List<TableItem> list = new ArrayList<>( restoringItemList); TableItem ti = new TableItem(); ti.setName("AnotherItem3_" + 80); @@ -160,7 +160,7 @@ public class TableRepairsScrollPositionOnReAddingAllRows @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { cont.removeAllItems(); - BeanItemContainer<TableItem> newContainer = new BeanItemContainer<TableItem>( + BeanItemContainer<TableItem> newContainer = new BeanItemContainer<>( TableItem.class); for (int i = 0; i < 50; i++) { TableItem ti = new TableItem(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableSelectPagingOff.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableSelectPagingOff.java index d173c7f5c7..f9f0069e5c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableSelectPagingOff.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableSelectPagingOff.java @@ -12,7 +12,7 @@ public class TableSelectPagingOff extends TestBase { @Override protected void setup() { Table table = new Table(); - BeanItemContainer<MyBean> dataSource = new BeanItemContainer<MyBean>( + BeanItemContainer<MyBean> dataSource = new BeanItemContainer<>( getBeans()); table.setContainerDataSource(dataSource); table.setSelectable(true); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableSorting.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableSorting.java index 995ab7e211..fd8c704f4c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableSorting.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableSorting.java @@ -16,7 +16,7 @@ public class TableSorting extends TestBase { final Label showID = new Label(""); final Table testTable = new Table(); - BeanItemContainer<TestItem> cont = new BeanItemContainer<TestItem>( + BeanItemContainer<TestItem> cont = new BeanItemContainer<>( TestItem.class); for (int i = 0; i < 20; i++) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingIndicator.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingIndicator.java index 31e8c262fb..8f44801437 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingIndicator.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingIndicator.java @@ -56,7 +56,7 @@ public class TableSortingIndicator extends AbstractTestUI { } private Container buildContainer() { - BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>( + BeanItemContainer<TestBean> container = new BeanItemContainer<>( TestBean.class); for (int i = 0; i < 100; ++i) { TestBean item = new TestBean(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingStopsWorkingOnChrome.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingStopsWorkingOnChrome.java index a319cbe7ea..e625608631 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingStopsWorkingOnChrome.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableSortingStopsWorkingOnChrome.java @@ -32,7 +32,7 @@ public class TableSortingStopsWorkingOnChrome extends AbstractTestUI { table.setColumnReorderingAllowed(true); table.setSizeFull(); - BeanItemContainer<TestItem> cont = new BeanItemContainer<TestItem>( + BeanItemContainer<TestItem> cont = new BeanItemContainer<>( TestItem.class); for (int i = 0; i < ROW_COUNT; i++) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableUnregisterComponent.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableUnregisterComponent.java index 59f5d3e49a..46853b9cb4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TableUnregisterComponent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableUnregisterComponent.java @@ -30,7 +30,7 @@ public class TableUnregisterComponent extends TestBase { container.addContainerProperty(COL_B, String.class, ""); Item it = container.addItem("a"); - final ObjectProperty<String> valA = new ObjectProperty<String>( + final ObjectProperty<String> valA = new ObjectProperty<>( "orgVal"); final TextField fieldA = new TextField(valA) { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/Tables.java b/uitest/src/main/java/com/vaadin/tests/components/table/Tables.java index 6439dfa64b..608c706d66 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/Tables.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/Tables.java @@ -59,7 +59,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> private Command<T, Boolean> columnVisibleCommand = new Command<T, Boolean>() { @Override public void execute(Table c, Boolean visible, Object propertyId) { - List<Object> visibleColumns = new ArrayList<Object>( + List<Object> visibleColumns = new ArrayList<>( Arrays.asList(c.getVisibleColumns())); if (visible) { // Table should really check this... Completely fails without @@ -491,7 +491,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createCellStyleAction(String categoryFeatures) { - LinkedHashMap<String, CellStyleInfo> options = new LinkedHashMap<String, CellStyleInfo>(); + LinkedHashMap<String, CellStyleInfo> options = new LinkedHashMap<>(); options.put("None", null); options.put("Red row", new CellStyleInfo( "tables-test-cell-style-red-row", "Item 2", null)); @@ -502,7 +502,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createGeneratedRowAction(String categoryFeatures) { - LinkedHashMap<String, GeneratedRowInfo> options = new LinkedHashMap<String, GeneratedRowInfo>(); + LinkedHashMap<String, GeneratedRowInfo> options = new LinkedHashMap<>(); options.put("None", null); options.put("Every fifth row, spanned", new GeneratedRowInfo(5, false, "foobarbaz this is a long one that should span.")); @@ -523,7 +523,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createColumnHeaderMode(String category) { - LinkedHashMap<String, ColumnHeaderMode> columnHeaderModeOptions = new LinkedHashMap<String, ColumnHeaderMode>(); + LinkedHashMap<String, ColumnHeaderMode> columnHeaderModeOptions = new LinkedHashMap<>(); columnHeaderModeOptions.put("Hidden", ColumnHeaderMode.HIDDEN); columnHeaderModeOptions.put("Id", ColumnHeaderMode.ID); columnHeaderModeOptions.put("Explicit", ColumnHeaderMode.EXPLICIT); @@ -536,7 +536,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createValueSelection(String categorySelection) { - LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> options = new LinkedHashMap<>(); options.put("null", null); for (int i = 1; i <= 10; i++) { options.put("Item " + i, "Item " + i); @@ -546,7 +546,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createContextMenuAction(String category) { - LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<String, ContextMenu>(); + LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<>(); options.put("None", null); options.put("Item without icon", new ContextMenu("No icon", null)); ContextMenu cm = new ContextMenu(); @@ -663,7 +663,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> createBooleanAction("Collapsed", category, false, columnCollapsed, propertyId); t.log("Collapsed"); - LinkedHashMap<String, Align> options = new LinkedHashMap<String, Align>(); + LinkedHashMap<String, Align> options = new LinkedHashMap<>(); options.put("Left", Align.LEFT); options.put("Center", Align.CENTER); options.put("Right", Align.RIGHT); @@ -671,7 +671,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> createSelectAction("Alignment", category, options, "Left", columnAlignmentCommand, propertyId); t.log("Alignment"); - LinkedHashMap<String, Integer> widthOptions = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> widthOptions = new LinkedHashMap<>(); widthOptions.put("- remove -", -1); for (int i : new int[] { 0, 1, 10, 100, 200, 400 }) { widthOptions.put(i + "px", i); @@ -680,7 +680,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> columnWidthCommand, propertyId); t.log("Width"); - LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<String, Resource>(); + LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<>(); iconOptions.put("- none -", null); iconOptions.put("ok 16x16", ICON_16_USER_PNG_CACHEABLE); iconOptions.put("help 16x16", ICON_16_HELP_PNG_CACHEABLE); @@ -690,7 +690,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> columnIconCommand, propertyId); t.log("Icon"); - LinkedHashMap<String, String> columnHeaderOptions = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> columnHeaderOptions = new LinkedHashMap<>(); columnHeaderOptions.put("- none -", null); columnHeaderOptions.put("A", "A"); columnHeaderOptions.put("A nice column", "A nice column"); @@ -698,7 +698,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> createSelectAction("Column header", category, columnHeaderOptions, "- none -", columnHeaderCommand, propertyId); t.log("Header"); - LinkedHashMap<String, Float> expandOptions = new LinkedHashMap<String, Float>(); + LinkedHashMap<String, Float> expandOptions = new LinkedHashMap<>(); expandOptions.put("- remove -", -1f); for (float i : new float[] { 0, 1, 2, 3, 4, 5 }) { expandOptions.put(i + "", i); @@ -715,7 +715,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createRowHeaderModeSelect(String category) { - LinkedHashMap<String, RowHeaderMode> options = new LinkedHashMap<String, RowHeaderMode>(); + LinkedHashMap<String, RowHeaderMode> options = new LinkedHashMap<>(); options.put("Explicit", RowHeaderMode.EXPLICIT); options.put("Explicit defaults id", RowHeaderMode.EXPLICIT_DEFAULTS_ID); options.put("Hidden", RowHeaderMode.HIDDEN); @@ -730,7 +730,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createFooterTextSelect(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("None", null); options.put("Footer X", "Footer {id}"); options.put("X", "{id}"); @@ -740,7 +740,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } private void createHeaderTextCheckbox(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("None", null); options.put("Col: {id}", "Col: {id}"); options.put("Header {id} - every second", "Header {id}"); @@ -803,7 +803,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } protected void createHeaderVisibilitySelect(String category) { - LinkedHashMap<String, ColumnHeaderMode> options = new LinkedHashMap<String, ColumnHeaderMode>(); + LinkedHashMap<String, ColumnHeaderMode> options = new LinkedHashMap<>(); options.put("Explicit", ColumnHeaderMode.EXPLICIT); options.put("Explicit defaults id", ColumnHeaderMode.EXPLICIT_DEFAULTS_ID); @@ -823,7 +823,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } protected void createPageLengthSelect(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("0", 0); options.put("5", 5); options.put("10", 10); @@ -845,7 +845,7 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T> } protected void createSelectionModeSelect(String category) { - LinkedHashMap<String, SelectMode> options = new LinkedHashMap<String, SelectMode>(); + LinkedHashMap<String, SelectMode> options = new LinkedHashMap<>(); options.put("None", SelectMode.NONE); options.put("Single", SelectMode.SINGLE); options.put("Multi - simple", SelectMode.MULTI_SIMPLE); diff --git a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java index 8607dfe42e..c58edc38a8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java @@ -70,7 +70,7 @@ public class FirstTabNotVisibleWhenTabsheetNotClipped extends AbstractTestUI { TabSheet tabsheet = new TabSheet(); String[] letters = { "A", "B", "C", "D" }; - HashMap<String, TabSheet.Tab> tabMap = new HashMap<String, TabSheet.Tab>(); + HashMap<String, TabSheet.Tab> tabMap = new HashMap<>(); for (String letter : letters) { VerticalLayout vLayout = new VerticalLayout(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/RemoveTabs.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/RemoveTabs.java index 2b37c4358e..45890ced73 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/RemoveTabs.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/RemoveTabs.java @@ -133,7 +133,7 @@ public class RemoveTabs extends TestBase { AbstractComponentContainer container = tabsheet; if (container != null) { - List<Component> c = new ArrayList<Component>(); + List<Component> c = new ArrayList<>(); Iterator<Component> i = container.getComponentIterator(); while (i.hasNext()) { Component comp = i.next(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java index 0f08b19318..e17ec00227 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java @@ -32,7 +32,7 @@ import com.vaadin.v7.ui.TextField; public class TabKeyboardNavigation extends AbstractTestUI { int index = 1; - ArrayList<Component> tabs = new ArrayList<Component>(); + ArrayList<Component> tabs = new ArrayList<>(); TabSheet ts = new TabSheet(); Log focusblur = new Log(10); diff --git a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationWaiAria.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationWaiAria.java index 7f1792474e..09f1e7b55c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationWaiAria.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationWaiAria.java @@ -17,7 +17,7 @@ import com.vaadin.v7.ui.TextField; public class TabKeyboardNavigationWaiAria extends AbstractTestUI { int index = 1; - ArrayList<Component> tabs = new ArrayList<Component>(); + ArrayList<Component> tabs = new ArrayList<>(); TabSheet ts = new TabSheet(); @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabSheetTest.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabSheetTest.java index c106b5bde2..ece3693bfd 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabSheetTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabSheetTest.java @@ -160,7 +160,7 @@ public class TabSheetTest<T extends TabSheet> extends String captionOptions[] = new String[] { "", "{id}", "Tab {id}", "A long caption for tab {id}" }; - LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<String, Resource>(); + LinkedHashMap<String, Resource> iconOptions = new LinkedHashMap<>(); iconOptions.put("-", null); iconOptions.put("16x16 (cachable)", ICON_16_USER_PNG_CACHEABLE); iconOptions.put("16x16 (uncachable)", ICON_16_USER_PNG_UNCACHEABLE); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/BigDecimalTextField.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/BigDecimalTextField.java index 352bf86423..5de8cd1a19 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/BigDecimalTextField.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/BigDecimalTextField.java @@ -43,7 +43,7 @@ public class BigDecimalTextField extends AbstractTestUIWithLog { setLocale(new Locale("fi", "FI")); BeanBigDecimal beanBigDecimal = new BeanBigDecimal(); - BeanItem<BeanBigDecimal> beanItem = new BeanItem<BeanBigDecimal>( + BeanItem<BeanBigDecimal> beanItem = new BeanItem<>( beanBigDecimal); FormLayout formLayout = new FormLayout(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithDataSourceAndInputPrompt.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithDataSourceAndInputPrompt.java index a9920c2ead..9c5f83e323 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithDataSourceAndInputPrompt.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithDataSourceAndInputPrompt.java @@ -45,7 +45,7 @@ public class TextFieldWithDataSourceAndInputPrompt extends AbstractTestUI { "TextField with null data source value"); textField2.setInputPrompt("Me is input prompt"); textField2.setNullRepresentation(null); - BeanItem<Pojo> beanItem = new BeanItem<Pojo>(new Pojo()); + BeanItem<Pojo> beanItem = new BeanItem<>(new Pojo()); textField2.setPropertyDataSource(beanItem.getItemProperty("string")); addComponent(textField2); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithProperty.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithProperty.java index 15d5a1694a..79239da7e7 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithProperty.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithProperty.java @@ -15,7 +15,7 @@ public class TextFieldWithProperty extends TestBase { final TextField tf1 = new TextField(); - final ObjectProperty<String> op = new ObjectProperty<String>("FOO"); + final ObjectProperty<String> op = new ObjectProperty<>("FOO"); tf1.setPropertyDataSource(op); diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/Trees.java b/uitest/src/main/java/com/vaadin/tests/components/tree/Trees.java index dbe64a5355..9694ce66d9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tree/Trees.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tree/Trees.java @@ -130,7 +130,7 @@ public class Trees extends AbstractSelectTestCase<Tree> } private void createContextMenuAction(String category) { - LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<String, ContextMenu>(); + LinkedHashMap<String, ContextMenu> options = new LinkedHashMap<>(); options.put("None", null); options.put("Item without icon", new ContextMenu("No icon", null)); ContextMenu cm = new ContextMenu(); @@ -146,7 +146,7 @@ public class Trees extends AbstractSelectTestCase<Tree> private void createItemStyleGenerator(String category) { - LinkedHashMap<String, com.vaadin.v7.ui.Tree.ItemStyleGenerator> options = new LinkedHashMap<String, com.vaadin.v7.ui.Tree.ItemStyleGenerator>(); + LinkedHashMap<String, com.vaadin.v7.ui.Tree.ItemStyleGenerator> options = new LinkedHashMap<>(); options.put("-", null); options.put(rootGreenSecondLevelRed.toString(), @@ -173,7 +173,7 @@ public class Trees extends AbstractSelectTestCase<Tree> } protected void createSelectionModeSelect(String category) { - LinkedHashMap<String, SelectMode> options = new LinkedHashMap<String, SelectMode>(); + LinkedHashMap<String, SelectMode> options = new LinkedHashMap<>(); options.put("None", SelectMode.NONE); options.put("Single", SelectMode.SINGLE); options.put("Multi - simple", SelectMode.MULTI_SIMPLE); @@ -245,7 +245,7 @@ public class Trees extends AbstractSelectTestCase<Tree> secondLevel++; } - List<Object> itemIds = new ArrayList<Object>(c.getItemIds()); + List<Object> itemIds = new ArrayList<>(c.getItemIds()); int nextItemId = roots; for (int rootIndex = 0; rootIndex < roots; rootIndex++) { @@ -282,7 +282,7 @@ public class Trees extends AbstractSelectTestCase<Tree> } private void createRootItemSelectAction(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); for (int i = 1; i <= 10; i++) { options.put(String.valueOf(i), i); } @@ -295,7 +295,7 @@ public class Trees extends AbstractSelectTestCase<Tree> } private void createExpandCollapseActions(String category) { - LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> options = new LinkedHashMap<>(); for (Object id : getComponent().getItemIds()) { options.put(id.toString(), id); @@ -310,7 +310,7 @@ public class Trees extends AbstractSelectTestCase<Tree> } private void createChildrenAllowedAction(String category) { - LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> options = new LinkedHashMap<>(); for (Object id : getComponent().getItemIds()) { options.put(id.toString(), id); diff --git a/uitest/src/main/java/com/vaadin/tests/components/treetable/ProgrammaticSelect.java b/uitest/src/main/java/com/vaadin/tests/components/treetable/ProgrammaticSelect.java index c47d258d6f..8a6fb535c5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treetable/ProgrammaticSelect.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treetable/ProgrammaticSelect.java @@ -65,7 +65,7 @@ public class ProgrammaticSelect extends TestBase { secondLevel++; } - List<Object> itemIds = new ArrayList<Object>(c.getItemIds()); + List<Object> itemIds = new ArrayList<>(c.getItemIds()); int nextItemId = roots; for (int rootIndex = 0; rootIndex < roots; rootIndex++) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/treetable/RowHeightWithoutRows.java b/uitest/src/main/java/com/vaadin/tests/components/treetable/RowHeightWithoutRows.java index 137d91bb64..95f215b66b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treetable/RowHeightWithoutRows.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treetable/RowHeightWithoutRows.java @@ -11,7 +11,7 @@ public class RowHeightWithoutRows extends TestBase { private TreeTable treeTable = new TreeTable(); - private BeanItemContainer<User> container = new BeanItemContainer<User>( + private BeanItemContainer<User> container = new BeanItemContainer<>( User.class); @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java index da41209a50..3824c6c5d0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java @@ -115,7 +115,7 @@ public class TreeTableCacheOnPartialUpdates extends TestBase { if (c instanceof Container.Indexed) { return ((Container.Indexed) source).indexOfId(itemId); } else { - ArrayList<Object> list = new ArrayList<Object>(source.getItemIds()); + ArrayList<Object> list = new ArrayList<>(source.getItemIds()); return list.indexOf(itemId); } @@ -160,9 +160,9 @@ public class TreeTableCacheOnPartialUpdates extends TestBase { addComponent(cacheRateSelect); treeTable = new TreeTable(); treeTable.addStyleName("table-equal-rowheight"); - testBeanContainer = new BeanItemContainer<TestBean>(TestBean.class); + testBeanContainer = new BeanItemContainer<>(TestBean.class); - Map<String, Integer> hasChildren = new HashMap<String, Integer>(); + Map<String, Integer> hasChildren = new HashMap<>(); hasChildren.put("1", 5); hasChildren.put("3", 10); hasChildren.put("5", 20); diff --git a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java index 6b15367d6b..3e99374ae0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java @@ -12,7 +12,7 @@ import com.vaadin.v7.ui.TreeTable; public class TreeTableContainerHierarchicalWrapper extends AbstractTestUI { TreeTable treetable = new TreeTable(); - BeanItemContainer<Bean> beanContainer = new BeanItemContainer<Bean>( + BeanItemContainer<Bean> beanContainer = new BeanItemContainer<>( Bean.class); ContainerHierarchicalWrapper hierarchicalWrapper = new ContainerHierarchicalWrapper( beanContainer); diff --git a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableTest.java b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableTest.java index f5f7cc866c..e8903ed92f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableTest.java @@ -158,7 +158,7 @@ public class TreeTableTest extends Tables<TreeTable> secondLevel++; } - List<Object> itemIds = new ArrayList<Object>(c.getItemIds()); + List<Object> itemIds = new ArrayList<>(c.getItemIds()); int nextItemId = roots; for (int rootIndex = 0; rootIndex < roots; rootIndex++) { @@ -195,7 +195,7 @@ public class TreeTableTest extends Tables<TreeTable> } private void createRootItemSelectAction(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); for (int i = 1; i <= 10; i++) { options.put(String.valueOf(i), i); } @@ -208,7 +208,7 @@ public class TreeTableTest extends Tables<TreeTable> } private void createExpandCollapseActions(String category) { - LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> options = new LinkedHashMap<>(); for (Object id : getComponent().getItemIds()) { options.put(id.toString(), id); @@ -223,7 +223,7 @@ public class TreeTableTest extends Tables<TreeTable> } private void createChildrenAllowedAction(String category) { - LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> options = new LinkedHashMap<>(); for (Object id : getComponent().getItemIds()) { options.put(id.toString(), id); diff --git a/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java b/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java index fd16225636..230825d808 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java +++ b/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java @@ -19,7 +19,7 @@ public class TwinColSelects extends AbstractSelectTestCase<TwinColSelect> { } private void createRowSelectAction() { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("-", 0); for (int i = 1; i <= 10; i++) { options.put(String.valueOf(i), i); diff --git a/uitest/src/main/java/com/vaadin/tests/components/ui/CurrentUiRetained.java b/uitest/src/main/java/com/vaadin/tests/components/ui/CurrentUiRetained.java index 1632e1e613..dcb1dcf577 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ui/CurrentUiRetained.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ui/CurrentUiRetained.java @@ -32,8 +32,8 @@ public class CurrentUiRetained extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - final ArrayList<UI> uiLog = new ArrayList<UI>(); - final ArrayList<Boolean> probeLog = new ArrayList<Boolean>(); + final ArrayList<UI> uiLog = new ArrayList<>(); + final ArrayList<Boolean> probeLog = new ArrayList<>(); final Thread thread = new Thread(new Runnable() { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/ui/UIsInMultipleTabs.java b/uitest/src/main/java/com/vaadin/tests/components/ui/UIsInMultipleTabs.java index 25bf40edde..c10da456b5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ui/UIsInMultipleTabs.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ui/UIsInMultipleTabs.java @@ -13,7 +13,7 @@ import com.vaadin.ui.VerticalLayout; public class UIsInMultipleTabs extends AbstractTestUIProvider { // No cleanup -> will leak, but shouldn't matter for tests - private static ConcurrentHashMap<VaadinSession, AtomicInteger> numberOfUIsOpened = new ConcurrentHashMap<VaadinSession, AtomicInteger>(); + private static ConcurrentHashMap<VaadinSession, AtomicInteger> numberOfUIsOpened = new ConcurrentHashMap<>(); public static class TabUI extends UI { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/uitest/TestSampler.java b/uitest/src/main/java/com/vaadin/tests/components/uitest/TestSampler.java index ef2ed2ffda..19a2148001 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/uitest/TestSampler.java +++ b/uitest/src/main/java/com/vaadin/tests/components/uitest/TestSampler.java @@ -35,7 +35,7 @@ import com.vaadin.ui.Window; public class TestSampler extends TabSheet { public static final String ICON_URL = "../runo/icons/16/help.png"; - private List<Component> components = new ArrayList<Component>(); + private List<Component> components = new ArrayList<>(); private ComponentContainer currentTab; diff --git a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/FormsCssTest.java b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/FormsCssTest.java index b6ac6e2f97..9280faf600 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/FormsCssTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/FormsCssTest.java @@ -20,8 +20,8 @@ public class FormsCssTest extends HorizontalLayout { setWidth("100%"); VerticalLayout vl = new VerticalLayout(); - FieldGroup fg = new BeanFieldGroup<Person>(Person.class); - fg.setItemDataSource(new BeanItem<Person>(new Person())); + FieldGroup fg = new BeanFieldGroup<>(Person.class); + fg.setItemDataSource(new BeanItem<>(new Person())); for (Object propId : fg.getUnboundPropertyIds()) { if (!"address".equals(propId)) { vl.addComponent(fg.buildAndBind(propId)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/TablesCssTest.java b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/TablesCssTest.java index ab8011010c..7441544a13 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/TablesCssTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/TablesCssTest.java @@ -42,7 +42,7 @@ public class TablesCssTest extends GridLayout { } private void createTableWith(String caption, String primaryStyleName) { - final HashSet<Object> markedRows = new HashSet<Object>(); + final HashSet<Object> markedRows = new HashSet<>(); final Table t; if (caption != null) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/upload/TestUpload.java b/uitest/src/main/java/com/vaadin/tests/components/upload/TestUpload.java index 9ca0cb9c38..cac26c2297 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/upload/TestUpload.java +++ b/uitest/src/main/java/com/vaadin/tests/components/upload/TestUpload.java @@ -46,7 +46,7 @@ public class TestUpload extends ComponentTestCase<Upload> implements Receiver { @Override protected List<Component> createActions() { - List<Component> actions = new ArrayList<Component>(); + List<Component> actions = new ArrayList<>(); actions.add(createEnabledAction(true)); return actions; diff --git a/uitest/src/main/java/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java b/uitest/src/main/java/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java index 516ca2d7c9..c117f179f7 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java +++ b/uitest/src/main/java/com/vaadin/tests/components/upload/TestUploadAndDisableOnSuccess.java @@ -79,7 +79,7 @@ public class TestUploadAndDisableOnSuccess extends ComponentTestCase<Upload> @Override protected List<Component> createActions() { - List<Component> actions = new ArrayList<Component>(); + List<Component> actions = new ArrayList<>(); actions.add(createButtonAction("Toggle Enabled", new Command<Upload, Boolean>() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/BottomComponentScrollsUp.java b/uitest/src/main/java/com/vaadin/tests/components/window/BottomComponentScrollsUp.java index 857d84f261..d7aaab37ca 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/window/BottomComponentScrollsUp.java +++ b/uitest/src/main/java/com/vaadin/tests/components/window/BottomComponentScrollsUp.java @@ -79,7 +79,7 @@ public class BottomComponentScrollsUp extends AbstractTestUI { p.setContent(content); content.setHeight("500px"); - List<String> items = new ArrayList<String>(); + List<String> items = new ArrayList<>(); items.add("1"); items.add("2"); items.add("3"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/SubWindowOrder.java b/uitest/src/main/java/com/vaadin/tests/components/window/SubWindowOrder.java index 6d9ced5d11..f4dae2aa75 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/window/SubWindowOrder.java +++ b/uitest/src/main/java/com/vaadin/tests/components/window/SubWindowOrder.java @@ -16,7 +16,7 @@ import com.vaadin.v7.ui.ComboBox; public class SubWindowOrder extends TestBase { - private BeanItemContainer<Window> windowlist = new BeanItemContainer<Window>( + private BeanItemContainer<Window> windowlist = new BeanItemContainer<>( Window.class); @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/WindowCloseShortcuts.java b/uitest/src/main/java/com/vaadin/tests/components/window/WindowCloseShortcuts.java index 47523067c9..dca7074f2e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/window/WindowCloseShortcuts.java +++ b/uitest/src/main/java/com/vaadin/tests/components/window/WindowCloseShortcuts.java @@ -167,7 +167,7 @@ public class WindowCloseShortcuts extends AbstractTestUI { } private String elementToHtml(Element producedElem, StringBuilder sb) { - ArrayList<String> names = new ArrayList<String>(); + ArrayList<String> names = new ArrayList<>(); for (Attribute a : producedElem.attributes().asList()) { names.add(a.getKey()); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java b/uitest/src/main/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java index 300809e420..3eca52b468 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java +++ b/uitest/src/main/java/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java @@ -68,7 +68,7 @@ public class WindowShouldRemoveActionHandler extends AbstractTestUI { removeActionHandler(actionHandlers.remove(actionHandlers.size() - 1)); } - private List<Handler> actionHandlers = new ArrayList<Handler>(); + private List<Handler> actionHandlers = new ArrayList<>(); public void add() { Handler actionHandler = new Handler() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/WindowZIndex.java b/uitest/src/main/java/com/vaadin/tests/components/window/WindowZIndex.java index 5d1a2540b8..965dd470eb 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/window/WindowZIndex.java +++ b/uitest/src/main/java/com/vaadin/tests/components/window/WindowZIndex.java @@ -25,7 +25,7 @@ public class WindowZIndex extends AbstractTestUI { } int windowCount = 0; - Queue<Window> windows = new ArrayDeque<Window>(); + Queue<Window> windows = new ArrayDeque<>(); @Override protected void setup(VaadinRequest request) { diff --git a/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java b/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java index 1a5a7ff9f6..a423fbef0e 100644 --- a/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java +++ b/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java @@ -64,7 +64,7 @@ public class BeanItemContainerFilteringTest extends TestBase { protected void setup() { table = new Table(); try { - container = new BeanItemContainer<TestBean>(TestBean.class); + container = new BeanItemContainer<>(TestBean.class); table.setContainerDataSource(container); table.setWidth(300, Sizeable.UNITS_PIXELS); diff --git a/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerTest.java b/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerTest.java index 0edd76e5a1..3946ec12be 100644 --- a/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerTest.java +++ b/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerTest.java @@ -15,16 +15,16 @@ public class BeanItemContainerTest { */ public static void main(String[] args) throws InstantiationException, IllegalAccessException { - BeanItemContainer<Hello> c = new BeanItemContainer<Hello>(Hello.class); + BeanItemContainer<Hello> c = new BeanItemContainer<>(Hello.class); c.addItem(new Hello()); - Collection<Hello> col = new LinkedList<Hello>(); + Collection<Hello> col = new LinkedList<>(); for (int i = 0; i < 100; i++) { col.add(new Hello()); } col.add(new Hello2()); - c = new BeanItemContainer<Hello>(col); + c = new BeanItemContainer<>(col); System.out.println(c + " contains " + c.size() + " objects"); diff --git a/uitest/src/main/java/com/vaadin/tests/containers/filesystemcontainer/FileSystemContainerInTreeTable.java b/uitest/src/main/java/com/vaadin/tests/containers/filesystemcontainer/FileSystemContainerInTreeTable.java index c8b3604fd6..13d43f8349 100644 --- a/uitest/src/main/java/com/vaadin/tests/containers/filesystemcontainer/FileSystemContainerInTreeTable.java +++ b/uitest/src/main/java/com/vaadin/tests/containers/filesystemcontainer/FileSystemContainerInTreeTable.java @@ -120,7 +120,7 @@ public class FileSystemContainerInTreeTable extends TestBase { if (c instanceof Container.Indexed) { return ((Container.Indexed) source).indexOfId(itemId); } else { - ArrayList<Object> list = new ArrayList<Object>(source.getItemIds()); + ArrayList<Object> list = new ArrayList<>(source.getItemIds()); return list.indexOf(itemId); } } diff --git a/uitest/src/main/java/com/vaadin/tests/dd/DDTest2.java b/uitest/src/main/java/com/vaadin/tests/dd/DDTest2.java index ea688c7380..73e709d79d 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/DDTest2.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/DDTest2.java @@ -83,7 +83,7 @@ public class DDTest2 extends TestBase { @Override protected Set<Object> getAllowedItemIds(DragAndDropEvent dragEvent, Tree tree) { - return new HashSet<Object>(tree.getItemIds()); + return new HashSet<>(tree.getItemIds()); } }; diff --git a/uitest/src/main/java/com/vaadin/tests/dd/DDTest6.java b/uitest/src/main/java/com/vaadin/tests/dd/DDTest6.java index 69c9e3cfe9..86f47ac505 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/DDTest6.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/DDTest6.java @@ -79,7 +79,7 @@ public class DDTest6 extends TestBase { tree1 = new Tree("Volume 1"); tree1.setImmediate(true); - fs1 = new BeanItemContainer<File>(File.class); + fs1 = new BeanItemContainer<>(File.class); tree1.setContainerDataSource(fs1); for (int i = 0; i < files.length; i++) { fs1.addBean(files[i]); @@ -297,7 +297,7 @@ public class DDTest6 extends TestBase { static class FolderView extends DragAndDropWrapper implements DropHandler { - static final HashMap<Folder, FolderView> views = new HashMap<Folder, FolderView>(); + static final HashMap<Folder, FolderView> views = new HashMap<>(); public static FolderView get(Folder f) { @@ -342,7 +342,7 @@ public class DDTest6 extends TestBase { // make modifiable children = new HashSet<Object>(children); } - Set<Component> removed = new HashSet<Component>(); + Set<Component> removed = new HashSet<>(); for (Iterator<Component> componentIterator = l .getComponentIterator(); componentIterator.hasNext();) { FileIcon next = (FileIcon) componentIterator.next(); diff --git a/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java b/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java index 0c0a631c46..100ebc3dc1 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java @@ -77,7 +77,7 @@ public class DDTest7 extends TestBase { .getItem(draggedItemId).getItemProperty("Weight") .getValue(); - HashSet<Object> accepted = new HashSet<Object>(); + HashSet<Object> accepted = new HashSet<>(); for (Object itemId : visibleItemIds) { Item item = table.getItem(itemId); Integer w = (Integer) item.getItemProperty("Weight") diff --git a/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java b/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java index 1d88541841..eec30f5b40 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java @@ -99,7 +99,7 @@ public class TreeDragStart extends TestBase { if (sourceItemId instanceof BeanItem<?>) { beanItem = (BeanItem<?>) sourceItemId; } else if (sourceItemId instanceof InventoryObject) { - beanItem = new BeanItem<InventoryObject>( + beanItem = new BeanItem<>( (InventoryObject) sourceItemId); } @@ -137,9 +137,9 @@ public class TreeDragStart extends TestBase { table.setDragMode(TableDragMode.ROW); // Initialize the table container - ArrayList<InventoryObject> collection = new ArrayList<InventoryObject>(); + ArrayList<InventoryObject> collection = new ArrayList<>(); collection.add(new InventoryObject("Dummy Item", 0.0, false)); - final BeanItemContainer<InventoryObject> tableContainer = new BeanItemContainer<InventoryObject>( + final BeanItemContainer<InventoryObject> tableContainer = new BeanItemContainer<>( collection); table.setContainerDataSource(tableContainer); table.setVisibleColumns(new String[] { "name", "weight" }); @@ -242,7 +242,7 @@ public class TreeDragStart extends TestBase { } } - HashMap<String, InventoryObject> inventoryStore = new HashMap<String, InventoryObject>(); + HashMap<String, InventoryObject> inventoryStore = new HashMap<>(); public HierarchicalContainer createTreeContent() { final Object[] inventory = new Object[] { @@ -281,14 +281,14 @@ public class TreeDragStart extends TestBase { BeanItem<InventoryObject> item; if (data[i].getClass() == InventoryObject.class) { InventoryObject object = (InventoryObject) data[i]; - item = new BeanItem<InventoryObject>(object); + item = new BeanItem<>(object); container.addItem(item); container.setParent(item, parent); container.setChildrenAllowed(item, false); } else {// It's an Object[] Object[] sub = (Object[]) data[i]; InventoryObject object = (InventoryObject) sub[0]; - item = new BeanItem<InventoryObject>(object); + item = new BeanItem<>(object); container.addItem(item); container.setParent(item, parent); diff --git a/uitest/src/main/java/com/vaadin/tests/declarative/PotusCrud.java b/uitest/src/main/java/com/vaadin/tests/declarative/PotusCrud.java index 670da355ef..ede0a23c7f 100644 --- a/uitest/src/main/java/com/vaadin/tests/declarative/PotusCrud.java +++ b/uitest/src/main/java/com/vaadin/tests/declarative/PotusCrud.java @@ -36,7 +36,7 @@ public class PotusCrud extends VerticalLayout { private FieldGroup fg; - private BeanItemContainer<Potus> potusContainer = new BeanItemContainer<Potus>( + private BeanItemContainer<Potus> potusContainer = new BeanItemContainer<>( Potus.class); public PotusCrud() { diff --git a/uitest/src/main/java/com/vaadin/tests/extensions/BrowserPopupExtensionTest.java b/uitest/src/main/java/com/vaadin/tests/extensions/BrowserPopupExtensionTest.java index ff3ab1767b..39994eb970 100644 --- a/uitest/src/main/java/com/vaadin/tests/extensions/BrowserPopupExtensionTest.java +++ b/uitest/src/main/java/com/vaadin/tests/extensions/BrowserPopupExtensionTest.java @@ -48,7 +48,7 @@ public class BrowserPopupExtensionTest extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - List<Class<? extends Component>> components = new ArrayList<Class<? extends Component>>(); + List<Class<? extends Component>> components = new ArrayList<>(); components.add(Button.class); components.add(NativeButton.class); components.add(Link.class); diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java index 5c580b5f3d..1c1e2efcef 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java @@ -85,7 +85,7 @@ public class BasicPersonForm extends AbstractTestUIWithLog { Panel confPanel = new ConfigurationPanel(); addComponent(confPanel); - final FieldGroup fieldGroup = new BeanFieldGroup<Person>(Person.class); + final FieldGroup fieldGroup = new BeanFieldGroup<>(Person.class); fieldGroup.addCommitHandler(new CommitHandler() { @Override @@ -181,7 +181,7 @@ public class BasicPersonForm extends AbstractTestUIWithLog { }); Person p = new Person("John", "Doe", "john@doe.com", 64, Sex.MALE, new Address("John street", 11223, "John's town", Country.USA)); - fieldGroup.setItemDataSource(new BeanItem<Person>(p)); + fieldGroup.setItemDataSource(new BeanItem<>(p)); } @SuppressWarnings("unchecked") diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/ComplexPerson.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/ComplexPerson.java index 90ac03a67a..c2aeb51bab 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/ComplexPerson.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/ComplexPerson.java @@ -78,7 +78,7 @@ public class ComplexPerson { } public static BeanItemContainer<ComplexPerson> createContainer(int size) { - BeanItemContainer<ComplexPerson> bic = new BeanItemContainer<ComplexPerson>( + BeanItemContainer<ComplexPerson> bic = new BeanItemContainer<>( ComplexPerson.class); Random r = new Random(size); diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java index a45e346947..39a8d89153 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/DateForm.java @@ -79,7 +79,7 @@ public class DateForm extends AbstractTestUIWithLog { protected void setup(VaadinRequest request) { setLocale(Locale.US); addComponent(log); - final FieldGroup fieldGroup = new BeanFieldGroup<DateObject>( + final FieldGroup fieldGroup = new BeanFieldGroup<>( DateObject.class); fieldGroup.setBuffered(true); @@ -130,7 +130,7 @@ public class DateForm extends AbstractTestUIWithLog { DateObject d = new DateObject(new Date(443457289789L), new Date(443457289789L), new Date(443457289789L), new Date(443457289789L)); - fieldGroup.setItemDataSource(new BeanItem<DateObject>(d)); + fieldGroup.setItemDataSource(new BeanItem<>(d)); } @SuppressWarnings("unchecked") diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java index 15c205bbda..a4f236bd25 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java @@ -31,7 +31,7 @@ public class FieldBinderWithBeanValidation extends TestBase { protected void setup() { addComponent(log); - final BeanFieldGroup<PersonWithBeanValidationAnnotations> fieldGroup = new BeanFieldGroup<PersonWithBeanValidationAnnotations>( + final BeanFieldGroup<PersonWithBeanValidationAnnotations> fieldGroup = new BeanFieldGroup<>( PersonWithBeanValidationAnnotations.class); fieldGroup.buildAndBindMemberFields(this); @@ -85,7 +85,7 @@ public class FieldBinderWithBeanValidation extends TestBase { "John", "Doe", "john@doe.com", 64, Sex.MALE, new Address("John street", 11223, "John's town", Country.USA)); fieldGroup.setItemDataSource( - new BeanItem<PersonWithBeanValidationAnnotations>(p)); + new BeanItem<>(p)); } public static PersonWithBeanValidationAnnotations getPerson( diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormBuilderWithNestedProperties.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormBuilderWithNestedProperties.java index 2e3a855202..dd8b78510c 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormBuilderWithNestedProperties.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormBuilderWithNestedProperties.java @@ -20,14 +20,14 @@ public class FormBuilderWithNestedProperties extends TestBase { @Override protected void setup() { - FieldGroup fieldGroup = new BeanFieldGroup<Person>(Person.class); + FieldGroup fieldGroup = new BeanFieldGroup<>(Person.class); fieldGroup.buildAndBindMemberFields(this); addComponent(firstName); addComponent(lastName); addComponent(streetAddress); - fieldGroup.setItemDataSource(new BeanItem<Person>(new Person("Who", + fieldGroup.setItemDataSource(new BeanItem<>(new Person("Who", "me?", "email", 1, Sex.MALE, new Address("street name", 202020, "City", Country.FINLAND)))); } diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java index d8637fe27f..fb57932caa 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java @@ -30,7 +30,7 @@ public class FormWithNestedProperties extends AbstractBeanFieldGroupTest { protected void setup() { super.setup(); - setFieldBinder(new BeanFieldGroup<Person>(Person.class)); + setFieldBinder(new BeanFieldGroup<>(Person.class)); country = (NativeSelect) getFieldBinder().buildAndBind("country", "address.country", NativeSelect.class); getFieldBinder().bindMemberFields(this); diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java index 44b2c72cc2..ec715a30bb 100644 --- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java +++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java @@ -22,7 +22,7 @@ public class MultipleValidationErrors extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - BeanItem<PersonBeanWithValidationAnnotations> item = new BeanItem<PersonBeanWithValidationAnnotations>( + BeanItem<PersonBeanWithValidationAnnotations> item = new BeanItem<>( new PersonBeanWithValidationAnnotations()); final FieldGroup fieldGroup = new FieldGroup(item); diff --git a/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java b/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java index 76df6a99ba..0ec27edf5a 100644 --- a/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java +++ b/uitest/src/main/java/com/vaadin/tests/fields/TabIndexes.java @@ -88,7 +88,7 @@ public class TabIndexes extends AbstractTestUIWithLog { updateCaptions(); } }); - fields = new ArrayList<Focusable>(); + fields = new ArrayList<>(); Table t = new Table(); t.setSelectable(true); t.addContainerProperty("foo", String.class, "bar"); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java index 20782e8d7e..c0ffcca0df 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java @@ -38,7 +38,7 @@ public class CaptionsInLayouts extends AbstractTestUI { private HorizontalLayout horizontalLayout; private GridLayout gridLayout; private FormLayout formLayout; - private List<AbstractField<?>> components = new ArrayList<AbstractField<?>>(); + private List<AbstractField<?>> components = new ArrayList<>(); private CssLayout cssLayout; private HorizontalLayout layoutParent = new HorizontalLayout(); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java b/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java index 63b5aaba5f..60519cf1c0 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java @@ -15,7 +15,7 @@ import com.vaadin.ui.NativeButton; public class CssLayoutCustomCss extends TestBase implements ClickListener { - protected Map<Component, String> css = new HashMap<Component, String>(); + protected Map<Component, String> css = new HashMap<>(); private CssLayout layout; @Override diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java b/uitest/src/main/java/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java index 87bed151d4..fb182cc89a 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/MovingComponentsWhileOldParentInvisible.java @@ -103,7 +103,7 @@ public class MovingComponentsWhileOldParentInvisible extends TestBase { } private Collection<Class<? extends HasComponents>> getComponentContainers() { - List<Class<? extends HasComponents>> list = new ArrayList<Class<? extends HasComponents>>(); + List<Class<? extends HasComponents>> list = new ArrayList<>(); list.add(AbsoluteLayout.class); list.add(Accordion.class); list.add(CssLayout.class); diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java b/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java index 0c0670c54d..4d1f0213c4 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/OrderedLayoutBasics.java @@ -26,7 +26,7 @@ public class OrderedLayoutBasics extends TestBase { String valignName[] = new String[] { "top", "middle", "bottom" }; - Set<AbstractOrderedLayout> layouts = new HashSet<AbstractOrderedLayout>(); + Set<AbstractOrderedLayout> layouts = new HashSet<>(); private AbstractOrderedLayout layoutContainer; private int suffix = 0; diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java index e9214d2356..925edc1aaf 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java @@ -21,7 +21,7 @@ import java.util.concurrent.CopyOnWriteArrayList; public class Broadcaster { - private static final List<BroadcastListener> listeners = new CopyOnWriteArrayList<BroadcastListener>(); + private static final List<BroadcastListener> listeners = new CopyOnWriteArrayList<>(); public static void register(BroadcastListener listener) { listeners.add(listener); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/GridExampleHelper.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/GridExampleHelper.java index 1d7943d1d1..f81f5a8ba3 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/GridExampleHelper.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/GridExampleHelper.java @@ -19,7 +19,7 @@ import com.vaadin.v7.data.util.BeanItemContainer; public class GridExampleHelper { public static BeanItemContainer<GridExampleBean> createContainer() { - BeanItemContainer<GridExampleBean> container = new BeanItemContainer<GridExampleBean>( + BeanItemContainer<GridExampleBean> container = new BeanItemContainer<>( GridExampleBean.class); for (int i = 0; i < 1000; i++) { container.addItem(new GridExampleBean("Bean " + i, i * i, i / 10d)); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java index 07ffab84a0..00da200d39 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java @@ -39,12 +39,12 @@ public class AutoGeneratingForm extends UI { layout.setMargin(true); setContent(layout); - FieldGroup fieldGroup = new BeanFieldGroup<Person>(Person.class); + FieldGroup fieldGroup = new BeanFieldGroup<>(Person.class); // We need an item data source before we create the fields to be able to // find the properties, otherwise we have to specify them by hand fieldGroup.setItemDataSource( - new BeanItem<Person>(new Person("John", "Doe", 34))); + new BeanItem<>(new Person("John", "Doe", 34))); // Loop through the properties, build fields for them and add the fields // to this root diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/FormUsingExistingLayout.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/FormUsingExistingLayout.java index bf2aecc102..7de1b8515d 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/FormUsingExistingLayout.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/FormUsingExistingLayout.java @@ -79,7 +79,7 @@ public class FormUsingExistingLayout extends AbstractTestUI { // Create a field group and use it to bind the fields in the layout FieldGroup fieldGroup = new FieldGroup( - new BeanItem<Notice>(new Notice("John", "Doe", ""))); + new BeanItem<>(new Notice("John", "Doe", ""))); fieldGroup.bindMemberFields(myFormLayout); addComponent(myFormLayout); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java index cbda57bbc0..2717034a43 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/IntegerTextFieldDataSource.java @@ -28,7 +28,7 @@ public class IntegerTextFieldDataSource extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { final MyBean myBean = new MyBean(); - BeanItem<MyBean> beanItem = new BeanItem<MyBean>(myBean); + BeanItem<MyBean> beanItem = new BeanItem<>(myBean); final Property<Integer> integerProperty = beanItem .getItemProperty("value"); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/UsingBeanValidation.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/UsingBeanValidation.java index 06932cbb9c..7affc2d2f2 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/UsingBeanValidation.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a1/UsingBeanValidation.java @@ -72,7 +72,7 @@ public class UsingBeanValidation extends UI { @Override protected void init(VaadinRequest request) { Person person = new Person("John", 26); - BeanItem<Person> item = new BeanItem<Person>(person); + BeanItem<Person> item = new BeanItem<>(person); TextField firstName = new TextField("First name", item.getItemProperty("name")); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/WidgetContainer.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/WidgetContainer.java index 8d1f4a1f9f..af5aefbe22 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/WidgetContainer.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/WidgetContainer.java @@ -9,7 +9,7 @@ import com.vaadin.ui.Component; public class WidgetContainer extends AbstractComponentContainer { - List<Component> children = new ArrayList<Component>(); + List<Component> children = new ArrayList<>(); @Override public void addComponent(Component c) { diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/ComplexTypesComponent.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/ComplexTypesComponent.java index 5b0e42740f..64008cf093 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/ComplexTypesComponent.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/ComplexTypesComponent.java @@ -30,20 +30,20 @@ import com.vaadin.ui.UI; @JavaScript("complex_types_connector.js") public class ComplexTypesComponent extends AbstractJavaScriptComponent { public void sendComplexTypes() { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); list.add("First string"); list.add(null); list.add("Another string"); - Map<String, Integer> stringMap = new HashMap<String, Integer>(); + Map<String, Integer> stringMap = new HashMap<>(); stringMap.put("one", 1); stringMap.put("two", 2); - Map<Integer, String> otherMap = new HashMap<Integer, String>(); + Map<Integer, String> otherMap = new HashMap<>(); otherMap.put(3, "3"); otherMap.put(4, "4"); - Map<Connector, String> connectorMap = new HashMap<Connector, String>(); + Map<Connector, String> connectorMap = new HashMap<>(); connectorMap.put(this, "this"); connectorMap.put(UI.getCurrent(), "root"); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/Flot.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/Flot.java index 5b24247807..bb7e14c3dc 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/Flot.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/Flot.java @@ -51,7 +51,7 @@ public class Flot extends AbstractJavaScriptComponent { } public void addSeries(double... points) { - List<List<Double>> pointList = new ArrayList<List<Double>>(); + List<List<Double>> pointList = new ArrayList<>(); for (int i = 0; i < points.length; i++) { pointList.add(Arrays.asList(Double.valueOf(i), Double.valueOf(points[i]))); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/FlotState.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/FlotState.java index 54cb65db05..b1c16e040b 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/FlotState.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a3/FlotState.java @@ -6,5 +6,5 @@ import java.util.List; import com.vaadin.shared.ui.JavaScriptComponentState; public class FlotState extends JavaScriptComponentState { - public List<List<List<Double>>> series = new ArrayList<List<List<Double>>>(); + public List<List<List<Double>>> series = new ArrayList<>(); } diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/SettingsView.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/SettingsView.java index 2c19ac03d7..b4091e8930 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/SettingsView.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/SettingsView.java @@ -39,7 +39,7 @@ public class SettingsView extends Panel implements View { date.setImmediate(true); layout.addComponent(date); // pretend we have a datasource: - date.setPropertyDataSource(new ObjectProperty<Date>(new Date())); + date.setPropertyDataSource(new ObjectProperty<>(new Date())); date.setBuffered(true); // show buttons when date is changed date.addValueChangeListener(new ValueChangeListener() { diff --git a/uitest/src/main/java/com/vaadin/tests/push/PushConfigurator.java b/uitest/src/main/java/com/vaadin/tests/push/PushConfigurator.java index 73fec4026c..ea95e50e41 100644 --- a/uitest/src/main/java/com/vaadin/tests/push/PushConfigurator.java +++ b/uitest/src/main/java/com/vaadin/tests/push/PushConfigurator.java @@ -69,7 +69,7 @@ public class PushConfigurator extends VerticalLayout { private void refreshStatus() { PushConfiguration pc = ui.getPushConfiguration(); String value = ""; - ArrayList<String> names = new ArrayList<String>(); + ArrayList<String> names = new ArrayList<>(); names.addAll(pc.getParameterNames()); Collections.sort(names); for (String param : names) { diff --git a/uitest/src/main/java/com/vaadin/tests/push/PushErrorHandling.java b/uitest/src/main/java/com/vaadin/tests/push/PushErrorHandling.java index 5abeedcea6..f5549e0eb6 100644 --- a/uitest/src/main/java/com/vaadin/tests/push/PushErrorHandling.java +++ b/uitest/src/main/java/com/vaadin/tests/push/PushErrorHandling.java @@ -60,7 +60,7 @@ public class PushErrorHandling extends AbstractTestUI { AbstractInMemoryContainer.class) { @Override public Collection<String> getContainerPropertyIds() { - List<String> cpropIds = new ArrayList<String>( + List<String> cpropIds = new ArrayList<>( super.getContainerPropertyIds()); cpropIds.add("testid"); return cpropIds; diff --git a/uitest/src/main/java/com/vaadin/tests/rpclogger/RPCLoggerUI.java b/uitest/src/main/java/com/vaadin/tests/rpclogger/RPCLoggerUI.java index ff2f39959b..eb43486eb6 100644 --- a/uitest/src/main/java/com/vaadin/tests/rpclogger/RPCLoggerUI.java +++ b/uitest/src/main/java/com/vaadin/tests/rpclogger/RPCLoggerUI.java @@ -36,7 +36,7 @@ import com.vaadin.v7.ui.ListSelect; public class RPCLoggerUI extends AbstractTestUIWithLog implements ErrorHandler { - private List<Action> lastActions = new ArrayList<Action>(); + private List<Action> lastActions = new ArrayList<>(); public static class Action { public Action(ClientConnector connector, MethodInvocation invocation) { diff --git a/uitest/src/main/java/com/vaadin/tests/serialization/SerializerTest.java b/uitest/src/main/java/com/vaadin/tests/serialization/SerializerTest.java index e07abaa9f6..4537cf5212 100644 --- a/uitest/src/main/java/com/vaadin/tests/serialization/SerializerTest.java +++ b/uitest/src/main/java/com/vaadin/tests/serialization/SerializerTest.java @@ -176,14 +176,14 @@ public class SerializerTest extends AbstractTestUI { // rpc.sendListArray( // new List[] { Arrays.asList(1, 2), Arrays.asList(3, 4) }, // new List[] { Collections.singletonList(new SimpleTestBean(-1)) }); - rpc.sendSet(new HashSet<Integer>(Arrays.asList(4, 7, 12)), + rpc.sendSet(new HashSet<>(Arrays.asList(4, 7, 12)), Collections.singleton((Connector) this), - new HashSet<SimpleTestBean>(Arrays.asList(new SimpleTestBean(1), + new HashSet<>(Arrays.asList(new SimpleTestBean(1), new SimpleTestBean(2)))); - state.intSet = new HashSet<Integer>(Arrays.asList(4, 7, 12)); + state.intSet = new HashSet<>(Arrays.asList(4, 7, 12)); state.connectorSet = Collections.singleton((Connector) this); - state.beanSet = new HashSet<SimpleTestBean>( + state.beanSet = new HashSet<>( Arrays.asList(new SimpleTestBean(1), new SimpleTestBean(2))); rpc.sendMap(new HashMap<String, SimpleTestBean>() { @@ -401,12 +401,12 @@ public class SerializerTest extends AbstractTestUI { @Override public void sendSet(Set<Integer> intSet, Set<Connector> connectorSet, Set<SimpleTestBean> beanSet) { - List<Integer> intList = new ArrayList<Integer>(intSet); + List<Integer> intList = new ArrayList<>(intSet); Collections.sort(intList); - List<Connector> connectorList = new ArrayList<Connector>( + List<Connector> connectorList = new ArrayList<>( connectorSet); Collections.sort(connectorList, new ConnectorComparator()); - List<SimpleTestBean> beanList = new ArrayList<SimpleTestBean>( + List<SimpleTestBean> beanList = new ArrayList<>( beanSet); Collections.sort(beanList, new SimpleBeanComparator()); log.log("sendSet: " + intList + ", " diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CollapsibleTableColumn.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CollapsibleTableColumn.java index 2981001530..c80d2818a9 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CollapsibleTableColumn.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CollapsibleTableColumn.java @@ -32,7 +32,7 @@ public class CollapsibleTableColumn extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { Table table = new Table(); - BeanItemContainer<Bean> container = new BeanItemContainer<Bean>( + BeanItemContainer<Bean> container = new BeanItemContainer<>( Bean.class); Bean bean = new Bean(); bean.setName("name"); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java index cae1dbc29b..784c82304c 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/DateFields.java @@ -202,7 +202,7 @@ public class DateFields extends VerticalLayout implements View { PropertysetItem item = new PropertysetItem(); item.addItemProperty("date", - new ObjectProperty<Date>(getDefaultDate())); + new ObjectProperty<>(getDefaultDate())); FormLayout form = new FormLayout(); form.setMargin(false); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/Dragging.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/Dragging.java index 683e1a8cc0..df34961973 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/Dragging.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/Dragging.java @@ -129,7 +129,7 @@ public class Dragging extends VerticalLayout implements View { } private List<Component> createComponents() { - final List<Component> components = new ArrayList<Component>(); + final List<Component> components = new ArrayList<>(); final Label label = new Label( "This is a long text block that will wrap."); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/TestIcon.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/TestIcon.java index db58dd1feb..ba71072c43 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/TestIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/TestIcon.java @@ -54,7 +54,7 @@ public class TestIcon { "../runo/icons/" + imageSize + "/document.png"); } - static List<FontAwesome> ICONS = new ArrayList<FontAwesome>(); + static List<FontAwesome> ICONS = new ArrayList<>(); static { ICONS.add(FontAwesome.ADJUST); ICONS.add(FontAwesome.ADN); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java index db4e36e49a..1a84fd8718 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java @@ -65,7 +65,7 @@ public class ValoThemeUI extends UI { private boolean testMode = false; - private static LinkedHashMap<String, String> themeVariants = new LinkedHashMap<String, String>(); + private static LinkedHashMap<String, String> themeVariants = new LinkedHashMap<>(); static { themeVariants.put("tests-valo", "Default"); themeVariants.put("tests-valo-dark", "Dark"); @@ -80,7 +80,7 @@ public class ValoThemeUI extends UI { menu.setId("testMenu"); } private Navigator navigator; - private LinkedHashMap<String, String> menuItems = new LinkedHashMap<String, String>(); + private LinkedHashMap<String, String> menuItems = new LinkedHashMap<>(); @Override protected void init(VaadinRequest request) { diff --git a/uitest/src/main/java/com/vaadin/tests/util/LargeContainer.java b/uitest/src/main/java/com/vaadin/tests/util/LargeContainer.java index 7707fe0b77..75734e5391 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/LargeContainer.java +++ b/uitest/src/main/java/com/vaadin/tests/util/LargeContainer.java @@ -25,7 +25,7 @@ public class LargeContainer extends AbstractContainer @Override public Property<?> getItemProperty(Object propertyId) { - ObjectProperty<String> property = new ObjectProperty<String>( + ObjectProperty<String> property = new ObjectProperty<>( containerPropertyIdDefaults.get(propertyId) + " (item " + itemId + ")"); return property; @@ -55,8 +55,8 @@ public class LargeContainer extends AbstractContainer private int size = 1000; - private Map<Object, Class<?>> containerPropertyIdTypes = new HashMap<Object, Class<?>>(); - private Map<Object, Object> containerPropertyIdDefaults = new HashMap<Object, Object>(); + private Map<Object, Class<?>> containerPropertyIdTypes = new HashMap<>(); + private Map<Object, Object> containerPropertyIdDefaults = new HashMap<>(); @Override public Object nextItemId(Object itemId) { diff --git a/uitest/src/main/java/com/vaadin/tests/util/Log.java b/uitest/src/main/java/com/vaadin/tests/util/Log.java index 54e266fa40..5c1391e932 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/Log.java +++ b/uitest/src/main/java/com/vaadin/tests/util/Log.java @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; public class Log extends VerticalLayout { - List<Label> eventLabels = new ArrayList<Label>(); + List<Label> eventLabels = new ArrayList<>(); private boolean numberLogRows = true; private int nextLogNr = 1; diff --git a/uitest/src/main/java/com/vaadin/tests/util/Millionaire.java b/uitest/src/main/java/com/vaadin/tests/util/Millionaire.java index 44d4def416..ba860eb843 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/Millionaire.java +++ b/uitest/src/main/java/com/vaadin/tests/util/Millionaire.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; public class Millionaire extends Person { - private List<Address> secondaryResidences = new ArrayList<Address>(); + private List<Address> secondaryResidences = new ArrayList<>(); public Millionaire() { } diff --git a/uitest/src/main/java/com/vaadin/tests/util/Role.java b/uitest/src/main/java/com/vaadin/tests/util/Role.java index 5f7d7680fd..115250240e 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/Role.java +++ b/uitest/src/main/java/com/vaadin/tests/util/Role.java @@ -6,7 +6,7 @@ import java.util.Set; public class Role implements Serializable { private String name = ""; - private Set<User> users = new HashSet<User>(); + private Set<User> users = new HashSet<>(); public Role() { } diff --git a/uitest/src/main/java/com/vaadin/tests/util/TestClickListener.java b/uitest/src/main/java/com/vaadin/tests/util/TestClickListener.java index b9f6d66b3e..750e0a4223 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/TestClickListener.java +++ b/uitest/src/main/java/com/vaadin/tests/util/TestClickListener.java @@ -7,7 +7,7 @@ import com.vaadin.ui.Button.ClickEvent; public class TestClickListener implements Button.ClickListener { - private static final HashMap<String, Integer> buttonListeners = new HashMap<String, Integer>(); + private static final HashMap<String, Integer> buttonListeners = new HashMap<>(); String name = ""; int count = 0; diff --git a/uitest/src/main/java/com/vaadin/tests/util/User.java b/uitest/src/main/java/com/vaadin/tests/util/User.java index c5de9a3e46..1042eb630a 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/User.java +++ b/uitest/src/main/java/com/vaadin/tests/util/User.java @@ -7,7 +7,7 @@ import java.util.Set; public class User implements Serializable { private String name = ""; - private Set<Role> roles = new HashSet<Role>(); + private Set<Role> roles = new HashSet<>(); public User() { } diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java index 5f8472391c..59342e34e8 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java @@ -29,7 +29,7 @@ public class RoundTripTesterConnector extends AbstractComponentConnector { private double lastPrintedTime = -1; private int receivedPings = 0; - private List<Double> throughputData = new ArrayList<Double>(); + private List<Double> throughputData = new ArrayList<>(); private int payloadSize = 0; @Override diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java index 745af93b11..838ec9b238 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java @@ -52,18 +52,18 @@ public class SerializerTestConnector extends AbstractExtensionConnector { @Override public void sendWrappedGenerics( Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> generics) { - Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> updated = new HashMap<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>>(); + Map<Set<SimpleTestBean>, Map<Integer, List<SimpleTestBean>>> updated = new HashMap<>(); SimpleTestBean firstValue = generics.values().iterator().next() .get(Integer.valueOf(1)).get(0); - Set<SimpleTestBean> key = new HashSet<SimpleTestBean>( + Set<SimpleTestBean> key = new HashSet<>( Arrays.asList(firstValue)); - Map<Integer, List<SimpleTestBean>> value = new HashMap<Integer, List<SimpleTestBean>>(); + Map<Integer, List<SimpleTestBean>> value = new HashMap<>(); Set<SimpleTestBean> firstKeyValue = generics.keySet().iterator() .next(); value.put(Integer.valueOf(1), - new ArrayList<SimpleTestBean>(firstKeyValue)); + new ArrayList<>(firstKeyValue)); updated.put(key, value); @@ -83,7 +83,7 @@ public class SerializerTestConnector extends AbstractExtensionConnector { Set<Connector> connectorSet, Set<SimpleTestBean> beanSet) { beanSet.iterator().next().setValue(intSet.size()); - Set<Integer> updatedIntSet = new HashSet<Integer>(); + Set<Integer> updatedIntSet = new HashSet<>(); for (Integer integer : intSet) { updatedIntSet.add(Integer.valueOf(-integer.intValue())); @@ -107,7 +107,7 @@ public class SerializerTestConnector extends AbstractExtensionConnector { Map<Connector, SimpleTestBean> connectorMap, Map<Integer, Connector> intMap, Map<SimpleTestBean, SimpleTestBean> beanMap) { - Map<SimpleTestBean, SimpleTestBean> updatedBeanMap = new HashMap<SimpleTestBean, SimpleTestBean>(); + Map<SimpleTestBean, SimpleTestBean> updatedBeanMap = new HashMap<>(); for (Entry<SimpleTestBean, SimpleTestBean> entry : beanMap .entrySet()) { updatedBeanMap.put(entry.getValue(), entry.getKey()); @@ -208,7 +208,7 @@ public class SerializerTestConnector extends AbstractExtensionConnector { Arrays.asList(simpleBean, updatedSimpleBean)); updatedComplexBean.setPrivimite(complexBean.getPrivimite() + 1); - ArrayList<SimpleTestBean> arrayList = new ArrayList<SimpleTestBean>( + ArrayList<SimpleTestBean> arrayList = new ArrayList<>( Arrays.asList(array)); Collections.reverse(arrayList); @@ -221,7 +221,7 @@ public class SerializerTestConnector extends AbstractExtensionConnector { List<Integer[]> objectArrayList, List<SimpleTestBean[]> beanArrayList) { Collections.reverse(beanArrayList); - List<Integer[]> updatedObjectArrayList = new ArrayList<Integer[]>(); + List<Integer[]> updatedObjectArrayList = new ArrayList<>(); for (int[] array : primitiveArrayList) { updatedObjectArrayList .add(new Integer[] { Integer.valueOf(array.length), diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/TestWidgetConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/TestWidgetConnector.java index ac9ed4f7b5..7b10fba579 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/TestWidgetConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/TestWidgetConnector.java @@ -66,7 +66,7 @@ public class TestWidgetConnector extends AbstractComponentConnector { .create(TestWidgetRegistry.class); public static abstract class TestWidgetRegistry { - private Map<String, Invoker> creators = new HashMap<String, Invoker>(); + private Map<String, Invoker> creators = new HashMap<>(); // Called by generated sub class protected void register(String widgetClass, Invoker creator) { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/EscalatorBasicClientFeaturesWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/EscalatorBasicClientFeaturesWidget.java index a4a5ed0ee1..99a9ae2c8f 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/EscalatorBasicClientFeaturesWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/EscalatorBasicClientFeaturesWidget.java @@ -27,7 +27,7 @@ public class EscalatorBasicClientFeaturesWidget private static final int MAX_LOG = 9; private final HTML html = new HTML(); - private final List<String> logs = new ArrayList<String>(); + private final List<String> logs = new ArrayList<>(); private Escalator escalator; public LogWidget() { @@ -153,12 +153,12 @@ public class EscalatorBasicClientFeaturesWidget private class Data { private int columnCounter = 0; private int rowCounter = 0; - private final List<Integer> columns = new ArrayList<Integer>(); - private final List<Integer> rows = new ArrayList<Integer>(); + private final List<Integer> columns = new ArrayList<>(); + private final List<Integer> rows = new ArrayList<>(); @SuppressWarnings("boxing") public void insertRows(final int offset, final int amount) { - final List<Integer> newRows = new ArrayList<Integer>(); + final List<Integer> newRows = new ArrayList<>(); for (int i = 0; i < amount; i++) { newRows.add(rowCounter++); } @@ -167,7 +167,7 @@ public class EscalatorBasicClientFeaturesWidget @SuppressWarnings("boxing") public void insertColumns(final int offset, final int amount) { - final List<Integer> newColumns = new ArrayList<Integer>(); + final List<Integer> newColumns = new ArrayList<>(); for (int i = 0; i < amount; i++) { newColumns.add(columnCounter++); } diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridBasicClientFeaturesWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridBasicClientFeaturesWidget.java index 96e988b8ea..9014ed68b3 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridBasicClientFeaturesWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridBasicClientFeaturesWidget.java @@ -112,7 +112,7 @@ public class GridBasicClientFeaturesWidget private class TestEditorHandler implements EditorHandler<List<Data>> { - private Map<Grid.Column<?, ?>, TextBox> widgets = new HashMap<Grid.Column<?, ?>, TextBox>(); + private Map<Grid.Column<?, ?>, TextBox> widgets = new HashMap<>(); private Label log = new Label(); @@ -220,7 +220,7 @@ public class GridBasicClientFeaturesWidget * @return */ private List<List<Data>> createData(int rowCount) { - List<List<Data>> dataList = new ArrayList<List<Data>>(); + List<List<Data>> dataList = new ArrayList<>(); Random rand = new Random(); rand.setSeed(13334); long timestamp = 0; @@ -266,7 +266,7 @@ public class GridBasicClientFeaturesWidget * @return */ private List<Data> createDataRow(int cols) { - List<Data> list = new ArrayList<Data>(cols); + List<Data> list = new ArrayList<>(cols); for (int i = 0; i < cols; ++i) { list.add(new Data()); } @@ -280,7 +280,7 @@ public class GridBasicClientFeaturesWidget // Initialize data source data = createData(ROWS); - ds = new ListDataSource<List<Data>>(data); + ds = new ListDataSource<>(data); grid = getTestedWidget(); grid.getElement().setId("testComponent"); grid.setDataSource(ds); @@ -288,7 +288,7 @@ public class GridBasicClientFeaturesWidget grid.setSelectionMode(SelectionMode.NONE); grid.setEditorHandler(new TestEditorHandler()); - sorter = new ListSorter<List<Data>>(grid); + sorter = new ListSorter<>(grid); // Create a bunch of grid columns @@ -774,7 +774,7 @@ public class GridBasicClientFeaturesWidget @Override public void execute() { - List<Column> columns = new ArrayList<Column>(grid.getColumns()); + List<Column> columns = new ArrayList<>(grid.getColumns()); Collections.reverse(columns); grid.setColumnOrder( columns.toArray(new Column[columns.size()])); @@ -980,7 +980,7 @@ public class GridBasicClientFeaturesWidget @Override public void execute() { List<Column<?, List<Data>>> cols = grid.getColumns(); - ArrayList<Column> reordered = new ArrayList<Column>(cols); + ArrayList<Column> reordered = new ArrayList<>(cols); final int index = cols.indexOf(column); if (index == 0) { Column<?, List<Data>> col = reordered.remove(0); @@ -1332,7 +1332,7 @@ public class GridBasicClientFeaturesWidget * Creates a collection of handlers for all the grid key events */ private void createKeyHandlers() { - final List<VLabel> labels = new ArrayList<VLabel>(); + final List<VLabel> labels = new ArrayList<>(); for (int i = 0; i < 9; ++i) { VLabel tmp = new VLabel(); addNorth(tmp, 20); @@ -1534,8 +1534,8 @@ public class GridBasicClientFeaturesWidget private void createSidebarMenu() { String[] menupath = new String[] { "Component", "Sidebar" }; - final List<MenuItem> customMenuItems = new ArrayList<MenuItem>(); - final List<MenuItemSeparator> separators = new ArrayList<MenuItemSeparator>(); + final List<MenuItem> customMenuItems = new ArrayList<>(); + final List<MenuItemSeparator> separators = new ArrayList<>(); addMenuCommand("Add item to end", new ScheduledCommand() { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java index ba598b6897..0fe861f723 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridCellFocusOnResetSizeWidget.java @@ -34,7 +34,7 @@ public class GridCellFocusOnResetSizeWidget private Grid<String[]> grid; private final class MyDataSource implements DataSource<String[]> { - List<String[]> rows = new ArrayList<String[]>(); + List<String[]> rows = new ArrayList<>(); int ROWS_MAX = 10; int size = ROWS_MAX; DataChangeHandler handler = null; diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java index b7d6e03596..904ecbf1d5 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientColumnRendererConnector.java @@ -125,7 +125,7 @@ public class GridClientColumnRendererConnector grid.setSelectionMode(Grid.SelectionMode.NONE); // Generated some column data - List<String> columnData = new ArrayList<String>(); + List<String> columnData = new ArrayList<>(); for (int i = 0; i < 100; i++) { columnData.add(String.valueOf(i)); } @@ -133,10 +133,10 @@ public class GridClientColumnRendererConnector // Provide data as data source if (Location.getParameter("latency") != null) { grid.setDataSource(new DelayedDataSource( - new ListDataSource<String>(columnData), + new ListDataSource<>(columnData), Integer.parseInt(Location.getParameter("latency")))); } else { - grid.setDataSource(new ListDataSource<String>(columnData)); + grid.setDataSource(new ListDataSource<>(columnData)); } // Add a column to display the data in @@ -211,7 +211,7 @@ public class GridClientColumnRendererConnector @SuppressWarnings("unchecked") public void triggerClientSortingTest() { Grid<String> grid = getWidget(); - ListSorter<String> sorter = new ListSorter<String>( + ListSorter<String> sorter = new ListSorter<>( grid); // Make sorter sort the numbers in natural order @@ -236,7 +236,7 @@ public class GridClientColumnRendererConnector @SuppressWarnings("unchecked") public void shuffle() { Grid<String> grid = getWidget(); - ListSorter<String> shuffler = new ListSorter<String>( + ListSorter<String> shuffler = new ListSorter<>( grid); // Make shuffler return random order diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientDataSourcesWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientDataSourcesWidget.java index c70359c1c4..9281002ae9 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientDataSourcesWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClientDataSourcesWidget.java @@ -102,7 +102,7 @@ public class GridClientDataSourcesWidget private List<String[]> fetchRows(int firstRowIndex, int numberOfRows) { - List<String[]> rows = new ArrayList<String[]>(); + List<String[]> rows = new ArrayList<>(); for (int i = 0; i < numberOfRows; i++) { String id = String.valueOf(firstRowIndex + i); rows.add(new String[] { id, diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridColumnAutoWidthClientWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridColumnAutoWidthClientWidget.java index 8752fd0768..139835b31a 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridColumnAutoWidthClientWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridColumnAutoWidthClientWidget.java @@ -48,10 +48,10 @@ public class GridColumnAutoWidthClientWidget grid.setSelectionMode(SelectionMode.NONE); grid.setWidth("750px"); - List<List<String>> list = new ArrayList<List<String>>(); + List<List<String>> list = new ArrayList<>(); list.add(Arrays.asList("equal length", "a very long cell content", "short", "fixed width narrow", "fixed width wide")); - grid.setDataSource(new ListDataSource<List<String>>(list)); + grid.setDataSource(new ListDataSource<>(list)); addColumn("equal length"); addColumn("short"); diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDataChangeHandlerWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDataChangeHandlerWidget.java index c90551dbf2..a354580645 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDataChangeHandlerWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDataChangeHandlerWidget.java @@ -31,7 +31,7 @@ import com.vaadin.v7.client.widgets.Grid.Column; public class GridDataChangeHandlerWidget extends Composite { private final SimplePanel panel = new SimplePanel(); - private final Grid<String> grid = new Grid<String>(); + private final Grid<String> grid = new Grid<>(); public static class DelayedDataSource extends ListDataSource<String> { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDefaultTextRendererWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDefaultTextRendererWidget.java index dbeec1b0a7..2e61b293ad 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDefaultTextRendererWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridDefaultTextRendererWidget.java @@ -35,7 +35,7 @@ public class GridDefaultTextRendererWidget super(new Grid<String>()); grid = getTestedWidget(); - grid.setDataSource(new ListDataSource<String>(NULL_STRING, "string")); + grid.setDataSource(new ListDataSource<>(NULL_STRING, "string")); grid.addColumn(new Column<String, String>() { @Override public String getValue(String row) { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridHeightByRowOnInitWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridHeightByRowOnInitWidget.java index 7813b3312c..d8a49d8c35 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridHeightByRowOnInitWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridHeightByRowOnInitWidget.java @@ -11,13 +11,13 @@ import com.vaadin.v7.shared.ui.grid.HeightMode; public class GridHeightByRowOnInitWidget extends Composite { private final SimplePanel panel = new SimplePanel(); - private final Grid<String> grid = new Grid<String>(); + private final Grid<String> grid = new Grid<>(); public GridHeightByRowOnInitWidget() { initWidget(panel); panel.setWidget(grid); - grid.setDataSource(new ListDataSource<String>( + grid.setDataSource(new ListDataSource<>( Arrays.asList("A", "B", "C", "D", "E"))); grid.addColumn(new Column<String, String>("letter") { @Override diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/MySelectionModelConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/MySelectionModelConnector.java index 9cd0a26ed6..b5b1e688eb 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/MySelectionModelConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/MySelectionModelConnector.java @@ -34,7 +34,7 @@ public class MySelectionModelConnector extends MultiSelectionModelConnector { @Override protected void extend(ServerConnector target) { super.extend(target); - handler = new ClickSelectHandler<JsonObject>(getGrid()); + handler = new ClickSelectHandler<>(getGrid()); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/PureGWTTestApplication.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/PureGWTTestApplication.java index 01b00b04cc..368d85e9de 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/PureGWTTestApplication.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/PureGWTTestApplication.java @@ -99,8 +99,8 @@ public abstract class PureGWTTestApplication<T> extends DockLayoutPanel title = ""; menubar = new MenuBar(); menubar.getElement().setId("menu"); - children = new ArrayList<Menu>(); - items = new ArrayList<Command>(); + children = new ArrayList<>(); + items = new ArrayList<>(); } /** @@ -111,8 +111,8 @@ public abstract class PureGWTTestApplication<T> extends DockLayoutPanel public Menu(String title) { this.title = title; menubar = new MenuBar(true); - children = new ArrayList<Menu>(); - items = new ArrayList<Command>(); + children = new ArrayList<>(); + items = new ArrayList<>(); } /** diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java b/uitest/src/main/java/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java index 2dcb5d5b3f..c03c375810 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java @@ -118,7 +118,7 @@ public class TestWidgetRegistryGenerator extends Generator { private List<JClassType> findTestWidgets(TreeLogger logger, TypeOracle typeOracle) { - List<JClassType> testWidgetTypes = new ArrayList<JClassType>(); + List<JClassType> testWidgetTypes = new ArrayList<>(); JClassType[] widgetTypes = typeOracle.findType(Widget.class.getName()) .getSubtypes(); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridCheckBoxDisplay.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridCheckBoxDisplay.java index a654406f1e..dd144bdc58 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridCheckBoxDisplay.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridCheckBoxDisplay.java @@ -25,7 +25,7 @@ import com.vaadin.v7.ui.Grid; public class GridCheckBoxDisplay extends AbstractTestUI { private static final long serialVersionUID = -5575892909354637168L; - private BeanItemContainer<Todo> todoContainer = new BeanItemContainer<Todo>( + private BeanItemContainer<Todo> todoContainer = new BeanItemContainer<>( Todo.class); @Override diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridColumnWidthRecalculation.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridColumnWidthRecalculation.java index 7c0191d7c5..e50effb6a4 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridColumnWidthRecalculation.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridColumnWidthRecalculation.java @@ -68,7 +68,7 @@ public class GridColumnWidthRecalculation extends AbstractTestUI { Indexed dataSource = grid.getContainerDataSource(); Object itemId = dataSource.getItemIds().iterator().next(); Item item = dataSource.getItem(itemId); - ArrayList<Object> pIds = new ArrayList<Object>( + ArrayList<Object> pIds = new ArrayList<>( item.getItemPropertyIds()); for (int i = 0; i < pIds.size() / 2; i++) { int j = pIds.size() - 1 - i; diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDataSourceReset.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDataSourceReset.java index 98c204de46..7df5fbd5d1 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDataSourceReset.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDataSourceReset.java @@ -37,7 +37,7 @@ public class GridDataSourceReset extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { persons = createPersons(10, new Random(1)); - container = new BeanItemContainer<ComplexPerson>(ComplexPerson.class, + container = new BeanItemContainer<>(ComplexPerson.class, persons); grid = new Grid(container); @@ -57,7 +57,7 @@ public class GridDataSourceReset extends AbstractTestUI { } public static List<ComplexPerson> createPersons(int count, Random r) { - List<ComplexPerson> c = new ArrayList<ComplexPerson>(); + List<ComplexPerson> c = new ArrayList<>(); for (int i = 0; i < count; ++i) { c.add(ComplexPerson.create(r)); } diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDefaultSelectionMode.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDefaultSelectionMode.java index c455932ceb..fc7dd7e791 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDefaultSelectionMode.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDefaultSelectionMode.java @@ -38,11 +38,11 @@ public class GridDefaultSelectionMode extends AbstractTestUI { person2.setFirstName("person"); person2.setLastName("two"); - ArrayList<Person> items = new ArrayList<Person>(); + ArrayList<Person> items = new ArrayList<>(); items.add(person1); items.add(person2); - final BeanItemContainer<Person> container = new BeanItemContainer<Person>( + final BeanItemContainer<Person> container = new BeanItemContainer<>( Person.class, items); final Grid grid = new Grid(); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDetailsDetach.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDetailsDetach.java index 888313e3b7..5568f6b97c 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDetailsDetach.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridDetailsDetach.java @@ -71,7 +71,7 @@ public class GridDetailsDetach extends AbstractTestUI { } private Grid generateGrid() { - BeanItemContainer<GridExampleBean> container = new BeanItemContainer<GridExampleBean>( + BeanItemContainer<GridExampleBean> container = new BeanItemContainer<>( GridExampleBean.class); for (int i = 0; i < 1000; i++) { container.addItem(new GridExampleBean("Bean " + i, i * i, i / 10d)); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java index 1277257686..b67164c1c4 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java @@ -97,7 +97,7 @@ public class GridHeaderFormatChange extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - BeanItemContainer<Person> datasource = new BeanItemContainer<Person>( + BeanItemContainer<Person> datasource = new BeanItemContainer<>( Person.class); final Grid grid; diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeight.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeight.java index b91324bf0c..13f52537e2 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeight.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeight.java @@ -54,7 +54,7 @@ public class GridHeight extends AbstractTestUI { static final String[] detailsRowHeights = { FULL, UNDEFINED, PX100 }; private Grid grid; - private Map<Object, VerticalLayout> detailsLayouts = new HashMap<Object, VerticalLayout>(); + private Map<Object, VerticalLayout> detailsLayouts = new HashMap<>(); private OptionGroup detailsHeightSelector; @Override diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridReplaceContainer.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridReplaceContainer.java index 07a71f53e0..d31bca5901 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridReplaceContainer.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridReplaceContainer.java @@ -85,7 +85,7 @@ public class GridReplaceContainer extends AbstractTestUIWithLog { } private Indexed createContainer() { - BeanItemContainer<Bean> bic = new BeanItemContainer<Bean>(Bean.class); + BeanItemContainer<Bean> bic = new BeanItemContainer<>(Bean.class); bic.addBean(new Bean(1, "First item")); bic.addBean(new Bean(2, "Second item")); bic.addBean(new Bean(3, "Third item")); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSortIndicator.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSortIndicator.java index bf17dc553e..87adb11bb4 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSortIndicator.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSortIndicator.java @@ -41,13 +41,13 @@ public class GridSortIndicator extends AbstractTestUI { @Override public void sort(SortEvent event) { - List<SortOrder> currentSortOrder = new ArrayList<SortOrder>( + List<SortOrder> currentSortOrder = new ArrayList<>( event.getSortOrder()); if (currentSortOrder.size() == 1) { // If the name column was clicked, set a new sort order for // both columns. Otherwise, revert to oldSortDirection if it // is not null. - List<SortOrder> newSortOrder = new ArrayList<SortOrder>(); + List<SortOrder> newSortOrder = new ArrayList<>(); SortDirection newSortDirection = oldSortDirection; if (currentSortOrder.get(0).getPropertyId() .equals("Name")) { diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrapping.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrapping.java index c37ffa86a4..9c9b49e3da 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrapping.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridSubPixelProblemWrapping.java @@ -77,7 +77,7 @@ public class GridSubPixelProblemWrapping extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { addComponent(button); - container = new BeanItemContainer<DataObject>(DataObject.class); + container = new BeanItemContainer<>(DataObject.class); container.addBean(new DataObject("Foo", "Bar")); Grid grid = new Grid(container); grid.getColumn("foo").setWidth(248.525); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java index 5c0df81c9c..cf31a5f3dd 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java @@ -120,7 +120,7 @@ public class GridThemeUI extends AbstractTestUIWithLog { @Override public void buttonClick(ClickEvent event) { HeaderRow row = addHeaderRowAt(0); - List<Object> pids = new ArrayList<Object>(); + List<Object> pids = new ArrayList<>(); for (Column c : getColumns()) { pids.add(c.getPropertyId()); } diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java index 1e2fd09f2e..a534074da0 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -228,7 +228,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }; - private Map<Object, Panel> detailsMap = new HashMap<Object, Panel>(); + private Map<Object, Panel> detailsMap = new HashMap<>(); private final DetailsGenerator persistingDetailsGenerator = new DetailsGenerator() { @@ -474,7 +474,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { protected void createGridActions() { - LinkedHashMap<String, String> primaryStyleNames = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> primaryStyleNames = new LinkedHashMap<>(); primaryStyleNames.put("v-grid", "v-grid"); primaryStyleNames.put("v-escalator", "v-escalator"); primaryStyleNames.put("my-grid", "my-grid"); @@ -489,7 +489,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }, primaryStyleNames.get("v-grid")); - LinkedHashMap<String, SelectionMode> selectionModes = new LinkedHashMap<String, Grid.SelectionMode>(); + LinkedHashMap<String, SelectionMode> selectionModes = new LinkedHashMap<>(); selectionModes.put("single", SelectionMode.SINGLE); selectionModes.put("multi", SelectionMode.MULTI); selectionModes.put("none", SelectionMode.NONE); @@ -511,7 +511,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }); - LinkedHashMap<String, Integer> selectionLimits = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> selectionLimits = new LinkedHashMap<>(); selectionLimits.put("2", Integer.valueOf(2)); selectionLimits.put("1000", Integer.valueOf(1000)); selectionLimits.put("Integer.MAX_VALUE", @@ -530,7 +530,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }); - LinkedHashMap<String, List<SortOrder>> sortableProperties = new LinkedHashMap<String, List<SortOrder>>(); + LinkedHashMap<String, List<SortOrder>> sortableProperties = new LinkedHashMap<>(); for (Object propertyId : ds.getSortableContainerPropertyIds()) { sortableProperties.put(propertyId + ", ASC", Sort.by(propertyId).build()); @@ -551,7 +551,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { @Override public void execute(Grid c, Boolean value, Object data) { - List<Object> ids = new ArrayList<Object>(); + List<Object> ids = new ArrayList<>(); ids.addAll(ds.getContainerPropertyIds()); if (!value) { c.setColumnOrder(ids.toArray()); @@ -565,8 +565,8 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }); - LinkedHashMap<String, CellStyleGenerator> cellStyleGenerators = new LinkedHashMap<String, CellStyleGenerator>(); - LinkedHashMap<String, RowStyleGenerator> rowStyleGenerators = new LinkedHashMap<String, RowStyleGenerator>(); + LinkedHashMap<String, CellStyleGenerator> cellStyleGenerators = new LinkedHashMap<>(); + LinkedHashMap<String, RowStyleGenerator> rowStyleGenerators = new LinkedHashMap<>(); rowStyleGenerators.put(ROW_STYLE_GENERATOR_NONE, null); rowStyleGenerators.put(ROW_STYLE_GENERATOR_ROW_NUMBERS, new RowStyleGenerator() { @@ -684,7 +684,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }); - LinkedHashMap<String, Integer> frozenOptions = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> frozenOptions = new LinkedHashMap<>(); for (int i = -1; i <= COLUMNS; i++) { frozenOptions.put(String.valueOf(i), Integer.valueOf(i)); } @@ -701,7 +701,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }); - LinkedHashMap<String, Integer> containerDelayValues = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> containerDelayValues = new LinkedHashMap<>(); for (int delay : new int[] { 0, 500, 2000, 10000 }) { containerDelayValues.put(String.valueOf(delay), Integer.valueOf(delay)); @@ -845,7 +845,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }); - LinkedHashMap<String, String> defaultRows = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> defaultRows = new LinkedHashMap<>(); defaultRows.put("Top", "Top"); defaultRows.put("Bottom", "Bottom"); defaultRows.put("Unset", "Unset"); @@ -997,7 +997,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { final String columnProperty = getColumnProperty( (Integer) data); List<Column> cols = grid.getColumns(); - List<Object> reordered = new ArrayList<Object>(); + List<Object> reordered = new ArrayList<>(); boolean addAsLast = false; for (int i = 0; i < cols.size(); i++) { Column col = cols.get(i); @@ -1131,7 +1131,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { }, w, c); } - LinkedHashMap<String, GridStaticCellType> defaultRows = new LinkedHashMap<String, GridStaticCellType>(); + LinkedHashMap<String, GridStaticCellType> defaultRows = new LinkedHashMap<>(); defaultRows.put("Text Header", GridStaticCellType.TEXT); defaultRows.put("Html Header ", GridStaticCellType.HTML); defaultRows.put("Widget Header", GridStaticCellType.WIDGET); @@ -1170,7 +1170,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { }, c); - defaultRows = new LinkedHashMap<String, GridStaticCellType>(); + defaultRows = new LinkedHashMap<>(); defaultRows.put("Text Footer", GridStaticCellType.TEXT); defaultRows.put("Html Footer", GridStaticCellType.HTML); defaultRows.put("Widget Footer", GridStaticCellType.WIDGET); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/AbstractTextFieldTest.java b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/AbstractTextFieldTest.java index 604eb707ee..5e27b591b4 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/AbstractTextFieldTest.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/AbstractTextFieldTest.java @@ -128,7 +128,7 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField> } private void createNullRepresentationAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("null", "null"); options.put("This is empty", "This is empty"); @@ -169,7 +169,7 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField> } private void createSelectionRangeAction(String category) { - List<Range> options = new ArrayList<Range>(); + List<Range> options = new ArrayList<>(); options.add(new Range(0, 10)); options.add(new Range(0, 1)); options.add(new Range(0, 2)); @@ -198,7 +198,7 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField> } private void createTextChangeEventTimeoutAction(String category) { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> options = new LinkedHashMap<>(); options.put("0", 0); options.put("100ms", 100); options.put("500ms", 500); @@ -211,7 +211,7 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField> } private void createTextChangeEventModeAction(String category) { - LinkedHashMap<String, TextChangeEventMode> options = new LinkedHashMap<String, AbstractTextField.TextChangeEventMode>(); + LinkedHashMap<String, TextChangeEventMode> options = new LinkedHashMap<>(); for (TextChangeEventMode m : TextChangeEventMode.values()) { options.put(m.toString(), m); } @@ -234,7 +234,7 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField> } private void createInputPromptAction(String category) { - LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + LinkedHashMap<String, String> options = new LinkedHashMap<>(); options.put("-", null); options.put("Enter a value", "Enter a value"); options.put("- Click here -", "- Click here -"); diff --git a/uitest/src/test/java/com/vaadin/tests/application/DeploymentConfigurationTest.java b/uitest/src/test/java/com/vaadin/tests/application/DeploymentConfigurationTest.java index 6de1d16d41..d2cc9450f2 100644 --- a/uitest/src/test/java/com/vaadin/tests/application/DeploymentConfigurationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/application/DeploymentConfigurationTest.java @@ -31,7 +31,7 @@ public class DeploymentConfigurationTest extends SingleBrowserTest { @Test public void testParameters() { openTestURL(); - List<String> texts = new ArrayList<String>(Arrays.asList( + List<String> texts = new ArrayList<>(Arrays.asList( "Init parameters:", "widgetset: com.vaadin.v7.Vaadin7WidgetSet", "closeIdleSessions: true", "productionMode: false", "testParam: 42", "heartbeatInterval: 301", diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionPageLengthTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionPageLengthTest.java index 060a6a2a7d..137216d718 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionPageLengthTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionPageLengthTest.java @@ -59,7 +59,7 @@ public class ComboBoxSuggestionPageLengthTest extends MultiBrowserTest { .findElements(By.cssSelector( ".v-filterselect-suggestpopup .gwt-MenuItem span")); - List<String> suggestions = new ArrayList<String>(); + List<String> suggestions = new ArrayList<>(); for (WebElement suggestion : suggestionElements) { suggestions.add(suggestion.getText()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java index ca87aaa379..d804f8f8ce 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java @@ -69,7 +69,7 @@ public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest { List<WebElement> headerElements = popup .findElement(By.className("v-datefield-calendarpanel-weekdays")) .findElements(By.tagName("td")); - List<WebElement> weekdays = new ArrayList<WebElement>(); + List<WebElement> weekdays = new ArrayList<>(); for (WebElement headerElement : headerElements) { if ("columnheader".equals(headerElement.getAttribute("role"))) { weekdays.add(headerElement); @@ -176,7 +176,7 @@ public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest { List<WebElement> headerElements = popup .findElement(By.className("v-datefield-calendarpanel-weekdays")) .findElements(By.tagName("td")); - List<WebElement> weekdays = new ArrayList<WebElement>(); + List<WebElement> weekdays = new ArrayList<>(); for (WebElement headerElement : headerElements) { if ("columnheader".equals(headerElement.getAttribute("role"))) { weekdays.add(headerElement); @@ -303,7 +303,7 @@ public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest { List<WebElement> headerElements = popup .findElement(By.className("v-datefield-calendarpanel-weekdays")) .findElements(By.tagName("td")); - List<WebElement> weekdays = new ArrayList<WebElement>(); + List<WebElement> weekdays = new ArrayList<>(); for (WebElement headerElement : headerElements) { if ("columnheader".equals(headerElement.getAttribute("role"))) { weekdays.add(headerElement); diff --git a/uitest/src/test/java/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java b/uitest/src/test/java/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java index cc27555638..b48f252d27 100644 --- a/uitest/src/test/java/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java +++ b/uitest/src/test/java/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKeyTest.java @@ -26,7 +26,7 @@ public class TableQueryWithNonUniqueFirstPrimaryKeyTest $(ComboBoxElement.class).first().findElement(By.vaadin("#textbox")) .sendKeys("rus", Keys.ENTER); - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); // pick list items that are shown in suggestion popup List<WebElement> elems = findElements( diff --git a/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java b/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java index 6bd456c7e2..a642a1207a 100644 --- a/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fields/TabIndexesTest.java @@ -73,7 +73,7 @@ public class TabIndexesTest extends MultiBrowserTest { } private List<WebElement> getFieldElements() { - List<WebElement> fieldElements = new ArrayList<WebElement>(); + List<WebElement> fieldElements = new ArrayList<>(); fieldElements.add(getElement1()); fieldElements.add(getElement2()); fieldElements.add(getElement3()); diff --git a/uitest/src/test/java/com/vaadin/tests/integration/AbstractServletIntegrationTest.java b/uitest/src/test/java/com/vaadin/tests/integration/AbstractServletIntegrationTest.java index 33841a13ea..b17febee04 100644 --- a/uitest/src/test/java/com/vaadin/tests/integration/AbstractServletIntegrationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/integration/AbstractServletIntegrationTest.java @@ -59,7 +59,7 @@ public abstract class AbstractServletIntegrationTest @Parameters public static Collection<String> getContextPaths() { if (getServerName().equals("wildfly9-nginx")) { - ArrayList<String> paths = new ArrayList<String>(); + ArrayList<String> paths = new ArrayList<>(); paths.add("/buffering/demo"); paths.add("/nonbuffering/demo"); paths.add("/buffering-timeout/demo"); diff --git a/uitest/src/test/java/com/vaadin/tests/integration/JSPIntegrationTest.java b/uitest/src/test/java/com/vaadin/tests/integration/JSPIntegrationTest.java index e7cb461b1c..d135c79347 100644 --- a/uitest/src/test/java/com/vaadin/tests/integration/JSPIntegrationTest.java +++ b/uitest/src/test/java/com/vaadin/tests/integration/JSPIntegrationTest.java @@ -57,8 +57,8 @@ public class JSPIntegrationTest extends PrivateTB3Configuration { // Should now have two services with 2 + 1 UIs List<UIData> threeUIs = getUIs(); assertEquals(3, threeUIs.size()); - Set<String> serviceNames = new HashSet<String>(); - Set<Integer> uiIds = new HashSet<Integer>(); + Set<String> serviceNames = new HashSet<>(); + Set<Integer> uiIds = new HashSet<>(); for (UIData uiData : threeUIs) { serviceNames.add(uiData.serviceName); uiIds.add(uiData.uiId); @@ -76,7 +76,7 @@ public class JSPIntegrationTest extends PrivateTB3Configuration { } private List<UIData> getUIs() { - List<UIData> uis = new ArrayList<UIData>(); + List<UIData> uis = new ArrayList<>(); getDriver().get(jspUrl); List<WebElement> rows = getDriver() diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java b/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java index bb29a82d2d..391618bf43 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java @@ -49,7 +49,7 @@ public class AffectedTB3TestLocator extends TB3TestLocator { testClasses .addAll(getTestClassesWithAffectedPackageName(allTestClasses)); - List<Class<? extends T>> affectedTestClasses = new ArrayList<Class<? extends T>>(); + List<Class<? extends T>> affectedTestClasses = new ArrayList<>(); affectedTestClasses.addAll(testClasses); return affectedTestClasses; @@ -57,7 +57,7 @@ public class AffectedTB3TestLocator extends TB3TestLocator { private <T> List<Class<? extends T>> getTestClassesWithAffectedPackageName( List<Class<? extends T>> classes) { - List<Class<? extends T>> affectedTestClasses = new ArrayList<Class<? extends T>>(); + List<Class<? extends T>> affectedTestClasses = new ArrayList<>(); List<String> affectedFiles = getAffectedFiles(); for (Class c : classes) { @@ -79,7 +79,7 @@ public class AffectedTB3TestLocator extends TB3TestLocator { } private List<String> getAffectedFiles() { - List<String> affectedFilePaths = new ArrayList<String>(); + List<String> affectedFilePaths = new ArrayList<>(); for (String path : changedTB3TestLocator.getChangedFilePaths()) { if (!path.toLowerCase().contains("test")) { diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java index 44ec4ca129..9de53a3c28 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java @@ -54,7 +54,7 @@ public class ChangedTB3TestLocator extends TB3TestLocator { } protected List<String> getChangedFilePaths() { - List<String> filePaths = new ArrayList<String>(); + List<String> filePaths = new ArrayList<>(); for (DiffEntry diff : getDiffs()) { if (diff.getChangeType() != ChangeType.DELETE) { @@ -100,7 +100,7 @@ public class ChangedTB3TestLocator extends TB3TestLocator { Git git = new Git(repository); DiffCommand diffCommand = git.diff(); - List<DiffEntry> diffsInWorkingTree = new ArrayList<DiffEntry>(); + List<DiffEntry> diffsInWorkingTree = new ArrayList<>(); for (DiffEntry diff : diffCommand.call()) { if (pathIsExcluded(diff.getNewPath())) { @@ -143,7 +143,7 @@ public class ChangedTB3TestLocator extends TB3TestLocator { private <T> List<Class<? extends T>> getChangedTestClasses( Class<T> baseClass) { List<String> changedTestFilePaths = getTestFilePaths(); - List<Class<? extends T>> testClasses = new ArrayList<Class<? extends T>>(); + List<Class<? extends T>> testClasses = new ArrayList<>(); for (String filePath : changedTestFilePaths) { String path = filePath.replace("uitest/src/", "").replace(".java", @@ -156,7 +156,7 @@ public class ChangedTB3TestLocator extends TB3TestLocator { } private List<String> getTestFilePaths() { - List<String> changedTestFilePaths = new ArrayList<String>(); + List<String> changedTestFilePaths = new ArrayList<>(); for (String filePath : getChangedFilePaths()) { if (filePath.toLowerCase().startsWith("uitest") diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java index 5b218e3f98..261af495fa 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTest.java @@ -50,7 +50,7 @@ public abstract class MultiBrowserThemeTest extends MultiBrowserTest { @Override protected void openTestURL(Class<?> uiClass, String... parameters) { - Set<String> params = new HashSet<String>(Arrays.asList(parameters)); + Set<String> params = new HashSet<>(Arrays.asList(parameters)); params.add("theme=" + theme); super.openTestURL(uiClass, params.toArray(new String[params.size()])); } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java index 1ceed606cd..7d798fa2e8 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java @@ -48,7 +48,7 @@ public abstract class MultiBrowserThemeTestWithProxy @Override protected void openTestURL(Class<?> uiClass, String... parameters) { - Set<String> params = new HashSet<String>(Arrays.asList(parameters)); + Set<String> params = new HashSet<>(Arrays.asList(parameters)); params.add("theme=" + theme); super.openTestURL(uiClass, params.toArray(new String[params.size()])); } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ServletIntegrationTests.java b/uitest/src/test/java/com/vaadin/tests/tb3/ServletIntegrationTests.java index bf0387d468..9698068621 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/ServletIntegrationTests.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/ServletIntegrationTests.java @@ -32,8 +32,8 @@ import com.vaadin.tests.tb3.ServletIntegrationTests.ServletIntegrationTestSuite; @RunWith(ServletIntegrationTestSuite.class) public class ServletIntegrationTests { - public static Set<String> notJSR356Compatible = new HashSet<String>(); - public static Set<String> notWebsocketCompatible = new HashSet<String>(); + public static Set<String> notJSR356Compatible = new HashSet<>(); + public static Set<String> notWebsocketCompatible = new HashSet<>(); static { notJSR356Compatible.add("jetty8"); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java index c2b5c3f1cb..de8e4ea9c4 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridDetailsLocationTest.java @@ -78,7 +78,7 @@ public class GridDetailsLocationTest extends MultiBrowserTest { } public static Collection<Param> parameters() { - List<Param> data = new ArrayList<Param>(); + List<Param> data = new ArrayList<>(); int[] params = new int[] { 0, 500, 999 }; diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java index 776cbfb57d..15c8498676 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeightTest.java @@ -67,7 +67,7 @@ public class GridHeightTest extends MultiBrowserTest { private Map<AssertionError, Object[]> testGridHeightAndResizing( Object gridHeight) throws InterruptedException { - Map<AssertionError, Object[]> errors = new HashMap<AssertionError, Object[]>(); + Map<AssertionError, Object[]> errors = new HashMap<>(); String caption; if (GridHeight.ROW3.equals(gridHeight)) { caption = gridHeight + " rows"; diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java index 7a0c80f11a..5787c2facc 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java @@ -72,7 +72,7 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { } protected List<TestBenchElement> getGridHeaderRowCells() { - List<TestBenchElement> headerCells = new ArrayList<TestBenchElement>(); + List<TestBenchElement> headerCells = new ArrayList<>(); for (int i = 0; i < getGridElement().getHeaderCount(); ++i) { headerCells.addAll(getGridElement().getHeaderCells(i)); } @@ -80,7 +80,7 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { } protected List<TestBenchElement> getGridFooterRowCells() { - List<TestBenchElement> footerCells = new ArrayList<TestBenchElement>(); + List<TestBenchElement> footerCells = new ArrayList<>(); for (int i = 0; i < getGridElement().getFooterCount(); ++i) { footerCells.addAll(getGridElement().getFooterCells(i)); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java index 5413e7a0b1..a0ca714824 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridClientColumnPropertiesTest.java @@ -154,7 +154,7 @@ public class GridClientColumnPropertiesTest GridElement gridElement = getGridElement(); List<GridCellElement> headerCells = gridElement.getHeaderCells(0); - final List<Integer> columnWidths = new ArrayList<Integer>(); + final List<Integer> columnWidths = new ArrayList<>(); for (GridCellElement cell : headerCells) { columnWidths.add(cell.getSize().getWidth()); } |