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.
GROOVY-1848was 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.