Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 21493 invoked from network); 9 Jun 2005 09:16:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jun 2005 09:16:40 -0000 Received: (qmail 56229 invoked by uid 500); 9 Jun 2005 09:16:33 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 56192 invoked by uid 500); 9 Jun 2005 09:16:32 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 56178 invoked by uid 99); 9 Jun 2005 09:16:31 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from gate.corvil.net (HELO corvil.com) (213.94.219.177) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 09 Jun 2005 02:16:30 -0700 Received: from [172.18.1.171] (angel.local.corvil.com [172.18.1.171]) by corvil.com (8.13.3/8.13.3) with ESMTP id j599G3AX039449 for ; Thu, 9 Jun 2005 10:16:03 +0100 (IST) (envelope-from peterreilly@apache.org) Message-ID: <42A80A88.6090202@apache.org> Date: Thu, 09 Jun 2005 10:23:20 +0100 From: Peter Reilly User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ant Users List Subject: Re: type not supported by task? References: <7881d2f20506080843160f1860@mail.gmail.com> <20050608161559.50816.qmail@web30911.mail.mud.yahoo.com> <7881d2f20506090153405c1124@mail.gmail.com> <7881d2f2050609020051501c30@mail.gmail.com> In-Reply-To: <7881d2f2050609020051501c30@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I meant to reply yesterday - but my battery ran out. You need to use the attribute "loaderref" so that the same classloader is used for both the typedef and the taskdef. Otherwise, different classloaders will be used, and so the the classes will not be compatible. Example: --------------------- build.xml --------------- -------------- Task.java ------------------ package my; public class Task extends org.apache.tools.ant.Task { public void add(Type p) { } } --------------- Type.java -------------------- package my; public class Type { } Peter Eric Tchepannou wrote: >I have checked http://www.oracle.com/technology/pub/articles/bodewig_taskwriters.html >I think I should rather use addMyBaseType(MyBaseType t) instead of >addConfigured(...) ? >Could it be that this new syntax is now only valid with Ant 1.6 + ? > >On 6/9/05, Eric Tchepannou wrote: > > >>Thanks for that Matt. >>I have checked my code again and managed to have it working with the >>createXXX() Method. The addConfigured(..) still fails... :( >> >>On 6/8/05, Matt Benson wrote: >> >> >>>Eric: >>> Without consulting the code (much)... if you want >>>your custom task to recognize any of >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>where mytypea|b|c all have one base class, you will >>>want to make each type available with a typedef and >>>then the code you have--addConfigured(BaseTypeClass >>>o)--should work. Beyond that I do wonder why you need >>>to cast your subtypes... OO would dictate that you >>>call a designated method and they would simply behave >>>accordingly, but whatever floats your boat I suppose. >>> >>>HTH, >>>Matt >>> >>>--- Eric Tchepannou wrote: >>> >>> >>> >>>>Hello, >>>> >>>>I am developing an ant task extension but face >>>>problems to have it >>>>running from the buildfile. I get an error stating >>>>that a certain >>>>custom type of mine is not supported by my task. >>>> >>>>I think I know where the problem might come from: >>>>I have implemented multiple types that I have >>>>defined as extension of >>>>a base abstract class (that implements an interface) >>>>and in my Task >>>>extension I have defined an >>>>addConfigured(BaseTypeClass o) and do the >>>>casting in the method implementation. >>>>Could this be the source of the problem? >>>>Should I rather for each type subclass implement a >>>>addConfigured(TypeSubclass o)? >>>> >>>>...or do you think the the problem somewhere else? >>>> >>>>My next step will be to test this, but as this might >>>>be a time >>>>consuming typing job, I thought I could count on >>>>your previous >>>>experiences. >>>> >>>>Many thanks for your contributions. >>>> >>>>-- >>>>Best Regards, >>>>Eric Tchepannou >>>> >>>> >>>> >>>> >>>--------------------------------------------------------------------- >>> >>> >>>>To unsubscribe, e-mail: >>>>user-unsubscribe@ant.apache.org >>>>For additional commands, e-mail: >>>>user-help@ant.apache.org >>>> >>>> >>>> >>>> >>> >>> >>>__________________________________ >>>Discover Yahoo! >>>Use Yahoo! to plan a weekend, have fun online and more. Check it out! >>>http://discover.yahoo.com/ >>> >>> >>> >>-- >>Best Regards, >>Eric Tchepannou >> >> >> > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org