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


Java PsiReferenceExpression类代码示例

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


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

示例1: buildVisitor

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
  return new JavaElementVisitor() {
    @Override
    public void visitReferenceExpression(PsiReferenceExpression psiReferenceExpression) {
    }

    @Override
    public void visitLocalVariable(PsiLocalVariable variable) {
      super.visitLocalVariable(variable);
      if (VariantPool.isJump()) {
        if (isFindYYY(variable.toString())) {
          holder.registerProblem(variable, DESCRIPTION_TEMPLATE, myQuickFix);
          log.info("isFindYYY" + variable );
        }
      }
    }
  };
}
 
开发者ID:appetizerio,项目名称:appetizer-intellij,代码行数:21,代码来源:ReplaceInspection.java

示例2: visitMethod

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
public void visitMethod(JavaContext context, JavaElementVisitor visitor,
                        PsiMethodCallExpression call, PsiMethod method) {
    PsiReferenceExpression methodExpression = call.getMethodExpression();
    String fullyQualifiedMethodName = methodExpression.getQualifiedName();

    if (fullyQualifiedMethodName.startsWith("android.util.Log")
            //Handle multiple overloaded out.print(and println, etc) methods.
            || fullyQualifiedMethodName.startsWith("java.lang.System.out.print")) {
        sHelper.reportIssue(context, ISSUE_LOG_CLASS, methodExpression);
        return;
    }

    if (fullyQualifiedMethodName.equals("java.lang.String.format")) {
        checkNestedStringFormat(context, call);
        return;
    }
}
 
开发者ID:JumeiRdGroup,项目名称:Android-PLog,代码行数:19,代码来源:LoggingIssueDetector.java

