mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Parameter Hints] builder methods only ones with single param
This commit is contained in:
@@ -57,15 +57,17 @@ public class JavaParameterHintManager {
|
||||
}
|
||||
|
||||
private static boolean isBuilder(PsiCallExpression expression, PsiMethod method) {
|
||||
if (expression instanceof PsiNewExpression) {
|
||||
if (expression instanceof PsiNewExpression || !hasSingleParameter(method)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PsiType returnType = TypeConversionUtil.erasure(method.getReturnType());
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
final String calledMethodFqn = aClass != null ? aClass.getQualifiedName() : null;
|
||||
if (calledMethodFqn != null && returnType != null) {
|
||||
return returnType.equalsToText(calledMethodFqn);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+21
@@ -582,6 +582,27 @@ class Test {
|
||||
onLineStartingWith("builder.bwait").assertNoInlays()
|
||||
}
|
||||
|
||||
fun `test builder method only method with one param`() {
|
||||
setup("""
|
||||
class Builder {
|
||||
Builder qwit(boolean value, String sValue) {}
|
||||
Builder trew(boolean value) {}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public void test() {
|
||||
Builder builder = new Builder();
|
||||
builder
|
||||
.trew(false)
|
||||
.qwit(true, "value");
|
||||
}
|
||||
}
|
||||
""")
|
||||
|
||||
onLineStartingWith(".trew").assertNoInlays()
|
||||
onLineStartingWith(".qw").assertInlays("value->true", "sValue->\"value\"")
|
||||
}
|
||||
|
||||
fun `test do not show single parameter hint if it is string literal`() {
|
||||
setup("""
|
||||
public class Test {
|
||||
|
||||
Reference in New Issue
Block a user