Browse Source

These are all patches to stop java1.5 whining about varargs.

In java.15 some of the reflection APIs are overloaded to be
usable via varargs, so untyped things cause confusion. These
are everywhere that bootstrap complains.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277008 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 21 years ago
parent
commit
29b76e0c01
10 changed files with 22 additions and 21 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +1
    -1
      src/main/org/apache/tools/ant/ComponentHelper.java
  3. +2
    -2
      src/main/org/apache/tools/ant/Diagnostics.java
  4. +9
    -8
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  5. +1
    -1
      src/main/org/apache/tools/ant/Project.java
  6. +1
    -1
      src/main/org/apache/tools/ant/TaskAdapter.java
  7. +3
    -3
      src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
  8. +1
    -1
      src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
  9. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
  10. +1
    -1
      src/main/org/apache/tools/zip/ZipEntry.java

+ 1
- 1
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -518,7 +518,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
if (cons.length > 0 && cons[0] != null) {
final String[] strs = new String[NUMBER_OF_STRINGS];
try {
cons[0].newInstance(strs);
cons[0].newInstance((Object[])strs);
// Expecting an exception to be thrown by this call:
// IllegalArgumentException: wrong number of Arguments
} catch (Throwable t) {


+ 1
- 1
src/main/org/apache/tools/ant/ComponentHelper.java View File

@@ -295,7 +295,7 @@ public class ComponentHelper {
throw new BuildException(message);
}
try {
taskClass.getConstructor(null);
taskClass.getConstructor((Class[])null);
// don't have to check for public, since
// getConstructor finds public constructors only.
} catch (NoSuchMethodException e) {


+ 2
- 2
src/main/org/apache/tools/ant/Diagnostics.java View File

@@ -131,11 +131,11 @@ public final class Diagnostics {
try {
// Package pkg = clazz.getPackage();
Method method = Class.class.getMethod("getPackage", new Class[0]);
Object pkg = method.invoke(clazz, null);
Object pkg = method.invoke(clazz, (Object[])null);
if (pkg != null) {
// pkg.getImplementationVersion();
method = pkg.getClass().getMethod("getImplementationVersion", new Class[0]);
Object version = method.invoke(pkg, null);
Object version = method.invoke(pkg, (Object[])null);
return (String) version;
}
} catch (Exception e) {


+ 9
- 8
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -540,7 +540,7 @@ public final class IntrospectionHelper implements BuildListener {
}
}
try {
addText.invoke(element, new String[] {text});
addText.invoke(element, new Object[] {text});
} catch (IllegalAccessException ie) {
// impossible as getMethods should only return public methods
throw new BuildException(ie);
@@ -1050,7 +1050,7 @@ public final class IntrospectionHelper implements BuildListener {
return new AttributeSetter(m) {
public void set(Project p, Object parent, String value)
throws InvocationTargetException, IllegalAccessException {
m.invoke(parent, new String[] {value});
m.invoke(parent, (Object[])(new String[] {value}));
}
};

@@ -1064,7 +1064,8 @@ public final class IntrospectionHelper implements BuildListener {
+ "legal value for attribute \""
+ attrName + "\"");
}
m.invoke(parent, new Character[] {new Character(value.charAt(0))});
m.invoke(parent, (Object[])
(new Character[] {new Character(value.charAt(0))}));
}

};
@@ -1074,9 +1075,9 @@ public final class IntrospectionHelper implements BuildListener {
return new AttributeSetter(m) {
public void set(Project p, Object parent, String value)
throws InvocationTargetException, IllegalAccessException {
m.invoke(parent,
m.invoke(parent,(Object[])(
new Boolean[] {Project.toBoolean(value)
? Boolean.TRUE : Boolean.FALSE});
? Boolean.TRUE : Boolean.FALSE}));
}

};
@@ -1087,7 +1088,7 @@ public final class IntrospectionHelper implements BuildListener {
public void set(Project p, Object parent, String value)
throws InvocationTargetException, IllegalAccessException, BuildException {
try {
m.invoke(parent, new Class[] {Class.forName(value)});
m.invoke(parent, new Object[] {Class.forName(value)});
} catch (ClassNotFoundException ce) {
throw new BuildException(ce);
}
@@ -1099,7 +1100,7 @@ public final class IntrospectionHelper implements BuildListener {
return new AttributeSetter(m) {
public void set(Project p, Object parent, String value)
throws InvocationTargetException, IllegalAccessException {
m.invoke(parent, new File[] {p.resolveFile(value)});
m.invoke(parent, new Object[] {p.resolveFile(value)});
}

};
@@ -1113,7 +1114,7 @@ public final class IntrospectionHelper implements BuildListener {
EnumeratedAttribute ea =
(EnumeratedAttribute) reflectedArg.newInstance();
ea.setValue(value);
m.invoke(parent, new EnumeratedAttribute[] {ea});
m.invoke(parent, new Object[] {ea});
} catch (InstantiationException ie) {
throw new BuildException(ie);
}


+ 1
- 1
src/main/org/apache/tools/ant/Project.java View File

@@ -888,7 +888,7 @@ public class Project {
throw new BuildException(message);
}
try {
taskClass.getConstructor(null);
taskClass.getConstructor((Class[])null);
// don't have to check for public, since
// getConstructor finds public constructors only.
} catch (NoSuchMethodException e) {


+ 1
- 1
src/main/org/apache/tools/ant/TaskAdapter.java View File

@@ -59,7 +59,7 @@ public class TaskAdapter extends Task implements TypeAdapter {
// don't have to check for interface, since then
// taskClass would be abstract too.
try {
final Method executeM = taskClass.getMethod("execute", null);
final Method executeM = taskClass.getMethod("execute", (Class[])null);
// don't have to check for public, since
// getMethod finds public method only.
// don't have to check for abstract, since then


+ 3
- 3
src/main/org/apache/tools/ant/dispatch/DispatchUtils.java View File

@@ -55,7 +55,7 @@ public class DispatchUtils {
final Class c = dispatchable.getClass();
final Method actionM = c.getMethod(mName, new Class[0]);
if (actionM != null) {
final Object o = actionM.invoke(dispatchable, null);
final Object o = actionM.invoke(dispatchable, (Object[])null);
if (o != null) {
final String s = o.toString();
if (s != null && s.trim().length() > 0) {
@@ -66,7 +66,7 @@ public class DispatchUtils {
throw new BuildException("No public " + methodName + "() in "
+ dispatchable.getClass());
}
executeM.invoke(dispatchable, null);
executeM.invoke(dispatchable, (Object[])null);
if (task instanceof UnknownElement) {
((UnknownElement) task).setRealThing(null);
}
@@ -92,7 +92,7 @@ public class DispatchUtils {
throw new BuildException("No public " + methodName + "() in "
+ task.getClass());
}
executeM.invoke(task, null);
executeM.invoke(task, (Object[])null);
if (task instanceof UnknownElement) {
((UnknownElement) task).setRealThing(null);
}


+ 1
- 1
src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java View File

@@ -175,7 +175,7 @@ public final class ChainReaderHelper {
}
final Reader[] rdr = {instream};
instream =
(Reader) constructors[j].newInstance(rdr);
(Reader) constructors[j].newInstance((Object[])rdr);
setProjectOnObject(instream);
if (Parameterizable.class.isAssignableFrom(clazz)) {
final Parameter[] params = filter.getParams();


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java View File

@@ -45,8 +45,8 @@ public class KaffeRmic extends DefaultRmicAdapter {
Class c = Class.forName(RMIC_CLASSNAME);
Constructor cons = c.getConstructor(new Class[] {String[].class});
Object rmic = cons.newInstance(new Object[] {cmd.getArguments()});
Method doRmic = c.getMethod("run", null);
Boolean ok = (Boolean) doRmic.invoke(rmic, null);
Method doRmic = c.getMethod("run", (Class[]) null);
Boolean ok = (Boolean) doRmic.invoke(rmic, (Object[])null);

return ok.booleanValue();
} catch (ClassNotFoundException ex) {


+ 1
- 1
src/main/org/apache/tools/zip/ZipEntry.java View File

@@ -423,7 +423,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
private static void performSetCompressedSize(ZipEntry ze, long size) {
Long[] s = {new Long(size)};
try {
setCompressedSizeMethod.invoke(ze, s);
setCompressedSizeMethod.invoke(ze, (Object[])s);
} catch (InvocationTargetException ite) {
Throwable nested = ite.getTargetException();
throw new RuntimeException("Exception setting the compressed size "


Loading…
Cancel
Save