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.
This commit is contained in:
parent
43796815bf
commit
c74e9ad3bd
|
@ -49,8 +49,7 @@ public abstract class AppleImage {
|
||||||
public static AppleImage create(int width, int height) {
|
public static AppleImage create(int width, int height) {
|
||||||
String[] classes = {
|
String[] classes = {
|
||||||
"ImageIoImage", "SunJpegImage", "SwtImage" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"ImageIoImage", "SunJpegImage", "SwtImage" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
Class<?> constructorArgType = AppleImage.class;
|
Class[] constructorArgClasses = new Class[] { int.class, int.class };
|
||||||
Class<?>[] constructorArgClasses = new Class[] { AppleImage.class };
|
|
||||||
Object[] constructorArgs = new Object[] {
|
Object[] constructorArgs = new Object[] {
|
||||||
new Integer(width), new Integer(height) };
|
new Integer(width), new Integer(height) };
|
||||||
for (int i=0; i<classes.length; i++) {
|
for (int i=0; i<classes.length; i++) {
|
||||||
|
@ -58,8 +57,9 @@ public abstract class AppleImage {
|
||||||
Class<?> appleImageClass = Class.forName(
|
Class<?> appleImageClass = Class.forName(
|
||||||
"com.webcodepro.applecommander.storage.filters.imagehandlers." //$NON-NLS-1$
|
"com.webcodepro.applecommander.storage.filters.imagehandlers." //$NON-NLS-1$
|
||||||
+ classes[i]);
|
+ classes[i]);
|
||||||
Constructor constructor =
|
Constructor<?> constructor =
|
||||||
constructorArgType.getConstructor(constructorArgClasses);
|
appleImageClass.getConstructor(constructorArgClasses);
|
||||||
|
|
||||||
AppleImage appleImage = (AppleImage)
|
AppleImage appleImage = (AppleImage)
|
||||||
constructor.newInstance(constructorArgs);
|
constructor.newInstance(constructorArgs);
|
||||||
return appleImage;
|
return appleImage;
|
||||||
|
|
Loading…
Reference in New Issue