Commit fe41174b authored by Ahmed Ashour's avatar Ahmed Ashour Committed by skylot

feat: add generic method information to .jcst (PR #564)

parent 513766d4
......@@ -2,6 +2,8 @@ package jadx.core.clsp;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
......@@ -28,7 +30,7 @@ public class ConvertToClsSet {
usage();
System.exit(1);
}
File output = new File(args[0]);
Path output = Paths.get(args[0]);
List<InputFile> inputFiles = new ArrayList<>(args.length - 1);
for (int i = 1; i < args.length; i++) {
......
......@@ -7,6 +7,7 @@ public class NClass {
private final String name;
private NClass[] parents;
private NMethod[] methods;
private final int id;
public NClass(String name, int id) {
......@@ -51,4 +52,12 @@ public class NClass {
public String toString() {
return name;
}
public void setMethods(NMethod[] methods) {
this.methods = methods;
}
public NMethod[] getMethods() {
return methods;
}
}
package jadx.core.clsp;
import jadx.core.dex.instructions.args.ArgType;
/**
* Generic method node in classpath graph.
*/
public class NMethod {
private final String shortId;
private final ArgType[] argType;
private final ArgType retType;
private final boolean varArgs;
public NMethod(String shortId, ArgType[] argType, ArgType retType, boolean varArgs) {
this.shortId = shortId;
this.argType = argType;
this.retType = retType;
this.varArgs = varArgs;
}
public String getShortId() {
return shortId;
}
public ArgType[] getArgType() {
return argType;
}
public ArgType getReturnType() {
return retType;
}
public boolean isVarArgs() {
return varArgs;
}
}
......@@ -75,8 +75,8 @@ public abstract class ArgType {
return new WildcardType(OBJECT, 0);
}
public static ArgType wildcard(ArgType obj, int bound) {
return new WildcardType(obj, bound);
public static ArgType wildcard(ArgType obj, int bounds) {
return new WildcardType(obj, bounds);
}
public static ArgType generic(String sign) {
......@@ -214,10 +214,10 @@ public abstract class ArgType {
private final ArgType type;
private final int bounds;
public WildcardType(ArgType obj, int bound) {
public WildcardType(ArgType obj, int bounds) {
super(OBJECT.getObject());
this.type = obj;
this.bounds = bound;
this.bounds = bounds;
}
@Override
......
......@@ -36,7 +36,7 @@ public class InputFile {
public static void addFilesFrom(File file, List<InputFile> list, boolean... skipSources) throws IOException, DecodeException {
InputFile inputFile = new InputFile(file);
inputFile.searchDexFiles(skipSources[0]);
inputFile.searchDexFiles(skipSources.length == 0 ? false : skipSources[0]);
list.add(inputFile);
}
......
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