◐ Shell
clean mode source ↗

Remove redundant boxing and casting by Minimaximize · Pull Request #5982 · processing/processing

Expand Up @@ -1190,7 +1190,7 @@ public int displayDensity(int display) { field.setAccessible(true); Object scale = field.get(device);
if (scale instanceof Integer && ((Integer)scale).intValue() == 2) { if (scale instanceof Integer && (Integer) scale == 2) { return 2; } } Expand Down Expand Up @@ -1620,18 +1620,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) { Expand Down Expand Up @@ -2262,7 +2251,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); Expand Down Expand Up @@ -2746,7 +2735,7 @@ protected void handleMouseEvent(MouseEvent event) { break; }
handleMethods("mouseEvent", new Object[] { event }); handleMethods("mouseEvent", event);
switch (action) { case MouseEvent.PRESS: Expand Down Expand Up @@ -3018,7 +3007,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). Expand Down Expand Up @@ -3863,8 +3852,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(); Expand Down Expand Up @@ -6715,8 +6704,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"); Expand Down Expand Up @@ -10841,8 +10830,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 } Expand Down