use shared constants

This commit is contained in:
Stepan Koltsov
2012-06-17 00:27:19 +04:00
parent 1ce24b10cc
commit 9d781640af
@@ -598,12 +598,10 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
} }
private static final FqName JL_OBJECT = new FqName("java.lang.Object");
private boolean isJavaLangObject(JetType type) { private boolean isJavaLangObject(JetType type) {
ClassifierDescriptor classifierDescriptor = type.getConstructor().getDeclarationDescriptor(); ClassifierDescriptor classifierDescriptor = type.getConstructor().getDeclarationDescriptor();
return classifierDescriptor instanceof ClassDescriptor && return classifierDescriptor instanceof ClassDescriptor &&
DescriptorUtils.getFQName(classifierDescriptor).equalsTo(JL_OBJECT); DescriptorUtils.getFQName(classifierDescriptor).equalsTo(JdkNames.JL_OBJECT.getFqName());
} }
@@ -877,7 +875,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
if (result.isEmpty()) { if (result.isEmpty()) {
if (classData.kotlin if (classData.kotlin
|| psiClass.getQualifiedName().equals(JdkNames.JL_OBJECT.getFqName().getFqName()) || JdkNames.JL_OBJECT.getFqName().equalsTo(psiClass.getQualifiedName())
// TODO: annotations // TODO: annotations
|| classDescriptor.getKind() == ClassKind.ANNOTATION_CLASS) { || classDescriptor.getKind() == ClassKind.ANNOTATION_CLASS) {
result.add(JetStandardClasses.getAnyType()); result.add(JetStandardClasses.getAnyType());
@@ -898,7 +896,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
private void transformSupertypeList(List<JetType> result, PsiClassType[] extendsListTypes, TypeVariableResolver typeVariableResolver, boolean annotation) { private void transformSupertypeList(List<JetType> result, PsiClassType[] extendsListTypes, TypeVariableResolver typeVariableResolver, boolean annotation) {
for (PsiClassType type : extendsListTypes) { for (PsiClassType type : extendsListTypes) {
PsiClass resolved = type.resolve(); PsiClass resolved = type.resolve();
if (resolved != null && resolved.getQualifiedName().equals(JvmStdlibNames.JET_OBJECT.getFqName().getFqName())) { if (resolved != null && JvmStdlibNames.JET_OBJECT.getFqName().equalsTo(resolved.getQualifiedName())) {
continue; continue;
} }
if (resolved != null && annotation && resolved.getQualifiedName().equals("java.lang.annotation.Annotation")) { if (resolved != null && annotation && resolved.getQualifiedName().equals("java.lang.annotation.Annotation")) {
@@ -1575,7 +1573,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
if (scopeData.kotlin) { if (scopeData.kotlin) {
// TODO: unless maybe class explicitly extends Object // TODO: unless maybe class explicitly extends Object
String ownerClassName = method.getPsiMethod().getContainingClass().getQualifiedName(); String ownerClassName = method.getPsiMethod().getContainingClass().getQualifiedName();
if (ownerClassName.equals("java.lang.Object")) { if (JdkNames.JL_OBJECT.getFqName().getFqName().equals(ownerClassName)) {
return null; return null;
} }
} }