Package org.eclipse.jdt.core.compiler

Examples of org.eclipse.jdt.core.compiler.CategorizedProblem


         */
        public void acceptResult(org.eclipse.jdt.internal.compiler.CompilationResult result) {
            if (result.hasProblems()) {
                CategorizedProblem[] problems = result.getProblems();
                for (int i = 0; i < problems.length; i++) {
                    CategorizedProblem problem = problems[i];
                    String msg = problem.getMessage();
                    String fileName = CharOperation.charToString(problem.getOriginatingFileName());
                    int line = problem.getSourceLineNumber();
                    int pos = problem.getSourceStart();

                    if (problem.isError()) {
                        this.errorHandler.onError(msg, fileName, line, pos);
                    } else if (problem.isWarning()) {
                        this.errorHandler.onWarning(msg, fileName, line, pos);
                    } else {
                        logger.debug("unknown problem category: {}", problem);
                    }
                }
View Full Code Here


      String filePath = icunit.getPath().toOSString();
      String[] args = new String[]{};

      int severity = isError ? ProblemSeverities.Error : ProblemSeverities.Warning;

      CategorizedProblem problem = new DefaultProblem(filePath.toCharArray(), msg, id,
          args, severity, start, endChar, line, col)
      {
        @Override
        public String getMarkerType()
        {
View Full Code Here

  CategorizedProblem[] allProblems = new CategorizedProblem[totalNumberOfProblem];
  int allProblemIndex = 0;
  int taskIndex = 0;
  int problemIndex = 0;
  while (taskIndex + problemIndex < totalNumberOfProblem) {
    CategorizedProblem nextTask = null;
    CategorizedProblem nextProblem = null;
    if (taskIndex < onlyTaskCount) {
      nextTask = onlyTasks[taskIndex];
    }
    if (problemIndex < onlyProblemCount) {
      nextProblem = onlyProblems[problemIndex];
    }
    // select the next problem
    CategorizedProblem currentProblem = null;
    if (nextProblem != null) {
      if (nextTask != null) {
        if (nextProblem.getSourceStart() < nextTask.getSourceStart()) {
          currentProblem = nextProblem;
          problemIndex++;
View Full Code Here

    while (computePriority(problemList[right]) < mid)
      right--;
    while (mid < computePriority(problemList[left]))
      left++;
    if (left <= right) {
      CategorizedProblem tmp = problemList[left];
      problemList[left] = problemList[right];
      problemList[right] = tmp;
      left++;
      right--;
    }
View Full Code Here

    if (problems != null) {
      int max = problems.length;
      StringBuffer buffer = new StringBuffer(25);
      int count = 0;
      for (int i = 0; i < max; i++) {
        CategorizedProblem problem = problems[i];
        if ((problem != null) && (problem.isError())) {
          buffer.append("\t"  +problem.getMessage() + "\n" ); //$NON-NLS-1$ //$NON-NLS-2$
          count++;
          if (problemLine == 0) {
            problemLine = problem.getSourceLineNumber();
          }
          problems[i] = null;
        }
      } // insert the top line afterwards, once knowing how many problems we have to consider
      if (count > 1) {
View Full Code Here

    if (problems != null) {
      int max = problems.length;
      StringBuffer buffer = new StringBuffer(25);
      int count = 0;
      for (int i = 0; i < max; i++) {
        CategorizedProblem problem = problems[i];
        if ((problem != null) && (problem.isError())) {
          buffer.append("\t"  +problem.getMessage() + "\n" ); //$NON-NLS-1$ //$NON-NLS-2$
          count++;
          if (problemLine == 0) {
            problemLine = problem.getSourceLineNumber();
          }
        }
      } // insert the top line afterwards, once knowing how many problems we have to consider
      if (count > 1) {
        buffer.insert(0, Messages.compilation_unresolvedProblems);
View Full Code Here

    if (problems != null) {
      int max = problems.length;
      StringBuffer buffer = new StringBuffer(25);
      int count = 0;
      for (int i = 0; i < max; i++) {
        CategorizedProblem problem = problems[i];
        if ((problem != null)
          && (problem.isError())
          && (problem.getSourceStart() >= method.declarationSourceStart)
          && (problem.getSourceEnd() <= method.declarationSourceEnd)) {
          buffer.append("\t"  +problem.getMessage() + "\n" ); //$NON-NLS-1$ //$NON-NLS-2$
          count++;
          if (problemLine == 0) {
            problemLine = problem.getSourceLineNumber();
          }
          problems[i] = null;
        }
      } // insert the top line afterwards, once knowing how many problems we have to consider
      if (count > 1) {
View Full Code Here

        MethodBinding methodBinding = methodDeclaration.binding;
         String readableName = new String(methodBinding.readableName());
         CategorizedProblem[] problems = compilationResult.problems;
         int problemsCount = compilationResult.problemCount;
        for (int j = 0; j < problemsCount; j++) {
          CategorizedProblem problem = problems[j];
          if (problem != null
              && problem.getID() == IProblem.AbstractMethodMustBeImplemented
              && problem.getMessage().indexOf(readableName) != -1
              && problem.getSourceStart() >= typeDeclarationSourceStart
              && problem.getSourceEnd() <= typeDeclarationSourceEnd) {
            // we found a match
            addMissingAbstractProblemMethod(methodDeclaration, methodBinding, problem, compilationResult);
          }
        }
      }
View Full Code Here

  int problemCount = this.compilationResult.problemCount;
  IrritantSet[] foundIrritants = new IrritantSet[this.suppressWarningsCount];
  CompilerOptions options = this.scope.compilerOptions();
  boolean hasMandatoryErrors = false;
  nextProblem: for (int iProblem = 0, length = problemCount; iProblem < length; iProblem++) {
    CategorizedProblem problem = problems[iProblem];
    int problemID = problem.getID();
    int irritant = ProblemReporter.getIrritant(problemID);
    boolean isError = problem.isError();
    if (isError) {
      if (irritant == 0) {
        // tolerate unused warning tokens when mandatory errors
        hasMandatoryErrors = true;
        continue;
      }
      if (!options.suppressOptionalErrors) {
        continue;
      }
    }
    int start = problem.getSourceStart();
    int end = problem.getSourceEnd();
    nextSuppress: for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
      long position = this.suppressWarningScopePositions[iSuppress];
      int startSuppress = (int) (position >>> 32);
      int endSuppress = (int) position;
      if (start < startSuppress) continue nextSuppress;
      if (end > endSuppress) continue nextSuppress;
      if (!this.suppressWarningIrritants[iSuppress].isSet(irritant))
        continue nextSuppress;
      // 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++;
View Full Code Here

    return;

  // if no reference context, we need to abort from the current compilation process
  if (referenceContext == null) {
    if ((severity & ProblemSeverities.Error) != 0) { // non reportable error is fatal
      CategorizedProblem problem = this.createProblem(null, problemId, problemArguments, elaborationId, messageArguments, severity, 0, 0, 0, 0);
      throw new AbortCompilation(null, problem);
    } else {
      return; // ignore non reportable warning
    }
  }

  int[] lineEnds;
  int lineNumber = problemStartPosition >= 0
      ? Util.getLineNumber(problemStartPosition, lineEnds = unitResult.getLineSeparatorPositions(), 0, lineEnds.length-1)
      : 0;
  int columnNumber = problemStartPosition >= 0
      ? Util.searchColumnNumber(unitResult.getLineSeparatorPositions(), lineNumber, problemStartPosition)
      : 0;
  CategorizedProblem problem =
    this.createProblem(
      unitResult.getFileName(),
      problemId,
      problemArguments,
      elaborationId,
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.compiler.CategorizedProblem

Copyright © 2018 www.massapicom. 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.