JVM: refactor JvmDefaultMode, remove/rename some entries

- remove ENABLE/COMPATIBILITY because they can no longer be used
- remove forAllMethodsWithBody because its behavior is now equivalent to
  isEnabled
- inline isCompatibility
- inline DEFAULT
- rename ALL_INCOMPATIBLE -> ALL
This commit is contained in:
Alexander Udalov
2024-02-01 13:22:48 +01:00
committed by Space Team
parent 6219806ab9
commit 28797a31b4
22 changed files with 58 additions and 85 deletions
@@ -24,7 +24,7 @@ fun <D> FirBasedSymbol<out D>.isCompiledToJvmDefault(
if (getAnnotationByClassId(JvmStandardClassIds.Annotations.JvmDefault, session) != null) return true
val container = getContainingClassSymbol(session)
if (container !is FirRegularClassSymbol || container.origin.fromSource) return jvmDefaultMode.forAllMethodsWithBody
if (container !is FirRegularClassSymbol || container.origin.fromSource) return jvmDefaultMode.isEnabled
// Opt-in is fine here because this flag is only possible for deserialized declarations, and it's set during deserialization.
@OptIn(SymbolInternals::class)
@@ -36,7 +36,7 @@ object FirJvmDefaultChecker : FirBasicDeclarationChecker(MppCheckerKind.Common)
if (annotationWithCompatibility != null) {
val source = annotationWithCompatibility.source
when {
jvmDefaultMode != JvmDefaultMode.ALL_INCOMPATIBLE -> {
jvmDefaultMode != JvmDefaultMode.ALL -> {
reporter.reportOn(source, FirJvmErrors.JVM_DEFAULT_WITH_COMPATIBILITY_IN_DECLARATION, context)
return
}