Skip to content

Commit

Permalink
Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Mar 30, 2023
1 parent 2c73ea8 commit 415a929
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public static boolean methodExistsInEnclosingClass(CharSequence methodName, Visi
}

/**
* Returns the {@link MethodTree} from which control flow would exit if there would be a {@code
* return} statement at the given {@link VisitorState}'s current {@link VisitorState#getPath()
* path}.
* Returns the {@link MethodTree} from which the control flow would exit if there would be a
* {@code return} statement at the given {@link VisitorState}'s current {@link
* VisitorState#getPath() path}.
*
* @param state The {@link VisitorState} from which to derive the AST location of interest.
* @return A {@link MethodTree}, unless the {@link VisitorState}'s path does not point to an AST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ void identification() {
"import static org.mockito.Mockito.mock;",
"import static org.mockito.Mockito.spy;",
"",
"import java.util.function.Supplier;",
"",
"class A {",
" private String field;",
"",
Expand Down Expand Up @@ -87,7 +89,7 @@ void identification() {
" return variable;",
" }",
"",
" Object salienSpyTypeVariableDeclaration() {",
" Object salientSpyTypeVariableDeclaration() {",
" String variable = spy(\"name\");",
" return variable;",
" }",
Expand Down Expand Up @@ -126,6 +128,14 @@ void identification() {
" return variable;",
" }",
" }",
"",
" Supplier<String> redundantAssignmentInLambda() {",
" return () -> {",
" // BUG: Diagnostic contains:",
" String variable = toString();",
" return variable;",
" };",
" }",
"}")
.doTest();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ void areSameType() {
"class A {",
" void negative1(String a, Integer b) {}",
"",
" void negative2(Integer a, Number b) {}",
"",
" // BUG: Diagnostic contains:",
" void positive1(String a, String b) {}",
"",
Expand Down

0 comments on commit 415a929

Please sign in to comment.