本文整理匯總了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();
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例9: addModifier
import com.intellij.psi.PsiMethod; //導入方法依賴的package包/類
private void addModifier( PsiMethod psiMethod, ManLightMethodBuilder method, String modifier )
{
if( psiMethod.hasModifierProperty( modifier ) )
{
method.withModifier( modifier );
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}