Roberto Lublinerman has uploaded a new change for review.

  https://gwt-review.googlesource.com/2683


Change subject: Allow GWT to continue even in presence of internal JDT compiler Errors.
......................................................................

Allow GWT to continue even in presence of internal JDT compiler Errors.

Change-Id: Id7df86271fc64ac75e0857d17e557e79d870854a
---
M dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
1 file changed, 22 insertions(+), 5 deletions(-)



diff --git a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
index 716e2c6..51749eb 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
@@ -375,6 +375,12 @@
     }
   }

+  /**
+ * Maximun number of JDT compiler errors or abort requests before it actually returns
+   * a fatal error to the user.
+   */
+  private static final double ABORT_COUNT_MAX = 100;
+
   private class CompilerImpl extends Compiler {
     private TreeLogger logger;
     private int abortCount = 0;
@@ -420,9 +426,14 @@
             "JDT aborted: " + filename + ": " + e.problem.getMessage());
         return; // continue without it; it might be a server-side class.
       } catch (RuntimeException e) {
+        abortCount++;
+        String filename = new String(cud.getFileName());
         logger.log(TreeLogger.Type.ERROR,
-            "JDT died after " + abortCount + " previous errors", e);
-        throw new AbortCompilation(cud.compilationResult, e);
+            "JDT threw an exception: " + filename + e);
+        if (abortCount >= ABORT_COUNT_MAX) {
+          throw new AbortCompilation(cud.compilationResult, e);
+        }
+        return; // continue without it; it might be a server-side class.
       }
       ClassFile[] classFiles = cud.compilationResult().getClassFiles();
Map<ClassFile, CompiledClass> results = new LinkedHashMap<ClassFile, CompiledClass>();
@@ -458,6 +469,10 @@
new CompiledClass(classFile.getBytes(), enclosingClass, isLocalType(classFile),
               internalName);
       results.put(classFile, result);
+    }
+
+    int getAbortCount() {
+      return abortCount;
     }
   }

@@ -922,15 +937,17 @@
     try {
compilerImpl.compile(icus.toArray(new ICompilationUnit[icus.size()]));
     } catch (AbortCompilation e) {
+ final String compilerAborted = String.format("JDT compiler aborted after %d errors",
+          compilerImpl.getAbortCount());
       if (e.problem == null) {
-        logger.log(TreeLogger.Type.ERROR, "JDT compiler aborted");
+        logger.log(TreeLogger.Type.ERROR, compilerAborted + ".");
       } else if (e.problem.getOriginatingFileName() == null) {
- logger.log(TreeLogger.Type.ERROR, "JDT compiler aborted: " + e.problem.getMessage()); + logger.log(TreeLogger.Type.ERROR, compilerAborted + ": " + e.problem.getMessage());
       } else {
         String filename = new String(e.problem.getOriginatingFileName());
         TreeLogger branch = logger.branch(TreeLogger.Type.ERROR,
             "At " + filename + ": " + e.problem.getSourceLineNumber());
- branch.log(TreeLogger.Type.ERROR, "JDT compiler aborted: " + e.problem.getMessage()); + branch.log(TreeLogger.Type.ERROR, compilerAborted + ": " + e.problem.getMessage());
       }
       throw new UnableToCompleteException();
     } finally {

--
To view, visit https://gwt-review.googlesource.com/2683
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7df86271fc64ac75e0857d17e557e79d870854a
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Roberto Lublinerman <rlu...@google.com>

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to