Browse Source

Removed references to ValidatedFileAttribute and PreferredAttribute.

Reverted IntrospectionHelper to previous version.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270488 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
9a7f0056b4
2 changed files with 4 additions and 43 deletions
  1. +0
    -10
      WHATSNEW
  2. +4
    -33
      src/main/org/apache/tools/ant/IntrospectionHelper.java

+ 0
- 10
WHATSNEW View File

@@ -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 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 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. 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: Fixed bugs:
----------- -----------


+ 4
- 33
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -56,8 +56,6 @@ package org.apache.tools.ant;


import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.EnumeratedAttribute; 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.Method;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@@ -73,7 +71,6 @@ import java.util.Locale;
* elements. * elements.
* *
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
* @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
*/ */
public class IntrospectionHelper implements BuildListener { public class IntrospectionHelper implements BuildListener {


@@ -168,25 +165,17 @@ public class IntrospectionHelper implements BuildListener {


String propName = getPropertyName(name, "set"); String propName = getPropertyName(name, "set");
if (attributeSetters.get(propName) != null) { 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 Ignore method m, as there is an overloaded
form of this method that takes in a form of this method that takes in a
non-string argument, which gains higher non-string argument, which gains higher
priority. 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; 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, is an overloaded form of this method already defined,
we just override that with the new one. we just override that with the new one.
This mechanism does not guarantee any specific order 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 that depends on the order in which "set" methods have
been defined, is not guaranteed to be selected in any been defined, is not guaranteed to be selected in any
particular order. particular order.
*/
*/
} }
AttributeSetter as = createAttributeSetter(m, args[0]); AttributeSetter as = createAttributeSetter(m, args[0]);
if (as != null) { 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 // worst case. look for a public String constructor and use it
} else { } else {




Loading…
Cancel
Save