From 58ade5293f98d84fa132c8ee9d4f6e4dacdc6b71 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Fri, 12 Sep 2025 20:02:50 +0200 Subject: [PATCH] Ensure that the java.lang.Thread class is loaded in InnerClassWithThreadTest If the Thread class is not loaded, frameworks like SootUp or Opal treat the Thread class as a phantom class. Hence, a call like "t.start()" is simply bypassed (since DataFlowScope.EXCLUDE_PHANTOM_CLASSES is used) and not analyzed. However, loading the Thread class results in a failure of the InnerClassWithThreadTest.threadQuery test, if the SootUp or Opal framework is used. This test fails because "Thread.start()" calls the native method "Thread.start0()", which causes the flow to stop. Hence, disable this test for SootUp and Opal. Note: The threadQuery test succeeds in case of the Soot framework because Soot's callgraph has an additional "virtual" edge from "Thread.start()" to "Thread.run()", which keeps the flow alive. --- .../java/test/cases/threading/InnerClassWithThreadTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/boomerangPDS/src/test/java/test/cases/threading/InnerClassWithThreadTest.java b/boomerangPDS/src/test/java/test/cases/threading/InnerClassWithThreadTest.java index 56076725..2a98798d 100644 --- a/boomerangPDS/src/test/java/test/cases/threading/InnerClassWithThreadTest.java +++ b/boomerangPDS/src/test/java/test/cases/threading/InnerClassWithThreadTest.java @@ -17,11 +17,15 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import test.TestingFramework; import test.core.BoomerangTestRunnerInterceptor; import test.core.QueryMethods; +import test.core.TestConfig; +import test.core.TestParameters; import test.core.selfrunning.AllocatedObject; @ExtendWith(BoomerangTestRunnerInterceptor.class) +@TestConfig(includedClasses = {"java.lang.Thread"}) public class InnerClassWithThreadTest { private static ThreadingAlloc param; @@ -73,6 +77,8 @@ public void run() { } @Test + @TestParameters( + skipFramework = {TestingFramework.Framework.SOOT_UP, TestingFramework.Framework.OPAL}) public void threadQuery() { for (int i = 1; i < 3; i++) { Thread t = new MyThread();