From 66eadd35fd8334d6050d845bbfc696643bbbd7f7 Mon Sep 17 00:00:00 2001 From: sahilagichani Date: Fri, 15 Nov 2024 13:51:16 +0100 Subject: [PATCH] removed getClassTypes() --- .../main/java/sootup/jimple/frontend/JimpleView.java | 8 -------- .../JimpleStringAnalysisInputLocationTest.java | 12 +++++++----- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/sootup.jimple.frontend/src/main/java/sootup/jimple/frontend/JimpleView.java b/sootup.jimple.frontend/src/main/java/sootup/jimple/frontend/JimpleView.java index 45fba1c89f..bb169ec5f5 100644 --- a/sootup.jimple.frontend/src/main/java/sootup/jimple/frontend/JimpleView.java +++ b/sootup.jimple.frontend/src/main/java/sootup/jimple/frontend/JimpleView.java @@ -157,12 +157,4 @@ private synchronized void resolveAll() { .forEach(this::buildClassFrom); isFullyResolved = true; } - - /** This is expensive, don't use in production code. Use it only for test case for convenience. */ - @Nonnull - public Optional getClassTypes(@Nonnull AnalysisInputLocation analysisInputLocation) { - Collection classSources = - analysisInputLocation.getClassSources(this); - return classSources.stream().map(AbstractClassSource::getClassType).findAny(); - } } diff --git a/sootup.jimple.frontend/src/test/java/sootup/jimple/frontend/JimpleStringAnalysisInputLocationTest.java b/sootup.jimple.frontend/src/test/java/sootup/jimple/frontend/JimpleStringAnalysisInputLocationTest.java index ae862a1026..6293ea617d 100644 --- a/sootup.jimple.frontend/src/test/java/sootup/jimple/frontend/JimpleStringAnalysisInputLocationTest.java +++ b/sootup.jimple.frontend/src/test/java/sootup/jimple/frontend/JimpleStringAnalysisInputLocationTest.java @@ -22,8 +22,7 @@ * #L% */ -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; import java.util.Collections; import org.junit.jupiter.api.Tag; @@ -31,6 +30,7 @@ import sootup.core.model.SourceType; import sootup.core.signatures.MethodSignature; import sootup.core.types.VoidType; +import sootup.interceptors.DeadAssignmentEliminator; @Tag("Java8") public class JimpleStringAnalysisInputLocationTest { @@ -61,15 +61,17 @@ public void test() { JimpleStringAnalysisInputLocation analysisInputLocation = new JimpleStringAnalysisInputLocation( - methodStr, SourceType.Application, Collections.emptyList()); + methodStr, + SourceType.Application, + Collections.singletonList(new DeadAssignmentEliminator())); JimpleView view = new JimpleView(Collections.singletonList(analysisInputLocation)); - assertTrue(view.getClassTypes(analysisInputLocation).isPresent()); + assertNotNull(view.getIdentifierFactory().getClassType("DummyClass")); MethodSignature methodSig = view.getIdentifierFactory() .getMethodSignature( - view.getClassTypes(analysisInputLocation).get(), + view.getIdentifierFactory().getClassType("DummyClass"), "banana", VoidType.getInstance(), Collections.emptyList());