Hi,

I recently hit a case that made me reevaluate the way that we use 
propertyMissing() to auto create items in container DSLs. 

In short: when configuring a container, if you reference a var that does not 
exist on the container or the closure owner, an item will be created 
automatically.

The code is here: 
https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/groovy/org/gradle/api/internal/ConfigureDelegate.java#L75

The issue I hit was that I was trying to create a configuration called 'idea' 
when the 'idea' plugin was applied. Given that we typically use a 
delegate_first strategy everywhere, I expected this to work without fuss. I 
understand why this can't really use proper delegate_first resolution.

I think we should deprecate this behaviour and force element creation to be 
done via a method call, even if it's with an empty configure block. This is a 
small amount of convenience to sacrifice for a increased understandability and 
the reduced risk of confusing behaviour.

I'm proposing changing:

configurations {
        custom
}

to:

configurations {
        custom { }
}

-- 
Luke Daley
Principal Engineer, Gradleware 
http://gradleware.com


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to