當前位置: 首頁>>代碼示例>>Java>>正文


Java ExpressionUtils.isEvaluatedAtCompileTime方法代碼示例

本文整理匯總了Java中com.siyeh.ig.psiutils.ExpressionUtils.isEvaluatedAtCompileTime方法的典型用法代碼示例。如果您正苦於以下問題:Java ExpressionUtils.isEvaluatedAtCompileTime方法的具體用法?Java ExpressionUtils.isEvaluatedAtCompileTime怎麽用?Java ExpressionUtils.isEvaluatedAtCompileTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.siyeh.ig.psiutils.ExpressionUtils的用法示例。


在下文中一共展示了ExpressionUtils.isEvaluatedAtCompileTime方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: containsNonConstantConcatenation

import com.siyeh.ig.psiutils.ExpressionUtils; //導入方法依賴的package包/類
private boolean containsNonConstantConcatenation(@Nullable PsiExpression expression) {
  if (expression instanceof PsiParenthesizedExpression) {
    final PsiParenthesizedExpression parenthesizedExpression = (PsiParenthesizedExpression)expression;
    return containsNonConstantConcatenation(parenthesizedExpression.getExpression());
  }
  else if (expression instanceof PsiPolyadicExpression) {
    final PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression)expression;
    if (!ExpressionUtils.hasStringType(polyadicExpression)) {
      return false;
    }
    if (!JavaTokenType.PLUS.equals(polyadicExpression.getOperationTokenType())) {
      return false;
    }
    final PsiExpression[] operands = polyadicExpression.getOperands();
    for (PsiExpression operand : operands) {
      if (!ExpressionUtils.isEvaluatedAtCompileTime(operand)) {
        return true;
      }
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:StringConcatenationArgumentToLogCallInspectionBase.java

示例2: containsNonConstantConcatenation

import com.siyeh.ig.psiutils.ExpressionUtils; //導入方法依賴的package包/類
private static boolean containsNonConstantConcatenation(@Nullable PsiExpression expression) {
  if (expression instanceof PsiParenthesizedExpression) {
    final PsiParenthesizedExpression parenthesizedExpression = (PsiParenthesizedExpression)expression;
    return containsNonConstantConcatenation(parenthesizedExpression.getExpression());
  }
  else if (expression instanceof PsiPolyadicExpression) {
    final PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression)expression;
    if (!ExpressionUtils.hasStringType(polyadicExpression)) {
      return false;
    }
    if (!JavaTokenType.PLUS.equals(polyadicExpression.getOperationTokenType())) {
      return false;
    }
    final PsiExpression[] operands = polyadicExpression.getOperands();
    for (PsiExpression operand : operands) {
      if (!ExpressionUtils.isEvaluatedAtCompileTime(operand)) {
        return true;
      }
    }
  }
  return false;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:23,代碼來源:StringConcatenationArgumentToLogCallInspection.java

示例3: isAvailable

import com.siyeh.ig.psiutils.ExpressionUtils; //導入方法依賴的package包/類
public static boolean isAvailable(PsiExpression expression) {
  if (!(expression instanceof PsiPolyadicExpression)) {
    return false;
  }
  final PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression)expression;
  final PsiExpression[] operands = polyadicExpression.getOperands();
  for (PsiExpression operand : operands) {
    if (!ExpressionUtils.isEvaluatedAtCompileTime(operand)) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:StringConcatenationArgumentToLogCallInspectionBase.java

示例4: visitPolyadicExpression

import com.siyeh.ig.psiutils.ExpressionUtils; //導入方法依賴的package包/類
@Override
public void visitPolyadicExpression(PsiPolyadicExpression expression) {
  super.visitPolyadicExpression(expression);
  final PsiExpression[] operands = expression.getOperands();
  if (operands.length <= 1) {
    return;
  }
  final IElementType tokenType = expression.getOperationTokenType();
  if (!tokenType.equals(JavaTokenType.PLUS)) {
    return;
  }
  final PsiType type = expression.getType();
  if (!TypeUtils.isJavaLangString(type)) {
    return;
  }
  if (!ControlFlowUtils.isInLoop(expression)) {
    return;
  }
  if (ControlFlowUtils.isInExitStatement(expression)) {
    return;
  }
  if (ExpressionUtils.isEvaluatedAtCompileTime(expression)) {
    return;
  }
  if (containingStatementExits(expression)) {
    return;
  }
  if (m_ignoreUnlessAssigned && !isAppendedRepeatedly(expression)) {
    return;
  }
  final PsiJavaToken sign = expression.getTokenBeforeOperand(operands[1]);
  registerError(sign);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:34,代碼來源:StringConcatenationInLoopsInspection.java


注:本文中的com.siyeh.ig.psiutils.ExpressionUtils.isEvaluatedAtCompileTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。