Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6.5, 1.7-beta-2
-
None
Description
GroovyClassLoader#parseClass(String) internally generates a dummy file name for the script text passed to it and uses that file name to cache the class it generates. It uses System.currentTimeMillis() to come up with a unique dummy file name.
However, sometimes it happens that consecutive parseClass(String) calls with different script text may take place during the same milli-second causing GCL to following to happen:
// say dummy file name is script4576677673878.groovy. The class gets cached againt this file name. GCL#parseClass('class A {}') // following returns the class A because this call is happening within the same milli-sec and hence has the same file name GCL#parseClass('class B {}')