SSR: improve multi-matching references qualified with this or super (IDEA-144697)
[idea/community.git] / platform / structuralsearch / testSource / com / intellij / structuralsearch / StructuralReplaceTest.java
index 1182b1d4ec9868dd6fa6d5ae0ef4dda75b541fae..d9978491566e8b111abad877a3edd9d9548532a5 100644 (file)
@@ -2202,4 +2202,25 @@ public class StructuralReplaceTest extends StructuralReplaceTestCase {
                  "}",
                  replacer.testReplace(in2, what, by, options));
   }
+
+  public void testReplaceQualifiedReference() {
+    String in = "class A {" +
+                "  String s;" +
+                "  void setS(String s) {" +
+                "    System.out.println(this.s);" +
+                "    this.s = s;" +
+                "  }" +
+                "}";
+    String what = "System.out.println('_a);";
+    String by = "System.out.println(\"$a$\" + $a$);";
+    assertEquals("don't drop this",
+                 "class A {" +
+                 "  String s;" +
+                 "  void setS(String s) {" +
+                 "    System.out.println(\"this.s\" + this.s);" +
+                 "    this.s = s;" +
+                 "  }" +
+                 "}",
+                 replacer.testReplace(in, what, by, options));
+  }
 }
\ No newline at end of file