mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PsiParameterList#isEmpty; isEmpty and getParametersCount used where possible
This commit is contained in:
@@ -101,7 +101,7 @@ public class JUnitUtil {
|
||||
if (!psiMethod.hasModifierProperty(PsiModifier.PUBLIC)) return false;
|
||||
if (!psiMethod.hasModifierProperty(PsiModifier.STATIC)) return false;
|
||||
if (psiMethod.isConstructor()) return false;
|
||||
if (psiMethod.getParameterList().getParametersCount() > 0) return false;
|
||||
if (!psiMethod.getParameterList().isEmpty()) return false;
|
||||
final PsiType returnType = psiMethod.getReturnType();
|
||||
if (returnType == null || returnType instanceof PsiPrimitiveType) return false;
|
||||
return returnType.equalsToText(TEST_INTERFACE) ||
|
||||
@@ -137,7 +137,7 @@ public class JUnitUtil {
|
||||
return !isInheritorOrSelfRunner(annotation, RUNNERS_REQUIRE_ANNOTATION_ON_TEST_METHOD);
|
||||
}
|
||||
}
|
||||
if (psiMethod.getParameterList().getParametersCount() > 0) return false;
|
||||
if (!psiMethod.getParameterList().isEmpty()) return false;
|
||||
if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) return false;
|
||||
if (!psiMethod.getName().startsWith("test")) return false;
|
||||
if (checkClass) {
|
||||
|
||||
+1
-1
@@ -2843,7 +2843,7 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
@Nullable
|
||||
static HighlightInfo checkAnnotationMethodParameters(@NotNull PsiParameterList list) {
|
||||
final PsiElement parent = list.getParent();
|
||||
if (PsiUtil.isAnnotationMethod(parent) && list.getParametersCount() > 0) {
|
||||
if (PsiUtil.isAnnotationMethod(parent) && !list.isEmpty()) {
|
||||
final String message = JavaErrorMessages.message("annotation.interface.members.may.not.have.parameters");
|
||||
final HighlightInfo highlightInfo =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).descriptionAndTooltip(message).create();
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class JavaHighlightUtil {
|
||||
if (containingClass == null) return false;
|
||||
if (method.isConstructor()) {
|
||||
if (isSerializable(containingClass, "java.io.Externalizable") &&
|
||||
method.getParameterList().getParametersCount() == 0 &&
|
||||
method.getParameterList().isEmpty() &&
|
||||
method.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -399,7 +399,7 @@ public class ModuleHighlightUtil {
|
||||
|
||||
PsiMethod provider = ContainerUtil.find(
|
||||
implClass.findMethodsByName("provider", false),
|
||||
m -> m.hasModifierProperty(PsiModifier.PUBLIC) && m.hasModifierProperty(PsiModifier.STATIC) && m.getParameterList().getParametersCount() == 0);
|
||||
m -> m.hasModifierProperty(PsiModifier.PUBLIC) && m.hasModifierProperty(PsiModifier.STATIC) && m.getParameterList().isEmpty());
|
||||
if (provider != null) {
|
||||
PsiType type = provider.getReturnType();
|
||||
PsiClass typeClass = type instanceof PsiClassType ? ((PsiClassType)type).resolve() : null;
|
||||
|
||||
+1
-1
@@ -506,7 +506,7 @@ public class AnonymousCanBeLambdaInspection extends AbstractBaseJavaLocalInspect
|
||||
psiMethod != null &&
|
||||
!methodCallExpression.getMethodExpression().isQualified() &&
|
||||
"getClass".equals(psiMethod.getName()) &&
|
||||
psiMethod.getParameterList().getParametersCount() == 0) {
|
||||
psiMethod.getParameterList().isEmpty()) {
|
||||
myBodyContainsForbiddenRefs = true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -290,7 +290,7 @@ public class ProjectBytecodeAnalysis {
|
||||
|
||||
Map<EKey, Effects> puritySolutions = puritySolver.solve();
|
||||
|
||||
int arity = owner.getParameterList().getParameters().length;
|
||||
int arity = owner.getParameterList().getParametersCount();
|
||||
BytecodeAnalysisConverter.addEffectAnnotations(puritySolutions, result, key, owner.isConstructor());
|
||||
|
||||
EKey failureKey = key.withDirection(Throw);
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public class InferenceFromSourceUtil {
|
||||
}
|
||||
|
||||
static boolean suppressNullable(PsiMethod method) {
|
||||
if (method.getParameterList().getParametersCount() == 0) return false;
|
||||
if (method.getParameterList().isEmpty()) return false;
|
||||
|
||||
for (StandardMethodContract contract : ControlFlowAnalyzer.getMethodContracts(method)) {
|
||||
if (contract.returnValue == MethodContract.ValueConstraint.NULL_VALUE) {
|
||||
|
||||
+1
-1
@@ -220,7 +220,7 @@ public class DfaExpressionFactory {
|
||||
return method;
|
||||
}
|
||||
}
|
||||
if (method.getParameterList().getParametersCount() == 0) {
|
||||
if (method.getParameterList().isEmpty()) {
|
||||
if ((ControlFlowAnalyzer.isPure(method) ||
|
||||
AnnotationUtil.findAnnotation(method.getContainingClass(), "javax.annotation.concurrent.Immutable") != null) &&
|
||||
ControlFlowAnalyzer.getMethodCallContracts(method, null).isEmpty()) {
|
||||
|
||||
+1
-2
@@ -46,7 +46,6 @@ import com.intellij.psi.search.PsiNonJavaFileReferenceProcessor;
|
||||
import com.intellij.psi.search.PsiSearchHelper;
|
||||
import com.intellij.psi.util.PsiMethodUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import java.util.HashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -186,7 +185,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
|
||||
if (!method.isConstructor()) return false;
|
||||
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) return false;
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) return false;
|
||||
if (!parameterList.isEmpty()) return false;
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
return aClass == null || isExternalizable(aClass, refClass);
|
||||
}
|
||||
|
||||
+2
-2
@@ -118,7 +118,7 @@ abstract class DeprecationInspectionBase extends AbstractBaseJavaLocalInspection
|
||||
|
||||
PsiMethod constructor = result == null ? null : result.getElement();
|
||||
if (constructor != null && expression.getClassOrAnonymousClassReference() != null) {
|
||||
if (expression.getClassReference() == null && constructor.getParameterList().getParametersCount() == 0) return;
|
||||
if (expression.getClassReference() == null && constructor.getParameterList().isEmpty()) return;
|
||||
checkDeprecated(constructor, expression.getClassOrAnonymousClassReference(), null, myIgnoreInsideDeprecated,
|
||||
myIgnoreImportStatements, true, myIgnoreInSameOutermostClass, myHolder, myForRemoval, myHighlightType);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ abstract class DeprecationInspectionBase extends AbstractBaseJavaLocalInspection
|
||||
|
||||
private static boolean hasDefaultDeprecatedConstructor(PsiClass superClass, boolean forRemoval) {
|
||||
return superClass != null && Arrays.stream(superClass.getConstructors())
|
||||
.anyMatch(constructor -> constructor.getParameterList().getParametersCount() == 0 &&
|
||||
.anyMatch(constructor -> constructor.getParameterList().isEmpty() &&
|
||||
constructor.isDeprecated() &&
|
||||
isMarkedForRemoval(constructor, forRemoval));
|
||||
}
|
||||
|
||||
+2
-2
@@ -134,13 +134,13 @@ public class Java9ModuleEntryPoint extends EntryPointWithVisibilityLevel {
|
||||
|
||||
private static boolean isDefaultConstructor(@NotNull PsiMethod method) {
|
||||
return method.isConstructor() &&
|
||||
method.getParameterList().getParametersCount() == 0 &&
|
||||
method.getParameterList().isEmpty() &&
|
||||
method.hasModifierProperty(PsiModifier.PUBLIC);
|
||||
}
|
||||
|
||||
private static boolean isProviderMethod(@NotNull PsiMethod method) {
|
||||
return "provider".equals(method.getName()) &&
|
||||
method.getParameterList().getParametersCount() == 0 &&
|
||||
method.getParameterList().isEmpty() &&
|
||||
method.hasModifierProperty(PsiModifier.PUBLIC) &&
|
||||
method.hasModifierProperty(PsiModifier.STATIC);
|
||||
}
|
||||
|
||||
+1
-1
@@ -278,6 +278,6 @@ public class RefJavaModuleImpl extends RefElementImpl implements RefJavaModule {
|
||||
final PsiMethod[] methods = psiClass.findMethodsByName("provider", false);
|
||||
return ContainerUtil.find(methods, m -> m.hasModifierProperty(PsiModifier.PUBLIC) &&
|
||||
m.hasModifierProperty(PsiModifier.STATIC) &&
|
||||
m.getParameterList().getParametersCount() == 0);
|
||||
m.getParameterList().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -146,7 +146,7 @@ public class ClassHasNoToStringMethodInspection extends AbstractToStringInspecti
|
||||
final PsiMethod[] toStringMethods = clazz.findMethodsByName("toString", false);
|
||||
for (PsiMethod method : toStringMethods) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
// toString() method found
|
||||
return;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class ClassHasNoToStringMethodInspection extends AbstractToStringInspecti
|
||||
final PsiMethod[] superMethods = clazz.findMethodsByName("toString", true);
|
||||
for (PsiMethod method : superMethods) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (method.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class FieldNotUsedInToStringInspection extends AbstractToStringInspection
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiType returnType = method.getReturnType();
|
||||
|
||||
@@ -464,7 +464,7 @@ public class PsiAdapter {
|
||||
return false;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -598,7 +598,7 @@ public class PsiAdapter {
|
||||
|
||||
// must not have a parameter
|
||||
PsiParameterList parameters = method.getParameterList();
|
||||
if (parameters.getParametersCount() != 0) {
|
||||
if (!parameters.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ public class JavaTargetElementEvaluator extends TargetElementEvaluatorEx2 implem
|
||||
public PsiElement getGotoDeclarationTarget(@NotNull final PsiElement element, @Nullable final PsiElement navElement) {
|
||||
if (navElement == element && element instanceof PsiCompiledElement && element instanceof PsiMethod) {
|
||||
PsiMethod method = (PsiMethod)element;
|
||||
if (method.isConstructor() && method.getParameterList().getParametersCount() == 0) {
|
||||
if (method.isConstructor() && method.getParameterList().isEmpty()) {
|
||||
PsiClass aClass = method.getContainingClass();
|
||||
PsiElement navClass = aClass == null ? null : aClass.getNavigationElement();
|
||||
if (aClass != navClass) return navClass;
|
||||
|
||||
@@ -52,7 +52,7 @@ class ChainedCallCompletion {
|
||||
return;
|
||||
}
|
||||
|
||||
if (object instanceof PsiMethod && ((PsiMethod)object).getParameterList().getParametersCount() > 0) {
|
||||
if (object instanceof PsiMethod && !((PsiMethod)object).getParameterList().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ class CollectConversion {
|
||||
|
||||
PsiMethodCallExpression innerCall = (PsiMethodCallExpression)args[0];
|
||||
PsiMethod collectorMethod = innerCall.resolveMethod();
|
||||
if (collectorMethod != null && collectorMethod.getParameterList().getParametersCount() > 0) {
|
||||
if (collectorMethod != null && !collectorMethod.getParameterList().isEmpty()) {
|
||||
context.getEditor().getCaretModel().moveToOffset(innerCall.getArgumentList().getFirstChild().getTextRange().getEndOffset());
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -243,7 +243,7 @@ public class ConstructorInsertHandler implements InsertHandler<LookupElementDeco
|
||||
|
||||
final PsiElement place = context.getFile().findElementAt(context.getStartOffset());
|
||||
assert place != null;
|
||||
boolean hasParams = constructor != null ? constructor.getParameterList().getParametersCount() > 0 : hasConstructorParameters(psiClass, place);
|
||||
boolean hasParams = constructor != null ? !constructor.getParameterList().isEmpty() : hasConstructorParameters(psiClass, place);
|
||||
|
||||
RangeMarker refEnd = context.getDocument().createRangeMarker(context.getTailOffset(), context.getTailOffset());
|
||||
|
||||
@@ -264,7 +264,7 @@ public class ConstructorInsertHandler implements InsertHandler<LookupElementDeco
|
||||
boolean hasParams = false;
|
||||
for (PsiMethod constructor : psiClass.getConstructors()) {
|
||||
if (!resolveHelper.isAccessible(constructor, place, null)) continue;
|
||||
if (constructor.getParameterList().getParametersCount() > 0) {
|
||||
if (!constructor.getParameterList().isEmpty()) {
|
||||
hasParams = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ public class JavaKeywordCompletion {
|
||||
if (superClass != null) {
|
||||
for (final PsiMethod psiMethod : superClass.getConstructors()) {
|
||||
final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(method.getProject()).getResolveHelper();
|
||||
if (resolveHelper.isAccessible(psiMethod, method, null) && psiMethod.getParameterList().getParameters().length > 0) {
|
||||
if (resolveHelper.isAccessible(psiMethod, method, null) && !psiMethod.getParameterList().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
|
||||
}
|
||||
|
||||
public static boolean startArgumentLiveTemplate(InsertionContext context, PsiMethod method) {
|
||||
if (method.getParameterList().getParametersCount() == 0 ||
|
||||
if (method.getParameterList().isEmpty() ||
|
||||
context.getCompletionChar() == Lookup.COMPLETE_STATEMENT_SELECT_CHAR ||
|
||||
!ParameterInfoController.areParameterTemplatesEnabledOnCompletion()) {
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public class JavaMethodMergingContributor extends CompletionContributor {
|
||||
private static int getPriority(LookupElement element) {
|
||||
PsiMethod method = assertNotNull(getItemMethod(element));
|
||||
return (PsiType.VOID.equals(method.getReturnType()) ? 0 : 1) +
|
||||
(method.getParameterList().getParametersCount() > 0 ? 2 : 0);
|
||||
(method.getParameterList().isEmpty() ? 0 : 2);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -120,7 +120,7 @@ class SlowerTypeConversions implements Runnable {
|
||||
final PsiMethod method = (PsiMethod)o;
|
||||
final PsiType type = method.getReturnType();
|
||||
if (PsiType.VOID.equals(type) || PsiType.NULL.equals(type)) return null;
|
||||
if (method.getParameterList().getParametersCount() > 0) return null;
|
||||
if (!method.getParameterList().isEmpty()) return null;
|
||||
return method.getName() + "(" +
|
||||
getSpace(CodeStyleSettingsManager.getSettings(method.getProject())
|
||||
.getCommonSettings(JavaLanguage.INSTANCE).SPACE_WITHIN_METHOD_CALL_PARENTHESES) + ")";
|
||||
|
||||
@@ -30,7 +30,10 @@ import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -90,7 +93,7 @@ public abstract class StaticMemberProcessor {
|
||||
return createLookupElement(method, containingClass, shouldImport);
|
||||
}
|
||||
|
||||
if (overloads.get(0).getParameterList().getParametersCount() == 0) {
|
||||
if (overloads.get(0).getParameterList().isEmpty()) {
|
||||
overloads.add(0, overloads.remove(1));
|
||||
}
|
||||
return createLookupElement(overloads, containingClass, shouldImport);
|
||||
|
||||
@@ -360,7 +360,7 @@ public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor {
|
||||
|
||||
private static boolean isServiceProviderMethod(@NotNull PsiMethod method) {
|
||||
return "provider".equals(method.getName()) &&
|
||||
method.getParameterList().getParametersCount() == 0 &&
|
||||
method.getParameterList().isEmpty() &&
|
||||
method.hasModifierProperty(PsiModifier.PUBLIC) &&
|
||||
method.hasModifierProperty(PsiModifier.STATIC);
|
||||
}
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class CreateClassFromNewFix extends CreateFromUsageBaseFix {
|
||||
boolean hasDefaultConstructor = false;
|
||||
|
||||
for (PsiMethod superConstructor : constructors) {
|
||||
if (superConstructor.getParameterList().getParametersCount() == 0) {
|
||||
if (superConstructor.getParameterList().isEmpty()) {
|
||||
hasDefaultConstructor = true;
|
||||
supConstructor = null;
|
||||
break;
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class DefineParamsDefaultValueAction extends PsiElementBaseIntentionActio
|
||||
}
|
||||
final PsiMethod method = (PsiMethod)parent;
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
|
||||
PsiElement e = ((CandidateInfo)c).getElement();
|
||||
if (!(e instanceof PsiMethod)) return false;
|
||||
PsiMethod m = (PsiMethod)e;
|
||||
return m.getParameterList().getParametersCount() == 0 && m.getName().equals(methodName);
|
||||
return m.getParameterList().isEmpty() && m.getName().equals(methodName);
|
||||
}) != null;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -347,7 +347,7 @@ public class CreateSubclassAction extends BaseIntentionAction {
|
||||
boolean hasNonTrivialConstructor = false;
|
||||
final PsiMethod[] constructors = psiClass.getConstructors();
|
||||
for (PsiMethod constructor : constructors) {
|
||||
if (constructor.getParameterList().getParametersCount() > 0) {
|
||||
if (!constructor.getParameterList().isEmpty()) {
|
||||
hasNonTrivialConstructor = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1078,7 +1078,7 @@ public class JavaDocInfoGenerator {
|
||||
PsiClass parentClass = method.getContainingClass();
|
||||
if (parentClass != null && parentClass.isEnum()) {
|
||||
PsiParameterList parameterList = method.getParameterList();
|
||||
if (method.getName().equals("values") && parameterList.getParametersCount() == 0) {
|
||||
if (method.getName().equals("values") && parameterList.isEmpty()) {
|
||||
return loadSyntheticDocComment(method, "/javadoc/EnumValues.java.template");
|
||||
}
|
||||
if (method.getName().equals("valueOf") &&
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CapturingCleanerInspection extends AbstractBaseJavaLocalInspectionT
|
||||
}
|
||||
if (runnableExpr instanceof PsiLambdaExpression) {
|
||||
PsiLambdaExpression lambda = (PsiLambdaExpression)runnableExpr;
|
||||
if (lambda.getParameterList().getParametersCount() != 0) return null;
|
||||
if (!lambda.getParameterList().isEmpty()) return null;
|
||||
PsiElement lambdaBody = lambda.getBody();
|
||||
if (lambdaBody == null) return null;
|
||||
return getLambdaElementCapturingThis(lambdaBody, trackedClass).orElse(null);
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ public class RedundantStreamOptionalCallInspection extends AbstractBaseJavaLocal
|
||||
if (aClass == null) return false;
|
||||
PsiType primitiveCandidate = null;
|
||||
PsiParameterList list = method.getParameterList();
|
||||
if (list.getParametersCount() == 0) {
|
||||
if (list.isEmpty()) {
|
||||
primitiveCandidate = method.getReturnType();
|
||||
}
|
||||
else if (list.getParametersCount() == 1) {
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class ReplaceInefficientStreamCountInspection extends AbstractBaseJavaLoc
|
||||
PsiMethodReferenceExpression methodRef = (PsiMethodReferenceExpression)function;
|
||||
if (!STREAM_METHOD.equals(methodRef.getReferenceName())) return false;
|
||||
PsiMethod method = ObjectUtils.tryCast(methodRef.resolve(), PsiMethod.class);
|
||||
if (method != null && STREAM_METHOD.equals(method.getName()) && method.getParameterList().getParametersCount() == 0) {
|
||||
if (method != null && STREAM_METHOD.equals(method.getName()) && method.getParameterList().isEmpty()) {
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass != null && CommonClassNames.JAVA_UTIL_COLLECTION.equals(containingClass.getQualifiedName())) {
|
||||
return true;
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ public class SimplifyOptionalCallChainsInspection extends AbstractBaseJavaLocalI
|
||||
else if (OPTIONAL_OR_ELSE_GET.test(call)) {
|
||||
useOrElseGet = true;
|
||||
PsiLambdaExpression lambda = getLambda(call.getArgumentList().getExpressions()[0]);
|
||||
if (lambda == null || lambda.getParameterList().getParametersCount() != 0) return;
|
||||
if (lambda == null || !lambda.getParameterList().isEmpty()) return;
|
||||
falseArg = LambdaUtil.extractSingleExpressionFromBody(lambda.getBody());
|
||||
}
|
||||
if (falseArg == null) return;
|
||||
@@ -184,7 +184,7 @@ public class SimplifyOptionalCallChainsInspection extends AbstractBaseJavaLocalI
|
||||
}
|
||||
if (OPTIONAL_OR_ELSE_GET.test(call)) {
|
||||
PsiLambdaExpression lambda = getLambda(call.getArgumentList().getExpressions()[0]);
|
||||
if (lambda == null || lambda.getParameterList().getParametersCount() != 0) return null;
|
||||
if (lambda == null || !lambda.getParameterList().isEmpty()) return null;
|
||||
return LambdaUtil.extractSingleExpressionFromBody(lambda.getBody());
|
||||
}
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -753,7 +753,7 @@ public class SimplifyStreamApiCallChainsInspection extends AbstractBaseJavaLocal
|
||||
PsiMethodReferenceExpression methodRef = tryCast(call.getArgumentList().getExpressions()[0], PsiMethodReferenceExpression.class);
|
||||
if (methodRef == null || !methodRef.isConstructor()) return null;
|
||||
PsiMethod ctor = tryCast(methodRef.resolve(), PsiMethod.class);
|
||||
if (ctor == null || ctor.getParameterList().getParametersCount() != 0) return null;
|
||||
if (ctor == null || !ctor.getParameterList().isEmpty()) return null;
|
||||
PsiClass aClass = ctor.getContainingClass();
|
||||
if (aClass == null) return null;
|
||||
String name = aClass.getQualifiedName();
|
||||
|
||||
@@ -270,7 +270,7 @@ public class JavaQualifiedNameProvider implements QualifiedNameProvider {
|
||||
}
|
||||
|
||||
int caretOffset = rangeMarker.getEndOffset();
|
||||
if (element instanceof PsiMethod && ((PsiMethod)element).getParameterList().getParametersCount() != 0 && StringUtil.endsWithChar(suffix,')')) {
|
||||
if (element instanceof PsiMethod && !((PsiMethod)element).getParameterList().isEmpty() && StringUtil.endsWithChar(suffix,')')) {
|
||||
caretOffset --;
|
||||
}
|
||||
editor.getCaretModel().moveToOffset(caretOffset);
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class ConvertToInstanceMethodHandler implements RefactoringActionHandler
|
||||
String className = containingClass.getName();
|
||||
PsiMethod[] constructors = containingClass.getConstructors();
|
||||
boolean noArgConstructor =
|
||||
constructors.length == 0 || Arrays.stream(constructors).anyMatch(constructor -> constructor.getParameterList().getParametersCount() == 0);
|
||||
constructors.length == 0 || Arrays.stream(constructors).anyMatch(constructor -> constructor.getParameterList().isEmpty());
|
||||
if (noArgConstructor) {
|
||||
targetQualifiers.add("this / new " + className + "()");
|
||||
}
|
||||
|
||||
+1
-1
@@ -598,7 +598,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
|
||||
}
|
||||
|
||||
private boolean notHasGeneratedFields() {
|
||||
return !myMultipleExitPoints && getMethod().getParameterList().getParametersCount() == 0;
|
||||
return !myMultipleExitPoints && getMethod().getParameterList().isEmpty();
|
||||
}
|
||||
|
||||
private void createInnerClassConstructor(final PsiParameter[] parameters) throws IncorrectOperationException {
|
||||
|
||||
+1
-1
@@ -204,7 +204,7 @@ public class InlineToAnonymousClassProcessor extends BaseRefactoringProcessor {
|
||||
final PsiElement resolved = methodExpression.resolve();
|
||||
if (resolved instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)resolved;
|
||||
if ("getClass".equals(method.getName()) && method.getParameterList().getParametersCount() == 0) {
|
||||
if ("getClass".equals(method.getName()) && method.getParameterList().isEmpty()) {
|
||||
result.putValue(methodExpression, "Result of getClass() invocation would be changed");
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -41,7 +41,6 @@ import com.intellij.usageView.UsageViewDescriptor;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import java.util.HashMap;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -193,7 +192,7 @@ public class InlineSuperClassRefactoringProcessor extends FixableUsagesRefactori
|
||||
|
||||
//insert implicit call to super
|
||||
for (PsiMethod superConstructor : superConstructors) {
|
||||
if (superConstructor.getParameterList().getParametersCount() == 0) {
|
||||
if (superConstructor.getParameterList().isEmpty()) {
|
||||
final PsiExpression expression = JavaPsiFacade.getElementFactory(myProject).createExpressionFromText("super()", constructor);
|
||||
usages.add(new InlineSuperCallUsageInfo((PsiMethodCallExpression)expression, constrBody));
|
||||
}
|
||||
@@ -203,7 +202,7 @@ public class InlineSuperClassRefactoringProcessor extends FixableUsagesRefactori
|
||||
if (targetClass.getConstructors().length == 0) {
|
||||
//copy default constructor
|
||||
for (PsiMethod superConstructor : superConstructors) {
|
||||
if (superConstructor.getParameterList().getParametersCount() == 0) {
|
||||
if (superConstructor.getParameterList().isEmpty()) {
|
||||
usages.add(new CopyDefaultConstructorUsageInfo(targetClass, superConstructor));
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.refactoring.util.FixableUsageInfo;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
|
||||
public class ReplaceConstructorUsageInfo extends FixableUsageInfo{
|
||||
@@ -35,7 +34,7 @@ public class ReplaceConstructorUsageInfo extends FixableUsageInfo{
|
||||
final PsiMethod constructor = element.resolveConstructor();
|
||||
if (constructor == null) {
|
||||
if (element.getArgumentList() != null) {
|
||||
if (constructors.length == 1 && constructors[0].getParameterList().getParametersCount() > 0 || constructors.length > 1) {
|
||||
if (constructors.length == 1 && !constructors[0].getParameterList().isEmpty() || constructors.length > 1) {
|
||||
myConflict = CONSTRUCTOR_MATCHING_SUPER_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.intellij.refactoring.util.classMembers.ClassMemberReferencesVisitor;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
import java.util.HashMap;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
@@ -655,7 +654,7 @@ public class JavaPullUpHelper implements PullUpHelper<MemberInfo> {
|
||||
}
|
||||
|
||||
// check default constructor
|
||||
if (constructor == null || constructor.getParameterList().getParametersCount() == 0) {
|
||||
if (constructor == null || constructor.getParameterList().isEmpty()) {
|
||||
RefactoringUtil.visitImplicitSuperConstructorUsages(mySourceClass, new RefactoringUtil.ImplicitConstructorUsageVisitor() {
|
||||
public void visitConstructor(PsiMethod constructor, PsiMethod baseConstructor) {
|
||||
referencingSubConstructors.add(constructor);
|
||||
|
||||
+5
-3
@@ -18,7 +18,6 @@ package com.intellij.refactoring.replaceConstructorWithBuilder;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.ide.util.PackageUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -30,7 +29,10 @@ import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.VariableKind;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.*;
|
||||
import com.intellij.psi.util.PropertyUtilBase;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.refactoring.MoveDestination;
|
||||
import com.intellij.refactoring.replaceConstructorWithBuilder.usageInfo.ReplaceConstructorWithSettersChainInfo;
|
||||
import com.intellij.refactoring.util.FixableUsageInfo;
|
||||
@@ -250,7 +252,7 @@ public class ReplaceConstructorWithBuilderProcessor extends FixableUsagesRefacto
|
||||
PsiMethod constructor = getMostCommonConstructor();
|
||||
if (constructor == null){
|
||||
constructor = myConstructors[0];
|
||||
if (constructor.getParameterList().getParametersCount() == 0) {
|
||||
if (constructor.getParameterList().isEmpty()) {
|
||||
constructor = myConstructors[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ import com.intellij.usages.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import java.util.HashMap;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -773,7 +772,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
|
||||
}
|
||||
|
||||
private static boolean isTheOnlyEmptyDefaultConstructor(final PsiMethod constructor) {
|
||||
if (constructor.getParameterList().getParameters().length > 0) return false;
|
||||
if (!constructor.getParameterList().isEmpty()) return false;
|
||||
final PsiCodeBlock body = constructor.getBody();
|
||||
if (body != null && body.getStatements().length > 0) return false;
|
||||
return constructor.getContainingClass().getConstructors().length == 1;
|
||||
|
||||
@@ -50,8 +50,6 @@ import com.intellij.refactoring.introduceField.ElementToWorkOn;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import com.intellij.util.text.UniqueNameGenerator;
|
||||
import gnu.trove.THashMap;
|
||||
import one.util.streamex.StreamEx;
|
||||
@@ -757,7 +755,7 @@ public class RefactoringUtil {
|
||||
private static PsiMethod findDefaultConstructor(final PsiClass aClass) {
|
||||
final PsiMethod[] constructors = aClass.getConstructors();
|
||||
for (PsiMethod constructor : constructors) {
|
||||
if (constructor.getParameterList().getParametersCount() == 0) return constructor;
|
||||
if (constructor.getParameterList().isEmpty()) return constructor;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class MethodUsagesSearcher extends QueryExecutorBase<PsiReference, Method
|
||||
methodName[0] = method.getName();
|
||||
isValueAnnotation[0] = PsiUtil.isAnnotationMethod(method) &&
|
||||
PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals(methodName[0]) &&
|
||||
method.getParameterList().getParametersCount() == 0;
|
||||
method.getParameterList().isEmpty();
|
||||
needStrictSignatureSearch[0] = strictSignatureSearch && (aClass1 instanceof PsiAnonymousClass
|
||||
|| aClass1.hasModifierProperty(PsiModifier.FINAL)
|
||||
|| method.hasModifierProperty(PsiModifier.STATIC)
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class PsiAnnotationMethodReferencesSearcher implements QueryExecutor<PsiR
|
||||
final PsiMethod method = (PsiMethod)refElement;
|
||||
PsiClass containingClass = ReadAction.compute(() -> {
|
||||
boolean isValueMethod =
|
||||
PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals(method.getName()) && method.getParameterList().getParametersCount() == 0;
|
||||
PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals(method.getName()) && method.getParameterList().isEmpty();
|
||||
return isValueMethod ? method.getContainingClass() : null;
|
||||
});
|
||||
if (containingClass != null) {
|
||||
|
||||
@@ -41,4 +41,12 @@ public interface PsiParameterList extends PsiElement {
|
||||
* Returns the number of parameters (excluding type annotation receiver).
|
||||
*/
|
||||
int getParametersCount();
|
||||
|
||||
/**
|
||||
* @return true if this parameter list has no parameters (excluding type annotation receiver).
|
||||
* @since 2018.1
|
||||
*/
|
||||
default boolean isEmpty() {
|
||||
return getParametersCount() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public class PropertyUtilBase {
|
||||
|
||||
@Contract("null -> false")
|
||||
public static boolean isSimplePropertyGetter(@Nullable PsiMethod method) {
|
||||
return hasGetterName(method) && method.getParameterList().getParametersCount() == 0;
|
||||
return hasGetterName(method) && method.getParameterList().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.EmptyIterable;
|
||||
import java.util.HashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -1029,7 +1028,7 @@ public final class PsiUtil extends PsiUtilCore {
|
||||
for (PsiMethod cls: constructors) {
|
||||
if ((!checkModifiers || cls.hasModifierProperty(PsiModifier.PUBLIC) ||
|
||||
allowProtected && cls.hasModifierProperty(PsiModifier.PROTECTED)) &&
|
||||
cls.getParameterList().getParametersCount() == 0) {
|
||||
cls.getParameterList().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ public class ExceptionUtil {
|
||||
final PsiMethod[] superConstructors = superClass == null ? PsiMethod.EMPTY_ARRAY : superClass.getConstructors();
|
||||
Set<PsiClassType> unhandled = new HashSet<>();
|
||||
for (PsiMethod superConstructor : superConstructors) {
|
||||
if (!superConstructor.hasModifierProperty(PsiModifier.PRIVATE) && superConstructor.getParameterList().getParametersCount() == 0) {
|
||||
if (!superConstructor.hasModifierProperty(PsiModifier.PRIVATE) && superConstructor.getParameterList().isEmpty()) {
|
||||
final PsiClassType[] exceptionTypes = superConstructor.getThrowsList().getReferencedTypes();
|
||||
for (PsiClassType exceptionType : exceptionTypes) {
|
||||
if (!isUncheckedException(exceptionType) && !isHandled(element, exceptionType, topElement)) {
|
||||
|
||||
@@ -471,7 +471,7 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
|
||||
public static boolean hasDefaultConstructor(@NotNull final PsiClass psiClass) {
|
||||
final PsiMethod[] constructors = psiClass.getConstructors();
|
||||
for (PsiMethod method : constructors) {
|
||||
if (method.getParameterList().getParametersCount() == 0) return true;
|
||||
if (method.getParameterList().isEmpty()) return true;
|
||||
}
|
||||
return constructors.length == 0;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,16 @@ public class PsiParameterListImpl extends JavaStubPsiElement<PsiParameterListStu
|
||||
return getNode().countChildren(Constants.PARAMETER_BIT_SET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
final PsiParameterListStub stub = getGreenStub();
|
||||
if (stub != null) {
|
||||
return stub.getChildrenStubs().stream().noneMatch(child -> child.getStubType() == JavaStubElementTypes.PARAMETER);
|
||||
}
|
||||
|
||||
return getNode().findChildByType(Constants.PARAMETER_BIT_SET) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor){
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class MethodParenthesesHandler extends ParenthesesInsertHandler<LookupEle
|
||||
}
|
||||
|
||||
public static boolean hasParams(LookupElement item, LookupElement[] allItems, final boolean overloadsMatter, final PsiMethod method) {
|
||||
boolean hasParams = method.getParameterList().getParametersCount() > 0;
|
||||
boolean hasParams = !method.getParameterList().isEmpty();
|
||||
if (overloadsMatter){
|
||||
hasParams |= hasOverloads(allItems, method);
|
||||
}
|
||||
|
||||
+1
-1
@@ -369,7 +369,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
final PsiLambdaExpression expression2 = (PsiLambdaExpression)other;
|
||||
boolean result = true;
|
||||
final PsiParameterList parameterList1 = expression.getParameterList();
|
||||
if (parameterList1.getParametersCount() != 0) {
|
||||
if (!parameterList1.isEmpty()) {
|
||||
result = myMatchingVisitor.matchSons(parameterList1, expression2.getParameterList());
|
||||
}
|
||||
final PsiElement body1 = getElementToMatch(expression.getBody());
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class ListArrayConversionRule extends TypeConversionRule {
|
||||
PsiArrayType arrayType) {
|
||||
@NonNls final String methodName = method.getName();
|
||||
if (methodName.equals("toArray")) {
|
||||
if (method.getParameterList().getParameters().length == 0) {
|
||||
if (method.getParameterList().isEmpty()) {
|
||||
return new TypeConversionDescriptor("$qualifier$.toArray()", "$qualifier$");
|
||||
}
|
||||
return new TypeConversionDescriptor("$qualifier$.toArray($expr$)", "$qualifier$");
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class GuavaPredicatesUtil {
|
||||
if (method == null) return false;
|
||||
final PsiParameterList parameters = method.getParameterList();
|
||||
if (parameters.getParametersCount() != 1) {
|
||||
return parameters.getParametersCount() != 0;
|
||||
return !parameters.isEmpty();
|
||||
}
|
||||
final PsiParameter parameter = parameters.getParameters()[0];
|
||||
final PsiType type = parameter.getType();
|
||||
|
||||
+3
-2
@@ -20,7 +20,8 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiClassType;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.siyeh.InspectionGadgetsBundle;import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -57,7 +58,7 @@ public class InterfaceMethodClashesWithObjectInspection extends BaseInspection {
|
||||
@Override
|
||||
public void visitMethod(PsiMethod method) {
|
||||
super.visitMethod(method);
|
||||
if (method.getParameterList().getParametersCount() != 0) {
|
||||
if (!method.getParameterList().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ public class ObjectToStringInspection extends BaseInspection {
|
||||
continue;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ public class PublicConstructorInNonPublicClassInspection extends BaseInspection
|
||||
}
|
||||
if (SerializationUtils.isExternalizable(containingClass)) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class PublicConstructorInspectionBase extends BaseInspection {
|
||||
}
|
||||
if (SerializationUtils.isExternalizable(aClass)) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class UtilityClassWithoutPrivateConstructorInspectionBase extends BaseIns
|
||||
final PsiMethod[] constructors = aClass.getConstructors();
|
||||
for (final PsiMethod constructor : constructors) {
|
||||
final PsiParameterList params = constructor.getParameterList();
|
||||
if (params.getParametersCount() == 0) {
|
||||
if (params.isEmpty()) {
|
||||
return constructor;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class ConvertToVarargsMethodFix extends InspectionGadgetsFix {
|
||||
|
||||
private static void makeMethodVarargs(PsiMethod method) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiParameter[] parameters = parameterList.getParameters();
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ public class RefusedBequestInspectionBase extends BaseInspection {
|
||||
if (!"setUp".equals(name) && !"tearDown".equals(name)) {
|
||||
return false;
|
||||
}
|
||||
if (method.getParameterList().getParametersCount() != 0) {
|
||||
if (!method.getParameterList().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ public class InstanceVariableInitializationInspection extends BaseInspection {
|
||||
}
|
||||
final PsiParameterList parameterList =
|
||||
method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (PsiType.VOID.equals(method.getReturnType())) {
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class NumericToStringInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ public class TimeToStringInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class ClassWithoutNoArgConstructorInspection extends BaseInspection {
|
||||
for (final PsiMethod constructor : constructors) {
|
||||
final PsiParameterList parameterList =
|
||||
constructor.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class BeforeClassOrAfterClassIsPublicStaticVoidNoArgInspectionBase extend
|
||||
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
boolean junit4Annotation = isJunit4Annotation(annotation);
|
||||
if (junit4Annotation && (parameterList.getParametersCount() != 0 || !method.hasModifierProperty(PsiModifier.PUBLIC)) ||
|
||||
if (junit4Annotation && (!parameterList.isEmpty() || !method.hasModifierProperty(PsiModifier.PUBLIC)) ||
|
||||
!returnType.equals(PsiType.VOID) ||
|
||||
!method.hasModifierProperty(PsiModifier.STATIC) && (junit4Annotation || !TestUtils.testInstancePerClass(targetClass))) {
|
||||
registerMethodError(method, method, annotation);
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class BeforeOrAfterIsPublicVoidNoArgInspectionBase extends BaseInspection
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0 || !returnType.equals(PsiType.VOID) ||
|
||||
if (!parameterList.isEmpty() || !returnType.equals(PsiType.VOID) ||
|
||||
!method.hasModifierProperty(PsiModifier.PUBLIC) || method.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
registerMethodError(method, method);
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class JUnit5PlatformInspection extends BaseInspection {
|
||||
final PsiClass runnerClass = PsiUtil.resolveClassInClassTypeOnly(operand.getType());
|
||||
if (runnerClass != null && "org.junit.platform.runner.JUnitPlatform".equals(runnerClass.getQualifiedName()) &&
|
||||
Arrays.stream(aClass.getMethods()).noneMatch(method -> method.hasModifierProperty(PsiModifier.PUBLIC) &&
|
||||
method.getParameterList().getParametersCount() == 0 &&
|
||||
method.getParameterList().isEmpty() &&
|
||||
AnnotationUtil.isAnnotated(method, "org.junit.Test", 0))) {
|
||||
registerError(nameIdentifier, "Class #ref annotated @RunWith(JUnitPlatform.class) lacks test methods");
|
||||
}
|
||||
|
||||
+5
-2
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.junit;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
@@ -59,7 +62,7 @@ public class MalformedSetUpTearDownInspection extends BaseInspection {
|
||||
if (!InheritanceUtil.isInheritor(targetClass, JUnitCommonClassNames.JUNIT_FRAMEWORK_TEST_CASE)) {
|
||||
return;
|
||||
}
|
||||
if (method.getParameterList().getParametersCount() != 0 ||
|
||||
if (!method.getParameterList().isEmpty() ||
|
||||
!PsiType.VOID.equals(method.getReturnType()) ||
|
||||
!method.hasModifierProperty(PsiModifier.PUBLIC) &&
|
||||
!method.hasModifierProperty(PsiModifier.PROTECTED)) {
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class StaticSuiteInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (method.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
|
||||
+4
-2
@@ -23,7 +23,9 @@ import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.psiutils.TestUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.codeInsight.AnnotationUtil.CHECK_HIERARCHY;
|
||||
|
||||
@@ -88,7 +90,7 @@ public class TestMethodIsPublicVoidNoArgInspectionBase extends BaseInspection {
|
||||
registerMethodError(method, Problem.STATIC, method);
|
||||
return;
|
||||
}
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
final PsiParameter[] parameters = parameterList.getParameters();
|
||||
boolean annotated = true;
|
||||
for (PsiParameter parameter : parameters) {
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class UnconstructableTestCaseInspection extends BaseInspection {
|
||||
if (constructors.length == 1) {
|
||||
final PsiMethod constructor = constructors[0];
|
||||
final PsiParameterList parameterList = constructor.getParameterList();
|
||||
if (constructor.hasModifierProperty(PsiModifier.PUBLIC) && parameterList.getParametersCount() == 0) {
|
||||
if (constructor.hasModifierProperty(PsiModifier.PUBLIC) && parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class SystemGCInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class ParameterNameDiffersFromOverriddenParameterInspectionBase extends B
|
||||
@Override
|
||||
public void visitMethod(@NotNull PsiMethod method) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiMethod superMethod = MethodUtils.getSuper(method);
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ public class StringBufferToStringInConcatenationInspection extends BaseInspectio
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
|
||||
+2
-2
@@ -102,7 +102,7 @@ public class ConstructionUtils {
|
||||
PsiExpressionList argumentList = call.getArgumentList();
|
||||
if(name != null && name.startsWith("new") && argumentList.isEmpty()) {
|
||||
PsiMethod method = call.resolveMethod();
|
||||
if(method != null && method.getParameterList().getParametersCount() == 0) {
|
||||
if(method != null && method.getParameterList().isEmpty()) {
|
||||
PsiClass aClass = method.getContainingClass();
|
||||
if(aClass != null) {
|
||||
String qualifiedName = aClass.getQualifiedName();
|
||||
@@ -147,7 +147,7 @@ public class ConstructionUtils {
|
||||
PsiExpressionList argumentList = call.getArgumentList();
|
||||
if (name != null && name.startsWith("new") && !argumentList.isEmpty()) {
|
||||
PsiMethod method = call.resolveMethod();
|
||||
if (method != null && method.getParameterList().getParametersCount() > 0) {
|
||||
if (method != null && !method.getParameterList().isEmpty()) {
|
||||
PsiClass aClass = method.getContainingClass();
|
||||
if (aClass != null) {
|
||||
String qualifiedName = aClass.getQualifiedName();
|
||||
|
||||
+2
-2
@@ -87,7 +87,7 @@ public class TestUtils {
|
||||
return false;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
return parameterList.getParametersCount() == 0;
|
||||
return parameterList.isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isJUnit3TestMethod(@Nullable PsiMethod method) {
|
||||
@@ -97,7 +97,7 @@ public class TestUtils {
|
||||
final String methodName = method.getName();
|
||||
@NonNls final String test = "test";
|
||||
if (!methodName.startsWith(test) ||
|
||||
!method.hasModifierProperty(PsiModifier.PUBLIC) && method.getParameterList().getParametersCount() > 0) {
|
||||
!method.hasModifierProperty(PsiModifier.PUBLIC) && !method.getParameterList().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
|
||||
+4
-2
@@ -24,8 +24,10 @@ import com.intellij.psi.search.searches.DirectClassInheritorsSearch;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.search.searches.SuperMethodsSearch;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Query;
|
||||
import com.siyeh.HardcodedMethodConstants;
|
||||
@@ -267,7 +269,7 @@ public class WeakestTypeFinder {
|
||||
return false;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final PsiParameter[] parameters = parameterList.getParameters();
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class ExternalizableWithoutPublicNoArgConstructorInspectionBase extends B
|
||||
final PsiMethod[] constructors = aClass.getConstructors();
|
||||
for (PsiMethod constructor : constructors) {
|
||||
final PsiParameterList parameterList = constructor.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return constructor;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.siyeh.ig.serialization;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
import com.intellij.psi.PsiParameterList;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -84,7 +87,7 @@ public class SerializableWithUnconstructableAncestorInspection extends BaseInspe
|
||||
for (final PsiMethod constructor : aClass.getConstructors()) {
|
||||
hasConstructor = true;
|
||||
final PsiParameterList parameterList = constructor.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0 &&
|
||||
if (parameterList.isEmpty() &&
|
||||
(constructor.hasModifierProperty(PsiModifier.PUBLIC) || constructor.hasModifierProperty(PsiModifier.PROTECTED))) {
|
||||
hasNoArgConstructor = true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ public class SizeReplaceableByIsEmptyInspectionBase extends BaseInspection {
|
||||
final PsiMethod[] methods = aClass.findMethodsByName("isEmpty", true);
|
||||
for (PsiMethod method : methods) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return qualifierExpression.getText() + ".isEmpty()";
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ public class UnnecessaryConstructorInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
final PsiParameterList parameterList = constructor.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (ignoreAnnotations) {
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class ThreadRunInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass methodClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class ThreadStartInConstructionInspection extends BaseInspection {
|
||||
}
|
||||
final PsiParameterList parameterList =
|
||||
method.getParameterList();
|
||||
if (parameterList.getParametersCount() != 0) {
|
||||
if (!parameterList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final PsiClass methodClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public class ThreadWithDefaultRunMethodInspection extends BaseInspection {
|
||||
final PsiMethod[] methods = aClass.findMethodsByName(HardcodedMethodConstants.RUN, false);
|
||||
for (final PsiMethod method : methods) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ public class UtilityClassWithoutPrivateConstructorInspection extends UtilityClas
|
||||
final PsiMethod[] constructors = aClass.getConstructors();
|
||||
for (final PsiMethod constructor : constructors) {
|
||||
final PsiParameterList parameterList = constructor.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
if (parameterList.isEmpty()) {
|
||||
final PsiModifierList modifiers = constructor.getModifierList();
|
||||
modifiers.setModifierProperty(PsiModifier.PUBLIC, false);
|
||||
modifiers.setModifierProperty(PsiModifier.PROTECTED, false);
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ public class CatchMayIgnoreExceptionInspection extends AbstractBaseJavaLocalInsp
|
||||
myExceptionVar = exceptionVar;
|
||||
myMethods = StreamEx.of("getMessage", "getLocalizedMessage", "getCause")
|
||||
.flatArray(name -> exceptionClass.findMethodsByName(name, true))
|
||||
.filter(m -> m.getParameterList().getParametersCount() == 0)
|
||||
.filter(m -> m.getParameterList().isEmpty())
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ public class JUnit4AnnotatedMethodInJUnit3TestCaseInspection extends JUnit4Annot
|
||||
@NonNls final String name = method.getName();
|
||||
if (!method.hasModifierProperty(PsiModifier.STATIC) &&
|
||||
PsiType.VOID.equals(method.getReturnType()) &&
|
||||
method.getParameterList().getParametersCount() == 0) {
|
||||
method.getParameterList().isEmpty()) {
|
||||
final PsiModifierList modifierList = method.getModifierList();
|
||||
if (name.startsWith("test")) {
|
||||
addAnnotationIfNotPresent(modifierList, "org.junit.Test");
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class JUnit5AssertionsConverterInspection extends BaseInspection {
|
||||
|
||||
private boolean absentInJUnit5(PsiMethod psiMethod, String methodName) {
|
||||
if ("fail".equals(methodName)) {
|
||||
return psiMethod.getParameterList().getParametersCount() == 0;
|
||||
return psiMethod.getParameterList().isEmpty();
|
||||
}
|
||||
if ("assertNotEquals".equals(methodName)) {
|
||||
PsiParameter[] parameters = psiMethod.getParameterList().getParameters();
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ public class DataPointHolderConversionIntention extends PsiElementBaseIntentionA
|
||||
}
|
||||
final PsiMethod method = (PsiMethod)member;
|
||||
final PsiType returnType = method.getReturnType();
|
||||
if (returnType == null || returnType.equals(PsiType.VOID) || method.getParameterList().getParametersCount() != 0) {
|
||||
if (returnType == null || returnType.equals(PsiType.VOID) || !method.getParameterList().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final PsiCodeBlock body = method.getBody();
|
||||
|
||||
@@ -155,7 +155,7 @@ class LanguageResolvingUtil {
|
||||
|
||||
PsiMethod defaultConstructor = null;
|
||||
for (PsiMethod constructor : languagePsiClass.getConstructors()) {
|
||||
if (constructor.getParameterList().getParametersCount() == 0) {
|
||||
if (constructor.getParameterList().isEmpty()) {
|
||||
defaultConstructor = constructor;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class QuickFixGetFamilyNameViolationInspection extends DevKitInspectionBa
|
||||
@Override
|
||||
public ProblemDescriptor[] checkMethod(@NotNull PsiMethod method, @NotNull InspectionManager manager, boolean isOnTheFly) {
|
||||
if ("getFamilyName".equals(method.getName()) &&
|
||||
method.getParameterList().getParametersCount() == 0 &&
|
||||
method.getParameterList().isEmpty() &&
|
||||
!method.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
if (InheritanceUtil.isInheritor(aClass, QuickFix.class.getName()) && doesMethodViolate(method, new THashSet<>())) {
|
||||
|
||||
@@ -384,7 +384,7 @@ public class RegistrationProblemsInspection extends DevKitInspectionBase {
|
||||
final PsiMethod[] constructors = checkedClass.getConstructors();
|
||||
if (constructors.length > 0) {
|
||||
for (PsiMethod ctor : constructors) {
|
||||
if (ctor.getParameterList().getParametersCount() == 0) {
|
||||
if (ctor.getParameterList().isEmpty()) {
|
||||
return new ConstructorType(ctor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class PsiUtil {
|
||||
if (constructors.length == 0) return true;
|
||||
|
||||
for (PsiMethod constructor : constructors) {
|
||||
if (constructor.getParameterList().getParameters().length == 0
|
||||
if (constructor.getParameterList().isEmpty()
|
||||
&& constructor.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
return true;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class PsiUtil {
|
||||
public static PsiMethod findNearestMethod(String name, @Nullable PsiClass cls) {
|
||||
if (cls == null) return null;
|
||||
for (PsiMethod method : cls.getMethods()) {
|
||||
if (method.getParameterList().getParametersCount() == 0 && method.getName().equals(name)) {
|
||||
if (method.getParameterList().isEmpty() && method.getName().equals(name)) {
|
||||
return method.getModifierList().hasModifierProperty(PsiModifier.ABSTRACT) ? null : method;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -31,7 +31,6 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import java.util.HashSet;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -740,7 +739,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
|
||||
if (byName.length == 0) return null;
|
||||
Outer:
|
||||
for (PsiMethod method : byName) {
|
||||
if (method.getParameterList().getParametersCount() == 0) return method;
|
||||
if (method.getParameterList().isEmpty()) return method;
|
||||
if (!(method instanceof GrMethod)) continue;
|
||||
final GrParameter[] parameters = ((GrMethod)method).getParameterList().getParameters();
|
||||
|
||||
|
||||
+2
-2
@@ -132,7 +132,7 @@ public class GroovyConditionalCanBeElvisInspection extends BaseInspection {
|
||||
|
||||
return resolved instanceof PsiMethod &&
|
||||
"isEmpty".equals(((PsiMethod)resolved).getName()) &&
|
||||
((PsiMethod)resolved).getParameterList().getParametersCount() == 0;
|
||||
((PsiMethod)resolved).getParameterList().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +166,7 @@ public class GroovyConditionalCanBeElvisInspection extends BaseInspection {
|
||||
|
||||
return resolved instanceof PsiMethod &&
|
||||
"isEmpty".equals(((PsiMethod)resolved).getName()) &&
|
||||
((PsiMethod)resolved).getParameterList().getParametersCount() == 0;
|
||||
((PsiMethod)resolved).getParameterList().isEmpty();
|
||||
}
|
||||
|
||||
private static boolean checkForNull(GrExpression condition, GrExpression then) {
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ public class GDKSuperMethodSearcher implements QueryExecutor<MethodSignatureBack
|
||||
|
||||
private static PsiMethod getRealMethod(PsiMethod method) {
|
||||
final PsiElement element = method.getNavigationElement();
|
||||
if (element instanceof PsiMethod && ((PsiMethod)element).getParameterList().getParametersCount() > 0) {
|
||||
if (element instanceof PsiMethod && !((PsiMethod)element).getParameterList().isEmpty()) {
|
||||
return (PsiMethod)element;
|
||||
}
|
||||
else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user