From c74e9ad3bd083b420bd1aea7177b0cfd8957f333 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Mon, 13 Nov 2017 09:23:05 -0800 Subject: [PATCH] Fix my idiot attempt to fix this warning My fix for the unchecked warning in AppleImage.java was completely dumb and I had no idea what I was doing. My understanding of how this works is now greatly improved and the bug I introduced in 292afd2 is fixed. --- .../storage/filters/imagehandlers/AppleImage.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java b/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java index 540c15b..224643f 100644 --- a/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java +++ b/src/com/webcodepro/applecommander/storage/filters/imagehandlers/AppleImage.java @@ -49,8 +49,7 @@ public abstract class AppleImage { public static AppleImage create(int width, int height) { String[] classes = { "ImageIoImage", "SunJpegImage", "SwtImage" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - Class constructorArgType = AppleImage.class; - Class[] constructorArgClasses = new Class[] { AppleImage.class }; + Class[] constructorArgClasses = new Class[] { int.class, int.class }; Object[] constructorArgs = new Object[] { new Integer(width), new Integer(height) }; for (int i=0; i appleImageClass = Class.forName( "com.webcodepro.applecommander.storage.filters.imagehandlers." //$NON-NLS-1$ + classes[i]); - Constructor constructor = - constructorArgType.getConstructor(constructorArgClasses); + Constructor constructor = + appleImageClass.getConstructor(constructorArgClasses); + AppleImage appleImage = (AppleImage) constructor.newInstance(constructorArgs); return appleImage;