Commit d553157b authored by Skylot's avatar Skylot

fix: hide debug type inference logs

parent 95f9ab03
......@@ -10,6 +10,7 @@ import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jadx.core.Consts;
import jadx.core.dex.instructions.IndexInsnNode;
import jadx.core.dex.instructions.args.ArgType;
import jadx.core.dex.instructions.args.LiteralArg;
......@@ -67,7 +68,7 @@ public final class TypeInferenceVisitor extends AbstractVisitor {
if (assignArg.isTypeImmutable()) {
ArgType initType = assignArg.getInitType();
TypeUpdateResult result = typeUpdate.apply(ssaVar, initType);
if (result == TypeUpdateResult.REJECT && LOG.isDebugEnabled()) {
if (Consts.DEBUG && result == TypeUpdateResult.REJECT && LOG.isDebugEnabled()) {
LOG.debug("Initial immutable type set rejected: {} -> {}", ssaVar, initType);
}
} else {
......@@ -85,7 +86,7 @@ public final class TypeInferenceVisitor extends AbstractVisitor {
if (bestTypeOpt.isPresent()) {
ArgType candidateType = bestTypeOpt.get();
TypeUpdateResult result = typeUpdate.apply(ssaVar, candidateType);
if (result == TypeUpdateResult.REJECT && LOG.isDebugEnabled()) {
if (Consts.DEBUG && result == TypeUpdateResult.REJECT && LOG.isDebugEnabled()) {
if (ssaVar.getTypeInfo().getType().equals(candidateType)) {
LOG.warn("Same type rejected: {} -> {}, bounds: {}", ssaVar, candidateType, bounds);
} else {
......
......@@ -7,10 +7,10 @@ import java.util.Objects;
import java.util.Set;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jadx.core.Consts;
import jadx.core.dex.instructions.InsnType;
import jadx.core.dex.instructions.args.ArgType;
import jadx.core.dex.instructions.args.InsnArg;
......@@ -81,7 +81,7 @@ public final class TypeUpdate {
private TypeUpdateResult updateTypeForSsaVar(TypeUpdateInfo updateInfo, SSAVar ssaVar, ArgType candidateType) {
TypeInfo typeInfo = ssaVar.getTypeInfo();
if (!inBounds(typeInfo.getBounds(), candidateType)) {
if (LOG.isDebugEnabled()) {
if (Consts.DEBUG && LOG.isDebugEnabled()) {
LOG.debug("Reject type '{}' for {} by bounds: {}", candidateType, ssaVar, typeInfo.getBounds());
}
return REJECT;
......@@ -153,7 +153,6 @@ public final class TypeUpdate {
return true;
}
@Nullable
private boolean checkBound(ArgType candidateType, ITypeBound bound, ArgType boundType) {
TypeCompareEnum compareResult = comparator.compareTypes(candidateType, boundType);
switch (compareResult) {
......@@ -166,9 +165,7 @@ public final class TypeUpdate {
case NARROW:
if (bound.getBound() == BoundEnum.ASSIGN) {
if (boundType.isTypeKnown() || !checkAssignForUnknown(boundType, candidateType)) {
return false;
}
return !boundType.isTypeKnown() && checkAssignForUnknown(boundType, candidateType);
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment