Addressed review comments + additional test

This commit is contained in:
upnotes
2018-09-28 15:54:51 +02:00
committed by Roman Shevchenko
parent 44bfa867e5
commit eaa2830596
6 changed files with 171 additions and 24 deletions

View File

@@ -245,30 +245,33 @@ public class ClassesProcessor implements CodeConstants {
mt.expandData();
InstructionSequence seq = mt.getInstructionSequence();
int len = seq.length();
for (int i = 0; i < len; i++) {
Instruction instr = seq.getInstr(i);
switch(instr.opcode) {
case opc_checkcast:
case opc_instanceof:
if(cl.qualifiedName.equals(pool.getPrimitiveConstant(instr.operand(0)).getString())) {
ref_counter++;
ref_not_new = true;
}
break;
case opc_new:
case opc_anewarray:
case opc_multianewarray:
if(cl.qualifiedName.equals(pool.getPrimitiveConstant(instr.operand(0)).getString())) {
ref_counter++;
}
break;
case opc_getstatic:
case opc_putstatic:
if(cl.qualifiedName.equals(pool.getLinkConstant(instr.operand(0)).classname)) {
ref_counter++;
ref_not_new = true;
if(seq != null) {
int len = seq.length();
for (int i = 0; i < len; i++) {
Instruction instr = seq.getInstr(i);
switch(instr.opcode) {
case opc_checkcast:
case opc_instanceof:
if(cl.qualifiedName.equals(pool.getPrimitiveConstant(instr.operand(0)).getString())) {
ref_counter++;
ref_not_new = true;
}
break;
case opc_new:
case opc_anewarray:
case opc_multianewarray:
if(cl.qualifiedName.equals(pool.getPrimitiveConstant(instr.operand(0)).getString())) {
ref_counter++;
}
break;
case opc_getstatic:
case opc_putstatic:
if(cl.qualifiedName.equals(pool.getLinkConstant(instr.operand(0)).classname)) {
ref_counter++;
ref_not_new = true;
}
}
}
}