void () { String in = """ class X { void x() {} void y() { x(); this.x(); } }"""; assertEquals("replace (un)qualified calls correctly", """ class X { void x() {} void y() { x(); this.x(); } }""", replace(in, "'_Instance?.'_MethodCall('_arguments*)", "$Instance$.$MethodCall$($arguments$)", true)); String in2 = """ class X { void x() { System.out.println("" + Some.x()); } static class Some { int x() { return 1; } } } """; assertEquals("copy unmatched qualifiers", """ class X { void x() { System.out.println(Some.x()); } static class Some { int x() { return 1; } } } """, replace(in2, "System.out.println(\"\"+'_x());", "System.out.println($x$());", true)); }