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


Java ErrorUtil.containsError方法代码示例

本文整理汇总了Java中com.siyeh.ipp.psiutils.ErrorUtil.containsError方法的典型用法代码示例。如果您正苦于以下问题:Java ErrorUtil.containsError方法的具体用法?Java ErrorUtil.containsError怎么用?Java ErrorUtil.containsError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.siyeh.ipp.psiutils.ErrorUtil的用法示例。


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

示例1: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiVariable)) {
    return false;
  }
  if (ErrorUtil.containsError(element)) {
    return false;
  }
  final PsiVariable var = (PsiVariable)element;
  final PsiTypeElement typeElement = var.getTypeElement();
  if (typeElement == null) {
    return false; // Could be true for enum constants.
  }

  final PsiType elementType = typeElement.getType();
  final PsiType type = var.getType();
  return elementType.getArrayDimensions() != type.getArrayDimensions();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SimplifyVariablePredicate.java

示例2: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
@Override
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiBinaryExpression)) {
    return false;
  }
  final PsiBinaryExpression expression = (PsiBinaryExpression)element;
  final IElementType tokenType = expression.getOperationTokenType();
  if (!tokenType.equals(JavaTokenType.EQEQ) &&
      !tokenType.equals(JavaTokenType.NE)) {
    return false;
  }
  final PsiExpression lhs = expression.getLOperand();
  final PsiExpression rhs = expression.getROperand();
  if (rhs == null) {
    return false;
  }
  if (!BoolUtils.isBooleanLiteral(lhs) &&
      !BoolUtils.isBooleanLiteral(rhs)) {
    return false;
  }
  final PsiType type = expression.getType();
  if (!PsiType.BOOLEAN.equals(type)) {
    return false;
  }
  return !ErrorUtil.containsError(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:BooleanLiteralEqualityPredicate.java

示例3: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiMethodCallExpression)) {
    return false;
  }
  final PsiMethodCallExpression expression =
    (PsiMethodCallExpression)element;
  final PsiExpressionList argumentList = expression.getArgumentList();
  final PsiExpression[] arguments = argumentList.getExpressions();
  if (arguments.length != 1) {
    return false;
  }
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  final PsiExpression qualifier =
    methodExpression.getQualifierExpression();
  if (qualifier == null) {
    return false;
  }
  @NonNls final String methodName = methodExpression.getReferenceName();
  if (!"equals".equals(methodName)) {
    return false;
  }
  return !ErrorUtil.containsError(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:EqualsPredicate.java

示例4: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(@NotNull PsiElement element) {
  final PsiElement parent = element.getParent();
  if (!(parent instanceof PsiField)) {
    return false;
  }
  if (element instanceof PsiComment &&
      element == parent.getFirstChild()) {
    return false;
  }
  final PsiField field = (PsiField)parent;
  final PsiExpression initializer = field.getInitializer();
  if (initializer == null) {
    return false;
  }
  final PsiClass containingClass = field.getContainingClass();
  if (containingClass == null || containingClass.isInterface()) {
    return false;
  }
  return !ErrorUtil.containsError(field);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SplitDeclarationAndInitializationPredicate.java

示例5: checkSwitchStatement

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public static boolean checkSwitchStatement(@NotNull PsiSwitchStatement switchStatement) {
  final PsiExpression expression = switchStatement.getExpression();
  if (expression == null) {
    return false;
  }
  final PsiCodeBlock body = switchStatement.getBody();
  if (body == null) {
    return false;
  }
  if (ErrorUtil.containsError(switchStatement)) {
    return false;
  }
  boolean hasLabel = false;
  final PsiStatement[] statements = body.getStatements();
  for (PsiStatement statement : statements) {
    if (statement instanceof PsiSwitchLabelStatement) {
      hasLabel = true;
      break;
    }
  }
  return hasLabel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SwitchPredicate.java

示例6: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiJavaToken)) {
    return false;
  }
  final PsiJavaToken token = (PsiJavaToken)element;
  if (token.getTokenType() != JavaTokenType.IF_KEYWORD) {
    return false;
  }
  final PsiElement parent = element.getParent();
  if (!(parent instanceof PsiIfStatement)) {
    return false;
  }
  final PsiIfStatement statement = (PsiIfStatement)parent;
  if (ErrorUtil.containsError(statement)) {
    return false;
  }
  return SwitchUtils.getSwitchExpression(statement, 0) != null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IfToSwitchPredicate.java

示例7: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiConditionalExpression)) {
    return false;
  }
  final PsiConditionalExpression condition =
    (PsiConditionalExpression)element;
  PsiExpression thenExpression = condition.getThenExpression();
  PsiExpression elseExpression = condition.getElseExpression();
  if (thenExpression == null || elseExpression == null) {
    return false;
  }
  thenExpression = ParenthesesUtils.stripParentheses(thenExpression);
  elseExpression = ParenthesesUtils.stripParentheses(elseExpression);
  if (thenExpression == null || elseExpression == null) {
    return false;
  }
  @NonNls final String thenText = thenExpression.getText();
  @NonNls final String elseText = elseExpression.getText();
  if ("true".equals(elseText) && "false".equals(thenText)) {
    return !ErrorUtil.containsError(element);
  }
  else if ("true".equals(thenText) && "false".equals(elseText)) {
    return !ErrorUtil.containsError(element);
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:RemoveConditionalPredicate.java

示例8: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiJavaToken)) {
    return false;
  }
  final PsiJavaToken token = (PsiJavaToken)element;
  final IElementType tokenType = token.getTokenType();
  if (!JavaTokenType.FOR_KEYWORD.equals(tokenType)) {
    return false;
  }
  final PsiElement parent = element.getParent();
  if (!(parent instanceof PsiForeachStatement)) {
    return false;
  }
  final PsiForeachStatement foreachStatement = (PsiForeachStatement)parent;
  final PsiExpression iteratedValue = foreachStatement.getIteratedValue();
  if (iteratedValue == null) {
    return false;
  }
  final PsiType type = iteratedValue.getType();
  if (!InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_ITERABLE)) {
    return false;
  }
  return !ErrorUtil.containsError(foreachStatement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IterableForEachLoopPredicate.java

示例9: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiBinaryExpression)) {
    return false;
  }
  final PsiBinaryExpression expression = (PsiBinaryExpression)element;
  final IElementType tokenType = expression.getOperationTokenType();
  if (!tokenType.equals(JavaTokenType.EQEQ) &&
      !tokenType.equals(JavaTokenType.NE)) {
    return false;
  }
  final PsiExpression lhs = expression.getLOperand();
  final PsiExpression rhs = expression.getROperand();
  if (rhs == null) {
    return false;
  }
  if (!BoolUtils.isBooleanLiteral(lhs) &&
      !BoolUtils.isBooleanLiteral(rhs)) {
    return false;
  }
  final PsiType type = expression.getType();
  if (!PsiType.BOOLEAN.equals(type)) {
    return false;
  }
  return !ErrorUtil.containsError(element);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:BooleanLiteralEqualityPredicate.java

