This is similar in spirit to bug 8559, but instead of extending <arg>, it would be really nice if <java> itself provided <apply>-like features, like supporting source and dest directories, filesets, selectors and mappers, and being able to pass the arguments that are selected to the java argument list as arguments. It would greatly reduce the need to write tasks in Java for each java program I want to invoke in this way (much of which is boilerplate).
I also would like to have it, but maybe it is better to be able to use <java> inside <apply>.
> maybe it is better to be able to use <java> inside <apply>. Yes, that's what I'm doing now, using executable="${java.home}/bin/java". However, this basically forces you to fork, and is not entirely obvious. And things like defining the classpath for it are a bit tedious. <java> has the advantage that the java-specific options are nicely structured into the task already, so we're mainly talking about grafting <apply>'s argument-handling features onto <java>.
It is a matter of taste, but I think it is better to have tasks orthogonal. It would also help to avoid copy/paste code reuse. I think something like that would be better: <apply> <java/> <apply>