From f4ee8dcc26246fb21e1548605a4cfa2182c104b7 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Tue, 21 Aug 2007 12:26:21 +0000 Subject: [PATCH] Allow reflection on setX(Object x) to be an xml attribute Normally x will be of String type, however with the new PropertyHelper, x may be of other types. x="${el:path.main}" for example. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@568096 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/IntrospectionHelper.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index b2ed38f7e..142fc5b97 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -943,6 +943,17 @@ public final class IntrospectionHelper { final Class reflectedArg = PRIMITIVE_TYPE_MAP.containsKey(arg) ? (Class) PRIMITIVE_TYPE_MAP.get(arg) : arg; + // Object.class - it gets handled differently by AttributeSetter + if (java.lang.Object.class == reflectedArg) { + return new AttributeSetter(m, arg) { + public void set(Project p, Object parent, String value) + throws InvocationTargetException, + IllegalAccessException { + throw new BuildException( + "Internal ant problem - this should not get called"); + } + }; + } // simplest case - setAttribute expects String if (java.lang.String.class.equals(reflectedArg)) { return new AttributeSetter(m, arg) {