ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaikiran Pai <jai.forums2...@gmail.com>
Subject User implementations of custom interfaces can have access to Task instance?
Date Tue, 13 Mar 2018 06:17:14 GMT
I'm looking for some suggestion on whether it's a good/bad idea to 
expose a method to custom user defined classes which takes a "Task" 
object. This is in context of the JUnitLauncher task that I recently 
added. It allows custom report formatters/listeners to be implemented 
and the expectation is that such classes will implement the 
TestResultFormatter interface that is (newly) part of Ant. This 
interface exposes:

void setTask(Task currentExecutingTask)

so the implementations of this class have access to the current task 
that's running. Right now, the only reason I exposed that Task instance 
was to allow such implementation to issue log messages from within the 
implementation like:

task.getProject().log(...., level);

I have been looking into other such cases where we allow custom 
implementations and documentation, but haven't found a guideline or 
anything that says whether it's good idea to give access to the Task 
instance to such custom implementations.

For now, I would like to avoid it if possible (logging is the only 
reason I use this instance for now). However, if there are no real 
concerns of letting custom implementations of the interface have access 
to this, then I will just go ahead and expose it without worrying about it.

P.S: I realize in fork mode, the Task instance won't be available and 
I'll be taking that into account, but this question is more a general 
guideline I'm looking for.

-Jaikiran




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


Mime
View raw message