Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.0
-
Fix Version/s: 1.1-rc-1
-
Component/s: command line processing
-
Labels:None
-
Number of attachments :
Description
Unpack the attached example and compile it. The compiler will crash with a RuntimeException like this:
{
Attachments
Issue Links
| This issue depends upon: | ||||
| GROOVY-1962 | add a stream based class reader and an optional java5 module |
|
|
|
Unpack the attached example and compile it. The compiler will crash with a RuntimeException like this:
The problem is this: Foo does some strange stuff in its constructor.
StaticInitBug has a static initializer of type Foo.
Bar uses StaticInitBug. While the compiler compiles Bar, it tries to find out the lastModificationTime of the class StaticInitBug. This code resolves the class using reflection. The net result is that StaticInitBug is loaded and initialized which leads to the execution of the code in Foo.
This should not happen. I guess using reflection in the Groovy compiler is a "must not". Some other means to analyze a class without actually executing any code in it must be found.