示例10: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiBinaryExpression)) {
    return false;
  }
  final PsiBinaryExpression expression = (PsiBinaryExpression)element;
  final PsiExpression rhs = expression.getROperand();
  if (rhs == null) {
    return false;
  }
  if (!ComparisonUtils.isComparison((PsiExpression)element)) {
    return false;
  }
  return !ErrorUtil.containsError(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ComparisonPredicate.java

示例11: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiPolyadicExpression)) {
    return false;
  }
  final PsiPolyadicExpression expression = (PsiPolyadicExpression)element;
  final IElementType tokenType = expression.getOperationTokenType();
  if (!tokenType.equals(JavaTokenType.ANDAND) &&
      !tokenType.equals(JavaTokenType.OROR)) {
    return false;
  }
  return !ErrorUtil.containsError(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ConjunctionPredicate.java

示例12: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiMethodCallExpression)) {
    return false;
  }
  final PsiMethodCallExpression expression =
    (PsiMethodCallExpression)element;
  final PsiExpressionList args = expression.getArgumentList();
  final int numExpressions = args.getExpressions().length;
  if (numExpressions < 1 || numExpressions > 2) {
    return false;
  }
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  @NonNls final String methodName = methodExpression.getReferenceName();
  if (!("assertTrue".equals(methodName) ||
        "assertFalse".equals(methodName) ||
        "assertNull".equals(methodName))) {
    return false;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return false;
  }
  final PsiClass targetClass = method.getContainingClass();
  if (targetClass == null) {
    return false;
  }
  final String qualifiedName = targetClass.getQualifiedName();
  if (!"junit.framework.Assert".equals(qualifiedName) &&
      !"org.junit.Assert".equals(qualifiedName)) {
    return false;
  }
  return !ErrorUtil.containsError(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:AssertLiteralPredicate.java

示例13: isMergableExplicitIf

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public static boolean isMergableExplicitIf(PsiElement element) {
  if (!(element instanceof PsiJavaToken)) {
    return false;
  }
  final PsiJavaToken token = (PsiJavaToken)element;
  final PsiElement parent = token.getParent();
  if (!(parent instanceof PsiIfStatement)) {
    return false;
  }
  final PsiIfStatement ifStatement = (PsiIfStatement)parent;
  final PsiStatement thenBranch = ifStatement.getThenBranch();
  final PsiStatement elseBranch = ifStatement.getElseBranch();
  if (thenBranch == null) {
    return false;
  }
  if (elseBranch == null) {
    return false;
  }
  if (!(elseBranch instanceof PsiIfStatement)) {
    return false;
  }
  if (ErrorUtil.containsError(ifStatement)) {
    return false;
  }
  final PsiIfStatement childIfStatement = (PsiIfStatement)elseBranch;
  final PsiStatement childThenBranch = childIfStatement.getThenBranch();
  return EquivalenceChecker.statementsAreEquivalent(thenBranch, childThenBranch);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:MergeIfOrPredicate.java

示例14: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiMethodCallExpression)) {
    return false;
  }
  final PsiMethodCallExpression expression =
    (PsiMethodCallExpression)element;
  final PsiExpressionList argumentList = expression.getArgumentList();
  final int numExpressions = argumentList.getExpressions().length;
  if (numExpressions < 1 || numExpressions > 2) {
    return false;
  }
  final PsiReferenceExpression methodExpression =
    expression.getMethodExpression();
  @NonNls final String methodName = methodExpression.getReferenceName();
  if (!"assertTrue".equals(methodName) &&
      !"assertFalse".equals(methodName)) {
    return false;
  }
  final PsiMethod method = expression.resolveMethod();
  if (method == null) {
    return false;
  }
  final PsiClass targetClass = method.getContainingClass();
  if (targetClass == null) {
    return false;
  }
  final String qualifiedName = targetClass.getQualifiedName();
  if (!"junit.framework.Assert".equals(qualifiedName) &&
      !"org.junit.Assert".equals(qualifiedName)) {
    return false;
  }
  return !ErrorUtil.containsError(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:AssertTrueOrFalsePredicate.java

示例15: satisfiedBy

import com.siyeh.ipp.psiutils.ErrorUtil; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiJavaToken)) {
    return false;
  }
  @NonNls final String text = element.getText();
  if (!PsiKeyword.ELSE.equals(text)) {
    return false;
  }
  final PsiJavaToken token = (PsiJavaToken)element;
  final PsiElement parent = token.getParent();
  if (!(parent instanceof PsiIfStatement)) {
    return false;
  }
  final PsiIfStatement ifStatement = (PsiIfStatement)parent;
  if (ErrorUtil.containsError(ifStatement)) {
    return false;
  }
  final PsiStatement thenBranch = ifStatement.getThenBranch();
  final PsiStatement elseBranch = ifStatement.getElseBranch();
  if (thenBranch == null) {
    return false;
  }
  if (!(elseBranch instanceof PsiBlockStatement)) {
    return false;
  }
  final PsiCodeBlock block =
    ((PsiBlockStatement)elseBranch).getCodeBlock();
  final PsiStatement[] statements = block.getStatements();
  return statements.length == 1 &&
         statements[0] instanceof PsiIfStatement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:MergeElseIfPredicate.java


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