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


Java PsiMethod.hasModifierProperty方法代码示例

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


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

示例1: getAbstractColumnValue

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Nullable
@Override
protected Object getAbstractColumnValue(GrMemberInfo memberInfo) {
  if (!(memberInfo.getMember() instanceof PsiMethod)) return null;
  if (memberInfo.isStatic()) return null;

  PsiMethod method = (PsiMethod)memberInfo.getMember();
  if (method.hasModifierProperty(PsiModifier.ABSTRACT)) {
    final Boolean fixedAbstract = myMemberInfoModel.isFixedAbstract(memberInfo);
    if (fixedAbstract != null) return fixedAbstract;
  }

  if (!myMemberInfoModel.isAbstractEnabled(memberInfo)) {
    return myMemberInfoModel.isAbstractWhenDisabled(memberInfo);
  }
  else {
    return memberInfo.isToAbstract();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GrMemberSelectionTable.java

示例2: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  //note: no call to super;
  if (!CloneUtils.isClone(method)) {
    return;
  }
  if (method.hasModifierProperty(PsiModifier.ABSTRACT) ||
      method.hasModifierProperty(PsiModifier.NATIVE)) {
    return;
  }
  final PsiClass containingClass = method.getContainingClass();
  if (containingClass == null) {
    return;
  }
  if (containingClass.isInterface() ||
      containingClass.isAnnotationType()) {
    return;
  }
  if (CloneUtils.onlyThrowsException(method)) {
    return;
  }
  if (MethodCallUtils.containsSuperMethodCall(HardcodedMethodConstants.CLONE, method)) {
    return;
  }
  registerMethodError(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:CloneCallsSuperCloneInspection.java

示例3: checkSuperMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
public static PsiMethod checkSuperMethod(@NotNull PsiMethod method, @NotNull String actionString) {
  PsiClass aClass = method.getContainingClass();
  if (aClass == null) return method;

  PsiMethod superMethod = method.findDeepestSuperMethod();
  if (superMethod == null) return method;

  if (ApplicationManager.getApplication().isUnitTestMode()) return superMethod;

  PsiClass containingClass = superMethod.getContainingClass();

  SuperMethodWarningDialog dialog =
      new SuperMethodWarningDialog(
          method.getProject(),
          DescriptiveNameUtil.getDescriptiveName(method), actionString, containingClass.isInterface() || superMethod.hasModifierProperty(PsiModifier.ABSTRACT),
          containingClass.isInterface(), aClass.isInterface(), containingClass.getQualifiedName()
      );
  dialog.show();

  if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) return superMethod;
  if (dialog.getExitCode() == SuperMethodWarningDialog.NO_EXIT_CODE) return method;

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SuperMethodWarningUtil.java

示例4: getAbstractColumnValue

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Nullable
@Override
protected Object getAbstractColumnValue(MemberInfo memberInfo) {
  if (!(memberInfo.getMember() instanceof PsiMethod)) return null;
  if (memberInfo.isStatic()) return null;

  PsiMethod method = (PsiMethod)memberInfo.getMember();
  if (method.hasModifierProperty(PsiModifier.ABSTRACT)) {
    final Boolean fixedAbstract = myMemberInfoModel.isFixedAbstract(memberInfo);
    if (fixedAbstract != null) return fixedAbstract;
  }

  if (!myMemberInfoModel.isAbstractEnabled(memberInfo)) {
    return myMemberInfoModel.isAbstractWhenDisabled(memberInfo);
  }
  else {
    return memberInfo.isToAbstract();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MemberSelectionTable.java

示例5: isTheLastClassRef

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
static PsiMethod isTheLastClassRef(PsiElement element, PsiMethod member) {
  final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class, false);
  if ( containingMethod != null &&
      !containingMethod.hasModifierProperty(PsiModifier.STATIC) &&
      !containingMethod.isConstructor() &&
       containingMethod.findDeepestSuperMethods().length == 0 &&
      !containingMethod.equals(member)) {
    final PsiClass containingClass = containingMethod.getContainingClass();
    if (containingClass != null) {
      final PsiClass gContainingClass = containingClass.getContainingClass();
      if (gContainingClass == null || gContainingClass.hasModifierProperty(PsiModifier.STATIC)) {
        final InternalUsageInfo[] refsInMember = MakeStaticUtil.findClassRefsInMember(containingMethod, true);
        for (InternalUsageInfo info : refsInMember) {
          final PsiElement referencedElement = info.getReferencedElement();
          if (!member.equals(referencedElement) && !containingMethod.equals(referencedElement)) {
            return null;
          }
        }
        return containingMethod;
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MakeStaticJavaCallerChooser.java

示例6: visitClass

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitClass(PsiClass aClass) {
  super.visitClass(aClass);
  if (aClass.isEnum() || aClass.hasModifierProperty(PsiModifier.FINAL)) {
    return;
  }
  final PsiMethod[] constructors = aClass.getConstructors();
  if (constructors.length == 0) {
    return;
  }
  for (PsiMethod constructor : constructors) {
    if (!constructor.hasModifierProperty(PsiModifier.PRIVATE)) {
      return;
    }
  }
  final PsiClass[] innerClasses = aClass.getInnerClasses();
  for (PsiClass innerClass : innerClasses) {
    if (isExtendedByInnerClass(innerClass, aClass, new HashSet<PsiClass>())) {
      return;
    }
  }
  registerClassError(aClass, aClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ClassWithOnlyPrivateConstructorsInspectionBase.java

示例7: findInstancePropertySetter

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Nullable
public static PsiMethod findInstancePropertySetter(@NotNull PsiClass psiClass,
    @Nullable String propertyName) {
  if (StringUtil.isEmpty(propertyName))
    return null;
  final String suggestedSetterName = PropertyUtil.suggestSetterName(propertyName);
  final PsiMethod[] setters = psiClass.findMethodsByName(suggestedSetterName, true);
  for (PsiMethod setter : setters) {
    if (setter.hasModifierProperty(PUBLIC) && !setter.hasModifierProperty(STATIC)
        && isSimplePropertySetter(setter)) {
      return setter;
    }
  }
  return null;
}
 
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:16,代码来源:PsiUtil.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: addModifier

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
private void addModifier( PsiMethod psiMethod, ManLightMethodBuilder method, String modifier )
{
  if( psiMethod.hasModifierProperty( modifier ) )
  {
    method.withModifier( modifier );
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:8,代码来源:ManAugmentProvider.java

示例10: isStructurallyAssignable_Laxed

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
public static boolean isStructurallyAssignable_Laxed( PsiClass toType, PsiClass fromType, TypeVarToTypeMap inferenceMap, boolean structural )
{
  if( fromType == PsiType.NULL )
  {
    return true;
  }

  List<Pair<PsiMethod, PsiSubstitutor>> toMethods = toType.getAllMethodsAndTheirSubstitutors();

  inferenceMap.setStructural( true );

  for( Pair<PsiMethod, PsiSubstitutor> pair : toMethods )
  {
    PsiMethod toMi = pair.getFirst();
    if( isObjectMethod( toMi ) )
    {
      continue;
    }
    if( toMi.getContainingClass().getModifierList().findAnnotation( "manifold.ext.ExtensionMethod" ) != null )
    {
      continue;
    }
    if( toMi.hasModifierProperty( PsiModifier.DEFAULT ) || toMi.hasModifierProperty( PsiModifier.STATIC ) )
    {
      continue;
    }
    PsiMethod fromMi = findAssignableMethod( structural, fromType, toMi, inferenceMap );
    if( fromMi == null )
    {
      return false;
    }
  }
  return true;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:35,代码来源:TypeUtil.java

示例11: 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.hasModifierProperty(PsiModifier.FINAL)) {
    return;
  }
  registerModifierError(PsiModifier.FINAL, method, PsiModifier.FINAL);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FinalMethodInspection.java

示例12: methodOverridesSuper

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
private static boolean methodOverridesSuper(PsiMethod method, PsiMethod superMethod) {
  boolean overrides = false;
  if (method.hasModifierProperty(PsiModifier.ABSTRACT)){
    overrides = true;
  }
  else if (!superMethod.hasModifierProperty(PsiModifier.ABSTRACT)){
    overrides = true;
  }
  return overrides;

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SuperTypesGrouper.java

示例13: isAbstractColumnEditable

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
protected boolean isAbstractColumnEditable(int rowIndex) {
  MemberInfo info = myMemberInfos.get(rowIndex);
  if (!(info.getMember() instanceof PsiMethod)) return false;
  if (info.isStatic()) return false;

  PsiMethod method = (PsiMethod)info.getMember();
  if (method.hasModifierProperty(PsiModifier.ABSTRACT)) {
    if (myMemberInfoModel.isFixedAbstract(info) != null) {
      return false;
    }
  }

  return info.isChecked() && myMemberInfoModel.isAbstractEnabled(info);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MemberSelectionTable.java

示例14: createLookupElement

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
public static LookupElement createLookupElement(final PsiMethod method,
                                                final @Nullable TIntObjectHashMap<SubLookupElement> replaceElements) {
  if (method.isConstructor()) {
    //noinspection ConstantConditions
    return LookupElementBuilder.create(String.format("%s %s", PsiKeyword.NEW, method.getContainingClass().getName()));
  } else if (method.hasModifierProperty(PsiModifier.STATIC)) {
    return new ChainCompletionMethodCallLookupElement(method, replaceElements, false, true);
  } else {
    return new ChainCompletionMethodCallLookupElement(method, replaceElements);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ChainCompletionLookupElementUtil.java

示例15: 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.hasModifierProperty(PsiModifier.FINAL)
      || !method.hasModifierProperty(PsiModifier.STATIC)) {
    return;
  }
  registerModifierError(PsiModifier.FINAL, method, PsiModifier.FINAL);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FinalStaticMethodInspection.java


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