当前位置: 首页>>代码示例>>Java>>正文


Java PsiMethod.getParameterList方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiMethod.getParameterList方法的典型用法代码示例。如果您正苦于以下问题:Java PsiMethod.getParameterList方法的具体用法?Java PsiMethod.getParameterList怎么用?Java PsiMethod.getParameterList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiMethod的用法示例。


在下文中一共展示了PsiMethod.getParameterList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  super.visitMethod(method);
  final String name = method.getName();
  if (!HardcodedMethodConstants.CLONE.equals(name)) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() != 0) {
    return;
  }
  if (method.hasModifierProperty(PsiModifier.FINAL)
      || method.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return;
  }
  final PsiClass containingClass = method.getContainingClass();
  if (containingClass == null) {
    return;
  }
  if (containingClass.hasModifierProperty(PsiModifier.FINAL)
      || containingClass.isInterface()) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NonFinalCloneInspection.java

示例2: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //note: no call to super
  @NonNls final String methodName = method.getName();
  if (!"suite".equals(methodName)) {
    return;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return;
  }
  if (!InheritanceUtil.isInheritor(aClass,
                                   "junit.framework.TestCase")) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() != 0) {
    return;
  }
  if (method.hasModifierProperty(PsiModifier.STATIC)) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:StaticSuiteInspection.java

示例3: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
  super.visitMethod(method);
  if (!method.isConstructor()) {
    return;
  }
  if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
    return;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return;
  }
  if (SerializationUtils.isExternalizable(aClass)) {
    final PsiParameterList parameterList = method.getParameterList();
    if (parameterList.getParametersCount() == 0) {
      return;
    }
  }
  registerMethodError(method, Boolean.FALSE);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PublicConstructorInspectionBase.java

示例4: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() == 0) {
    return;
  }
  final Query<MethodSignatureBackedByPsiMethod> query =
    SuperMethodsSearch.search(
      method, method.getContainingClass(), true, false);
  final MethodSignatureBackedByPsiMethod methodSignature =
    query.findFirst();
  if (methodSignature == null) {
    return;
  }
  final PsiMethod superMethod = methodSignature.getMethod();
  final PsiParameter[] parameters = parameterList.getParameters();
  checkParameters(superMethod, parameters);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ParameterNameDiffersFromOverriddenParameterInspectionBase.java

示例5: visitMethodCallExpression

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethodCallExpression(
  @NotNull PsiMethodCallExpression expression) {
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  final String methodName = methodExpression.getReferenceName();
  if (!HardcodedMethodConstants.NOTIFY.equals(methodName) &&
      !HardcodedMethodConstants.NOTIFY_ALL.equals(methodName)) {
    return;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() != 0) {
    return;
  }
  if (SynchronizationUtil.isInSynchronizedContext(expression)) {
    return;
  }
  registerMethodCallError(expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:NotifyNotInSynchronizedContextInspection.java

示例6: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  if (!method.isConstructor()) {
    return;
  }
  if (ignoreScope != Scope.NONE) {
    switch (ignoreScope.ordinal()) {
      case 3: if (method.hasModifierProperty(PsiModifier.PROTECTED)) return;
      case 2: if (method.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) return;
      case 1: if (method.hasModifierProperty(PsiModifier.PRIVATE)) return;
    }
  }
  final PsiParameterList parameterList = method.getParameterList();
  final int parametersCount = parameterList.getParametersCount();
  if (parametersCount <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(parametersCount));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ParametersPerConstructorInspectionBase.java

示例7: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  if (method.isConstructor()) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  final int parametersCount = parameterList.getParametersCount();
  if (parametersCount <= getLimit()) {
    return;
  }
  if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
    return;
  }
  registerMethodError(method, Integer.valueOf(parametersCount));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ParametersPerMethodInspection.java

示例8: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
public void visitMethod(JavaContext context, PsiMethod method) {

        boolean isPublicMethod = method.hasModifierProperty(PsiModifier.PUBLIC);
        if (!isPublicMethod) return;

        JavaEvaluator evaluator = context.getEvaluator();
        if (evaluator == null) return;

        PsiParameterList parameterList = method.getParameterList();
        PsiParameter[] psiParameters = parameterList.getParameters();

        boolean hasBeanParameter = false;
        for (PsiParameter p : psiParameters) {
            PsiType type = p.getType();

            if (!(type instanceof PsiClassType)) continue;

            PsiClassType classType = (PsiClassType) type;
            PsiClass psiCls = classType.resolve();
            if (psiCls == null) continue;

            hasBeanParameter = Utils.isCustomBean(context, psiCls);
            if (hasBeanParameter) break;
        }

        if (hasBeanParameter) {
            mMethods.add(method);
        }
    }
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:30,代码来源:AutoPointCustomViewGroupDetector.java

示例9: getParameters

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
/**
 * メソッドパラメータ取得
 * @param method ルートノード
 * @return メソッドバラメータのリスト (空要素の場合もあります)
 */
public static @NonNull List<PsiParameter> getParameters(@NonNull PsiMethod method) {
    List<PsiParameter> parameterList;
    PsiParameterList parameters = method.getParameterList();
    PsiParameter[] params = parameters.getParameters();
    parameterList = Arrays.asList(params);
    return parameterList;
}
 
开发者ID:cch-robo,项目名称:Android_Lint_SRP_Practice_Example,代码行数:13,代码来源:ElementUtil.java

示例10: invoke

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement psiElement) throws IncorrectOperationException {
    if(psiElement == null) {
        return;
    }
    final PsiCallExpression call = findParent(PsiCallExpression.class, psiElement);
    if(call == null) {
        return;
    }

    final PsiMethod psiMethod = call.resolveMethod();
    if(psiMethod == null) {
        return;
    }
    final PsiParameterList parameterList = psiMethod.getParameterList();
    if(parameterList == null) {
        return;
    }
    final PsiParameter[] params = parameterList.getParameters();
    if(params == null) {
        return;
    }
    String prefix = "";
    int offset = editor.getCaretModel().getOffset();
    final Document doc = editor.getDocument();
    for(final PsiParameter p : params) {
        doc.insertString(offset, prefix+p.getName());
        offset += p.getName().length() + prefix.length();
        prefix = ", ";
    }
    editor.getCaretModel().moveToOffset(offset + 1);
}
 
