/** * looks for methods that contain a checkcast instruction * * @param method * the context object of the current method * @return if the class does checkcast instructions */ private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Constants.CHECKCAST)); }
/** * implements the visitor to see if this method is equals(Object o) * * @param obj * the context object of the currently parsed code block */ @Override public void visitCode(Code obj) { Method m = getMethod(); String name = m.getName(); String signature = m.getSignature(); if ("equals".equals(name) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(signature) && prescreen(m)) { stack.resetForMethodEntry(this); super.visitCode(obj); } }
OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 1) { String thisCls = getClassName(); String equalsCls = getClassConstantOperand(); if (!thisCls.equals(equalsCls)) { JavaClass thisJavaClass = getClassContext().getJavaClass(); JavaClass equalsJavaClass = Repository.lookupClass(equalsCls); boolean inheritance = thisJavaClass.instanceOf(equalsJavaClass) || equalsJavaClass.instanceOf(thisJavaClass);
OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 1) { String thisCls = getClassName(); String equalsCls = getClassConstantOperand(); if (!thisCls.equals(equalsCls)) { JavaClass thisJavaClass = getClassContext().getJavaClass(); JavaClass equalsJavaClass = Repository.lookupClass(equalsCls); boolean inheritance = thisJavaClass.instanceOf(equalsJavaClass) || equalsJavaClass.instanceOf(thisJavaClass);
/** * implements the visitor to see if this method is equals(Object o) * * @param obj * the context object of the currently parsed code block */ @Override public void visitCode(Code obj) { Method m = getMethod(); String name = m.getName(); String signature = m.getSignature(); if ("equals".equals(name) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(signature) && prescreen(m)) { stack.resetForMethodEntry(this); super.visitCode(obj); } }
/** * looks for methods that contain a checkcast instruction * * @param method * the context object of the current method * @return if the class does checkcast instructions */ private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.CHECKCAST)); }