Replace CodegenUtils.isDeprecated to KotlinBuiltIns.isDeprecated

This commit is contained in:
Natalia.Ukhorskaya
2012-10-18 19:03:34 +04:00
parent 1c6b7ed1ae
commit 29ca8faa4e
5 changed files with 14 additions and 26 deletions
@@ -45,7 +45,6 @@ import java.util.Map;
import java.util.Set;
import static org.jetbrains.asm4.Opcodes.*;
import static org.jetbrains.jet.codegen.CodegenUtil.isDeprecated;
import static org.jetbrains.jet.codegen.CodegenUtil.isInterface;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isClassObject;
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.JAVA_STRING_TYPE;
@@ -155,11 +154,11 @@ public class AsmUtil {
public static int getDeprecatedAccessFlag(@NotNull MemberDescriptor descriptor) {
if (descriptor instanceof PropertyAccessorDescriptor) {
return isDeprecated(descriptor)
return KotlinBuiltIns.getInstance().isDeprecated(descriptor)
? ACC_DEPRECATED
: getDeprecatedAccessFlag(((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty());
}
else if (isDeprecated(descriptor)) {
else if (KotlinBuiltIns.getInstance().isDeprecated(descriptor)) {
return ACC_DEPRECATED;
}
return 0;
@@ -62,18 +62,6 @@ public class CodegenUtil {
return false;
}
public static boolean isDeprecated(DeclarationDescriptor descriptor) {
for (AnnotationDescriptor annotation : descriptor.getAnnotations()) {
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(annotation.getType());
if (classDescriptor != null) {
if (DescriptorUtils.getFQName(classDescriptor).getFqName().equals(CommonClassNames.JAVA_LANG_DEPRECATED)) {
return true;
}
}
}
return false;
}
public static boolean isInterface(JetType type) {
return isInterface(type.getConstructor().getDeclarationDescriptor());
}
@@ -47,6 +47,7 @@ import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
import org.jetbrains.jet.lang.resolve.java.kt.DescriptorKindUtils;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import java.util.*;
@@ -392,7 +393,7 @@ public class FunctionCodegen extends GenerationStateAware {
if (isAbstract) flags |= ACC_ABSTRACT;
if (CodegenUtil.isDeprecated(functionDescriptor)) {
if (KotlinBuiltIns.getInstance().isDeprecated(functionDescriptor)) {
flags |= ACC_DEPRECATED;
}
return flags;
@@ -148,7 +148,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (isAnnotation) {
access |= ACC_ANNOTATION;
}
if (CodegenUtil.isDeprecated(descriptor)) {
if (KotlinBuiltIns.getInstance().isDeprecated(descriptor)) {
access |= ACC_DEPRECATED;
}
if (isEnum) {