From 9de327e7e0c59627c48a5d6c913b505f9780e27e Mon Sep 17 00:00:00 2001 From: zunhoho Date: Fri, 20 Dec 2024 21:56:21 +0100 Subject: [PATCH] fix reduplicated predecessors problem --- shared-test-resources/bugfixes/TrapSSA.class | Bin 0 -> 1082 bytes .../core/graph/MutableBlockStmtGraph.java | 2 +- .../sootup/tests/InsertBeforeAfterTest.java | 17 ----------------- 3 files changed, 1 insertion(+), 18 deletions(-) create mode 100644 shared-test-resources/bugfixes/TrapSSA.class diff --git a/shared-test-resources/bugfixes/TrapSSA.class b/shared-test-resources/bugfixes/TrapSSA.class new file mode 100644 index 0000000000000000000000000000000000000000..c5a80d66390a8a6786357e256ed64ad1f9a5fc27 GIT binary patch literal 1082 zcmZuv-%}D%7(Ewuxwx)r6e^WvT8Ro$mSsq$Xf{oXO<R;ruJ>X2v zXhwFeRtb-bJli= z5pCCU$^!k-t<@dthm|N<e5q0+sK+W4vh`}!wQDuIATZdOwcT^`RysR9sChQM^H=KZBHR)}t)F;> z7sk#B3{b!|8Y!ve>s11+sw#SkFC*NkqWv&1j9$J|_4)YocEMC!4RIEn^@(GMBQ6AP za||?tKEBy7`bi;FOhbp{+5QQ9o5%34iA-$5KONE<&>INE8j!28GklDnAVytmLPNOo;AH^6Z zsLH@yq%P)VYRcdk=1#0hWb}@n=*E-Pwb|J|L5}^|jM3Lw{o(vH26~S|+)g%Tb vA`*8LRB$lP$y8yI+rjrdIH#F`j(D5kKWA-UD-ko_ { + // blockA is in eb's predecessors list, because A and B have same ebs. eb.removePredecessorBlock(blockB); - eb.addPredecessorBlock(blockA); }); } else { diff --git a/sootup.tests/src/test/java/sootup/tests/InsertBeforeAfterTest.java b/sootup.tests/src/test/java/sootup/tests/InsertBeforeAfterTest.java index ad203589fb..b6985abe72 100644 --- a/sootup.tests/src/test/java/sootup/tests/InsertBeforeAfterTest.java +++ b/sootup.tests/src/test/java/sootup/tests/InsertBeforeAfterTest.java @@ -18,7 +18,6 @@ import sootup.core.model.SourceType; import sootup.core.signatures.MethodSignature; import sootup.core.types.ClassType; -import sootup.core.util.DotExporter; import sootup.java.bytecode.frontend.inputlocation.PathBasedAnalysisInputLocation; import sootup.java.core.JavaIdentifierFactory; import sootup.java.core.language.JavaJimple; @@ -668,20 +667,4 @@ public void testInsertAfterBlockMiddle2() { + "}\n"; Assertions.assertEquals(exceptedBody, builder.build().toString()); } - - @Test - public void testErrors() { - ClassType clazzType = factory.getClassType("TrapSSA"); - MethodSignature methodSignature = - factory.getMethodSignature( - clazzType, "main", "void", Collections.singletonList("java.lang.String[]")); - final Path path = Paths.get(location + "TrapSSA.class"); - PathBasedAnalysisInputLocation inputLocation = - new PathBasedAnalysisInputLocation.ClassFileBasedAnalysisInputLocation( - path, "", SourceType.Application); - JavaView view = new JavaView(inputLocation); - Body body = view.getMethod(methodSignature).get().getBody(); - System.out.println(DotExporter.createUrlToWebeditor(body.getStmtGraph())); - System.out.println(body); - } }