BuiltIns refactoring: getEnumEntry
This commit is contained in:
@@ -385,13 +385,18 @@ public abstract class KotlinBuiltIns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ClassDescriptor getDeprecationLevelEnumEntry(@NotNull DeprecationLevel level) {
|
private static ClassDescriptor getEnumEntry(@NotNull ClassDescriptor enumDescriptor, @NotNull String entryName) {
|
||||||
ClassifierDescriptor result = getDeprecationLevelEnum().getUnsubstitutedInnerClassesScope().getContributedClassifier(
|
ClassifierDescriptor result = enumDescriptor.getUnsubstitutedInnerClassesScope().getContributedClassifier(
|
||||||
Name.identifier(level.name()), NoLookupLocation.FROM_BUILTINS
|
Name.identifier(entryName), NoLookupLocation.FROM_BUILTINS
|
||||||
);
|
);
|
||||||
return result instanceof ClassDescriptor ? (ClassDescriptor) result : null;
|
return result instanceof ClassDescriptor ? (ClassDescriptor) result : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public ClassDescriptor getDeprecationLevelEnumEntry(@NotNull DeprecationLevel level) {
|
||||||
|
return getEnumEntry(getDeprecationLevelEnum(), level.name());
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getTargetAnnotation() {
|
public ClassDescriptor getTargetAnnotation() {
|
||||||
return getAnnotationClassByName(FQ_NAMES.target.shortName());
|
return getAnnotationClassByName(FQ_NAMES.target.shortName());
|
||||||
@@ -419,10 +424,7 @@ public abstract class KotlinBuiltIns {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ClassDescriptor getAnnotationTargetEnumEntry(@NotNull KotlinTarget target) {
|
public ClassDescriptor getAnnotationTargetEnumEntry(@NotNull KotlinTarget target) {
|
||||||
ClassifierDescriptor result = getAnnotationTargetEnum().getUnsubstitutedInnerClassesScope().getContributedClassifier(
|
return getEnumEntry(getAnnotationTargetEnum(), target.name());
|
||||||
Name.identifier(target.name()), NoLookupLocation.FROM_BUILTINS
|
|
||||||
);
|
|
||||||
return result instanceof ClassDescriptor ? (ClassDescriptor) result : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -432,10 +434,7 @@ public abstract class KotlinBuiltIns {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ClassDescriptor getAnnotationRetentionEnumEntry(@NotNull KotlinRetention retention) {
|
public ClassDescriptor getAnnotationRetentionEnumEntry(@NotNull KotlinRetention retention) {
|
||||||
ClassifierDescriptor result = getAnnotationRetentionEnum().getUnsubstitutedInnerClassesScope().getContributedClassifier(
|
return getEnumEntry(getAnnotationRetentionEnum(), retention.name());
|
||||||
Name.identifier(retention.name()), NoLookupLocation.FROM_BUILTINS
|
|
||||||
);
|
|
||||||
return result instanceof ClassDescriptor ? (ClassDescriptor) result : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user