Extract some classes from descriptors module to :core:common

This is needed to remove dependencies from fir modules to
  `:core:descriptors` module

What was extracted:
- Modality
- ClassKind
- org.jetbrains.kotlin.name package
This commit is contained in:
Dmitriy Novozhilov
2020-08-14 16:05:28 +03:00
parent 41ba9b0a2d
commit 9d9f9c52c0
21 changed files with 66 additions and 29 deletions
+24
View File
@@ -0,0 +1,24 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
jvmTarget = "1.6"
javaHome = rootProject.extra["JDK_16"] as String
dependencies {
compile(project(":core:util.runtime"))
compile(project(":core:type-system"))
compile(kotlinStdlib())
compile(project(":kotlin-annotations-jvm"))
}
sourceSets {
"main" { projectDefault() }
"test" {}
}
tasks.withType<JavaCompile> {
sourceCompatibility = "1.6"
targetCompatibility = "1.6"
}
@@ -0,0 +1,26 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.descriptors
// For sealed classes, isOverridable is false but isOverridableByMembers is true
enum class Modality {
// THE ORDER OF ENTRIES MATTERS HERE
FINAL,
// NB: class can be sealed but not function or property
SEALED,
OPEN,
ABSTRACT;
companion object {
// NB: never returns SEALED
fun convertFromFlags(abstract: Boolean, open: Boolean): Modality {
if (abstract) return ABSTRACT
if (open) return OPEN
return FINAL
}
}
}
+1
View File
@@ -7,6 +7,7 @@ jvmTarget = "1.6"
javaHome = rootProject.extra["JDK_16"] as String
dependencies {
compile(project(":core:descriptors.common"))
compile(project(":core:util.runtime"))
compile(project(":core:type-system"))
compile(kotlinStdlib())
@@ -18,26 +18,6 @@ package org.jetbrains.kotlin.descriptors
import org.jetbrains.kotlin.resolve.DescriptorUtils
// For sealed classes, isOverridable is false but isOverridableByMembers is true
enum class Modality {
// THE ORDER OF ENTRIES MATTERS HERE
FINAL,
// NB: class can be sealed but not function or property
SEALED,
OPEN,
ABSTRACT;
companion object {
// NB: never returns SEALED
fun convertFromFlags(abstract: Boolean, open: Boolean): Modality {
if (abstract) return ABSTRACT
if (open) return OPEN
return FINAL
}
}
}
val CallableMemberDescriptor.isOverridable: Boolean
get() = visibility != Visibilities.PRIVATE
&& modality != Modality.FINAL
@@ -58,7 +58,7 @@ public abstract class AbstractClassTypeConstructor extends AbstractTypeConstruct
@Override
public final boolean isFinal() {
ClassDescriptor descriptor = getDeclarationDescriptor();
return ModalityKt.isFinalClass(descriptor) && !descriptor.isExpect();
return ModalityUtilsKt.isFinalClass(descriptor) && !descriptor.isExpect();
}
@NotNull