Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,15 @@ private Modifier getAccessSpecifier(Set<Modifier> modifiers) {
return mod;
}

@Override
public Tree visitMemberReference(MemberReferenceTree node, TreePath p) {
Element asElement = asElement(new TreePath(p, node));
if (element.equals(asElement)) {
isRecursive = true;
}
return super.visitMemberReference(node, p);
}

@Override
public Tree visitIdentifier(IdentifierTree node, TreePath p) {
Element asElement = asElement(new TreePath(p, node));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2271,6 +2271,27 @@ public void test271065InlineMethodReduceThis() throws Exception {
);
}

public void testInlineMethodRecursiveViaMethodRef1() throws Exception {
writeFilesAndWaitForScan(src,
new File("t/TestInline4.java",
"""
package t;
public class TestInline4 {
public void test() {
Runnable r = this::test();
}

public void copy() {
test;
}
}
""")
);
final InlineRefactoring[] r = new InlineRefactoring[1];
createInlineMethodRefactoring(src.getFileObject("t/TestInline4.java"), 1, r);
performRefactoring(r, new Problem(true, "ERR_InlineMethodRecursion"));
}

private void createInlineConstantRefactoring(FileObject source, final int position, final InlineRefactoring[] r) throws IOException, IllegalArgumentException {
JavaSource.forFileObject(source).runUserActionTask(new Task<CompilationController>() {

Expand Down
Loading