Examples of CompilationResult


Examples of org.eclipse.jdt.internal.compiler.CompilationResult

        CompilationUnitScope scope) {
      return process(typeDeclaration);
    }

    private SourceInfo makeSourceInfo(TypeDeclaration typeDecl) {
      CompilationResult compResult = typeDecl.compilationResult;
      int[] indexes = compResult.lineSeparatorPositions;
      String fileName = String.valueOf(compResult.fileName);
      int startLine = Util.getLineNumber(typeDecl.sourceStart, indexes, 0,
          indexes.length - 1);
      return program.createSourceInfo(typeDecl.sourceStart, typeDecl.bodyEnd,
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.CompilationResult

    new JsniRefGenerationVisitor(jprogram, jsProgram, jsniMethodMap).accept(jprogram);
  }

  public static void reportJsniError(SourceInfo info,
      AbstractMethodDeclaration methodDeclaration, String message) {
    CompilationResult compResult = methodDeclaration.compilationResult();
    // recalculate startColumn, because SourceInfo does not hold it
    int startColumn = Util.searchColumnNumber(
        compResult.getLineSeparatorPositions(), info.getStartLine(),
        info.getStartPos());
    DefaultProblem problem = new DefaultProblem(
        info.getFileName().toCharArray(), message,
        IProblem.ExternalProblemNotFixable, null, ProblemSeverities.Error,
        info.getStartPos(), info.getEndPos(), info.getStartLine(), startColumn);
    compResult.record(problem, methodDeclaration);
  }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.CompilationResult

    recordInCud(ProblemSeverities.Error, node, cud, message, helpInfo);
  }

  public static void recordInCud(int problemSeverity, ASTNode node,
      CompilationUnitDeclaration cud, String message, HelpInfo helpInfo) {
    CompilationResult compResult = cud.compilationResult();
    int[] lineEnds = compResult.getLineSeparatorPositions();
    int startLine = Util.getLineNumber(node.sourceStart(), lineEnds, 0,
        lineEnds.length - 1);
    int startColumn = Util.searchColumnNumber(lineEnds, startLine,
        node.sourceStart());
    DefaultProblem problem = new GWTProblem(problemSeverity,
        compResult.fileName, message, node.sourceStart(), node.sourceEnd(),
        startLine, startColumn, helpInfo);
    compResult.record(problem, cud);
  }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.CompilationResult

    boolean anyRemoved = false;
    for (CompilationUnit unit : units) {
      if (unit.getState() != State.COMPILED) {
        continue;
      }
      CompilationResult result = unit.getJdtCud().compilationResult();
      if (result.hasProblems()) {

        // Log the errors and GWT warnings.
        TreeLogger branch = null;
        for (CategorizedProblem problem : result.getProblems()) {
          TreeLogger.Type logLevel;
          if (problem.isError()) {
            // Log errors.
            logLevel = TreeLogger.ERROR;
            // Only log GWT-specific warnings.
          } else if (problem.isWarning() && problem instanceof GWTProblem) {
            logLevel = TreeLogger.WARN;
          } else {
            // Ignore all other problems.
            continue;
          }
          // Append 'Line #: msg' to the error message.
          StringBuffer msgBuf = new StringBuffer();
          int line = problem.getSourceLineNumber();
          if (line > 0) {
            msgBuf.append("Line ");
            msgBuf.append(line);
            msgBuf.append(": ");
          }
          msgBuf.append(problem.getMessage());

          HelpInfo helpInfo = null;
          if (problem instanceof GWTProblem) {
            GWTProblem gwtProblem = (GWTProblem) problem;
            helpInfo = gwtProblem.getHelpInfo();
          }
          if (branch == null) {
            Type branchType = result.hasErrors() ? TreeLogger.ERROR
                : TreeLogger.WARN;
            String branchString = result.hasErrors() ? "Errors" : "Warnings";
            branch = logger.branch(branchType, branchString + " in '"
                + unit.getDisplayLocation() + "'", null);
          }
          branch.log(logLevel, msgBuf.toString(), null, helpInfo);
        }

        if (branch != null) {
          Util.maybeDumpSource(branch, unit.getDisplayLocation(),
              unit.getSource(), unit.getTypeName());
        }

        // Invalidate the unit if there are errors.
        if (result.hasErrors()) {
          unit.setError();
          anyRemoved = true;
        }
      }
    }
View Full Code Here

Examples of org.mapstruct.ap.testutil.compilation.annotation.CompilationResult

        return false;
    }

    public static CompilationOutcomeDescriptor forResult(String sourceDir, boolean compilationSuccessful,
                                                         List<Diagnostic<? extends JavaFileObject>> diagnostics) {
        CompilationResult compilationResult =
            compilationSuccessful ? CompilationResult.SUCCEEDED : CompilationResult.FAILED;

        List<DiagnosticDescriptor> diagnosticDescriptors = new ArrayList<DiagnosticDescriptor>();
        for ( Diagnostic<? extends JavaFileObject> diagnostic : diagnostics ) {
            //ignore notes created by the compiler
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.