[GRADLE-352] Cannot call a convention method called 'source' from build script Created: 08/Jan/09 Updated: 04/Jan/13 Resolved: 20/May/09 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 0.5 |
Fix Version/s: | 0.6 |
Type: | Bug | ||
Reporter: | Adam Murdoch | Assignee: | Adam Murdoch |
Resolution: | Fixed | Votes: | 0 |
Description |
I have a convention object with a method called 'source' and I cannot call it from a build script. I can call other methods on the same convention object - just not the source() method. Here's some sample code: convention.plugins.bean = new Bean() class Bean { def source() { println 'in source()' }} |
Comments |
Comment by Hans Dockter [ 07/Apr/09 ] |
This problem has to do with the ScriptWithSource class and its setSource method. The stacktrace is confusing. I guess Groovy checks first if Script has a source method. If not it checks if there is a source property. Because of the setSource method it thinks there is one, but that it is not readable. Renaming the setter to setScriptSource would make this problem more unlikely to occur. We might even choose even more uncatchy names for those methods. An alternative would be not to extend Script at all. |
Comment by Adam Murdoch [ 20/May/09 ] |
I've renamed the setter to setScriptSource(). Not a particularly good fix, but it will do for now. |