- switched from the privileged 'isObjectType()' interface to querying the root type.
	- also made other overload of getLeastCommonSuperclass() language-based.


git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3680 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
omertripp 2009-06-12 19:07:59 +00:00
parent cf0a8ce430
commit 680dd54c1b
3 changed files with 8 additions and 9 deletions

View File

@ -589,11 +589,6 @@ public class JavaLanguage extends LanguageImpl implements BytecodeLanguage, Cons
return type == TypeReference.JavaLangClass;
}
public boolean isObjectType(TypeReference type) {
return type == TypeReference.JavaLangObject;
}
public boolean isStringType(TypeReference type) {
return type == TypeReference.JavaLangString;
}

View File

@ -90,6 +90,4 @@ public interface Language {
TypeReference getPointerType(TypeReference pointee);
PrimitiveType getPrimitive(TypeReference reference);
boolean isObjectType(TypeReference reference);
}

View File

@ -725,7 +725,7 @@ public class ClassHierarchy implements IClassHierarchy {
return B;
} else if (B.getReference().equals(TypeReference.Null)) {
return A;
} else if (lang.isObjectType(B.getReference())) {
} else if (B.getReference().equals(lang.getRootType())) {
return B;
} else {
Node n = map.get(B);
@ -770,7 +770,13 @@ public class ClassHierarchy implements IClassHierarchy {
IClass BClass = lookupClass(B);
if (AClass == null || BClass == null) {
// One of the classes is not in scope. Give up.
return TypeReference.JavaLangObject;
if (AClass != null) {
return AClass.getClassLoader().getLanguage().getRootType();
} else if (BClass != null) {
return BClass.getClassLoader().getLanguage().getRootType();
} else {
return getRootClass().getReference();
}
}
return getLeastCommonSuperclass(AClass, BClass).getReference();
}