private static boolean processMethod(
      @NotNull GrTypeDefinition grType,
      @NotNull PsiScopeProcessor processor,
      @NotNull ResolveState state,
      @NotNull PsiElement place,
      boolean processInstanceMethods,
      @NotNull PsiSubstitutor substitutor,
      @NotNull PsiElementFactory factory,
      @NotNull LanguageLevel level,
      boolean placeGroovy,
      @NotNull CandidateInfo info) {
    PsiMethod method = (PsiMethod) info.getElement();
    if (!processInstanceMember(processInstanceMethods, method)
        || isSameDeclaration(place, method)
        || !isMethodVisible(placeGroovy, method)) {
      return true;
    }
    LOG.assertTrue(method.getContainingClass() != null);
    final PsiSubstitutor finalSubstitutor =
        PsiClassImplUtil.obtainFinalSubstitutor(
            method.getContainingClass(),
            info.getSubstitutor(),
            grType,
            substitutor,
            factory,
            level);

    return processor.execute(method, state.put(PsiSubstitutor.KEY, finalSubstitutor));
  }
 @Override
 public boolean processDeclarations(
     @NotNull final PsiScopeProcessor processor,
     @NotNull final ResolveState state,
     final PsiElement lastParent,
     @NotNull final PsiElement place) {
   return PsiClassImplUtil.processDeclarationsInClass(
       this, processor, state, null, lastParent, place, PsiUtil.getLanguageLevel(place), false);
 }
    @Override
    @Nullable
    public PsiType fun(final PsiMethodCallExpression call) {
      PsiReferenceExpression methodExpression = call.getMethodExpression();
      PsiType theOnly = null;
      final JavaResolveResult[] results = methodExpression.multiResolve(false);
      LanguageLevel languageLevel = PsiUtil.getLanguageLevel(call);

      final PsiElement callParent = PsiUtil.skipParenthesizedExprUp(call.getParent());
      final PsiExpressionList parentArgList;
      if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
        parentArgList =
            callParent instanceof PsiConditionalExpression
                    && !PsiPolyExpressionUtil.isPolyExpression((PsiExpression) callParent)
                ? null
                : PsiTreeUtil.getParentOfType(call, PsiExpressionList.class);
      } else {
        parentArgList = null;
      }
      final MethodCandidateInfo.CurrentCandidateProperties properties =
          MethodCandidateInfo.getCurrentMethod(parentArgList);
      final boolean genericMethodCall =
          properties != null && properties.getInfo().isToInferApplicability();

      for (int i = 0; i < results.length; i++) {
        final JavaResolveResult candidateInfo = results[i];

        if (genericMethodCall
            && PsiPolyExpressionUtil.isMethodCallPolyExpression(
                call, (PsiMethod) candidateInfo.getElement())) {
          if (callParent instanceof PsiAssignmentExpression) {
            return null;
          }
          LOG.error("poly expression evaluation during overload resolution");
        }

        final PsiType type = getResultType(call, methodExpression, candidateInfo, languageLevel);
        if (type == null) {
          return null;
        }

        if (i == 0) {
          theOnly = type;
        } else if (!theOnly.equals(type)) {
          return null;
        }
      }

      return PsiClassImplUtil.correctType(theOnly, call.getResolveScope());
    }
 @Nullable
 public PsiField findFieldByName(String name, boolean checkBases) {
   if (checkBases) {
     return PsiClassImplUtil.findFieldByName(myClass, name, true);
   }
   return CachedValuesManager.getCachedValue(
           myClass,
           new CachedValueProvider<Map<String, PsiField>>() {
             @Nullable
             @Override
             public Result<Map<String, PsiField>> compute() {
               return Result.create(
                   getFieldsMap(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
             }
           })
       .get(name);
 }
 @NotNull
 public PsiMethod[] findMethodsByName(String name, boolean checkBases) {
   if (checkBases) {
     return PsiClassImplUtil.findMethodsByName(myClass, name, true);
   }
   PsiMethod[] methods =
       CachedValuesManager.getCachedValue(
               myClass,
               new CachedValueProvider<Map<String, PsiMethod[]>>() {
                 @Nullable
                 @Override
                 public Result<Map<String, PsiMethod[]>> compute() {
                   return Result.create(
                       getMethodsMap(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
                 }
               })
           .get(name);
   return methods == null ? PsiMethod.EMPTY_ARRAY : methods.clone();
 }
 @Override
 public boolean isEquivalentTo(PsiElement another) {
   return PsiClassImplUtil.isMethodEquivalentTo(this, another);
 }
Beispiel #7
0
 @Override
 public Icon getElementIcon(final int flags) {
   return PsiClassImplUtil.getClassIcon(flags, this);
 }
 @Override
 protected Icon getElementIcon(@Iconable.IconFlags int flags) {
   return PsiClassImplUtil.getClassIcon(flags, this);
 }
Beispiel #9
0
 @Override
 public PsiClass[] getInterfaces() {
   return PsiClassImplUtil.getInterfaces(this);
 }
Beispiel #10
0
 @Nullable
 @Override
 public PsiClass findInnerClassByName(@NonNls String name, boolean checkBases) {
   return PsiClassImplUtil.findInnerByName(this, name, checkBases);
 }
Beispiel #11
0
 @NotNull
 @Override
 public List<Pair<PsiMethod, PsiSubstitutor>> getAllMethodsAndTheirSubstitutors() {
   return PsiClassImplUtil.getAllWithSubstitutorsByMap(this, PsiClassImplUtil.MemberType.METHOD);
 }
Beispiel #12
0
 @NotNull
 @Override
 public List<Pair<PsiMethod, PsiSubstitutor>> findMethodsAndTheirSubstitutorsByName(
     @NonNls String name, boolean checkBases) {
   return PsiClassImplUtil.findMethodsAndTheirSubstitutorsByName(this, name, checkBases);
 }
Beispiel #13
0
 @NotNull
 @Override
 public PsiMethod[] findMethodsByName(@NonNls String name, boolean checkBases) {
   return PsiClassImplUtil.findMethodsByName(this, name, checkBases);
 }
Beispiel #14
0
 @NotNull
 @Override
 public PsiMethod[] findMethodsBySignature(PsiMethod patternMethod, boolean checkBases) {
   return PsiClassImplUtil.findMethodsBySignature(this, patternMethod, checkBases);
 }
Beispiel #15
0
 @NotNull
 @Override
 public PsiClassType[] getSuperTypes() {
   return PsiClassImplUtil.getSuperTypes(this);
 }
 public static boolean isClassEquivalentTo(GrTypeDefinitionImpl definition, PsiElement another) {
   return PsiClassImplUtil.isClassEquivalentTo(definition, another);
 }
Beispiel #17
0
 @Nullable
 @Override
 public PsiClass getSuperClass() {
   return PsiClassImplUtil.getSuperClass(this);
 }