Minor, use String instead of DeprecationLevel
Using classes from runtime in the compiler is confusing and doesn't allow to incompatibly change them
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.builtins;
|
||||
|
||||
import kotlin.DeprecationLevel;
|
||||
import kotlin.SetsKt;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -393,8 +392,8 @@ public abstract class KotlinBuiltIns {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ClassDescriptor getDeprecationLevelEnumEntry(@NotNull DeprecationLevel level) {
|
||||
return getEnumEntry(getDeprecationLevelEnum(), level.name());
|
||||
public ClassDescriptor getDeprecationLevelEnumEntry(@NotNull String level) {
|
||||
return getEnumEntry(getDeprecationLevelEnum(), level);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.types.Variance
|
||||
public fun KotlinBuiltIns.createDeprecatedAnnotation(
|
||||
message: String,
|
||||
replaceWith: String,
|
||||
level: DeprecationLevel = DeprecationLevel.WARNING
|
||||
level: String = "WARNING"
|
||||
): AnnotationDescriptor {
|
||||
val deprecatedAnnotation = deprecatedAnnotation
|
||||
val parameters = deprecatedAnnotation.unsubstitutedPrimaryConstructor!!.valueParameters
|
||||
@@ -52,7 +52,7 @@ public fun KotlinBuiltIns.createDeprecatedAnnotation(
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
),
|
||||
parameters["level"] to EnumValue(getDeprecationLevelEnumEntry(level)!!)
|
||||
parameters["level"] to EnumValue(getDeprecationLevelEnumEntry(level) ?: error("Deprecation level $level not found"))
|
||||
),
|
||||
SourceElement.NO_SOURCE)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve;
|
||||
|
||||
import kotlin.DeprecationLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
@@ -133,11 +132,9 @@ public class DescriptorFactory {
|
||||
|
||||
@NotNull
|
||||
public static PropertyDescriptor createEnumValuesProperty(@NotNull ClassDescriptor enumClass) {
|
||||
AnnotationsImpl annotations = AnnotationsImpl.createWithNoTarget(
|
||||
AnnotationUtilKt.createDeprecatedAnnotation(getBuiltIns(enumClass),
|
||||
"Use 'values()' function instead", "this.values()",
|
||||
DeprecationLevel.ERROR)
|
||||
);
|
||||
AnnotationsImpl annotations = AnnotationsImpl.createWithNoTarget(AnnotationUtilKt.createDeprecatedAnnotation(
|
||||
getBuiltIns(enumClass), "Use 'values()' function instead", "this.values()", "ERROR"
|
||||
));
|
||||
|
||||
PropertyDescriptorImpl values =
|
||||
PropertyDescriptorImpl.create(
|
||||
|
||||
Reference in New Issue
Block a user