use of jadx.core.dex.visitors.typeinference.TypeCompare in project jadx by skylot.
the class ProcessVariables method checkCodeVars.
private void checkCodeVars(MethodNode mth, List<CodeVar> codeVars) {
int unknownTypesCount = 0;
for (CodeVar codeVar : codeVars) {
ArgType codeVarType = codeVar.getType();
if (codeVarType == null) {
codeVar.setType(ArgType.UNKNOWN);
unknownTypesCount++;
} else {
codeVar.getSsaVars().forEach(ssaVar -> {
ArgType ssaType = ssaVar.getImmutableType();
if (ssaType != null && ssaType.isTypeKnown()) {
TypeCompare comparator = mth.root().getTypeUpdate().getTypeCompare();
TypeCompareEnum result = comparator.compareTypes(ssaType, codeVarType);
if (result == TypeCompareEnum.CONFLICT || result.isNarrow()) {
mth.addWarn("Incorrect type for immutable var: ssa=" + ssaType + ", code=" + codeVarType + ", for " + ssaVar.getDetailedVarInfo(mth));
}
}
});
}
}
if (unknownTypesCount != 0) {
mth.addWarn("Unknown variable types count: " + unknownTypesCount);
}
}
Aggregations