本文整理汇总了Java中com.intellij.psi.util.PropertyUtil.isSimpleSetter方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtil.isSimpleSetter方法的具体用法?Java PropertyUtil.isSimpleSetter怎么用?Java PropertyUtil.isSimpleSetter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PropertyUtil
的用法示例。
在下文中一共展示了PropertyUtil.isSimpleSetter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMethod
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
//no drilldown
if (method.getNameIdentifier() == null) {
return;
}
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
return;
}
final PsiCodeBlock body = method.getBody();
if (body == null) {
return;
}
if (method.isConstructor()) {
return;
}
if (PropertyUtil.isSimpleGetter(method) || PropertyUtil.isSimpleSetter(method)) {
return;
}
if (containsLoggingCall(body)) {
return;
}
registerMethodError(method);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PublicMethodWithoutLoggingInspectionBase.java
示例2: calculateTotalMethodCount
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
private int calculateTotalMethodCount(PsiClass aClass) {
final PsiMethod[] methods = aClass.getMethods();
int totalCount = 0;
for (final PsiMethod method : methods) {
if (method.isConstructor()) {
continue;
}
if (ignoreGettersAndSetters) {
if (PropertyUtil.isSimpleGetter(method) || PropertyUtil.isSimpleSetter(method)) {
continue;
}
}
if (ignoreOverridingMethods) {
if (MethodUtils.hasSuper(method)) {
continue;
}
}
totalCount++;
}
return totalCount;
}
示例3: calculateTotalMethodCount
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
private int calculateTotalMethodCount(PsiClass aClass) {
final PsiMethod[] methods = aClass.getMethods();
int totalCount = 0;
for (final PsiMethod method : methods) {
if (method.isConstructor()) {
continue;
}
if (ignoreGettersAndSetters) {
if (PropertyUtil.isSimpleGetter(method) ||
PropertyUtil.isSimpleSetter(method)) {
continue;
}
}
totalCount++;
}
return totalCount;
}
示例4: visitMethod
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
final PsiClass aClass = method.getContainingClass();
if (aClass == null || !aClass.isInterface()) {
return;
}
}
if (PropertyUtil.isSimpleSetter(method) || LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
final PsiParameterList parameterList = method.getParameterList();
final PsiParameter[] parameters = parameterList.getParameters();
int count = 0;
for (PsiParameter parameter : parameters) {
final PsiType type = parameter.getType();
if (!PsiPrimitiveType.BOOLEAN.equals(type)) {
continue;
}
count++;
if (count > 1) {
break;
}
}
if (count == 0 || onlyReportMultiple && count == 1) {
return;
}
registerMethodError(method, method, Integer.valueOf(count));
}
示例5: checkSideEffects
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
public static boolean checkSideEffects(PsiElement element, PsiVariable variable, List<PsiElement> sideEffects) {
if (sideEffects == null || element == null) return false;
if (element instanceof PsiMethodCallExpression) {
final PsiMethod psiMethod = ((PsiMethodCallExpression)element).resolveMethod();
if (psiMethod == null || !PropertyUtil.isSimpleGetter(psiMethod) && !PropertyUtil.isSimpleSetter(psiMethod)) {
sideEffects.add(element);
return true;
}
}
if (element instanceof PsiNewExpression) {
PsiNewExpression newExpression = (PsiNewExpression)element;
if (newExpression.getArrayDimensions().length == 0
&& newExpression.getArrayInitializer() == null
&& !isSideEffectFreeConstructor(newExpression)) {
sideEffects.add(element);
return true;
}
}
if (element instanceof PsiAssignmentExpression
&& !(((PsiAssignmentExpression)element).getLExpression() instanceof PsiReferenceExpression
&& ((PsiReferenceExpression)((PsiAssignmentExpression)element).getLExpression()).resolve() == variable)) {
sideEffects.add(element);
return true;
}
PsiElement[] children = element.getChildren();
for (PsiElement child : children) {
checkSideEffects(child, variable, sideEffects);
}
return !sideEffects.isEmpty();
}
示例6: checkSideEffects
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
public static boolean checkSideEffects(PsiElement element, PsiVariable variable, List<PsiElement> sideEffects) {
if (sideEffects == null || element == null) return false;
if (element instanceof PsiMethodCallExpression) {
final PsiMethod psiMethod = ((PsiMethodCallExpression)element).resolveMethod();
if (psiMethod == null || !PropertyUtil.isSimpleGetter(psiMethod) && !PropertyUtil.isSimpleSetter(psiMethod)) {
sideEffects.add(element);
return true;
}
}
if (element instanceof PsiNewExpression) {
PsiNewExpression newExpression = (PsiNewExpression)element;
if (newExpression.getArrayDimensions().length == 0
&& newExpression.getArrayInitializer() == null
&& !isSideEffectFreeConstructor(newExpression)) {
sideEffects.add(element);
return true;
}
}
if (element instanceof PsiAssignmentExpression
&& !(((PsiAssignmentExpression)element).getLExpression() instanceof PsiReferenceExpression
&& ((PsiReferenceExpression)((PsiAssignmentExpression)element).getLExpression()).resolve() == variable)) {
sideEffects.add(element);
return true;
}
PsiElement[] children = element.getChildren();
for (PsiElement child : children) {
checkSideEffects(child, variable, sideEffects);
}
return !sideEffects.isEmpty();
}
示例7: visitMethodCallExpression
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@Override
public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
super.visitMethodCallExpression(call);
final PsiClass containingClass = ClassUtils.getContainingClass(call);
if (containingClass == null) {
return;
}
final PsiMethod method = call.resolveMethod();
if (method == null) {
return;
}
if (!containingClass.equals(method.getContainingClass())) {
return;
}
final PsiReferenceExpression methodExpression = call.getMethodExpression();
final PsiExpression qualifier = methodExpression.getQualifierExpression();
if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
if (ignoreSetterCallsOnOtherObjects) {
return;
}
final PsiType type = qualifier.getType();
if (!(type instanceof PsiClassType)) {
return;
}
final PsiClassType classType = (PsiClassType)type;
final PsiClass qualifierClass = classType.resolve();
if (!containingClass.equals(qualifierClass)) {
return;
}
}
if (!PropertyUtil.isSimpleSetter(method)) {
return;
}
if (onlyReportPrivateSetter && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
return;
}
final Query<PsiMethod> query = OverridingMethodsSearch.search(method, true);
final PsiMethod overridingMethod = query.findFirst();
if (overridingMethod != null) {
return;
}
registerMethodCallError(call);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:CallToSimpleSetterInClassInspectionBase.java