Examples of IrritantSet


Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

      // discard suppressed warning
      removed++;
      problems[iProblem] = null;
      this.compilationResult.removeProblem(problem);
      if (foundIrritants[iSuppress] == null){
        foundIrritants[iSuppress] = new IrritantSet(irritant);
      } else {
        foundIrritants[iSuppress].set(irritant);
      }
      continue nextProblem;
    }
  }
  // compact remaining problems
  if (removed > 0) {
    for (int i = 0, index = 0; i < problemCount; i++) {
      CategorizedProblem problem;
      if ((problem = problems[i]) != null) {
        if (i > index) {
          problems[index++] = problem;
        } else {
          index++;
        }
      }
    }
  }
  // flag SuppressWarnings which had no effect (only if no (mandatory) error got detected within unit
  if (!hasMandatoryErrors) {
    int severity = options.getSeverity(CompilerOptions.UnusedWarningToken);
    if (severity != ProblemSeverities.Ignore) {
      boolean unusedWarningTokenIsWarning = (severity & ProblemSeverities.Error) == 0;
      for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
        Annotation annotation = this.suppressWarningAnnotations[iSuppress];
        if (annotation == null) continue; // implicit annotation
        IrritantSet irritants = this.suppressWarningIrritants[iSuppress];
        if (unusedWarningTokenIsWarning && irritants.areAllSet()) continue; // @SuppressWarnings("all") also suppresses unused warning token
        if (irritants != foundIrritants[iSuppress]) { // mismatch, some warning tokens were unused
          MemberValuePair[] pairs = annotation.memberValuePairs();
          pairLoop: for (int iPair = 0, pairCount = pairs.length; iPair < pairCount; iPair++) {
            MemberValuePair pair = pairs[iPair];
            if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
              Expression value = pair.value;
              if (value instanceof ArrayInitializer) {
                ArrayInitializer initializer = (ArrayInitializer) value;
                Expression[] inits = initializer.expressions;
                if (inits != null) {
                  for (int iToken = 0, tokenCount = inits.length; iToken < tokenCount; iToken++) {
                    Constant cst = inits[iToken].constant;
                    if (cst != Constant.NotAConstant && cst.typeID() == TypeIds.T_JavaLangString) {
                      IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                      if (tokenIrritants != null
                          && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                          && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                          && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                        if (unusedWarningTokenIsWarning) {
                          int start = value.sourceStart, end = value.sourceEnd;
                          nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
                            long position = this.suppressWarningScopePositions[jSuppress];
                            int startSuppress = (int) (position >>> 32);
                            int endSuppress = (int) position;
                            if (start < startSuppress) continue nextSuppress;
                            if (end > endSuppress) continue nextSuppress;
                            if (this.suppressWarningIrritants[jSuppress].areAllSet()) break pairLoop; // suppress all?
                          }
                        }
                        this.scope.problemReporter().unusedWarningToken(inits[iToken]);
                      }
                    }
                  }
                }
              } else {
                Constant cst = value.constant;
                if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                  IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                  if (tokenIrritants != null
                      && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                      && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                      && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                    if (unusedWarningTokenIsWarning) {
                      int start = value.sourceStart, end = value.sourceEnd;
                      nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

    this.type.printExpression(0, output);
    return output;
  }

  public void recordSuppressWarnings(Scope scope, int startSuppresss, int endSuppress, boolean isSuppressingWarnings) {
    IrritantSet suppressWarningIrritants = null;
    MemberValuePair[] pairs = memberValuePairs();
    pairLoop: for (int i = 0, length = pairs.length; i < length; i++) {
      MemberValuePair pair = pairs[i];
      if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
        Expression value = pair.value;
        if (value instanceof ArrayInitializer) {
          ArrayInitializer initializer = (ArrayInitializer) value;
          Expression[] inits = initializer.expressions;
          if (inits != null) {
            for (int j = 0, initsLength = inits.length; j < initsLength; j++) {
              Constant cst = inits[j].constant;
              if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                if (irritants != null) {
                  if (suppressWarningIrritants == null) {
                    suppressWarningIrritants = new IrritantSet(irritants);
                  } else if (suppressWarningIrritants.set(irritants) == null) {
                      scope.problemReporter().unusedWarningToken(inits[j]);
                  }
                } else {
                  scope.problemReporter().unhandledWarningToken(inits[j]);
                }
              }
            }
          }
        } else {
          Constant cst = value.constant;
          if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
            IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
            if (irritants != null) {
              suppressWarningIrritants = new IrritantSet(irritants);
              // TODO: should check for unused warning token against enclosing annotation as well ?
            } else {
              scope.problemReporter().unhandledWarningToken(value);
            }
          }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

    this.type.printExpression(0, output);
    return output;
  }

  public void recordSuppressWarnings(Scope scope, int startSuppresss, int endSuppress, boolean isSuppressingWarnings) {
    IrritantSet suppressWarningIrritants = null;
    MemberValuePair[] pairs = memberValuePairs();
    pairLoop: for (int i = 0, length = pairs.length; i < length; i++) {
      MemberValuePair pair = pairs[i];
      if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
        Expression value = pair.value;
        if (value instanceof ArrayInitializer) {
          ArrayInitializer initializer = (ArrayInitializer) value;
          Expression[] inits = initializer.expressions;
          if (inits != null) {
            for (int j = 0, initsLength = inits.length; j < initsLength; j++) {
              Constant cst = inits[j].constant;
              if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                if (irritants != null) {
                  if (suppressWarningIrritants == null) {
                    suppressWarningIrritants = new IrritantSet(irritants);
                  } else if (suppressWarningIrritants.set(irritants) == null) {
                      scope.problemReporter().unusedWarningToken(inits[j]);
                  }
                } else {
                  scope.problemReporter().unhandledWarningToken(inits[j]);
                }
              }
            }
          }
        } else {
          Constant cst = value.constant;
          if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
            IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
            if (irritants != null) {
              suppressWarningIrritants = new IrritantSet(irritants);
              // TODO: should check for unused warning token against enclosing annotation as well ?
            } else {
              scope.problemReporter().unhandledWarningToken(value);
            }
          }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

      removed++;
      problems[iProblem] = null;
      if (this.compilationResult.problemsMap != null) this.compilationResult.problemsMap.remove(problem);
      if (this.compilationResult.firstErrors != null) this.compilationResult.firstErrors.remove(problem);
      if (foundIrritants[iSuppress] == null){
        foundIrritants[iSuppress] = new IrritantSet(irritant);
      } else {
        foundIrritants[iSuppress].set(irritant);
      }
      continue nextProblem;
    }
  }
  // compact remaining problems
  if (removed > 0) {
    for (int i = 0, index = 0; i < problemCount; i++) {
      CategorizedProblem problem;
      if ((problem = problems[i]) != null) {
        if (i > index) {
          problems[index++] = problem;
        } else {
          index++;
        }
      }
    }
    this.compilationResult.problemCount -= removed;
  }
  // flag SuppressWarnings which had no effect (only if no (mandatory) error got detected within unit
  if (!hasErrors) {
    int severity = options.getSeverity(CompilerOptions.UnusedWarningToken);
    if (severity != ProblemSeverities.Ignore) {
      boolean unusedWarningTokenIsWarning = (severity & ProblemSeverities.Error) == 0;
      for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
        Annotation annotation = this.suppressWarningAnnotations[iSuppress];
        if (annotation == null) continue; // implicit annotation
        IrritantSet irritants = this.suppressWarningIrritants[iSuppress];
        if (unusedWarningTokenIsWarning && irritants.areAllSet()) continue; // @SuppressWarnings("all") also suppresses unused warning token
        if (irritants != foundIrritants[iSuppress]) { // mismatch, some warning tokens were unused
          MemberValuePair[] pairs = annotation.memberValuePairs();
          pairLoop: for (int iPair = 0, pairCount = pairs.length; iPair < pairCount; iPair++) {
            MemberValuePair pair = pairs[iPair];
            if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
              Expression value = pair.value;
              if (value instanceof ArrayInitializer) {
                ArrayInitializer initializer = (ArrayInitializer) value;
                Expression[] inits = initializer.expressions;
                if (inits != null) {
                  for (int iToken = 0, tokenCount = inits.length; iToken < tokenCount; iToken++) {
                    Constant cst = inits[iToken].constant;
                    if (cst != Constant.NotAConstant && cst.typeID() == TypeIds.T_JavaLangString) {
                      IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                      if (tokenIrritants != null
                          && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                          && options.isAnyEnabled(tokenIrritants) // if irritant is effectevely enabled
                          && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                        if (unusedWarningTokenIsWarning) {
                          int start = value.sourceStart, end = value.sourceEnd;
                          nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
                            long position = this.suppressWarningScopePositions[jSuppress];
                            int startSuppress = (int) (position >>> 32);
                            int endSuppress = (int) position;
                            if (start < startSuppress) continue nextSuppress;
                            if (end > endSuppress) continue nextSuppress;
                            if (this.suppressWarningIrritants[jSuppress].areAllSet()) break pairLoop; // suppress all?
                          }
                        }
                        this.scope.problemReporter().unusedWarningToken(inits[iToken]);
                      }
                    }
                  }
                }
              } else {
                Constant cst = value.constant;
                if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                  IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                  if (tokenIrritants != null
                      && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                      && options.isAnyEnabled(tokenIrritants) // if irritant is effectevely enabled
                      && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                    if (unusedWarningTokenIsWarning) {
                      int start = value.sourceStart, end = value.sourceEnd;
                      nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

    this.type.printExpression(0, output);
    return output;
  }

  public void recordSuppressWarnings(Scope scope, int startSuppresss, int endSuppress, boolean isSuppressingWarnings) {
    IrritantSet suppressWarningIrritants = null;
    MemberValuePair[] pairs = memberValuePairs();
    pairLoop: for (int i = 0, length = pairs.length; i < length; i++) {
      MemberValuePair pair = pairs[i];
      if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
        Expression value = pair.value;
        if (value instanceof ArrayInitializer) {
          ArrayInitializer initializer = (ArrayInitializer) value;
          Expression[] inits = initializer.expressions;
          if (inits != null) {
            for (int j = 0, initsLength = inits.length; j < initsLength; j++) {
              Constant cst = inits[j].constant;
              if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                if (irritants != null) {
                  if (suppressWarningIrritants == null) {
                    suppressWarningIrritants = new IrritantSet(irritants);
                  } else if (suppressWarningIrritants.set(irritants) == null) {
                      scope.problemReporter().unusedWarningToken(inits[j]);
                  }
                } else {
                  scope.problemReporter().unhandledWarningToken(inits[j]);
                }
              }
            }
          }
        } else {
          Constant cst = value.constant;
          if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
            IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
            if (irritants != null) {
              suppressWarningIrritants = new IrritantSet(irritants);
              // TODO: should check for unused warning token against enclosing annotation as well ?
            } else {
              scope.problemReporter().unhandledWarningToken(value);
            }
          }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

      // discard suppressed warning
      removed++;
      problems[iProblem] = null;
      this.compilationResult.removeProblem(problem);
      if (foundIrritants[iSuppress] == null){
        foundIrritants[iSuppress] = new IrritantSet(irritant);
      } else {
        foundIrritants[iSuppress].set(irritant);
      }
      continue nextProblem;
    }
  }
  // compact remaining problems
  if (removed > 0) {
    for (int i = 0, index = 0; i < problemCount; i++) {
      CategorizedProblem problem;
      if ((problem = problems[i]) != null) {
        if (i > index) {
          problems[index++] = problem;
        } else {
          index++;
        }
      }
    }
  }
  // flag SuppressWarnings which had no effect (only if no (mandatory) error got detected within unit
  if (!hasMandatoryErrors) {
    int severity = options.getSeverity(CompilerOptions.UnusedWarningToken);
    if (severity != ProblemSeverities.Ignore) {
      boolean unusedWarningTokenIsWarning = (severity & ProblemSeverities.Error) == 0;
      for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
        Annotation annotation = this.suppressWarningAnnotations[iSuppress];
        if (annotation == null) continue; // implicit annotation
        IrritantSet irritants = this.suppressWarningIrritants[iSuppress];
        if (unusedWarningTokenIsWarning && irritants.areAllSet()) continue; // @SuppressWarnings("all") also suppresses unused warning token
        if (irritants != foundIrritants[iSuppress]) { // mismatch, some warning tokens were unused
          MemberValuePair[] pairs = annotation.memberValuePairs();
          pairLoop: for (int iPair = 0, pairCount = pairs.length; iPair < pairCount; iPair++) {
            MemberValuePair pair = pairs[iPair];
            if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
              Expression value = pair.value;
              if (value instanceof ArrayInitializer) {
                ArrayInitializer initializer = (ArrayInitializer) value;
                Expression[] inits = initializer.expressions;
                if (inits != null) {
                  for (int iToken = 0, tokenCount = inits.length; iToken < tokenCount; iToken++) {
                    Constant cst = inits[iToken].constant;
                    if (cst != Constant.NotAConstant && cst.typeID() == TypeIds.T_JavaLangString) {
                      IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                      if (tokenIrritants != null
                          && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                          && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                          && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                        if (unusedWarningTokenIsWarning) {
                          int start = value.sourceStart, end = value.sourceEnd;
                          nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
                            long position = this.suppressWarningScopePositions[jSuppress];
                            int startSuppress = (int) (position >>> 32);
                            int endSuppress = (int) position;
                            if (start < startSuppress) continue nextSuppress;
                            if (end > endSuppress) continue nextSuppress;
                            if (this.suppressWarningIrritants[jSuppress].areAllSet()) break pairLoop; // suppress all?
                          }
                        }
                        this.scope.problemReporter().unusedWarningToken(inits[iToken]);
                      }
                    }
                  }
                }
              } else {
                Constant cst = value.constant;
                if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                  IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                  if (tokenIrritants != null
                      && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                      && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                      && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                    if (unusedWarningTokenIsWarning) {
                      int start = value.sourceStart, end = value.sourceEnd;
                      nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

      // discard suppressed warning
      removed++;
      problems[iProblem] = null;
      this.compilationResult.removeProblem(problem);
      if (foundIrritants[iSuppress] == null){
        foundIrritants[iSuppress] = new IrritantSet(irritant);
      } else {
        foundIrritants[iSuppress].set(irritant);
      }
      continue nextProblem;
    }
  }
  // compact remaining problems
  if (removed > 0) {
    for (int i = 0, index = 0; i < problemCount; i++) {
      CategorizedProblem problem;
      if ((problem = problems[i]) != null) {
        if (i > index) {
          problems[index++] = problem;
        } else {
          index++;
        }
      }
    }
  }
  // flag SuppressWarnings which had no effect (only if no (mandatory) error got detected within unit
  if (!hasMandatoryErrors) {
    int severity = options.getSeverity(CompilerOptions.UnusedWarningToken);
    if (severity != ProblemSeverities.Ignore) {
      boolean unusedWarningTokenIsWarning = (severity & ProblemSeverities.Error) == 0;
      for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
        Annotation annotation = this.suppressWarningAnnotations[iSuppress];
        if (annotation == null) continue; // implicit annotation
        IrritantSet irritants = this.suppressWarningIrritants[iSuppress];
        if (unusedWarningTokenIsWarning && irritants.areAllSet()) continue; // @SuppressWarnings("all") also suppresses unused warning token
        if (irritants != foundIrritants[iSuppress]) { // mismatch, some warning tokens were unused
          MemberValuePair[] pairs = annotation.memberValuePairs();
          pairLoop: for (int iPair = 0, pairCount = pairs.length; iPair < pairCount; iPair++) {
            MemberValuePair pair = pairs[iPair];
            if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
              Expression value = pair.value;
              if (value instanceof ArrayInitializer) {
                ArrayInitializer initializer = (ArrayInitializer) value;
                Expression[] inits = initializer.expressions;
                if (inits != null) {
                  for (int iToken = 0, tokenCount = inits.length; iToken < tokenCount; iToken++) {
                    Constant cst = inits[iToken].constant;
                    if (cst != Constant.NotAConstant && cst.typeID() == TypeIds.T_JavaLangString) {
                      IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                      if (tokenIrritants != null
                          && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                          && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                          && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                        if (unusedWarningTokenIsWarning) {
                          int start = value.sourceStart, end = value.sourceEnd;
                          nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
                            long position = this.suppressWarningScopePositions[jSuppress];
                            int startSuppress = (int) (position >>> 32);
                            int endSuppress = (int) position;
                            if (start < startSuppress) continue nextSuppress;
                            if (end > endSuppress) continue nextSuppress;
                            if (this.suppressWarningIrritants[jSuppress].areAllSet()) break pairLoop; // suppress all?
                          }
                        }
                        this.scope.problemReporter().unusedWarningToken(inits[iToken]);
                      }
                    }
                  }
                }
              } else {
                Constant cst = value.constant;
                if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                  IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                  if (tokenIrritants != null
                      && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                      && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                      && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                    if (unusedWarningTokenIsWarning) {
                      int start = value.sourceStart, end = value.sourceEnd;
                      nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

    this.type.printExpression(0, output);
    return output;
  }

  public void recordSuppressWarnings(Scope scope, int startSuppresss, int endSuppress, boolean isSuppressingWarnings) {
    IrritantSet suppressWarningIrritants = null;
    MemberValuePair[] pairs = memberValuePairs();
    pairLoop: for (int i = 0, length = pairs.length; i < length; i++) {
      MemberValuePair pair = pairs[i];
      if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
        Expression value = pair.value;
        if (value instanceof ArrayInitializer) {
          ArrayInitializer initializer = (ArrayInitializer) value;
          Expression[] inits = initializer.expressions;
          if (inits != null) {
            for (int j = 0, initsLength = inits.length; j < initsLength; j++) {
              Constant cst = inits[j].constant;
              if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                if (irritants != null) {
                  if (suppressWarningIrritants == null) {
                    suppressWarningIrritants = new IrritantSet(irritants);
                  } else if (suppressWarningIrritants.set(irritants) == null) {
                      scope.problemReporter().unusedWarningToken(inits[j]);
                  }
                } else {
                  scope.problemReporter().unhandledWarningToken(inits[j]);
                }
              }
            }
          }
        } else {
          Constant cst = value.constant;
          if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
            IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
            if (irritants != null) {
              suppressWarningIrritants = new IrritantSet(irritants);
              // TODO: should check for unused warning token against enclosing annotation as well ?
            } else {
              scope.problemReporter().unhandledWarningToken(value);
            }
          }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

    this.type.printExpression(0, output);
    return output;
  }

  public void recordSuppressWarnings(Scope scope, int startSuppresss, int endSuppress, boolean isSuppressingWarnings) {
    IrritantSet suppressWarningIrritants = null;
    MemberValuePair[] pairs = memberValuePairs();
    pairLoop: for (int i = 0, length = pairs.length; i < length; i++) {
      MemberValuePair pair = pairs[i];
      if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
        Expression value = pair.value;
        if (value instanceof ArrayInitializer) {
          ArrayInitializer initializer = (ArrayInitializer) value;
          Expression[] inits = initializer.expressions;
          if (inits != null) {
            for (int j = 0, initsLength = inits.length; j < initsLength; j++) {
              Constant cst = inits[j].constant;
              if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                if (irritants != null) {
                  if (suppressWarningIrritants == null) {
                    suppressWarningIrritants = new IrritantSet(irritants);
                  } else if (suppressWarningIrritants.set(irritants) == null) {
                      scope.problemReporter().unusedWarningToken(inits[j]);
                  }
                } else {
                  scope.problemReporter().unhandledWarningToken(inits[j]);
                }
              }
            }
          }
        } else {
          Constant cst = value.constant;
          if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
            IrritantSet irritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
            if (irritants != null) {
              suppressWarningIrritants = new IrritantSet(irritants);
              // TODO: should check for unused warning token against enclosing annotation as well ?
            } else {
              scope.problemReporter().unhandledWarningToken(value);
            }
          }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.impl.IrritantSet

      // discard suppressed warning
      removed++;
      problems[iProblem] = null;
      this.compilationResult.removeProblem(problem);
      if (foundIrritants[iSuppress] == null){
        foundIrritants[iSuppress] = new IrritantSet(irritant);
      } else {
        foundIrritants[iSuppress].set(irritant);
      }
      continue nextProblem;
    }
  }
  // compact remaining problems
  if (removed > 0) {
    for (int i = 0, index = 0; i < problemCount; i++) {
      CategorizedProblem problem;
      if ((problem = problems[i]) != null) {
        if (i > index) {
          problems[index++] = problem;
        } else {
          index++;
        }
      }
    }
  }
  // flag SuppressWarnings which had no effect (only if no (mandatory) error got detected within unit
  if (!hasMandatoryErrors) {
    int severity = options.getSeverity(CompilerOptions.UnusedWarningToken);
    if (severity != ProblemSeverities.Ignore) {
      boolean unusedWarningTokenIsWarning = (severity & ProblemSeverities.Error) == 0;
      for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
        Annotation annotation = this.suppressWarningAnnotations[iSuppress];
        if (annotation == null) continue; // implicit annotation
        IrritantSet irritants = this.suppressWarningIrritants[iSuppress];
        if (unusedWarningTokenIsWarning && irritants.areAllSet()) continue; // @SuppressWarnings("all") also suppresses unused warning token
        if (irritants != foundIrritants[iSuppress]) { // mismatch, some warning tokens were unused
          MemberValuePair[] pairs = annotation.memberValuePairs();
          pairLoop: for (int iPair = 0, pairCount = pairs.length; iPair < pairCount; iPair++) {
            MemberValuePair pair = pairs[iPair];
            if (CharOperation.equals(pair.name, TypeConstants.VALUE)) {
              Expression value = pair.value;
              if (value instanceof ArrayInitializer) {
                ArrayInitializer initializer = (ArrayInitializer) value;
                Expression[] inits = initializer.expressions;
                if (inits != null) {
                  for (int iToken = 0, tokenCount = inits.length; iToken < tokenCount; iToken++) {
                    Constant cst = inits[iToken].constant;
                    if (cst != Constant.NotAConstant && cst.typeID() == TypeIds.T_JavaLangString) {
                      IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                      if (tokenIrritants != null
                          && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                          && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                          && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                        if (unusedWarningTokenIsWarning) {
                          int start = value.sourceStart, end = value.sourceEnd;
                          nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
                            long position = this.suppressWarningScopePositions[jSuppress];
                            int startSuppress = (int) (position >>> 32);
                            int endSuppress = (int) position;
                            if (start < startSuppress) continue nextSuppress;
                            if (end > endSuppress) continue nextSuppress;
                            if (this.suppressWarningIrritants[jSuppress].areAllSet()) break pairLoop; // suppress all?
                          }
                        }
                        this.scope.problemReporter().unusedWarningToken(inits[iToken]);
                      }
                    }
                  }
                }
              } else {
                Constant cst = value.constant;
                if (cst != Constant.NotAConstant && cst.typeID() == T_JavaLangString) {
                  IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue());
                  if (tokenIrritants != null
                      && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all")
                      && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled
                      && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem
                    if (unusedWarningTokenIsWarning) {
                      int start = value.sourceStart, end = value.sourceEnd;
                      nextSuppress: for (int jSuppress = iSuppress - 1; jSuppress >= 0; jSuppress--) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.