當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiMethod.findSuperMethods方法代碼示例

本文整理匯總了Java中com.intellij.psi.PsiMethod.findSuperMethods方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiMethod.findSuperMethods方法的具體用法?Java PsiMethod.findSuperMethods怎麽用?Java PsiMethod.findSuperMethods使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.psi.PsiMethod的用法示例。


在下文中一共展示了PsiMethod.findSuperMethods方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateSiblingMethods

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
public static Set<PsiMethod> calculateSiblingMethods(PsiMethod method) {
    final Set<PsiMethod> siblingMethods = new HashSet<PsiMethod>();
    final Stack<PsiMethod> pendingMethods = new Stack<PsiMethod>();
    pendingMethods.add(method);
    while(!pendingMethods.isEmpty())
    {
        final PsiMethod methodToAnalyze = pendingMethods.pop();
        siblingMethods.add(methodToAnalyze);
      final Iterable<PsiMethod> overridingMethods = OverridingMethodsSearch.search(methodToAnalyze, false);
        for (PsiMethod overridingMethod : overridingMethods) {
            if (!siblingMethods.contains(overridingMethod) &&
                    !pendingMethods.contains(overridingMethod)) {
                pendingMethods.add(overridingMethod);
            }
        }
        final PsiMethod[] superMethods = methodToAnalyze.findSuperMethods();
        for (PsiMethod superMethod : superMethods) {
            if (!siblingMethods.contains(superMethod) &&
                    !pendingMethods.contains(superMethod)) {
                pendingMethods.add(superMethod);
            }
        }
    }
    return siblingMethods;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:MethodInheritanceUtils.java

示例2: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //no call to super, so we don't drill into anonymous classes
  if (method.isConstructor()) {
    return;
  }
  if (method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
    return;
  }
  if (method.getNameIdentifier() == null) {
    return;
  }
  final PsiMethod[] superMethods = method.findSuperMethods();
  for (final PsiMethod superMethod : superMethods) {
    if (superMethod.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
      registerMethodError(method);
      return;
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:NonSynchronizedMethodOverridesSynchronizedMethodVisitor.java

示例3: hasSiblingMethods

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
public static boolean hasSiblingMethods(PsiMethod method) {


        final Iterable<PsiMethod> overridingMethods =
                SearchUtils.findOverridingMethods(method);
        if(overridingMethods.iterator().hasNext())
        {
            return true;
        }
        final PsiMethod[] superMethods = method.findSuperMethods();
        return superMethods.length!=0;

    }
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:MethodInheritanceUtils.java

示例4: findAvailableSuperClasses

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
private static void findAvailableSuperClasses(PsiMethod method, List<PsiClass> sourceClasses){
    final PsiMethod[] superMethods = method.findSuperMethods(true);
    for(PsiMethod superMethod : superMethods){
        final PsiClass containingClass = superMethod.getContainingClass();
        if(!(containingClass instanceof PsiCompiledElement)){
            sourceClasses.add(containingClass);
            findAvailableSuperClasses(superMethod, sourceClasses);
        }
    }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:MethodInheritanceUtils.java

示例5: visitMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //no call to super, so we don't drill into anonymous classes
  if (method.isConstructor()) {
    return;
  }
  final PsiClass containingClass = method.getContainingClass();
  if (containingClass == null) {
    return;
  }
  if (containingClass.isInterface() ||
      containingClass.isAnnotationType()) {
    return;
  }
  if (!method.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return;
  }
  final PsiMethod[] superMethods = method.findSuperMethods();
  for (final PsiMethod superMethod : superMethods) {
    final PsiClass superClass = superMethod.getContainingClass();
    if (superClass == null) {
      continue;
    }
    final String superClassName = superClass.getQualifiedName();
    if (!superClass.isInterface() &&
        !CommonClassNames.JAVA_LANG_OBJECT.equals(superClassName) &&
        !superMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
      registerMethodError(method);
      return;
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:AbstractMethodOverridesConcreteMethodInspection.java

示例6: calculateOverriddenMethods

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
private static void calculateOverriddenMethods(
  PsiMethod method, Set<PsiMethod> overriddenMethods) {
  final PsiMethod[] superMethods = method.findSuperMethods();
  for (final PsiMethod superMethod : superMethods) {
    overriddenMethods.add(superMethod);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:AbstractClassWithoutAbstractMethodsInspection.java

示例7: shouldBeGenerated

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
private static boolean shouldBeGenerated(PsiMethod method) {
  for (PsiMethod psiMethod : method.findSuperMethods()) {
    if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
      final PsiType type = method.getReturnType();
      final PsiType superType = psiMethod.getReturnType();
      if (type != null && superType != null && !superType.isAssignableFrom(type)) {
        return false;
      }
    }
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ClassGenerator.java

示例8: findMethod

import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
@Override
PsiMethod[] findMethod(PsiMethod method) {
  return method.findSuperMethods();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:AllSuperMethodsTest.java


注:本文中的com.intellij.psi.PsiMethod.findSuperMethods方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。