Ignore built-in type qualifier defaults when Jsr305State=IGNORE
This commit is contained in:
@@ -29,6 +29,7 @@ val TEST_ANNOTATIONS_SOURCE_PATH = "compiler/testData/foreignAnnotations/testAnn
|
||||
|
||||
abstract class AbstractForeignAnnotationsTest : AbstractDiagnosticsTest() {
|
||||
private val WARNING_FOR_JSR305_ANNOTATIONS_DIRECTIVE = "WARNING_FOR_JSR305_ANNOTATIONS"
|
||||
private val JSR305_ANNOTATIONS_IGNORE_DIRECTIVE = "JSR305_ANNOTATIONS_IGNORE"
|
||||
|
||||
override fun getExtraClasspath(): List<File> {
|
||||
val foreignAnnotations = listOf(MockLibraryUtil.compileJvmLibraryToJar(annotationsPath, "foreign-annotations"))
|
||||
@@ -54,7 +55,16 @@ abstract class AbstractForeignAnnotationsTest : AbstractDiagnosticsTest() {
|
||||
InTextDirectivesUtils.isDirectiveDefined(it.expectedText, WARNING_FOR_JSR305_ANNOTATIONS_DIRECTIVE)
|
||||
}
|
||||
|
||||
val jsr305State = if (hasWarningDirective) Jsr305State.WARN else Jsr305State.STRICT
|
||||
val hasIgnoreDirective = module.any {
|
||||
InTextDirectivesUtils.isDirectiveDefined(it.expectedText, JSR305_ANNOTATIONS_IGNORE_DIRECTIVE)
|
||||
}
|
||||
|
||||
val jsr305State = when {
|
||||
hasIgnoreDirective -> Jsr305State.IGNORE
|
||||
hasWarningDirective -> Jsr305State.WARN
|
||||
else -> Jsr305State.STRICT
|
||||
}
|
||||
|
||||
return LanguageVersionSettingsImpl(LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE,
|
||||
mapOf(AnalysisFlag.jsr305 to jsr305State)
|
||||
)
|
||||
|
||||
+15
@@ -90,6 +90,21 @@ public class ForeignAnnotationsNoAnnotationInClasspathTestGenerated extends Abst
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Jsr305Ignore extends AbstractForeignAnnotationsNoAnnotationInClasspathTest {
|
||||
public void testAllFilesPresentInJsr305Ignore() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305Ignore"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("parametersAreNonnullByDefault.kt")
|
||||
public void testParametersAreNonnullByDefault() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore/parametersAreNonnullByDefault.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+15
@@ -90,6 +90,21 @@ public class ForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTestGe
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Jsr305Ignore extends AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest {
|
||||
public void testAllFilesPresentInJsr305Ignore() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305Ignore"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("parametersAreNonnullByDefault.kt")
|
||||
public void testParametersAreNonnullByDefault() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore/parametersAreNonnullByDefault.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -90,6 +90,21 @@ public class ForeignAnnotationsTestGenerated extends AbstractForeignAnnotationsT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Jsr305Ignore extends AbstractForeignAnnotationsTest {
|
||||
public void testAllFilesPresentInJsr305Ignore() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305Ignore"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("parametersAreNonnullByDefault.kt")
|
||||
public void testParametersAreNonnullByDefault() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore/parametersAreNonnullByDefault.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+15
@@ -90,6 +90,21 @@ public class JavacForeignAnnotationsTestGenerated extends AbstractJavacForeignAn
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Jsr305Ignore extends AbstractJavacForeignAnnotationsTest {
|
||||
public void testAllFilesPresentInJsr305Ignore() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/jsr305Ignore"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("parametersAreNonnullByDefault.kt")
|
||||
public void testParametersAreNonnullByDefault() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Ignore/parametersAreNonnullByDefault.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityWarnings")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user