Add Java8 foreign-annotations tests without jsr305.jar in the classpath

Some of them are expected to fail since neither IntelliJ class reading
nor our fast class reading can read annotations on type arguments
This commit is contained in:
Denis Zharkov
2017-09-11 13:13:18 +03:00
parent 58a0ca61a9
commit fd9025a4fb
13 changed files with 399 additions and 1 deletions
@@ -16,7 +16,36 @@
package org.jetbrains.kotlin.checkers
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import java.io.File
abstract class AbstractForeignJava8AnnotationsTest : AbstractForeignAnnotationsTest() {
override val annotationsPath: String
get() = "third-party/jdk8-annotations"
get() = JAVA8_ANNOTATION_SOURCES_PATH
}
abstract class AbstractForeignJava8AnnotationsNoAnnotationInClasspathTest : AbstractForeignAnnotationsNoAnnotationInClasspathTest() {
override val annotationsPath: String
get() = JAVA8_ANNOTATION_SOURCES_PATH
override fun analyzeAndCheck(testDataFile: File, files: List<TestFile>) {
if (skipForCompiledVersion(files)) return
super.analyzeAndCheck(testDataFile, files)
}
}
abstract class AbstractForeignJava8AnnotationsNoAnnotationInClasspathWithFastClassReadingTest : AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest() {
override val annotationsPath: String
get() = JAVA8_ANNOTATION_SOURCES_PATH
override fun analyzeAndCheck(testDataFile: File, files: List<TestFile>) {
if (skipForCompiledVersion(files)) return
super.analyzeAndCheck(testDataFile, files)
}
}
private fun skipForCompiledVersion(files: List<BaseDiagnosticsTest.TestFile>) =
files.any { file -> InTextDirectivesUtils.isDirectiveDefined(file.expectedText, "// SKIP_COMPILED_JAVA") }
private const val JAVA8_ANNOTATION_SOURCES_PATH = "third-party/jdk8-annotations"