Class AliasedTypeAnnotationValidationTest

java.lang.Object
org.checkerframework.framework.test.junit.AliasedTypeAnnotationValidationTest

public class AliasedTypeAnnotationValidationTest extends Object
Tests that AnnotatedTypeFactory.addAliasedTypeAnnotation(java.lang.Class<?>, javax.lang.model.element.AnnotationMirror) validates that the canonical annotation is a supported qualifier and the alias is not already in the type hierarchy.
  • Constructor Details

    • AliasedTypeAnnotationValidationTest

      public AliasedTypeAnnotationValidationTest()
      Creates a new AliasedTypeAnnotationValidationTest.
  • Method Details

    • testUnsupportedCanonicalMirror

      public void testUnsupportedCanonicalMirror()
      Tests that registering an alias with an unsupported canonical AnnotationMirror throws TypeSystemError.
    • testUnsupportedCanonicalClass

      public void testUnsupportedCanonicalClass()
      Tests that registering an alias with an unsupported canonical Class throws TypeSystemError.
    • testAliasIsQualifierName

      public void testAliasIsQualifierName()
      Tests that registering an alias whose name is already a supported qualifier throws TypeSystemError.
    • testAliasIsQualifierClass

      public void testAliasIsQualifierClass()
      Tests that registering an alias whose class is already a supported qualifier throws TypeSystemError.
    • testSupportedQualifierWithoutTarget

      public void testSupportedQualifierWithoutTarget()
      Tests that a supported qualifier declared without a @Target meta-annotation is reported rather than dereferenced as null.
    • testCommandLineCanonicalIsDeclarationAnnotation

      public void testCommandLineCanonicalIsDeclarationAnnotation()
      Tests that -AaliasedTypeAnnos naming a canonical annotation that is a declaration annotation rather than a type annotation is a UserError, not a TypeSystemError.
    • testCommandLineCanonicalWithoutTarget

      public void testCommandLineCanonicalWithoutTarget()
      Tests that -AaliasedTypeAnnos naming a canonical annotation that declares no @Target is a UserError rather than a NullPointerException.
    • testCommandLineAliasIsSupportedQualifier

      public void testCommandLineAliasIsSupportedQualifier()
      Tests that -AaliasedTypeAnnos naming an alias that is itself a supported qualifier is a UserError, not a TypeSystemError.
    • testCommandLineUnsupportedCanonicalIsSkipped

      public void testCommandLineUnsupportedCanonicalIsSkipped()
      Tests that -AaliasedTypeAnnos naming a canonical qualifier that this checker does not support is skipped rather than reported.

      The option is global and every type factory in the checker hierarchy processes it, so an alias written for another type system reaching this one is the normal case. See CustomAliasTest, where the Nullness Checker's KeyFor subchecker sees aliases written for @NonNull.