Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.12
-
None
-
None
Description
class Foo { static storageProvider def getStorageProvider(Boolean a) { return storageProvider } def getStorageProvider() { if(!storageProvider) { getStorageProvider(true) // <-- Attempts to call statically in 2.5 } return storageProvider } } new Foo().getStorageProvider()
In groovy 2.5+ it seems it gets confused if you have a static variable in a class, say static storageProvider, and a non-static method def getStorageProvider(Boolean x) it tries to call the getStorageProvider(true) statically, which does not exist.
In the groovyConsole you can see the change happen between conversion and semantic analysis - it changes from non-static to static.
Unsure this is intended or not. I couldn't find mention of it in any changes. It would be nice to document/know why the change happened between 2.4/2.5.