stevel 2004/11/09 16:37:31 Modified: src/main/org/apache/tools/ant AntClassLoader.java ComponentHelper.java Diagnostics.java IntrospectionHelper.java Project.java TaskAdapter.java src/main/org/apache/tools/ant/dispatch DispatchUtils.java src/main/org/apache/tools/ant/filters/util ChainReaderHelper.java src/main/org/apache/tools/zip ZipEntry.java src/main/org/apache/tools/ant/taskdefs/rmic KaffeRmic.java Log: 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. Revision Changes Path 1.85 +1 -1 ant/src/main/org/apache/tools/ant/AntClassLoader.java Index: AntClassLoader.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/AntClassLoader.java,v retrieving revision 1.84 retrieving revision 1.85 diff -u -r1.84 -r1.85 --- AntClassLoader.java 27 Jul 2004 07:02:06 -0000 1.84 +++ AntClassLoader.java 10 Nov 2004 00:37:30 -0000 1.85 @@ -518,7 +518,7 @@ 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.38 +1 -1 ant/src/main/org/apache/tools/ant/ComponentHelper.java Index: ComponentHelper.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/ComponentHelper.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- ComponentHelper.java 16 Jun 2004 15:41:51 -0000 1.37 +++ ComponentHelper.java 10 Nov 2004 00:37:30 -0000 1.38 @@ -295,7 +295,7 @@ 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.16 +2 -2 ant/src/main/org/apache/tools/ant/Diagnostics.java Index: Diagnostics.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Diagnostics.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- Diagnostics.java 28 Oct 2004 08:47:26 -0000 1.15 +++ Diagnostics.java 10 Nov 2004 00:37:30 -0000 1.16 @@ -131,11 +131,11 @@ 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) { 1.91 +9 -8 ant/src/main/org/apache/tools/ant/IntrospectionHelper.java Index: IntrospectionHelper.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- IntrospectionHelper.java 24 Sep 2004 08:45:49 -0000 1.90 +++ IntrospectionHelper.java 10 Nov 2004 00:37:30 -0000 1.91 @@ -540,7 +540,7 @@ } } 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 @@ 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 @@ + "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 @@ 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 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 @@ 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 @@ 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.177 +2 -2 ant/src/main/org/apache/tools/ant/Project.java Index: Project.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Project.java,v retrieving revision 1.176 retrieving revision 1.177 diff -u -r1.176 -r1.177 --- Project.java 28 Oct 2004 09:12:02 -0000 1.176 +++ Project.java 10 Nov 2004 00:37:30 -0000 1.177 @@ -888,7 +888,7 @@ 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.31 +1 -1 ant/src/main/org/apache/tools/ant/TaskAdapter.java Index: TaskAdapter.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/TaskAdapter.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- TaskAdapter.java 10 Jun 2004 18:01:47 -0000 1.30 +++ TaskAdapter.java 10 Nov 2004 00:37:30 -0000 1.31 @@ -59,7 +59,7 @@ // 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 1.2 +113 -113 ant/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java Index: DispatchUtils.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DispatchUtils.java 10 Jun 2004 18:01:47 -0000 1.1 +++ DispatchUtils.java 10 Nov 2004 00:37:30 -0000 1.2 @@ -1,113 +1,113 @@ -/* - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.tools.ant.dispatch; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.UnknownElement; -import org.apache.tools.ant.Task; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Determines and Executes the action method for the task - */ -public class DispatchUtils { - /** - * Determines and Executes the action method for the task - */ - public static final void execute(Object task) throws BuildException { - String methodName = "execute"; - Dispatchable dispatchable = null; - try { - if (task instanceof Dispatchable) { - dispatchable = (Dispatchable) task; - } else if (task instanceof UnknownElement) { - UnknownElement ue = (UnknownElement)task; - Object realThing = ue.getRealThing(); - if (realThing != null && realThing instanceof Dispatchable && realThing instanceof Task) { - dispatchable = (Dispatchable) realThing; - } - } - if (dispatchable != null) { - String mName = null; - try { - final String name = dispatchable.getActionParameterName(); - if (name != null && name.trim().length() > 0) { - mName = "get" + name.trim().substring(0, 1).toUpperCase(); - if (name.length() > 1) { - mName += name.substring(1); - } - final Class c = dispatchable.getClass(); - final Method actionM = c.getMethod(mName, new Class[0]); - if (actionM != null) { - final Object o = actionM.invoke(dispatchable, null); - if (o != null) { - final String s = o.toString(); - if (s != null && s.trim().length() > 0) { - methodName = s.trim(); - Method executeM = null; - executeM = dispatchable.getClass().getMethod(methodName, new Class[0]); - if (executeM == null) { - throw new BuildException("No public " + methodName + "() in " - + dispatchable.getClass()); - } - executeM.invoke(dispatchable, null); - if (task instanceof UnknownElement) { - ((UnknownElement) task).setRealThing(null); - } - } else { - throw new BuildException("Dispatchable Task attribute '" + name.trim() - + "' not set or value is empty."); - } - } else { - throw new BuildException("Dispatchable Task attribute '" + name.trim() - + "' not set or value is empty."); - } - } - } else { - throw new BuildException("Action Parameter Name must not be empty for Dispatchable Task."); - } - } catch (NoSuchMethodException nsme) { - throw new BuildException("No public " + mName + "() in " + task.getClass()); - } - } else { - Method executeM = null; - executeM = task.getClass().getMethod(methodName, new Class[0]); - if (executeM == null) { - throw new BuildException("No public " + methodName + "() in " - + task.getClass()); - } - executeM.invoke(task, null); - if (task instanceof UnknownElement) { - ((UnknownElement) task).setRealThing(null); - } - } - } catch(InvocationTargetException ie) { - Throwable t = ie.getTargetException(); - if (t instanceof BuildException) { - throw ((BuildException) t); - } else { - throw new BuildException(t); - } - } catch (NoSuchMethodException e) { - throw new BuildException(e); - } catch (IllegalAccessException e) { - throw new BuildException(e); - } - } -} +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.tools.ant.dispatch; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.UnknownElement; +import org.apache.tools.ant.Task; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * Determines and Executes the action method for the task + */ +public class DispatchUtils { + /** + * Determines and Executes the action method for the task + */ + public static final void execute(Object task) throws BuildException { + String methodName = "execute"; + Dispatchable dispatchable = null; + try { + if (task instanceof Dispatchable) { + dispatchable = (Dispatchable) task; + } else if (task instanceof UnknownElement) { + UnknownElement ue = (UnknownElement)task; + Object realThing = ue.getRealThing(); + if (realThing != null && realThing instanceof Dispatchable && realThing instanceof Task) { + dispatchable = (Dispatchable) realThing; + } + } + if (dispatchable != null) { + String mName = null; + try { + final String name = dispatchable.getActionParameterName(); + if (name != null && name.trim().length() > 0) { + mName = "get" + name.trim().substring(0, 1).toUpperCase(); + if (name.length() > 1) { + mName += name.substring(1); + } + final Class c = dispatchable.getClass(); + final Method actionM = c.getMethod(mName, new Class[0]); + if (actionM != null) { + final Object o = actionM.invoke(dispatchable, (Object[])null); + if (o != null) { + final String s = o.toString(); + if (s != null && s.trim().length() > 0) { + methodName = s.trim(); + Method executeM = null; + executeM = dispatchable.getClass().getMethod(methodName, new Class[0]); + if (executeM == null) { + throw new BuildException("No public " + methodName + "() in " + + dispatchable.getClass()); + } + executeM.invoke(dispatchable, (Object[])null); + if (task instanceof UnknownElement) { + ((UnknownElement) task).setRealThing(null); + } + } else { + throw new BuildException("Dispatchable Task attribute '" + name.trim() + + "' not set or value is empty."); + } + } else { + throw new BuildException("Dispatchable Task attribute '" + name.trim() + + "' not set or value is empty."); + } + } + } else { + throw new BuildException("Action Parameter Name must not be empty for Dispatchable Task."); + } + } catch (NoSuchMethodException nsme) { + throw new BuildException("No public " + mName + "() in " + task.getClass()); + } + } else { + Method executeM = null; + executeM = task.getClass().getMethod(methodName, new Class[0]); + if (executeM == null) { + throw new BuildException("No public " + methodName + "() in " + + task.getClass()); + } + executeM.invoke(task, (Object[])null); + if (task instanceof UnknownElement) { + ((UnknownElement) task).setRealThing(null); + } + } + } catch(InvocationTargetException ie) { + Throwable t = ie.getTargetException(); + if (t instanceof BuildException) { + throw ((BuildException) t); + } else { + throw new BuildException(t); + } + } catch (NoSuchMethodException e) { + throw new BuildException(e); + } catch (IllegalAccessException e) { + throw new BuildException(e); + } + } +} 1.24 +1 -1 ant/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java Index: ChainReaderHelper.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- ChainReaderHelper.java 9 Mar 2004 16:48:02 -0000 1.23 +++ ChainReaderHelper.java 10 Nov 2004 00:37:31 -0000 1.24 @@ -175,7 +175,7 @@ } 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(); 1.17 +2 -2 ant/src/main/org/apache/tools/zip/ZipEntry.java Index: ZipEntry.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipEntry.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ZipEntry.java 9 Mar 2004 16:48:55 -0000 1.16 +++ ZipEntry.java 10 Nov 2004 00:37:31 -0000 1.17 @@ -423,7 +423,7 @@ 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 " 1.18 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java Index: KaffeRmic.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- KaffeRmic.java 5 Aug 2004 17:13:42 -0000 1.17 +++ KaffeRmic.java 10 Nov 2004 00:37:31 -0000 1.18 @@ -45,8 +45,8 @@ 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) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]