Issue Details (XML | Word | Printable)

Key: GROOVY-1962
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Jochen Theodorou
Reporter: Jochen Theodorou
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

add a stream based class reader and an optional java5 module

Created: 01/Jul/07 01:26 PM   Updated: 11/Oct/07 06:16 PM   Resolved: 11/Oct/07 06:16 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1-rc-1

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide

as GROOVY-1848 states Groovy should try to not to load classes by ClassLoader#loadClass but to open them using a stream based class reader. As this will avoid the issue with the static initializer it will also avoid allow to read the class creation date in a class without loading it and it will allow to extract generics (or annotation) information from the class without using the java5 API (GROOVY-1314).

As a fall back we still require a module accessing the class using reflection. In same cases we can not avoid this action. therefor I thought that adding an optional module to the build that uses java5 methods would solve that in a way we can live with. For this the default build would have to migrate to java5, but could still be run on java4. in case of java4 the build would not compile the optional module, thus allowing us to operate on a replacement doing the job as good as a running on a JVM prior to java5 can do. This dummy would also be used if groovy runs on a pre java5 VM.

With that we can still build Groovy on java4, but without generics and annotations, even when run on java5. When build on java5 we can still run Groovy on java4, if run on java5 the optional module will be used and allow additional information for java5 classes. The stream based reader will not need to be part of that module.



Jochen Theodorou added a comment - 11/Oct/07 06:16 PM

since GROOVY-1848 was implemented without using a stream based class reader this requirement is removed. Also the java 5 module is now reponsible for reading the generics information, something we would have had to add anyway.

The java5 module is now available, it is only build if the ant property groovy.build.vm5 is set. The module will be used only if running in a java5 VM, and will fallback to a java4 module. currently running the tests on a java4 VM is not possible due to some generics checks we have to figure out how to disable on a java4 machine. But the build without tests will run fine.