Replace CodegenUtils.isDeprecated to KotlinBuiltIns.isDeprecated
This commit is contained in:
@@ -33,12 +33,12 @@ import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.calls.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.calls.VariableAsFunctionResolvedCall;
|
||||
import org.jetbrains.jet.lang.types.TypeUtils;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.codegen.CodegenUtil.isDeprecated;
|
||||
|
||||
public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
if (resolvedCall != null && resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
// Deprecated for invoke()
|
||||
JetCallExpression parent = PsiTreeUtil.getParentOfType(expression, JetCallExpression.class);
|
||||
if (parent != null && isDeprecated(resolvedCall.getResultingDescriptor())) {
|
||||
if (parent != null && KotlinBuiltIns.getInstance().isDeprecated(resolvedCall.getResultingDescriptor())) {
|
||||
reportAnnotation(parent, resolvedCall.getResultingDescriptor(), true);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
|
||||
private void checkFunctionDescriptor(JetExpression expression, DeclarationDescriptor target) {
|
||||
// Deprecated for Function
|
||||
if (isDeprecated(target)) {
|
||||
if (KotlinBuiltIns.getInstance().isDeprecated(target)) {
|
||||
reportAnnotation(expression, target, expression instanceof JetArrayAccessExpression);
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
// Deprecated for Class and for Constructor
|
||||
DeclarationDescriptor containingDeclaration = target.getContainingDeclaration();
|
||||
if (containingDeclaration != null) {
|
||||
if (isDeprecated(containingDeclaration) || isDeprecated(target)) {
|
||||
if (KotlinBuiltIns.getInstance().isDeprecated(containingDeclaration) || KotlinBuiltIns.getInstance().isDeprecated(target)) {
|
||||
reportAnnotation(expression, containingDeclaration);
|
||||
}
|
||||
}
|
||||
@@ -112,13 +112,13 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
|
||||
private void checkClassDescriptor(@NotNull JetExpression expression, @NotNull ClassDescriptor target) {
|
||||
// Deprecated for Class, for ClassObject (if reference isn't in UserType or in ModifierList (trait))
|
||||
if (isDeprecated(target)) {
|
||||
if (KotlinBuiltIns.getInstance().isDeprecated(target)) {
|
||||
reportAnnotation(expression, target);
|
||||
}
|
||||
else if (PsiTreeUtil.getParentOfType(expression, JetUserType.class) == null &&
|
||||
PsiTreeUtil.getParentOfType(expression, JetModifierList.class) == null) {
|
||||
ClassDescriptor classObjectDescriptor = target.getClassObjectDescriptor();
|
||||
if (classObjectDescriptor != null && isDeprecated(classObjectDescriptor)) {
|
||||
if (classObjectDescriptor != null && KotlinBuiltIns.getInstance().isDeprecated(classObjectDescriptor)) {
|
||||
reportAnnotation(expression, classObjectDescriptor);
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
@NotNull PropertyDescriptor propertyDescriptor
|
||||
) {
|
||||
// Deprecated for Property
|
||||
if (isDeprecated(propertyDescriptor)) {
|
||||
if (KotlinBuiltIns.getInstance().isDeprecated(propertyDescriptor)) {
|
||||
reportAnnotation(expression, propertyDescriptor, propertyDescriptor.isVar());
|
||||
return;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
@NotNull PropertyAccessorDescriptor accessor,
|
||||
@NotNull JetExpression expression, boolean isVar
|
||||
) {
|
||||
if (isDeprecated(accessor)) {
|
||||
if (KotlinBuiltIns.getInstance().isDeprecated(accessor)) {
|
||||
reportAnnotation(expression, accessor, isVar);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
private void checkDeprecatedForOperations(@NotNull JetReferenceExpression expression) {
|
||||
DeclarationDescriptor target = bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
|
||||
if (target != null) {
|
||||
if (isDeprecated(target)) {
|
||||
if (KotlinBuiltIns.getInstance().isDeprecated(target)) {
|
||||
reportAnnotation(expression, target, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user