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
+21
@@ -5390,6 +5390,27 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJvmErrors.JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE) { firDiagnostic ->
|
||||
JavaModuleDoesNotDependOnModuleImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJvmErrors.JAVA_MODULE_DOES_NOT_READ_UNNAMED_MODULE) { firDiagnostic ->
|
||||
JavaModuleDoesNotReadUnnamedModuleImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJvmErrors.JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE) { firDiagnostic ->
|
||||
JavaModuleDoesNotExportPackageImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic.b,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJvmErrors.JVM_DEFAULT_IN_DECLARATION) { firDiagnostic ->
|
||||
JvmDefaultInDeclarationImpl(
|
||||
firDiagnostic.a,
|
||||
|
||||
+15
@@ -3751,6 +3751,21 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = IllegalJavaLangRecordSupertype::class
|
||||
}
|
||||
|
||||
interface JavaModuleDoesNotDependOnModule : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = JavaModuleDoesNotDependOnModule::class
|
||||
val moduleName: String
|
||||
}
|
||||
|
||||
interface JavaModuleDoesNotReadUnnamedModule : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = JavaModuleDoesNotReadUnnamedModule::class
|
||||
}
|
||||
|
||||
interface JavaModuleDoesNotExportPackage : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = JavaModuleDoesNotExportPackage::class
|
||||
val moduleName: String
|
||||
val packageName: String
|
||||
}
|
||||
|
||||
interface JvmDefaultInDeclaration : KtFirDiagnostic<KtElement> {
|
||||
override val diagnosticClass get() = JvmDefaultInDeclaration::class
|
||||
val annotation: String
|
||||
|
||||
+18
@@ -4528,6 +4528,24 @@ internal class IllegalJavaLangRecordSupertypeImpl(
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.IllegalJavaLangRecordSupertype
|
||||
|
||||
internal class JavaModuleDoesNotDependOnModuleImpl(
|
||||
override val moduleName: String,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.JavaModuleDoesNotDependOnModule
|
||||
|
||||
internal class JavaModuleDoesNotReadUnnamedModuleImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.JavaModuleDoesNotReadUnnamedModule
|
||||
|
||||
internal class JavaModuleDoesNotExportPackageImpl(
|
||||
override val moduleName: String,
|
||||
override val packageName: String,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.JavaModuleDoesNotExportPackage
|
||||
|
||||
internal class JvmDefaultInDeclarationImpl(
|
||||
override val annotation: String,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
|
||||
Reference in New Issue
Block a user