dsg said: Unfortunately, since gen-class depends on AOT compilation, fixing the Java 5 issue is not as simple for gen-class as it is for deftype. Most solutions will require changes to the build script. Here are my proposed solutions:
Option 1: Disable tests for Java 5
Simply don't try to compile the test class and skip the annotation tests if the VM is version 5. Given that Java 5 from Oracle has reached its end of life, this option has the appeal of simplicity.
Option 2: The deftype approach
Like deftype, create a simplified set of tests for Java 5. The build script will have to conditionally compile either a Java 5 test class or a Java 6+ test class.
Option 3: Custom annotations
Write a custom set of annotations (probably in Java). This way the tests will not be dependent on which JVM version is being used. This would keep the test code itself simple, and could be reused by the deftype tests.
Option 4: Restricted annotations
Restrict the annotations used to those available in Java 5. Unfortunately, there are not many, and I don't think that any of them allow features like nested annotations. I could be mistaken, though.
I appreciate any opinion on what is the preferred way to handle this problem.