Skip to content

Release 5.0.1

Choose a tag to compare

@Builderb0y Builderb0y released this 30 Mar 04:09
  • Fixed type formatting of annotations. The previous logic had the following issues:

    • Attributes like stringValue = "foo.bar.example" would be shortened to value = "example". This is undesirable for string literals.
    • Attributes like doubleValue = 16.0 would be shortened to doubleValue = 0. This is VERY undesirable for double literals.
    • Attributes like classValue = foo.bar.Example.class would be shortened to classValue = class. This is EXTREMELY undesirable for class literals.
      All 3 of these issues are now fixed.
  • 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.