diff --git a/WHATSNEW b/WHATSNEW index b5590e596..8f100558a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -28,16 +28,6 @@ Changes that could break older environments: a check is made to see if there is another overloaded method that takes in some other type of argument. If there is one such method, then the method that takes in String as an argument is not selected by the Introspector. - - In addition, if there is an overloaded setter method that takes in a - PreferredAttribute, it gains preference over other setters that do not - take in a PreferredAttribute as argument. For example, if the methods - setFoo(File) and setFoo(SrcFile) is present, setFoo(SrcFile) will be the - one which gets invoked because SrcFile is a PreferredAttribute. If there - are methods like setFoo(SrcFile) as well as setFoo(DestDir), where - SrcFile and DestDir are PreferredAttributes, the setFoo method that - gets selected first by the Java runtime will be the one that gets - invoked. Fixed bugs: ----------- diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index fc044b2e8..56096cd22 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -56,8 +56,6 @@ package org.apache.tools.ant; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.EnumeratedAttribute; -import org.apache.tools.ant.types.PreferredAttribute; -import org.apache.tools.ant.types.ValidatedFileAttribute; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; @@ -73,7 +71,6 @@ import java.util.Locale; * elements. * * @author Stefan Bodewig - * @author Magesh Umasankar */ public class IntrospectionHelper implements BuildListener { @@ -168,25 +165,17 @@ public class IntrospectionHelper implements BuildListener { String propName = getPropertyName(name, "set"); if (attributeSetters.get(propName) != null) { - if (java.lang.String.class.equals(args[0]) + if (java.lang.String.class.equals(args[0])) { /* Ignore method m, as there is an overloaded form of this method that takes in a non-string argument, which gains higher priority. - */ - || PreferredAttribute.class. - isAssignableFrom((Class)attributeTypes.get(propName)) - /* - Ignore method m because there is an overloaded form of - this method that takes in a PreferredAttribute argument, - which gains higher priority. - */ - ) { + */ continue; } /* - If the above conditions are not true, and if there + If the argument is not a String, and if there is an overloaded form of this method already defined, we just override that with the new one. This mechanism does not guarantee any specific order @@ -194,7 +183,7 @@ public class IntrospectionHelper implements BuildListener { that depends on the order in which "set" methods have been defined, is not guaranteed to be selected in any particular order. - */ + */ } AttributeSetter as = createAttributeSetter(m, args[0]); if (as != null) { @@ -600,24 +589,6 @@ public class IntrospectionHelper implements BuildListener { } }; - // ValidatedFileAttributes have their own helper class - } else if (ValidatedFileAttribute.class.isAssignableFrom(arg)) { - return new AttributeSetter() { - public void set(Project p, Object parent, String value) - throws InvocationTargetException, IllegalAccessException, BuildException { - try { - ValidatedFileAttribute[] vfa = { - (ValidatedFileAttribute) arg.newInstance() - }; - File f = p.resolveFile(value); - vfa[0].setFile(f); - m.invoke(parent, vfa); - } catch (InstantiationException ie) { - throw new BuildException(ie); - } - } - }; - // worst case. look for a public String constructor and use it } else {