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