code: 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, true);
  
              /* 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();
          }
      }
docs: /*
  Compiler crash recovery in case of unexpected runtime exceptions