File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
core/src/test/java/com/google/errorprone/bugpatterns/inlineme Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -1511,6 +1511,59 @@ public void doTest() {
1511
1511
.doTest ();
1512
1512
}
1513
1513
1514
+ @ Test
1515
+ public void inlinerReplacesParameterValueInPackageName_b375421323 () {
1516
+ refactoringTestHelper
1517
+ .addInputLines (
1518
+ "Bar.java" ,
1519
+ """
1520
+ package foo;
1521
+
1522
+ public class Bar {
1523
+ public static void baz(String s) {}
1524
+ }
1525
+ """ )
1526
+ .expectUnchanged ()
1527
+ .addInputLines (
1528
+ "Client.java" ,
1529
+ """
1530
+ import com.google.errorprone.annotations.InlineMe;
1531
+ import foo.Bar;
1532
+
1533
+ public class Client {
1534
+ @InlineMe(replacement = "Bar.baz(foo)", imports = "foo.Bar")
1535
+ public static void inlinedMethod(String foo) {
1536
+ Bar.baz(foo);
1537
+ }
1538
+ }
1539
+ """ )
1540
+ .expectUnchanged ()
1541
+ .addInputLines (
1542
+ "Caller.java" ,
1543
+ """
1544
+ class Caller {
1545
+ class Bar {}
1546
+
1547
+ void doTest() {
1548
+ Client.inlinedMethod("abc");
1549
+ }
1550
+ }
1551
+ """ )
1552
+ .addOutputLines (
1553
+ "out/Caller.java" ,
1554
+ """
1555
+ class Caller {
1556
+ class Bar {}
1557
+
1558
+ void doTest() {
1559
+ "abc".Bar.baz("abc");
1560
+ }
1561
+ }
1562
+ """ )
1563
+ .allowBreakingChanges ()
1564
+ .doTest ();
1565
+ }
1566
+
1514
1567
private BugCheckerRefactoringTestHelper bugCheckerWithPrefixFlag (String prefix ) {
1515
1568
return BugCheckerRefactoringTestHelper .newInstance (Inliner .class , getClass ())
1516
1569
.setArgs ("-XepOpt:" + PREFIX_FLAG + "=" + prefix );
You can’t perform that action at this time.
0 commit comments