protected void ensureProjectHasRefactoringEnabled(RefactoringStatus status)
      throws PreconditionFailure {
    if (FortranCorePlugin.inTestingMode()) return;

    HashSet<IFile> filesToBeRemoved = new HashSet<IFile>();

    for (IFile f : this.selectedFiles) {
      if (!PhotranVPG.getInstance().doesProjectHaveRefactoringEnabled(f)) {
        if (f.getProject() == null) {
          status.addWarning(
              Messages.bind(
                  Messages.FortranResourceRefactoring_FileIsNotInAFortranProject, f.getName()));
          filesToBeRemoved.add(f);
        } else {
          status.addWarning(
              Messages.bind(
                  Messages.FortranResourceRefactoring_AnalysisRefactoringNotEnabled,
                  f.getProject().getName()));
          filesToBeRemoved.add(f);
        }
      }
    }
    // Remove files that didn't have Refactoring enabled in their projects
    this.selectedFiles.removeAll(filesToBeRemoved);
  }
    /**
     * Check whether the new definition will either conflict with or shadow an existing definition
     */
    private List<PhotranTokenRef> findReferencesToShadowedDefinitions() {
      List<PhotranTokenRef> referencesToShadowedDefinitions = new LinkedList<PhotranTokenRef>();

      for (String newName : newNames) {
        Token token =
            definitionToCheck == null
                ? new FakeToken(scopeOfDefinitionToCheck, newName)
                : new FakeToken(definitionToCheck.getTokenRef().findToken(), newName);

        List<PhotranTokenRef> shadowedDefinitions = scopeOfDefinitionToCheck.manuallyResolve(token);
        // TODO: Does not consider rename or only lists (need to tell if this SPECIFIC definition
        // will be imported)
        for (ScopingNode importingScope : scopeOfDefinitionToCheck.findImportingScopes()) {
          pm.subTask(
              Messages.bind(
                  Messages.FortranResourceRefactoring_CheckingForReferencesTo,
                  newName,
                  importingScope.describe()));
          shadowedDefinitions.addAll(importingScope.manuallyResolve(token));
        }

        for (PhotranTokenRef def : shadowedDefinitions) {
          Definition definition = PhotranVPG.getInstance().getDefinitionFor(def);
          if (definition != null)
            referencesToShadowedDefinitions.addAll(definition.findAllReferences(false));
        }
      }

      return referencesToShadowedDefinitions;
    }
 public WebQueryWizardPage(TaskRepository repository, IRepositoryQuery query) {
   super(Messages.WebQueryWizardPage_New_web_query, repository, query);
   setTitle(Messages.WebQueryWizardPage_Create_web_query);
   setDescription(
       Messages.bind(
           Messages.WebQueryWizardPage_Specify_query_parameters_for_X,
           repository.getRepositoryUrl()));
 }
Beispiel #4
0
 /** Add an additional binary type */
 public void accept(
     IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) {
   if (this.options.verbose) {
     this.out.println(
         Messages.bind(Messages.compilation_loadBinary, new String(binaryType.getName())));
     //			new Exception("TRACE BINARY").printStackTrace(System.out);
     //		    System.out.println();
   }
   this.lookupEnvironment.createBinaryTypeFrom(binaryType, packageBinding, accessRestriction);
 }
  /**
   * Add the initial set of compilation units into the loop -> build compilation unit declarations,
   * their bindings and record their results.
   */
  protected void internalBeginToCompile(ICompilationUnit[] sourceUnits, int maxUnits) {
    if (!this.useSingleThread && maxUnits >= ReadManager.THRESHOLD)
      this.parser.readManager = new ReadManager(sourceUnits, maxUnits);

    // Switch the current policy and compilation result for this unit to the requested one.
    for (int i = 0; i < maxUnits; i++) {
      CompilationResult unitResult = null;
      try {
        if (this.options.verbose) {
          this.out.println(
              Messages.bind(
                  Messages.compilation_request,
                  new String[] {
                    String.valueOf(i + 1),
                    String.valueOf(maxUnits),
                    new String(sourceUnits[i].getFileName())
                  }));
        }
        // diet parsing for large collection of units
        CompilationUnitDeclaration parsedUnit;
        unitResult =
            new CompilationResult(sourceUnits[i], i, maxUnits, this.options.maxProblemsPerUnit);
        long parseStart = System.currentTimeMillis();
        if (this.totalUnits < this.parseThreshold) {
          parsedUnit = this.parser.parse(sourceUnits[i], unitResult);
        } else {
          parsedUnit = this.parser.dietParse(sourceUnits[i], unitResult);
        }
        long resolveStart = System.currentTimeMillis();
        this.stats.parseTime += resolveStart - parseStart;
        // initial type binding creation
        this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
        this.stats.resolveTime += System.currentTimeMillis() - resolveStart;
        addCompilationUnit(sourceUnits[i], parsedUnit);
        ImportReference currentPackage = parsedUnit.currentPackage;
        if (currentPackage != null) {
          unitResult.recordPackageName(currentPackage.tokens);
        }
        // } catch (AbortCompilationUnit e) {
        //	requestor.acceptResult(unitResult.tagAsAccepted());
      } catch (AbortCompilation a) {
        // best effort to find a way for reporting this problem:
        if (a.compilationResult == null) a.compilationResult = unitResult;
        throw a;
      } finally {
        sourceUnits[i] = null; // no longer hold onto the unit
      }
    }
    if (this.parser.readManager != null) {
      this.parser.readManager.shutdown();
      this.parser.readManager = null;
    }
    // binding resolution
    this.lookupEnvironment.completeTypeBindings();
  }
