diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java
index d26b7e4d8..03bb03a48 100644
--- a/core/src/processing/awt/PSurfaceAWT.java
+++ b/core/src/processing/awt/PSurfaceAWT.java
@@ -633,8 +633,8 @@ public class PSurfaceAWT extends PSurfaceNone {
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
}
@@ -691,8 +691,8 @@ public class PSurfaceAWT extends PSurfaceNone {
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 bddc7c0da..a7584c9f2 100644
--- a/core/src/processing/core/PApplet.java
+++ b/core/src/processing/core/PApplet.java
@@ -1454,18 +1454,7 @@ public class PApplet implements PConstants {
}
}
-
- 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) {
@@ -2096,7 +2085,7 @@ public class PApplet implements PConstants {
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);
@@ -2580,7 +2569,7 @@ public class PApplet implements PConstants {
break;
}
- handleMethods("mouseEvent", new Object[] { event });
+ handleMethods("mouseEvent", event);
switch (action) {
case MouseEvent.PRESS:
@@ -2852,7 +2841,7 @@ public class PApplet implements PConstants {
}
*/
- 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).
@@ -3689,8 +3678,8 @@ public class PApplet implements PConstants {
*/
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();
@@ -6150,8 +6139,8 @@ public class PApplet implements PConstants {
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");
@@ -10236,8 +10225,8 @@ public class PApplet implements PConstants {
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 7dde4803b..da18974e8 100644
--- a/core/src/processing/data/Table.java
+++ b/core/src/processing/data/Table.java
@@ -1062,7 +1062,7 @@ public class Table {
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 @@ public class Table {
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 @@ public class Table {
}
//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 b4f145eda..7d992cdb3 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