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 /server/src | |
parent | 1827ccb5ed99c9b2deeea38e239527420711f5d1 (diff) | |
download | vaadin-framework-7065740d6d02954c3483e2f24db36ad1af45c62e.tar.gz vaadin-framework-7065740d6d02954c3483e2f24db36ad1af45c62e.zip |
Use interface instead of implementation (#10073)
Diffstat (limited to 'server/src')
25 files changed, 76 insertions, 72 deletions
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); - } } |