Improve the canNarrowAfterInstanceOf check when using an empty bootclasspath

If the types in question can't be resolved, we just assume that the
narrowing can't happen.
This commit is contained in:
Ben Gruver 2016-09-18 14:25:38 -07:00
parent 12a3d71759
commit 41ba26d00a

View File

@ -1185,13 +1185,17 @@ public class MethodAnalyzer {
Reference reference = ((Instruction22c)analyzedInstanceOfInstruction.getInstruction()).getReference();
RegisterType registerType = RegisterType.getRegisterType(classPath, (TypeReference)reference);
if (registerType.type != null && !registerType.type.isInterface()) {
int objectRegister = ((TwoRegisterInstruction)analyzedInstanceOfInstruction.getInstruction())
.getRegisterB();
try {
if (registerType.type != null && !registerType.type.isInterface()) {
int objectRegister = ((TwoRegisterInstruction)analyzedInstanceOfInstruction.getInstruction())
.getRegisterB();
RegisterType originalType = analyzedIfInstruction.getPreInstructionRegisterType(objectRegister);
RegisterType originalType = analyzedIfInstruction.getPreInstructionRegisterType(objectRegister);
return isNarrowingConversion(originalType, registerType);
return isNarrowingConversion(originalType, registerType);
}
} catch (UnresolvedClassException ex) {
return false;
}
}
return false;