diff --git a/src/main/java/se/kth/spork/spoon/printer/SporkPrettyPrinter.java b/src/main/java/se/kth/spork/spoon/printer/SporkPrettyPrinter.java index c16a6bbf..49786167 100644 --- a/src/main/java/se/kth/spork/spoon/printer/SporkPrettyPrinter.java +++ b/src/main/java/se/kth/spork/spoon/printer/SporkPrettyPrinter.java @@ -183,9 +183,12 @@ public SporkPrinterHelper write(String s) { // // All we need to do here is the decrease tabs and enter some appropriate whitespace writelnIfNotPresent().writeAtLeftMargin(s).writeln(); + return this; } - if (globalContentConflicts.containsKey(s)) { - Pair conflict = globalContentConflicts.get(s); + + String strippedQuotes = trimmed.replaceAll("\"", ""); + if (globalContentConflicts.containsKey(strippedQuotes)) { + Pair conflict = globalContentConflicts.get(strippedQuotes); writeConflict(conflict.first, conflict.second); } else if (localConflictMap.isPresent() && localConflictMap.get().containsKey(s)) { Pair conflict = localConflictMap.get().get(s); diff --git a/src/test/resources/conflict/integer_literal_conflict/Base.java b/src/test/resources/conflict/integer_literal_conflict/Base.java new file mode 100644 index 00000000..d257ed10 --- /dev/null +++ b/src/test/resources/conflict/integer_literal_conflict/Base.java @@ -0,0 +1,5 @@ +public class Main { + int calcNumber() { + return 1 + 2 + 3; + } +} \ No newline at end of file diff --git a/src/test/resources/conflict/integer_literal_conflict/Expected.java b/src/test/resources/conflict/integer_literal_conflict/Expected.java new file mode 100644 index 00000000..9c2b55ca --- /dev/null +++ b/src/test/resources/conflict/integer_literal_conflict/Expected.java @@ -0,0 +1,11 @@ +public class Main { + int calcNumber() { + return 1 + 2 + +<<<<<<< LEFT +99 +======= +102 +>>>>>>> RIGHT + ; + } +} \ No newline at end of file diff --git a/src/test/resources/conflict/integer_literal_conflict/Left.java b/src/test/resources/conflict/integer_literal_conflict/Left.java new file mode 100644 index 00000000..02dd38ad --- /dev/null +++ b/src/test/resources/conflict/integer_literal_conflict/Left.java @@ -0,0 +1,5 @@ +public class Main { + int calcNumber() { + return 1 + 2 + 99; + } +} \ No newline at end of file diff --git a/src/test/resources/conflict/integer_literal_conflict/Right.java b/src/test/resources/conflict/integer_literal_conflict/Right.java new file mode 100644 index 00000000..017aaa51 --- /dev/null +++ b/src/test/resources/conflict/integer_literal_conflict/Right.java @@ -0,0 +1,5 @@ +public class Main { + int calcNumber() { + return 1 + 2 + 102; + } +} \ No newline at end of file