if (staticMethod && seen == PUTSTATIC && MutableStaticFields.mutableSignature(getSigConstantOperand())) {
OpcodeStack.Item top = stack.getStackItem(0);
if (isPotentialCapture(top)) {
bugAccumulator.accumulateBug(
new BugInstance(this, "EI_EXPOSE_STATIC_REP2", NORMAL_PRIORITY)
.addClassAndMethod(this)
.addReferencedField(this)
.add(LocalVariableAnnotation.getLocalVariableAnnotation(getMethod(), top.getRegisterNumber(),
getPC(), getPC() - 1)), this);
}
}
if (!staticMethod && seen == PUTFIELD && MutableStaticFields.mutableSignature(getSigConstantOperand())) {
OpcodeStack.Item top = stack.getStackItem(0);
OpcodeStack.Item target = stack.getStackItem(1);
if (isPotentialCapture(top) && target.getRegisterNumber() == 0) {
bugAccumulator.accumulateBug(
new BugInstance(this, "EI_EXPOSE_REP2", NORMAL_PRIORITY)
.addClassAndMethod(this)
.addReferencedField(this)
.add(LocalVariableAnnotation.getLocalVariableAnnotation(getMethod(), top.getRegisterNumber(),
getPC(), getPC() - 1)), this);
}
}
if (seen == ALOAD_0 && !staticMethod) {
thisOnTOS = true;
fieldOnTOS = false;
return;
}
if (thisOnTOS && seen == GETFIELD && getClassConstantOperand().equals(getClassName())
&& !AnalysisContext.currentXFactory().isEmptyArrayField(getXFieldOperand())) {
fieldOnTOS = true;
thisOnTOS = false;
nameOnStack = getNameConstantOperand();
classNameOnStack = getDottedClassConstantOperand();
sigOnStack = getSigConstantOperand();
fieldIsStatic = false;
return;
}
if (seen == GETSTATIC && getClassConstantOperand().equals(getClassName())
&& !AnalysisContext.currentXFactory().isEmptyArrayField(getXFieldOperand())) {
fieldOnTOS = true;
thisOnTOS = false;
nameOnStack = getNameConstantOperand();
classNameOnStack = getDottedClassConstantOperand();
sigOnStack = getSigConstantOperand();
fieldIsStatic = true;
return;
}
thisOnTOS = false;
if (check && fieldOnTOS && seen == ARETURN
/*
* && !sigOnStack.equals("Ljava/lang/String;") &&
* sigOnStack.indexOf("Exception") == -1 && sigOnStack.indexOf("[") >= 0
*/
&& nameOnStack.indexOf("EMPTY") == -1 && MutableStaticFields.mutableSignature(sigOnStack)) {
bugAccumulator.accumulateBug(new BugInstance(this, staticMethod ? "MS_EXPOSE_REP" : "EI_EXPOSE_REP", NORMAL_PRIORITY)
.addClassAndMethod(this).addField(classNameOnStack, nameOnStack, sigOnStack, fieldIsStatic), this);
}
fieldOnTOS = false;
thisOnTOS = false;