Don't perform additional lookups for DeprecatedSinceKotlin annotation
There is no need to check it as `DeprecatedSinceKotlin` can be used only along with `Deprecated` annotation
This commit is contained in:
@@ -370,7 +370,7 @@ internal fun KtModifierListOwner.isDeprecated(support: KtUltraLightSupport? = nu
|
|||||||
|
|
||||||
val fqName = toQualifiedName(typeElement) ?: continue
|
val fqName = toQualifiedName(typeElement) ?: continue
|
||||||
|
|
||||||
if (fqName == deprecatedFqName || fqName == KotlinBuiltIns.FQ_NAMES.deprecatedSinceKotlin) return true
|
if (fqName == deprecatedFqName) return true
|
||||||
if (fqName.asString() == deprecatedName) return true
|
if (fqName.asString() == deprecatedName) return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,8 +178,7 @@ public class KtPsiUtil {
|
|||||||
List<KtAnnotationEntry> annotationEntries = modifierList.getAnnotationEntries();
|
List<KtAnnotationEntry> annotationEntries = modifierList.getAnnotationEntries();
|
||||||
for (KtAnnotationEntry annotation : annotationEntries) {
|
for (KtAnnotationEntry annotation : annotationEntries) {
|
||||||
Name shortName = annotation.getShortName();
|
Name shortName = annotation.getShortName();
|
||||||
if (KotlinBuiltIns.FQ_NAMES.deprecated.shortName().equals(shortName) ||
|
if (KotlinBuiltIns.FQ_NAMES.deprecated.shortName().equals(shortName)) {
|
||||||
KotlinBuiltIns.FQ_NAMES.deprecatedSinceKotlin.shortName().equals(shortName)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1117,7 +1117,6 @@ public abstract class KotlinBuiltIns {
|
|||||||
return classFqNameEquals(descriptor, FQ_NAMES.cloneable);
|
return classFqNameEquals(descriptor, FQ_NAMES.cloneable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: support DeprecatedSinceKotlin
|
|
||||||
public static boolean isDeprecated(@NotNull DeclarationDescriptor declarationDescriptor) {
|
public static boolean isDeprecated(@NotNull DeclarationDescriptor declarationDescriptor) {
|
||||||
if (declarationDescriptor.getOriginal().getAnnotations().hasAnnotation(FQ_NAMES.deprecated)) return true;
|
if (declarationDescriptor.getOriginal().getAnnotations().hasAnnotation(FQ_NAMES.deprecated)) return true;
|
||||||
|
|
||||||
|
|||||||
-1
@@ -103,7 +103,6 @@ class DeprecatedCallableAddReplaceWithInspection : AbstractApplicabilityBasedIns
|
|||||||
|
|
||||||
private fun KtCallableDeclaration.deprecatedAnnotationWithNoReplaceWith(): KtAnnotationEntry? {
|
private fun KtCallableDeclaration.deprecatedAnnotationWithNoReplaceWith(): KtAnnotationEntry? {
|
||||||
for (entry in annotationEntries) {
|
for (entry in annotationEntries) {
|
||||||
// TODO: support DeprecatedSinceKotlin here
|
|
||||||
if (entry.shortName != DEPRECATED_NAME) continue
|
if (entry.shortName != DEPRECATED_NAME) continue
|
||||||
val bindingContext = entry.analyze()
|
val bindingContext = entry.analyze()
|
||||||
val resolvedCall = entry.calleeExpression.getResolvedCall(bindingContext) ?: continue
|
val resolvedCall = entry.calleeExpression.getResolvedCall(bindingContext) ?: continue
|
||||||
|
|||||||
-1
@@ -79,7 +79,6 @@ abstract class DeprecatedSymbolUsageFixBase(
|
|||||||
contextElement: KtSimpleNameExpression?,
|
contextElement: KtSimpleNameExpression?,
|
||||||
replaceInWholeProject: Boolean
|
replaceInWholeProject: Boolean
|
||||||
): ReplaceWith? {
|
): ReplaceWith? {
|
||||||
// TODO: support DeprecatedSinceKotlin
|
|
||||||
val annotation = descriptor.annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecated) ?: return null
|
val annotation = descriptor.annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecated) ?: return null
|
||||||
val replaceWithValue =
|
val replaceWithValue =
|
||||||
annotation.argumentValue(Deprecated::replaceWith.name)?.safeAs<AnnotationValue>()?.value ?: return null
|
annotation.argumentValue(Deprecated::replaceWith.name)?.safeAs<AnnotationValue>()?.value ?: return null
|
||||||
|
|||||||
Reference in New Issue
Block a user