Use varargs reflection methods.
For slightly more readable code.
Reformatted some files so autoformat doesn't create space/tab mixtures.
Change-Id: I763749fd305d30a278bd839abd67602fc0792eab
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.core.databinding.beans/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.databinding.beans/META-INF/MANIFEST.MF
index ec6a52d..92e330e 100644
--- a/bundles/org.eclipse.core.databinding.beans/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.databinding.beans/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.databinding.beans
-Bundle-Version: 1.4.200.qualifier
+Bundle-Version: 1.4.300.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.core.databinding.beans/pom.xml b/bundles/org.eclipse.core.databinding.beans/pom.xml
index 850c288..51546f4 100644
--- a/bundles/org.eclipse.core.databinding.beans/pom.xml
+++ b/bundles/org.eclipse.core.databinding.beans/pom.xml
@@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.databinding.beans</artifactId>
- <version>1.4.200-SNAPSHOT</version>
+ <version>1.4.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyHelper.java b/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyHelper.java
index 14aa9fe..6299ef3 100644
--- a/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyHelper.java
+++ b/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2014 Matthew Hall and others.
+ * Copyright (c) 2008, 2018 Matthew Hall and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -59,7 +59,7 @@
if (!writeMethod.isAccessible()) {
writeMethod.setAccessible(true);
}
- writeMethod.invoke(source, new Object[] { value });
+ writeMethod.invoke(source, value);
} catch (InvocationTargetException e) {
/*
* InvocationTargetException wraps any exception thrown by the
diff --git a/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyListenerSupport.java b/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyListenerSupport.java
index 18ae065..2153a69 100644
--- a/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyListenerSupport.java
+++ b/bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/beans/BeanPropertyListenerSupport.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -89,15 +89,11 @@
try {
try {
- method = bean.getClass().getMethod(
- methodName,
- new Class[] { String.class,
- PropertyChangeListener.class });
+ method = bean.getClass().getMethod(methodName, String.class, PropertyChangeListener.class);
parameters = new Object[] { propertyName, listener };
} catch (NoSuchMethodException e) {
- method = bean.getClass().getMethod(methodName,
- new Class[] { PropertyChangeListener.class });
+ method = bean.getClass().getMethod(methodName, PropertyChangeListener.class);
parameters = new Object[] { listener };
}
diff --git a/bundles/org.eclipse.core.databinding/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.databinding/META-INF/MANIFEST.MF
index cf7308c..2825a42 100644
--- a/bundles/org.eclipse.core.databinding/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.databinding/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.databinding
-Bundle-Version: 1.7.0.qualifier
+Bundle-Version: 1.7.100.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.core.databinding/pom.xml b/bundles/org.eclipse.core.databinding/pom.xml
index 9ca4976..99fe1d3 100644
--- a/bundles/org.eclipse.core.databinding/pom.xml
+++ b/bundles/org.eclipse.core.databinding/pom.xml
@@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.databinding</artifactId>
- <version>1.7.0-SNAPSHOT</version>
+ <version>1.7.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/NumberToStringConverter.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/NumberToStringConverter.java
index 04a85e5..5dc1639 100644
--- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/NumberToStringConverter.java
+++ b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/NumberToStringConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,7 +57,7 @@
*/
try {
icuBigDecimal = Class.forName("com.ibm.icu.math.BigDecimal"); //$NON-NLS-1$
- icuBigDecimalCtr = icuBigDecimal.getConstructor(new Class[] {BigInteger.class, int.class});
+ icuBigDecimalCtr = icuBigDecimal.getConstructor(BigInteger.class, int.class);
// System.out.println("DEBUG: Full ICU4J support state: icuBigDecimal="+(icuBigDecimal != null)+", icuBigDecimalCtr="+(icuBigDecimalCtr != null)); //$NON-NLS-1$ //$NON-NLS-2$
}
catch(ClassNotFoundException e) {}
@@ -133,7 +133,7 @@
// Full ICU4J present. Convert java.math.BigDecimal to ICU BigDecimal to format. Bug #180392.
BigDecimal o = (BigDecimal) fromObject;
try {
- fromObject = icuBigDecimalCtr.newInstance(new Object[] {o.unscaledValue(), Integer.valueOf(o.scale())});
+ fromObject = icuBigDecimalCtr.newInstance(o.unscaledValue(), Integer.valueOf(o.scale()));
}
catch(InstantiationException e) {}
catch(InvocationTargetException e) {}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyPaddingSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyPaddingSWTHandler.java
index 82bcff4..3aa0837 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyPaddingSWTHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyPaddingSWTHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 IBM Corporation and others.
+ * Copyright (c) 2010, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -181,7 +181,7 @@
}
try {
- Method m = renderer.getClass().getMethod("getPadding", new Class[]{});
+ Method m = renderer.getClass().getMethod("getPadding");
Rectangle pad = (Rectangle) m.invoke(renderer);
// TBD: is there a CTF equivalent ?
@@ -211,10 +211,7 @@
if (top != pad.x || right != pad.y || bottom != pad.width
|| left != pad.height) {
- Method m2 = renderer.getClass().getMethod(
- "setPadding",
- new Class[] { int.class, int.class, int.class,
- int.class });
+ Method m2 = renderer.getClass().getMethod("setPadding", int.class, int.class, int.class, int.class);
m2.invoke(renderer, left, right, top, bottom);
}
} catch (Exception e) {
diff --git a/bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/util/JFaceProperty.java b/bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/util/JFaceProperty.java
index f212407..3f85f98 100644
--- a/bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/util/JFaceProperty.java
+++ b/bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/util/JFaceProperty.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2014 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -75,7 +75,7 @@
@Override
protected void doAddTo(Object model) {
try {
- addPropertyListenerMethod.invoke(model, new Object[] { this });
+ addPropertyListenerMethod.invoke(model, this);
} catch (Exception e) {
throw new IllegalStateException(e.getMessage());
}
@@ -84,8 +84,7 @@
@Override
protected void doRemoveFrom(Object model) {
try {
- removePropertyListenerMethod.invoke(model,
- new Object[] { this });
+ removePropertyListenerMethod.invoke(model, this);
} catch (Exception e) {
throw new IllegalStateException(e.getMessage());
}
@@ -97,27 +96,23 @@
* @param property
* @param clazz
*/
- public JFaceProperty(String fieldName, String property, Class clazz) {
+ public JFaceProperty(String fieldName, String property, Class<?> clazz) {
this.property = property;
// Create all the necessary method ahead of time to ensure they are
// available
try {
try {
String getterName = getGetterName(fieldName);
- getterMethod = clazz.getMethod(getterName, new Class[] {});
+ getterMethod = clazz.getMethod(getterName);
} catch (NoSuchMethodException e) {
String getterName = getBooleanGetterName(fieldName);
- getterMethod = clazz.getMethod(getterName, new Class[] {});
+ getterMethod = clazz.getMethod(getterName);
}
returnType = getterMethod.getReturnType();
- setterMethod = clazz.getMethod(getSetterName(fieldName),
- new Class[] { returnType });
- addPropertyListenerMethod = clazz
- .getMethod(
- "addPropertyChangeListener", new Class[] { IPropertyChangeListener.class }); //$NON-NLS-1$
- removePropertyListenerMethod = clazz
- .getMethod(
- "removePropertyChangeListener", new Class[] { IPropertyChangeListener.class }); //$NON-NLS-1$
+ setterMethod = clazz.getMethod(getSetterName(fieldName), returnType);
+ addPropertyListenerMethod = clazz.getMethod("addPropertyChangeListener", IPropertyChangeListener.class); //$NON-NLS-1$
+ removePropertyListenerMethod = clazz.getMethod("removePropertyChangeListener", //$NON-NLS-1$
+ IPropertyChangeListener.class);
} catch (SecurityException e) {
throw new IllegalArgumentException();
} catch (NoSuchMethodException e) {
@@ -134,7 +129,7 @@
@Override
protected Object doGetValue(Object model) {
try {
- return getterMethod.invoke(model, new Object[] {});
+ return getterMethod.invoke(model);
} catch (InvocationTargetException e) {
throw new IllegalStateException(e.getMessage());
} catch (IllegalAccessException e) {
@@ -145,7 +140,7 @@
@Override
protected void doSetValue(Object model, Object value) {
try {
- setterMethod.invoke(model, new Object[] { value });
+ setterMethod.invoke(model);
} catch (IllegalAccessException e) {
throw new IllegalStateException(e.getMessage());
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java
index d16460f..2f698ee 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java
@@ -365,9 +365,8 @@
Class tselClass = getTextSelectionClass();
if (tselClass != null && tselClass.isInstance(selection)) {
try {
- Method m = tselClass.getDeclaredMethod(
- "getLength", new Class[0]); //$NON-NLS-1$
- Object r = m.invoke(selection, new Object[0]);
+ Method m = tselClass.getDeclaredMethod("getLength"); //$NON-NLS-1$
+ Object r = m.invoke(selection);
if (r instanceof Integer) {
return isEnabledFor(selection, ((Integer) r).intValue());
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java
index 271b17f..b21aaca 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -246,8 +246,8 @@
long max = Long.MAX_VALUE;
try {
// Must use reflect to allow compilation against JCL/Foundation
- Method maxMemMethod = Runtime.class.getMethod("maxMemory", new Class[0]); //$NON-NLS-1$
- Object o = maxMemMethod.invoke(Runtime.getRuntime(), new Object[0]);
+ Method maxMemMethod = Runtime.class.getMethod("maxMemory"); //$NON-NLS-1$
+ Object o = maxMemMethod.invoke(Runtime.getRuntime());
if (o instanceof Long) {
max = ((Long) o).longValue();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
index 67ada10..f42ca1f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,7 +18,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -300,7 +299,7 @@
return c;
}
- private static Object getDefaultContributorResourceAdapter() {
+ private static Object getDefaultContributorResourceAdapter() {
if (defaultContributorResourceAdapter != null) {
return defaultContributorResourceAdapter;
}
@@ -311,8 +310,8 @@
Class c = LegacyResourceSupport.getDefaultContributorResourceAdapterClass();
if (c != null) {
try {
- Method m = c.getDeclaredMethod("getDefault", new Class[0]);//$NON-NLS-1$
- defaultContributorResourceAdapter = m.invoke(null, new Object[0]);
+ Method m = c.getDeclaredMethod("getDefault");//$NON-NLS-1$
+ defaultContributorResourceAdapter = m.invoke(null);
return defaultContributorResourceAdapter;
} catch (SecurityException e) {
// shouldn't happen - but play it safe
@@ -425,7 +424,7 @@
Method m = getContributorResourceAdapterGetAdaptedResourceMethod();
if (m != null) {
try {
- return m.invoke(resourceAdapter, new Object[]{adaptable});
+ return m.invoke(resourceAdapter, adaptable);
} catch (IllegalArgumentException e) {
// shouldn't happen - but play it safe
} catch (IllegalAccessException e) {
@@ -533,7 +532,7 @@
if (m != null) {
try {
- Object result = m.invoke(resourceMappingAdapter, new Object[]{adaptable});
+ Object result = m.invoke(resourceMappingAdapter, adaptable);
if (result != null) {
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
index a168f15..0933faf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1233,22 +1233,17 @@
// look for the 32 bit internal_new shell method
try {
- Method method = Shell.class.getMethod(
- "internal_new", new Class[] { Display.class, int.class }); //$NON-NLS-1$
+ Method method = Shell.class.getMethod("internal_new", Display.class, int.class); //$NON-NLS-1$
// we're on a 32 bit platform so invoke it with splash
// handle as an int
- splashShell = (Shell) method.invoke(null, new Object[] { display,
- Integer.valueOf(splashHandle) });
+ splashShell = (Shell) method.invoke(null, display, Integer.valueOf(splashHandle));
} catch (NoSuchMethodException e) {
// look for the 64 bit internal_new shell method
try {
- Method method = Shell.class
- .getMethod(
- "internal_new", new Class[] { Display.class, long.class }); //$NON-NLS-1$
+ Method method = Shell.class.getMethod("internal_new", Display.class, long.class); //$NON-NLS-1$
// we're on a 64 bit platform so invoke it with a long
- splashShell = (Shell) method.invoke(null, new Object[] {
- display, Long.valueOf(splashHandle) });
+ splashShell = (Shell) method.invoke(null, display, Long.valueOf(splashHandle));
} catch (NoSuchMethodException e2) {
// cant find either method - don't do anything.
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java
index 3e01c85..c74d7b6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,7 +15,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -132,7 +131,7 @@
} else if (numParams == 1) {
// This is a single-point selection method.
final Method textLimitAccessor = focusControl.getClass()
- .getMethod("getTextLimit", NO_PARAMETERS); //$NON-NLS-1$
+ .getMethod("getTextLimit"); //$NON-NLS-1$
final Integer textLimit = (Integer) textLimitAccessor
.invoke(focusControl);
final Object[] parameters = { new Point(0, textLimit
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java
index 5c4e778..3190209 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -41,8 +41,6 @@
* The parameters to pass to the method this handler invokes. This handler
* always passes no parameters.
*/
- protected static final Class[] NO_PARAMETERS = new Class[0];
-
public WidgetMethodHandler() {
display = Display.getCurrent();
if (display != null) {
@@ -160,13 +158,10 @@
protected void swingInvokeLater(Runnable methodRunnable)
throws ClassNotFoundException, NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
- final Class swingUtilitiesClass = Class
- .forName("javax.swing.SwingUtilities"); //$NON-NLS-1$
- final Method swingUtilitiesInvokeLaterMethod = swingUtilitiesClass
- .getMethod("invokeLater", //$NON-NLS-1$
- new Class[] { Runnable.class });
- swingUtilitiesInvokeLaterMethod.invoke(swingUtilitiesClass,
- new Object[] { methodRunnable });
+ final Class swingUtilitiesClass = Class.forName("javax.swing.SwingUtilities"); //$NON-NLS-1$
+ final Method swingUtilitiesInvokeLaterMethod = swingUtilitiesClass.getMethod("invokeLater", //$NON-NLS-1$
+ Runnable.class);
+ swingUtilitiesInvokeLaterMethod.invoke(swingUtilitiesClass, methodRunnable);
}
/**
@@ -245,7 +240,7 @@
if (focusControl != null) {
final Class clazz = focusControl.getClass();
try {
- method = clazz.getMethod(methodName, NO_PARAMETERS);
+ method = clazz.getMethod(methodName);
} catch (NoSuchMethodException e) {
// Fall through...
}
@@ -268,7 +263,7 @@
final Class clazz = focusComponent.getClass();
try {
- method = clazz.getMethod(methodName, NO_PARAMETERS);
+ method = clazz.getMethod(methodName);
} catch (NoSuchMethodException e) {
// Do nothing.
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
index deda92e..8d7f865 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -31,251 +31,247 @@
/**
* Utility class to create status objects.
*
- * @private - This class is an internal implementation class and should
- * not be referenced or subclassed outside of the workbench
+ * @private - This class is an internal implementation class and should not be
+ * referenced or subclassed outside of the workbench
*/
public class StatusUtil {
- /**
- * Answer a flat collection of the passed status and its recursive children
- */
- protected static List flatten(IStatus aStatus) {
- List result = new ArrayList();
+ /**
+ * Answer a flat collection of the passed status and its recursive children
+ */
+ protected static List flatten(IStatus aStatus) {
+ List result = new ArrayList();
- if (aStatus.isMultiStatus()) {
+ if (aStatus.isMultiStatus()) {
for (IStatus status : aStatus.getChildren()) {
if (status.isMultiStatus()) {
Iterator childStatiiEnum = flatten(status).iterator();
- while (childStatiiEnum.hasNext()) {
+ while (childStatiiEnum.hasNext()) {
result.add(childStatiiEnum.next());
}
- } else {
+ } else {
result.add(status);
}
- }
- } else {
+ }
+ } else {
result.add(aStatus);
}
- return result;
- }
+ return result;
+ }
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- */
- protected static IStatus newStatus(IStatus[] stati, String message,
- Throwable exception) {
+ /**
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for creating status.
+ */
+ protected static IStatus newStatus(IStatus[] stati, String message, Throwable exception) {
- Assert.isTrue(message != null);
- Assert.isTrue(message.trim().length() != 0);
+ Assert.isTrue(message != null);
+ Assert.isTrue(message.trim().length() != 0);
- return new MultiStatus(WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR,
- stati, message, exception);
- }
+ return new MultiStatus(WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, stati, message, exception);
+ }
- public static IStatus newStatus(String pluginId, Throwable exception) {
- return newStatus(pluginId, getLocalizedMessage(exception), exception);
- }
+ public static IStatus newStatus(String pluginId, Throwable exception) {
+ return newStatus(pluginId, getLocalizedMessage(exception), exception);
+ }
- /**
- * Returns a localized message describing the given exception. If the given exception does not
- * have a localized message, this returns the string "An error occurred".
- *
- * @param exception
- * @return
- */
- public static String getLocalizedMessage(Throwable exception) {
- String message = exception.getLocalizedMessage();
+ /**
+ * Returns a localized message describing the given exception. If the given
+ * exception does not have a localized message, this returns the string "An
+ * error occurred".
+ *
+ * @param exception
+ * @return
+ */
+ public static String getLocalizedMessage(Throwable exception) {
+ String message = exception.getLocalizedMessage();
- if (message != null) {
- return message;
- }
+ if (message != null) {
+ return message;
+ }
- // Workaround for the fact that CoreException does not implement a getLocalizedMessage() method.
- // Remove this branch when and if CoreException implements getLocalizedMessage()
- if (exception instanceof CoreException) {
- CoreException ce = (CoreException)exception;
- return ce.getStatus().getMessage();
- }
+ // Workaround for the fact that CoreException does not implement a
+ // getLocalizedMessage() method.
+ // Remove this branch when and if CoreException implements getLocalizedMessage()
+ if (exception instanceof CoreException) {
+ CoreException ce = (CoreException) exception;
+ return ce.getStatus().getMessage();
+ }
- return WorkbenchMessages.StatusUtil_errorOccurred;
- }
+ return WorkbenchMessages.StatusUtil_errorOccurred;
+ }
- /**
- * Creates a new Status based on the original status, but with a different message
- *
- * @param originalStatus
- * @param newMessage
- * @return
- */
- public static IStatus newStatus(IStatus originalStatus, String newMessage) {
- return new Status(originalStatus.getSeverity(),
- originalStatus.getPlugin(), originalStatus.getCode(), newMessage, originalStatus.getException());
- }
+ /**
+ * Creates a new Status based on the original status, but with a different
+ * message
+ *
+ * @param originalStatus
+ * @param newMessage
+ * @return
+ */
+ public static IStatus newStatus(IStatus originalStatus, String newMessage) {
+ return new Status(originalStatus.getSeverity(), originalStatus.getPlugin(), originalStatus.getCode(),
+ newMessage, originalStatus.getException());
+ }
- public static IStatus newStatus(String pluginId, String message, Throwable exception) {
- return new Status(IStatus.ERROR, pluginId, IStatus.OK,
- message, getCause(exception));
- }
+ public static IStatus newStatus(String pluginId, String message, Throwable exception) {
+ return new Status(IStatus.ERROR, pluginId, IStatus.OK, message, getCause(exception));
+ }
- public static Throwable getCause(Throwable exception) {
- // Figure out which exception should actually be logged -- if the given exception is
- // a wrapper, unwrap it
- Throwable cause = null;
- if (exception != null) {
- if (exception instanceof CoreException) {
- // Workaround: CoreException contains a cause, but does not actually implement getCause().
- // If we get a CoreException, we need to manually unpack the cause. Otherwise, use
- // the general-purpose mechanism. Remove this branch if CoreException ever implements
- // a correct getCause() method.
- CoreException ce = (CoreException)exception;
- cause = ce.getStatus().getException();
- } else {
- // use reflect instead of a direct call to getCause(), to allow compilation against JCL Foundation (bug 80053)
- try {
- Method causeMethod = exception.getClass().getMethod("getCause", new Class[0]); //$NON-NLS-1$
- Object o = causeMethod.invoke(exception, new Object[0]);
- if (o instanceof Throwable) {
- cause = (Throwable) o;
- }
- }
- catch (NoSuchMethodException e) {
- // ignore
- } catch (IllegalArgumentException e) {
- // ignore
+ public static Throwable getCause(Throwable exception) {
+ // Figure out which exception should actually be logged -- if the given
+ // exception is
+ // a wrapper, unwrap it
+ Throwable cause = null;
+ if (exception != null) {
+ if (exception instanceof CoreException) {
+ // Workaround: CoreException contains a cause, but does not actually implement
+ // getCause().
+ // If we get a CoreException, we need to manually unpack the cause. Otherwise,
+ // use
+ // the general-purpose mechanism. Remove this branch if CoreException ever
+ // implements
+ // a correct getCause() method.
+ CoreException ce = (CoreException) exception;
+ cause = ce.getStatus().getException();
+ } else {
+ // use reflect instead of a direct call to getCause(), to allow compilation
+ // against JCL Foundation (bug 80053)
+ try {
+ Method causeMethod = exception.getClass().getMethod("getCause"); //$NON-NLS-1$
+ Object o = causeMethod.invoke(exception);
+ if (o instanceof Throwable) {
+ cause = (Throwable) o;
+ }
+ } catch (NoSuchMethodException e) {
+ // ignore
+ } catch (IllegalArgumentException e) {
+ // ignore
} catch (IllegalAccessException e) {
- // ignore
+ // ignore
} catch (InvocationTargetException e) {
- // ignore
+ // ignore
}
- }
+ }
- if (cause == null) {
- cause = exception;
- }
- }
+ if (cause == null) {
+ cause = exception;
+ }
+ }
- return cause;
- }
+ return cause;
+ }
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- */
- public static IStatus newStatus(int severity, String message,
- Throwable exception) {
+ /**
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for creating status.
+ */
+ public static IStatus newStatus(int severity, String message, Throwable exception) {
- String statusMessage = message;
- if (message == null || message.trim().length() == 0) {
- if (exception.getMessage() == null) {
+ String statusMessage = message;
+ if (message == null || message.trim().length() == 0) {
+ if (exception.getMessage() == null) {
statusMessage = exception.toString();
} else {
statusMessage = exception.getMessage();
}
- }
+ }
- return new Status(severity, WorkbenchPlugin.PI_WORKBENCH, severity,
- statusMessage, getCause(exception));
- }
+ return new Status(severity, WorkbenchPlugin.PI_WORKBENCH, severity, statusMessage, getCause(exception));
+ }
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- */
- public static IStatus newStatus(List children, String message,
- Throwable exception) {
+ /**
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for creating status.
+ */
+ public static IStatus newStatus(List children, String message, Throwable exception) {
- List flatStatusCollection = new ArrayList();
- Iterator iter = children.iterator();
- while (iter.hasNext()) {
- IStatus currentStatus = (IStatus) iter.next();
- Iterator childrenIter = flatten(currentStatus).iterator();
- while (childrenIter.hasNext()) {
+ List flatStatusCollection = new ArrayList();
+ Iterator iter = children.iterator();
+ while (iter.hasNext()) {
+ IStatus currentStatus = (IStatus) iter.next();
+ Iterator childrenIter = flatten(currentStatus).iterator();
+ while (childrenIter.hasNext()) {
flatStatusCollection.add(childrenIter.next());
}
- }
+ }
- IStatus[] stati = new IStatus[flatStatusCollection.size()];
- flatStatusCollection.toArray(stati);
- return newStatus(stati, message, exception);
- }
-
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
- public static void handleStatus(IStatus status, int hint, Shell shell) {
- StatusManager.getManager().handle(status, hint);
+ IStatus[] stati = new IStatus[flatStatusCollection.size()];
+ flatStatusCollection.toArray(stati);
+ return newStatus(stati, message, exception);
}
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
- public static void handleStatus(Throwable e, int hint) {
- StatusManager.getManager().handle(
- newStatus(WorkbenchPlugin.PI_WORKBENCH, e), hint);
+ /**
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
+ public static void handleStatus(IStatus status, int hint, Shell shell) {
+ StatusManager.getManager().handle(status, hint);
}
- /**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
+ /**
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
+ public static void handleStatus(Throwable e, int hint) {
+ StatusManager.getManager().handle(newStatus(WorkbenchPlugin.PI_WORKBENCH, e), hint);
+ }
+
+ /**
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
public static void handleStatus(String message, Throwable e, int hint) {
- StatusManager.getManager().handle(
- newStatus(WorkbenchPlugin.PI_WORKBENCH, message, e), hint);
+ StatusManager.getManager().handle(newStatus(WorkbenchPlugin.PI_WORKBENCH, message, e), hint);
}
/**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
- public static void handleStatus(String message, Throwable e, int hint,
- Shell shell) {
- StatusManager.getManager().handle(
- newStatus(WorkbenchPlugin.PI_WORKBENCH, message, e), hint);
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
+ public static void handleStatus(String message, Throwable e, int hint, Shell shell) {
+ StatusManager.getManager().handle(newStatus(WorkbenchPlugin.PI_WORKBENCH, message, e), hint);
}
/**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
public static void handleStatus(IStatus status, String message, int hint) {
StatusManager.getManager().handle(newStatus(status, message), hint);
}
/**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
- public static void handleStatus(IStatus status, String message, int hint,
- Shell shell) {
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
+ public static void handleStatus(IStatus status, String message, int hint, Shell shell) {
StatusManager.getManager().handle(newStatus(status, message), hint);
}
/**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
public static void handleStatus(String message, int hint) {
handleStatus(message, null, hint);
}
/**
- * This method must not be called outside the workbench.
- *
- * Utility method for handling status.
- */
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for handling status.
+ */
public static void handleStatus(String message, int hint, Shell shell) {
handleStatus(message, null, hint);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java
index 9172f7c..10886e9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,7 +18,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.jface.resource.ColorDescriptor;
import org.eclipse.jface.resource.DeviceResourceDescriptor;
import org.eclipse.jface.resource.DeviceResourceException;
@@ -40,11 +39,12 @@
import org.eclipse.ui.internal.WorkbenchPlugin;
/**
- * Contains a bunch of helper methods that allow JFace resource descriptors to be passed
- * directly to SWT widgets without worrying about resource allocation. This class is internal,
- * but it should be moved into JFace if the pattern is found generally useful. The current
- * implementation uses a lot of reflection to save repeated code, but this could all be inlined
- * (without reflection) if performance turns out to be a problem.
+ * Contains a bunch of helper methods that allow JFace resource descriptors to
+ * be passed directly to SWT widgets without worrying about resource allocation.
+ * This class is internal, but it should be moved into JFace if the pattern is
+ * found generally useful. The current implementation uses a lot of reflection
+ * to save repeated code, but this could all be inlined (without reflection) if
+ * performance turns out to be a problem.
*
* <p>
* For example, an Image might be passed to a TableItem as follows:
@@ -80,219 +80,228 @@
* </code>
*
* <p>
- * This class tries to behave as if the table item itself had a set method that took a descriptor.
- * Resource allocation and deallocation happens for free. All the methods are leakproof. That is,
- * if any images, colors, etc. need to be allocated and passed to the SWT widget, they will be
- * deallocated automatically when the widget goes away (the implementation hooks a dispose listener
- * on the widget which cleans up as soon as the widget is disposed).
+ * This class tries to behave as if the table item itself had a set method that
+ * took a descriptor. Resource allocation and deallocation happens for free. All
+ * the methods are leakproof. That is, if any images, colors, etc. need to be
+ * allocated and passed to the SWT widget, they will be deallocated
+ * automatically when the widget goes away (the implementation hooks a dispose
+ * listener on the widget which cleans up as soon as the widget is disposed).
* </p>
*
* @since 3.1
*/
public final class Descriptors {
- private static final String DISPOSE_LIST = "Descriptors.disposeList"; //$NON-NLS-1$
+ private static final String DISPOSE_LIST = "Descriptors.disposeList"; //$NON-NLS-1$
- private Descriptors() {
- }
+ private Descriptors() {
+ }
- private static final class ResourceMethod {
- ResourceMethod(Method m, String id) {
- method = m;
- this.id = id;
- }
+ private static final class ResourceMethod {
+ ResourceMethod(Method m, String id) {
+ method = m;
+ this.id = id;
+ }
- Method method;
- DeviceResourceDescriptor oldDescriptor;
- String id;
+ Method method;
+ DeviceResourceDescriptor oldDescriptor;
+ String id;
- public void invoke(Widget toCall, DeviceResourceDescriptor newDescriptor) {
- if (newDescriptor == oldDescriptor) {
- return;
- }
+ public void invoke(Widget toCall, DeviceResourceDescriptor newDescriptor) {
+ if (newDescriptor == oldDescriptor) {
+ return;
+ }
- ResourceManager mgr = JFaceResources.getResources(toCall.getDisplay());
+ ResourceManager mgr = JFaceResources.getResources(toCall.getDisplay());
- Object newResource;
- try {
- newResource = newDescriptor == null? null : mgr.create(newDescriptor);
- } catch (DeviceResourceException e1) {
- WorkbenchPlugin.log(e1);
- return;
- }
+ Object newResource;
+ try {
+ newResource = newDescriptor == null ? null : mgr.create(newDescriptor);
+ } catch (DeviceResourceException e1) {
+ WorkbenchPlugin.log(e1);
+ return;
+ }
- try {
- method.invoke(toCall, new Object[] {newResource});
- } catch (IllegalArgumentException e) {
- throw e;
- } catch (IllegalAccessException e) {
- WorkbenchPlugin.log(e);
- return;
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof RuntimeException) {
- throw (RuntimeException)e.getTargetException();
- }
- WorkbenchPlugin.log(e);
- return;
- }
+ try {
+ method.invoke(toCall, newResource);
+ } catch (IllegalArgumentException e) {
+ throw e;
+ } catch (IllegalAccessException e) {
+ WorkbenchPlugin.log(e);
+ return;
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() instanceof RuntimeException) {
+ throw (RuntimeException) e.getTargetException();
+ }
+ WorkbenchPlugin.log(e);
+ return;
+ }
- // Deallocate the old image
- if (oldDescriptor != null) {
- // Dispose the image
- mgr.destroy(oldDescriptor);
- }
+ // Deallocate the old image
+ if (oldDescriptor != null) {
+ // Dispose the image
+ mgr.destroy(oldDescriptor);
+ }
- // Remember the new image for next time
+ // Remember the new image for next time
- oldDescriptor = newDescriptor;
- }
+ oldDescriptor = newDescriptor;
+ }
- public void dispose() {
- // Deallocate the old image
- if (oldDescriptor != null) {
- ResourceManager mgr = JFaceResources.getResources();
- // Dispose the image
- mgr.destroy(oldDescriptor);
- oldDescriptor = null;
- }
+ public void dispose() {
+ // Deallocate the old image
+ if (oldDescriptor != null) {
+ ResourceManager mgr = JFaceResources.getResources();
+ // Dispose the image
+ mgr.destroy(oldDescriptor);
+ oldDescriptor = null;
+ }
- }
- }
+ }
+ }
- private static DisposeListener disposeListener = e -> doDispose(e.widget);
+ private static DisposeListener disposeListener = e -> doDispose(e.widget);
- // Item //////////////////////////////////////////////////////////////////////////////////
+ // Item
+ // //////////////////////////////////////////////////////////////////////////////////
- /**
- * Sets the image on the given ToolItem. The image will be automatically allocated and
- * disposed as needed.
- *
- * @since 3.1
- *
- * @param item
- * @param descriptor
- */
- public static void setImage(Item item, ImageDescriptor descriptor) {
- callMethod(item, "setImage", descriptor, Image.class); //$NON-NLS-1$
- }
+ /**
+ * Sets the image on the given ToolItem. The image will be automatically
+ * allocated and disposed as needed.
+ *
+ * @since 3.1
+ *
+ * @param item
+ * @param descriptor
+ */
+ public static void setImage(Item item, ImageDescriptor descriptor) {
+ callMethod(item, "setImage", descriptor, Image.class); //$NON-NLS-1$
+ }
- // ToolItem //////////////////////////////////////////////////////////////////////////////
+ // ToolItem
+ // //////////////////////////////////////////////////////////////////////////////
- public static void setHotImage(ToolItem item, ImageDescriptor descriptor) {
- callMethod(item, "setHotImage", descriptor, Image.class); //$NON-NLS-1$
- }
+ public static void setHotImage(ToolItem item, ImageDescriptor descriptor) {
+ callMethod(item, "setHotImage", descriptor, Image.class); //$NON-NLS-1$
+ }
- public static void setDisabledImage(ToolItem item, ImageDescriptor descriptor) {
- callMethod(item, "setDisabledImage", descriptor, Image.class); //$NON-NLS-1$
- }
+ public static void setDisabledImage(ToolItem item, ImageDescriptor descriptor) {
+ callMethod(item, "setDisabledImage", descriptor, Image.class); //$NON-NLS-1$
+ }
- // TableItem //////////////////////////////////////////////////////////////////////////////
+ // TableItem
+ // //////////////////////////////////////////////////////////////////////////////
- public static void setFont(TableItem item, FontDescriptor descriptor) {
- callMethod(item, "setFont", descriptor, Font.class); //$NON-NLS-1$
- }
+ public static void setFont(TableItem item, FontDescriptor descriptor) {
+ callMethod(item, "setFont", descriptor, Font.class); //$NON-NLS-1$
+ }
- public static void setBackground(TableItem item, ColorDescriptor descriptor) {
- callMethod(item, "setBackground", descriptor, Color.class); //$NON-NLS-1$
- }
+ public static void setBackground(TableItem item, ColorDescriptor descriptor) {
+ callMethod(item, "setBackground", descriptor, Color.class); //$NON-NLS-1$
+ }
- public static void setForeground(TableItem item, ColorDescriptor descriptor) {
- callMethod(item, "setForeground", descriptor, Color.class); //$NON-NLS-1$
- }
+ public static void setForeground(TableItem item, ColorDescriptor descriptor) {
+ callMethod(item, "setForeground", descriptor, Color.class); //$NON-NLS-1$
+ }
- // Control ///////////////////////////////////////////////////////////////////////////////
+ // Control
+ // ///////////////////////////////////////////////////////////////////////////////
- public static void setBackground(Control control, ColorDescriptor descriptor) {
- callMethod(control, "setBackground", descriptor, Color.class); //$NON-NLS-1$
- }
+ public static void setBackground(Control control, ColorDescriptor descriptor) {
+ callMethod(control, "setBackground", descriptor, Color.class); //$NON-NLS-1$
+ }
- public static void setForeground(Control control, ColorDescriptor descriptor) {
- callMethod(control, "setForeground", descriptor, Color.class); //$NON-NLS-1$
- }
+ public static void setForeground(Control control, ColorDescriptor descriptor) {
+ callMethod(control, "setForeground", descriptor, Color.class); //$NON-NLS-1$
+ }
- // Button ///////////////////////////////////////////////////////////////////////////////
+ // Button
+ // ///////////////////////////////////////////////////////////////////////////////
- public static void setImage(Button button, ImageDescriptor descriptor) {
- callMethod(button, "setImage", descriptor, Image.class); //$NON-NLS-1$
- }
+ public static void setImage(Button button, ImageDescriptor descriptor) {
+ callMethod(button, "setImage", descriptor, Image.class); //$NON-NLS-1$
+ }
- public static void setImage(Label label, ImageDescriptor descriptor) {
- callMethod(label, "setImage", descriptor, Image.class); //$NON-NLS-1$
- }
+ public static void setImage(Label label, ImageDescriptor descriptor) {
+ callMethod(label, "setImage", descriptor, Image.class); //$NON-NLS-1$
+ }
- private static ResourceMethod getResourceMethod(Widget toCall, String methodName, Class resourceType) throws NoSuchMethodException {
- Object oldData = toCall.getData(DISPOSE_LIST);
+ private static ResourceMethod getResourceMethod(Widget toCall, String methodName, Class resourceType)
+ throws NoSuchMethodException {
+ Object oldData = toCall.getData(DISPOSE_LIST);
- if (oldData instanceof List) {
- // Check for existing data
- for (Iterator iter = ((List)oldData).iterator(); iter.hasNext();) {
- ResourceMethod method = (ResourceMethod) iter.next();
+ if (oldData instanceof List) {
+ // Check for existing data
+ for (Iterator iter = ((List) oldData).iterator(); iter.hasNext();) {
+ ResourceMethod method = (ResourceMethod) iter.next();
- if (method.id == methodName) {
- return method;
- }
- }
- } if (oldData instanceof ResourceMethod) {
- if (((ResourceMethod)oldData).id == methodName) {
- return ((ResourceMethod)oldData);
- }
+ if (method.id == methodName) {
+ return method;
+ }
+ }
+ }
+ if (oldData instanceof ResourceMethod) {
+ if (((ResourceMethod) oldData).id == methodName) {
+ return ((ResourceMethod) oldData);
+ }
- List newList = new ArrayList();
- newList.add(oldData);
- oldData = newList;
- toCall.setData(DISPOSE_LIST, oldData);
- }
+ List newList = new ArrayList();
+ newList.add(oldData);
+ oldData = newList;
+ toCall.setData(DISPOSE_LIST, oldData);
+ }
- // At this point, the DISPOSE_LIST data is either null or points to an ArrayList
+ // At this point, the DISPOSE_LIST data is either null or points to an ArrayList
- Class clazz = toCall.getClass();
+ Class clazz = toCall.getClass();
- Method method;
- try {
- method = clazz.getMethod(methodName, new Class[] {resourceType});
- } catch (SecurityException e) {
- throw e;
- }
+ Method method;
+ try {
+ method = clazz.getMethod(methodName, resourceType);
+ } catch (SecurityException e) {
+ throw e;
+ }
- ResourceMethod result = new ResourceMethod(method, methodName);
+ ResourceMethod result = new ResourceMethod(method, methodName);
- if (oldData == null) {
- toCall.setData(DISPOSE_LIST, result);
- toCall.addDisposeListener(disposeListener);
- } else {
- ((List)oldData).add(result);
- }
+ if (oldData == null) {
+ toCall.setData(DISPOSE_LIST, result);
+ toCall.addDisposeListener(disposeListener);
+ } else {
+ ((List) oldData).add(result);
+ }
- return result;
- }
+ return result;
+ }
- private static void callMethod(Widget toCall, String methodName, DeviceResourceDescriptor descriptor, Class resourceType) {
- ResourceMethod method;
- try {
- method = getResourceMethod(toCall, methodName, resourceType);
- } catch (NoSuchMethodException e) {
- WorkbenchPlugin.log(e);
- return;
- }
+ private static void callMethod(Widget toCall, String methodName, DeviceResourceDescriptor descriptor,
+ Class resourceType) {
+ ResourceMethod method;
+ try {
+ method = getResourceMethod(toCall, methodName, resourceType);
+ } catch (NoSuchMethodException e) {
+ WorkbenchPlugin.log(e);
+ return;
+ }
- method.invoke(toCall, descriptor);
- }
+ method.invoke(toCall, descriptor);
+ }
- private static void doDispose(Widget widget) {
- Object oldData = widget.getData(DISPOSE_LIST);
+ private static void doDispose(Widget widget) {
+ Object oldData = widget.getData(DISPOSE_LIST);
- if (oldData instanceof ArrayList) {
- ArrayList list = ((ArrayList)oldData);
- ResourceMethod[] data = (ResourceMethod[]) list.toArray(new ResourceMethod[list.size()]);
+ if (oldData instanceof ArrayList) {
+ ArrayList list = ((ArrayList) oldData);
+ ResourceMethod[] data = (ResourceMethod[]) list.toArray(new ResourceMethod[list.size()]);
- // Clear out the images
- for (ResourceMethod method : data) {
- method.dispose();
- }
- }
+ // Clear out the images
+ for (ResourceMethod method : data) {
+ method.dispose();
+ }
+ }
- if (oldData instanceof ResourceMethod) {
- ((ResourceMethod)oldData).dispose();
- }
- }
+ if (oldData instanceof ResourceMethod) {
+ ((ResourceMethod) oldData).dispose();
+ }
+ }
}
diff --git a/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet048TreeViewerTabWithCheckboxFor3_3.java b/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet048TreeViewerTabWithCheckboxFor3_3.java
index ef1dc30..d7c2079 100644
--- a/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet048TreeViewerTabWithCheckboxFor3_3.java
+++ b/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet048TreeViewerTabWithCheckboxFor3_3.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 Tom Schindl and others.
+ * Copyright (c) 2006, 2018 Tom Schindl and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -198,7 +198,7 @@
try {
Method m = ColumnViewerEditor.class.getDeclaredMethod("processTraverseEvent", new Class[] {int.class,ViewerRow.class,TraverseEvent.class});
m.setAccessible(true);
- m.invoke(editor, new Object[] { Integer.valueOf(cell.getColumnIndex()), cell.getViewerRow(), e });
+ m.invoke(editor, Integer.valueOf(cell.getColumnIndex()), cell.getViewerRow(), e);
} catch (SecurityException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
diff --git a/tests/org.eclipse.e4.ui.tests.css.core/META-INF/MANIFEST.MF b/tests/org.eclipse.e4.ui.tests.css.core/META-INF/MANIFEST.MF
index b2431ff..f380efa 100644
--- a/tests/org.eclipse.e4.ui.tests.css.core/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.e4.ui.tests.css.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: e4 css core tests (Incubation)
Bundle-SymbolicName: org.eclipse.e4.ui.tests.css.core
-Bundle-Version: 1.300.200.qualifier
+Bundle-Version: 1.300.300.qualifier
Require-Bundle: org.eclipse.core.runtime,
org.junit,
org.eclipse.swt,
diff --git a/tests/org.eclipse.e4.ui.tests.css.core/pom.xml b/tests/org.eclipse.e4.ui.tests.css.core/pom.xml
index 8b038cc..b16809a 100644
--- a/tests/org.eclipse.e4.ui.tests.css.core/pom.xml
+++ b/tests/org.eclipse.e4.ui.tests.css.core/pom.xml
@@ -15,7 +15,7 @@
</parent>
<groupId>org.eclipse.e4</groupId>
<artifactId>org.eclipse.e4.ui.tests.css.core</artifactId>
- <version>1.300.200-SNAPSHOT</version>
+ <version>1.300.300-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/ViewCSSTest.java b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/ViewCSSTest.java
index 6b24624..7d3eee5 100644
--- a/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/ViewCSSTest.java
+++ b/tests/org.eclipse.e4.ui.tests.css.core/src/org/eclipse/e4/ui/tests/css/core/parser/ViewCSSTest.java
@@ -128,9 +128,6 @@
docCss.addStyleSheet(styleSheet);
ViewCSSImpl viewCSS = new ViewCSSImpl(docCss);
- Class<?>[] NO_TYPES = new Class<?>[0];
- Object[] NO_ARGS = new Object[0];
-
Field currentCombinedRulesField = ViewCSSImpl.class.getDeclaredField("currentCombinedRules");
currentCombinedRulesField.setAccessible(true);
@@ -148,12 +145,12 @@
assertNotNull(currentCombinedRulesField.get(viewCSS));
// deeper inspection: check what private method getCombinedRules returns
- Method getCombinedRulesMethod = ViewCSSImpl.class.getDeclaredMethod("getCombinedRules", NO_TYPES);
+ Method getCombinedRulesMethod = ViewCSSImpl.class.getDeclaredMethod("getCombinedRules");
getCombinedRulesMethod.setAccessible(true);
- List<CSSRule> cssRules = (List<CSSRule>) getCombinedRulesMethod.invoke(viewCSS, NO_ARGS);
+ List<CSSRule> cssRules = (List<CSSRule>) getCombinedRulesMethod.invoke(viewCSS);
// check caching: a 2nd call retrieves cached list
- assertSame(cssRules, getCombinedRulesMethod.invoke(viewCSS, NO_ARGS));
+ assertSame(cssRules, getCombinedRulesMethod.invoke(viewCSS));
// add a new stylesheet => flush cache
css = "Shell > * > * { color: blue; }\n" + "Label { color: green; }\n";
@@ -162,7 +159,7 @@
assertNull(currentCombinedRulesField.get(viewCSS));
- List<CSSRule> cssRules2 = (List<CSSRule>) getCombinedRulesMethod.invoke(viewCSS, NO_ARGS);
+ List<CSSRule> cssRules2 = (List<CSSRule>) getCombinedRulesMethod.invoke(viewCSS);
assertNotSame(cssRules, cssRules2);
// stylesheet added => more rules
assertTrue(cssRules2.size() > cssRules.size());
diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java
index 1e6c648..ed1d469 100644
--- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java
+++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -132,7 +132,7 @@
{
try {
icuBigDecimal = Class.forName("com.ibm.icu.math.BigDecimal");
- icuBigDecimalCtr = icuBigDecimal.getConstructor(new Class[] {BigInteger.class, int.class});
+ icuBigDecimalCtr = icuBigDecimal.getConstructor(BigInteger.class, int.class);
}
catch(ClassNotFoundException e) {}
catch(NoSuchMethodException e) {}
@@ -151,8 +151,8 @@
private String formatBigDecimal(BigDecimal javabd) throws Exception {
if(icuBigDecimal != null && icuBigDecimalCtr != null) {
// ICU Big Decimal constructor available
- Number icubd = (Number) icuBigDecimalCtr.newInstance(
- new Object[] { javabd.unscaledValue(), Integer.valueOf(javabd.scale()) });
+ Number icubd = (Number) icuBigDecimalCtr.newInstance(javabd.unscaledValue(),
+ Integer.valueOf(javabd.scale()));
return numberFormat.format(icubd);
}
throw new IllegalArgumentException("ICU not present. Cannot reliably format large BigDecimal values; needed for testing. Java platforms prior to 1.5 fail to format/parse these decimals correctly.");
diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java
index 28e3e81..8e5ea0b 100644
--- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java
+++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -83,7 +83,7 @@
{
try {
icuBigDecimal = Class.forName("com.ibm.icu.math.BigDecimal");
- icuBigDecimalCtr = icuBigDecimal.getConstructor(new Class[] {BigInteger.class, int.class});
+ icuBigDecimalCtr = icuBigDecimal.getConstructor(BigInteger.class, int.class);
}
catch(ClassNotFoundException e) {}
catch(NoSuchMethodException e) {}
@@ -102,8 +102,8 @@
private String formatBigDecimal(BigDecimal javabd) throws Exception {
if(icuBigDecimal != null && icuBigDecimalCtr != null) {
// ICU Big Decimal constructor available
- Number icubd = (Number) icuBigDecimalCtr.newInstance(
- new Object[] { javabd.unscaledValue(), Integer.valueOf(javabd.scale()) });
+ Number icubd = (Number) icuBigDecimalCtr.newInstance(javabd.unscaledValue(),
+ Integer.valueOf(javabd.scale()));
return numberFormat.format(icubd);
}
throw new IllegalArgumentException("ICU not present. Cannot reliably format large BigDecimal values; needed for testing. Java platforms prior to 1.5 fail to format/parse these decimals correctly.");
diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/observable/map/CompositeMapTest.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/observable/map/CompositeMapTest.java
index 2e711d2..01edae3 100644
--- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/observable/map/CompositeMapTest.java
+++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/observable/map/CompositeMapTest.java
@@ -48,7 +48,7 @@
try {
Method method = AbstractObservable.class.getSuperclass().getDeclaredMethod("hasListeners", new Class[0]);
method.setAccessible(true);
- return ((Boolean)method.invoke(o, new Object[0])).booleanValue();
+ return ((Boolean) method.invoke(o)).booleanValue();
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/beans/BeanPropertyHelperTest.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/beans/BeanPropertyHelperTest.java
index cf64f37..3720ada 100644
--- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/beans/BeanPropertyHelperTest.java
+++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/beans/BeanPropertyHelperTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2014 Matthew Hall and others.
+ * Copyright (c) 2009, 2018 Matthew Hall and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -33,9 +33,7 @@
PropertyDescriptor pd = BeanPropertyHelper.getPropertyDescriptor(
Bean.class, "value");
assertEquals(Bean.class.getMethod("getValue"), pd.getReadMethod());
- assertEquals(
- Bean.class.getMethod("setValue", new Class[] { String.class }),
- pd.getWriteMethod());
+ assertEquals(Bean.class.getMethod("setValue", String.class), pd.getWriteMethod());
}
@Test
@@ -44,9 +42,7 @@
PropertyDescriptor pd = BeanPropertyHelper.getPropertyDescriptor(
IBean.class, "value");
assertEquals(IBean.class.getMethod("getValue"), pd.getReadMethod());
- assertEquals(
- IBean.class.getMethod("setValue", new Class[] { String.class }),
- pd.getWriteMethod());
+ assertEquals(IBean.class.getMethod("setValue", String.class), pd.getWriteMethod());
}
@Test
@@ -55,9 +51,7 @@
PropertyDescriptor pd = BeanPropertyHelper.getPropertyDescriptor(
IBeanExtension.class, "value");
assertEquals(IBean.class.getMethod("getValue"), pd.getReadMethod());
- assertEquals(
- IBean.class.getMethod("setValue", new Class[] { String.class }),
- pd.getWriteMethod());
+ assertEquals(IBean.class.getMethod("setValue", String.class), pd.getWriteMethod());
}
}
diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/ComboScenarios.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/ComboScenarios.java
index 7afaa57..a4f64f3 100644
--- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/ComboScenarios.java
+++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/ComboScenarios.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -73,6 +73,7 @@
}
};
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -84,6 +85,7 @@
catalog = SampleData.CATALOG_2005; // Lodging source
}
+ @Override
@After
public void tearDown() throws Exception {
combo.dispose();
@@ -128,11 +130,10 @@
+ feature.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ feature.substring(1);
try {
- Method getter = list[0].getClass().getMethod(getterName,
- new Class[0]);
+ Method getter = list[0].getClass().getMethod(getterName);
try {
for (int i = 0; i < list.length; i++) {
- result.add(getter.invoke(list[i], new Object[0]));
+ result.add(getter.invoke(list[i]));
}
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/CustomBeanUpdateValueStrategy.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/CustomBeanUpdateValueStrategy.java
index 72c4593..2bbb049 100644
--- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/CustomBeanUpdateValueStrategy.java
+++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/scenarios/CustomBeanUpdateValueStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,10 +57,8 @@
Method getValidator;
try {
- getValidator = objectClass.getMethod(getValidatorMethodName,
- new Class[] { Class.class });
- beforeSetValidator= (IValidator) getValidator.invoke(property
- .getObject(), new Object[0]);
+ getValidator = objectClass.getMethod(getValidatorMethodName, Class.class);
+ beforeSetValidator = (IValidator) getValidator.invoke(property.getObject());
} catch (Exception e) {
// ignore
}
diff --git a/tests/org.eclipse.ui.tests.harness/META-INF/MANIFEST.MF b/tests/org.eclipse.ui.tests.harness/META-INF/MANIFEST.MF
index 760ab4b..b57bb43 100644
--- a/tests/org.eclipse.ui.tests.harness/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ui.tests.harness/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Harness Plug-in
Bundle-SymbolicName: org.eclipse.ui.tests.harness;singleton:=true
-Bundle-Version: 1.4.300.qualifier
+Bundle-Version: 1.4.400.qualifier
Eclipse-BundleShape: dir
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
diff --git a/tests/org.eclipse.ui.tests.harness/pom.xml b/tests/org.eclipse.ui.tests.harness/pom.xml
index 388b6dd..d14c700 100644
--- a/tests/org.eclipse.ui.tests.harness/pom.xml
+++ b/tests/org.eclipse.ui.tests.harness/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.ui</groupId>
<artifactId>org.eclipse.ui.tests.harness</artifactId>
- <version>1.4.300-SNAPSHOT</version>
+ <version>1.4.400-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/ActionUtil.java b/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/ActionUtil.java
index a3e81d0..ceaae97 100644
--- a/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/ActionUtil.java
+++ b/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/ActionUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -149,10 +149,9 @@
*/
public static void fireAboutToShow(MenuManager mgr) throws Throwable {
Class<?> clazz = mgr.getClass();
- Method method = clazz.getDeclaredMethod("handleAboutToShow",
- new Class[0]);
+ Method method = clazz.getDeclaredMethod("handleAboutToShow");
method.setAccessible(true);
- method.invoke(mgr, new Object[0]);
+ method.invoke(mgr);
}
}
diff --git a/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/Mocks.java b/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/Mocks.java
index 1152b70..f3f89d8 100644
--- a/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/Mocks.java
+++ b/tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/Mocks.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -49,10 +49,8 @@
static {
try {
- getMockInvocationHandlerMethod = Mock.class.getMethod(
- "getMockInvocationHandler", new Class[0]);
- equalsMethod = Object.class.getMethod("equals",
- new Class[] { Object.class });
+ getMockInvocationHandlerMethod = Mock.class.getMethod("getMockInvocationHandler");
+ equalsMethod = Object.class.getMethod("equals", Object.class);
} catch (Exception e) {
// ignore, will lead to NullPointerExceptions later on
}
diff --git a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/jst/WebJavaContentProvider.java b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/jst/WebJavaContentProvider.java
index 3783e42..f161907 100644
--- a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/jst/WebJavaContentProvider.java
+++ b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/jst/WebJavaContentProvider.java
@@ -68,15 +68,13 @@
private final Map compressedNodes = new HashMap();
public static Object javaCoreCreateResource(IResource res) throws Exception {
- Method m = JAVA_CORE_CLASS.getMethod("create",
- new Class[] { IResource.class });
- return m.invoke(null, new Object[] { res });
+ Method m = JAVA_CORE_CLASS.getMethod("create", IResource.class);
+ return m.invoke(null, res);
}
public static Object javaCoreCreateProject(IResource res) throws Exception {
- Method m = JAVA_CORE_CLASS.getMethod("create",
- new Class[] { IProject.class });
- return m.invoke(null, new Object[] { res });
+ Method m = JAVA_CORE_CLASS.getMethod("create", IProject.class);
+ return m.invoke(null, res);
}
@Override
@@ -124,22 +122,17 @@
public Object getPipelinedParent(Object anObject, Object aSuggestedParent) {
try {
- Method m = IJAVA_PROJECT_CLASS.getMethod("getProject",
- new Class[] {});
+ Method m = IJAVA_PROJECT_CLASS.getMethod("getProject");
if (IPACKAGE_FRAGMENT_ROOT_CLASS.isInstance(anObject)) {
if (IJAVA_PROJECT_CLASS.isInstance(aSuggestedParent)) {
- return getCompressedNode((IProject) m.invoke(
- aSuggestedParent, new Object[] {}));
+ return getCompressedNode((IProject) m.invoke(aSuggestedParent));
} else if (aSuggestedParent instanceof IProject) {
return getCompressedNode(((IProject) aSuggestedParent));
}
} else if (INTERNAL_CONTAINER_CLASS.isInstance(anObject)) {
if (IJAVA_PROJECT_CLASS.isInstance(aSuggestedParent)) {
- return getCompressedNode(
- (IProject) m.invoke(aSuggestedParent,
- new Object[] {}))
- .getCompressedJavaLibraries();
+ return getCompressedNode((IProject) m.invoke(aSuggestedParent)).getCompressedJavaLibraries();
} else if (aSuggestedParent instanceof IProject) {
return getCompressedNode(((IProject) aSuggestedParent))
.getCompressedJavaLibraries();
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java
index bcbec75..37b7371 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -97,7 +97,7 @@
try {
method = ColumnViewer.class.getDeclaredMethod("getViewerColumn", new Class[]{int.class});
method.setAccessible(true);
- return (ViewerColumn) method.invoke(viewer, new Object[]{Integer.valueOf(index)});
+ return (ViewerColumn) method.invoke(viewer, Integer.valueOf(index));
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerColumnTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerColumnTest.java
index 737a308..21d3376 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerColumnTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerColumnTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -111,7 +111,7 @@
try {
method = ColumnViewer.class.getDeclaredMethod("getViewerColumn", new Class[]{int.class});
method.setAccessible(true);
- return (ViewerColumn) method.invoke(viewer, new Object[]{Integer.valueOf(index)});
+ return (ViewerColumn) method.invoke(viewer, Integer.valueOf(index));
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextControlView.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextControlView.java
index 9df3ccb..e9b805f 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextControlView.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextControlView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 IBM Corporation and others.
+ * Copyright (c) 2009, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -95,9 +95,9 @@
public void updateEnabledState() throws Exception {
Method method = TextActionHandler.class.getDeclaredMethod(
- "updateActionsEnableState", (Class[]) null);
+ "updateActionsEnableState");
method.setAccessible(true);
- method.invoke(delegator, (Object[]) null);
+ method.invoke(delegator);
}
private Action getAction(String fieldName) throws Exception {
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/markers/MarkersTestMarkersView.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/markers/MarkersTestMarkersView.java
index c013d82..520ba36 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/markers/MarkersTestMarkersView.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/markers/MarkersTestMarkersView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -53,8 +53,7 @@
public IMarker[] getCurrentMarkers() {
Method method;
try {
- method = ExtendedMarkersView.class.getDeclaredMethod("getAllMarkers",
- new Class[0]);
+ method = ExtendedMarkersView.class.getDeclaredMethod("getAllMarkers");
method.setAccessible(true);
} catch (SecurityException e) {
e.printStackTrace();
@@ -64,7 +63,7 @@
return new IMarker[0];
}
try {
- return (IMarker[]) method.invoke(this, new Object[0]);
+ return (IMarker[]) method.invoke(this);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/services/EvaluationServiceTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/services/EvaluationServiceTest.java
index d28a4bd..7c62e46 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/services/EvaluationServiceTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/services/EvaluationServiceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -478,8 +478,9 @@
hpField.setAccessible(true);
Object eclipseContext = hpField.get(hs);
assertNotNull(eclipseContext);
- Method getMethod = eclipseContext.getClass().getDeclaredMethod("get", new Class[] { String.class });
- activations = (Collection<IHandlerActivation>) getMethod.invoke(eclipseContext, new Object[] { LEGACY_H_ID + CHECK_HANDLER_ID});
+ Method getMethod = eclipseContext.getClass().getDeclaredMethod("get", String.class);
+ activations = (Collection<IHandlerActivation>) getMethod.invoke(eclipseContext,
+ LEGACY_H_ID + CHECK_HANDLER_ID);
assertNotNull(activations);
} else {
fail("Incorrect handler service: " + hsClassName);