K2 JVM: implement Java modules-related checkers
All existing tests use custom test data for FIR because the diagnostic text in FIR has to have a dot at the end. Also, the K2 checker doesn't check usages in imports because there are no "import checkers" in K2 right now, this will need to be fixed later if necessary. #KT-60797 Fixed
This commit is contained in:
committed by
Space Team
parent
ac901c6d07
commit
5ca7ab9801
+2
-11
@@ -9,14 +9,5 @@ import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractFirJavaModulesIntegrationTest(jdkVersion: Int, jdkHome: File) : AbstractJavaModulesIntegrationTest(
|
||||
jdkVersion, jdkHome, maxOf(LanguageVersion.KOTLIN_2_0, LanguageVersion.LATEST_STABLE),
|
||||
) {
|
||||
override fun muteForK2(test: () -> Unit) {
|
||||
try {
|
||||
test()
|
||||
} catch (e: Throwable) {
|
||||
return
|
||||
}
|
||||
fail("Looks like this test can be unmuted. Remove the call to `muteForK2`.")
|
||||
}
|
||||
}
|
||||
jdkVersion, jdkHome, LanguageVersion.LATEST_STABLE,
|
||||
)
|
||||
|
||||
+6
-16
@@ -25,10 +25,6 @@ abstract class AbstractJavaModulesIntegrationTest(
|
||||
override val testDataPath: String
|
||||
get() = "compiler/testData/javaModules/"
|
||||
|
||||
protected open fun muteForK2(test: () -> Unit) {
|
||||
test()
|
||||
}
|
||||
|
||||
private fun module(
|
||||
name: String,
|
||||
modulePath: List<File> = emptyList(),
|
||||
@@ -120,8 +116,7 @@ abstract class AbstractJavaModulesIntegrationTest(
|
||||
module("moduleB", listOf(a))
|
||||
}
|
||||
|
||||
// TODO (KT-60797): missing JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE.
|
||||
fun testSimpleUseNonExportedPackage() = muteForK2 {
|
||||
fun testSimpleUseNonExportedPackage() {
|
||||
val a = module("moduleA")
|
||||
module("moduleB", listOf(a))
|
||||
}
|
||||
@@ -133,8 +128,7 @@ abstract class AbstractJavaModulesIntegrationTest(
|
||||
module("moduleD", listOf(a, b, c))
|
||||
}
|
||||
|
||||
// TODO (KT-60797): missing JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE.
|
||||
fun testUnnamedDependsOnNamed() = muteForK2 {
|
||||
fun testUnnamedDependsOnNamed() {
|
||||
val a = module("moduleA")
|
||||
module("moduleB", listOf(a), listOf("moduleA"))
|
||||
|
||||
@@ -174,8 +168,7 @@ abstract class AbstractJavaModulesIntegrationTest(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO (KT-60797): missing JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE.
|
||||
fun testAutomaticModuleInternalJdkPackageUsage() = muteForK2 {
|
||||
fun testAutomaticModuleInternalJdkPackageUsage() {
|
||||
module("jvmStatUsage")
|
||||
}
|
||||
|
||||
@@ -217,8 +210,7 @@ abstract class AbstractJavaModulesIntegrationTest(
|
||||
module("moduleD", listOf(c, b, a))
|
||||
}
|
||||
|
||||
// TODO (KT-60797): missing JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE.
|
||||
fun testSpecifyPathToModuleInfoInArguments() = muteForK2 {
|
||||
fun testSpecifyPathToModuleInfoInArguments() {
|
||||
val a = module("moduleA")
|
||||
|
||||
val kotlinOptions = mutableListOf(
|
||||
@@ -349,15 +341,13 @@ abstract class AbstractJavaModulesIntegrationTest(
|
||||
})
|
||||
}
|
||||
|
||||
// TODO (KT-60797): missing JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE.
|
||||
fun testNoDependencyOnNamed() = muteForK2 {
|
||||
fun testNoDependencyOnNamed() {
|
||||
// This is a test on the JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE diagnostic.
|
||||
val lib = module("lib")
|
||||
module("main", listOf(lib), listOf("lib"))
|
||||
}
|
||||
|
||||
// TODO (KT-60797): missing JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE.
|
||||
fun testNoDependencyOnUnnamed() = muteForK2 {
|
||||
fun testNoDependencyOnUnnamed() {
|
||||
// This is a test on the JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE diagnostic.
|
||||
// Most of the other tests in this class are compiling modules to jars, however here we need to compile the module to a directory.
|
||||
// The reason is twofold:
|
||||
|
||||
Reference in New Issue
Block a user