diff --git a/cast/js/src/main/java/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java b/cast/js/src/main/java/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java index 2e2587c647..fcb3fe3a07 100644 --- a/cast/js/src/main/java/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java +++ b/cast/js/src/main/java/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java @@ -199,11 +199,11 @@ protected static Pair quotify(String value) { quote = '"'; } else { quote = '"'; - value = value.replaceAll("\"", "\\\""); + value = value.replaceAll("\"", "\\\\\""); } if (value.indexOf('\n') >= 0) { - value = value.replaceAll("\n", "\\n"); + value = value.replaceAll("\n", "\\\\n"); } return Pair.make(value, quote); diff --git a/core/src/main/java/com/ibm/wala/types/generics/MethodTypeSignature.java b/core/src/main/java/com/ibm/wala/types/generics/MethodTypeSignature.java index f47f89689f..ce8bd1b4b7 100644 --- a/core/src/main/java/com/ibm/wala/types/generics/MethodTypeSignature.java +++ b/core/src/main/java/com/ibm/wala/types/generics/MethodTypeSignature.java @@ -43,7 +43,7 @@ public static MethodTypeSignature make(String genericsSignature) throws IllegalA * @return null if no arguments */ public TypeSignature[] getArguments() { - String typeSig = rawString().replaceAll(".*\\(", "\\(").replaceAll("\\).*", "\\)"); + String typeSig = rawString().replaceAll(".*\\(", "(").replaceAll("\\).*", ")"); String[] args = TypeSignature.parseForTypeSignatures(typeSig); if (args == null) { return null; diff --git a/core/src/test/java/com/ibm/wala/types/generics/MethodTypeSignatureTest.java b/core/src/test/java/com/ibm/wala/types/generics/MethodTypeSignatureTest.java new file mode 100644 index 0000000000..6830779794 --- /dev/null +++ b/core/src/test/java/com/ibm/wala/types/generics/MethodTypeSignatureTest.java @@ -0,0 +1,19 @@ +package com.ibm.wala.types.generics; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.arrayContaining; +import static org.hamcrest.Matchers.is; + +import org.junit.jupiter.api.Test; + +/** Unit tests for {@link MethodTypeSignature}. */ +class MethodTypeSignatureTest { + + /** Unit test for {@link MethodTypeSignature#getArguments()}. */ + @Test + void getArguments() { + assertThat( + MethodTypeSignature.make("(I)V").getArguments(), + arrayContaining(is(TypeSignature.make("I")))); + } +}