From bcf5c2f20c47de64346e74a6edc1e9e41e91344a Mon Sep 17 00:00:00 2001 From: Palaniappan Muthuraman Date: Wed, 6 Nov 2024 11:31:21 +0100 Subject: [PATCH] coupled two method streams into single stream in APK frontend --- .../sootup/apk/frontend/dexpler/DexClassSource.java | 12 ++---------- .../test/java/sootup/apk/frontend/ApkToDexTest.java | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sootup.apk.frontend/src/main/java/sootup/apk/frontend/dexpler/DexClassSource.java b/sootup.apk.frontend/src/main/java/sootup/apk/frontend/dexpler/DexClassSource.java index c322b2b78d..1c78afade1 100644 --- a/sootup.apk.frontend/src/main/java/sootup/apk/frontend/dexpler/DexClassSource.java +++ b/sootup.apk.frontend/src/main/java/sootup/apk/frontend/dexpler/DexClassSource.java @@ -26,7 +26,6 @@ import java.nio.file.Path; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.Stream; import java.util.stream.StreamSupport; import javax.annotation.Nonnull; import org.jf.dexlib2.dexbacked.raw.EncodedValue; @@ -78,16 +77,9 @@ public DexClassSource( @Override public Collection resolveMethods() throws ResolveException { if (classInformation != null) { - Iterable methodIterable = classInformation.classDefinition.getMethods(); DexMethod dexMethod = createDexMethodFactory(classInformation.dexEntry, classSignature); - // Convert the Iterable to a Stream - Stream methodStream = - StreamSupport.stream(methodIterable.spliterator(), false); - Iterable virtualMethodIterable = - classInformation.classDefinition.getVirtualMethods(); - Stream virtualMethodStream = - StreamSupport.stream(virtualMethodIterable.spliterator(), false); - return Stream.concat(methodStream, virtualMethodStream) + return StreamSupport.stream( + classInformation.classDefinition.getMethods().spliterator(), false) .map(method -> loadMethod(method, dexMethod)) .collect(Collectors.toSet()); } else { diff --git a/sootup.apk.frontend/src/test/java/sootup/apk/frontend/ApkToDexTest.java b/sootup.apk.frontend/src/test/java/sootup/apk/frontend/ApkToDexTest.java index 5f9e6ae37a..d98725c8f1 100644 --- a/sootup.apk.frontend/src/test/java/sootup/apk/frontend/ApkToDexTest.java +++ b/sootup.apk.frontend/src/test/java/sootup/apk/frontend/ApkToDexTest.java @@ -70,7 +70,7 @@ public void loadAnApk() { methodsSize += methods.size(); } // There are a total of 740 classes and 10559 methods present in the given APK - assertEquals(10559, methodsSize); + assertEquals(6220, methodsSize); assertEquals(740, classes.size()); }