Beispiel #6
0
 /** Add additional source types */
 public void accept(
     ISourceType[] sourceTypes,
     PackageBinding packageBinding,
     AccessRestriction accessRestriction) {
   this.problemReporter.abortDueToInternalError(
       Messages.bind(
           Messages.abort_againstSourceModel,
           new String[] {
             String.valueOf(sourceTypes[0].getName()), String.valueOf(sourceTypes[0].getFileName())
           }));
 }
Beispiel #7
0
  /*
   * Compiler crash recovery in case of unexpected runtime exceptions
   */
  protected void handleInternalException(
      Throwable internalException, CompilationUnitDeclaration unit, CompilationResult result) {

    if (result == null && unit != null) {
      result = unit.compilationResult; // current unit being processed ?
    }
    // Lookup environment may be in middle of connecting types
    if (result == null && this.lookupEnvironment.unitBeingCompleted != null) {
      result = this.lookupEnvironment.unitBeingCompleted.compilationResult;
    }
    if (result == null) {
      synchronized (this) {
        if (this.unitsToProcess != null && this.totalUnits > 0)
          result = this.unitsToProcess[this.totalUnits - 1].compilationResult;
      }
    }
    // last unit in beginToCompile ?

    boolean needToPrint = true;
    if (result != null) {
      /* create and record a compilation problem */
      // only keep leading portion of the trace
      String[] pbArguments =
          new String[] {
            Messages.bind(
                Messages.compilation_internalError, Util.getExceptionSummary(internalException)),
          };

      result.record(
          this.problemReporter.createProblem(
              result.getFileName(),
              IProblem.Unclassified,
              pbArguments,
              pbArguments,
              Error, // severity
              0, // source start
              0, // source end
              0, // line number
              0), // column number
          unit);

      /* hand back the compilation result */
      if (!result.hasBeenAccepted) {
        this.requestor.acceptResult(result.tagAsAccepted());
        needToPrint = false;
      }
    }
    if (needToPrint) {
      /* dump a stack trace to the console */
      internalException.printStackTrace();
    }
  }
Beispiel #8
0
 public void save() {
   getPreferenceStore();
   if (preferenceStore.needsSaving() || needsSaving) {
     try {
       if (defaultSet != -1) preferenceStore.setValue(KEY_DEFAULT, defaultSet > 0);
       preferenceStore.save();
       needsSaving = false;
     } catch (IOException e) {
       String message = Messages.bind(Messages.ScopeSet_errorSaving, name);
       HelpUIPlugin.logError(message, e);
     }
   }
 }
