Skip to content

Commit

Permalink
Refactor method and variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebFenton committed Sep 3, 2020
1 parent b119538 commit 6deb1e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions simplify/src/main/java/org/cf/simplify/Launcher.java
Expand Up @@ -4,7 +4,6 @@
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.cf.smalivm.exception.UnhandledVirtualException;
import org.cf.smalivm.VirtualMachine;
import org.cf.smalivm.exception.VirtualMachineException;
import org.cf.smalivm.VirtualMachineFactory;
Expand Down Expand Up @@ -48,7 +47,7 @@ private static void filterMethods(Collection<VirtualMethod> methods, Pattern pos
}
}

private static void filterSupportLibrary(Collection<String> classNames) {
private static void filterSupportLibraryClasses(Collection<String> classNames) {
classNames.removeIf(name -> SUPPORT_LIBRARY_PATTERN.matcher(name).find());
}

Expand Down Expand Up @@ -116,7 +115,7 @@ private static void usage(Options options) {

private VirtualMachine vm;

public void run(String[] args) throws IOException, UnhandledVirtualException {
public void run(String[] args) throws IOException {
opts = getOptions(args);

setLogLevel(opts);
Expand Down Expand Up @@ -158,7 +157,7 @@ private static Map<String, Collection<VirtualMethod>> collectTargetClassNameToMe

if (!opts.includeSupportLibrary()) {
int beforeCount = classNames.size();
filterSupportLibrary(classNames);
filterSupportLibraryClasses(classNames);
log.info("Filtered {} support library classes", (beforeCount - classNames.size()));
}

Expand Down
20 changes: 10 additions & 10 deletions smalivm/src/main/java/org/cf/smalivm/VirtualMachineFactory.java
Expand Up @@ -24,31 +24,31 @@ public VirtualMachine build(ClassManager manager, int maxAddressVisits, int maxC
return new VirtualMachine(manager, maxAddressVisits, maxCallDepth, maxMethodVisits, maxExecutionTime);
}

public VirtualMachine build(File smaliPath, int outputAPILevel, int maxAddressVisits, int maxCallDepth,
public VirtualMachine build(File inputPath, int outputAPILevel, int maxAddressVisits, int maxCallDepth,
int maxMethodVisits, int maxExecutionTime) throws IOException {
ClassManagerFactory factory = new ClassManagerFactory();
ClassManager manager = factory.build(smaliPath, outputAPILevel);
ClassManager manager = factory.build(inputPath, outputAPILevel);

return new VirtualMachine(manager, maxAddressVisits, maxCallDepth, maxMethodVisits, maxExecutionTime);
}

public VirtualMachine build(File smaliPath) throws IOException {
return build(smaliPath, SmaliParser.DEX_API_LEVEL, DEFAULT_MAX_ADDRESS_VISITS, DEFAULT_MAX_CALL_DEPTH,
public VirtualMachine build(File inputPath) throws IOException {
return build(inputPath, SmaliParser.DEX_API_LEVEL, DEFAULT_MAX_ADDRESS_VISITS, DEFAULT_MAX_CALL_DEPTH,
DEFAULT_MAX_METHOD_VISITS, DEFAULT_MAX_EXECUTION_TIME);
}

public VirtualMachine build(String smaliPath) throws IOException {
return build(smaliPath, SmaliParser.DEX_API_LEVEL);
public VirtualMachine build(String inputPath) throws IOException {
return build(inputPath, SmaliParser.DEX_API_LEVEL);
}

public VirtualMachine build(String smaliPath, int outputAPILevel) throws IOException {
return build(smaliPath, outputAPILevel, DEFAULT_MAX_ADDRESS_VISITS, DEFAULT_MAX_CALL_DEPTH,
public VirtualMachine build(String inputPath, int outputAPILevel) throws IOException {
return build(inputPath, outputAPILevel, DEFAULT_MAX_ADDRESS_VISITS, DEFAULT_MAX_CALL_DEPTH,
DEFAULT_MAX_METHOD_VISITS, DEFAULT_MAX_EXECUTION_TIME);
}

public VirtualMachine build(String smaliPath, int outputAPILevel, int maxAddressVisits, int maxCallDepth,
public VirtualMachine build(String inputPath, int outputAPILevel, int maxAddressVisits, int maxCallDepth,
int maxMethodVisits, int maxExecutionTime) throws IOException {
return build(new File(smaliPath), outputAPILevel, maxAddressVisits, maxCallDepth, maxMethodVisits,
return build(new File(inputPath), outputAPILevel, maxAddressVisits, maxCallDepth, maxMethodVisits,
maxExecutionTime);
}
}

0 comments on commit 6deb1e0

Please sign in to comment.