ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kev Jackson <>
Subject Re: Use of reflection in DirectoryScanner to remove duplicated code
Date Fri, 25 Aug 2006 00:57:51 GMT
> I am not historically a champion of readability for
> its own sake ;) , but in this case I am of the general
> impression (without having thoroughly perused the
> proposed change) that it should be possible to
> eliminate the duplication without resorting to
> reflection.  To rephrase, if reflection were (is) the
> only way to remove the duplication, I would be +1.  I
> am not sure it has been demonstrated that this is the
> case, so pending clarification here I would categorize
> my stance as -0.
> -Matt

The basic problem is that the two methods do identical work (up to a  
point), except that the fields on which they operate are different.   
Of course I could pass in the vectors as parameters instead of doing  
a reflective lookup (to be honest it's only just occurred to me that  
this would resolve the issue).

I'm interested in this mainly as an academic exercise, because I see  
using reflection as the only dynamic behaviour that Java offers and  
it allows for some 'tricks' (for want of a better phrase) to write  
less code.  I'm also interested in the sort of reception that this  
kind of code gets - most people who I've worked with (Java  
programmers) hate it, but some people (Perl programmers) think it's a  
nice solution to a problem.

I'll post a different solution when I get to work, based on a  
parameterised helper method.

Thanks for the feedback

"All governments are in equal measure good and evil.  The best ideal  
is anarchy." - Leo Tolstoy

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message