Package org.eclipse.jdt.internal.compiler.batch

Examples of org.eclipse.jdt.internal.compiler.batch.CompilationUnit


          problemFactory, options, reportLocalDeclarations,
          optimizeStringLiterals);

      File sourceFile = findSourceFile(klass);
      sourceContents = read(sourceFile);
      CompilationUnit unit = new CompilationUnit(sourceContents,
          sourceFile.getName(), null);

      parser.parseCompilationUnit(unit, true);
    }
View Full Code Here


            String contents = context.getContents();
            if (contents == null) {
                continue;
            }
            File file = context.file;
            CompilationUnit unit = new CompilationUnit(contents.toCharArray(), file.getPath(),
                    UTF_8);
            sources.add(unit);
            mSourceUnits.put(file, unit);
        }
        List<String> classPath = computeClassPath(contexts);
        mCompiled = Maps.newHashMapWithExpectedSize(mSourceUnits.size());
        try {
            parse(createCompilerOptions(), sources, classPath, mCompiled, mClient);
        } catch (Throwable t) {
            mClient.log(t, "ECJ compiler crashed");
        }

        if (DEBUG_DUMP_PARSE_ERRORS) {
            for (CompilationUnitDeclaration unit : mCompiled.values()) {
                // so maybe I don't need my map!!
                CategorizedProblem[] problems = unit.compilationResult()
                        .getAllProblems();
                if (problems != null) {
                    for (IProblem problem : problems) {
                        if (problem == null || !problem.isError()) {
                            continue;
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) {
View Full Code Here

        CompilationResult compilationResult = new CompilationResult(cu, 0, 0, options.maxProblemsPerUnit);
        return compilationResult;
    }

    private static ICompilationUnit createCompilationunit(String source, String filename) {
        ICompilationUnit cu = new CompilationUnit(source.toCharArray(), filename, null);
        return cu;
    }
View Full Code Here

    private static CompilationResult createDefaultCompilationResult(ICompilationUnit cu, CompilerOptions options) {
        return new CompilationResult(cu, 0, 0, options.maxProblemsPerUnit);
    }

    private static ICompilationUnit createCompilationUnit(String source, String filename) {
        return new CompilationUnit(source.toCharArray(), filename, null);
    }
View Full Code Here

      if (javaFileObject.getKind() != JavaFileObject.Kind.SOURCE) {
        throw new IllegalArgumentException();
      }
      String name = javaFileObject.getName();
      name = name.replace('\\', '/');
      CompilationUnit compilationUnit = new CompilationUnit(null,
        name,
        null) {

        @Override
        public char[] getContents() {
View Full Code Here

    if (!_closed) {
      _closed = true;
      //TODO: support encoding
      switch(this.getKind()) {
        case SOURCE :
          CompilationUnit unit = new CompilationUnit(null, _fileName, null /* encoding */);
          _filer.addNewUnit(unit);
          break;
        case CLASS :
          IBinaryType binaryType = null;
          try {
View Full Code Here

    CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false);
    parser.setMethodsFullRecovery(false);
    parser.setStatementsRecovery(enabledStatementRecovery);

    ICompilationUnit sourceUnit =
      new CompilationUnit(
        source,
        "", //$NON-NLS-1$
        compilerOptions.defaultEncoding);

    CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
View Full Code Here

          compilerOptions,
          new DefaultProblemFactory(Locale.getDefault())),
      false);

    ICompilationUnit sourceUnit =
      new CompilationUnit(
        source,
        "", //$NON-NLS-1$
        compilerOptions.defaultEncoding);
    final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
    CompilationUnitDeclaration compilationUnitDeclaration = parser.dietParse(sourceUnit, compilationResult);
View Full Code Here

          new DefaultProblemFactory(Locale.getDefault()));

    CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false);

    ICompilationUnit sourceUnit =
      new CompilationUnit(
        source,
        "", //$NON-NLS-1$
        compilerOptions.defaultEncoding);

    CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.batch.CompilationUnit

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.