void initObservedValues() throws DataflowAnalysisException { for(Iterator<Location> iterator = cfg.locationIterator(); iterator.hasNext(); ) { Location location = iterator.next(); Instruction instruction = location.getHandle().getInstruction(); if(instruction instanceof ANEWARRAY || instruction instanceof NEWARRAY || instruction instanceof MULTIANEWARRAY) { int number = vna.getFactAfterLocation(location).getTopValue().getNumber(); TypeFrame typeFrame = ta.getFactAfterLocation(location); if(typeFrame.isValid()) { Type type = typeFrame.getTopValue(); observedValues.put(number, new ValueInfo(number, location, type)); } } else if(instruction instanceof INVOKESPECIAL) { InvokeInstruction inv = (InvokeInstruction) instruction; if (inv.getMethodName(cpg).equals(CONSTRUCTOR_NAME) && noSideEffectMethods.hasNoSideEffect(new MethodDescriptor(inv, cpg))) { int number = vna.getFactAtLocation(location).getStackValue(inv.consumeStack(cpg)-1).getNumber(); TypeFrame typeFrame = ta.getFactAtLocation(location); if(typeFrame.isValid()) { Type type = typeFrame.getStackValue(inv.consumeStack(cpg)-1); observedValues.put(number, new ValueInfo(number, location, type)); } } } } thisValue = vna.getThisValue(); if(thisValue != null) { observedValues.remove(thisValue.getNumber()); } count = observedValues.size(); }
sawExcludedNSECall = true; if (noSideEffectMethods.hasNoSideEffect(callSeen.getMethodDescriptor())) { int priority = NORMAL_PRIORITY; Type callReturnType = Type.getReturnType(callSeen.getMethodDescriptor().getSignature());
void initObservedValues() throws DataflowAnalysisException { for(Iterator<Location> iterator = cfg.locationIterator(); iterator.hasNext(); ) { Location location = iterator.next(); Instruction instruction = location.getHandle().getInstruction(); if(instruction instanceof ANEWARRAY || instruction instanceof NEWARRAY || instruction instanceof MULTIANEWARRAY) { int number = vna.getFactAfterLocation(location).getTopValue().getNumber(); TypeFrame typeFrame = ta.getFactAfterLocation(location); if(typeFrame.isValid()) { Type type = typeFrame.getTopValue(); observedValues.put(number, new ValueInfo(number, location, type)); } } else if(instruction instanceof INVOKESPECIAL) { InvokeInstruction inv = (InvokeInstruction) instruction; if (inv.getMethodName(cpg).equals("<init>") && noSideEffectMethods.hasNoSideEffect(new MethodDescriptor(inv, cpg))) { int number = vna.getFactAtLocation(location).getStackValue(inv.consumeStack(cpg)-1).getNumber(); TypeFrame typeFrame = ta.getFactAtLocation(location); if(typeFrame.isValid()) { Type type = typeFrame.getStackValue(inv.consumeStack(cpg)-1); observedValues.put(number, new ValueInfo(number, location, type)); } } } } thisValue = vna.getThisValue(); if(thisValue != null) { observedValues.remove(thisValue.getNumber()); } count = observedValues.size(); }
sawExcludedNSECall = true; if (noSideEffectMethods.hasNoSideEffect(callSeen.getMethodDescriptor())) { int priority = NORMAL_PRIORITY; Type callReturnType = Type.getReturnType(callSeen.getMethodDescriptor().getSignature());