[FIR] Implement warnings for java nullability upper bound violation
This commit is contained in:
committed by
Space Team
parent
2df1e9dde6
commit
a63ec9efdc
+16
@@ -5063,6 +5063,22 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJvmErrors.UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS) { firDiagnostic ->
|
||||
UpperBoundViolatedBasedOnJavaAnnotationsImpl(
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.b),
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJvmErrors.UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION_BASED_ON_JAVA_ANNOTATIONS) { firDiagnostic ->
|
||||
UpperBoundViolatedInTypealiasExpansionBasedOnJavaAnnotationsImpl(
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.b),
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJvmErrors.STRICTFP_ON_CLASS) { firDiagnostic ->
|
||||
StrictfpOnClassImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
|
||||
+12
@@ -3523,6 +3523,18 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = UpperBoundCannotBeArray::class
|
||||
}
|
||||
|
||||
interface UpperBoundViolatedBasedOnJavaAnnotations : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = UpperBoundViolatedBasedOnJavaAnnotations::class
|
||||
val expectedUpperBound: KtType
|
||||
val actualUpperBound: KtType
|
||||
}
|
||||
|
||||
interface UpperBoundViolatedInTypealiasExpansionBasedOnJavaAnnotations : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = UpperBoundViolatedInTypealiasExpansionBasedOnJavaAnnotations::class
|
||||
val expectedUpperBound: KtType
|
||||
val actualUpperBound: KtType
|
||||
}
|
||||
|
||||
interface StrictfpOnClass : KtFirDiagnostic<KtAnnotationEntry> {
|
||||
override val diagnosticClass get() = StrictfpOnClass::class
|
||||
}
|
||||
|
||||
+14
@@ -4250,6 +4250,20 @@ internal class UpperBoundCannotBeArrayImpl(
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.UpperBoundCannotBeArray
|
||||
|
||||
internal class UpperBoundViolatedBasedOnJavaAnnotationsImpl(
|
||||
override val expectedUpperBound: KtType,
|
||||
override val actualUpperBound: KtType,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.UpperBoundViolatedBasedOnJavaAnnotations
|
||||
|
||||
internal class UpperBoundViolatedInTypealiasExpansionBasedOnJavaAnnotationsImpl(
|
||||
override val expectedUpperBound: KtType,
|
||||
override val actualUpperBound: KtType,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.UpperBoundViolatedInTypealiasExpansionBasedOnJavaAnnotations
|
||||
|
||||
internal class StrictfpOnClassImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
|
||||
Reference in New Issue
Block a user