feat: add raung input plugin, use raung in tests
This commit is contained in:
+8
-1
@@ -1,8 +1,11 @@
|
||||
package jadx.plugins.input.java;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import jadx.api.plugins.JadxPluginInfo;
|
||||
import jadx.api.plugins.input.JadxInputPlugin;
|
||||
import jadx.api.plugins.input.data.ILoadResult;
|
||||
@@ -22,10 +25,14 @@ public class JavaInputPlugin implements JadxInputPlugin {
|
||||
|
||||
@Override
|
||||
public ILoadResult loadFiles(List<Path> inputFiles) {
|
||||
return loadClassFiles(inputFiles, null);
|
||||
}
|
||||
|
||||
public static ILoadResult loadClassFiles(List<Path> inputFiles, @Nullable Closeable closeable) {
|
||||
List<JavaClassReader> readers = new JavaFileLoader().collectFiles(inputFiles);
|
||||
if (readers.isEmpty()) {
|
||||
return EmptyLoadResult.INSTANCE;
|
||||
}
|
||||
return new JavaLoadResult(readers);
|
||||
return new JavaLoadResult(readers, closeable);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -1,8 +1,11 @@
|
||||
package jadx.plugins.input.java;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -14,9 +17,12 @@ public class JavaLoadResult implements ILoadResult {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JavaLoadResult.class);
|
||||
|
||||
private final List<JavaClassReader> readers;
|
||||
@Nullable
|
||||
private final Closeable closeable;
|
||||
|
||||
public JavaLoadResult(List<JavaClassReader> readers) {
|
||||
public JavaLoadResult(List<JavaClassReader> readers, @Nullable Closeable closeable) {
|
||||
this.readers = readers;
|
||||
this.closeable = closeable;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,7 +46,10 @@ public class JavaLoadResult implements ILoadResult {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
public void close() throws IOException {
|
||||
readers.clear();
|
||||
if (closeable != null) {
|
||||
closeable.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user