ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject using project.createTask bad?
Date Wed, 09 Aug 2000 23:03:56 GMT
As has been pointed out on the ant-user list, the practice of using
project.createTask("taskx") and then casting it to the desired task type is
not really desirable. All you can rely on is that project will give you a
class that implements the Task interface. Since the mapping of task names to
classes can be changed you can't assume anything more.

This pattern has been used a lot. I think we should change it. If you want a
particular class, then I think it would be better to create an instance of
that class and avoid the cast. We should reorganize the methods in the
Project class a little so that Tasks can be created outside the project and
then initialised in a consistent manner. This would involve splitting out an
initTask method from the current createTask method.

I will go ahead with this change unless someone objects.

Conor MacNeill
Cortex eBusiness

View raw message