/** * Determine whether the given INVOKESTATIC instruction is an inner-class * field accessor method. * * @param inv * the INVOKESTATIC instruction * @param cpg * the ConstantPoolGen for the method * @return true if the instruction is an inner-class field accessor, false * if not */ public static boolean isInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) { String methodName = inv.getName(cpg); return methodName.startsWith("access$"); }
@Override public void visitINVOKESTATIC(INVOKESTATIC ins) { // Find calls to System.exit(), since this effectively terminates the // basic block. String className = ins.getClassName(constPoolGen); String methodName = ins.getName(constPoolGen); String methodSig = ins.getSignature(constPoolGen); if ("java.lang.System".equals(className) && "exit".equals(methodName) && "(I)V".equals(methodSig)) { isExit = true; } }
/** * Get the InnerClassAccess for access method called by given INVOKESTATIC. * * @param inv * the INVOKESTATIC instruction * @param cpg * the ConstantPoolGen for the method * @return the InnerClassAccess, or null if the instruction is not an * inner-class access */ public static InnerClassAccess getInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) throws ClassNotFoundException { String className = inv.getClassName(cpg); String methodName = inv.getName(cpg); String methodSig = inv.getSignature(cpg); InnerClassAccess access = AnalysisContext.currentAnalysisContext().getInnerClassAccessMap() .getInnerClassAccess(className, methodName); return (access != null && access.getMethodSignature().equals(methodSig)) ? access : null; }
ConstantPoolGen cpg = getCPG(); String targetClassName = obj.getClassName(cpg); String methodName = obj.getName(cpg); String methodSig = obj.getSignature(cpg);
/** * Determine whether the given INVOKESTATIC instruction is an inner-class * field accessor method. * * @param inv * the INVOKESTATIC instruction * @param cpg * the ConstantPoolGen for the method * @return true if the instruction is an inner-class field accessor, false * if not */ public static boolean isInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) { String methodName = inv.getName(cpg); return methodName.startsWith("access$"); }
@Override public void visitINVOKESTATIC(INVOKESTATIC ins) { // Find calls to System.exit(), since this effectively terminates the // basic block. String className = ins.getClassName(constPoolGen); String methodName = ins.getName(constPoolGen); String methodSig = ins.getSignature(constPoolGen); if ("java.lang.System".equals(className) && "exit".equals(methodName) && "(I)V".equals(methodSig)) { isExit = true; } }
/** * Get the InnerClassAccess for access method called by given INVOKESTATIC. * * @param inv * the INVOKESTATIC instruction * @param cpg * the ConstantPoolGen for the method * @return the InnerClassAccess, or null if the instruction is not an * inner-class access */ public static InnerClassAccess getInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) throws ClassNotFoundException { String className = inv.getClassName(cpg); String methodName = inv.getName(cpg); String methodSig = inv.getSignature(cpg); InnerClassAccess access = AnalysisContext.currentAnalysisContext().getInnerClassAccessMap() .getInnerClassAccess(className, methodName); return (access != null && access.getMethodSignature().equals(methodSig)) ? access : null; }
ConstantPoolGen cpg = getCPG(); String targetClassName = obj.getClassName(cpg); String methodName = obj.getName(cpg); String methodSig = obj.getSignature(cpg);