Use a consistent ordering for reporting errors.
Change-Id: Ie25439705c328a310f7b67d2683de768661746d7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/JsInteropRestrictionChecker.java b/dev/core/src/com/google/gwt/dev/jjs/impl/JsInteropRestrictionChecker.java
index 8717ee0..0fb9de3 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/JsInteropRestrictionChecker.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/JsInteropRestrictionChecker.java
@@ -43,11 +43,13 @@
import com.google.gwt.dev.jjs.ast.JStatement;
import com.google.gwt.dev.jjs.ast.JType;
import com.google.gwt.dev.jjs.ast.JVisitor;
+import com.google.gwt.dev.util.log.AbstractTreeLogger;
import com.google.gwt.thirdparty.guava.common.base.Predicate;
import com.google.gwt.thirdparty.guava.common.collect.FluentIterable;
import com.google.gwt.thirdparty.guava.common.collect.Iterables;
import com.google.gwt.thirdparty.guava.common.collect.Maps;
import com.google.gwt.thirdparty.guava.common.collect.Multimap;
+import com.google.gwt.thirdparty.guava.common.collect.Ordering;
import com.google.gwt.thirdparty.guava.common.collect.Sets;
import com.google.gwt.thirdparty.guava.common.collect.TreeMultimap;
@@ -71,8 +73,10 @@
}
}
- private Multimap<String, String> errorsByFilename = TreeMultimap.create();
- private Multimap<String, String> warningsByFilename = TreeMultimap.create();
+ private Multimap<String, String> errorsByFilename
+ = TreeMultimap.create(Ordering.natural(), AbstractTreeLogger.LOG_LINE_COMPARATOR);
+ private Multimap<String, String> warningsByFilename
+ = TreeMultimap.create(Ordering.natural(), AbstractTreeLogger.LOG_LINE_COMPARATOR);
private final JProgram jprogram;
private final MinimalRebuildCache minimalRebuildCache;
diff --git a/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
index 2cac012..a6f0fc08 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
@@ -17,7 +17,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
+import com.google.gwt.thirdparty.guava.common.collect.ComparisonChain;
+import java.util.Comparator;
import java.util.HashSet;
/**
@@ -25,6 +27,17 @@
*/
public abstract class AbstractTreeLogger extends TreeLogger implements CanUpdateMetrics {
+ public static final Comparator<String> LOG_LINE_COMPARATOR =
+ new Comparator<String>() {
+ @Override
+ public int compare(String thisLine, String thatLine) {
+ return ComparisonChain.start()
+ .compare(thisLine.indexOf(':'), thatLine.indexOf(':'))
+ .compare(thisLine, thatLine)
+ .result();
+ }
+ };
+
private static class UncommittedBranchData {
public final Throwable caught;
diff --git a/dev/core/test/com/google/gwt/dev/util/UnitTestTreeLogger.java b/dev/core/test/com/google/gwt/dev/util/UnitTestTreeLogger.java
index b57a254..660ed05 100644
--- a/dev/core/test/com/google/gwt/dev/util/UnitTestTreeLogger.java
+++ b/dev/core/test/com/google/gwt/dev/util/UnitTestTreeLogger.java
@@ -16,6 +16,7 @@
package com.google.gwt.dev.util;
import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.dev.util.log.AbstractTreeLogger;
import com.google.gwt.thirdparty.guava.common.collect.ComparisonChain;
import com.google.gwt.thirdparty.guava.common.collect.Lists;
@@ -207,7 +208,7 @@
@Override
public int compareTo(LogEntry that) {
return ComparisonChain.start()
- .compare(this.msg, that.msg)
+ .compare(this.msg, that.msg, AbstractTreeLogger.LOG_LINE_COMPARATOR)
.compare(this.type, that.type)
.result();
}