[FIR] Remove the TODO in FirJvmAnnotationHelper.kt
This code should not be reachable when not in JVM. `jvmDefaultModeState` is only accessed from the JVM checkers.
This commit is contained in:
committed by
Space Team
parent
8541143d6f
commit
a9207a8396
+2
-5
@@ -15,12 +15,9 @@ import org.jetbrains.kotlin.name.StandardClassIds
|
||||
|
||||
fun <D> FirBasedSymbol<out D>.isCompiledToJvmDefault(
|
||||
session: FirSession,
|
||||
jvmDefaultMode: JvmDefaultMode?
|
||||
jvmDefaultMode: JvmDefaultMode
|
||||
): Boolean where D : FirAnnotationContainer, D : FirDeclaration {
|
||||
if (getAnnotationByClassId(StandardClassIds.Annotations.JvmDefault, session) != null) return true
|
||||
|
||||
// jvmDefaultMode is null only on common metadata compilation
|
||||
// TODO: it's unclear what should be returned here if jvmDefaultMode is null, KT-57079
|
||||
return jvmDefaultMode?.forAllMethodsWithBody ?: true
|
||||
return jvmDefaultMode.forAllMethodsWithBody
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ object FirJvmDefaultChecker : FirBasicDeclarationChecker() {
|
||||
val annotationNoCompatibility = declaration.getAnnotationByClassId(JVM_DEFAULT_NO_COMPATIBILITY_CLASS_ID, session)
|
||||
if (annotationNoCompatibility != null) {
|
||||
val source = annotationNoCompatibility.source
|
||||
if (jvmDefaultMode?.isEnabled != true) {
|
||||
if (!jvmDefaultMode.isEnabled) {
|
||||
reporter.reportOn(source, FirJvmErrors.JVM_DEFAULT_IN_DECLARATION, "JvmDefaultWithoutCompatibility", context)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.fir.FirSessionComponent
|
||||
|
||||
class FirJvmDefaultModeComponent(val jvmDefaultMode: JvmDefaultMode) : FirSessionComponent
|
||||
|
||||
private val FirSession.jvmDefaultModeComponent: FirJvmDefaultModeComponent? by FirSession.nullableSessionComponentAccessor()
|
||||
private val FirSession.jvmDefaultModeComponent: FirJvmDefaultModeComponent by FirSession.sessionComponentAccessor()
|
||||
|
||||
val FirSession.jvmDefaultModeState: JvmDefaultMode?
|
||||
get() = jvmDefaultModeComponent?.jvmDefaultMode
|
||||
val FirSession.jvmDefaultModeState: JvmDefaultMode
|
||||
get() = jvmDefaultModeComponent.jvmDefaultMode
|
||||
|
||||
Reference in New Issue
Block a user