diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java
index 8d897f44df..705f771872 100644
--- a/core/src/processing/awt/PSurfaceAWT.java
+++ b/core/src/processing/awt/PSurfaceAWT.java
@@ -597,8 +597,8 @@ public void setIcon(PImage image) {
Class> thinkDifferent =
Thread.currentThread().getContextClassLoader().loadClass(td);
Method method =
- thinkDifferent.getMethod("setIconImage", new Class[] { java.awt.Image.class });
- method.invoke(null, new Object[] { awtImage });
+ thinkDifferent.getMethod("setIconImage", Image.class);
+ method.invoke(null, awtImage);
} catch (Exception e) {
e.printStackTrace(); // That's unfortunate
}
@@ -655,8 +655,8 @@ protected void setProcessingIcon(Frame frame) {
Class> thinkDifferent =
Thread.currentThread().getContextClassLoader().loadClass(td);
Method method =
- thinkDifferent.getMethod("setIconImage", new Class[] { java.awt.Image.class });
- method.invoke(null, new Object[] { Toolkit.getDefaultToolkit().getImage(url) });
+ thinkDifferent.getMethod("setIconImage", Image.class);
+ method.invoke(null, Toolkit.getDefaultToolkit().getImage(url));
} catch (Exception e) {
e.printStackTrace(); // That's unfortunate
}
diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java
index ccc62e859a..3b8b06a984 100644
--- a/core/src/processing/core/PApplet.java
+++ b/core/src/processing/core/PApplet.java
@@ -1581,18 +1581,7 @@ public void unregisterMethod(String name, Object target) {
}
}
-
- protected void handleMethods(String methodName) {
- synchronized (registerLock) {
- RegisteredMethods meth = registerMap.get(methodName);
- if (meth != null) {
- meth.handle();
- }
- }
- }
-
-
- protected void handleMethods(String methodName, Object[] args) {
+ protected void handleMethods(String methodName, Object...args) {
synchronized (registerLock) {
RegisteredMethods meth = registerMap.get(methodName);
if (meth != null) {
@@ -2223,7 +2212,7 @@ protected PGraphics makeGraphics(int w, int h,
Class> rendererClass =
Thread.currentThread().getContextClassLoader().loadClass(renderer);
- Constructor> constructor = rendererClass.getConstructor(new Class[] { });
+ Constructor> constructor = rendererClass.getConstructor();
PGraphics pg = (PGraphics) constructor.newInstance();
pg.setParent(this);
@@ -2707,7 +2696,7 @@ protected void handleMouseEvent(MouseEvent event) {
break;
}
- handleMethods("mouseEvent", new Object[] { event });
+ handleMethods("mouseEvent", event);
switch (action) {
case MouseEvent.PRESS:
@@ -2979,7 +2968,7 @@ protected void handleKeyEvent(KeyEvent event) {
}
*/
- handleMethods("keyEvent", new Object[] { event });
+ handleMethods("keyEvent", event);
// if someone else wants to intercept the key, they should
// set key to zero (or something besides the ESC).
@@ -3824,8 +3813,8 @@ public void dispose() {
*/
public void method(String name) {
try {
- Method method = getClass().getMethod(name, new Class[] {});
- method.invoke(this, new Object[] { });
+ Method method = getClass().getMethod(name);
+ method.invoke(this);
} catch (IllegalArgumentException e) {
e.printStackTrace();
@@ -6676,8 +6665,8 @@ static private void selectCallback(File selectedFile,
try {
Class> callbackClass = callbackObject.getClass();
Method selectMethod =
- callbackClass.getMethod(callbackMethod, new Class[] { File.class });
- selectMethod.invoke(callbackObject, new Object[] { selectedFile });
+ callbackClass.getMethod(callbackMethod, File.class);
+ selectMethod.invoke(callbackObject, selectedFile);
} catch (IllegalAccessException iae) {
System.err.println(callbackMethod + "() must be public");
@@ -10802,8 +10791,8 @@ public void uncaughtException(Thread t, Throwable e) {
Class> thinkDifferent =
Thread.currentThread().getContextClassLoader().loadClass(td);
Method method =
- thinkDifferent.getMethod("init", new Class[] { PApplet.class });
- method.invoke(null, new Object[] { sketch });
+ thinkDifferent.getMethod("init", PApplet.class);
+ method.invoke(null, sketch);
} catch (Exception e) {
e.printStackTrace(); // That's unfortunate
}
diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java
index 7dde4803bb..da18974e80 100644
--- a/core/src/processing/data/Table.java
+++ b/core/src/processing/data/Table.java
@@ -1062,7 +1062,7 @@ public void parseInto(Object enclosingObject, String fieldName) {
con = target.getDeclaredConstructor(); //new Class[] { });
// PApplet.println("no enclosing class");
} else {
- con = target.getDeclaredConstructor(new Class[] { enclosingClass });
+ con = target.getDeclaredConstructor(enclosingClass);
// PApplet.println("enclosed by " + enclosingClass.getName());
}
if (!con.canAccess(null)) {
@@ -1509,17 +1509,15 @@ protected void saveODS(OutputStream os) throws IOException {
entry = new ZipEntry("content.xml");
zos.putNextEntry(entry);
//lines = new String[] {
- writeUTF(zos, new String[] {
- xmlHeader,
- "",
- " ",
- " ",
- " "
- });
+ writeUTF(zos, xmlHeader,
+ "",
+ " ",
+ " ",
+ " ");
//zos.write(PApplet.join(lines, "\n").getBytes());
byte[] rowStart = " \n".getBytes();
@@ -1546,12 +1544,10 @@ protected void saveODS(OutputStream os) throws IOException {
}
//lines = new String[] {
- writeUTF(zos, new String[] {
- " ",
- " ",
- " ",
- ""
- });
+ writeUTF(zos, " ",
+ " ",
+ " ",
+ "");
//zos.write(PApplet.join(lines, "\n").getBytes());
zos.closeEntry();
diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java
index b4f145eda6..7d992cdb36 100644
--- a/core/src/processing/opengl/PGraphicsOpenGL.java
+++ b/core/src/processing/opengl/PGraphicsOpenGL.java
@@ -53,7 +53,7 @@ public class PGraphicsOpenGL extends PGraphics {
// Using the technique alternative to finalization described in:
// http://www.oracle.com/technetwork/articles/java/finalization-137655.html
private static ReferenceQueue