开发者ID:kontext-e,项目名称:AutoFillingCallArguments,代码行数:33,代码来源:AutoFillCallArguments.java

示例11: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //note: no call to super;
  if (method.isConstructor()) {
    return;
  }
  if (!TestUtils.isJUnit3TestMethod(method) && !TestUtils.isJUnit4TestMethod(method)) {
    return;
  }
  final PsiType returnType = method.getReturnType();
  final PsiParameterList parameterList = method.getParameterList();
  final boolean takesArguments;
  final boolean isStatic;
  if (parameterList.getParametersCount() == 0) {
    takesArguments = false;
    isStatic = method.hasModifierProperty(PsiModifier.STATIC);
    if (!isStatic && PsiType.VOID.equals(returnType) && method.hasModifierProperty(PsiModifier.PUBLIC)) {
      return;
    }
  }
  else {
    isStatic = false;
    takesArguments = true;
  }
  registerMethodError(method, Boolean.valueOf(takesArguments),
                      Boolean.valueOf(isStatic));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:TestMethodIsPublicVoidNoArgInspection.java

示例12: checkParameters

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
private void checkParameters(PsiMethod superMethod,
                             PsiParameter[] parameters) {
  if (m_ignoreOverridesOfLibraryMethods) {
    final PsiClass containingClass =
      superMethod.getContainingClass();
    if (containingClass != null &&
        LibraryUtil.classIsInLibrary(containingClass)) {
      return;
    }
  }
  final PsiParameterList superParameterList =
    superMethod.getParameterList();
  final PsiParameter[] superParameters =
    superParameterList.getParameters();
  for (int i = 0; i < parameters.length; i++) {
    final PsiParameter parameter = parameters[i];
    final String parameterName = parameter.getName();
    final String superParameterName = superParameters[i].getName();
    if (superParameterName == null) {
      continue;
    }
    if (superParameterName.equals(parameterName)) {
      continue;
    }
    if (m_ignoreSingleCharacterNames &&
        superParameterName.length() == 1) {
      continue;
    }
    registerVariableError(parameter, superParameterName);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:ParameterNameDiffersFromOverriddenParameterInspectionBase.java

示例13: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //note: no call to super
  @NonNls final String methodName = method.getName();
  if (!"tostring".equals(methodName)) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() != 0) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MisspelledToStringInspectionBase.java

示例14: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //note: no call to super
  @NonNls final String methodName = method.getName();
  if (!"equal".equals(methodName)) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() != 1) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MisspelledEqualsInspectionBase.java

示例15: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //note: no call to super
  @NonNls final String methodName = method.getName();
  if (!"compareto".equals(methodName)) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() != 1) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MisspelledCompareToInspectionBase.java


注:本文中的com.intellij.psi.PsiMethod.getParameterList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。