]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove redundant array creation for varargs
authorPer-Åke Minborg <minborg@speedment.com>
Sat, 29 Oct 2016 04:17:38 +0000 (21:17 -0700)
committerHenri Sara <hesara@vaadin.com>
Sat, 5 Nov 2016 01:52:05 +0000 (03:52 +0200)
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf722f

server/src/main/java/com/vaadin/event/ListenerMethod.java
server/src/main/java/com/vaadin/server/VaadinPortlet.java
server/src/main/java/com/vaadin/server/VaadinService.java
server/src/main/java/com/vaadin/ui/PopupView.java
server/src/main/java/com/vaadin/ui/TabSheet.java
server/src/main/java/com/vaadin/ui/Upload.java
server/src/main/java/com/vaadin/ui/Window.java
server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java

index f20a14a034e6ccb9b91981e82a0abfc397a8311a..a47aa453343201c907d1d51654c3400e65ca446d 100644 (file)
@@ -507,7 +507,7 @@ public class ListenerMethod implements EventListener, Serializable {
             try {
                 if (eventArgumentIndex >= 0) {
                     if (eventArgumentIndex == 0 && arguments.length == 1) {
-                        method.invoke(target, new Object[] { event });
+                        method.invoke(target, event);
                     } else {
                         final Object[] arg = new Object[arguments.length];
                         System.arraycopy(arguments, 0, arg, 0, arg.length);
index 81b3b6aa07e41a329cfbdf1a36623ab48884a1b8..84f90d70e3baf21f266c676797a3a1f4461c2bf4 100644 (file)
@@ -245,7 +245,7 @@ public class VaadinPortlet extends GenericPortlet
                 Method method = targetClass.getMethod(methodName,
                         parameterClass);
 
-                return method.invoke(null, new Object[] { argument });
+                return method.invoke(null, argument);
             } catch (InvocationTargetException ite) {
                 throw (Exception) ite.getCause();
             } finally {
@@ -359,8 +359,8 @@ public class VaadinPortlet extends GenericPortlet
                     Class<?> portletRequestClass = Class.forName(
                             "com.bea.portlet.container.PortletRequestImpl");
                     servletRequestMethod = portletRequestClass
-                            .getDeclaredMethod("getInternalRequest",
-                                    new Class[] {});
+                            .getDeclaredMethod("getInternalRequest"
+                            );
                     servletRequestMethod.setAccessible(true);
                 }
 
index 3899965622c577f967eb400c92633f5f1fbf4831..af61064ada2259d57fd21fa7baf5d2a6cef42f36 100644 (file)
@@ -164,9 +164,9 @@ public abstract class VaadinService implements Serializable {
                 final Class<?> classLoaderClass = getClass().getClassLoader()
                         .loadClass(classLoaderName);
                 final Constructor<?> c = classLoaderClass
-                        .getConstructor(new Class[] { ClassLoader.class });
+                        .getConstructor(ClassLoader.class);
                 setClassLoader((ClassLoader) c.newInstance(
-                        new Object[] { getClass().getClassLoader() }));
+                        getClass().getClassLoader()));
             } catch (final Exception e) {
                 throw new RuntimeException(
                         "Could not find specified class loader: "
index 497e052f22b99c59cbe979f641d832db7f2118f2..7223facdfe2a83de662f2d9e68ec6d3a1e510101 100644 (file)
@@ -49,7 +49,7 @@ public class PopupView extends AbstractComponent implements HasComponents {
         try {
             POPUP_VISIBILITY_METHOD = PopupVisibilityListener.class
                     .getDeclaredMethod("popupVisibilityChange",
-                            new Class[] { PopupVisibilityEvent.class });
+                            PopupVisibilityEvent.class);
         } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException(
index b246e147968ca1ccdacc14c6a954aa3dea95bee0..cef21eff4954cec7e50b60ccbb15034e37c8864f 100644 (file)
@@ -772,7 +772,7 @@ public class TabSheet extends AbstractComponentContainer
         try {
             SELECTED_TAB_CHANGE_METHOD = SelectedTabChangeListener.class
                     .getDeclaredMethod("selectedTabChange",
-                            new Class[] { SelectedTabChangeEvent.class });
+                            SelectedTabChangeEvent.class);
         } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException(
index a08fce099e26c42d7d8cd49556f27811a418baca..11eb553018085515e6b8cc598d3b135dd8f1f537 100644 (file)
@@ -230,13 +230,13 @@ public class Upload extends AbstractComponent
     static {
         try {
             UPLOAD_FINISHED_METHOD = FinishedListener.class.getDeclaredMethod(
-                    "uploadFinished", new Class[] { FinishedEvent.class });
+                    "uploadFinished", FinishedEvent.class);
             UPLOAD_FAILED_METHOD = FailedListener.class.getDeclaredMethod(
-                    "uploadFailed", new Class[] { FailedEvent.class });
+                    "uploadFailed", FailedEvent.class);
             UPLOAD_STARTED_METHOD = StartedListener.class.getDeclaredMethod(
-                    "uploadStarted", new Class[] { StartedEvent.class });
+                    "uploadStarted", StartedEvent.class);
             UPLOAD_SUCCEEDED_METHOD = SucceededListener.class.getDeclaredMethod(
-                    "uploadSucceeded", new Class[] { SucceededEvent.class });
+                    "uploadSucceeded", SucceededEvent.class);
         } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException(
index 1e4f43067fccfd01c9afa29f6599c79a9c5c51a4..318f48548d1885571cee0990cb139438b5b8fe8c 100644 (file)
@@ -337,7 +337,7 @@ public class Window extends Panel
     static {
         try {
             WINDOW_CLOSE_METHOD = CloseListener.class.getDeclaredMethod(
-                    "windowClose", new Class[] { CloseEvent.class });
+                    "windowClose", CloseEvent.class);
         } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException(
@@ -541,7 +541,7 @@ public class Window extends Panel
     static {
         try {
             WINDOW_RESIZE_METHOD = ResizeListener.class.getDeclaredMethod(
-                    "windowResized", new Class[] { ResizeEvent.class });
+                    "windowResized", ResizeEvent.class);
         } catch (final java.lang.NoSuchMethodException e) {
             // This should never happen
             throw new java.lang.RuntimeException(
index dc702b5b179171465514bda0e6e9bce3c6efe409..97646923458a63ec9c70183446bc0ebeb084e874 100644 (file)
@@ -37,8 +37,7 @@ import com.vaadin.ui.VerticalLayout;
 public class AbstractOrderedLayoutDeclarativeTest
         extends DeclarativeMarginTestBase<AbstractOrderedLayout> {
 
-    private List<String> defaultAlignments = Arrays
-            .asList(new String[] { ":top", ":left" });
+    private List<String> defaultAlignments = Arrays.asList(":top", ":left");
 
     @Test
     public void testMargins() {