Release 5.0.1
-
Fixed type formatting of annotations. The previous logic had the following issues:
- Attributes like
stringValue = "foo.bar.example"would be shortened tovalue = "example". This is undesirable for string literals. - Attributes like
doubleValue = 16.0would be shortened todoubleValue = 0. This is VERY undesirable for double literals. - Attributes like
classValue = foo.bar.Example.classwould be shortened toclassValue = class. This is EXTREMELY undesirable for class literals.
All 3 of these issues are now fixed.
- Attributes like
-
Added additional checks to AnnotationContainer to verify that the annotations you're asking about are actually available at runtime. It is easy to forget to annotate your annotations as
@Retention(RetentionPolicy.RUNTIME), and such un-annotated annotations will never be present on an AnnotationContainer unless you literally construct them manually by writing your own class which implements the annotation interface. Not very many people do this in my experience. As such, attempting to ask an AnnotationContainer "is this un-annotated annotation present?" is an indication that you may have forgotten to annotate your annotations as runtime-retained. As such, an AssertionError will now be thrown when asking an AnnotationContainer this question. I chose an AssertionError because the fix for this problem requires modifying your code; it is not correctable at runtime. For performance reasons, these checks are only performed when asserts are enabled. If for any reason it is unknown at compile-time whether or not an annotation is runtime-retained, an additional helper method is also provided to check this for you.