java-callgraph

Fix: ConstantMethodref only is too narrow. Generalize from

10/22/2018 5:49:33 PM

Details

diff --git a/src/main/java/gr/gousiosg/javacg/stat/DynamicCallManager.java b/src/main/java/gr/gousiosg/javacg/stat/DynamicCallManager.java
index 5d1275c..ef46a3b 100644
--- a/src/main/java/gr/gousiosg/javacg/stat/DynamicCallManager.java
+++ b/src/main/java/gr/gousiosg/javacg/stat/DynamicCallManager.java
@@ -8,8 +8,8 @@ import java.util.regex.Pattern;
 import org.apache.bcel.classfile.Attribute;
 import org.apache.bcel.classfile.BootstrapMethod;
 import org.apache.bcel.classfile.BootstrapMethods;
+import org.apache.bcel.classfile.ConstantCP;
 import org.apache.bcel.classfile.ConstantMethodHandle;
-import org.apache.bcel.classfile.ConstantMethodref;
 import org.apache.bcel.classfile.ConstantNameAndType;
 import org.apache.bcel.classfile.ConstantPool;
 import org.apache.bcel.classfile.ConstantUtf8;
@@ -80,7 +80,7 @@ public class DynamicCallManager {
 
     private String getMethodNameFromHandleIndex(ConstantPool cp, int callIndex) {
         ConstantMethodHandle handle = (ConstantMethodHandle) cp.getConstant(callIndex);
-        ConstantMethodref ref = (ConstantMethodref) cp.getConstant(handle.getReferenceIndex());
+        ConstantCP ref = (ConstantCP) cp.getConstant(handle.getReferenceIndex());
         ConstantNameAndType nameAndType = (ConstantNameAndType) cp.getConstant(ref.getNameAndTypeIndex());
         return nameAndType.getName(cp);
     }