示例3: create

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Nullable
@Override
protected List<DfaVariableValue> create(PsiElement closure) {
  final Set<DfaVariableValue> result = ContainerUtil.newLinkedHashSet();
  closure.accept(new PsiRecursiveElementWalkingVisitor() {
    @Override
    public void visitElement(PsiElement element) {
      if (element instanceof PsiReferenceExpression) {
        DfaValue value = myFactory.createValue((PsiReferenceExpression)element);
        if (value instanceof DfaVariableValue) {
          result.add((DfaVariableValue)value);
        }
      }
      super.visitElement(element);
    }
  });
  return ContainerUtil.newArrayList(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LiveVariablesAnalyzer.java

示例4: isSetSecurityManager

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
private static boolean isSetSecurityManager(
  PsiMethodCallExpression expression) {
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  @NonNls final String methodName =
    methodExpression.getReferenceName();
  if (!"setSecurityManager".equals(methodName)) {
    return false;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return false;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return false;
  }
  final String className = aClass.getQualifiedName();
  if (className == null) {
    return false;
  }
  return "java.lang.System".equals(className);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SystemSetSecurityManagerInspection.java

示例5: isDriverManagerGetConnection

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
private static boolean isDriverManagerGetConnection(
  PsiMethodCallExpression expression) {
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();

  final String methodName = methodExpression.getReferenceName();
  if (!HardcodedMethodConstants.GET_CONNECTION.equals(methodName)) {
    return false;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return false;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return false;
  }
  final String className = aClass.getQualifiedName();
  if (className == null) {
    return false;
  }
  return "java.sql.DriverManager".equals(className);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DriverManagerGetConnectionInspection.java

示例6: isResourceCreation

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
protected boolean isResourceCreation(PsiExpression expression) {
  if (expression instanceof PsiMethodCallExpression) {
    final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)expression;
    final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression();
    @NonNls final String methodName = methodExpression.getReferenceName();
    if (!"accept".equals(methodName)) {
      return false;
    }
    final PsiExpression qualifier = methodExpression.getQualifierExpression();
    if (qualifier == null || !TypeUtils.expressionHasTypeOrSubtype(qualifier, "java.net.ServerSocket")) {
      return false;
    }
    return TypeUtils.expressionHasTypeOrSubtype(methodCallExpression, "java.net.Socket");
  }
  else if (expression instanceof PsiNewExpression) {
    return TypeUtils.expressionHasTypeOrSubtype(expression, "java.net.Socket", "java.net.DatagramSocket", "java.net.ServerSocket") != null;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SocketResourceInspection.java

示例7: visitMethodCallExpression

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
public void visitMethodCallExpression(
  @NotNull PsiMethodCallExpression expression) {
  super.visitMethodCallExpression(expression);
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  final String methodName = methodExpression.getReferenceName();
  @NonNls final String exec = "exec";
  if (!exec.equals(methodName)) {
    return;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return;
  }
  final String className = aClass.getQualifiedName();
  if (!"java.lang.Runtime".equals(className)) {
    return;
  }
  registerMethodCallError(expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:RuntimeExecInspection.java

示例8: visitMethodCallExpression

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
  super.visitMethodCallExpression(expression);
  if (!MethodCallUtils.isEqualsCall(expression)) {
    return;
  }
  final PsiReferenceExpression methodExpression = expression.getMethodExpression();
  final PsiExpression qualifier = methodExpression.getQualifierExpression();
  if (qualifier == null) {
    return;
  }
  final PsiExpressionList argumentList = expression.getArgumentList();
  final PsiExpression[] arguments = argumentList.getExpressions();
  if (arguments.length != 1) {
    return;
  }
  final PsiExpression argument = arguments[0];
  if (!EquivalenceChecker.expressionsAreEquivalent(qualifier, argument) ||
      SideEffectChecker.mayHaveSideEffects(qualifier)) {
    return;
  }
  registerMethodCallError(expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:EqualsWithItselfInspection.java

示例9: isThreadYield

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
private static boolean isThreadYield(
  PsiMethodCallExpression expression) {
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  @NonNls final String methodName =
    methodExpression.getReferenceName();
  if (!"yield".equals(methodName)) {
    return false;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return false;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return false;
  }
  final String className = aClass.getQualifiedName();
  if (className == null) {
    return false;
  }
  return "java.lang.Thread".equals(className);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ThreadYieldInspection.java

示例10: isStopSuspendOrResume

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
private static boolean isStopSuspendOrResume(
  PsiMethodCallExpression expression) {
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  @NonNls final String methodName =
    methodExpression.getReferenceName();
  if (!("stop".equals(methodName) || "suspend".equals(methodName) ||
        "resume".equals(methodName))) {
    return false;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return false;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return false;
  }
  final String className = aClass.getQualifiedName();
  if (className == null) {
    return false;
  }
  return "java.lang.Thread".equals(className);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ThreadStopSuspendResumeInspection.java

示例11: visitMethodCallExpression

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
public void visitMethodCallExpression(
  @NotNull PsiMethodCallExpression expression) {
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  final String methodName = methodExpression.getReferenceName();
  if (!HardcodedMethodConstants.NOTIFY.equals(methodName) &&
      !HardcodedMethodConstants.NOTIFY_ALL.equals(methodName)) {
    return;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return;
  }
  final PsiParameterList parameterList = method.getParameterList();
  if (parameterList.getParametersCount() != 0) {
    return;
  }
  if (SynchronizationUtil.isInSynchronizedContext(expression)) {
    return;
  }
  registerMethodCallError(expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:NotifyNotInSynchronizedContextInspection.java

示例12: isRunFinalizersOnExit

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
private static boolean isRunFinalizersOnExit(
  PsiMethodCallExpression expression) {
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  final String methodName = methodExpression.getReferenceName();
  @NonNls final String runFinalizers = "runFinalizersOnExit";
  if (!runFinalizers.equals(methodName)) {
    return false;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return false;
  }
  final PsiClass aClass = method.getContainingClass();
  if (aClass == null) {
    return false;
  }
  final String className = aClass.getQualifiedName();
  if (className == null) {
    return false;
  }
  return "java.lang.System".equals(className);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SystemRunFinalizersOnExitInspection.java

示例13: visitReferenceExpression

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
public void visitReferenceExpression(
  @NotNull PsiReferenceExpression referenceExpression) {
  if (used) {
    return;
  }
  super.visitReferenceExpression(referenceExpression);
  final PsiElement target = referenceExpression.resolve();
  if (target == null) {
    return;
  }
  if (target.equals(variable)) {
    used = true;
    //stopWalking();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:VariableUsedVisitor.java

示例14: visitReferenceExpression

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) {
  super.visitReferenceExpression(expression);
  final String name = expression.getReferenceName();
  if (!HardcodedMethodConstants.OUT.equals(name) &&
      !HardcodedMethodConstants.ERR.equals(name)) {
    return;
  }
  final PsiElement referent = expression.resolve();
  if (!(referent instanceof PsiField)) {
    return;
  }
  final PsiField field = (PsiField)referent;
  final PsiClass containingClass = field.getContainingClass();
  if (containingClass == null) {
    return;
  }
  final String className = containingClass.getQualifiedName();
  if (!"java.lang.System".equals(className)) {
    return;
  }
  registerError(expression, expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SystemOutErrInspectionBase.java

示例15: visitMethodCallExpression

import com.intellij.psi.PsiReferenceExpression; //导入依赖的package包/类
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
  super.visitMethodCallExpression(expression);
  final PsiReferenceExpression methodExpression = expression.getMethodExpression();
  final String name = methodExpression.getReferenceName();
  if (!"setScale".equals(name) && !"divide".equals(name)) {
    return;
  }
  final PsiExpressionList argumentList = expression.getArgumentList();
  if (PsiUtilCore.hasErrorElementChild(argumentList)) {
    return;
  }
  final PsiExpression[] arguments = argumentList.getExpressions();
  if (arguments.length != 1) {
    return;
  }
  if (!TypeUtils.expressionHasTypeOrSubtype(expression, "java.math.BigDecimal")) {
    return;
  }
  registerMethodCallError(expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:BigDecimalMethodWithoutRoundingCalledInspection.java


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