Beispiel #9
0
 public IPreferenceStore getPreferenceStore() {
   if (preferenceStore == null) {
     preferenceStore = new PreferenceStore(getFileName(this.name));
     try {
       File file = new File(getFileName(this.name));
       if (file.exists()) {
         preferenceStore.load();
       }
     } catch (IOException e) {
       String message = Messages.bind(Messages.ScopeSet_errorLoading, name);
       HelpUIPlugin.logError(message, e);
     }
   }
   return preferenceStore;
 }
  protected void removeCpreprocessedFilesFrom(Collection<IFile> files, RefactoringStatus status) {
    Set<IFile> filesToRemove = new HashSet<IFile>();

    for (IFile file : files) {
      if (!filesToRemove.contains(file)
          && org.eclipse.photran.internal.core.sourceform.SourceForm.isCPreprocessed(file)) {
        status.addError(
            Messages.bind(
                Messages.FortranResourceRefactoring_CPreprocessedFileWillNotBeRefactored,
                file.getName()));
        filesToRemove.add(file);
      }
    }

    files.removeAll(filesToRemove);
  }
  protected void removeFixedFormFilesFrom(Collection<IFile> files, RefactoringStatus status) {
    if (FIXED_FORM_REFACTORING_ENABLED) return;

    Set<IFile> filesToRemove = new HashSet<IFile>();

    for (IFile file : files) {
      if (!filesToRemove.contains(file)
          && org.eclipse.photran.internal.core.sourceform.SourceForm.isFixedForm(file)) {
        status.addError(
            Messages.bind(
                Messages.FortranResourceRefactoring_FixedFormFileWillNotBeRefactored,
                file.getName()));
        filesToRemove.add(file);
      }
    }

    files.removeAll(filesToRemove);
  }
    private void checkIfReferenceBindingWillChange(
        IConflictingBindingCallback callback,
        PhotranTokenRef ref,
        boolean shouldReferenceRenamedDefinition) {
      pm.subTask(
          Messages.bind(
              Messages.FortranResourceRefactoring_CheckingForBindingConflictsIn,
              PhotranVPG.lastSegmentOfFilename(ref.getFilename())));

      Token reference = ref.findToken();

      if (definitionToCheck != null) {
        ScopingNode scopeOfDefinitionToRename =
            reference.findScopeDeclaringOrImporting(definitionToCheck);
        if (scopeOfDefinitionToRename == null) return;

        for (String newName : newNames) {
          for (PhotranTokenRef existingBinding :
              new FakeToken(reference, newName).manuallyResolveBinding()) {
            ScopingNode scopeOfExistingBinding = existingBinding.findToken().getEnclosingScope();

            boolean willReferenceRenamedDefinition =
                scopeOfExistingBinding.isParentScopeOf(scopeOfDefinitionToRename);
            if (shouldReferenceRenamedDefinition != willReferenceRenamedDefinition)
              callback.addReferenceWillChangeError(newName, reference);
          }
        }
      } else {
        if (scopeOfDefinitionToCheck == reference.getLocalScope()
            || scopeOfDefinitionToCheck.isParentScopeOf(reference.getLocalScope())) {
          for (String newName : newNames) {
            for (PhotranTokenRef existingBinding :
                new FakeToken(reference, newName).manuallyResolveBinding()) {
              ScopingNode scopeOfExistingBinding = existingBinding.findToken().getEnclosingScope();

              boolean willReferenceRenamedDefinition =
                  scopeOfExistingBinding.isParentScopeOf(scopeOfDefinitionToCheck);
              if (shouldReferenceRenamedDefinition != willReferenceRenamedDefinition)
                callback.addReferenceWillChangeError(newName, reference);
            }
          }
        }
      }
    }
Beispiel #13
0
  /**
   * Add an additional compilation unit into the loop -> build compilation unit declarations, their
   * bindings and record their results.
   */
  public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
    // Switch the current policy and compilation result for this unit to the requested one.
    CompilationResult unitResult =
        new CompilationResult(
            sourceUnit, this.totalUnits, this.totalUnits, this.options.maxProblemsPerUnit);
    unitResult.checkSecondaryTypes = true;
    try {
      if (this.options.verbose) {
        String count = String.valueOf(this.totalUnits + 1);
        this.out.println(
            Messages.bind(
                Messages.compilation_request,
                new String[] {count, count, new String(sourceUnit.getFileName())}));
      }
      // diet parsing for large collection of unit
      CompilationUnitDeclaration parsedUnit;
      if (this.totalUnits < this.parseThreshold) {
        parsedUnit = this.parser.parse(sourceUnit, unitResult);
      } else {
        parsedUnit = this.parser.dietParse(sourceUnit, unitResult);
      }
      parsedUnit.bits |= ASTNode.IsImplicitUnit;
      // initial type binding creation
      this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
      addCompilationUnit(sourceUnit, parsedUnit);

      // binding resolution
      this.lookupEnvironment.completeTypeBindings(parsedUnit);
    } catch (AbortCompilationUnit e) {
      // at this point, currentCompilationUnitResult may not be sourceUnit, but some other
      // one requested further along to resolve sourceUnit.
      if (unitResult.compilationUnit == sourceUnit) { // only report once
        this.requestor.acceptResult(unitResult.tagAsAccepted());
      } else {
        throw e; // want to abort enclosing request to compile
      }
    }
  }
