From 4da002f47cc7ccd354127780aac7652ce2cd68fa Mon Sep 17 00:00:00 2001 From: dolby-oss Date: Mon, 30 Jun 2008 14:07:35 +0000 Subject: [PATCH] adapt to different notions of exception types for different languages git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2931 f5eafffb-2e1d-0410-98e4-8ec43c5233c4 --- .../src/com/ibm/wala/classLoader/Language.java | 6 ++++++ .../propagation/SSAPropagationCallGraphBuilder.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/com.ibm.wala.core/src/com/ibm/wala/classLoader/Language.java b/com.ibm.wala.core/src/com/ibm/wala/classLoader/Language.java index 284a8cd61..64d278caf 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/classLoader/Language.java +++ b/com.ibm.wala.core/src/com/ibm/wala/classLoader/Language.java @@ -17,6 +17,10 @@ public interface Language { return TypeReference.JavaLangObject; } + public TypeReference getThrowableType() { + return TypeReference.JavaLangThrowable; + } + public TypeReference getConstantType(Object o) { if (o instanceof String) { return TypeReference.JavaLangString; @@ -43,6 +47,8 @@ public interface Language { TypeReference getRootType(); + TypeReference getThrowableType(); + TypeReference getConstantType(Object o); boolean isNullType(TypeReference type); diff --git a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java index 2371edb45..7c04254f6 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java +++ b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java @@ -334,7 +334,9 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap List peis = getIncomingPEIs(ir, ir.getExitBlock()); PointerKey exception = getPointerKeyForExceptionalReturnValue(node); - IClass c = node.getClassHierarchy().lookupClass(TypeReference.JavaLangThrowable); + TypeReference throwableType = + node.getMethod().getDeclaringClass().getClassLoader().getLanguage().getThrowableType(); + IClass c = node.getClassHierarchy().lookupClass(throwableType); addExceptionDefConstraints(ir, du, node, peis, exception, Collections.singleton(c)); }