ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Quesseveur" <quessev...@abaksystemes.fr>
Subject Some problems extending ExecTask
Date Mon, 04 Dec 2006 15:19:19 GMT
Hello,

I wanted to be able to use conditional args with an exec-like task
(like the way compilerarg works in cc task). So I have done the
following things:

  - extend Commandline.Argument to Commandline.Xargument: that new
    class introduces 2 new attributes to manage if and unset
    conditions.
  - extend Commandline to XCommandLine to manage a vector of XArgument
  - extend ExecTask to set the new Commandline in the constructor

,----
|   cmdl = new XCommandLine();
`----

That works fine, but as the variable arguments in Commandline.java is
private I have to declare my own arguments variable in the extended
class XCommandline and rewrite all the methods that access that
variable. It would be more simple if the variable arguments was
protected. Is there any reason to restrict arguments visibility?

More annoying. If I want to use the new argument type in an Apply task
I have to manage correctly the Commandline.Marker. The
Commandline.Marker.getPosition() needs to access items in the
arguments vector. As I cannot override the private arguments variable
I have to rewrite the Commandline.Marker.getPosition() method to use
the new variable set in the extended class XCommandline. But it is not
possible: class Commandline.Marker is public but the constructor is
only package visible. The constructor should be protected to be able
to set a new Marker class subclassing Commandline.Marker. 

Once again there wouldn't any problems if arguments was protected.

What can I do to achieve my goal as I don't want to rewrite entirely
the Commandline and ExecuteOn tasks?

TIA.


-- 
Pascal Quesseveur, quesseveur@abaksystemes.fr


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message