Examples of CompilationResult


Examples of org.apache.sling.commons.compiler.CompilationResult

        // clear exception
        this.compileException = null;
        try {
            final CompilerOptions opts = this.ioProvider.getForceCompileOptions();
            final CompilationUnit unit = new CompilationUnit(this.sourcePath, className, ioProvider);
            final CompilationResult result = this.ioProvider.getCompiler().compile(new org.apache.sling.commons.compiler.CompilationUnit[] {unit},
                    opts);

            final List<CompilerMessage> errors = result.getErrors();
            this.destroy();
            if ( errors != null && errors.size() > 0 ) {
                throw CompilerException.create(errors, this.sourcePath);
            }

            final Servlet servlet = (Servlet) result.loadCompiledClass(this.className).newInstance();

            servlet.init(this.config);
            this.injectFields(servlet);

            this.theServlet = servlet;
View Full Code Here

Examples of org.apache.sling.commons.compiler.CompilationResult

            // Default to 1.6
            options.put(Options.KEY_TARGET_VERSION, Options.VERSION_1_6);
        }

        final ArrayList<JavacErrorDetail> problemList = new ArrayList<JavacErrorDetail>();
        final CompilationResult result = this.ctxt.getRuntimeContext().getIOProvider().getJavaCompiler().compile(new CompilationUnit[] {unit}, options);
        if ( result.getErrors() != null ) {
            for(final CompilerMessage cm : result.getErrors() ) {
                final String name = cm.getFile();
                try {
                    problemList.add(ErrorDispatcher.createJavacError
                            (name, pageNodes, new StringBuffer(cm.getMessage()),
                                    cm.getLine(), ctxt));
View Full Code Here

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

    List ret = new ArrayList();
    for (Iterator binIter = binarySourceEntries.keySet().iterator(); binIter.hasNext();) {
      String sourceFileName = (String) binIter.next();
      List unwovenClassFiles = (List) binarySourceEntries.get(sourceFileName);
      // XXX - see bugs 57432,58679 - final parameter on next call should be "compiler.options.maxProblemsPerUnit"
      CompilationResult result = new CompilationResult(sourceFileName.toCharArray(), 0, 0, Integer.MAX_VALUE);
      result.noSourceAvailable();
      InterimCompilationResult binarySource = new InterimCompilationResult(result, unwovenClassFiles);
      ret.add(binarySource);
    }
    return ret;
  }
View Full Code Here

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

          // throw new RuntimeException("Primary source location must match the file we are currently processing!");
        }
      }
    }

    CompilationResult problemSource = currentlyWeaving;
    if (problemSource == null) {
      // must be a problem found during completeTypeBindings phase of begin to compile
      if (sLoc instanceof EclipseSourceLocation) {
        problemSource = ((EclipseSourceLocation) sLoc).getCompilationResult();
      }
      if (problemSource == null) {
        // XXX this is ok for ajc, will have to do better for AJDT in time...
        return sink.handleMessage(message);
      }
    }
    int startPos = getStartPos(sLoc, problemSource);
    int endPos = getEndPos(sLoc, problemSource);
    int severity = message.isError() ? ProblemSeverities.Error : ProblemSeverities.Warning;
    char[] filename = problemSource.fileName;
    boolean usedBinarySourceFileName = false;
    if (problemSource.isFromBinarySource()) {
      if (sLoc != null) {
        filename = sLoc.getSourceFile().getPath().toCharArray();
        usedBinarySourceFileName = true;
      }
    }
View Full Code Here

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

    List<InterimCompilationResult> ret = new ArrayList<InterimCompilationResult>();
    for (Iterator<String> binIter = binarySourceEntries.keySet().iterator(); binIter.hasNext();) {
      String sourceFileName = binIter.next();
      List<UnwovenClassFile> unwovenClassFiles = binarySourceEntries.get(sourceFileName);
      // XXX - see bugs 57432,58679 - final parameter on next call should be "compiler.options.maxProblemsPerUnit"
      CompilationResult result = new CompilationResult(sourceFileName.toCharArray(), 0, 0, Integer.MAX_VALUE);
      result.noSourceAvailable();
      InterimCompilationResult binarySource = new InterimCompilationResult(result, unwovenClassFiles);
      ret.add(binarySource);
    }
    return ret;
  }
