You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "J.Pietschmann" <j3...@yahoo.de> on 2003/05/13 22:46:01 UTC
Testing for an abstract method
Hi all,
over at FOP we have an odd requirement: We are subclassing an
AWT class which got an abstract method added in JDK 1.4.
Unfortunately, the return value class exists in JDK 1.4 only
too, so that generally adding a dummy method still wouldn't
compile on JDK 1.3. The current solutions is to check for
JDK 1.4 presence by checking for java.lang.CharSequence and
conditionally substitute some text.
I'd rather like to test whether java.awt.GraphicsConfiguration
has a method createCompatibleVolatileImage(int, int), which is
harder to fool by adding a jar with some JDK 1.4 components to
a JDK 1.3 based environment.
Any chance to get the <available> task a bit extended so
that it can also be used to check for methods, fields,
implemented interfaces etc. and specific properties, like
for example
<available property="overrideGraphics"
class="java.awt.GraphicsConfiguration">
<method="createCompatibleVolatileImage"
abstract="yes">
<paramtype name="int"/>
<paramtype name="int"/>
</method>
</available>
J.Pietschmann
Re: Testing for an abstract method
Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
Could you enter your wish as an enhancement request in Bugzilla.
(http://nagoya.apache.org/bugzilla)
Yours
Antoine
----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Tuesday, May 13, 2003 10:46 PM
Subject: Testing for an abstract method
> Hi all,
> over at FOP we have an odd requirement: We are subclassing an
> AWT class which got an abstract method added in JDK 1.4.
> Unfortunately, the return value class exists in JDK 1.4 only
> too, so that generally adding a dummy method still wouldn't
> compile on JDK 1.3. The current solutions is to check for
> JDK 1.4 presence by checking for java.lang.CharSequence and
> conditionally substitute some text.
> I'd rather like to test whether java.awt.GraphicsConfiguration
> has a method createCompatibleVolatileImage(int, int), which is
> harder to fool by adding a jar with some JDK 1.4 components to
> a JDK 1.3 based environment.
>
> Any chance to get the <available> task a bit extended so
> that it can also be used to check for methods, fields,
> implemented interfaces etc. and specific properties, like
> for example
> <available property="overrideGraphics"
> class="java.awt.GraphicsConfiguration">
> <method="createCompatibleVolatileImage"
> abstract="yes">
> <paramtype name="int"/>
> <paramtype name="int"/>
> </method>
> </available>
>
> J.Pietschmann
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
Re: Testing for an abstract method
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Stefan Bodewig wrote:
>>Any chance to get the <available> task a bit extended so
>>that it can also be used to check for methods, fields,
>>implemented interfaces etc. and specific properties...
>
> Doesn't sound too hard. I wouldn't augment available with it but
> rather create a new condition, though.
Any suggestions for a name?
What are the particular rationales to create a new condition
rather than extending <available>? I thought that putting in
declarations for further conditions would be a straightforward
extension:
available class foo with
method foobar(int, int)
and protected static field bar (any type)
and implementing interface xyzzy
Hm, one problem is the syntax for
any method named bar
and
method bar(void).
People will probably assume that no declarations for
parameter types mean the the latter and will wonder
how to do the former. We can just omit the first case
though.
J.Pietschmann
Re: Testing for an abstract method
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 13 May 2003, J. Pietschmann <j3...@yahoo.de> wrote:
> Any chance to get the <available> task a bit extended so
> that it can also be used to check for methods, fields,
> implemented interfaces etc. and specific properties, like
> for example
Doesn't sound too hard. I wouldn't augment available with it but
rather create a new condition, though.
Stefan