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

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


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

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

    final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
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

      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

    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

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

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

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

            throws Exception {
        CompilationUnit[] units = new CompilationUnit[streams.size()];
        int i = 0;
        for (CtFile stream : streams) {
            InputStream in = stream.getContent();
            units[i] = new CompilationUnit(Util.getInputStreamAsCharArray(in,
                    -1, null), stream.getPath(), null);
            in.close();
            i++;
        }
        return units;
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

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.