diff --git a/src/main/java/pascal/taie/analysis/pta/core/cs/element/Pointer.java b/src/main/java/pascal/taie/analysis/pta/core/cs/element/Pointer.java index 6c0597a0c..4b0275149 100644 --- a/src/main/java/pascal/taie/analysis/pta/core/cs/element/Pointer.java +++ b/src/main/java/pascal/taie/analysis/pta/core/cs/element/Pointer.java @@ -100,8 +100,9 @@ public interface Pointer extends Indexable { /** * Removes out edges of this pointer if they satisfy the filter. *

- * Note: This method should not be used during pointer analysis iterations, - * as it can break the monotonicity of the analysis. + * Note: This method should not be called outside of + * {@link pascal.taie.analysis.pta.plugin.Plugin#onPhaseFinish()}, + * otherwise it may break the monotonicity of pointer analysis. *

*/ void removeEdgesIf(Predicate filter); diff --git a/src/main/java/pascal/taie/analysis/pta/plugin/taint/TaintAnalysis.java b/src/main/java/pascal/taie/analysis/pta/plugin/taint/TaintAnalysis.java index fd7132208..b35df5f4a 100644 --- a/src/main/java/pascal/taie/analysis/pta/plugin/taint/TaintAnalysis.java +++ b/src/main/java/pascal/taie/analysis/pta/plugin/taint/TaintAnalysis.java @@ -113,7 +113,7 @@ public void onPhaseFinish() { System.out.println("Taint Analysis is in interactive mode," + " you can change your taint config and run the analysis again.\n" + "Enter 'r' to run, 'e' to exit: "); - String input = nextLineFromConsole(); + String input = readLineFromConsole(); if (input == null) { break; } @@ -141,7 +141,7 @@ public void onPhaseFinish() { * or {@code null} if no line is available */ @Nullable - private static String nextLineFromConsole() { + private static String readLineFromConsole() { StringBuilder sb = new StringBuilder(); try { int c; diff --git a/src/main/java/pascal/taie/analysis/pta/pts/PointsToSet.java b/src/main/java/pascal/taie/analysis/pta/pts/PointsToSet.java index ff75a5474..913d8f5e0 100644 --- a/src/main/java/pascal/taie/analysis/pta/pts/PointsToSet.java +++ b/src/main/java/pascal/taie/analysis/pta/pts/PointsToSet.java @@ -61,8 +61,9 @@ public interface PointsToSet extends Iterable, Copyable { /** * Removes objects from this set if they satisfy the filter. *

- * Note: This method should be used with caution during pointer analysis iterations, - * as it can break the monotonicity of the analysis. + * Note: This method should not be called outside of + * {@link pascal.taie.analysis.pta.plugin.Plugin#onPhaseFinish()}, + * otherwise it may break the monotonicity of pointer analysis. *

*/ void removeIf(Predicate filter); diff --git a/src/test/java/pascal/taie/analysis/pta/TaintTest.java b/src/test/java/pascal/taie/analysis/pta/TaintTest.java index 1df1ad974..f95725b71 100644 --- a/src/test/java/pascal/taie/analysis/pta/TaintTest.java +++ b/src/test/java/pascal/taie/analysis/pta/TaintTest.java @@ -22,9 +22,7 @@ package pascal.taie.analysis.pta; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; -import pascal.taie.Main; import pascal.taie.analysis.Tests; import pascal.taie.util.MultiStringsSource; @@ -72,8 +70,15 @@ public class TaintTest { @MultiStringsSource({"CallSiteMode", TAINT_CONFIG_PREFIX + "taint-config-call-site-model.yml"}) void test(String mainClass, String... opts) { + testInNonInteractiveMode(mainClass, opts); + testInInteractiveMode(mainClass, opts); + } + + private void testInNonInteractiveMode(String mainClass, String... opts) { Tests.testPTA(DIR, mainClass, opts); - // test interactive mode + } + + private void testInInteractiveMode(String mainClass, String... opts) { InputStream originalSystemIn = System.in; try { String simulatedInput = "r\ne\n";