diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/ParameterNameHintsManager.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/ParameterNameHintsManager.java index eca6364f9aa5..96f91aa2f9ee 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/ParameterNameHintsManager.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/ParameterNameHintsManager.java @@ -44,9 +44,7 @@ public class ParameterNameHintsManager { private static final Set ALLOWED_PARAMETER_NAME_CHARS = ContainerUtil.newHashSet('x', 'y', 'z', 'w', 'h'); - private static final Set COMMON_METHOD_NAMES = ContainerUtil.newHashSet( - "get", "set", "contains", "append", "print", "println", "charAt", "startsWith", "endsWith", "indexOf" - ); + private static final Set COMMON_METHOD_NAMES = ContainerUtil.newHashSet("set", "print", "println"); @NotNull private final List myDescriptors; @@ -72,18 +70,26 @@ public class ParameterNameHintsManager { PsiElement element = resolveResult.getElement(); if (element instanceof PsiMethod) { PsiMethod method = (PsiMethod)element; - return !isSetter(method) && !isCommonMethod(method); + if (isSetter(method)) return false; + if (hasSingleParameter(method)) { + return PsiType.VOID.equals(method.getReturnType()); + } + return !isCommonMethod(method); } return false; } + private static boolean hasSingleParameter(PsiMethod method) { + return method.getParameterList().getParametersCount() == 1; + } + private static boolean isCommonMethod(PsiMethod method) { return COMMON_METHOD_NAMES.contains(method.getName()); } private static boolean isSetter(PsiMethod method) { String methodName = method.getName(); - if (method.getParameterList().getParametersCount() == 1 + if (hasSingleParameter(method) && methodName.startsWith("set") && methodName.length() > 3 && Character.isUpperCase(methodName.charAt(3))) { return true;