View Full Code Here

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

          // ensure dumping problems for enqueued units as well, since may contain primary errors (123476)
          CompilationUnitDeclaration[] queuedUnits = Main.this.batchCompiler.unitsToProcess;
          for (int i = 0, length = Main.this.batchCompiler.totalUnits; i < length; i++) {
            CompilationUnitDeclaration queuedUnit = queuedUnits[i];
            if (queuedUnit == null) continue;
            CompilationResult result = queuedUnit.compilationResult;
            if (result.hasProblems() && !result.hasBeenAccepted) {
              Main.this.logger.logProblems(result.getAllProblems(), result.compilationUnit.getContents(), Main.this);
            }
          }
          Main.this.logger.endLoggingSource();
          Main.this.logger.endLoggingSources();
          Main.this.logger.printStats();
View Full Code Here

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

    // see bug 47079 for more details
    int[] oldLineEnds = this.scanner.lineEnds;
    int oldLinePtr = this.scanner.linePtr;

    //real parse of the method....
    CompilationResult compilationResult = unit.compilationResult;
    char[] contents = compilationResult.compilationUnit.getContents();
    this.scanner.setSource(contents, compilationResult);
   
    if (this.javadocParser != null && this.javadocParser.checkDocComment) {
      this.javadocParser.scanner.setSource(contents);
View Full Code Here

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

    // walks the source units
    this.requestedSources = new HashtableOfObject();
    for (int i = 0; i < sourceLength; i++) {
      org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = sourceUnits[i];
      CompilationUnitDeclaration parsedUnit;
      CompilationResult unitResult =
        new CompilationResult(sourceUnit, index++, maxUnits, this.options.maxProblemsPerUnit);
      try {
        if (options.verbose) {
          this.out.println(
            Messages.bind(Messages.compilation_request,
            new String[] {
              String.valueOf(index++ + 1),
              String.valueOf(maxUnits),
              new String(sourceUnit.getFileName())
            }));
        }
        // diet parsing for large collection of units
        if (this.totalUnits < this.parseThreshold) {
          parsedUnit = this.parser.parse(sourceUnit, unitResult);
        } else {
          parsedUnit = this.parser.dietParse(sourceUnit, unitResult);
        }
        // initial type binding creation
        this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
        addCompilationUnit(sourceUnit, parsedUnit);
        this.requestedSources.put(unitResult.getFileName(), sourceUnit);
        worked(1);
      } finally {
        sourceUnits[i] = null; // no longer hold onto the unit
      }
    }
View Full Code Here

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

        false);
      int length = compilationUnits.length;
      if (monitor != null) monitor.beginTask("", length); //$NON-NLS-1$
      for (int i = 0; i < length; i++) {
        org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = (org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit) compilationUnits[i];
        CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
        CompilationUnitDeclaration compilationUnitDeclaration = parser.dietParse(sourceUnit, compilationResult);

        if (compilationUnitDeclaration.ignoreMethodBodies) {
          compilationUnitDeclaration.ignoreFurtherInvestigation = true;
          // if initial diet parse did not work, no need to dig into method bodies.
View Full Code Here

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

      new ProblemReporter(
          DefaultErrorHandlingPolicies.proceedWithAllProblems(),
          compilerOptions,
          new DefaultProblemFactory()),
      false);
    CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
    CompilationUnitDeclaration compilationUnitDeclaration = parser.dietParse(sourceUnit, compilationResult);

    if (compilationUnitDeclaration.ignoreMethodBodies) {
      compilationUnitDeclaration.ignoreFurtherInvestigation = true;
      // if initial diet parse did not work, no need to dig into method bodies.
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.