private void removeFromCollectionGroup(OpcodeStack.Item itm) { Comparable<?> groupElement = getGroupElement(itm); if (groupElement != null) { for (GroupPair groupPair : collectionGroups) { if (groupPair.containsMember(groupElement)) { groupPair.removeMember(groupElement); break; } } } }
private Object sawInvokeStatic(Object userObject) { if (doesStaticFactoryReturnNeedToBeWatched(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand())) { return Boolean.TRUE; } return userObject; }
private boolean isExpectedParmInstruction(int offsetConstant, int constant, int seen, int parmOffset) { if (parmOffset <= 3) { return (offsetConstant + parmOffset) == seen; } return (constant == seen) && (parmOffset == getRegisterOperand()); }
public void add(IfBlock block) { if (blocks.isEmpty()) { blocks.addLast(block); return; } IfBlock lastBlock = blocks.getLast(); if (block.getStart() > lastBlock.getEnd()) { blocks.addLast(block); } else { lastBlock.getSubIfBlocks().add(block); } }
private void sawOpcodeAfterEquals(int seen) { if (seen == Const.IFEQ) { if (getBranchOffset() > 0) { state = State.SAW_IFEQ; int target = getBranchTarget(); ifBlocks.add(new IfBlock(getPC(), target)); } else { state = State.SAW_NOTHING; } } else { state = State.SAW_NOTHING; } }
/** * builds up the method to field map of what method write to which fields this is one recursively so that if method A calls method B, and method B writes to * field C, then A modifies F. * * @param classContext * the context object of the currently parsed class */ private void buildMethodFieldModifiers(ClassContext classContext) { FieldModifier fm = new FieldModifier(); fm.visitClassContext(classContext); methodFieldModifiers = fm.getMethodFieldModifiers(); }
@Override protected void processMethodParms() { String nameConstantOperand = getNameConstantOperand(); // these requests are typically executed by being passed to an // "execute()" method. We know this doesn't // close the resource, we don't want to remove objects just because they // passed into this method if (!whiteListMethods.contains(nameConstantOperand)) { super.processMethodParms(); } }
@Override public void sawOpcode(int seen) { if ((seen == INVOKESPECIAL) || (seen == INVOKESTATIC) || (seen == INVOKEVIRTUAL)) { processInvoke(); } else if (seen == LDC) { processLoadConstant(); } }
public IfBlocks getSubIfBlocks() { if (subBlocks == null) { subBlocks = new IfBlocks(); } return subBlocks; }
public HangingExecutors(BugReporter reporter) { this.bugReporter = reporter; this.localHEDetector = new LocalHangingExecutor(this, reporter); }
@Override public int hashCode() { return appendType.hashCode() ^ (hasResolvedString ? 1 : 0); }
private Object sawInvokeStatic(Object userObject) { if (doesStaticFactoryReturnNeedToBeWatched(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand())) { return Boolean.TRUE; } return userObject; }
public void add(IfBlock block) { if (blocks.isEmpty()) { blocks.addLast(block); return; } IfBlock lastBlock = blocks.getLast(); if (block.getStart() > lastBlock.getEnd()) { blocks.addLast(block); } else { lastBlock.getSubIfBlocks().add(block); } }
private void sawOpcodeAfterEquals(int seen) { if (seen == IFEQ) { if (getBranchOffset() > 0) { state = State.SAW_IFEQ; int target = getBranchTarget(); ifBlocks.add(new IfBlock(getPC(), target)); } else { state = State.SAW_NOTHING; } } else { state = State.SAW_NOTHING; } }
private void removeFromCollectionGroup(OpcodeStack.Item itm) { Comparable<?> groupElement = getGroupElement(itm); if (groupElement != null) { for (GroupPair groupPair : collectionGroups) { if (groupPair.containsMember(groupElement)) { groupPair.removeMember(groupElement); break; } } } }
/** * builds up the method to field map of what method write to which fields this is one recursively so that if method A calls method B, and method B writes to * field C, then A modifies F. * * @param classContext * the context object of the currently parsed class */ private void buildMethodFieldModifiers(ClassContext classContext) { FieldModifier fm = new FieldModifier(); fm.visitClassContext(classContext); methodFieldModifiers = fm.getMethodFieldModifiers(); }
@Override protected void processMethodParms() { String nameConstantOperand = getNameConstantOperand(); // these requests are typically executed by being passed to an // "execute()" method. We know this doesn't // close the resource, we don't want to remove objects just because they // passed into this method if (!whiteListMethods.contains(nameConstantOperand)) { super.processMethodParms(); } }
@Override public void sawOpcode(int seen) { if ((seen == Const.INVOKESPECIAL) || (seen == Const.INVOKESTATIC) || (seen == Const.INVOKEVIRTUAL)) { processInvoke(); } else if (seen == Const.LDC) { processLoadConstant(); } }
private boolean isExpectedParmInstruction(int offsetConstant, int constant, int seen, int parmOffset) { if (parmOffset <= 3) { return (offsetConstant + parmOffset) == seen; } return (constant == seen) && (parmOffset == getRegisterOperand()); }
public IfBlocks getSubIfBlocks() { if (subBlocks == null) { subBlocks = new IfBlocks(); } return subBlocks; }