本文整理汇总了Java中com.intellij.psi.util.PropertyUtil.getFieldOfSetter方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtil.getFieldOfSetter方法的具体用法?Java PropertyUtil.getFieldOfSetter怎么用?Java PropertyUtil.getFieldOfSetter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PropertyUtil
的用法示例。
在下文中一共展示了PropertyUtil.getFieldOfSetter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMethodCallExpression
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
super.visitMethodCallExpression(expression);
if (!countGettersAndSetters) {
return;
}
final PsiReferenceExpression methodExpression =
expression.getMethodExpression();
final PsiExpression qualifier =
methodExpression.getQualifierExpression();
if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
return;
}
final PsiMethod method = (PsiMethod)methodExpression.resolve();
PsiField field = PropertyUtil.getFieldOfGetter(method);
if (field == null) {
field = PropertyUtil.getFieldOfSetter(method);
}
if (field == null) {
return;
}
if (m_inInitializer) {
}
else if (m_inSynchronizedContextCount > 0) {
m_synchronizedAccesses.add(field);
}
else {
m_unsynchronizedAccesses.add(field);
}
}
示例2: visitMethodCallExpression
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
super.visitMethodCallExpression(expression);
if (!countGettersAndSetters) {
return;
}
final PsiReferenceExpression methodExpression =
expression.getMethodExpression();
final PsiExpression qualifier =
methodExpression.getQualifierExpression();
if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
return;
}
final PsiMethod method = (PsiMethod)methodExpression.resolve();
PsiField field = PropertyUtil.getFieldOfGetter(method);
if (field == null) {
field = PropertyUtil.getFieldOfSetter(method);
}
if (field == null) {
return;
}
if (m_inInitializer) {
}
else if (m_inSynchronizedContext) {
m_synchronizedAccesses.add(field);
}
else {
m_unsynchronizedAccesses.add(field);
}
}
示例3: visitMethodCallExpression
import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
super.visitMethodCallExpression(expression);
final PsiExpressionList argumentList1 = expression.getArgumentList();
final PsiExpression[] arguments1 = argumentList1.getExpressions();
if (arguments1.length != 1) {
return;
}
final PsiExpression argument = arguments1[0];
if (!(argument instanceof PsiMethodCallExpression)) {
return;
}
final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)argument;
final PsiExpressionList argumentList2 = methodCallExpression.getArgumentList();
final PsiExpression[] arguments2 = argumentList2.getExpressions();
if (arguments2.length != 0) {
return;
}
final PsiReferenceExpression methodExpression1 = expression.getMethodExpression();
final PsiExpression qualifierExpression1 = ParenthesesUtils.stripParentheses(methodExpression1.getQualifierExpression());
final PsiReferenceExpression methodExpression2 = methodCallExpression.getMethodExpression();
final PsiExpression qualifierExpression2 = ParenthesesUtils.stripParentheses(methodExpression2.getQualifierExpression());
if (qualifierExpression1 instanceof PsiReferenceExpression && qualifierExpression2 instanceof PsiReferenceExpression) {
if (!EquivalenceChecker.expressionsAreEquivalent(qualifierExpression1, qualifierExpression2)) {
return;
}
}
else if((qualifierExpression1 != null &&
!(qualifierExpression1 instanceof PsiThisExpression) &&
!(qualifierExpression1 instanceof PsiSuperExpression))
||
qualifierExpression2 != null &&
!(qualifierExpression2 instanceof PsiThisExpression) &&
!(qualifierExpression2 instanceof PsiSuperExpression)) {
return;
}
final PsiMethod method1 = expression.resolveMethod();
final PsiField fieldOfSetter = PropertyUtil.getFieldOfSetter(method1);
if (fieldOfSetter == null) {
return;
}
final PsiMethod method2 = methodCallExpression.resolveMethod();
final PsiField fieldOfGetter = PropertyUtil.getFieldOfGetter(method2);
if (!fieldOfSetter.equals(fieldOfGetter)) {
return;
}
registerMethodCallError(expression);
}