Package org.eclipse.jdt.core.compiler

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


        end = methodDeclaration.bodyEnd;
        // try to get the best end position
        CategorizedProblem[] problems = methodDeclaration.compilationResult().problems;
        if (problems != null) {
          for (int i = 0, max = methodDeclaration.compilationResult().problemCount; i < max; i++) {
            CategorizedProblem currentProblem = problems[i];
            if (currentProblem.getSourceStart() == start && currentProblem.getID() == IProblem.ParsingErrorInsertToComplete) {
              end = currentProblem.getSourceEnd();
              break;
            }
          }
        }
        int startPosition = methodDecl.getStartPosition();
View Full Code Here


      int localProblemCount = 0;
      if (count != 0) {
        int errors = 0;
        int warnings = 0;
        for (int i = 0; i < count; i++) {
          CategorizedProblem problem = (CategorizedProblem) problems.get(i);
          if (problem != null) {
            currentMain.globalProblemsCount++;
            logExtraProblem(problem, localProblemCount, currentMain.globalProblemsCount);
            localProblemCount++;
            if (problem.isError()) {
              errors++;
              currentMain.globalErrorsCount++;
            } else if (problem.isWarning()) {
              currentMain.globalWarningsCount++;
              warnings++;
            }
          }
        }
        if ((this.tagBits & Logger.XML) != 0) {
          if ((errors + warnings) != 0) {
            startLoggingExtraProblems(count);
            for (int i = 0; i < count; i++) {
              CategorizedProblem problem = (CategorizedProblem) problems.get(i);
              if (problem!= null) {
                if (problem.getID() != IProblem.Task) {
                  logXmlExtraProblem(problem, localProblemCount, currentMain.globalProblemsCount);
                }
              }
            }
            endLoggingExtraProblems();
View Full Code Here

      if (count != 0) {
        int errors = 0;
        int warnings = 0;
        int tasks = 0;
        for (int i = 0; i < count; i++) {
          CategorizedProblem problem = problems[i];
          if (problem != null) {
            currentMain.globalProblemsCount++;
            logProblem(problem, localProblemCount, currentMain.globalProblemsCount, unitSource);
            localProblemCount++;
            if (problem.isError()) {
              localErrorCount++;
              errors++;
              currentMain.globalErrorsCount++;
            } else if (problem.getID() == IProblem.Task) {
              currentMain.globalTasksCount++;
              tasks++;
            } else {
              currentMain.globalWarningsCount++;
              warnings++;
            }
          }
        }
        if ((this.tagBits & Logger.XML) != 0) {
          if ((errors + warnings) != 0) {
            startLoggingProblems(errors, warnings);
            for (int i = 0; i < count; i++) {
              CategorizedProblem problem = problems[i];
              if (problem!= null) {
                if (problem.getID() != IProblem.Task) {
                  logXmlProblem(problem, unitSource);
                }
              }
            }
            endLoggingProblems();
          }
          if (tasks != 0) {
            startLoggingTasks(tasks);
            for (int i = 0; i < count; i++) {
              CategorizedProblem problem = problems[i];
              if (problem!= null) {
                if (problem.getID() == IProblem.Task) {
                  logXmlTask(problem, unitSource);
                }
              }
            }
            endLoggingTasks();
View Full Code Here

    code.append("  }-*/;\n");
    code.append("}\n");
    String source = code.toString();
    CategorizedProblem[] problems = getProblems("Foo", source);
    assertEquals(1, problems.length);
    CategorizedProblem problem = problems[0];
    assertEquals(source.indexOf('@') + "Bar".length(), problem.getSourceStart());
    assertEquals(3, problem.getSourceLineNumber());
    assertTrue(problem.isError());
    assertEquals("Expected \":\" in JSNI reference\n>     @Bar;\n> --------^",
        problem.getMessage());
  }
View Full Code Here

    code.append("  }-*/;\n");
    code.append("}\n");
    String source = code.toString();
    CategorizedProblem[] problems = getProblems("Foo", source);
    assertEquals(1, problems.length);
    CategorizedProblem problem = problems[0];
    assertEquals(source.indexOf('@') + "Bar".length(), problem.getSourceStart());
    assertEquals(9, problem.getSourceLineNumber());
    assertTrue(problem.isError());
    assertEquals("Expected \":\" in JSNI reference\n>     @Bar;\n> --------^",
        problem.getMessage());
  }
View Full Code Here

    code.append("}\n");
    String source = code.toString();

    CategorizedProblem[] problems = getProblems("Foo", source);
    assertEquals(1, problems.length);
    CategorizedProblem problem = problems[0];
    if (JSNI_PARSES_SOURCE_POSITION) {
      assertEquals(source.indexOf('@'), problem.getSourceStart());
    }
    assertEquals(3, problem.getSourceLineNumber());
    assertTrue(problem.isError());
    assertEquals(
        "Referencing method 'Foo.m(Ljava/lang/String)': unable to resolve method in class 'Foo'",
        problem.getMessage());
  }
View Full Code Here

  }

  private static void recordProblem(int startPos, int endPos, int startLine,
      int startColumn, CompilationResult compResult, String message,
      HelpInfo helpInfo, int problemSeverity) {
    CategorizedProblem problem =
        new GWTProblem(compResult.fileName, startPos, endPos, startLine,
            startColumn, message, helpInfo, problemSeverity);
    compResult.record(problem, null);
  }
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

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.