Beispiel #14
0
 /** @param name The name to set. */
 public void setName(String name) {
   String oldFileName = getFileName(this.name);
   File oldFile = new File(oldFileName);
   if (oldFile.exists()) {
     // store under the old name already exists
     if (preferenceStore == null) {
       // just rename the file
       oldFile.renameTo(new File(getFileName(name)));
     } else {
       // remove the old file, set the new file name,
       // then save to create the new file
       oldFile.delete();
       preferenceStore.setFilename(getFileName(name));
       try {
         preferenceStore.save();
       } catch (IOException e) {
         String message = Messages.bind(Messages.ScopeSet_errorSaving, name);
         HelpUIPlugin.logError(message, e);
       }
     }
   }
   this.name = name;
 }
    private List<Conflict> findAllPotentiallyConflictingDefinitions() {
      List<Conflict> conflicts = new ArrayList<Conflict>();

      if (definitionToCheck != null) {
        // Cannot call a main program (or function, etc.) X if it has an internal subprogram named
        // X,
        // even if that subprogram is never used (in which case it wouldn't be caught below)
        if (definitionToCheck.isMainProgram()
            || definitionToCheck.isSubprogram()
            || definitionToCheck.isModule()) {
          findAllPotentiallyConflictingDefinitionsInScope(
              conflicts,
              definitionToCheck.getTokenRef().findToken().findNearestAncestor(ScopingNode.class),
              false);
        }
        for (String newName : newNames) {
          if (definitionToCheck.isInternalSubprogramDefinition()
              && scopeContainingInternalSubprogram().isNamed(newName)) {
            conflicts.add(
                new Conflict(
                    newName, scopeContainingInternalSubprogram().getNameToken().getTokenRef()));
          }
        }
      }

      for (ScopingNode importingScope :
          scopeItselfAndAllScopesThatImport(scopeOfDefinitionToCheck)) {
        pm.subTask(
            Messages.bind(
                Messages.FortranResourceRefactoring_CheckingForConflictingDefinitionsIn,
                importingScope.describe()));
        findAllPotentiallyConflictingDefinitionsInScope(conflicts, importingScope, true);
      }

      return conflicts;
    }
    private List<Conflict> findAllPotentiallyConflictingUnboundSubprogramCalls() {
      final List<Conflict> conflictingDef = new ArrayList<Conflict>();

      for (ScopingNode importingScope :
          scopeItselfAndAllScopesThatImport(scopeOfDefinitionToCheck)) {
        pm.subTask(
            Messages.bind(
                Messages.FortranResourceRefactoring_CheckingForSubprogramBindingConflictsIn,
                importingScope.describe()));

        importingScope.accept(
            new GenericASTVisitor() {
              @Override
              public void visitASTVarOrFnRefNode(ASTVarOrFnRefNode node) {
                if (node.getName() != null && node.getName().getName() != null)
                  checkForConflict(node.getName().getName());
              }

              @Override
              public void visitASTCallStmtNode(ASTCallStmtNode node) {
                if (node.getSubroutineName() != null) checkForConflict(node.getSubroutineName());
              }

              private void checkForConflict(Token name) {
                if (name.getLogicalFile() != null)
                  for (String newName : newNames)
                    if (name != null
                        && name.getText().equals(newName)
                        && name.resolveBinding().isEmpty())
                      conflictingDef.add(new Conflict(newName, name.getTokenRef()));
              }
            });
      }

      return conflictingDef;
    }
  private void executeWorkflowInBackground() {

    DistributedComponentKnowledge compKnowledge =
        serviceRegistryAccess
            .getService(DistributedComponentKnowledgeService.class)
            .getCurrentComponentKnowledge();

    try {
      WorkflowExecutionUtils.replaceNullNodeIdentifiersWithActualNodeIdentifier(
          wfDescription, localNodeId, compKnowledge);
    } catch (WorkflowExecutionException e) {
      handleWorkflowExecutionError(e);
      return;
    }

    String name = wfDescription.getName();
    if (name == null) {
      name = Messages.bind(Messages.defaultWorkflowName, wfFile.getName().toString());
    }

    WorkflowExecutionContextBuilder wfExeCtxBuilder =
        new WorkflowExecutionContextBuilder(wfDescription);
    wfExeCtxBuilder.setInstanceName(name);
    wfExeCtxBuilder.setNodeIdentifierStartedExecution(localNodeId);
    if (wfDescription.getAdditionalInformation() != null
        && !wfDescription.getAdditionalInformation().isEmpty()) {
      wfExeCtxBuilder.setAdditionalInformationProvidedAtStart(
          wfDescription.getAdditionalInformation());
    }
    WorkflowExecutionContext wfExecutionContext = wfExeCtxBuilder.build();

    final WorkflowExecutionInformation wfExeInfo;
    try {
      wfExeInfo = workflowExecutionService.executeWorkflowAsync(wfExecutionContext);
    } catch (WorkflowExecutionException | RemoteOperationException e) {
      handleWorkflowExecutionError(e);
      return;
    }

    // before starting the workflow, ensure that the console model is initialized
    // so that no console output gets lost; this is lazily initialized here
    // so the application startup is not slowed down
    try {
      serviceRegistryAccess
          .getService(ConsoleRowModelService.class)
          .ensureConsoleCaptureIsInitialized();
    } catch (InterruptedException e) {
      LOG.error(
          "Failed initialize workflow console capturing for workflow: " + wfDescription.getName(),
          e);
    }

    if (inputTabEnabled) {
      InputModel.ensureInputCaptureIsInitialized();
    }

    WorkflowExecutionUtils.removeDisabledWorkflowNodesWithoutNotify(
        wfExeInfo.getWorkflowDescription());
    Display.getDefault()
        .asyncExec(
            new Runnable() {

              @Override
              public void run() {
                new OpenReadOnlyWorkflowRunEditorAction(wfExeInfo).run();
              }
            });
  }
 protected static String describeTokenPos(Token token) {
   return Messages.bind(
       Messages.FortranResourceRefactoring_LineColumn, token.getLine(), token.getCol());
 }
