diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-09-28 10:39:17 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-28 11:39:17 +0300 |
commit | 7065740d6d02954c3483e2f24db36ad1af45c62e (patch) | |
tree | db3a0f0cabb8cc3ce4a4d2636aff9bf1716fcd8b | |
parent | 1827ccb5ed99c9b2deeea38e239527420711f5d1 (diff) | |
download | vaadin-framework-7065740d6d02954c3483e2f24db36ad1af45c62e.tar.gz vaadin-framework-7065740d6d02954c3483e2f24db36ad1af45c62e.zip |
Use interface instead of implementation (#10073)
130 files changed, 467 insertions, 401 deletions
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 8ac6e8e4e7..ba27ef32da 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 @@ -538,7 +538,7 @@ public class ConnectorBundleLoaderFactory extends Generator { + connector.getName()); // Build map to speed up error checking - HashMap<String, Property> stateProperties = new HashMap<>(); + Map<String, Property> stateProperties = new HashMap<>(); JClassType stateType = ConnectorBundle .findInheritedMethod(connector, "getState").getReturnType() .isClassOrInterface(); 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 a001f591c1..4099832990 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 @@ -73,7 +73,7 @@ public class FieldProperty extends Property { private static List<JField> getPublicFields(JClassType type) { Set<String> names = new HashSet<>(); - ArrayList<JField> fields = new ArrayList<>(); + List<JField> fields = new ArrayList<>(); for (JClassType subType : type.getFlattenedSupertypeHierarchy()) { JField[] subFields = subType.getFields(); for (JField field : subFields) { diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java index 41ce18e8ee..2f53c24f0d 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java @@ -248,7 +248,7 @@ public class ApplicationConfiguration implements EntryPoint { private ErrorMessage sessionExpiredError; private int heartbeatInterval; - private HashMap<Integer, String> unknownComponents; + private Map<Integer, String> unknownComponents; private Map<Integer, Class<? extends ServerConnector>> classes = new HashMap<>(); @@ -256,11 +256,11 @@ public class ApplicationConfiguration implements EntryPoint { private static boolean moduleLoaded = false; static// TODO consider to make this hashmap per application - LinkedList<Command> callbacks = new LinkedList<>(); + List<Command> callbacks = new LinkedList<>(); private static int dependenciesLoading; - private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<>(); + private static List<ApplicationConnection> runningApplications = new ArrayList<>(); private Map<Integer, Integer> componentInheritanceMap = new HashMap<>(); private Map<Integer, String> tagToServerSideClassName = new HashMap<>(); diff --git a/client/src/main/java/com/vaadin/client/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java index aa02cd0a6f..d6a18f485b 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java @@ -115,7 +115,7 @@ public class ApplicationConnection implements HasHandlers { */ public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh"; - private final HashMap<String, String> resourcesMap = new HashMap<>(); + private final Map<String, String> resourcesMap = new HashMap<>(); private WidgetSet widgetSet; @@ -383,8 +383,8 @@ public class ApplicationConnection implements HasHandlers { + cnf.getServletVersion()); if (!cnf.getServletVersion().equals(Version.getFullVersion())) { - getLogger() - .severe("Warning: your widget set seems to be built with a different " + getLogger().severe( + "Warning: your widget set seems to be built with a different " + "version than the one used on server. Unexpected " + "behavior may occur."); } @@ -494,7 +494,7 @@ public class ApplicationConnection implements HasHandlers { return vi; } } - + client.getProfilingData = $entry(function() { var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); var pd = [ @@ -509,7 +509,7 @@ public class ApplicationConnection implements HasHandlers { pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime; return pd; }); - + client.getElementByPath = $entry(function(id) { return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); }); @@ -526,7 +526,7 @@ public class ApplicationConnection implements HasHandlers { return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); }); client.initializing = false; - + $wnd.vaadin.clients[TTAppId] = client; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ComponentDetail.java b/client/src/main/java/com/vaadin/client/ComponentDetail.java index ebdcc4414c..a6621ac178 100644 --- a/client/src/main/java/com/vaadin/client/ComponentDetail.java +++ b/client/src/main/java/com/vaadin/client/ComponentDetail.java @@ -16,6 +16,7 @@ package com.vaadin.client; import java.util.HashMap; +import java.util.Map; class ComponentDetail { @@ -54,7 +55,7 @@ class ComponentDetail { this.tooltipInfo = tooltipInfo; } - private HashMap<Object, TooltipInfo> additionalTooltips; + private Map<Object, TooltipInfo> additionalTooltips; public void putAdditionalTooltip(Object key, TooltipInfo tooltip) { if (tooltip == null && additionalTooltips != null) { diff --git a/client/src/main/java/com/vaadin/client/ComponentDetailMap.java b/client/src/main/java/com/vaadin/client/ComponentDetailMap.java index f95c1c1a83..e9cbe75fdf 100644 --- a/client/src/main/java/com/vaadin/client/ComponentDetailMap.java +++ b/client/src/main/java/com/vaadin/client/ComponentDetailMap.java @@ -17,6 +17,7 @@ package com.vaadin.client; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import com.google.gwt.core.client.JavaScriptObject; @@ -80,7 +81,7 @@ final class ComponentDetailMap extends JavaScriptObject { }-*/; final Collection<ComponentDetail> values() { - ArrayList<ComponentDetail> list = new ArrayList<>(); + List<ComponentDetail> list = new ArrayList<>(); fillWithValues(list); return list; } diff --git a/client/src/main/java/com/vaadin/client/ConnectorMap.java b/client/src/main/java/com/vaadin/client/ConnectorMap.java index a2fc8cc81e..1ccfb74434 100644 --- a/client/src/main/java/com/vaadin/client/ConnectorMap.java +++ b/client/src/main/java/com/vaadin/client/ConnectorMap.java @@ -17,6 +17,7 @@ package com.vaadin.client; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.logging.Logger; import com.google.gwt.core.client.GWT; @@ -205,7 +206,7 @@ public class ConnectorMap { */ @Deprecated public ComponentConnector[] getComponentConnectors() { - ArrayList<ComponentConnector> result = new ArrayList<>(); + List<ComponentConnector> result = new ArrayList<>(); JsArrayObject<ServerConnector> connectors = getConnectorsAsJsArray(); int size = connectors.size(); @@ -255,7 +256,7 @@ public class ConnectorMap { @Deprecated public Collection<? extends ServerConnector> getConnectors() { Collection<ComponentDetail> values = idToComponentDetail.values(); - ArrayList<ServerConnector> arrayList = new ArrayList<>(values.size()); + List<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 05449f1126..842526f65a 100644 --- a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java +++ b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java @@ -154,7 +154,7 @@ public class JavaScriptConnectorHelper { } protected boolean initJavaScript() { - ArrayList<String> initFunctionNames = getPotentialInitFunctionNames(); + List<String> initFunctionNames = getPotentialInitFunctionNames(); for (String initFunctionName : initFunctionNames) { if (tryInitJs(initFunctionName, getConnectorWrapper())) { getLogger().info("JavaScript connector initialized using " @@ -488,10 +488,10 @@ public class JavaScriptConnectorHelper { return initFunctionName; } - private ArrayList<String> getPotentialInitFunctionNames() { + private List<String> getPotentialInitFunctionNames() { ApplicationConfiguration conf = connector.getConnection() .getConfiguration(); - ArrayList<String> initFunctionNames = new ArrayList<String>(); + List<String> initFunctionNames = new ArrayList<String>(); Integer tag = Integer.valueOf(connector.getTag()); while (tag != null) { String initFunctionName = conf.getServerSideClassNameForTag(tag); diff --git a/client/src/main/java/com/vaadin/client/LayoutManager.java b/client/src/main/java/com/vaadin/client/LayoutManager.java index b679fe980e..117154f9de 100644 --- a/client/src/main/java/com/vaadin/client/LayoutManager.java +++ b/client/src/main/java/com/vaadin/client/LayoutManager.java @@ -621,7 +621,7 @@ public class LayoutManager { int pendingOverflowCount = pendingOverflowConnectorsIds.length(); ConnectorMap connectorMap = ConnectorMap.get(connection); if (pendingOverflowCount > 0) { - HashMap<Element, String> originalOverflows = new HashMap<>(); + Map<Element, String> originalOverflows = new HashMap<>(); FastStringSet delayedOverflowFixes = FastStringSet.create(); @@ -1646,8 +1646,9 @@ public class LayoutManager { int assignedHeight) { assert component.isRelativeHeight(); - float percentSize = parsePercent(component.getState().height == null - ? "" : component.getState().height); + float percentSize = parsePercent( + component.getState().height == null ? "" + : component.getState().height); int effectiveHeight = Math.round(assignedHeight * (percentSize / 100)); reportOuterHeight(component, effectiveHeight); diff --git a/client/src/main/java/com/vaadin/client/Profiler.java b/client/src/main/java/com/vaadin/client/Profiler.java index 5ab6b8a64d..caab0bccdc 100644 --- a/client/src/main/java/com/vaadin/client/Profiler.java +++ b/client/src/main/java/com/vaadin/client/Profiler.java @@ -537,7 +537,7 @@ public class Profiler { Map<String, Node> totals = new HashMap<>(); rootNode.sumUpTotals(totals); - ArrayList<Node> totalList = new ArrayList<>(totals.values()); + List<Node> totalList = new ArrayList<>(totals.values()); Collections.sort(totalList, new Comparator<Node>() { @Override public int compare(Node o1, Node o2) { @@ -569,14 +569,14 @@ public class Profiler { if (isEnabled()) { double now = Duration.currentTimeMillis(); - String[] keys = { "navigationStart", - "unloadEventStart", "unloadEventEnd", "redirectStart", - "redirectEnd", "fetchStart", "domainLookupStart", - "domainLookupEnd", "connectStart", "connectEnd", - "requestStart", "responseStart", "responseEnd", - "domLoading", "domInteractive", - "domContentLoadedEventStart", "domContentLoadedEventEnd", - "domComplete", "loadEventStart", "loadEventEnd" }; + String[] keys = { "navigationStart", "unloadEventStart", + "unloadEventEnd", "redirectStart", "redirectEnd", + "fetchStart", "domainLookupStart", "domainLookupEnd", + "connectStart", "connectEnd", "requestStart", + "responseStart", "responseEnd", "domLoading", + "domInteractive", "domContentLoadedEventStart", + "domContentLoadedEventEnd", "domComplete", "loadEventStart", + "loadEventEnd" }; LinkedHashMap<String, Double> timings = new LinkedHashMap<>(); diff --git a/client/src/main/java/com/vaadin/client/Util.java b/client/src/main/java/com/vaadin/client/Util.java index b849d0c0b3..bad1ac1ce2 100644 --- a/client/src/main/java/com/vaadin/client/Util.java +++ b/client/src/main/java/com/vaadin/client/Util.java @@ -727,7 +727,7 @@ public class Util { } private static void printConnectorInvocations( - ArrayList<MethodInvocation> invocations, String id, + List<MethodInvocation> invocations, String id, ApplicationConnection c) { ServerConnector connector = ConnectorMap.get(c).getConnector(id); if (connector != null) { @@ -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<>(); + List<MethodInvocation> invocations = new ArrayList<>(); for (MethodInvocation methodInvocation : methodInvocations) { String id = methodInvocation.getConnectorId(); diff --git a/client/src/main/java/com/vaadin/client/WidgetMap.java b/client/src/main/java/com/vaadin/client/WidgetMap.java index 5a2fb06a69..71c41b4738 100644 --- a/client/src/main/java/com/vaadin/client/WidgetMap.java +++ b/client/src/main/java/com/vaadin/client/WidgetMap.java @@ -16,6 +16,7 @@ package com.vaadin.client; import java.util.HashMap; +import java.util.Map; /** * Abstract class mapping between {@link ComponentConnector} instances and their @@ -26,7 +27,7 @@ import java.util.HashMap; */ abstract class WidgetMap { - protected static HashMap<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<>(); + protected static Map<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/componentlocator/VaadinFinderLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java index 77e1ee0a09..b650702c08 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java @@ -557,7 +557,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { private List<ComponentConnector> collectPotentialMatches( ComponentConnector parent, String pathFragment, boolean collectRecursively) { - ArrayList<ComponentConnector> potentialMatches = new ArrayList<>(); + List<ComponentConnector> potentialMatches = new ArrayList<>(); String widgetName = getWidgetName(pathFragment); // Special case when searching for UIElement. if (LocatorUtil.isUIElement(pathFragment)) { diff --git a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java index 3191be2ed1..dd14d98916 100644 --- a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java @@ -17,6 +17,7 @@ package com.vaadin.client.connectors; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.logging.Logger; import com.google.gwt.core.client.JavaScriptObject; @@ -65,7 +66,7 @@ public class JavaScriptRendererConnector private static native JavaScriptObject createCellReferenceWrapper() /*-{ var reference = {}; - + var setProperty = function(name, getter, setter) { var descriptor = { get: getter @@ -75,25 +76,25 @@ public class JavaScriptRendererConnector } Object.defineProperty(reference, name, descriptor); }; - + setProperty("element", function() { return reference.target.@CellReference::getElement()(); }, null); - + setProperty("rowIndex", function() { return reference.target.@CellReference::getRowIndex()(); }, null); - + setProperty("columnIndex", function() { return reference.target.@CellReference::getColumnIndex()(); }, null); - + setProperty("colSpan", function() { return reference.target.@RendererCellReference::getColSpan()(); }, function(colSpan) { reference.target.@RendererCellReference::setColSpan(*)(colSpan); }); - + return reference; }-*/; @@ -232,7 +233,7 @@ public class JavaScriptRendererConnector JsArrayString events = getConsumedEvents( helper.getConnectorWrapper()); - ArrayList<String> list = new ArrayList<>(events.length()); + List<String> list = new ArrayList<>(events.length()); for (int i = 0; i < events.length(); i++) { list.add(events.get(i)); } 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 f7669c53ca..2a03a37e18 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 @@ -18,6 +18,7 @@ package com.vaadin.client.connectors.data; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; import com.vaadin.client.ServerConnector; @@ -63,7 +64,7 @@ public class DataCommunicatorConnector extends AbstractExtensionConnector { @Override public void setData(int firstIndex, JsonArray data) { - ArrayList<JsonObject> rows = new ArrayList<>( + List<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/data/AbstractRemoteDataSource.java b/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java index ce1acef641..20de99cef0 100644 --- a/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java +++ b/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java @@ -181,8 +181,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { private Range cached = Range.between(0, 0); - private final HashMap<Integer, T> indexToRowMap = new HashMap<>(); - private final HashMap<Object, Integer> keyToIndexMap = new HashMap<>(); + private final Map<Integer, T> indexToRowMap = new HashMap<>(); + private final Map<Object, Integer> keyToIndexMap = new HashMap<>(); /** * Map used to temporarily store rows invalidated by 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 274255554b..3e443a54cb 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 @@ -17,6 +17,7 @@ package com.vaadin.client.debug.internal; import java.util.ArrayList; import java.util.Date; +import java.util.List; import com.google.gwt.core.client.Duration; import com.google.gwt.core.client.Scheduler; @@ -133,7 +134,7 @@ public final class VDebugWindow extends VOverlay { protected SimplePanel content = new SimplePanel(); // sections - protected ArrayList<Section> sections = new ArrayList<>(); + protected List<Section> sections = new ArrayList<>(); // handles resize/move protected HandlerRegistration mouseDownHandler = null; @@ -786,8 +787,7 @@ public final class VDebugWindow extends VOverlay { protected class Menu extends VOverlay { FlowPanel content = new FlowPanel(); - DebugButton[] sizes = { - new DebugButton(null, "Small", "A"), + DebugButton[] sizes = { new DebugButton(null, "Small", "A"), new DebugButton(null, "Medium", "A"), new DebugButton(null, "Large", "A") }; 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 7c515e2c7c..b4b21ea9e5 100644 --- a/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java +++ b/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java @@ -248,7 +248,7 @@ public abstract class ConnectorBundleLoader { * @since 8.0.3 */ public List<String> getLoadedBundles() { - ArrayList<String> bundles = new ArrayList<>(); + List<String> bundles = new ArrayList<>(); JsArrayString keys = asyncBlockLoaders.getKeys(); for (int i = 0; i < keys.length(); i++) { 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 1c85c752cf..a85ed4516e 100644 --- a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java +++ b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java @@ -17,6 +17,7 @@ package com.vaadin.client.metadata; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArrayString; @@ -260,7 +261,7 @@ public class TypeDataStore { throws NoDataException { JsArrayObject<Property> propertiesArray = getPropertiesAsArray(type); int size = propertiesArray.size(); - ArrayList<Property> properties = new ArrayList<>(size); + List<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/ui/FocusableScrollPanel.java b/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java index 99696ef2aa..9ec6c0ee2f 100644 --- a/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java @@ -15,7 +15,7 @@ */ package com.vaadin.client.ui; -import java.util.ArrayList; +import java.util.List; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -170,7 +170,7 @@ public class FocusableScrollPanel extends SimpleFocusablePanel public void setScrollPosition(int position) { if (BrowserInfo.get().isAndroidWithBrokenScrollTop() && BrowserInfo.get().requiresTouchScrollDelegate()) { - ArrayList<com.google.gwt.dom.client.Element> elements = TouchScrollDelegate + List<com.google.gwt.dom.client.Element> elements = TouchScrollDelegate .getElements(getElement()); for (com.google.gwt.dom.client.Element el : elements) { final Style style = el.getStyle(); 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 703df0b96d..9679473c80 100644 --- a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Element; @@ -58,7 +59,7 @@ public class ShortcutActionHandler { ShortcutActionHandler getShortcutActionHandler(); } - private final ArrayList<ShortcutAction> actions = new ArrayList<>(); + private final List<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 e5eb99ad2d..af8f918a4a 100644 --- a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java +++ b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.List; import com.google.gwt.animation.client.Animation; import com.google.gwt.core.client.Duration; @@ -94,7 +95,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { private int deltaScrollPos; private boolean transitionOn = false; private int finalScrollTop; - private ArrayList<Element> layers; + private List<Element> layers; private boolean moved; private ScrollHandler scrollHandler; 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 88c84ad5bb..82a08a4f12 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java @@ -17,6 +17,7 @@ package com.vaadin.client.ui; import java.util.HashMap; +import java.util.Map; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.ImageElement; @@ -49,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<>(); + private final Map<String, Element> locationToElement = new HashMap<>(); /** Location-name to contained widget map */ - final HashMap<String, Widget> locationToWidget = new HashMap<>(); + final Map<String, Widget> locationToWidget = new HashMap<>(); /** Widget to captionwrapper map */ - private final HashMap<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<>(); + private final Map<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<>(); /** * Unexecuted scripts loaded from the template. @@ -420,7 +421,8 @@ public class VCustomLayout extends ComplexPanel { * <p> * For internal use only. May be removed or replaced in the future. * - * @param el The first element of the layout + * @param el + * The first element of the layout * @return true if layout function exists and was run successfully, else * false. */ 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 5704dc497d..58ea0c6abb 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFormLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VFormLayout.java @@ -19,6 +19,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; import com.google.gwt.aria.client.Roles; import com.google.gwt.dom.client.Element; @@ -90,8 +91,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<>(); - private HashMap<Widget, ErrorFlag> widgetToError = new HashMap<>(); + private Map<Widget, Caption> widgetToCaption = new HashMap<>(); + private Map<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 c8c6cce0f3..16ae5b46ed 100644 --- a/client/src/main/java/com/vaadin/client/ui/VGridLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VGridLayout.java @@ -19,6 +19,7 @@ package com.vaadin.client.ui; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Set; import com.google.gwt.dom.client.DivElement; @@ -52,7 +53,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<>(); + public Map<Widget, Cell> widgetToCell = new HashMap<>(); /** For internal use only. May be removed or replaced in the future. */ public int[] columnWidths; 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 63e0f687b1..f357a6049e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -96,7 +96,7 @@ public class VMenuBar extends SimpleFocusablePanel /** Widget fields **/ protected boolean subMenu; - protected ArrayList<CustomMenuItem> items; + protected List<CustomMenuItem> items; protected Element containerElement; protected VOverlay popup; protected VMenuBar visibleChildMenu; @@ -176,7 +176,8 @@ public class VMenuBar extends SimpleFocusablePanel protected void updateStyleNames() { String primaryStyleName = getParentMenu() != null - ? getParentMenu().getStylePrimaryName() : getStylePrimaryName(); + ? getParentMenu().getStylePrimaryName() + : getStylePrimaryName(); // Reset the style name for all the items for (CustomMenuItem item : items) { @@ -583,7 +584,8 @@ public class VMenuBar extends SimpleFocusablePanel * prefix if needed */ String primaryStyleName = parentMenu != null - ? parentMenu.getStylePrimaryName() : getStylePrimaryName(); + ? parentMenu.getStylePrimaryName() + : getStylePrimaryName(); if (subMenu) { primaryStyleName = primaryStyleName .replace(SUBMENU_CLASSNAME_PREFIX, ""); 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 2da458c7e9..f4c18dd865 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java +++ b/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import com.google.gwt.user.client.DOM; @@ -35,7 +36,7 @@ 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<>(); + protected final List<String> tabKeys = new ArrayList<>(); /** For internal use only. May be removed or replaced in the future. */ protected Set<String> disabledTabKeys = new HashSet<>(); 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 9e4aad0d2c..333050c9d9 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -80,7 +80,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<>(); + private static List<VWindow> windowOrder = new ArrayList<>(); private static HandlerManager WINDOW_ORDER_HANDLER = new HandlerManager( VWindow.class); @@ -307,7 +307,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } private void doFireOrderEvent() { - ArrayList<VWindow> list = new ArrayList<>(); + List<VWindow> list = new ArrayList<>(); list.add(this); fireOrderEvent(list); } @@ -701,7 +701,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, // hanging. windowOrder.remove(curIndex); // Update the z-indices of any remaining windows - ArrayList<VWindow> update = new ArrayList<>( + List<VWindow> update = new ArrayList<>( windowOrder.size() - curIndex + 1); update.add(this); while (curIndex < windowOrder.size()) { 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 b2127c5b94..1db1848f56 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 @@ -55,7 +55,7 @@ public class VDragEvent { private int id; - private HashMap<String, Object> dropDetails = new HashMap<>(); + private Map<String, Object> dropDetails = new HashMap<>(); private Element elementOver; 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 f33b71841d..24e239ca0d 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 @@ -17,6 +17,7 @@ package com.vaadin.client.ui.layout; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.logging.Logger; import com.google.gwt.core.client.JsArrayString; @@ -703,7 +704,7 @@ public class LayoutDependencyTree { public Collection<ComponentConnector> getMeasureTargets() { JsArrayString targetIds = getMeasureTargetsJsArray(); int length = targetIds.length(); - ArrayList<ComponentConnector> targets = new ArrayList<>(length); + List<ComponentConnector> targets = new ArrayList<>(length); ConnectorMap connectorMap = ConnectorMap.get(connection); for (int i = 0; i < length; i++) { 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 696ce2896d..099cf15489 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 @@ -74,7 +74,7 @@ public class MenuBar extends Widget implements PopupListener { private final Element table; private final Element outer; - private final ArrayList<MenuItem> items = new ArrayList<>(); + private final List<MenuItem> items = new ArrayList<>(); private MenuBar parentMenu; private PopupPanel popup; private MenuItem selectedItem; 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 5d49c6cbce..0176da6a4e 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 @@ -17,6 +17,7 @@ package com.vaadin.client.ui.tabsheet; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ComponentConnector; @@ -56,7 +57,7 @@ public abstract class TabsheetBaseConnector getWidget().setEnabled(isEnabled()); // Widgets in the TabSheet before update - ArrayList<Widget> oldWidgets = new ArrayList<>(); + List<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 c808ea6c9d..749d72b575 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 @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.logging.Logger; import com.google.gwt.core.client.Scheduler; @@ -137,7 +138,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector @Override public void onWindowOrderChange(WindowOrderEvent event) { VWindow[] windows = event.getWindows(); - HashMap<Integer, Connector> orders = new HashMap<>(); + Map<Integer, Connector> orders = new HashMap<>(); boolean hasEventListener = hasEventListener(EventId.WINDOW_ORDER); for (VWindow window : windows) { Connector connector = Util.findConnectorFor(window); @@ -406,8 +407,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } else if (toBeFocused instanceof Focusable) { ((Focusable) toBeFocused).focus(); } else { - getLogger() - .severe("Server is trying to set focus to the widget of connector " + getLogger().severe( + "Server is trying to set focus to the widget of connector " + Util.getConnectorString(connector) + " but it is not focusable. The widget should implement either " + com.google.gwt.user.client.ui.Focusable.class @@ -671,7 +672,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector * @return */ public List<WindowConnector> getSubWindows() { - ArrayList<WindowConnector> windows = new ArrayList<>(); + List<WindowConnector> windows = new ArrayList<>(); for (ComponentConnector child : getChildComponents()) { if (child instanceof WindowConnector) { windows.add((WindowConnector) child); @@ -1218,8 +1219,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector return window1.getWindowOrder() > window2.getWindowOrder() ? 1 : -1; } - ArrayList<VWindow> getWindows() { - ArrayList<VWindow> result = new ArrayList<>(); + List<VWindow> getWindows() { + List<VWindow> result = new ArrayList<>(); result.addAll(windows); Collections.sort(result, this); return result; 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 e93fe1d3a8..996741ddc5 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 @@ -30,13 +30,14 @@ import com.google.gwt.dom.client.TableRowElement; * * @since 7.4 * @author Vaadin Ltd - * @see com.vaadin.client.widgets.Escalator.AbstractRowContainer#refreshRow(TableRowElement, int) + * @see com.vaadin.client.widgets.Escalator.AbstractRowContainer#refreshRow(TableRowElement, + * int) */ public class FlyweightRow implements Row { static class CellIterator implements Iterator<FlyweightCell> { /** A defensive copy of the cells in the current row. */ - private final ArrayList<FlyweightCell> cells; + private final List<FlyweightCell> cells; private final boolean cellsAttached; private int cursor = 0; private int skipNext = 0; 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 ee432e0892..81c1ec86b3 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -1740,8 +1740,8 @@ public class Escalator extends Widget * @since 7.5.0 * * @param tr - * the row element to check whether it, - * or any of its its descendants can be frozen + * the row element to check whether it, or any of its its + * descendants can be frozen * @return <code>true</code> if the given element, or any of its * descendants, can be frozen */ @@ -3882,8 +3882,8 @@ public class Escalator extends Widget insertFirst = true; } else if (insertFirst) { // remove row explicitly to work around an IE11 bug (#9850) - if (BrowserInfo.get().isIE11() && tr - .equals(root.getFirstChildElement())) { + if (BrowserInfo.get().isIE11() + && tr.equals(root.getFirstChildElement())) { root.removeChild(tr); } root.insertFirst(tr); @@ -4553,11 +4553,11 @@ public class Escalator extends Widget } if (index < 0 || index + numberOfColumns > getColumnCount()) { - throw new IndexOutOfBoundsException( - "The given " + "column range (" + index + ".." - + (index + numberOfColumns) - + ") was outside of the current number of columns (" - + getColumnCount() + ")"); + throw new IndexOutOfBoundsException("The given " + + "column range (" + index + ".." + + (index + numberOfColumns) + + ") was outside of the current number of columns (" + + getColumnCount() + ")"); } header.refreshColumns(index, numberOfColumns); @@ -5054,7 +5054,7 @@ public class Escalator extends Widget public Collection<SpacerImpl> getSpacersAfterPx(final double px, final SpacerInclusionStrategy strategy) { - ArrayList<SpacerImpl> spacers = new ArrayList<>( + List<SpacerImpl> spacers = new ArrayList<>( rowIndexToSpacer.values()); for (int i = 0; i < spacers.size(); i++) { @@ -6511,7 +6511,8 @@ public class Escalator extends Widget double footerHeight = footer.getHeightOfSection(); double bodyHeight = body.getDefaultRowHeight() * heightByRows; double scrollbar = horizontalScrollbar.showsScrollHandle() - ? horizontalScrollbar.getScrollbarThickness() : 0; + ? horizontalScrollbar.getScrollbarThickness() + : 0; double spacerHeight = 0; // ignored if HeightMode.ROW if (heightMode == HeightMode.UNDEFINED) { spacerHeight = body.spacerContainer.getSpacerHeightsSum(); 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 81b050b63d..8198e34544 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -1630,8 +1630,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, } } }); - grid.scrollToRow(rowIndex, isBuffered() - ? ScrollDestination.MIDDLE : ScrollDestination.ANY); + grid.scrollToRow(rowIndex, + isBuffered() ? ScrollDestination.MIDDLE + : ScrollDestination.ANY); } } @@ -4041,7 +4042,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<>(); + private Map<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<>(); /** * When column is being hidden with a toggle, do not refresh toggles for @@ -4375,10 +4376,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, && dropMarkerLeft <= escalator.getInnerWidth()) { dropMarkerLeft = rightBoundaryForDrag - dropMarkerWidthOffset; } else if ( - // Check if the drop marker shouldn't be shown at all - dropMarkerLeft < frozenColumnsWidth - || dropMarkerLeft > Math.min(rightBoundaryForDrag, - escalator.getInnerWidth()) + // Check if the drop marker shouldn't be shown at all + dropMarkerLeft < frozenColumnsWidth || dropMarkerLeft > Math + .min(rightBoundaryForDrag, escalator.getInnerWidth()) || dropMarkerLeft < 0) { dropMarkerLeft = -10000000; } @@ -4533,7 +4533,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (focusedColumnIndex == draggedColumnIndex) { // move with the dragged column int adjustedDropIndex = latestColumnDropIndex > draggedColumnIndex - ? latestColumnDropIndex - 1 : latestColumnDropIndex; + ? latestColumnDropIndex - 1 + : latestColumnDropIndex; // remove hidden columns from indexing adjustedDropIndex = getVisibleColumns() .indexOf(getColumn(adjustedDropIndex)); @@ -6033,7 +6034,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (sortIndex > -1 && Grid.this.getSortOrder().size() > 1) { // Show sort order indicator if column is // sorted and other sorted columns also exists. - cellElement.setAttribute("sort-order", String.valueOf(sortIndex + 1)); + cellElement.setAttribute("sort-order", + String.valueOf(sortIndex + 1)); cellElement.setAttribute("aria-sort", "other"); } @@ -6624,7 +6626,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<>(); + List<Column<?, T>> visible = new ArrayList<>(); for (Column<?, T> c : columns) { if (!c.isHidden()) { visible.add(c); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/JavaScriptRendererConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/JavaScriptRendererConnector.java index 51071e2c50..1e2a72ec70 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/JavaScriptRendererConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/JavaScriptRendererConnector.java @@ -17,6 +17,7 @@ package com.vaadin.v7.client.connectors; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.logging.Logger; import com.google.gwt.core.client.JavaScriptObject; @@ -64,7 +65,7 @@ public class JavaScriptRendererConnector private static native JavaScriptObject createCellReferenceWrapper() /*-{ var reference = {}; - + var setProperty = function(name, getter, setter) { var descriptor = { get: getter @@ -74,25 +75,25 @@ public class JavaScriptRendererConnector } Object.defineProperty(reference, name, descriptor); }; - + setProperty("element", function() { return reference.target.@CellReference::getElement()(); }, null); - + setProperty("rowIndex", function() { return reference.target.@CellReference::getRowIndex()(); }, null); - + setProperty("columnIndex", function() { return reference.target.@CellReference::getColumnIndex()(); }, null); - + setProperty("colSpan", function() { return reference.target.@RendererCellReference::getColSpan()(); }, function(colSpan) { reference.target.@RendererCellReference::setColSpan(*)(colSpan); }); - + return reference; }-*/; @@ -230,8 +231,7 @@ public class JavaScriptRendererConnector JsArrayString events = getConsumedEvents( helper.getConnectorWrapper()); - ArrayList<String> list = new ArrayList<String>( - events.length()); + List<String> list = new ArrayList<String>(events.length()); for (int i = 0; i < events.length(); i++) { list.add(events.get(i)); } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java index 98b329f13d..b06a6347c9 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java @@ -73,7 +73,7 @@ public class RpcDataSourceConnector extends AbstractExtensionConnector { registerRpc(DataProviderRpc.class, new DataProviderRpc() { @Override public void setRowData(int firstRow, JsonArray rowArray) { - ArrayList<JsonObject> rows = new ArrayList<JsonObject>( + List<JsonObject> rows = new ArrayList<JsonObject>( rowArray.length()); for (int i = 0; i < rowArray.length(); i++) { JsonObject rowObject = rowArray.getObject(i); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java index 6264561954..7a5b7e0935 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java @@ -19,6 +19,7 @@ package com.vaadin.v7.client.ui; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import com.google.gwt.event.dom.client.ChangeEvent; @@ -137,7 +138,7 @@ public class VListSelect extends VOptionGroupBase { @Override protected String[] getSelectedItems() { - final ArrayList<String> selectedItemKeys = new ArrayList<String>(); + final List<String> selectedItemKeys = new ArrayList<String>(); for (int i = 0; i < select.getItemCount(); i++) { if (select.isItemSelected(i)) { selectedItemKeys.add(select.getValue(i)); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java index 7f8b268880..ff5541c88c 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java @@ -18,6 +18,7 @@ package com.vaadin.v7.client.ui; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.user.client.ui.ListBox; @@ -77,7 +78,7 @@ public class VNativeSelect extends VOptionGroupBase implements Field { @Override protected String[] getSelectedItems() { - final ArrayList<String> selectedItemKeys = new ArrayList<String>(); + final List<String> selectedItemKeys = new ArrayList<String>(); for (int i = 0; i < select.getItemCount(); i++) { if (select.isItemSelected(i)) { selectedItemKeys.add(select.getValue(i)); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java index 2140610559..e3d94b0d4a 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java @@ -114,12 +114,12 @@ public class VOptionGroup extends VOptionGroupBase * rebuilt (losing focus) if number of elements or their order is * changed. */ - HashMap<String, CheckBox> keysToOptions = new HashMap<String, CheckBox>(); + Map<String, CheckBox> keysToOptions = new HashMap<String, CheckBox>(); for (Map.Entry<CheckBox, String> entry : optionsToKeys.entrySet()) { keysToOptions.put(entry.getValue(), entry.getKey()); } - ArrayList<Widget> existingwidgets = new ArrayList<Widget>(); - ArrayList<Widget> newwidgets = new ArrayList<Widget>(); + List<Widget> existingwidgets = new ArrayList<Widget>(); + List<Widget> newwidgets = new ArrayList<Widget>(); // Get current order of elements for (Widget wid : panel) { diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java index cef3b1525d..9c9665d7ce 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java @@ -473,7 +473,7 @@ public class VScrollTable extends FlowPanel public Collection<SelectionRange> split(VScrollTableRow row) { assert row.isAttached(); - ArrayList<SelectionRange> ranges = new ArrayList<SelectionRange>(2); + List<SelectionRange> ranges = new ArrayList<SelectionRange>(2); int endOfFirstRange = row.getIndex() - 1; if (endOfFirstRange >= startRow.getIndex()) { @@ -677,7 +677,7 @@ public class VScrollTable extends FlowPanel * This map contains captions and icon urls for actions like: * "33_c" -> * "Edit" * "33_i" -> "http://dom.com/edit.png" */ - private final HashMap<Object, String> actionMap = new HashMap<Object, String>(); + private final Map<Object, String> actionMap = new HashMap<Object, String>(); private String[] visibleColOrder; private boolean initialContentReceived = false; private Element scrollPositionElement; @@ -3541,9 +3541,9 @@ public class VScrollTable extends FlowPanel private static final int WRAPPER_WIDTH = 900000; - ArrayList<Widget> visibleCells = new ArrayList<Widget>(); + List<Widget> visibleCells = new ArrayList<Widget>(); - HashMap<String, HeaderCell> availableCells = new HashMap<String, HeaderCell>(); + Map<String, HeaderCell> availableCells = new HashMap<String, HeaderCell>(); Element div = DOM.createDiv(); Element hTableWrapper = DOM.createDiv(); @@ -4100,7 +4100,7 @@ public class VScrollTable extends FlowPanel } // fire column resize events for all columns but the source of the // resize action, since an event will fire separately for this. - ArrayList<HeaderCell> columns = new ArrayList<HeaderCell>( + List<HeaderCell> columns = new ArrayList<HeaderCell>( availableCells.values()); columns.remove(source); sendColumnWidthUpdates(columns); @@ -4477,8 +4477,8 @@ public class VScrollTable extends FlowPanel private static final int WRAPPER_WIDTH = 900000; - ArrayList<Widget> visibleCells = new ArrayList<Widget>(); - HashMap<String, FooterCell> availableCells = new HashMap<String, FooterCell>(); + List<Widget> visibleCells = new ArrayList<Widget>(); + Map<String, FooterCell> availableCells = new HashMap<String, FooterCell>(); Element div = DOM.createDiv(); Element hTableWrapper = DOM.createDiv(); @@ -5486,7 +5486,7 @@ public class VScrollTable extends FlowPanel private static final int TOUCHSCROLL_TIMEOUT = 100; private static final int DRAGMODE_MULTIROW = 2; - protected ArrayList<Widget> childWidgets = new ArrayList<Widget>(); + protected List<Widget> childWidgets = new ArrayList<Widget>(); private boolean selected = false; protected final int rowKey; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java index e9ddb02487..acfbb02d70 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Set; import com.google.gwt.aria.client.ExpandedValue; @@ -138,13 +139,13 @@ public class VTree extends FocusElementPanel /** For internal use only. May be removed or replaced in the future. */ public MultiSelectMode multiSelectMode = MultiSelectMode.DEFAULT; - private final HashMap<String, TreeNode> keyToNode = new HashMap<String, TreeNode>(); + private final Map<String, TreeNode> keyToNode = new HashMap<String, TreeNode>(); /** * This map contains captions and icon urls for actions like: * "33_c" -> * "Edit" * "33_i" -> "http://dom.com/edit.png" */ - private final HashMap<String, String> actionMap = new HashMap<String, String>(); + private final Map<String, String> actionMap = new HashMap<String, String>(); /** For internal use only. May be removed or replaced in the future. */ public boolean immediate; @@ -326,7 +327,7 @@ public class VTree extends FocusElementPanel * @return A list of all root {@link TreeNode}s. */ protected List<TreeNode> getRootNodes() { - ArrayList<TreeNode> rootNodes = new ArrayList<TreeNode>(); + List<TreeNode> rootNodes = new ArrayList<TreeNode>(); for (int i = 0; i < body.getWidgetCount(); i++) { rootNodes.add((TreeNode) body.getWidget(i)); } @@ -2178,7 +2179,7 @@ public class VTree extends FocusElementPanel isExpandCollapse = true; } - ArrayList<Integer> positions = new ArrayList<Integer>(); + List<Integer> positions = new ArrayList<Integer>(); while (treeNode.getParentNode() != null) { positions.add(0, treeNode.getParentNode().getChildren().indexOf(treeNode)); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java index 70e8d1892f..cf8e379818 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java @@ -19,6 +19,7 @@ package com.vaadin.v7.client.ui; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import com.google.gwt.dom.client.Style.Overflow; @@ -250,7 +251,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, @Override protected String[] getSelectedItems() { - final ArrayList<String> selectedItemKeys = new ArrayList<String>(); + final List<String> selectedItemKeys = new ArrayList<String>(); for (int i = 0; i < selections.getItemCount(); i++) { selectedItemKeys.add(selections.getValue(i)); } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java index 4cfc7a2b19..dce1a4e84e 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java @@ -22,6 +22,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import com.google.gwt.core.shared.GWT; import com.google.gwt.dom.client.Element; @@ -90,8 +91,8 @@ public class CalendarConnector extends AbstractLegacyComponentConnector private CalendarServerRpc rpc = RpcProxy.create(CalendarServerRpc.class, this); - private final HashMap<String, String> actionMap = new HashMap<String, String>(); - private HashMap<Object, String> tooltips = new HashMap<Object, String>(); + private final Map<String, String> actionMap = new HashMap<String, String>(); + private Map<Object, String> tooltips = new HashMap<Object, String>(); private static final String DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG = "-ac"; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/FlyweightRow.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/FlyweightRow.java index f322a86eb9..5b133d794a 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/FlyweightRow.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/FlyweightRow.java @@ -30,14 +30,14 @@ import com.google.gwt.dom.client.TableRowElement; * * @since 7.4 * @author Vaadin Ltd - * @see com.vaadin.v7.client.widgets.Escalator.AbstractRowContainer#refreshRow(TableRowElement, int) - * Escalator.AbstractRowContainer#refreshRow(TableRowElement, int) + * @see com.vaadin.v7.client.widgets.Escalator.AbstractRowContainer#refreshRow(TableRowElement, + * int) Escalator.AbstractRowContainer#refreshRow(TableRowElement, int) */ public class FlyweightRow implements Row { static class CellIterator implements Iterator<FlyweightCell> { /** A defensive copy of the cells in the current row. */ - private final ArrayList<FlyweightCell> cells; + private final List<FlyweightCell> cells; private final boolean cellsAttached; private int cursor = 0; private int skipNext = 0; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java index a93360d77a..9751b0909f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java @@ -20,6 +20,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; +import java.util.List; import java.util.Set; import com.vaadin.client.data.DataSource.RowHandle; @@ -264,8 +265,8 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T> return rowHandlesToRows(deselectionBatch); } - private ArrayList<T> rowHandlesToRows(Collection<RowHandle<T>> rowHandles) { - ArrayList<T> rows = new ArrayList<T>(rowHandles.size()); + private List<T> rowHandlesToRows(Collection<RowHandle<T>> rowHandles) { + List<T> rows = new ArrayList<T>(rowHandles.size()); for (RowHandle<T> handle : rowHandles) { rows.add(handle.getRow()); } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java index b38cc404d8..759327f3ae 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java @@ -703,13 +703,13 @@ public class Escalator extends Widget /*-{ var vScroll = esc.@com.vaadin.v7.client.widgets.Escalator::verticalScrollbar; var vScrollElem = vScroll.@com.vaadin.v7.client.widget.escalator.ScrollbarBundle::getElement()(); - + var hScroll = esc.@com.vaadin.v7.client.widgets.Escalator::horizontalScrollbar; var hScrollElem = hScroll.@com.vaadin.v7.client.widget.escalator.ScrollbarBundle::getElement()(); - + return $entry(function(e) { var target = e.target; - + // in case the scroll event was native (i.e. scrollbars were dragged, or // the scrollTop/Left was manually modified), the bundles have old cache // values. We need to make sure that the caches are kept up to date. @@ -730,29 +730,29 @@ public class Escalator extends Widget return $entry(function(e) { var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; - + // Delta mode 0 is in pixels; we don't need to do anything... - + // A delta mode of 1 means we're scrolling by lines instead of pixels // We need to scale the number of lines by the default line height if(e.deltaMode === 1) { var brc = esc.@com.vaadin.v7.client.widgets.Escalator::body; deltaY *= brc.@com.vaadin.v7.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); } - + // Other delta modes aren't supported if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; - + // Print warning message esc.@com.vaadin.v7.client.widgets.Escalator::logWarning(*)(msg); } - + // IE8 has only delta y if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; } - + @com.vaadin.v7.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); }); }-*/; @@ -4521,11 +4521,11 @@ public class Escalator extends Widget } if (index < 0 || index + numberOfColumns > getColumnCount()) { - throw new IndexOutOfBoundsException( - "The given " + "column range (" + index + ".." - + (index + numberOfColumns) - + ") was outside of the current number of columns (" - + getColumnCount() + ")"); + throw new IndexOutOfBoundsException("The given " + + "column range (" + index + ".." + + (index + numberOfColumns) + + ") was outside of the current number of columns (" + + getColumnCount() + ")"); } header.refreshColumns(index, numberOfColumns); @@ -5022,7 +5022,7 @@ public class Escalator extends Widget public Collection<SpacerImpl> getSpacersAfterPx(final double px, final SpacerInclusionStrategy strategy) { - ArrayList<SpacerImpl> spacers = new ArrayList<SpacerImpl>( + List<SpacerImpl> spacers = new ArrayList<SpacerImpl>( rowIndexToSpacer.values()); for (int i = 0; i < spacers.size(); i++) { @@ -6499,7 +6499,8 @@ public class Escalator extends Widget double footerHeight = footer.getHeightOfSection(); double bodyHeight = body.getDefaultRowHeight() * heightByRows; double scrollbar = horizontalScrollbar.showsScrollHandle() - ? horizontalScrollbar.getScrollbarThickness() : 0; + ? horizontalScrollbar.getScrollbarThickness() + : 0; double spacerHeight = 0; // ignored if HeightMode.ROW if (heightMode == HeightMode.UNDEFINED) { spacerHeight = body.spacerContainer.getSpacerHeightsSum(); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java index fbd1b2a0cc..8b330ad603 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java @@ -1631,8 +1631,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, } } }); - grid.scrollToRow(rowIndex, isBuffered() - ? ScrollDestination.MIDDLE : ScrollDestination.ANY); + grid.scrollToRow(rowIndex, + isBuffered() ? ScrollDestination.MIDDLE + : ScrollDestination.ANY); } } @@ -4008,7 +4009,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<Column<?, T>, MenuItem>(); + private Map<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<Column<?, T>, MenuItem>(); /** * When column is being hidden with a toggle, do not refresh toggles for @@ -4331,10 +4332,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, && dropMarkerLeft <= escalator.getInnerWidth()) { dropMarkerLeft = rightBoundaryForDrag - dropMarkerWidthOffset; } else if ( - // Check if the drop marker shouldn't be shown at all - dropMarkerLeft < frozenColumnsWidth - || dropMarkerLeft > Math.min(rightBoundaryForDrag, - escalator.getInnerWidth()) + // Check if the drop marker shouldn't be shown at all + dropMarkerLeft < frozenColumnsWidth || dropMarkerLeft > Math + .min(rightBoundaryForDrag, escalator.getInnerWidth()) || dropMarkerLeft < 0) { dropMarkerLeft = -10000000; } @@ -4483,7 +4483,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (focusedColumnIndex == draggedColumnIndex) { // move with the dragged column int adjustedDropIndex = latestColumnDropIndex > draggedColumnIndex - ? latestColumnDropIndex - 1 : latestColumnDropIndex; + ? latestColumnDropIndex - 1 + : latestColumnDropIndex; // remove hidden columns from indexing adjustedDropIndex = getVisibleColumns() .indexOf(getColumn(adjustedDropIndex)); @@ -4609,7 +4610,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, } cellColumnIndex = cellColumnRightIndex - 1; } else { // can't drop inside a spanned cell, or this is the - // dragged cell + // dragged cell while (colspan > 1) { cellColumnIndex++; colspan--; @@ -6550,7 +6551,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>>(); + List<Column<?, T>> visible = new ArrayList<Column<?, T>>(); for (Column<?, T> c : columns) { if (!c.isHidden()) { visible.add(c); @@ -9201,8 +9202,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * * @since 7.6 * @param editorBuffered - * {@code true} to enable buffered editor, - * {@code false} to disable it + * {@code true} to enable buffered editor, {@code false} to + * disable it */ public void setEditorBuffered(boolean editorBuffered) { editor.setBuffered(editorBuffered); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/ContainerHelpers.java b/compatibility-server/src/main/java/com/vaadin/v7/data/ContainerHelpers.java index 1b80737546..51e1444b24 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/ContainerHelpers.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/ContainerHelpers.java @@ -29,7 +29,8 @@ import com.vaadin.v7.data.Container.Indexed; * * @since 7.0 * - * @deprecated As of 8.0, no direct replacement available, see {@link DataProvider} + * @deprecated As of 8.0, no direct replacement available, see + * {@link DataProvider} */ @Deprecated public class ContainerHelpers implements Serializable { @@ -87,16 +88,16 @@ public class ContainerHelpers implements Serializable { endIndex = container.size(); } - ArrayList<Object> rangeOfIds = new ArrayList<Object>(); + List<Object> rangeOfIds = new ArrayList<Object>(); for (int i = startIndex; i < endIndex; i++) { Object idByIndex = container.getIdByIndex(i); if (idByIndex == null) { - throw new RuntimeException( - "Unable to get item id for index: " + i - + " from container using Container.Indexed#getIdByIndex() " - + "even though container.size() > endIndex. " - + "Returned item id was null. " - + "Check your container implementation!"); + throw new RuntimeException("Unable to get item id for index: " + + i + + " from container using Container.Indexed#getIdByIndex() " + + "even though container.size() > endIndex. " + + "Returned item id was null. " + + "Check your container implementation!"); } rangeOfIds.add(idByIndex); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java b/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java index 154014707a..ff4779ee8e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/fieldgroup/FieldGroup.java @@ -40,10 +40,10 @@ import com.vaadin.v7.ui.Field; * FieldGroup provides an easy way of binding fields to data and handling * commits of these fields. * <p> - * The functionality of FieldGroup is similar to {@link com.vaadin.v7.ui.Form Form} but - * {@link FieldGroup} does not handle layouts in any way. The typical use case - * is to create a layout outside the FieldGroup and then use FieldGroup to bind - * the fields to a data source. + * The functionality of FieldGroup is similar to {@link com.vaadin.v7.ui.Form + * Form} but {@link FieldGroup} does not handle layouts in any way. The typical + * use case is to create a layout outside the FieldGroup and then use FieldGroup + * to bind the fields to a data source. * </p> * <p> * {@link FieldGroup} is not a UI component so it cannot be added to a layout. @@ -65,7 +65,7 @@ public class FieldGroup implements Serializable { private boolean enabled = true; private boolean readOnly = false; - private HashMap<Object, Field<?>> propertyIdToField = new HashMap<Object, Field<?>>(); + private Map<Object, Field<?>> propertyIdToField = new HashMap<Object, Field<?>>(); private LinkedHashMap<Field<?>, Object> fieldToPropertyId = new LinkedHashMap<Field<?>, Object>(); private List<CommitHandler> commitHandlers = new ArrayList<CommitHandler>(); @@ -1258,7 +1258,7 @@ public class FieldGroup implements Serializable { */ protected static List<java.lang.reflect.Field> getFieldsInDeclareOrder( Class searchClass) { - ArrayList<java.lang.reflect.Field> memberFieldInOrder = new ArrayList<java.lang.reflect.Field>(); + List<java.lang.reflect.Field> memberFieldInOrder = new ArrayList<java.lang.reflect.Field>(); while (searchClass != null) { for (java.lang.reflect.Field memberField : searchClass @@ -1284,4 +1284,4 @@ public class FieldGroup implements Serializable { } -}
\ No newline at end of file +} diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerHierarchicalWrapper.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerHierarchicalWrapper.java index 5ad3cee4c7..a4e9d74c53 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerHierarchicalWrapper.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerHierarchicalWrapper.java @@ -26,6 +26,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.LinkedList; +import java.util.Map; import com.vaadin.v7.data.Container; import com.vaadin.v7.data.Item; @@ -63,10 +64,10 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, private HashSet<Object> noChildrenAllowed = null; /** Mapping from Item ID to parent Item ID */ - private Hashtable<Object, Object> parent = null; + private Map<Object, Object> parent = null; /** Mapping from Item ID to a list of child IDs */ - private Hashtable<Object, LinkedList<Object>> children = null; + private Map<Object, LinkedList<Object>> children = null; /** List that contains all root elements of the container. */ private LinkedHashSet<Object> roots = null; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerOrderedWrapper.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerOrderedWrapper.java index 69f51fc884..f7da00acd9 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerOrderedWrapper.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/ContainerOrderedWrapper.java @@ -22,6 +22,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; import com.vaadin.data.provider.DataProvider; import com.vaadin.v7.data.Container; @@ -60,13 +61,13 @@ public class ContainerOrderedWrapper implements Container.Ordered, * Ordering information, i.e. the mapping from Item ID to the next item ID. * The last item id should not be present */ - private Hashtable<Object, Object> next; + private Map<Object, Object> next; /** * Reverse ordering information for convenience and performance reasons. The * first item id should not be present */ - private Hashtable<Object, Object> prev; + private Map<Object, Object> prev; /** * ID of the first Item in the container. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java index a0943bc7ce..aa504409db 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.LinkedList; +import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -53,23 +54,23 @@ public class HierarchicalContainer extends IndexedContainer /** * Mapping from Item ID to parent Item ID. */ - private final HashMap<Object, Object> parent = new HashMap<Object, Object>(); + private final Map<Object, Object> parent = new HashMap<Object, Object>(); /** * Mapping from Item ID to parent Item ID for items included in the filtered * container. */ - private HashMap<Object, Object> filteredParent = null; + private Map<Object, Object> filteredParent = null; /** * Mapping from Item ID to a list of child IDs. */ - private final HashMap<Object, LinkedList<Object>> children = new HashMap<Object, LinkedList<Object>>(); + private final Map<Object, LinkedList<Object>> children = new HashMap<Object, LinkedList<Object>>(); /** * Mapping from Item ID to a list of child IDs when filtered */ - private HashMap<Object, LinkedList<Object>> filteredChildren = null; + private Map<Object, LinkedList<Object>> filteredChildren = null; /** * List that contains all root elements of the container. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java index f91cb783fe..bd74a132b0 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import com.vaadin.data.provider.ListDataProvider; import com.vaadin.v7.data.Container; @@ -74,29 +75,29 @@ public class IndexedContainer /** * Linked list of ordered Property IDs. */ - private ArrayList<Object> propertyIds = new ArrayList<Object>(); + private List<Object> propertyIds = new ArrayList<Object>(); /** * Property ID to type mapping. */ - private Hashtable<Object, Class<?>> types = new Hashtable<Object, Class<?>>(); + private Map<Object, Class<?>> types = new Hashtable<Object, Class<?>>(); /** * Hash of Items, where each Item is implemented as a mapping from Property * ID to Property value. */ - private Hashtable<Object, Map<Object, Object>> items = new Hashtable<Object, Map<Object, Object>>(); + private Map<Object, Map<Object, Object>> items = new Hashtable<Object, Map<Object, Object>>(); /** * Set of properties that are read-only. */ - private HashSet<Property<?>> readOnlyProperties = new HashSet<Property<?>>(); + private Set<Property<?>> readOnlyProperties = new HashSet<Property<?>>(); /** * List of all Property value change event listeners listening all the * properties. */ - private LinkedList<Property.ValueChangeListener> propertyValueChangeListeners = null; + private List<Property.ValueChangeListener> propertyValueChangeListeners = null; /** * Data structure containing all listeners interested in changes to single @@ -104,9 +105,9 @@ public class IndexedContainer * hashtable that maps Item IDs to a linked list of listeners listening * Property identified by given Property ID and Item ID. */ - private Hashtable<Object, Map<Object, List<Property.ValueChangeListener>>> singlePropertyValueChangeListeners = null; + private Map<Object, Map<Object, List<Property.ValueChangeListener>>> singlePropertyValueChangeListeners; - private HashMap<Object, Object> defaultPropertyValues; + private Map<Object, Object> defaultPropertyValues; private int nextGeneratedItemId = 1; @@ -266,7 +267,7 @@ public class IndexedContainer * @param t * data table of added item */ - private void addDefaultValues(Hashtable<Object, Object> t) { + private void addDefaultValues(Map<Object, Object> t) { if (defaultPropertyValues != null) { for (Object key : defaultPropertyValues.keySet()) { t.put(key, defaultPropertyValues.get(key)); @@ -389,7 +390,7 @@ public class IndexedContainer @Override protected void registerNewItem(int index, Object newItemId, Item item) { - Hashtable<Object, Object> t = new Hashtable<Object, Object>(); + Map<Object, Object> t = new Hashtable<Object, Object>(); items.put(newItemId, t); addDefaultValues(t); } @@ -983,39 +984,39 @@ public class IndexedContainer final IndexedContainer nc = new IndexedContainer(); // Clone the shallow properties - nc.setAllItemIds(getAllItemIds() != null - ? (ListSet<Object>) ((ListSet<Object>) getAllItemIds()).clone() - : null); + nc.setAllItemIds( + getAllItemIds() != null ? new ListSet<Object>(getAllItemIds()) + : null); nc.setItemSetChangeListeners(getItemSetChangeListeners() != null ? new LinkedList<Container.ItemSetChangeListener>( getItemSetChangeListeners()) : null); nc.propertyIds = propertyIds != null - ? (ArrayList<Object>) propertyIds.clone() : null; + ? new ArrayList<Object>(propertyIds) + : null; nc.setPropertySetChangeListeners(getPropertySetChangeListeners() != null ? new LinkedList<Container.PropertySetChangeListener>( getPropertySetChangeListeners()) : null); nc.propertyValueChangeListeners = propertyValueChangeListeners != null - ? (LinkedList<Property.ValueChangeListener>) propertyValueChangeListeners - .clone() + ? new LinkedList<Property.ValueChangeListener>( + propertyValueChangeListeners) : null; nc.readOnlyProperties = readOnlyProperties != null - ? (HashSet<Property<?>>) readOnlyProperties.clone() : null; + ? new HashSet<Property<?>>(readOnlyProperties) + : null; nc.singlePropertyValueChangeListeners = singlePropertyValueChangeListeners != null - ? (Hashtable<Object, Map<Object, List<Property.ValueChangeListener>>>) singlePropertyValueChangeListeners - .clone() + ? new Hashtable<Object, Map<Object, List<Property.ValueChangeListener>>>( + singlePropertyValueChangeListeners) : null; - nc.types = types != null ? (Hashtable<Object, Class<?>>) types.clone() + nc.types = types != null ? new Hashtable<Object, Class<?>>(types) : null; - nc.setFilters( - (HashSet<Filter>) ((HashSet<Filter>) getFilters()).clone()); + nc.setFilters(new HashSet<Filter>(getFilters())); nc.setFilteredItemIds(getFilteredItemIds() == null ? null - : (ListSet<Object>) ((ListSet<Object>) getFilteredItemIds()) - .clone()); + : new ListSet<Object>(getFilteredItemIds())); // Clone property-values if (items == null) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/ListSet.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/ListSet.java index 7b7a4b7782..4c40c8c81a 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/ListSet.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/ListSet.java @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.Map; /** * ListSet is an internal Vaadin class which implements a combination of a List @@ -42,7 +43,7 @@ public class ListSet<E> extends ArrayList<E> { * Contains a map from an element to the number of duplicates it has. Used * to temporarily allow duplicates in the list. */ - private HashMap<E, Integer> duplicates = new HashMap<E, Integer>(); + private Map<E, Integer> duplicates = new HashMap<E, Integer>(); public ListSet() { super(); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java index d5ad5f4aef..81eb4eb00d 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java @@ -22,6 +22,7 @@ import java.util.EventObject; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; +import java.util.List; import java.util.Map; import com.vaadin.data.Binder; @@ -54,17 +55,17 @@ public class PropertysetItem /** * Mapping from property id to property. */ - private HashMap<Object, Property<?>> map = new HashMap<Object, Property<?>>(); + private Map<Object, Property<?>> map = new HashMap<Object, Property<?>>(); /** * List of all property ids to maintain the order. */ - private LinkedList<Object> list = new LinkedList<Object>(); + private List<Object> list = new LinkedList<Object>(); /** * List of property set modification listeners. */ - private LinkedList<Item.PropertySetChangeListener> propertySetChangeListeners = null; + private List<Item.PropertySetChangeListener> propertySetChangeListeners = null; /* Item methods */ @@ -307,12 +308,12 @@ public class PropertysetItem final PropertysetItem npsi = new PropertysetItem(); - npsi.list = list != null ? (LinkedList<Object>) list.clone() : null; + npsi.list = list != null ? new LinkedList<Object>(list) : null; npsi.propertySetChangeListeners = propertySetChangeListeners != null - ? (LinkedList<PropertySetChangeListener>) propertySetChangeListeners - .clone() + ? new LinkedList<PropertySetChangeListener>( + propertySetChangeListeners) : null; - npsi.map = (HashMap<Object, Property<?>>) map.clone(); + npsi.map = new HashMap<Object, Property<?>>(map); return npsi; } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainer.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainer.java index 070b15fc5c..5ff356cbfe 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainer.java @@ -313,7 +313,7 @@ public class SQLContainer implements Container, Container.Filterable, @Override public Collection<?> getItemIds() { updateCount(); - ArrayList<RowId> ids = new ArrayList<RowId>(); + List<RowId> ids = new ArrayList<RowId>(); ResultSet rs = null; try { // Load ALL rows :( @@ -542,7 +542,7 @@ public class SQLContainer implements Container, Container.Filterable, * {@inheritDoc} */ public void removeContainerFilters(Object propertyId) { - ArrayList<Filter> toRemove = new ArrayList<Filter>(); + List<Filter> toRemove = new ArrayList<Filter>(); for (Filter f : filters) { if (f.appliesToProperty(propertyId)) { toRemove.add(f); @@ -1322,7 +1322,7 @@ public class SQLContainer implements Container, Container.Filterable, } private List<RowItem> getFilteredAddedItems() { - ArrayList<RowItem> filtered = new ArrayList<RowItem>(addedItems); + List<RowItem> filtered = new ArrayList<RowItem>(addedItems); if (filters != null && !filters.isEmpty()) { for (RowItem item : addedItems) { if (!itemPassesFilters(item)) { @@ -1684,8 +1684,7 @@ public class SQLContainer implements Container, Container.Filterable, return refdCont.getItem(getReferencedItemId(itemId, refdCont)); } - private void writeObject(ObjectOutputStream out) - throws IOException { + private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java index b415c5ac51..3cfd95e489 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/TableQuery.java @@ -559,9 +559,11 @@ public class TableQuery extends AbstractTransactionalQuery null); if (!tables.next()) { String catalog = (catalogName != null) - ? catalogName.toUpperCase() : null; + ? catalogName.toUpperCase() + : null; String schema = (schemaName != null) - ? schemaName.toUpperCase() : null; + ? schemaName.toUpperCase() + : null; tables = dbmd.getTables(catalog, schema, tableName.toUpperCase(), null); if (!tables.next()) { @@ -680,7 +682,7 @@ public class TableQuery extends AbstractTransactionalQuery @Override public boolean containsRowWithKey(Object... keys) throws SQLException { - ArrayList<Filter> filtersAndKeys = new ArrayList<Filter>(); + List<Filter> filtersAndKeys = new ArrayList<Filter>(); if (filters != null) { filtersAndKeys.addAll(filters); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java index eada1aa02b..894936e1cd 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.vaadin.ui.AbstractListing; import org.jsoup.nodes.Element; import com.vaadin.event.Transferable; @@ -46,6 +45,7 @@ import com.vaadin.server.Resource; import com.vaadin.server.VaadinSession; import com.vaadin.shared.ui.dd.VerticalDropLocation; import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.AbstractListing; import com.vaadin.ui.Component; import com.vaadin.ui.LegacyComponent; import com.vaadin.ui.declarative.DesignAttributeHandler; @@ -245,12 +245,12 @@ public abstract class AbstractSelect extends AbstractField<Object> implements /** * Item icons. */ - private final HashMap<Object, Resource> itemIcons = new HashMap<Object, Resource>(); + private final Map<Object, Resource> itemIcons = new HashMap<Object, Resource>(); /** * Item captions. */ - private final HashMap<Object, String> itemCaptions = new HashMap<Object, String>(); + private final Map<Object, String> itemCaptions = new HashMap<Object, String>(); /** * Item caption mode. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java index b88ee7f5df..63a6118c58 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java @@ -114,12 +114,12 @@ public class Form extends AbstractField<Object> /** * Mapping from propertyName to corresponding field. */ - private final HashMap<Object, Field<?>> fields = new HashMap<Object, Field<?>>(); + private final Map<Object, Field<?>> fields = new HashMap<Object, Field<?>>(); /** * Form may act as an Item, its own properties are stored here. */ - private final HashMap<Object, Property<?>> ownProperties = new HashMap<Object, Property<?>>(); + private final Map<Object, Property<?>> ownProperties = new HashMap<Object, Property<?>>(); /** * Field factory for this form. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java index 82dc65774c..c99757ee04 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java @@ -410,37 +410,37 @@ public class Table extends AbstractSelect implements Action.Container, /** * Holds headers for visible columns (by propertyId). */ - private final HashMap<Object, String> columnHeaders = new HashMap<Object, String>(); + private final Map<Object, String> columnHeaders = new HashMap<Object, String>(); /** * Holds footers for visible columns (by propertyId). */ - private final HashMap<Object, String> columnFooters = new HashMap<Object, String>(); + private final Map<Object, String> columnFooters = new HashMap<Object, String>(); /** * Holds icons for visible columns (by propertyId). */ - private final HashMap<Object, Resource> columnIcons = new HashMap<Object, Resource>(); + private final Map<Object, Resource> columnIcons = new HashMap<Object, Resource>(); /** * Holds alignments for visible columns (by propertyId). */ - private HashMap<Object, Align> columnAlignments = new HashMap<Object, Align>(); + private Map<Object, Align> columnAlignments = new HashMap<Object, Align>(); /** * Holds column widths in pixels for visible columns (by propertyId). */ - private final HashMap<Object, Integer> columnWidths = new HashMap<Object, Integer>(); + private final Map<Object, Integer> columnWidths = new HashMap<Object, Integer>(); /** * Holds column expand rations for visible columns (by propertyId). */ - private final HashMap<Object, Float> columnExpandRatios = new HashMap<Object, Float>(); + private final Map<Object, Float> columnExpandRatios = new HashMap<Object, Float>(); /** * Holds column generators */ - private final HashMap<Object, ColumnGenerator> columnGenerators = new LinkedHashMap<Object, ColumnGenerator>(); + private final Map<Object, ColumnGenerator> columnGenerators = new LinkedHashMap<Object, ColumnGenerator>(); /** * Holds value of property pageLength. 0 disables paging. @@ -597,7 +597,7 @@ public class Table extends AbstractSelect implements Action.Container, private boolean painted = false; - private HashMap<Object, Converter<String, Object>> propertyValueConverters = new HashMap<Object, Converter<String, Object>>(); + private Map<Object, Converter<String, Object>> propertyValueConverters = new HashMap<Object, Converter<String, Object>>(); /** * Set to true if the client-side should be informed that the key mapper has @@ -895,7 +895,7 @@ public class Table extends AbstractSelect implements Action.Container, } // Resets the alignments - final HashMap<Object, Align> newCA = new HashMap<Object, Align>(); + final Map<Object, Align> newCA = new HashMap<Object, Align>(); int i = 0; for (final Iterator<Object> it = visibleColumns.iterator(); it.hasNext() && i < columnAlignments.length; i++) { @@ -3725,7 +3725,7 @@ public class Table extends AbstractSelect implements Action.Container, private void paintVisibleColumnOrder(PaintTarget target) { // Visible column order - final ArrayList<String> visibleColOrder = new ArrayList<String>(); + final List<String> visibleColOrder = new ArrayList<String>(); for (Object columnId : visibleColumns) { if (!isColumnCollapsed(columnId)) { visibleColOrder.add(columnIdMap.key(columnId)); @@ -3737,7 +3737,7 @@ public class Table extends AbstractSelect implements Action.Container, private Set<Action> findAndPaintBodyActions(PaintTarget target) { Set<Action> actionSet = new LinkedHashSet<Action>(); if (actionHandlers != null) { - final ArrayList<String> keys = new ArrayList<String>(); + final List<String> keys = new ArrayList<String>(); for (Handler ah : actionHandlers) { // Getting actions for the null item, which in this case means // the body item @@ -3955,7 +3955,7 @@ public class Table extends AbstractSelect implements Action.Container, // Actions if (actionHandlers != null) { - final ArrayList<String> keys = new ArrayList<String>(); + final List<String> keys = new ArrayList<String>(); for (Handler ah : actionHandlers) { final Action[] aa = ah.getActions(itemId, this); if (aa != null) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java index cba3dd45da..6b3a4497c8 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java @@ -25,6 +25,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; @@ -122,7 +123,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, /** * Item icons alt texts. */ - private final HashMap<Object, String> itemIconAlts = new HashMap<Object, String>(); + private final Map<Object, String> itemIconAlts = new HashMap<Object, String>(); /** * Set of expanded nodes. @@ -691,7 +692,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, * by right clicking on the Tree body */ if (actionHandlers != null) { - final ArrayList<String> keys = new ArrayList<String>(); + final List<String> keys = new ArrayList<String>(); for (Handler ah : actionHandlers) { // Getting action for the null item, which in this case @@ -778,7 +779,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, // Actions if (actionHandlers != null) { - final ArrayList<String> keys = new ArrayList<String>(); + final List<String> keys = new ArrayList<String>(); final Iterator<Action.Handler> ahi = actionHandlers .iterator(); while (ahi.hasNext()) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/event/BasicEventProvider.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/event/BasicEventProvider.java index 99383c165c..e84a8384f8 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/event/BasicEventProvider.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/event/BasicEventProvider.java @@ -59,7 +59,7 @@ public class BasicEventProvider implements CalendarEditableEventProvider, */ @Override public List<CalendarEvent> getEvents(Date startDate, Date endDate) { - ArrayList<CalendarEvent> activeEvents = new ArrayList<CalendarEvent>(); + List<CalendarEvent> activeEvents = new ArrayList<CalendarEvent>(); for (CalendarEvent ev : eventList) { long from = startDate.getTime(); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/PerformanceTestIndexedContainerTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/PerformanceTestIndexedContainerTest.java index a22b704b84..78ff4e9b9f 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/PerformanceTestIndexedContainerTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/PerformanceTestIndexedContainerTest.java @@ -3,6 +3,7 @@ package com.vaadin.v7.data.util; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.List; import java.util.SortedSet; import java.util.TreeSet; @@ -113,7 +114,7 @@ public class PerformanceTestIndexedContainerTest { } private Long median(Collection<Long> times) { - ArrayList<Long> list = new ArrayList<Long>(times); + List<Long> list = new ArrayList<Long>(times); Collections.sort(list); // not exact median in some cases, but good enough return list.get(list.size() / 2); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/ColumnPropertyTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/ColumnPropertyTest.java index ce6398b50a..7392674fce 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/ColumnPropertyTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/ColumnPropertyTest.java @@ -6,6 +6,7 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.easymock.EasyMock; import org.junit.Assert; @@ -301,7 +302,7 @@ public class ColumnPropertyTest { // Here we really don't care about the container management, but in // order to set the value for a column the owner (RowItem) must be set // and to create the owner we must have a container... - ArrayList<ColumnProperty> properties = new ArrayList<ColumnProperty>(); + List<ColumnProperty> properties = new ArrayList<ColumnProperty>(); properties.add(property); SQLContainer container = EasyMock.createNiceMock(SQLContainer.class); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java index 4318295547..e04b6fc643 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTableQueryTest.java @@ -163,7 +163,7 @@ public class SQLContainerTableQueryTest { @Test public void propertyIdsAreFetched() { - ArrayList<String> propertyIds = new ArrayList<String>( + List<String> propertyIds = new ArrayList<String>( (Collection<? extends String>) container .getContainerPropertyIds()); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java index f858bde4ac..fe344cf8ef 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainerTest.java @@ -1649,7 +1649,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformQueryDelegate delegate = EasyMock .createMock(FreeformQueryDelegate.class); - final ArrayList<OrderBy> orderBys = new ArrayList<OrderBy>(); + final List<OrderBy> orderBys = new ArrayList<OrderBy>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setFilters(EasyMock.isA(List.class)); @@ -1767,7 +1767,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformQueryDelegate delegate = EasyMock .createMock(FreeformQueryDelegate.class); - final ArrayList<OrderBy> orderBys = new ArrayList<OrderBy>(); + final List<OrderBy> orderBys = new ArrayList<OrderBy>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setFilters(EasyMock.isA(List.class)); @@ -1878,7 +1878,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformStatementDelegate delegate = EasyMock .createMock(FreeformStatementDelegate.class); - final ArrayList<Filter> filters = new ArrayList<Filter>(); + final List<Filter> filters = new ArrayList<Filter>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setOrderBy(EasyMock.isA(List.class)); @@ -1949,7 +1949,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformStatementDelegate delegate = EasyMock .createMock(FreeformStatementDelegate.class); - final ArrayList<Filter> filters = new ArrayList<Filter>(); + final List<Filter> filters = new ArrayList<Filter>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setOrderBy(null); @@ -2019,7 +2019,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformStatementDelegate delegate = EasyMock .createMock(FreeformStatementDelegate.class); - final ArrayList<Filter> filters = new ArrayList<Filter>(); + final List<Filter> filters = new ArrayList<Filter>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setOrderBy(EasyMock.isA(List.class)); @@ -2090,7 +2090,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformStatementDelegate delegate = EasyMock .createMock(FreeformStatementDelegate.class); - final ArrayList<Filter> filters = new ArrayList<Filter>(); + final List<Filter> filters = new ArrayList<Filter>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setOrderBy(EasyMock.isA(List.class)); @@ -2167,7 +2167,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformStatementDelegate delegate = EasyMock .createMock(FreeformStatementDelegate.class); - final ArrayList<Filter> filters = new ArrayList<Filter>(); + final List<Filter> filters = new ArrayList<Filter>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setOrderBy(EasyMock.isA(List.class)); @@ -2244,7 +2244,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformStatementDelegate delegate = EasyMock .createMock(FreeformStatementDelegate.class); - final ArrayList<Filter> filters = new ArrayList<Filter>(); + final List<Filter> filters = new ArrayList<Filter>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setOrderBy(EasyMock.isA(List.class)); @@ -2353,7 +2353,7 @@ public class SQLContainerTest { connectionPool, "ID"); FreeformQueryDelegate delegate = EasyMock .createMock(FreeformQueryDelegate.class); - final ArrayList<OrderBy> orderBys = new ArrayList<OrderBy>(); + final List<OrderBy> orderBys = new ArrayList<OrderBy>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setFilters(EasyMock.isA(List.class)); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/TicketTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/TicketTest.java index 34cc791c7a..cd8ad96e9a 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/TicketTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/TicketTest.java @@ -56,7 +56,7 @@ public class TicketTest { Arrays.asList("ID"), connectionPool); FreeformStatementDelegate delegate = EasyMock .createMock(FreeformStatementDelegate.class); - final ArrayList<Filter> filters = new ArrayList<Filter>(); + final List<Filter> filters = new ArrayList<Filter>(); delegate.setFilters(null); EasyMock.expectLastCall().anyTimes(); delegate.setOrderBy(EasyMock.isA(List.class)); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQueryTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQueryTest.java index 04d357c71c..ea65310fc4 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQueryTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/FreeformQueryTest.java @@ -259,7 +259,7 @@ public class FreeformQueryTest { public void setFilters_noDelegate_shouldFail() { FreeformQuery query = new FreeformQuery("SELECT * FROM people", Arrays.asList("ID"), connectionPool); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Like("name", "%lle")); query.setFilters(filters); } diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/QueryBuilderTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/QueryBuilderTest.java index 834329b3d2..b01af9b9ad 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/QueryBuilderTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/query/QueryBuilderTest.java @@ -1,6 +1,7 @@ package com.vaadin.v7.data.util.sqlcontainer.query; import java.util.ArrayList; +import java.util.List; import org.easymock.EasyMock; import org.junit.Assert; @@ -200,7 +201,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_listOfFilters() { StatementHelper sh = mockedStatementHelper("%lle", 18); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Like("NAME", "%lle")); filters.add(new Greater("AGE", 18)); Assert.assertEquals(" WHERE \"NAME\" LIKE ? AND \"AGE\" > ?", @@ -211,7 +212,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_oneAndFilter() { StatementHelper sh = mockedStatementHelper("%lle", 18); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new And(new Like("NAME", "%lle"), new Greater("AGE", 18))); Assert.assertEquals(" WHERE (\"NAME\" LIKE ? AND \"AGE\" > ?)", QueryBuilder.getWhereStringForFilters(filters, sh)); @@ -221,7 +222,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_oneOrFilter() { StatementHelper sh = mockedStatementHelper("%lle", 18); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Or(new Like("NAME", "%lle"), new Greater("AGE", 18))); Assert.assertEquals(" WHERE (\"NAME\" LIKE ? OR \"AGE\" > ?)", QueryBuilder.getWhereStringForFilters(filters, sh)); @@ -231,7 +232,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_complexCompoundFilters() { StatementHelper sh = mockedStatementHelper("%lle", 18, 65, "Pelle"); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Or( new And(new Like("NAME", "%lle"), new Or(new Less("AGE", 18), new Greater("AGE", 65))), @@ -246,7 +247,7 @@ public class QueryBuilderTest { public void getWhereStringForFilters_complexCompoundFiltersAndSingleFilter() { StatementHelper sh = mockedStatementHelper("%lle", 18, 65, "Pelle", "Virtanen"); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Or( new And(new Like("NAME", "%lle"), new Or(new Less("AGE", 18), new Greater("AGE", 65))), @@ -260,7 +261,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_emptyList_shouldReturnEmptyString() { - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); Assert.assertEquals("", QueryBuilder.getWhereStringForFilters(filters, new StatementHelper())); } @@ -268,7 +269,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_NotFilter() { StatementHelper sh = mockedStatementHelper(18); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Not(new Equal("AGE", 18))); Assert.assertEquals(" WHERE NOT \"AGE\" = ?", QueryBuilder.getWhereStringForFilters(filters, sh)); @@ -278,7 +279,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_complexNegatedFilter() { StatementHelper sh = mockedStatementHelper(65, 18); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add( new Not(new Or(new Equal("AGE", 65), new Equal("AGE", 18)))); Assert.assertEquals(" WHERE NOT (\"AGE\" = ? OR \"AGE\" = ?)", @@ -288,7 +289,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_isNull() { - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new IsNull("NAME")); Assert.assertEquals(" WHERE \"NAME\" IS NULL", QueryBuilder .getWhereStringForFilters(filters, new StatementHelper())); @@ -296,7 +297,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_isNotNull() { - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Not(new IsNull("NAME"))); Assert.assertEquals(" WHERE \"NAME\" IS NOT NULL", QueryBuilder .getWhereStringForFilters(filters, new StatementHelper())); @@ -305,7 +306,7 @@ public class QueryBuilderTest { @Test public void getWhereStringForFilters_customStringDecorator() { QueryBuilder.setStringDecorator(new StringDecorator("[", "]")); - ArrayList<Filter> filters = new ArrayList<Filter>(); + List<Filter> filters = new ArrayList<Filter>(); filters.add(new Not(new IsNull("NAME"))); Assert.assertEquals(" WHERE [NAME] IS NOT NULL", QueryBuilder .getWhereStringForFilters(filters, new StatementHelper())); diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TablePropertyValueConverterTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TablePropertyValueConverterTest.java index 4e59d432a0..09ace47f3d 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TablePropertyValueConverterTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/table/TablePropertyValueConverterTest.java @@ -21,9 +21,9 @@ import static org.junit.Assert.fail; import java.lang.reflect.Field; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.Locale; +import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -347,7 +347,7 @@ public class TablePropertyValueConverterTest { Field f = Table.class .getDeclaredField("propertyValueConverters"); f.setAccessible(true); - HashMap<Object, Converter<String, Object>> pvc = (HashMap<Object, Converter<String, Object>>) f + Map<Object, Converter<String, Object>> pvc = (Map<Object, Converter<String, Object>>) f .get(this); Set<Object> currentConverters = new HashSet<Object>(); for (Entry<Object, Converter<String, Object>> entry : pvc diff --git a/compatibility-server/src/test/java/com/vaadin/v7/ui/AbsSelectTest.java b/compatibility-server/src/test/java/com/vaadin/v7/ui/AbsSelectTest.java index 518ee484cc..635ba4e0e2 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/ui/AbsSelectTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/ui/AbsSelectTest.java @@ -17,6 +17,7 @@ package com.vaadin.v7.ui; import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import org.junit.Assert; import org.junit.Test; @@ -49,7 +50,7 @@ public class AbsSelectTest { @Test public void addItemsStringList() { - ArrayList<String> itemIds = new ArrayList<String>(); + List<String> itemIds = new ArrayList<String>(); itemIds.add("foo"); itemIds.add("bar"); itemIds.add("baz"); @@ -65,7 +66,7 @@ public class AbsSelectTest { Object o1 = new Object(); Object o2 = new Object(); Object o3 = new Object(); - ArrayList<Object> itemIds = new ArrayList<Object>(); + List<Object> itemIds = new ArrayList<Object>(); itemIds.add(o1); itemIds.add(o2); itemIds.add(o3); diff --git a/server/src/main/java/com/vaadin/data/Binder.java b/server/src/main/java/com/vaadin/data/Binder.java index 0ec15c2345..b57e76571d 100644 --- a/server/src/main/java/com/vaadin/data/Binder.java +++ b/server/src/main/java/com/vaadin/data/Binder.java @@ -423,9 +423,11 @@ public class Binder<BEAN> implements Serializable { TARGET nullRepresentation) { return withConverter( fieldValue -> Objects.equals(fieldValue, nullRepresentation) - ? null : fieldValue, + ? null + : fieldValue, modelValue -> Objects.isNull(modelValue) - ? nullRepresentation : modelValue); + ? nullRepresentation + : modelValue); } /** @@ -2157,7 +2159,8 @@ public class Binder<BEAN> implements Serializable { Converter<FIELDVALUE, FIELDVALUE> nullRepresentationConverter = Converter .from(fieldValue -> fieldValue, modelValue -> Objects.isNull(modelValue) - ? field.getEmptyValue() : modelValue, + ? field.getEmptyValue() + : modelValue, exception -> exception.getMessage()); ConverterDelegate<FIELDVALUE> converter = new ConverterDelegate<>( nullRepresentationConverter); @@ -2382,7 +2385,7 @@ public class Binder<BEAN> implements Serializable { * @return list of all fields in the class considering hierarchy */ private List<Field> getFieldsInDeclareOrder(Class<?> searchClass) { - ArrayList<Field> memberFieldInOrder = new ArrayList<>(); + List<Field> memberFieldInOrder = new ArrayList<>(); while (searchClass != null) { memberFieldInOrder 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 3ede6a20e0..0453337c5d 100644 --- a/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java +++ b/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java @@ -32,7 +32,7 @@ import com.vaadin.ui.dnd.event.DropEvent; @SuppressWarnings("serial") public class TargetDetailsImpl implements TargetDetails { - private HashMap<String, Object> data = new HashMap<>(); + private Map<String, Object> data = new HashMap<>(); private DropTarget dropTarget; protected TargetDetailsImpl(Map<String, Object> rawDropData) { diff --git a/server/src/main/java/com/vaadin/server/KeyMapper.java b/server/src/main/java/com/vaadin/server/KeyMapper.java index d20eb7c605..08d36458d3 100644 --- a/server/src/main/java/com/vaadin/server/KeyMapper.java +++ b/server/src/main/java/com/vaadin/server/KeyMapper.java @@ -34,9 +34,9 @@ public class KeyMapper<V> implements DataKeyMapper<V>, Serializable { private int lastKey = 0; - private final HashMap<Object, String> objectIdKeyMap = new HashMap<>(); + private final Map<Object, String> objectIdKeyMap = new HashMap<>(); - private final HashMap<String, V> keyObjectMap = new HashMap<>(); + private final Map<String, V> keyObjectMap = new HashMap<>(); private ValueProvider<V, Object> identifierGetter; diff --git a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java index 4524442531..bb8d8cd4d5 100644 --- a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java +++ b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java @@ -59,7 +59,7 @@ import elemental.json.JsonValue; public class LegacyCommunicationManager implements Serializable { // TODO Refactor (#11410) - private final HashMap<Integer, ClientCache> uiToClientCache = new HashMap<>(); + private final Map<Integer, ClientCache> uiToClientCache = new HashMap<>(); /** * The session this communication manager is used for @@ -323,7 +323,7 @@ public class LegacyCommunicationManager implements Serializable { } } - private final HashMap<Class<? extends ClientConnector>, Integer> typeToKey = new HashMap<>(); + private final Map<Class<? extends ClientConnector>, Integer> typeToKey = new HashMap<>(); private int nextTypeKey = 0; /** diff --git a/server/src/main/java/com/vaadin/server/VaadinService.java b/server/src/main/java/com/vaadin/server/VaadinService.java index ba54ad014f..f4e1972c3e 100644 --- a/server/src/main/java/com/vaadin/server/VaadinService.java +++ b/server/src/main/java/com/vaadin/server/VaadinService.java @@ -115,7 +115,8 @@ public abstract class VaadinService implements Serializable { private static final String REQUEST_START_TIME_ATTRIBUTE = "requestStartTime"; /** - * Should never be used directly, always use {@link #getDeploymentConfiguration()} + * Should never be used directly, always use + * {@link #getDeploymentConfiguration()} */ private final DeploymentConfiguration deploymentConfiguration; @@ -265,7 +266,7 @@ public abstract class VaadinService implements Serializable { */ protected List<RequestHandler> createRequestHandlers() throws ServiceException { - ArrayList<RequestHandler> handlers = new ArrayList<>(); + List<RequestHandler> handlers = new ArrayList<>(); handlers.add(new SessionRequestHandler()); handlers.add(new PublishedFileHandler()); handlers.add(new HeartbeatHandler()); @@ -375,8 +376,7 @@ public abstract class VaadinService implements Serializable { /** * Gets the deployment configuration. Should be overridden (or otherwise - * intercepted) if the no-arg constructor is used in order to prevent - * NPEs. + * intercepted) if the no-arg constructor is used in order to prevent NPEs. * * @return the deployment configuration */ @@ -530,7 +530,7 @@ public abstract class VaadinService implements Serializable { if (session.getState() == State.OPEN) { closeSession(session); } - ArrayList<UI> uis = new ArrayList<>(session.getUIs()); + List<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { ui.accessSynchronously(() -> { /* @@ -1126,8 +1126,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<>( - attributeNames.size() * 2); + Map<String, Object> attrs = new HashMap<>(attributeNames.size() * 2); for (String name : attributeNames) { Object value = oldSession.getAttribute(name); if (value instanceof VaadinSession) { @@ -1266,7 +1265,7 @@ public abstract class VaadinService implements Serializable { * @param session */ private void removeClosedUIs(final VaadinSession session) { - ArrayList<UI> uis = new ArrayList<>(session.getUIs()); + List<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { if (ui.isClosing()) { ui.accessSynchronously(() -> { 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 f2caf5631c..38c7e4db5f 100644 --- a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java @@ -501,8 +501,7 @@ public class ServerRpcHandler implements Serializable { ConnectorTracker connectorTracker, JsonArray invocationsJson, int lastSyncIdSeenByClient) { int invocationCount = invocationsJson.length(); - ArrayList<MethodInvocation> invocations = new ArrayList<>( - invocationCount); + List<MethodInvocation> invocations = new ArrayList<>(invocationCount); MethodInvocation previousInvocation = null; // parse JSON to MethodInvocations 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 3700e67c36..18c1135dee 100644 --- a/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java @@ -17,6 +17,7 @@ package com.vaadin.server.communication; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import com.vaadin.server.RequestHandler; import com.vaadin.server.VaadinRequest; @@ -52,7 +53,7 @@ public class SessionRequestHandler implements RequestHandler { VaadinResponse response) throws IOException { // Use a copy to avoid ConcurrentModificationException session.lock(); - ArrayList<RequestHandler> requestHandlers; + List<RequestHandler> requestHandlers; try { requestHandlers = new ArrayList<>(session.getRequestHandlers()); } finally { 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 92b6e8e8bd..cdcb587b01 100644 --- a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java @@ -89,7 +89,7 @@ public class UidlWriter implements Serializable { getLogger().log(Level.FINE, "* Creating response to client"); while (true) { - ArrayList<ClientConnector> connectorsToProcess = new ArrayList<>(); + List<ClientConnector> connectorsToProcess = new ArrayList<>(); for (ClientConnector c : uiConnectorTracker .getDirtyVisibleConnectors()) { if (!processedConnectors.contains(c)) { @@ -138,7 +138,8 @@ public class UidlWriter implements Serializable { int syncId = service.getDeploymentConfiguration() .isSyncIdCheckEnabled() - ? uiConnectorTracker.getCurrentSyncId() : -1; + ? uiConnectorTracker.getCurrentSyncId() + : -1; writer.write("\"" + ApplicationConstants.SERVER_SYNC_ID + "\": " + syncId + ", "); if (repaintAll) { 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 f93803de99..65e3413122 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -58,8 +58,8 @@ public class ClassPathExplorer { /** * File filter that only accepts directories. */ - private static final FileFilter DIRECTORIES_ONLY = (File f) -> - f.exists() && f.isDirectory(); + private static final FileFilter DIRECTORIES_ONLY = (File f) -> f.exists() + && f.isDirectory(); /** * Contains information about widgetsets and themes found on the classpath @@ -525,7 +525,7 @@ public class ClassPathExplorer { public static URL getWidgetsetSourceDirectory(String widgetsetFileName) { if (debug) { debug("classpathLocations values:"); - ArrayList<String> locations = new ArrayList<>( + List<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/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index f74f2141da..2c9c40e668 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -427,7 +427,7 @@ public abstract class AbstractComponent extends AbstractClientConnector return false; } return !(getParent() instanceof SelectiveRenderer) - || ((SelectiveRenderer) getParent()).isRendered(this); + || ((SelectiveRenderer) getParent()).isRendered(this); } /* @@ -1251,7 +1251,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * implementation */ protected Collection<String> getCustomAttributes() { - ArrayList<String> l = new ArrayList<>(Arrays.asList(customAttributes)); + List<String> l = new ArrayList<>(Arrays.asList(customAttributes)); if (this instanceof Focusable) { l.add("tab-index"); l.add("tabindex"); @@ -1259,10 +1259,10 @@ public abstract class AbstractComponent extends AbstractClientConnector return l; } - private static final String[] customAttributes = { "width", - "height", "debug-id", "error", "width-auto", "height-auto", - "width-full", "height-full", "size-auto", "size-full", "immediate", - "locale", "read-only", "_id" }; + private static final String[] customAttributes = { "width", "height", + "debug-id", "error", "width-auto", "height-auto", "width-full", + "height-full", "size-auto", "size-full", "immediate", "locale", + "read-only", "_id" }; /* * (non-Javadoc) @@ -1288,9 +1288,11 @@ public abstract class AbstractComponent extends AbstractClientConnector writeSize(attr, def); // handle component error String errorMsg = getComponentError() != null - ? getComponentError().getFormattedHtmlMessage() : null; + ? getComponentError().getFormattedHtmlMessage() + : null; String defErrorMsg = def.getComponentError() != null - ? def.getComponentError().getFormattedHtmlMessage() : null; + ? def.getComponentError().getFormattedHtmlMessage() + : null; if (!SharedUtil.equals(errorMsg, defErrorMsg)) { attr.put("error", errorMsg); } diff --git a/server/src/main/java/com/vaadin/ui/AbstractMedia.java b/server/src/main/java/com/vaadin/ui/AbstractMedia.java index 800f5dca31..b83f25acc4 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMedia.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMedia.java @@ -153,7 +153,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @return The sources pointed to in this media. */ public List<Resource> getSources() { - ArrayList<Resource> sources = new ArrayList<>(); + List<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/ConnectorTracker.java b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java index 1bd9f81892..7b6002008d 100644 --- a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java @@ -67,7 +67,7 @@ import elemental.json.JsonObject; */ public class ConnectorTracker implements Serializable { - private final HashMap<String, ClientConnector> connectorIdToConnector = new HashMap<>(); + private final Map<String, ClientConnector> connectorIdToConnector = new HashMap<>(); private final Set<ClientConnector> dirtyConnectors = new HashSet<>(); private final Set<ClientConnector> uninitializedConnectors = new HashSet<>(); @@ -729,12 +729,11 @@ public class ConnectorTracker implements Serializable { } /* Special serialization to JsonObjects which are not serializable */ - private void writeObject(ObjectOutputStream out) - throws IOException { + private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); // Convert JsonObjects in diff state to String representation as // JsonObject is not serializable - HashMap<ClientConnector, String> stringDiffStates = new HashMap<>( + Map<ClientConnector, String> stringDiffStates = new HashMap<>( diffStates.size() * 2); for (ClientConnector key : diffStates.keySet()) { stringDiffStates.put(key, diffStates.get(key).toString()); @@ -751,7 +750,7 @@ public class ConnectorTracker implements Serializable { // JsonObject is not serializable diffStates = new HashMap<>(); @SuppressWarnings("unchecked") - HashMap<ClientConnector, String> stringDiffStates = (HashMap<ClientConnector, String>) in + Map<ClientConnector, String> stringDiffStates = (HashMap<ClientConnector, String>) in .readObject(); diffStates = new HashMap<>(stringDiffStates.size() * 2); for (ClientConnector key : stringDiffStates.keySet()) { diff --git a/server/src/main/java/com/vaadin/ui/CustomLayout.java b/server/src/main/java/com/vaadin/ui/CustomLayout.java index d44a02f52e..76107d7992 100644 --- a/server/src/main/java/com/vaadin/ui/CustomLayout.java +++ b/server/src/main/java/com/vaadin/ui/CustomLayout.java @@ -73,7 +73,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { /** * Custom layout slots containing the components. */ - private final HashMap<String, Component> slots = new HashMap<>(); + private final Map<String, Component> slots = new HashMap<>(); /** * Default constructor only used by subclasses. Subclasses are responsible diff --git a/server/src/main/java/com/vaadin/ui/Flash.java b/server/src/main/java/com/vaadin/ui/Flash.java index ced6d0bbad..affda1a372 100644 --- a/server/src/main/java/com/vaadin/ui/Flash.java +++ b/server/src/main/java/com/vaadin/ui/Flash.java @@ -18,6 +18,7 @@ package com.vaadin.ui; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.jsoup.nodes.Element; @@ -238,7 +239,7 @@ public class Flash extends AbstractEmbedded { super.writeDesign(design, designContext); // Parameters, in alphabetic order - ArrayList<String> paramNames = new ArrayList<>(); + List<String> paramNames = new ArrayList<>(); for (String param : getParameterNames()) { paramNames.add(param); } diff --git a/server/src/main/java/com/vaadin/ui/LoginForm.java b/server/src/main/java/com/vaadin/ui/LoginForm.java index 01f64665bd..771e353f3e 100644 --- a/server/src/main/java/com/vaadin/ui/LoginForm.java +++ b/server/src/main/java/com/vaadin/ui/LoginForm.java @@ -345,7 +345,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<>(); + Map<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/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index ac3a22eb41..8cbd41ccc2 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -110,7 +110,7 @@ public class TabSheet extends AbstractComponentContainer /** * Map containing information related to the tabs (caption, icon etc). */ - private final HashMap<Component, Tab> tabs = new HashMap<>(); + private final Map<Component, Tab> tabs = new HashMap<>(); /** * Selected tab content component. @@ -1323,7 +1323,6 @@ public class TabSheet extends AbstractComponentContainer tabState.componentErrorLevel = null; } - markAsDirty(); } diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java index e8b9198111..5c89c7f040 100644 --- a/server/src/main/java/com/vaadin/ui/UI.java +++ b/server/src/main/java/com/vaadin/ui/UI.java @@ -457,7 +457,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<>(); + List<Component> components = new ArrayList<>(); if (getContent() != null) { components.add(getContent()); 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 5b5887316c..357a9fbdf3 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -449,7 +449,7 @@ public class DesignAttributeHandler implements Serializable { } private Collection<String> getAttributes() { - ArrayList<String> attributes = new ArrayList<>(); + List<String> attributes = new ArrayList<>(); attributes.addAll(accessMethods.keySet()); return attributes; } 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 dfd7033430..aedd33618e 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java +++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java @@ -248,7 +248,7 @@ public class FieldBinder implements Serializable { */ protected static List<java.lang.reflect.Field> getFields( Class<?> searchClass) { - ArrayList<java.lang.reflect.Field> memberFields = new ArrayList<>(); + List<java.lang.reflect.Field> memberFields = new ArrayList<>(); memberFields.addAll(Arrays.asList(searchClass.getDeclaredFields())); return memberFields; 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 63f509c9ce..a1c283fae0 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<>(); + Map<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<>(); + Map<String, Integer> presentations = new HashMap<>(); for (Entry<Integer, String> entry : keyCodeMap.entrySet()) { presentations.put(entry.getValue(), entry.getKey()); } diff --git a/server/src/test/java/com/vaadin/server/JSONSerializerTest.java b/server/src/test/java/com/vaadin/server/JSONSerializerTest.java index ec5ba8bfc8..250d6831f4 100644 --- a/server/src/test/java/com/vaadin/server/JSONSerializerTest.java +++ b/server/src/test/java/com/vaadin/server/JSONSerializerTest.java @@ -40,8 +40,8 @@ import elemental.json.JsonValue; * */ public class JSONSerializerTest { - HashMap<String, AbstractSplitPanelState> stringToStateMap; - HashMap<AbstractSplitPanelState, String> stateToStringMap; + Map<String, AbstractSplitPanelState> stringToStateMap; + Map<AbstractSplitPanelState, String> stateToStringMap; @Test public void testStringToBeanMapSerialization() throws Exception { 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 609ec6d620..323238266e 100644 --- a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java +++ b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java @@ -268,7 +268,7 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { */ private String elementToHtml(Element producedElem, StringBuilder sb) { HashSet<String> booleanAttributes = new HashSet<>(); - ArrayList<String> names = new ArrayList<>(); + List<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/server/ClassesSerializableTest.java b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java index 085c0ec348..c42a11e31d 100644 --- a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java +++ b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java @@ -101,9 +101,8 @@ public class ClassesSerializableTest { "com\\.vaadin\\.themes\\.valoutil\\.BodyStyleName", // "com\\.vaadin\\.server\\.communication\\.JSR356WebsocketInitializer.*", // "com\\.vaadin\\.screenshotbrowser\\.ScreenshotBrowser.*", // - "com\\.vaadin\\.osgi.*",// - "com\\.vaadin\\.server\\.osgi.*" - }; + "com\\.vaadin\\.osgi.*", // + "com\\.vaadin\\.server\\.osgi.*" }; /** * Tests that all the relevant classes and interfaces under @@ -120,9 +119,9 @@ public class ClassesSerializableTest { classes.addAll(findServerClasses(location)); } - ArrayList<Field> nonSerializableFunctionFields = new ArrayList<>(); + List<Field> nonSerializableFunctionFields = new ArrayList<>(); - ArrayList<Class<?>> nonSerializableClasses = new ArrayList<>(); + List<Class<?>> nonSerializableClasses = new ArrayList<>(); for (String className : classes) { Class<?> cls = Class.forName(className); // Don't add classes that have a @Ignore annotation on the class @@ -209,7 +208,7 @@ public class ClassesSerializableTest { } private void failSerializableFields( - ArrayList<Field> nonSerializableFunctionFields) { + List<Field> nonSerializableFunctionFields) { String nonSerializableString = nonSerializableFunctionFields.stream() .map(field -> String.format("%s.%s", field.getDeclaringClass().getName(), field.getName())) @@ -220,7 +219,7 @@ public class ClassesSerializableTest { } private void failSerializableClasses( - ArrayList<Class<?>> nonSerializableClasses) { + List<Class<?>> nonSerializableClasses) { String nonSerializableString = ""; Iterator<Class<?>> it = nonSerializableClasses.iterator(); while (it.hasNext()) { 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 47a81aa8e4..b404ac2386 100644 --- a/server/src/test/java/com/vaadin/tests/server/KeyMapperTest.java +++ b/server/src/test/java/com/vaadin/tests/server/KeyMapperTest.java @@ -1,16 +1,18 @@ package com.vaadin.tests.server; -import com.vaadin.server.KeyMapper; -import org.junit.Test; - -import java.lang.reflect.Field; -import java.util.HashMap; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.fail; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import com.vaadin.server.KeyMapper; + public class KeyMapperTest { @Test @@ -104,8 +106,8 @@ public class KeyMapperTest { f1.setAccessible(true); f2.setAccessible(true); - HashMap<?, ?> h1 = (HashMap<?, ?>) f1.get(mapper); - HashMap<?, ?> h2 = (HashMap<?, ?>) f2.get(mapper); + Map<?, ?> h1 = (HashMap<?, ?>) f1.get(mapper); + Map<?, ?> h2 = (HashMap<?, ?>) f2.get(mapper); assertEquals(i, h1.size()); assertEquals(i, h2.size()); 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 0db8fbe86f..c2e453271a 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 @@ -1,6 +1,7 @@ package com.vaadin.tests.server.component.datefield; import java.util.ArrayList; +import java.util.List; import org.junit.Test; @@ -13,7 +14,7 @@ public class ResolutionTest { public void testResolutionHigherOrEqualToYear() { Iterable<DateResolution> higherOrEqual = DateResolution .getResolutionsHigherOrEqualTo(DateResolution.YEAR); - ArrayList<DateResolution> expected = new ArrayList<>(); + List<DateResolution> expected = new ArrayList<>(); expected.add(DateResolution.YEAR); TestUtil.assertIterableEquals(expected, higherOrEqual); } @@ -22,22 +23,20 @@ public class ResolutionTest { public void testResolutionHigherOrEqualToDay() { Iterable<DateResolution> higherOrEqual = DateResolution .getResolutionsHigherOrEqualTo(DateResolution.DAY); - ArrayList<DateResolution> expected = new ArrayList<>(); + List<DateResolution> expected = new ArrayList<>(); expected.add(DateResolution.DAY); expected.add(DateResolution.MONTH); expected.add(DateResolution.YEAR); TestUtil.assertIterableEquals(expected, higherOrEqual); - } @Test public void testResolutionLowerThanYear() { Iterable<DateResolution> higherOrEqual = DateResolution .getResolutionsLowerThan(DateResolution.YEAR); - ArrayList<DateResolution> expected = new ArrayList<>(); + List<DateResolution> expected = new ArrayList<>(); expected.add(DateResolution.MONTH); expected.add(DateResolution.DAY); TestUtil.assertIterableEquals(expected, higherOrEqual); - } } diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/NotificationElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/NotificationElement.java index e624c94623..6ba2a0f339 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/NotificationElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/NotificationElement.java @@ -77,7 +77,7 @@ public class NotificationElement extends AbstractElement { // the notification // To get type we search for css rules which represent notification type // This map maps css style rule to type of a notification - HashMap<String, String> styleToTypeMap = initStyleToTypeMap(); + Map<String, String> styleToTypeMap = initStyleToTypeMap(); for (Map.Entry<String, String> entry : styleToTypeMap.entrySet()) { String notifType = entry.getKey(); // Check notification has css style which describes notification @@ -89,8 +89,8 @@ public class NotificationElement extends AbstractElement { return ""; } - private HashMap<String, String> initStyleToTypeMap() { - HashMap<String, String> styleToType = new HashMap<String, String>(); + private Map<String, String> initStyleToTypeMap() { + Map<String, String> styleToType = new HashMap<String, String>(); styleToType.put("v-Notification-error", "error"); styleToType.put("v-Notification-warning", "warning"); styleToType.put("v-Notification-humanized", "humanized"); diff --git a/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java b/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java index a4719be6ec..db23287d88 100644 --- a/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java +++ b/uitest/src/main/java/com/vaadin/tests/ListenerOrder.java @@ -1,6 +1,7 @@ package com.vaadin.tests; import java.util.HashMap; +import java.util.Map; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -23,7 +24,7 @@ public class ListenerOrder extends com.vaadin.server.LegacyApplication Select s1; - HashMap<String, Integer> buttonListeners = new HashMap<>(); + Map<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 91d62a9b83..40353ad83c 100644 --- a/uitest/src/main/java/com/vaadin/tests/OrderedLayoutSwapComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/OrderedLayoutSwapComponents.java @@ -17,6 +17,7 @@ package com.vaadin.tests; import java.util.ArrayList; +import java.util.List; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; @@ -37,7 +38,7 @@ public class OrderedLayoutSwapComponents extends CustomComponent { private final AbstractOrderedLayout main; - ArrayList<MyComponent> order = new ArrayList<>(); + List<MyComponent> order = new ArrayList<>(); public OrderedLayoutSwapComponents() { diff --git a/uitest/src/main/java/com/vaadin/tests/TestBench.java b/uitest/src/main/java/com/vaadin/tests/TestBench.java index 7de6e4e2c5..388a113768 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestBench.java +++ b/uitest/src/main/java/com/vaadin/tests/TestBench.java @@ -276,7 +276,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication */ public static List<Class<?>> getTestableClassesForPackage( String packageName) throws Exception { - final ArrayList<File> directories = new ArrayList<>(); + final List<File> directories = new ArrayList<>(); try { final ClassLoader cld = Thread.currentThread() .getContextClassLoader(); @@ -295,7 +295,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication packageName + " does not appear to be a valid package."); } - final ArrayList<Class<?>> classes = new ArrayList<>(); + final List<Class<?>> classes = new ArrayList<>(); // For every directory identified capture all the .class files for (final File directory : directories) { if (directory.exists()) { diff --git a/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java b/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java index 0ad4c5545b..8c5bc83561 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForChildComponentRendering.java @@ -18,6 +18,7 @@ package com.vaadin.tests; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Button; @@ -93,7 +94,7 @@ public class TestForChildComponentRendering extends CustomComponent { public void randomReorder() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<>(); + final List<Component> components = new ArrayList<>(); while (it.hasNext()) { components.add(it.next()); } @@ -110,7 +111,7 @@ public class TestForChildComponentRendering extends CustomComponent { public void removeRandomComponent() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<>(); + final List<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 1088ba00a2..8c2d83da30 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java @@ -18,6 +18,7 @@ package com.vaadin.tests; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Button; @@ -94,7 +95,7 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent { public void randomReorder() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<>(); + final List<Component> components = new ArrayList<>(); while (it.hasNext()) { components.add(it.next()); } @@ -118,7 +119,7 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent { public void removeRandomComponent() { final Iterator<Component> it = main.getComponentIterator(); - final ArrayList<Component> components = new ArrayList<>(); + final List<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 c2d910ec26..74dcd40ba1 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForMultipleStyleNames.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForMultipleStyleNames.java @@ -18,6 +18,7 @@ package com.vaadin.tests; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.Label; @@ -43,7 +44,7 @@ public class TestForMultipleStyleNames extends CustomComponent private final TwinColSelect s = new TwinColSelect(); - private ArrayList<String> styleNames2; + private List<String> styleNames2; public TestForMultipleStyleNames() { setCompositionRoot(main); @@ -82,7 +83,7 @@ public class TestForMultipleStyleNames extends CustomComponent final String currentStyle = l.getStyleName(); final String[] tmp = currentStyle.split(" "); - final ArrayList<String> curStyles = new ArrayList<>(); + final List<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/TestSizeableIncomponents.java b/uitest/src/main/java/com/vaadin/tests/TestSizeableIncomponents.java index 68856973fd..9a45be4712 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestSizeableIncomponents.java +++ b/uitest/src/main/java/com/vaadin/tests/TestSizeableIncomponents.java @@ -20,6 +20,7 @@ import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.vaadin.server.LegacyApplication; import com.vaadin.server.ThemeResource; @@ -233,7 +234,7 @@ public class TestSizeableIncomponents extends LegacyApplication { class Testable { private Class<?> classToTest; - private ArrayList<Configuration> configurations = new ArrayList<>(); + private List<Configuration> configurations = new ArrayList<>(); Testable(Class<?> c) { classToTest = c; 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 591bf599cb..a8b62bd7c2 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java @@ -66,7 +66,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<>(); + List<Component> actions = new ArrayList<>(); actions.add(createEnabledAction(true)); actions.add(createReadonlyAction(false)); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java index 6b72db4091..7558771969 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java @@ -5,6 +5,7 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.List; import java.util.Locale; import com.vaadin.data.HasValue.ValueChangeEvent; @@ -124,8 +125,7 @@ public abstract class AbstractFieldTest<T extends AbstractField<V>, V> // Sort collections to avoid problems with values printed in // different order try { - ArrayList<Comparable> c = new ArrayList<Comparable>( - (Collection) o); + List<Comparable> c = new ArrayList<Comparable>((Collection) o); Collections.sort(c); o = c; } catch (Exception e) { 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 fd0e815ec9..18ecfaf53b 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 @@ -154,8 +154,7 @@ public abstract class LegacyAbstractFieldTest<T extends AbstractField> // Sort collections to avoid problems with values printed in // different order try { - ArrayList<Comparable> c = new ArrayList<Comparable>( - (Collection) o); + List<Comparable> c = new ArrayList<Comparable>((Collection) o); Collections.sort(c); o = c; } catch (Exception e) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java index 625f94d426..a1a8449a93 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java @@ -16,6 +16,7 @@ package com.vaadin.tests.components.grid; import java.util.ArrayList; +import java.util.List; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; @@ -37,7 +38,7 @@ public class GridDefaultSelectionMode extends AbstractTestUI { person2.setFirstName("person"); person2.setLastName("two"); - ArrayList<Person> items = new ArrayList<>(); + List<Person> items = new ArrayList<>(); items.add(person1); items.add(person2); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java index 48f8f814d3..400ff5266c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java @@ -17,6 +17,7 @@ package com.vaadin.tests.components.grid; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Random; import com.vaadin.server.VaadinRequest; @@ -44,7 +45,7 @@ public class GridEditorUI extends AbstractReindeerTestUIWithLog { protected Collection<Person> createTestData(int size) { Random r = new Random(0); - ArrayList<Person> testData = new ArrayList<>(); + List<Person> testData = new ArrayList<>(); for (int i = 0; i < size; i++) { Person person = new Person(); person.setFirstName(TestDataGenerator.getFirstName(r)); 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 fa5c151c79..83f3ef2317 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 @@ -1,6 +1,7 @@ package com.vaadin.tests.components.listselect; import java.util.ArrayList; +import java.util.List; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ContentMode; @@ -21,7 +22,7 @@ public class ListSelectJump extends AbstractReindeerTestUI { + "<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<>(); + List<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/Menubars.java b/uitest/src/main/java/com/vaadin/tests/components/menubar/Menubars.java index dd3c5cecb8..b1a7a6a8c9 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<>(); + List<Component> actions = new ArrayList<>(); actions.add(createErrorIndicatorAction(false)); actions.add(createEnabledAction(true)); 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 f3cb05d158..2be125a917 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 @@ -213,7 +213,7 @@ public class BoxLayoutTest extends AbstractReindeerTestUI { controls.addComponent(cell); cell.addComponent(new Label("Cell")); - ArrayList<Alignment> alignments = new ArrayList<>(); + List<Alignment> alignments = new ArrayList<>(); alignments.addAll(Arrays.asList(Alignment.TOP_LEFT, Alignment.MIDDLE_LEFT, Alignment.BOTTOM_LEFT, Alignment.TOP_CENTER, Alignment.MIDDLE_CENTER, @@ -342,7 +342,8 @@ public class BoxLayoutTest extends AbstractReindeerTestUI { componentError.addValueChangeListener(event -> { if (target != null) { target.setComponentError(componentError.getValue() - ? new UserError("Error message") : null); + ? new UserError("Error message") + : null); } }); component.addComponent(componentError); 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 5b04c31db8..e9ddb52ab6 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 @@ -5,6 +5,7 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.Serializable; import java.util.HashMap; +import java.util.Map; import com.vaadin.shared.ui.ContentMode; import com.vaadin.tests.components.TestBase; @@ -57,7 +58,7 @@ public class EditableTableLeak extends TestBase { } private static class CachingFieldFactory extends DefaultFieldFactory { - private final HashMap<Object, HashMap<Object, Field<?>>> cache = new HashMap<>(); + private final Map<Object, Map<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/SetDataSourceWithPropertyIds.java b/uitest/src/main/java/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.java index 4c3dba7ee0..b9a9ddd7e8 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 AbstractReindeerTestUI { table.setVisibleColumns("jobId"); label.setValue("no Exception"); } catch (CacheUpdateException e) { - ArrayList<String> propertyIds = new ArrayList<>(); + List<String> propertyIds = new ArrayList<>(); propertyIds.add("jobId"); table.setContainerDataSource(jobContainer, propertyIds); label.setValue("Exception caught"); 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 abc549e4bd..4b9f4455eb 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<>(count); + List<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/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleWhenTabsheetNotClipped.java index fb10ad0c15..19dcf30d37 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 @@ -71,7 +71,7 @@ public class FirstTabNotVisibleWhenTabsheetNotClipped TabSheet tabsheet = new TabSheet(); String[] letters = { "A", "B", "C", "D" }; - HashMap<String, TabSheet.Tab> tabMap = new HashMap<>(); + Map<String, TabSheet.Tab> tabMap = new HashMap<>(); for (String letter : letters) { VerticalLayout vLayout = new VerticalLayout(); @@ -100,7 +100,7 @@ public class FirstTabNotVisibleWhenTabsheetNotClipped } private Button.ClickListener createTabListener( - final HashMap<String, TabSheet.Tab> map, final TabSheet tabsheet) { + final Map<String, TabSheet.Tab> map, final TabSheet tabsheet) { Button.ClickListener clickListener = new Button.ClickListener() { 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 63530fac1c..36365993ce 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 @@ -1,6 +1,7 @@ package com.vaadin.tests.components.tabsheet; import java.util.ArrayList; +import java.util.List; import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; @@ -31,7 +32,7 @@ import com.vaadin.v7.ui.TextField; public class TabKeyboardNavigation extends AbstractReindeerTestUI { int index = 1; - ArrayList<Component> tabs = new ArrayList<>(); + List<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 adf5667bc1..404794608f 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 @@ -1,6 +1,7 @@ package com.vaadin.tests.components.tabsheet; import java.util.ArrayList; +import java.util.List; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; @@ -17,7 +18,7 @@ import com.vaadin.v7.ui.TextField; public class TabKeyboardNavigationWaiAria extends AbstractReindeerTestUI { int index = 1; - ArrayList<Component> tabs = new ArrayList<>(); + List<Component> tabs = new ArrayList<>(); TabSheet ts = new TabSheet(); @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 8eba127abd..c2b7cbf91c 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 @@ -18,6 +18,7 @@ package com.vaadin.tests.components.window; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import org.jsoup.Jsoup; import org.jsoup.nodes.Attribute; @@ -165,7 +166,7 @@ public class WindowCloseShortcuts extends AbstractTestUI { } private String elementToHtml(Element producedElem, StringBuilder sb) { - ArrayList<String> names = new ArrayList<>(); + List<String> names = new ArrayList<>(); for (Attribute a : producedElem.attributes().asList()) { names.add(a.getKey()); } 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 ac423b3700..618543aab9 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 @@ -3,6 +3,7 @@ package com.vaadin.tests.containers.filesystemcontainer; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; @@ -120,7 +121,7 @@ public class FileSystemContainerInTreeTable extends TestBase { if (c instanceof Container.Indexed) { return ((Container.Indexed) source).indexOfId(itemId); } else { - ArrayList<Object> list = new ArrayList<>(source.getItemIds()); + List<Object> list = new ArrayList<>(source.getItemIds()); return list.indexOf(itemId); } } diff --git a/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java b/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java index 5e7fd6672e..a9a25a88ea 100644 --- a/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java +++ b/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java @@ -99,7 +99,7 @@ public class DataProviderRefresh extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { Grid<Bean> grid = new Grid<>(); - ArrayList<Bean> arrayList = new ArrayList<>(); + List<Bean> arrayList = new ArrayList<>(); Bean foo = new Bean("Foo", 10); arrayList.add(foo); arrayList.add(new Bean("Baz", 11)); 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 9087b80944..86451975ca 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/DDTest6.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/DDTest6.java @@ -8,6 +8,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.Map; import java.util.Set; import com.vaadin.event.Action; @@ -297,7 +298,7 @@ public class DDTest6 extends TestBase { static class FolderView extends DragAndDropWrapper implements DropHandler { - static final HashMap<Folder, FolderView> views = new HashMap<>(); + static final Map<Folder, FolderView> views = new HashMap<>(); public static FolderView get(Folder f) { 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 92f18ceffe..e6c45ae9c3 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java @@ -3,6 +3,8 @@ package com.vaadin.tests.dd; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.util.Map; import com.vaadin.event.dd.DragAndDropEvent; import com.vaadin.event.dd.DropHandler; @@ -133,7 +135,7 @@ public class TreeDragStart extends TestBase { table.setDragMode(TableDragMode.ROW); // Initialize the table container - ArrayList<InventoryObject> collection = new ArrayList<>(); + List<InventoryObject> collection = new ArrayList<>(); collection.add(new InventoryObject("Dummy Item", 0.0, false)); final BeanItemContainer<InventoryObject> tableContainer = new BeanItemContainer<>( collection); @@ -238,11 +240,10 @@ public class TreeDragStart extends TestBase { } } - HashMap<String, InventoryObject> inventoryStore = new HashMap<>(); + Map<String, InventoryObject> inventoryStore = new HashMap<>(); public HierarchicalContainer createTreeContent() { - final Object[] inventory = { - new InventoryObject("root", 0.0, true), + final Object[] inventory = { new InventoryObject("root", 0.0, true), new InventoryObject("+5 Quarterstaff (blessed)", 3.5, false), new InventoryObject("+3 Elven Dagger (blessed)", 0.2, false), new InventoryObject("+5 Helmet (greased)", 1.5, false), 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 fb56b5226b..34c4449556 100644 --- a/uitest/src/main/java/com/vaadin/tests/push/PushConfigurator.java +++ b/uitest/src/main/java/com/vaadin/tests/push/PushConfigurator.java @@ -21,6 +21,7 @@ package com.vaadin.tests.push; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import com.vaadin.shared.communication.PushMode; import com.vaadin.shared.ui.ContentMode; @@ -69,7 +70,7 @@ public class PushConfigurator extends VerticalLayout { private void refreshStatus() { PushConfiguration pc = ui.getPushConfiguration(); String value = ""; - ArrayList<String> names = new ArrayList<>(); + List<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/util/PersonContainer.java b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java index a94e53a924..bdb73234ba 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java +++ b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java @@ -3,6 +3,7 @@ package com.vaadin.tests.util; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Random; import com.vaadin.v7.data.util.BeanItemContainer; @@ -14,17 +15,17 @@ public class PersonContainer extends BeanItemContainer<Person> /** * Natural property order for Person bean. Used in tables and forms. */ - public static final Object[] NATURAL_COL_ORDER = { "firstName", - "lastName", "email", "phoneNumber", "address.streetAddress", + public static final Object[] NATURAL_COL_ORDER = { "firstName", "lastName", + "email", "phoneNumber", "address.streetAddress", "address.postalCode", "address.city" }; /** * "Human readable" captions for properties in same order as in * NATURAL_COL_ORDER. */ - public static final String[] COL_HEADERS_ENGLISH = { - "First name", "Last name", "Email", "Phone number", - "Street Address", "Postal Code", "City" }; + public static final String[] COL_HEADERS_ENGLISH = { "First name", + "Last name", "Email", "Phone number", "Street Address", + "Postal Code", "City" }; public PersonContainer() { super(Person.class); @@ -49,7 +50,7 @@ public class PersonContainer extends BeanItemContainer<Person> public static Collection<Person> createTestData(int size) { Random r = new Random(0); - ArrayList<Person> testData = new ArrayList<>(); + List<Person> testData = new ArrayList<>(); for (int i = 0; i < size; i++) { Person p = new Person(); p.setFirstName(TestDataGenerator.getFirstName(r)); 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 750e0a4223..3b11e18849 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/TestClickListener.java +++ b/uitest/src/main/java/com/vaadin/tests/util/TestClickListener.java @@ -1,13 +1,14 @@ package com.vaadin.tests.util; import java.util.HashMap; +import java.util.Map; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; public class TestClickListener implements Button.ClickListener { - private static final HashMap<String, Integer> buttonListeners = new HashMap<>(); + private static final Map<String, Integer> buttonListeners = new HashMap<>(); String name = ""; int count = 0; 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 0c13cea90c..797aed66cb 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 @@ -207,7 +207,7 @@ public class SerializerTestConnector extends AbstractExtensionConnector { Arrays.asList(simpleBean, updatedSimpleBean)); updatedComplexBean.setPrivimite(complexBean.getPrivimite() + 1); - ArrayList<SimpleTestBean> arrayList = new ArrayList<>( + List<SimpleTestBean> arrayList = new ArrayList<>( Arrays.asList(array)); Collections.reverse(arrayList); 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 806c639998..d41df99886 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 @@ -142,9 +142,8 @@ public class GridBasicClientFeaturesWidget @Override public void save(EditorRequest<List<Data>> request) { if (secondEditorError) { - request.failure( - "Syntethic fail of editor in column 2. " - + "This message is so long that it doesn't fit into its box", + request.failure("Syntethic fail of editor in column 2. " + + "This message is so long that it doesn't fit into its box", Collections.<Column<?, List<Data>>> singleton( grid.getColumn(2))); return; @@ -821,8 +820,7 @@ public class GridBasicClientFeaturesWidget } private void createScrollToRowMenu() { - String[] menupath = { "Component", "State", "Scroll to...", - null }; + String[] menupath = { "Component", "State", "Scroll to...", null }; for (int i = 0; i < ROWS; i += 100) { menupath[3] = "Row " + i + "..."; @@ -980,7 +978,7 @@ public class GridBasicClientFeaturesWidget @Override public void execute() { List<Column<?, List<Data>>> cols = grid.getColumns(); - ArrayList<Column> reordered = new ArrayList<>(cols); + List<Column> reordered = new ArrayList<>(cols); final int index = cols.indexOf(column); if (index == 0) { Column<?, List<Data>> col = reordered.remove(0); |