ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@gmx.de>
Subject Re: Non-reflective version of DirectoryScanner refectoring
Date Fri, 25 Aug 2006 02:12:20 GMT
Hello Kev,

this sounds like the solution.

I think the use of reflection in the ant codebase should be limited  
to cases where we want to use third party APIs which may or not be  
here and which we do not want to explicitly compile against.


Regards,

Antoine


On Aug 25, 2006, at 4:26 AM, Kev Jackson wrote:

> Hi,
>
> After thinking this through this morning on the ride into work,  
> here is
> a version of the refactoring (extract method) that doesn't use any
> reflection (so should satisfy both Antoine and Matt ;))
>
> Attached patch for testing purposes too.
>
> /**
>      * Process included file.
>      * @param name  path of the file relative to the directory of the
> FileSet.
>      * @param file  included File.
>      */
>     private void accountForIncludedFile(String name, File file) {
>     	processIncluded(name, file, filesIncluded, filesExcluded,
> filesDeselected);
>     }
>
>     /**
>      * Process included directory.
>      * @param name path of the directory relative to the directory of
>      *             the FileSet.
>      * @param file directory as File.
>      * @param fast whether to perform fast scans.
>      */
>     private void accountForIncludedDir(String name, File file, boolean
> fast) {
>     	processIncluded(name, file, dirsIncluded, dirsExcluded,
> dirsDeselected);
>         if (fast && couldHoldIncluded(name) && !contentsExcluded 
> (name))
> {
>             scandir(file, name + File.separator, fast);
>         }
>     }
>
>     private void processIncluded(String name, File file, Vector inc,
> Vector exc, Vector des) {
>
>         if (inc.contains(name) || exc.contains(name) ||
> des.contains(name)) { return; }
>
>         boolean included = false;
>         if (isExcluded(name)) {
>             exc.add(name);
>         } else if(isSelected(name, file)) {
>             included = true;
>             inc.add(name);
>         } else {
>             des.add(name);
>         }
>         everythingIncluded &= included;
>     }
> <DirectoryScanner.java.patch>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org


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


Mime
View raw message