Class AliasedTypeAnnotationValidationTest
java.lang.Object
org.checkerframework.framework.test.junit.AliasedTypeAnnotationValidationTest
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 Summary
ConstructorsConstructorDescriptionCreates a new AliasedTypeAnnotationValidationTest. -
Method Summary
Modifier and TypeMethodDescriptionvoidTests that registering an alias whose class is already a supported qualifier throws TypeSystemError.voidTests that registering an alias whose name is already a supported qualifier throws TypeSystemError.voidTests that-AaliasedTypeAnnosnaming an alias that is itself a supported qualifier is a UserError, not a TypeSystemError.voidTests that-AaliasedTypeAnnosnaming a canonical annotation that is a declaration annotation rather than a type annotation is a UserError, not a TypeSystemError.voidTests that-AaliasedTypeAnnosnaming a canonical annotation that declares no@Targetis a UserError rather than a NullPointerException.voidTests that-AaliasedTypeAnnosnaming a canonical qualifier that this checker does not support is skipped rather than reported.voidTests that a supported qualifier declared without a@Targetmeta-annotation is reported rather than dereferenced as null.voidTests that registering an alias with an unsupported canonical Class throws TypeSystemError.voidTests that registering an alias with an unsupported canonical AnnotationMirror throws TypeSystemError.
-
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@Targetmeta-annotation is reported rather than dereferenced as null. -
testCommandLineCanonicalIsDeclarationAnnotation
public void testCommandLineCanonicalIsDeclarationAnnotation()Tests that-AaliasedTypeAnnosnaming 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-AaliasedTypeAnnosnaming a canonical annotation that declares no@Targetis a UserError rather than a NullPointerException. -
testCommandLineAliasIsSupportedQualifier
public void testCommandLineAliasIsSupportedQualifier()Tests that-AaliasedTypeAnnosnaming an alias that is itself a supported qualifier is a UserError, not a TypeSystemError. -
testCommandLineUnsupportedCanonicalIsSkipped
public void testCommandLineUnsupportedCanonicalIsSkipped()Tests that-AaliasedTypeAnnosnaming 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.
-