boolean skipAnalysis = false;
for (Unit unit : graph) {
assert unit instanceof Stmt;
Stmt statement = (Stmt) unit;
if (statement instanceof JAssignStmt) {
JAssignStmt jAssignStmt = (JAssignStmt) statement;
if (jAssignStmt.getLeftOp().equals(varArgs)) {
// assigning to the varArgs variable
log.debug("Found varargs instantiation");
VarArgInfo varArgInfo = getVarArgInfo(jAssignStmt);
if (varArgInfo != null) {
varArgSize = varArgInfo.getSize();
varArgTypes = varArgInfo.getTypes();
varArgBase = varArgInfo.getBaseType();
} else {
Feedbacks.add(new UnanalyzedVarArgs(enclosingMethod,
enclosingStatement));
// we cant do anything, but to skip this analysis
skipAnalysis = true;
break;
}
} else if (!skipAnalysis
&& jAssignStmt.getLeftOp() instanceof JArrayRef) {
JArrayRef jArrayRef = (JArrayRef) jAssignStmt.getLeftOp();
if (jArrayRef.getBase().equals(varArgs)) {
// assigning to the varArg array values. Compute
// the type at the assigned position. This will always
// happen after the varargs instantiation!
if (jArrayRef.getIndex() instanceof IntConstant) {
IntConstant intConstant = (IntConstant) jArrayRef
.getIndex();
int index = intConstant.value;
Type oldType = varArgTypes[index];
Type type = jAssignStmt.getRightOp().getType();
if (oldType instanceof RefType
&& type instanceof RefType) {
RefType refType = (RefType) oldType;
RefType refType2 = (RefType) type;
type = resolver.getLeastCommonSupertypeOf(