From 504b3c4c65c6a2ccfeeb1501eff7a29f5a3dbec3 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 5 Sep 2016 12:33:39 +0300 Subject: Use diamond operator where it can be used Does not modify compatibility packages to keep to closer to Vaadin 7.7 Change-Id: Ic9c4944eb90218290545a04ecd7455eb63910012 --- server/src/main/java/com/vaadin/data/Result.java | 2 +- .../src/main/java/com/vaadin/data/sort/Sort.java | 2 +- .../main/java/com/vaadin/event/ActionManager.java | 8 +++--- .../main/java/com/vaadin/event/EventRouter.java | 6 ++-- .../main/java/com/vaadin/event/SelectionEvent.java | 6 ++-- .../java/com/vaadin/event/TransferableImpl.java | 2 +- .../com/vaadin/event/dd/TargetDetailsImpl.java | 2 +- .../main/java/com/vaadin/navigator/Navigator.java | 8 +++--- .../com/vaadin/server/AbstractClientConnector.java | 14 +++++----- .../com/vaadin/server/AbstractErrorMessage.java | 2 +- .../java/com/vaadin/server/BootstrapHandler.java | 2 +- .../com/vaadin/server/ComponentSizeValidator.java | 14 +++++----- .../java/com/vaadin/server/DownloadStream.java | 2 +- .../java/com/vaadin/server/GAEVaadinServlet.java | 4 +-- .../com/vaadin/server/GlobalResourceHandler.java | 10 +++---- .../vaadin/server/JavaScriptCallbackHelper.java | 4 +-- .../src/main/java/com/vaadin/server/JsonCodec.java | 26 +++++++++--------- .../java/com/vaadin/server/JsonPaintTarget.java | 18 ++++++------ .../src/main/java/com/vaadin/server/KeyMapper.java | 4 +-- .../java/com/vaadin/server/LegacyApplication.java | 2 +- .../vaadin/server/LegacyCommunicationManager.java | 10 +++---- server/src/main/java/com/vaadin/server/Page.java | 10 +++---- .../java/com/vaadin/server/ServerRpcManager.java | 2 +- .../vaadin/server/ServerRpcMethodInvocation.java | 2 +- .../com/vaadin/server/VaadinPortletSession.java | 18 ++++++------ .../main/java/com/vaadin/server/VaadinService.java | 8 +++--- .../main/java/com/vaadin/server/VaadinServlet.java | 6 ++-- .../main/java/com/vaadin/server/VaadinSession.java | 16 +++++------ .../java/com/vaadin/server/WrappedHttpSession.java | 2 +- .../server/communication/ClientRpcWriter.java | 4 +-- .../server/communication/LegacyUidlWriter.java | 2 +- .../server/communication/ServerRpcHandler.java | 4 +-- .../communication/SessionRequestHandler.java | 2 +- .../server/communication/SharedStateWriter.java | 2 +- .../vaadin/server/communication/UidlWriter.java | 10 +++---- .../themeutils/SASSAddonImportFileCreator.java | 6 ++-- .../server/widgetsetutils/ClassPathExplorer.java | 10 +++---- .../server/widgetsetutils/WidgetSetBuilder.java | 2 +- .../main/java/com/vaadin/ui/AbsoluteLayout.java | 4 +-- .../main/java/com/vaadin/ui/AbstractComponent.java | 10 +++---- .../com/vaadin/ui/AbstractComponentContainer.java | 6 ++-- .../src/main/java/com/vaadin/ui/AbstractMedia.java | 2 +- .../java/com/vaadin/ui/AbstractOrderedLayout.java | 2 +- .../main/java/com/vaadin/ui/ConnectorTracker.java | 32 +++++++++++----------- server/src/main/java/com/vaadin/ui/CssLayout.java | 2 +- .../src/main/java/com/vaadin/ui/CustomLayout.java | 2 +- .../java/com/vaadin/ui/DragAndDropWrapper.java | 6 ++-- server/src/main/java/com/vaadin/ui/Embedded.java | 2 +- server/src/main/java/com/vaadin/ui/Flash.java | 4 +-- server/src/main/java/com/vaadin/ui/GridLayout.java | 18 ++++++------ server/src/main/java/com/vaadin/ui/JavaScript.java | 2 +- server/src/main/java/com/vaadin/ui/LoginForm.java | 2 +- server/src/main/java/com/vaadin/ui/MenuBar.java | 10 +++---- server/src/main/java/com/vaadin/ui/TabSheet.java | 6 ++-- server/src/main/java/com/vaadin/ui/UI.java | 4 +-- server/src/main/java/com/vaadin/ui/Upload.java | 2 +- server/src/main/java/com/vaadin/ui/Window.java | 4 +-- .../ui/declarative/DesignAttributeHandler.java | 8 +++--- .../com/vaadin/ui/declarative/DesignContext.java | 20 +++++++------- .../com/vaadin/ui/declarative/DesignFormatter.java | 2 +- .../com/vaadin/ui/declarative/FieldBinder.java | 6 ++-- .../converters/DesignResourceConverter.java | 2 +- .../converters/DesignShortcutActionConverter.java | 4 +-- .../declarative/converters/ShortcutKeyMapper.java | 4 +-- .../main/java/com/vaadin/util/ConnectorHelper.java | 2 +- .../main/java/com/vaadin/util/CurrentInstance.java | 10 +++---- .../java/com/vaadin/util/FileTypeResolver.java | 4 +-- 67 files changed, 218 insertions(+), 218 deletions(-) (limited to 'server/src/main') diff --git a/server/src/main/java/com/vaadin/data/Result.java b/server/src/main/java/com/vaadin/data/Result.java index 7fb25bf9af..b82b3ff4e7 100644 --- a/server/src/main/java/com/vaadin/data/Result.java +++ b/server/src/main/java/com/vaadin/data/Result.java @@ -62,7 +62,7 @@ public interface Result extends Serializable { */ public static Result error(String message) { Objects.requireNonNull(message, "message cannot be null"); - return new SimpleResult(null, message); + return new SimpleResult<>(null, message); } /** diff --git a/server/src/main/java/com/vaadin/data/sort/Sort.java b/server/src/main/java/com/vaadin/data/sort/Sort.java index 63d152b001..fe082149e9 100644 --- a/server/src/main/java/com/vaadin/data/sort/Sort.java +++ b/server/src/main/java/com/vaadin/data/sort/Sort.java @@ -140,7 +140,7 @@ public class Sort implements Serializable { ++count; } - List order = new ArrayList(count); + List order = new ArrayList<>(count); s = this; do { diff --git a/server/src/main/java/com/vaadin/event/ActionManager.java b/server/src/main/java/com/vaadin/event/ActionManager.java index 98b1359337..b221d17511 100644 --- a/server/src/main/java/com/vaadin/event/ActionManager.java +++ b/server/src/main/java/com/vaadin/event/ActionManager.java @@ -98,7 +98,7 @@ public class ActionManager @Override public void addAction(T action) { if (ownActions == null) { - ownActions = new LinkedHashSet(); + ownActions = new LinkedHashSet<>(); } if (ownActions.add(action)) { requestRepaint(); @@ -123,7 +123,7 @@ public class ActionManager if (actionHandler != null) { if (actionHandlers == null) { - actionHandlers = new LinkedHashSet(); + actionHandlers = new LinkedHashSet<>(); } if (actionHandlers.add(actionHandler)) { @@ -165,7 +165,7 @@ public class ActionManager * removed but still exist on client side */ if (!actions.isEmpty() || clientHasActions) { - actionMapper = new KeyMapper(); + actionMapper = new KeyMapper<>(); paintTarget.addVariable((VariableOwner) viewer, "action", ""); paintTarget.startTag("actions"); @@ -240,7 +240,7 @@ public class ActionManager } private LinkedHashSet getActionSet(Object target, Object sender) { - LinkedHashSet actions = new LinkedHashSet(); + LinkedHashSet actions = new LinkedHashSet<>(); if (ownActions != null) { actions.addAll(ownActions); diff --git a/server/src/main/java/com/vaadin/event/EventRouter.java b/server/src/main/java/com/vaadin/event/EventRouter.java index 9e8051fed3..9ef6c8123b 100644 --- a/server/src/main/java/com/vaadin/event/EventRouter.java +++ b/server/src/main/java/com/vaadin/event/EventRouter.java @@ -52,7 +52,7 @@ public class EventRouter implements MethodEventSource { @Override public void addListener(Class eventType, Object object, Method method) { if (listenerList == null) { - listenerList = new LinkedHashSet(); + listenerList = new LinkedHashSet<>(); } listenerList.add(new ListenerMethod(eventType, object, method)); } @@ -66,7 +66,7 @@ public class EventRouter implements MethodEventSource { public void addListener(Class eventType, Object object, String methodName) { if (listenerList == null) { - listenerList = new LinkedHashSet(); + listenerList = new LinkedHashSet<>(); } listenerList.add(new ListenerMethod(eventType, object, methodName)); } @@ -232,7 +232,7 @@ public class EventRouter implements MethodEventSource { * are found. */ public Collection getListeners(Class eventType) { - List listeners = new ArrayList(); + List listeners = new ArrayList<>(); if (listenerList != null) { for (ListenerMethod lm : listenerList) { if (lm.isOrExtendsType(eventType)) { diff --git a/server/src/main/java/com/vaadin/event/SelectionEvent.java b/server/src/main/java/com/vaadin/event/SelectionEvent.java index f22f499893..b5a4d587e6 100644 --- a/server/src/main/java/com/vaadin/event/SelectionEvent.java +++ b/server/src/main/java/com/vaadin/event/SelectionEvent.java @@ -37,8 +37,8 @@ public class SelectionEvent extends EventObject { public SelectionEvent(Object source, Collection oldSelection, Collection newSelection) { super(source); - this.oldSelection = new LinkedHashSet(oldSelection); - this.newSelection = new LinkedHashSet(newSelection); + this.oldSelection = new LinkedHashSet<>(oldSelection); + this.newSelection = new LinkedHashSet<>(newSelection); } /** @@ -79,7 +79,7 @@ public class SelectionEvent extends EventObject { if (set2.isEmpty()) { return set1; } else { - LinkedHashSet set = new LinkedHashSet(set1); + LinkedHashSet set = new LinkedHashSet<>(set1); set.removeAll(set2); return set; } diff --git a/server/src/main/java/com/vaadin/event/TransferableImpl.java b/server/src/main/java/com/vaadin/event/TransferableImpl.java index fad6adf2eb..4da28176fc 100644 --- a/server/src/main/java/com/vaadin/event/TransferableImpl.java +++ b/server/src/main/java/com/vaadin/event/TransferableImpl.java @@ -27,7 +27,7 @@ import com.vaadin.ui.Component; * @since 6.3 */ public class TransferableImpl implements Transferable { - private Map rawVariables = new HashMap(); + private Map rawVariables = new HashMap<>(); private Component sourceComponent; public TransferableImpl(Component sourceComponent, diff --git a/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java b/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java index cce6029159..42bff9c007 100644 --- a/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java +++ b/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java @@ -30,7 +30,7 @@ import com.vaadin.shared.MouseEventDetails; @SuppressWarnings("serial") public class TargetDetailsImpl implements TargetDetails { - private HashMap data = new HashMap(); + private HashMap data = new HashMap<>(); private DropTarget dropTarget; protected TargetDetailsImpl(Map rawDropData) { diff --git a/server/src/main/java/com/vaadin/navigator/Navigator.java b/server/src/main/java/com/vaadin/navigator/Navigator.java index 5704457f72..13e3b4c2e7 100644 --- a/server/src/main/java/com/vaadin/navigator/Navigator.java +++ b/server/src/main/java/com/vaadin/navigator/Navigator.java @@ -374,8 +374,8 @@ public class Navigator implements Serializable { private NavigationStateManager stateManager; private ViewDisplay display; private View currentView = null; - private List listeners = new LinkedList(); - private List providers = new LinkedList(); + private List listeners = new LinkedList<>(); + private List providers = new LinkedList<>(); private String currentNavigationState = null; private ViewProvider errorProvider; @@ -722,7 +722,7 @@ public class Navigator implements Serializable { // a copy of the listener list is needed to avoid // ConcurrentModificationException as a listener can add/remove // listeners - for (ViewChangeListener l : new ArrayList( + for (ViewChangeListener l : new ArrayList<>( listeners)) { if (!l.beforeViewChange(event)) { return false; @@ -786,7 +786,7 @@ public class Navigator implements Serializable { // a copy of the listener list is needed to avoid // ConcurrentModificationException as a listener can add/remove // listeners - for (ViewChangeListener l : new ArrayList( + for (ViewChangeListener l : new ArrayList<>( listeners)) { l.afterViewChange(event); } diff --git a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java index 676256fb5d..ea969bea2b 100644 --- a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java @@ -60,13 +60,13 @@ public abstract class AbstractClientConnector * A map from client to server RPC interface class name to the RPC call * manager that handles incoming RPC calls for that interface. */ - private Map> rpcManagerMap = new HashMap>(); + private Map> rpcManagerMap = new HashMap<>(); /** * A map from server to client RPC interface class to the RPC proxy that * sends ourgoing RPC calls for that interface. */ - private Map, ClientRpc> rpcProxyMap = new HashMap, ClientRpc>(); + private Map, ClientRpc> rpcProxyMap = new HashMap<>(); /** * Shared state object to be communicated from the server to the client when @@ -79,11 +79,11 @@ public abstract class AbstractClientConnector /** * Pending RPC method invocations to be sent. */ - private ArrayList pendingInvocations = new ArrayList(); + private ArrayList pendingInvocations = new ArrayList<>(); private String connectorId; - private ArrayList extensions = new ArrayList(); + private ArrayList extensions = new ArrayList<>(); /** * The EventRouter used for the event model. @@ -92,7 +92,7 @@ public abstract class AbstractClientConnector private ErrorHandler errorHandler = null; - private static final ConcurrentHashMap, Class> stateTypeCache = new ConcurrentHashMap, Class>(); + private static final ConcurrentHashMap, Class> stateTypeCache = new ConcurrentHashMap<>(); @Override public void addAttachListener(AttachListener listener) { @@ -170,7 +170,7 @@ public abstract class AbstractClientConnector protected void registerRpc(T implementation, Class rpcInterfaceType) { rpcManagerMap.put(rpcInterfaceType.getName(), - new ServerRpcManager(implementation, rpcInterfaceType)); + new ServerRpcManager<>(implementation, rpcInterfaceType)); } /** @@ -425,7 +425,7 @@ public abstract class AbstractClientConnector return Collections.emptyList(); } else { List result = pendingInvocations; - pendingInvocations = new ArrayList(); + pendingInvocations = new ArrayList<>(); return Collections.unmodifiableList(result); } } diff --git a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java index 0bd00bae86..491462b53d 100644 --- a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java +++ b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java @@ -63,7 +63,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage { */ private ErrorLevel level = ErrorLevel.ERROR; - private List causes = new ArrayList(); + private List causes = new ArrayList<>(); protected AbstractErrorMessage(String message) { this.message = message; diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java index 359f878ad1..84ee3c2334 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java @@ -303,7 +303,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { .getBootstrapResponse(); if (vaadinService.isStandalone(request)) { - Map headers = new LinkedHashMap(); + Map headers = new LinkedHashMap<>(); Document document = Document.createShell(""); BootstrapPageResponse pageResponse = new BootstrapPageResponse(this, request, context.getSession(), context.getUIClass(), diff --git a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java index dcf47ba438..241aea2078 100644 --- a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java +++ b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java @@ -70,7 +70,7 @@ public class ComponentSizeValidator implements Serializable { parent.addError(error); } else { if (errors == null) { - errors = new LinkedList(); + errors = new LinkedList<>(); } errors.add(error); } @@ -168,7 +168,7 @@ public class ComponentSizeValidator implements Serializable { private final boolean invalidHeight; private final boolean invalidWidth; - private final Vector subErrors = new Vector(); + private final Vector subErrors = new Vector<>(); public InvalidLayout(Component component, boolean height, boolean width) { @@ -281,7 +281,7 @@ public class ComponentSizeValidator implements Serializable { private static Stack getHeightAttributes( Component component) { - Stack attributes = new Stack(); + Stack attributes = new Stack<>(); attributes .add(new ComponentInfo(component, getHeightString(component))); Component parent = component.getParent(); @@ -296,7 +296,7 @@ public class ComponentSizeValidator implements Serializable { private static Stack getWidthAttributes( Component component) { - Stack attributes = new Stack(); + Stack attributes = new Stack<>(); attributes.add(new ComponentInfo(component, getWidthString(component))); Component parent = component.getParent(); attributes.add(new ComponentInfo(parent, getWidthString(parent))); @@ -581,9 +581,9 @@ public class ComponentSizeValidator implements Serializable { } - private static Map creationLocations = new HashMap(); - private static Map widthLocations = new HashMap(); - private static Map heightLocations = new HashMap(); + private static Map creationLocations = new HashMap<>(); + private static Map widthLocations = new HashMap<>(); + private static Map heightLocations = new HashMap<>(); public static class FileLocation implements Serializable { public String method; diff --git a/server/src/main/java/com/vaadin/server/DownloadStream.java b/server/src/main/java/com/vaadin/server/DownloadStream.java index d67fbda8c2..a0a1334135 100644 --- a/server/src/main/java/com/vaadin/server/DownloadStream.java +++ b/server/src/main/java/com/vaadin/server/DownloadStream.java @@ -148,7 +148,7 @@ public class DownloadStream implements Serializable { */ public void setParameter(String name, String value) { if (params == null) { - params = new HashMap(); + params = new HashMap<>(); } params.put(name, value); } diff --git a/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java b/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java index aa3bccdb93..93a43829b3 100644 --- a/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java @@ -428,7 +428,7 @@ public class GAEVaadinServlet extends VaadinServlet { getLogger().log(Level.INFO, "Vaadin cleanup deleting {0} expired Vaadin sessions.", entities.size()); - List keys = new ArrayList(); + List keys = new ArrayList<>(); for (Entity e : entities) { keys.add(e.getKey()); } @@ -448,7 +448,7 @@ public class GAEVaadinServlet extends VaadinServlet { getLogger().log(Level.INFO, "Vaadin cleanup deleting {0} expired appengine sessions.", entities.size()); - List keys = new ArrayList(); + List keys = new ArrayList<>(); for (Entity e : entities) { keys.add(e.getKey()); } diff --git a/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java b/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java index 62f3d33014..975d5475d1 100644 --- a/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java @@ -49,15 +49,15 @@ public class GlobalResourceHandler implements RequestHandler { /** * Used to detect when a resource is no longer used by any connector. */ - private final Map> resourceUsers = new HashMap>(); + private final Map> resourceUsers = new HashMap<>(); /** * Used to find the resources that might not be needed any more when a * connector is unregistered. */ - private final Map> usedResources = new HashMap>(); + private final Map> usedResources = new HashMap<>(); - private final Map legacyResourceKeys = new HashMap(); - private final Map legacyResources = new HashMap(); + private final Map legacyResourceKeys = new HashMap<>(); + private final Map legacyResources = new HashMap<>(); private int nextLegacyId = 0; // APP/global/[uiid]/[type]/[id] @@ -173,7 +173,7 @@ public class GlobalResourceHandler implements RequestHandler { private void ensureInSet(Map> map, K key, V value) { Set set = map.get(key); if (set == null) { - set = new HashSet(); + set = new HashSet<>(); map.put(key, set); } set.add(value); diff --git a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java index f4b8556385..cdd42c19da 100644 --- a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java +++ b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java @@ -49,7 +49,7 @@ public class JavaScriptCallbackHelper implements Serializable { JavaScriptCallbackRpc.class, "call", String.class, JsonArray.class); private AbstractClientConnector connector; - private Map callbacks = new HashMap(); + private Map callbacks = new HashMap<>(); private JavaScriptCallbackRpc javascriptCallbackRpc; public JavaScriptCallbackHelper(AbstractClientConnector connector) { @@ -109,7 +109,7 @@ public class JavaScriptCallbackHelper implements Serializable { .getRpcInterfaces(); String interfaceName = rpcInterfaceType.getName(); if (!rpcInterfaces.containsKey(interfaceName)) { - Set methodNames = new HashSet(); + Set methodNames = new HashSet<>(); for (Method method : rpcInterfaceType.getMethods()) { methodNames.add(method.getName()); diff --git a/server/src/main/java/com/vaadin/server/JsonCodec.java b/server/src/main/java/com/vaadin/server/JsonCodec.java index 2dae3ed03e..adf3e029ee 100644 --- a/server/src/main/java/com/vaadin/server/JsonCodec.java +++ b/server/src/main/java/com/vaadin/server/JsonCodec.java @@ -137,7 +137,7 @@ public class JsonCodec implements Serializable { public static Collection find(Class type) throws IntrospectionException { Field[] fields = type.getFields(); - Collection properties = new ArrayList( + Collection properties = new ArrayList<>( fields.length); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { @@ -178,7 +178,7 @@ public class JsonCodec implements Serializable { public static Collection find(Class type) throws IntrospectionException { - Collection properties = new ArrayList(); + Collection properties = new ArrayList<>(); for (PropertyDescriptor pd : Introspector.getBeanInfo(type) .getPropertyDescriptors()) { @@ -204,17 +204,17 @@ public class JsonCodec implements Serializable { * happens to process Vaadin requests, so it must be protected from * corruption caused by concurrent access. */ - private static ConcurrentMap, Collection> typePropertyCache = new ConcurrentHashMap, Collection>(); + private static ConcurrentMap, Collection> typePropertyCache = new ConcurrentHashMap<>(); - private static Map, String> typeToTransportType = new HashMap, String>(); + private static Map, String> typeToTransportType = new HashMap<>(); /** * Note! This does not contain primitives. *

*/ - private static Map> transportTypeToType = new HashMap>(); + private static Map> transportTypeToType = new HashMap<>(); - private static Map, JSONSerializer> customSerializers = new HashMap, JSONSerializer>(); + private static Map, JSONSerializer> customSerializers = new HashMap<>(); static { customSerializers.put(Date.class, new DateSerializer()); } @@ -464,7 +464,7 @@ public class JsonCodec implements Serializable { // See #8906. JsonArray jsonArray = (JsonArray) jsonMap; if (jsonArray.length() == 0) { - return new HashMap(); + return new HashMap<>(); } } @@ -499,7 +499,7 @@ public class JsonCodec implements Serializable { assert (keys.length() == values.length()); - Map map = new HashMap( + Map map = new HashMap<>( keys.length() * 2); for (int i = 0; i < keys.length(); i++) { Object key = decodeInternalOrCustomType(keyType, keys.get(i), @@ -515,7 +515,7 @@ public class JsonCodec implements Serializable { private static Map decodeConnectorMap(Type valueType, JsonObject jsonMap, ConnectorTracker connectorTracker) { - Map map = new HashMap(); + Map map = new HashMap<>(); for (String key : jsonMap.keys()) { Object value = decodeInternalOrCustomType(valueType, @@ -531,7 +531,7 @@ public class JsonCodec implements Serializable { private static Map decodeStringMap(Type valueType, JsonObject jsonMap, ConnectorTracker connectorTracker) { - Map map = new HashMap(); + Map map = new HashMap<>(); for (String key : jsonMap.keys()) { Object value = decodeInternalOrCustomType(valueType, @@ -590,7 +590,7 @@ public class JsonCodec implements Serializable { boolean restrictToInternalTypes, JsonArray jsonArray, ConnectorTracker connectorTracker) { int arrayLength = jsonArray.length(); - List list = new ArrayList(arrayLength); + List list = new ArrayList<>(arrayLength); for (int i = 0; i < arrayLength; ++i) { // each entry always has two elements: type and value JsonValue encodedValue = jsonArray.get(i); @@ -604,7 +604,7 @@ public class JsonCodec implements Serializable { private static Set decodeSet(Type targetType, boolean restrictToInternalTypes, JsonArray jsonArray, ConnectorTracker connectorTracker) { - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); set.addAll(decodeList(targetType, restrictToInternalTypes, jsonArray, connectorTracker)); return set; @@ -702,7 +702,7 @@ public class JsonCodec implements Serializable { if (cachedProperties != null) { return cachedProperties; } - Collection properties = new ArrayList(); + Collection properties = new ArrayList<>(); properties.addAll(MethodProperty.find(type)); properties.addAll(FieldProperty.find(type)); diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java index 19f79b6507..4463fd1ab5 100644 --- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java +++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java @@ -65,7 +65,7 @@ public class JsonPaintTarget implements PaintTarget { private int changes = 0; - private final Set usedResources = new HashSet(); + private final Set usedResources = new HashSet<>(); private boolean customLayoutArgumentsOpen = false; @@ -73,7 +73,7 @@ public class JsonPaintTarget implements PaintTarget { private boolean cacheEnabled = false; - private final Set> usedClientConnectors = new HashSet>(); + private final Set> usedClientConnectors = new HashSet<>(); /** * Creates a new JsonPaintTarget. @@ -96,11 +96,11 @@ public class JsonPaintTarget implements PaintTarget { uidlBuffer = new PrintWriter(outWriter); // Initialize tag-writing - mOpenTags = new Stack(); - openJsonTags = new Stack(); + mOpenTags = new Stack<>(); + openJsonTags = new Stack<>(); - openPaintables = new Stack(); - openPaintableTags = new Stack(); + openPaintables = new Stack<>(); + openPaintableTags = new Stack<>(); cacheEnabled = cachingRequired; } @@ -728,11 +728,11 @@ public class JsonPaintTarget implements PaintTarget { class JsonTag implements Serializable { boolean firstField = false; - Vector variables = new Vector(); + Vector variables = new Vector<>(); - Vector children = new Vector(); + Vector children = new Vector<>(); - Vector attr = new Vector(); + Vector attr = new Vector<>(); StringBuilder data = new StringBuilder(); diff --git a/server/src/main/java/com/vaadin/server/KeyMapper.java b/server/src/main/java/com/vaadin/server/KeyMapper.java index 389fcd8b66..54d85c4bce 100644 --- a/server/src/main/java/com/vaadin/server/KeyMapper.java +++ b/server/src/main/java/com/vaadin/server/KeyMapper.java @@ -32,9 +32,9 @@ public class KeyMapper implements DataKeyMapper, Serializable { private int lastKey = 0; - private final HashMap objectKeyMap = new HashMap(); + private final HashMap objectKeyMap = new HashMap<>(); - private final HashMap keyObjectMap = new HashMap(); + private final HashMap keyObjectMap = new HashMap<>(); /** * Gets key for an object. diff --git a/server/src/main/java/com/vaadin/server/LegacyApplication.java b/server/src/main/java/com/vaadin/server/LegacyApplication.java index 93f3da3d8f..210520cfaa 100644 --- a/server/src/main/java/com/vaadin/server/LegacyApplication.java +++ b/server/src/main/java/com/vaadin/server/LegacyApplication.java @@ -42,7 +42,7 @@ public abstract class LegacyApplication implements ErrorHandler { private LegacyWindow mainWindow; private String theme; - private Map legacyUINames = new HashMap(); + private Map legacyUINames = new HashMap<>(); private boolean isRunning = true; diff --git a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java index 513f598b21..858f61d0c7 100644 --- a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java +++ b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java @@ -56,7 +56,7 @@ import elemental.json.JsonValue; public class LegacyCommunicationManager implements Serializable { // TODO Refactor (#11410) - private final HashMap uiToClientCache = new HashMap(); + private final HashMap uiToClientCache = new HashMap<>(); /** * The session this communication manager is used for @@ -67,7 +67,7 @@ public class LegacyCommunicationManager implements Serializable { private String requestThemeName; // TODO Refactor (#11413) - private Map> publishedFileContexts = new HashMap>(); + private Map> publishedFileContexts = new HashMap<>(); /** * TODO New constructor - document me! @@ -82,7 +82,7 @@ public class LegacyCommunicationManager implements Serializable { return session; } - private static final ConcurrentHashMap, JsonValue> referenceDiffStates = new ConcurrentHashMap, JsonValue>(); + private static final ConcurrentHashMap, JsonValue> referenceDiffStates = new ConcurrentHashMap<>(); /** * @deprecated As of 7.1. See #11411. @@ -307,7 +307,7 @@ public class LegacyCommunicationManager implements Serializable { } } - private final HashMap, Integer> typeToKey = new HashMap, Integer>(); + private final HashMap, Integer> typeToKey = new HashMap<>(); private int nextTypeKey = 0; /** @@ -338,7 +338,7 @@ public class LegacyCommunicationManager implements Serializable { @Deprecated public class ClientCache implements Serializable { - private final Set res = new HashSet(); + private final Set res = new HashSet<>(); /** * diff --git a/server/src/main/java/com/vaadin/server/Page.java b/server/src/main/java/com/vaadin/server/Page.java index 7142659fca..9330c08a28 100644 --- a/server/src/main/java/com/vaadin/server/Page.java +++ b/server/src/main/java/com/vaadin/server/Page.java @@ -273,7 +273,7 @@ public class Page implements Serializable { * Resources to be opened automatically on next repaint. The list is * automatically cleared when it has been sent to the client. */ - private final LinkedList openList = new LinkedList(); + private final LinkedList openList = new LinkedList<>(); /** * A list of notifications that are waiting to be sent to the client. @@ -388,9 +388,9 @@ public class Page implements Serializable { */ public static class Styles implements Serializable { - private LinkedHashSet injectedStyles = new LinkedHashSet(); + private LinkedHashSet injectedStyles = new LinkedHashSet<>(); - private LinkedHashSet pendingInjections = new LinkedHashSet(); + private LinkedHashSet pendingInjections = new LinkedHashSet<>(); private final UI ui; @@ -440,7 +440,7 @@ public class Page implements Serializable { if (target.isFullRepaint()) { injectedStyles.addAll(pendingInjections); pendingInjections = injectedStyles; - injectedStyles = new LinkedHashSet(); + injectedStyles = new LinkedHashSet<>(); } if (!pendingInjections.isEmpty()) { @@ -1161,7 +1161,7 @@ public class Page implements Serializable { */ private void addNotification(Notification notification) { if (notifications == null) { - notifications = new LinkedList(); + notifications = new LinkedList<>(); } notifications.add(notification); uI.markAsDirty(); diff --git a/server/src/main/java/com/vaadin/server/ServerRpcManager.java b/server/src/main/java/com/vaadin/server/ServerRpcManager.java index e1f5f79860..e9f8d9543e 100644 --- a/server/src/main/java/com/vaadin/server/ServerRpcManager.java +++ b/server/src/main/java/com/vaadin/server/ServerRpcManager.java @@ -69,7 +69,7 @@ public class ServerRpcManager implements Serializable { } - private static final Map, Class> boxedTypes = new HashMap, Class>(); + private static final Map, Class> boxedTypes = new HashMap<>(); static { try { Class[] boxClasses = new Class[] { Boolean.class, Byte.class, diff --git a/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java b/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java index 22bcd1bf6b..f4e2b4064d 100644 --- a/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java +++ b/server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java @@ -24,7 +24,7 @@ import com.vaadin.shared.communication.ServerRpc; public class ServerRpcMethodInvocation extends MethodInvocation { - private static final Map invocationMethodCache = new ConcurrentHashMap( + private static final Map invocationMethodCache = new ConcurrentHashMap<>( 128, 0.75f, 1); private final Method method; diff --git a/server/src/main/java/com/vaadin/server/VaadinPortletSession.java b/server/src/main/java/com/vaadin/server/VaadinPortletSession.java index f431d08b7e..6a6cb429d3 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortletSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortletSession.java @@ -64,13 +64,13 @@ import com.vaadin.util.CurrentInstance; @SuppressWarnings("serial") public class VaadinPortletSession extends VaadinSession { - private final Set portletListeners = new LinkedHashSet(); + private final Set portletListeners = new LinkedHashSet<>(); - private final Map eventActionDestinationMap = new HashMap(); - private final Map eventActionValueMap = new HashMap(); + private final Map eventActionDestinationMap = new HashMap<>(); + private final Map eventActionValueMap = new HashMap<>(); - private final Map sharedParameterActionNameMap = new HashMap(); - private final Map sharedParameterActionValueMap = new HashMap(); + private final Map sharedParameterActionNameMap = new HashMap<>(); + private final Map sharedParameterActionValueMap = new HashMap<>(); /** * Create a portlet service session for the given portlet service @@ -143,7 +143,7 @@ public class VaadinPortletSession extends VaadinSession { */ public void firePortletRenderRequest(UI uI, RenderRequest request, RenderResponse response) { - for (PortletListener l : new ArrayList( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleRenderRequest(request, new RestrictedRenderResponse(response), uI); @@ -172,7 +172,7 @@ public class VaadinPortletSession extends VaadinSession { sharedParameterActionValueMap.remove(key); } else { // normal action request, notify listeners - for (PortletListener l : new ArrayList( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleActionRequest(request, response, uI); } @@ -184,7 +184,7 @@ public class VaadinPortletSession extends VaadinSession { */ public void firePortletEventRequest(UI uI, EventRequest request, EventResponse response) { - for (PortletListener l : new ArrayList( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleEventRequest(request, response, uI); } @@ -195,7 +195,7 @@ public class VaadinPortletSession extends VaadinSession { */ public void firePortletResourceRequest(UI uI, ResourceRequest request, ResourceResponse response) { - for (PortletListener l : new ArrayList( + for (PortletListener l : new ArrayList<>( portletListeners)) { l.handleResourceRequest(request, response, uI); } diff --git a/server/src/main/java/com/vaadin/server/VaadinService.java b/server/src/main/java/com/vaadin/server/VaadinService.java index 50e20a0389..922c7cfe52 100644 --- a/server/src/main/java/com/vaadin/server/VaadinService.java +++ b/server/src/main/java/com/vaadin/server/VaadinService.java @@ -209,7 +209,7 @@ public abstract class VaadinService implements Serializable { */ protected List createRequestHandlers() throws ServiceException { - ArrayList handlers = new ArrayList(); + ArrayList handlers = new ArrayList<>(); handlers.add(new SessionRequestHandler()); handlers.add(new PublishedFileHandler()); handlers.add(new HeartbeatHandler()); @@ -466,7 +466,7 @@ public abstract class VaadinService implements Serializable { if (session.getState() == State.OPEN) { closeSession(session); } - ArrayList uis = new ArrayList(session.getUIs()); + ArrayList uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { ui.accessSynchronously(new Runnable() { @Override @@ -1050,7 +1050,7 @@ public abstract class VaadinService implements Serializable { // Stores all attributes (security key, reference to this context // instance) so they can be added to the new session Set attributeNames = oldSession.getAttributeNames(); - HashMap attrs = new HashMap( + HashMap attrs = new HashMap<>( attributeNames.size() * 2); for (String name : attributeNames) { Object value = oldSession.getAttribute(name); @@ -1190,7 +1190,7 @@ public abstract class VaadinService implements Serializable { * @param session */ private void removeClosedUIs(final VaadinSession session) { - ArrayList uis = new ArrayList(session.getUIs()); + ArrayList uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { if (ui.isClosing()) { ui.accessSynchronously(new Runnable() { diff --git a/server/src/main/java/com/vaadin/server/VaadinServlet.java b/server/src/main/java/com/vaadin/server/VaadinServlet.java index e3402f6937..03d47b6693 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServlet.java +++ b/server/src/main/java/com/vaadin/server/VaadinServlet.java @@ -87,7 +87,7 @@ public class VaadinServlet extends HttpServlet implements Constants { css = json.getString("css"); timestamp = Long.parseLong(json.getString("timestamp")); - sourceUris = new ArrayList(); + sourceUris = new ArrayList<>(); JsonArray uris = json.getArray("uris"); for (int i = 0; i < uris.length(); i++) { @@ -661,7 +661,7 @@ public class VaadinServlet extends HttpServlet implements Constants { return sb.toString(); } - private static final Collection CHAR_BLACKLIST = new HashSet( + private static final Collection CHAR_BLACKLIST = new HashSet<>( Arrays.asList(new Character[] { '&', '"', '\'', '<', '>', '(', ')', ';' })); @@ -678,7 +678,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * Global cache of scss compilation results. This map is protected from * concurrent access by {@link #SCSS_MUTEX}. */ - private final Map scssCache = new HashMap(); + private final Map scssCache = new HashMap<>(); /** * Keeps track of whether a warning about not being able to persist cache diff --git a/server/src/main/java/com/vaadin/server/VaadinSession.java b/server/src/main/java/com/vaadin/server/VaadinSession.java index 8b503b9b37..d2cf4e740a 100644 --- a/server/src/main/java/com/vaadin/server/VaadinSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinSession.java @@ -226,12 +226,12 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { @Deprecated private Object converterFactory; - private LinkedList requestHandlers = new LinkedList(); + private LinkedList requestHandlers = new LinkedList<>(); private int nextUIId = 0; - private Map uIs = new HashMap(); + private Map uIs = new HashMap<>(); - private final Map embedIdMap = new HashMap(); + private final Map embedIdMap = new HashMap<>(); private final EventRouter eventRouter = new EventRouter(); @@ -253,9 +253,9 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { private transient WrappedSession session; - private final Map attributes = new HashMap(); + private final Map attributes = new HashMap<>(); - private LinkedList uiProviders = new LinkedList(); + private LinkedList uiProviders = new LinkedList<>(); private transient VaadinService service; @@ -266,7 +266,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * session is serialized as long as it doesn't happen while some other * thread has the lock. */ - private transient ConcurrentLinkedQueue pendingAccessQueue = new ConcurrentLinkedQueue(); + private transient ConcurrentLinkedQueue pendingAccessQueue = new ConcurrentLinkedQueue<>(); /** * Creates a new VaadinSession tied to a VaadinService. @@ -465,7 +465,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { */ public static Collection getAllSessions( HttpSession httpSession) { - Set sessions = new HashSet(); + Set sessions = new HashSet<>(); Enumeration attributeNames = httpSession.getAttributeNames(); while (attributeNames.hasMoreElements()) { @@ -1426,7 +1426,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { Map, CurrentInstance> old = CurrentInstance.setCurrent(this); try { stream.defaultReadObject(); - pendingAccessQueue = new ConcurrentLinkedQueue(); + pendingAccessQueue = new ConcurrentLinkedQueue<>(); } finally { CurrentInstance.restoreInstances(old); } diff --git a/server/src/main/java/com/vaadin/server/WrappedHttpSession.java b/server/src/main/java/com/vaadin/server/WrappedHttpSession.java index 781cdedc5c..39944fc7da 100644 --- a/server/src/main/java/com/vaadin/server/WrappedHttpSession.java +++ b/server/src/main/java/com/vaadin/server/WrappedHttpSession.java @@ -76,7 +76,7 @@ public class WrappedHttpSession implements WrappedSession { // Helper shared with WrappedPortletSession static Set enumerationToSet(Enumeration values) { - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); while (values.hasMoreElements()) { set.add(values.nextElement()); } diff --git a/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java b/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java index 94755385eb..efa8cc3be9 100644 --- a/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java @@ -116,7 +116,7 @@ public class ClientRpcWriter implements Serializable { */ private Collection collectPendingRpcCalls( Collection rpcPendingQueue) { - List pendingInvocations = new ArrayList(); + List pendingInvocations = new ArrayList<>(); for (ClientConnector connector : rpcPendingQueue) { List paintablePendingRpc = connector .retrievePendingRpcCalls(); @@ -124,7 +124,7 @@ public class ClientRpcWriter implements Serializable { List oldPendingRpc = pendingInvocations; int totalCalls = pendingInvocations.size() + paintablePendingRpc.size(); - pendingInvocations = new ArrayList( + pendingInvocations = new ArrayList<>( totalCalls); // merge two ordered comparable lists diff --git a/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java b/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java index 041c5e9e8b..498dcf5bf4 100644 --- a/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java @@ -60,7 +60,7 @@ public class LegacyUidlWriter implements Serializable { Collection dirtyVisibleConnectors = ui .getConnectorTracker().getDirtyVisibleConnectors(); - List legacyComponents = new ArrayList( + List legacyComponents = new ArrayList<>( dirtyVisibleConnectors.size()); for (ClientConnector connector : dirtyVisibleConnectors) { // All Components that want to use paintContent must implement diff --git a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java index c4160a92dd..8ec3503be0 100644 --- a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java @@ -334,7 +334,7 @@ public class ServerRpcHandler implements Serializable { try { ConnectorTracker connectorTracker = ui.getConnectorTracker(); - Set enabledConnectors = new HashSet(); + Set enabledConnectors = new HashSet<>(); List invocations = parseInvocations( ui.getConnectorTracker(), invocationsData, @@ -491,7 +491,7 @@ public class ServerRpcHandler implements Serializable { ConnectorTracker connectorTracker, JsonArray invocationsJson, int lastSyncIdSeenByClient) { int invocationCount = invocationsJson.length(); - ArrayList invocations = new ArrayList( + ArrayList invocations = new ArrayList<>( invocationCount); MethodInvocation previousInvocation = null; diff --git a/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java b/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java index 0a890282cd..85b1fda1bf 100644 --- a/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/SessionRequestHandler.java @@ -54,7 +54,7 @@ public class SessionRequestHandler implements RequestHandler { session.lock(); ArrayList requestHandlers; try { - requestHandlers = new ArrayList( + requestHandlers = new ArrayList<>( session.getRequestHandlers()); } finally { session.unlock(); diff --git a/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java b/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java index 1e0efb88ff..73b82fc877 100644 --- a/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java @@ -58,7 +58,7 @@ public class SharedStateWriter implements Serializable { Collection dirtyVisibleConnectors = ui .getConnectorTracker().getDirtyVisibleConnectors(); - Set writtenConnectors = new HashSet(); + Set writtenConnectors = new HashSet<>(); JsonObject sharedStates = Json.createObject(); for (ClientConnector connector : dirtyVisibleConnectors) { // encode and send shared state diff --git a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java index 3028475d1b..7132433963 100644 --- a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java @@ -80,7 +80,7 @@ public class UidlWriter implements Serializable { // to write out service.runPendingAccessTasks(session); - Set processedConnectors = new HashSet(); + Set processedConnectors = new HashSet<>(); LegacyCommunicationManager manager = session.getCommunicationManager(); ClientCache clientCache = manager.getClientCache(ui); @@ -90,7 +90,7 @@ public class UidlWriter implements Serializable { getLogger().log(Level.FINE, "* Creating response to client"); while (true) { - ArrayList connectorsToProcess = new ArrayList(); + ArrayList connectorsToProcess = new ArrayList<>(); for (ClientConnector c : uiConnectorTracker.getDirtyConnectors()) { if (!processedConnectors.contains(c) && LegacyCommunicationManager @@ -209,7 +209,7 @@ public class UidlWriter implements Serializable { .getUsedClientConnectors(); boolean typeMappingsOpen = false; - List> newConnectorTypes = new ArrayList>(); + List> newConnectorTypes = new ArrayList<>(); for (Class class1 : usedClientConnectors) { if (clientCache.cache(class1)) { @@ -284,8 +284,8 @@ public class UidlWriter implements Serializable { } }); - List scriptDependencies = new ArrayList(); - List styleDependencies = new ArrayList(); + List scriptDependencies = new ArrayList<>(); + List styleDependencies = new ArrayList<>(); for (Class class1 : newConnectorTypes) { JavaScript jsAnnotation = class1 diff --git a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java index 2bb44f65dd..fe950b4318 100644 --- a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java +++ b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java @@ -100,7 +100,7 @@ public class SASSAddonImportFileCreator { // Sort addon styles so that CSS imports are first and SCSS import // last - List paths = new ArrayList(addonThemes.keySet()); + List paths = new ArrayList<>(addonThemes.keySet()); Collections.sort(paths, new Comparator() { @Override @@ -117,7 +117,7 @@ public class SASSAddonImportFileCreator { } }); - List mixins = new ArrayList(); + List mixins = new ArrayList<>(); for (String path : paths) { mixins.addAll( addImport(printStream, path, addonThemes.get(path))); @@ -142,7 +142,7 @@ public class SASSAddonImportFileCreator { // Add import comment printImportComment(stream, location); - List foundMixins = new ArrayList(); + List foundMixins = new ArrayList<>(); if (file.endsWith(".css")) { stream.print("@import url(\"../../../" + file + "\");\n"); diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java index da5b692533..5d1bbbfa5f 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -145,8 +145,8 @@ public class ClassPathExplorer { */ public static LocationInfo getAvailableWidgetSetsAndStylesheets() { long start = System.currentTimeMillis(); - Map widgetsets = new HashMap(); - Map themes = new HashMap(); + Map widgetsets = new HashMap<>(); + Map themes = new HashMap<>(); Set keySet = classpathLocations.keySet(); for (String location : keySet) { searchForWidgetSetsAndAddonStyles(location, widgetsets, themes); @@ -298,7 +298,7 @@ public class ClassPathExplorer { */ private final static List getRawClasspathEntries() { // try to keep the order of the classpath - List locations = new ArrayList(); + List locations = new ArrayList<>(); String pathSep = System.getProperty("path.separator"); String classpath = System.getProperty("java.class.path"); @@ -338,7 +338,7 @@ public class ClassPathExplorer { List rawClasspathEntries) { long start = System.currentTimeMillis(); // try to keep the order of the classpath - Map locations = new LinkedHashMap(); + Map locations = new LinkedHashMap<>(); for (String classpathEntry : rawClasspathEntries) { File file = new File(classpathEntry); include(null, file, locations); @@ -520,7 +520,7 @@ public class ClassPathExplorer { public static URL getWidgetsetSourceDirectory(String widgetsetFileName) { if (debug) { debug("classpathLocations values:"); - ArrayList locations = new ArrayList( + ArrayList locations = new ArrayList<>( classpathLocations.keySet()); for (String location : locations) { debug(String.valueOf(classpathLocations.get(location))); diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java index 645c15fc1a..f64b43092f 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java @@ -168,7 +168,7 @@ public class WidgetSetBuilder { private static Collection getCurrentInheritedWidgetsets( String content) { - HashSet hashSet = new HashSet(); + HashSet hashSet = new HashSet<>(); Pattern inheritsPattern = Pattern.compile(" name=\"([^\"]*)\""); Matcher matcher = inheritsPattern.matcher(content); diff --git a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java index 59221fcd83..d435bc806b 100644 --- a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java @@ -63,7 +63,7 @@ public class AbsoluteLayout extends AbstractLayout } }; // Maps each component to a position - private LinkedHashMap componentToCoordinates = new LinkedHashMap(); + private LinkedHashMap componentToCoordinates = new LinkedHashMap<>(); /** * Creates an AbsoluteLayout with full size. @@ -191,7 +191,7 @@ public class AbsoluteLayout extends AbstractLayout // Map was supported. We cannot get the child // connectorId unless the component is attached to the application so // the String->String map cannot be populated in internal* either. - Map connectorToPosition = new HashMap(); + Map connectorToPosition = new HashMap<>(); for (Iterator ci = getComponentIterator(); ci.hasNext();) { Component c = ci.next(); connectorToPosition.put(c.getConnectorId(), diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index 536e831d87..a34b09e9d8 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -197,7 +197,7 @@ public abstract class AbstractComponent extends AbstractClientConnector return; } if (getState().styles == null) { - getState().styles = new ArrayList(); + getState().styles = new ArrayList<>(); } List styles = getState().styles; styles.clear(); @@ -232,7 +232,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } if (getState().styles == null) { - getState().styles = new ArrayList(); + getState().styles = new ArrayList<>(); } List styles = getState().styles; if (!styles.contains(style)) { @@ -1027,7 +1027,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } // check for unsupported attributes - Set supported = new HashSet(); + Set supported = new HashSet<>(); supported.addAll(getDefaultAttributes()); supported.addAll(getCustomAttributes()); for (Attribute a : attr) { @@ -1084,7 +1084,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } } else { // remove responsive extensions - List extensions = new ArrayList( + List extensions = new ArrayList<>( getExtensions()); for (Extension e : extensions) { if (e instanceof Responsive) { @@ -1263,7 +1263,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * implementation */ protected Collection getCustomAttributes() { - ArrayList l = new ArrayList( + ArrayList l = new ArrayList<>( Arrays.asList(customAttributes)); if (this instanceof Focusable) { l.add("tab-index"); diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java index 4dacf2c64a..b5fe4e9bcd 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java @@ -62,7 +62,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent */ @Override public void removeAllComponents() { - final LinkedList l = new LinkedList(); + final LinkedList l = new LinkedList<>(); // Adds all components for (final Iterator i = getComponentIterator(); i @@ -83,7 +83,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent */ @Override public void moveComponentsFrom(ComponentContainer source) { - final LinkedList components = new LinkedList(); + final LinkedList components = new LinkedList<>(); for (final Iterator i = source.getComponentIterator(); i .hasNext();) { components.add(i.next()); @@ -301,7 +301,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent : ComponentSizeValidator.checkWidths(component); if (!valid) { if (components == null) { - components = new HashSet(); + components = new HashSet<>(); } components.add(component); } diff --git a/server/src/main/java/com/vaadin/ui/AbstractMedia.java b/server/src/main/java/com/vaadin/ui/AbstractMedia.java index f24c3e5e08..f56f6a7f27 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMedia.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMedia.java @@ -152,7 +152,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @return The sources pointed to in this media. */ public List getSources() { - ArrayList sources = new ArrayList(); + ArrayList sources = new ArrayList<>(); for (URLReference ref : getState(false).sources) { sources.add(((ResourceReference) ref).getResource()); } diff --git a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java index 453adb2579..331a0e72be 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java @@ -58,7 +58,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout /** * Custom layout slots containing the components. */ - protected LinkedList components = new LinkedList(); + protected LinkedList components = new LinkedList<>(); private Alignment defaultComponentAlignment = Alignment.TOP_LEFT; diff --git a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java index d92d554cf5..fd2c0029d1 100644 --- a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java @@ -67,21 +67,21 @@ import elemental.json.JsonObject; */ public class ConnectorTracker implements Serializable { - private final HashMap connectorIdToConnector = new HashMap(); - private Set dirtyConnectors = new HashSet(); - private Set uninitializedConnectors = new HashSet(); + private final HashMap connectorIdToConnector = new HashMap<>(); + private Set dirtyConnectors = new HashSet<>(); + private Set uninitializedConnectors = new HashSet<>(); /** * Connectors that have been unregistered and should be cleaned up the next * time {@link #cleanConnectorMap()} is invoked unless they have been * registered again. */ - private final Set unregisteredConnectors = new HashSet(); + private final Set unregisteredConnectors = new HashSet<>(); private boolean writingResponse = false; private UI uI; - private transient Map diffStates = new HashMap(); + private transient Map diffStates = new HashMap<>(); /** Maps connectorIds to a map of named StreamVariables */ private Map> pidToNameToStreamVariable; @@ -96,7 +96,7 @@ public class ConnectorTracker implements Serializable { * @see #getCurrentSyncId() * @see #cleanConcurrentlyRemovedConnectorIds(long) */ - private TreeMap> syncIdToUnregisteredConnectorIds = new TreeMap>(); + private TreeMap> syncIdToUnregisteredConnectorIds = new TreeMap<>(); /** * Gets a logger for this class @@ -185,7 +185,7 @@ public class ConnectorTracker implements Serializable { Set unregisteredConnectorIds = syncIdToUnregisteredConnectorIds .get(currentSyncId); if (unregisteredConnectorIds == null) { - unregisteredConnectorIds = new HashSet(); + unregisteredConnectorIds = new HashSet<>(); syncIdToUnregisteredConnectorIds.put(currentSyncId, unregisteredConnectorIds); } @@ -438,10 +438,10 @@ public class ConnectorTracker implements Serializable { private boolean isHierarchyComplete() { boolean noErrors = true; - Set danglingConnectors = new HashSet( + Set danglingConnectors = new HashSet<>( connectorIdToConnector.values()); - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(uI); while (!stack.isEmpty()) { ClientConnector connector = stack.pop(); @@ -623,7 +623,7 @@ public class ConnectorTracker implements Serializable { */ public ArrayList getDirtyVisibleConnectors() { Collection dirtyConnectors = getDirtyConnectors(); - ArrayList dirtyVisibleConnectors = new ArrayList( + ArrayList dirtyVisibleConnectors = new ArrayList<>( dirtyConnectors.size()); for (ClientConnector c : dirtyConnectors) { if (LegacyCommunicationManager.isConnectorVisibleToClient(c)) { @@ -706,7 +706,7 @@ public class ConnectorTracker implements Serializable { out.defaultWriteObject(); // Convert JsonObjects in diff state to String representation as // JsonObject is not serializable - HashMap stringDiffStates = new HashMap( + HashMap stringDiffStates = new HashMap<>( diffStates.size() * 2); for (ClientConnector key : diffStates.keySet()) { stringDiffStates.put(key, diffStates.get(key).toString()); @@ -721,11 +721,11 @@ public class ConnectorTracker implements Serializable { // Read String versions of JsonObjects and parse into JsonObjects as // JsonObject is not serializable - diffStates = new HashMap(); + diffStates = new HashMap<>(); @SuppressWarnings("unchecked") HashMap stringDiffStates = (HashMap) in .readObject(); - diffStates = new HashMap( + diffStates = new HashMap<>( stringDiffStates.size() * 2); for (ClientConnector key : stringDiffStates.keySet()) { try { @@ -770,18 +770,18 @@ public class ConnectorTracker implements Serializable { StreamVariable variable) { assert getConnector(connectorId) != null; if (pidToNameToStreamVariable == null) { - pidToNameToStreamVariable = new HashMap>(); + pidToNameToStreamVariable = new HashMap<>(); } Map nameToStreamVariable = pidToNameToStreamVariable .get(connectorId); if (nameToStreamVariable == null) { - nameToStreamVariable = new HashMap(); + nameToStreamVariable = new HashMap<>(); pidToNameToStreamVariable.put(connectorId, nameToStreamVariable); } nameToStreamVariable.put(variableName, variable); if (streamVariableToSeckey == null) { - streamVariableToSeckey = new HashMap(); + streamVariableToSeckey = new HashMap<>(); } String seckey = streamVariableToSeckey.get(variable); if (seckey == null) { diff --git a/server/src/main/java/com/vaadin/ui/CssLayout.java b/server/src/main/java/com/vaadin/ui/CssLayout.java index 982c55cab2..381e7aa463 100644 --- a/server/src/main/java/com/vaadin/ui/CssLayout.java +++ b/server/src/main/java/com/vaadin/ui/CssLayout.java @@ -85,7 +85,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { /** * Custom layout slots containing the components. */ - protected LinkedList components = new LinkedList(); + protected LinkedList components = new LinkedList<>(); /** * Constructs an empty CssLayout. diff --git a/server/src/main/java/com/vaadin/ui/CustomLayout.java b/server/src/main/java/com/vaadin/ui/CustomLayout.java index 11ab9c2f0e..179969765d 100644 --- a/server/src/main/java/com/vaadin/ui/CustomLayout.java +++ b/server/src/main/java/com/vaadin/ui/CustomLayout.java @@ -67,7 +67,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { /** * Custom layout slots containing the components. */ - private final HashMap slots = new HashMap(); + private final HashMap slots = new HashMap<>(); /** * Default constructor only used by subclasses. Subclasses are responsible diff --git a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java index 280f80ee21..deffa06631 100644 --- a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java +++ b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java @@ -120,7 +120,7 @@ public class DragAndDropWrapper extends CustomComponent } }; - private Map receivers = new HashMap(); + private Map receivers = new HashMap<>(); public class WrapperTargetDetails extends TargetDetailsImpl { @@ -191,11 +191,11 @@ public class DragAndDropWrapper extends CustomComponent COMPONENT_OTHER, } - private final Map html5DataFlavors = new LinkedHashMap(); + private final Map html5DataFlavors = new LinkedHashMap<>(); private DragStartMode dragStartMode = DragStartMode.NONE; private Component dragImageComponent = null; - private Set sentIds = new HashSet(); + private Set sentIds = new HashSet<>(); /** * This is an internal constructor. Use diff --git a/server/src/main/java/com/vaadin/ui/Embedded.java b/server/src/main/java/com/vaadin/ui/Embedded.java index 382b0d47c3..b0c7f1725b 100644 --- a/server/src/main/java/com/vaadin/ui/Embedded.java +++ b/server/src/main/java/com/vaadin/ui/Embedded.java @@ -88,7 +88,7 @@ public class Embedded extends AbstractComponent implements LegacyComponent { /** * Hash of object parameters. */ - private final Map parameters = new HashMap(); + private final Map parameters = new HashMap<>(); /** * Applet or other client side runnable properties. diff --git a/server/src/main/java/com/vaadin/ui/Flash.java b/server/src/main/java/com/vaadin/ui/Flash.java index c6eac450ef..faec5a83d9 100644 --- a/server/src/main/java/com/vaadin/ui/Flash.java +++ b/server/src/main/java/com/vaadin/ui/Flash.java @@ -201,7 +201,7 @@ public class Flash extends AbstractEmbedded { */ public void setParameter(String name, String value) { if (getState().embedParams == null) { - getState().embedParams = new HashMap(); + getState().embedParams = new HashMap<>(); } getState().embedParams.put(name, value); requestRepaint(); @@ -238,7 +238,7 @@ public class Flash extends AbstractEmbedded { super.writeDesign(design, designContext); // Parameters, in alphabetic order - ArrayList paramNames = new ArrayList(); + ArrayList paramNames = new ArrayList<>(); for (String param : getParameterNames()) { paramNames.add(param); } diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java index 546a89cdfc..6e74071f65 100644 --- a/server/src/main/java/com/vaadin/ui/GridLayout.java +++ b/server/src/main/java/com/vaadin/ui/GridLayout.java @@ -97,10 +97,10 @@ public class GridLayout extends AbstractLayout */ private int cursorY = 0; - private final LinkedList components = new LinkedList(); + private final LinkedList components = new LinkedList<>(); - private Map columnExpandRatio = new HashMap(); - private Map rowExpandRatio = new HashMap(); + private Map columnExpandRatio = new HashMap<>(); + private Map rowExpandRatio = new HashMap<>(); private Alignment defaultComponentAlignment = Alignment.TOP_LEFT; /** @@ -1290,8 +1290,8 @@ public class GridLayout extends AbstractLayout setMargin(readMargin(design, getMargin(), designContext)); - List rowElements = new ArrayList(); - List> rows = new ArrayList>(); + List rowElements = new ArrayList<>(); + List> rows = new ArrayList<>(); // Prepare a 2D map for reading column contents for (Element e : design.children()) { if (e.tagName().equalsIgnoreCase("row")) { @@ -1301,8 +1301,8 @@ public class GridLayout extends AbstractLayout } } setRows(Math.max(rows.size(), 1)); - Map alignments = new HashMap(); - List columnExpandRatios = new ArrayList(); + Map alignments = new HashMap<>(); + List columnExpandRatios = new ArrayList<>(); for (int row = 0; row < rowElements.size(); ++row) { Element rowElement = rowElements.get(row); @@ -1386,7 +1386,7 @@ public class GridLayout extends AbstractLayout } // Reiterate through the 2D map and add components to GridLayout - Set visited = new HashSet(); + Set visited = new HashSet<>(); // Ignore any missing components visited.add(null); @@ -1457,7 +1457,7 @@ public class GridLayout extends AbstractLayout } // Go through the map and write only needed column tags - Set visited = new HashSet(); + Set visited = new HashSet<>(); // Skip the dummy placeholder visited.add(dummyComponent); diff --git a/server/src/main/java/com/vaadin/ui/JavaScript.java b/server/src/main/java/com/vaadin/ui/JavaScript.java index b51577c4ac..92320c6df1 100644 --- a/server/src/main/java/com/vaadin/ui/JavaScript.java +++ b/server/src/main/java/com/vaadin/ui/JavaScript.java @@ -38,7 +38,7 @@ import elemental.json.JsonException; * @since 7.0.0 */ public class JavaScript extends AbstractExtension { - private Map functions = new HashMap(); + private Map functions = new HashMap<>(); // Can not be defined in client package as this JSONArray is not available // in GWT diff --git a/server/src/main/java/com/vaadin/ui/LoginForm.java b/server/src/main/java/com/vaadin/ui/LoginForm.java index 9e986d34fb..fe31eb3d75 100644 --- a/server/src/main/java/com/vaadin/ui/LoginForm.java +++ b/server/src/main/java/com/vaadin/ui/LoginForm.java @@ -353,7 +353,7 @@ public class LoginForm extends AbstractSingleComponentContainer { * URL in the method or the password manager will not be triggered. */ private void login() { - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put("username", getUsernameField().getValue()); params.put("password", getPasswordField().getValue()); LoginEvent event = new LoginEvent(LoginForm.this, params); diff --git a/server/src/main/java/com/vaadin/ui/MenuBar.java b/server/src/main/java/com/vaadin/ui/MenuBar.java index db252b0619..24f2dd89b3 100644 --- a/server/src/main/java/com/vaadin/ui/MenuBar.java +++ b/server/src/main/java/com/vaadin/ui/MenuBar.java @@ -162,7 +162,7 @@ public class MenuBar extends AbstractComponent /** Deserialize changes received from client. */ @Override public void changeVariables(Object source, Map variables) { - Stack items = new Stack(); + Stack items = new Stack<>(); boolean found = false; if (variables.containsKey("clickedId")) { @@ -205,7 +205,7 @@ public class MenuBar extends AbstractComponent * Constructs an empty, horizontal menu */ public MenuBar() { - menuItems = new ArrayList(); + menuItems = new ArrayList<>(); setMoreMenuItem(null); } @@ -554,7 +554,7 @@ public class MenuBar extends AbstractComponent } if (itsChildren == null) { - itsChildren = new ArrayList(); + itsChildren = new ArrayList<>(); } MenuItem newItem = new MenuItem(caption, icon, command); @@ -1005,7 +1005,7 @@ public class MenuBar extends AbstractComponent } String caption = ""; - List subMenus = new ArrayList(); + List subMenus = new ArrayList<>(); for (Node node : menuElement.childNodes()) { if (node instanceof Element && ((Element) node).tagName().equals("menu")) { @@ -1051,7 +1051,7 @@ public class MenuBar extends AbstractComponent } if (!subMenus.isEmpty()) { - menu.itsChildren = new ArrayList(); + menu.itsChildren = new ArrayList<>(); } for (Element subMenu : subMenus) { diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index ff9e1813f6..a03b342ba0 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -106,12 +106,12 @@ public class TabSheet extends AbstractComponentContainer * there is a {@link Tab} object in tabs for each tab with meta-data about * the tab. */ - private final ArrayList components = new ArrayList(); + private final ArrayList components = new ArrayList<>(); /** * Map containing information related to the tabs (caption, icon etc). */ - private final HashMap tabs = new HashMap(); + private final HashMap tabs = new HashMap<>(); /** * Selected tab content component. @@ -122,7 +122,7 @@ public class TabSheet extends AbstractComponentContainer * Mapper between server-side component instances (tab contents) and keys * given to the client that identify tabs. */ - private final KeyMapper keyMapper = new KeyMapper(); + private final KeyMapper keyMapper = new KeyMapper<>(); /** * Handler to be called when a tab is closed. diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java index 4454f96596..82bbea7039 100644 --- a/server/src/main/java/com/vaadin/ui/UI.java +++ b/server/src/main/java/com/vaadin/ui/UI.java @@ -116,7 +116,7 @@ public abstract class UI extends AbstractSingleComponentContainer /** * List of windows in this UI. */ - private final LinkedHashSet windows = new LinkedHashSet(); + private final LinkedHashSet windows = new LinkedHashSet<>(); /** * The component that should be scrolled into view after the next repaint. @@ -415,7 +415,7 @@ public abstract class UI extends AbstractSingleComponentContainer public Iterator iterator() { // TODO could directly create some kind of combined iterator instead of // creating a new ArrayList - ArrayList components = new ArrayList(); + ArrayList components = new ArrayList<>(); if (getContent() != null) { components.add(getContent()); diff --git a/server/src/main/java/com/vaadin/ui/Upload.java b/server/src/main/java/com/vaadin/ui/Upload.java index 915e2035fa..9077a35b95 100644 --- a/server/src/main/java/com/vaadin/ui/Upload.java +++ b/server/src/main/java/com/vaadin/ui/Upload.java @@ -783,7 +783,7 @@ public class Upload extends AbstractComponent */ public void addProgressListener(ProgressListener listener) { if (progressListeners == null) { - progressListeners = new LinkedHashSet(); + progressListeners = new LinkedHashSet<>(); } progressListeners.add(listener); } diff --git a/server/src/main/java/com/vaadin/ui/Window.java b/server/src/main/java/com/vaadin/ui/Window.java index 6ad8ef500b..c0eac75970 100644 --- a/server/src/main/java/com/vaadin/ui/Window.java +++ b/server/src/main/java/com/vaadin/ui/Window.java @@ -106,7 +106,7 @@ public class Window extends Panel /** * Holds registered CloseShortcut instances for query and later removal */ - private List closeShortcuts = new ArrayList( + private List closeShortcuts = new ArrayList<>( 4); /** @@ -1398,7 +1398,7 @@ public class Window extends Panel @Override protected void readDesignChildren(Elements children, DesignContext context) { - List descriptions = new ArrayList(); + List descriptions = new ArrayList<>(); Elements content = new Elements(); for (Element child : children) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java index ba5c279ed1..a70ab256e1 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -55,7 +55,7 @@ public class DesignAttributeHandler implements Serializable { return Logger.getLogger(DesignAttributeHandler.class.getName()); } - private static Map, AttributeCacheEntry> cache = new ConcurrentHashMap, AttributeCacheEntry>(); + private static Map, AttributeCacheEntry> cache = new ConcurrentHashMap<>(); // translates string <-> object private static DesignFormatter FORMATTER = new DesignFormatter(); @@ -81,7 +81,7 @@ public class DesignAttributeHandler implements Serializable { for (Attribute a : attr.asList()) { attr.remove(a.getKey()); } - List children = new ArrayList(); + List children = new ArrayList<>(); children.addAll(design.childNodes()); for (Node node : children) { node.remove(); @@ -428,7 +428,7 @@ public class DesignAttributeHandler implements Serializable { * @author Vaadin Ltd */ private static class AttributeCacheEntry implements Serializable { - private Map accessMethods = new ConcurrentHashMap(); + private Map accessMethods = new ConcurrentHashMap<>(); private void addAttribute(String attribute, Method getter, Method setter) { @@ -439,7 +439,7 @@ public class DesignAttributeHandler implements Serializable { } private Collection getAttributes() { - ArrayList attributes = new ArrayList(); + ArrayList attributes = new ArrayList<>(); attributes.addAll(accessMethods.keySet()); return attributes; } diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java index 505437d778..35145c45fb 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java @@ -64,7 +64,7 @@ public class DesignContext implements Serializable { private static final String VAADIN7_UI_PACKAGE = "com.vaadin.v7.ui"; // cache for object instances - private static Map, Component> instanceCache = new ConcurrentHashMap, Component>(); + private static Map, Component> instanceCache = new ConcurrentHashMap<>(); // The root component of the component hierarchy private Component rootComponent = null; @@ -74,20 +74,20 @@ public class DesignContext implements Serializable { public static final String CAPTION_ATTRIBUTE = "caption"; public static final String LOCAL_ID_ATTRIBUTE = "_id"; // Mappings from ids to components. Modified when reading from design. - private Map idToComponent = new HashMap(); - private Map localIdToComponent = new HashMap(); - private Map captionToComponent = new HashMap(); + private Map idToComponent = new HashMap<>(); + private Map localIdToComponent = new HashMap<>(); + private Map captionToComponent = new HashMap<>(); // Mapping from components to local ids. Accessed when writing to // design. Modified when reading from design. - private Map componentToLocalId = new HashMap(); + private Map componentToLocalId = new HashMap<>(); private Document doc; // required for calling createElement(String) // namespace mappings - private Map packageToPrefix = new HashMap(); - private Map prefixToPackage = new HashMap(); - private final Map> customAttributes = new HashMap>(); + private Map packageToPrefix = new HashMap<>(); + private Map prefixToPackage = new HashMap<>(); + private final Map> customAttributes = new HashMap<>(); // component creation listeners - private List listeners = new ArrayList(); + private List listeners = new ArrayList<>(); private ShouldWriteDataDelegate shouldWriteDataDelegate = ShouldWriteDataDelegate.DEFAULT; @@ -828,7 +828,7 @@ public class DesignContext implements Serializable { Map map = customAttributes.get(component); if (map == null) { customAttributes.put(component, - map = new HashMap()); + map = new HashMap<>()); } map.put(attribute, value); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java index 0fcefe0a27..203954dd27 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java @@ -55,7 +55,7 @@ import com.vaadin.ui.declarative.converters.DesignToStringConverter; */ public class DesignFormatter implements Serializable { - private final Map, Converter> converterMap = new ConcurrentHashMap, Converter>(); + private final Map, Converter> converterMap = new ConcurrentHashMap<>(); private final Converter stringObjectConverter = new DesignObjectConverter(); /** diff --git a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java index 25469b8cde..3d7dcc20d9 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java +++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java @@ -40,7 +40,7 @@ public class FieldBinder implements Serializable { // the instance containing the bound fields private Object bindTarget; // mapping between field names and Fields - private Map fieldMap = new HashMap(); + private Map fieldMap = new HashMap<>(); /** * Creates a new instance of LayoutFieldBinder. @@ -79,7 +79,7 @@ public class FieldBinder implements Serializable { * @return a collection of fields assignable to Component that are not bound */ public Collection getUnboundFields() throws FieldBindingException { - List unboundFields = new ArrayList(); + List unboundFields = new ArrayList<>(); for (Field f : fieldMap.values()) { try { Object value = getFieldValue(bindTarget, f); @@ -252,7 +252,7 @@ public class FieldBinder implements Serializable { */ protected static List getFields( Class searchClass) { - ArrayList memberFields = new ArrayList(); + ArrayList memberFields = new ArrayList<>(); for (java.lang.reflect.Field memberField : searchClass .getDeclaredFields()) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index cc9d6ac655..1efc382fcc 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -169,7 +169,7 @@ public class DesignResourceConverter implements Converter { return ((ExternalResource) value).getURL(); } - private static Map, ResourceConverterByProtocol> typeToConverter = new HashMap, ResourceConverterByProtocol>(); + private static Map, ResourceConverterByProtocol> typeToConverter = new HashMap<>(); static { typeToConverter.put(ExternalResource.class, HTTP); // ^ any of non-specialized would actually work diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java index fdd61f0489..2468c29c8c 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java @@ -40,7 +40,7 @@ public class DesignShortcutActionConverter private final Map presentationMap; public DesignShortcutActionConverter() { - HashMap codes = new HashMap(); + HashMap 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 presentations = new HashMap(); + HashMap presentations = new HashMap<>(); for (Entry entry : keyCodeMap.entrySet()) { presentations.put(entry.getValue(), entry.getKey()); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java b/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java index 1862173aba..b1010d811d 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/ShortcutKeyMapper.java @@ -54,8 +54,8 @@ public interface ShortcutKeyMapper extends Serializable { */ public static final ShortcutKeyMapper DEFAULT = new ShortcutKeyMapper() { - private final Map keyCodeMap = new ConcurrentHashMap(); - private final Map presentationMap = new ConcurrentHashMap(); + private final Map keyCodeMap = new ConcurrentHashMap<>(); + private final Map presentationMap = new ConcurrentHashMap<>(); { // map modifiers diff --git a/server/src/main/java/com/vaadin/util/ConnectorHelper.java b/server/src/main/java/com/vaadin/util/ConnectorHelper.java index 3cb6a1c425..5b5958175b 100644 --- a/server/src/main/java/com/vaadin/util/ConnectorHelper.java +++ b/server/src/main/java/com/vaadin/util/ConnectorHelper.java @@ -66,7 +66,7 @@ public class ConnectorHelper { */ public static void writeHierarchyInformation(ClientConnector connector, StringBuilder builder) { - LinkedList h = new LinkedList(); + LinkedList h = new LinkedList<>(); h.add(connector); ClientConnector parent = connector.getParent(); while (parent != null) { diff --git a/server/src/main/java/com/vaadin/util/CurrentInstance.java b/server/src/main/java/com/vaadin/util/CurrentInstance.java index be5300e915..f8d6af2a4c 100644 --- a/server/src/main/java/com/vaadin/util/CurrentInstance.java +++ b/server/src/main/java/com/vaadin/util/CurrentInstance.java @@ -72,7 +72,7 @@ public class CurrentInstance implements Serializable { return null; } - Map, CurrentInstance> value = new HashMap, CurrentInstance>(); + Map, CurrentInstance> value = new HashMap<>(); // Copy all inheritable values to child map for (Entry, CurrentInstance> e : parentValue.entrySet()) { @@ -86,7 +86,7 @@ public class CurrentInstance implements Serializable { }; private CurrentInstance(Object instance, boolean inheritable) { - this.instance = new WeakReference(instance); + this.instance = new WeakReference<>(instance); this.inheritable = inheritable; } @@ -200,7 +200,7 @@ public class CurrentInstance implements Serializable { } else { assert type.isInstance(instance) : "Invald instance type"; if (map == null) { - map = new HashMap, CurrentInstance>(); + map = new HashMap<>(); instances.set(map); } @@ -286,7 +286,7 @@ public class CurrentInstance implements Serializable { if (map == null) { return Collections.emptyMap(); } else { - Map, CurrentInstance> copy = new HashMap, CurrentInstance>(); + Map, CurrentInstance> copy = new HashMap<>(); boolean removeStale = false; for (Class c : map.keySet()) { CurrentInstance ci = map.get(c); @@ -338,7 +338,7 @@ public class CurrentInstance implements Serializable { */ public static Map, CurrentInstance> setCurrent( VaadinSession session) { - Map, CurrentInstance> old = new HashMap, CurrentInstance>(); + Map, CurrentInstance> old = new HashMap<>(); old.put(VaadinSession.class, set(VaadinSession.class, session, true)); VaadinService service = null; if (session != null) { diff --git a/server/src/main/java/com/vaadin/util/FileTypeResolver.java b/server/src/main/java/com/vaadin/util/FileTypeResolver.java index 7700ff9563..305bc1c5d7 100644 --- a/server/src/main/java/com/vaadin/util/FileTypeResolver.java +++ b/server/src/main/java/com/vaadin/util/FileTypeResolver.java @@ -210,12 +210,12 @@ public class FileTypeResolver implements Serializable { /** * File extension to MIME type mapping. All extensions are in lower case. */ - static private Hashtable extToMIMEMap = new Hashtable(); + static private Hashtable extToMIMEMap = new Hashtable<>(); /** * MIME type to Icon mapping. */ - static private Hashtable MIMEToIconMap = new Hashtable(); + static private Hashtable MIMEToIconMap = new Hashtable<>(); static { -- cgit v1.2.3