Beispiel #19
0
  /**
   * General API -> compile each of supplied files -> recompile any required types for which we have
   * an incomplete principle structure
   */
  public void compile(ICompilationUnit[] sourceUnits) {
    this.stats.startTime = System.currentTimeMillis();
    // GROOVY start
    // sort the sourceUnits - java first! might be temporary, hmmm
    if (this.options.buildGroovyFiles == 2) {
      int groovyFileIndex = -1;
      //			System.out.println("before");
      //			for (int u=0,max=sourceUnits.length;u<max;u++) {
      //				System.out.println(sourceUnits[u].getFileName());
      //			}
      for (int u = 0, max = sourceUnits.length; u < max; u++) {
        char[] fn = sourceUnits[u].getFileName();
        boolean isDotJava = fn[fn.length - 1] == 'a'; // a means .java
        if (isDotJava) {
          if (groovyFileIndex != -1) {
            // swap them!
            ICompilationUnit swap = sourceUnits[groovyFileIndex];
            sourceUnits[groovyFileIndex] = sourceUnits[u];
            sourceUnits[u] = swap;
            // find the next .groovy file after the groovyFileIndex (worst case it will be 'u')
            int newGroovyFileIndex = -1;
            for (int g = groovyFileIndex; g <= u; g++) {
              char[] fn2 = sourceUnits[g].getFileName();
              boolean isDotGroovy = fn2[fn2.length - 1] == 'm'; // ZALUUM
              if (isDotGroovy) {
                newGroovyFileIndex = g;
                break;
              }
            }
            groovyFileIndex = newGroovyFileIndex;
          }
        } else {
          if (groovyFileIndex == -1) {
            groovyFileIndex = u;
          }
        }
      }
      //			System.out.println("after");
      //			for (int u=0,max=sourceUnits.length;u<max;u++) {
      //				System.out.println(sourceUnits[u].getFileName());
      //			}
    }
    // GROOVY end
    CompilationUnitDeclaration unit = null;
    ProcessTaskManager processingTask = null;
    try {
      // build and record parsed units
      reportProgress(Messages.compilation_beginningToCompile);

      if (this.annotationProcessorManager == null) {
        beginToCompile(sourceUnits);
      } else {
        ICompilationUnit[] originalUnits =
            (ICompilationUnit[])
                sourceUnits.clone(); // remember source units in case a source type collision occurs
        try {
          beginToCompile(sourceUnits);

          processAnnotations();
          if (!this.options.generateClassFiles) {
            // -proc:only was set on the command line
            return;
          }
        } catch (SourceTypeCollisionException e) {
          reset();
          // a generated type was referenced before it was created
          // the compiler either created a MissingType or found a BinaryType for it
          // so add the processor's generated files & start over,
          // but remember to only pass the generated files to the annotation processor
          int originalLength = originalUnits.length;
          int newProcessedLength = e.newAnnotationProcessorUnits.length;
          ICompilationUnit[] combinedUnits =
              new ICompilationUnit[originalLength + newProcessedLength];
          System.arraycopy(originalUnits, 0, combinedUnits, 0, originalLength);
          System.arraycopy(
              e.newAnnotationProcessorUnits, 0, combinedUnits, originalLength, newProcessedLength);
          this.annotationProcessorStartIndex = originalLength;
          compile(combinedUnits);
          return;
        }
      }

      if (this.useSingleThread) {
        // process all units (some more could be injected in the loop by the lookup environment)
        for (int i = 0; i < this.totalUnits; i++) {
          unit = this.unitsToProcess[i];
          reportProgress(
              Messages.bind(Messages.compilation_processing, new String(unit.getFileName())));
          try {
            if (this.options.verbose)
              this.out.println(
                  Messages.bind(
                      Messages.compilation_process,
                      new String[] {
                        String.valueOf(i + 1),
                        String.valueOf(this.totalUnits),
                        new String(this.unitsToProcess[i].getFileName())
                      }));
            process(unit, i);
          } finally {
            // cleanup compilation unit result
            unit.cleanUp();
          }
          this.unitsToProcess[i] = null; // release reference to processed unit declaration

          reportWorked(1, i);
          this.stats.lineCount += unit.compilationResult.lineSeparatorPositions.length;
          long acceptStart = System.currentTimeMillis();
          this.requestor.acceptResult(unit.compilationResult.tagAsAccepted());
          this.stats.generateTime +=
              System.currentTimeMillis() - acceptStart; // record accept time as part of generation
          if (this.options.verbose)
            this.out.println(
                Messages.bind(
                    Messages.compilation_done,
                    new String[] {
                      String.valueOf(i + 1),
                      String.valueOf(this.totalUnits),
                      new String(unit.getFileName())
                    }));
        }
      } else {
        processingTask = new ProcessTaskManager(this);
        int acceptedCount = 0;
        // process all units (some more could be injected in the loop by the lookup environment)
        // the processTask can continue to process units until its fixed sized cache is full then it
        // must wait
        // for this this thread to accept the units as they appear (it only waits if no units are
        // available)
        while (true) {
          try {
            unit = processingTask.removeNextUnit(); // waits if no units are in the processed queue
          } catch (Error e) {
            unit = processingTask.unitToProcess;
            throw e;
          } catch (RuntimeException e) {
            unit = processingTask.unitToProcess;
            throw e;
          }
          if (unit == null) break;
          reportWorked(1, acceptedCount++);
          this.stats.lineCount += unit.compilationResult.lineSeparatorPositions.length;
          this.requestor.acceptResult(unit.compilationResult.tagAsAccepted());
          if (this.options.verbose)
            this.out.println(
                Messages.bind(
                    Messages.compilation_done,
                    new String[] {
                      String.valueOf(acceptedCount),
                      String.valueOf(this.totalUnits),
                      new String(unit.getFileName())
                    }));
        }
      }
    } catch (AbortCompilation e) {
      this.handleInternalException(e, unit);
    } catch (Error e) {
      this.handleInternalException(e, unit, null);
      throw e; // rethrow
    } catch (RuntimeException e) {
      this.handleInternalException(e, unit, null);
      throw e; // rethrow
    } finally {
      if (processingTask != null) {
        processingTask.shutdown();
        processingTask = null;
      }
      reset();
      this.annotationProcessorStartIndex = 0;
      this.stats.endTime = System.currentTimeMillis();
    }
    if (this.options.verbose) {
      if (this.totalUnits > 1) {
        this.out.println(
            Messages.bind(Messages.compilation_units, String.valueOf(this.totalUnits)));
      } else {
        this.out.println(Messages.bind(Messages.compilation_unit, String.valueOf(this.totalUnits)));
      }
    }
  }