On 25/09/2013, at 12:20 PM, Spencer Allain <[email protected]> wrote:
> Was digging around how the modified copy task and copy spec changes work
> together within the gradle code based and was wondering how to interpret this
> piece of code within CopySpecBackCopyActionProcessingStream.java.
>
> This is part of an inner FileVisitor() anonymous class declaration.
>
> private void visit(FileVisitDetails visitDetails) {
> DefaultFileCopyDetails details =
> instantiator.newInstance(DefaultFileCopyDetails.class, visitDetails, spec,
> fileSystem);
> for (Action<? super FileCopyDetails> action :
> spec.getAllCopyActions()) {
> action.execute(details);
> if (details.isExcluded()) {
> return;
> }
> }
> action.processFile(details);
> }
>
> Why would the details.isExcluded() test be done within the for loop?
Because `action.execute(details);` may have called details.exclude().
>
> Ignore that the action variable appears to be out of scope in this snippet,
> as there is a different variable outside the for loop that is also called
> action.
>
> -Spencer
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
Join us at the Gradle eXchange 2013, Oct 28th in London, UK:
http://skillsmatter.com/event/java-jee/gradle-exchange-2013
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email