gui: fix build for java 10 and update dependencies (#291)

This commit is contained in:
Skylot
2018-06-02 14:39:33 +03:00
parent 188bfd1a7e
commit 7b4321ecee
14 changed files with 72 additions and 67 deletions
@@ -249,14 +249,9 @@ public class ModVisitor extends AbstractVisitor {
|| !parentClass.getInnerClasses().contains(classNode)) {
return;
}
if (!classNode.getAccessFlags().isStatic()
&& (callMth.getArgsCount() == 0
|| !callMth.getArgumentsTypes().get(0).equals(parentClass.getClassInfo().getType()))) {
return;
}
// TODO: calculate this constructor and other constructor usage
Map<InsnArg, FieldNode> argsMap = getArgsToFieldsMapping(callMthNode, co);
if (argsMap.isEmpty()) {
if (argsMap.isEmpty() && !callMthNode.getArguments(true).isEmpty()) {
return;
}
@@ -285,9 +280,14 @@ public class ModVisitor extends AbstractVisitor {
private static Map<InsnArg, FieldNode> getArgsToFieldsMapping(MethodNode callMthNode, ConstructorInsn co) {
Map<InsnArg, FieldNode> map = new LinkedHashMap<>();
ClassNode parentClass = callMthNode.getParentClass();
MethodInfo callMth = callMthNode.getMethodInfo();
ClassNode cls = callMthNode.getParentClass();
ClassNode parentClass = cls.getParentClass();
List<RegisterArg> argList = callMthNode.getArguments(false);
int startArg = parentClass.getAccessFlags().isStatic() ? 0 : 1;
int startArg = 0;
if (callMth.getArgsCount() != 0 && callMth.getArgumentsTypes().get(0).equals(parentClass.getClassInfo().getType())) {
startArg = 1;
}
int argsCount = argList.size();
for (int i = startArg; i < argsCount; i++) {
RegisterArg arg = argList.get(i);
@@ -298,7 +298,7 @@ public class ModVisitor extends AbstractVisitor {
FieldNode fieldNode = null;
if (useInsn.getType() == InsnType.IPUT) {
FieldInfo field = (FieldInfo) ((IndexInsnNode) useInsn).getIndex();
fieldNode = parentClass.searchField(field);
fieldNode = cls.searchField(field);
if (fieldNode == null || !fieldNode.getAccessFlags().isSynthetic()) {
return Collections.emptyMap();
}
@@ -208,8 +208,8 @@ public class SimplifyVisitor extends AbstractVisitor {
} // end of if constructor is for StringBuilder
} // end of if we found a constructor early in the chain
} catch (Throwable e) {
LOG.debug("Can't convert string concatenation: {} insn: {}", mth, insn, e);
} catch (Exception e) {
LOG.warn("Can't convert string concatenation: {} insn: {}", mth, insn, e);
}
}
return null;
@@ -6,6 +6,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.jetbrains.annotations.TestOnly;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,6 +33,7 @@ import jadx.core.utils.exceptions.CodegenException;
import jadx.core.utils.exceptions.JadxRuntimeException;
@Deprecated
@TestOnly
public class DebugUtils {
private static final Logger LOG = LoggerFactory.getLogger(DebugUtils.class);