DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18011>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18011

Overriding built-in types fails within tasks

           Summary: Overriding built-in types fails within tasks
           Product: Ant
           Version: 1.5.2
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I constructed an extended version of FileSet (using a selector is too slow) and 
registered it in a types.properties file for use as "fileset".  I added a 
typedef under project and the debug output indicated that the type was 
successfully overridden.  However, when I try to use the extended version of 
fileset in a task, Ant throws an exception indicating that the 
attribute "query" is not valid for fileset.  The stacktrace clearly indicates 
that the reason is because the the attribute is attempting to be set on the 
default org.apache version of FileSet, not the (differently named) extension.

During my investigation of this, I discovered that the root cause is in 
IntrospectionHelper.  In the IntrospectionHelper constructor, there is a block 
for handling the "add" methods of a task.  This block simply invokes the 
constructor of the class specified as the argument of the "add" method.  This 
is a problem because in my case, the addFileset method of all tasks specifies 
the org.apache.tools.ant.types.FileSet class and that is the only class that 
will be instantiated despite what the typedef indicates.  It seems the 
IntrospectionHelper should first attempt to lookup the type before 
instantiating the default.  This, of course, will require some rearchitecting 
as IntrospectionHelper does not have a reference to an instance of Project.

Reply via email to