Affects Version/s: 1.0, 1.1-beta-1, 1.1-beta-2
Fix Version/s: 1.1-beta-3
Environment:Windows XP, jdk 1.5.0_11
Number of attachments :
We're using Groovy to write controllers in Spring MVC environment. But we often see a "MissingPropertyException" for ModelAndView.viewName property. We investigated it, and found, that org.codehaus.groovy.runtime.GroovyCategorySupport#categoriesInUse counter was not zero, and we were not using any categories in that line! Thus, Groovy tried to fetch a setter from an object, then from a category, and <as we had no active category at the moment, it got null for the setter, and overwrote the valid setter from real ModelAndView. This behaviour (overriding real setter with null setter from category) was fixed in 1.1 beta. But these were only sympthoms - the real problem is the counter. It's incrementing/decrementing methods lack synchronization. There is no synchronization at all!
The methods in question are org.codehaus.groovy.runtime.GroovyCategorySupport#newScope, org.codehaus.groovy.runtime.GroovyCategorySupport#endScope and org.codehaus.groovy.runtime.GroovyCategorySupport#hasCategoryInAnyThread. Each one uses one static long variable, and it will break almost for sure.
So, we've written a testcase for that. It's attached to the issue.
Sometimes we get
groovy.lang.MissingMethodException: No signature of method: java.lang.String.test() is applicable for argument types: (java.lang.String) values:
After adding "synchronized" to these three methods signatures, we got no exceptions.
This bug is similar to http://jira.codehaus.org/browse/GROOVY-1883 , but I have a bit simpler testcase and a patch proposal for that, so I opened one more issue.