Package org.eclipse.jdt.internal.compiler

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.hasErrors()) {
        anyRemoved = true;

        // TODO: defer this until later?
        TreeLogger branch = logger.branch(TreeLogger.ERROR, "Errors in '"
            + unit.getDisplayLocation() + "'", null);

        for (CategorizedProblem error : result.getErrors()) {
          // Append 'Line #: msg' to the error message.
          StringBuffer msgBuf = new StringBuffer();
          int line = error.getSourceLineNumber();
          if (line > 0) {
            msgBuf.append("Line ");
View Full Code Here


*/
public class GWTProblem extends DefaultProblem {

  public static void recordInCud(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(compResult.fileName, message,
        node.sourceStart(), node.sourceEnd(), startLine, startColumn, helpInfo);
    compResult.record(problem, cud);
  }
View Full Code Here

    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

   */
  private static class BuildDeclMapVisitor extends ASTVisitor {

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

     * more straightforward), it makes for fewer kinds of things to worry about
     * when optimizing (more aggressive optimizations), and it's how Java
     * actually implements the stuff under the hood anyway.
     */
    private boolean process(TypeDeclaration typeDeclaration) {
      CompilationResult compResult = typeDeclaration.compilationResult;
      currentSeparatorPositions = compResult.lineSeparatorPositions;
      currentFileName = String.valueOf(compResult.fileName);
      SourceTypeBinding binding = typeDeclaration.binding;

      if (binding.constantPoolName() == null) {
View Full Code Here

   * types; it must be done is a subsequent pass.
   */
  private static class BuildTypeMapVisitor extends ASTVisitor {

    private static 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 new SourceInfo(typeDecl.sourceStart, typeDecl.bodyEnd, startLine,
View Full Code Here

      return null;
    }
  };
 
  public EcjTreeBuilder(lombok.ast.grammar.Source source, CompilerOptions options) {
    this(source, createDefaultProblemReporter(options), createSilentProblemReporter(options), new CompilationResult(source.getName().toCharArray(), 0, 0, 0));
  }
View Full Code Here

  public EcjTreeBuilder(lombok.ast.grammar.Source source, CompilerOptions options) {
    this(source, createDefaultProblemReporter(options), createSilentProblemReporter(options), new CompilationResult(source.getName().toCharArray(), 0, 0, 0));
  }
 
  public EcjTreeBuilder(String rawInput, String name, CompilerOptions options) {
    this(rawInput, createDefaultProblemReporter(options), createSilentProblemReporter(options), new CompilationResult(name.toCharArray(), 0, 0, 0));
  }
View Full Code Here

      super(makeDummyParser(reporter, mainTypeName));
    }
   
    private static Parser makeDummyParser(ProblemReporter reporter, String mainTypeName) {
      Parser parser = new Parser(reporter, false);
      CompilationResult cr = new CompilationResult((mainTypeName + ".java").toCharArray(), 0, 1, 0);
      parser.compilationUnit = new CompilationUnitDeclaration(reporter, cr, 0);
      return parser;
    }
View Full Code Here

        if (sourceUnit == null) {
            sourceUnit = new CompilationUnit(code.toCharArray(), context.file.getName(), UTF_8);
        }
        try {
            CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
            return getParser().parse(sourceUnit, compilationResult);
        } catch (AbortCompilation e) {
            // No need to report Java parsing errors while running in Eclipse.
            // Eclipse itself will already provide problem markers for these files,
            // so all this achieves is creating "multiple annotations on this line"
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.CompilationResult

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.