Revert 'Use TreeMaps instead of Maps in a couple of places.'

The commit c691ba171d traded the problem
of TreeMap failing to meet Map to the problem of TreeMap failing to
meet TreeMap. So it did only limit genericity without fixing the
problem described in that commit. So we still could not compile on
OpenJDK 6 (e.g.:

  OpenJDK Runtime Environment (IcedTea6 1.11.3) (Gentoo build 1.6.0_24-b24)
  OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

) as we obtained

  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project gerrit-server: Compilation failure: Compilation failure:
  [ERROR] /home/christian/sources/Wikimedia/gerrit/gerrit-git/gerrit-server/src/main/java/com/google/gerrit/server/change/ReviewerJson.java:[91,35] incompatible types; no instance(s) of type variable(s) K,V exist so that java.util.TreeMap<K,V> conforms to java.util.TreeMap<java.lang.String,java.lang.String>
  [ERROR] found   : <K,V>java.util.TreeMap<K,V>
  [ERROR] required: java.util.TreeMap<java.lang.String,java.lang.String>
  [ERROR] /home/christian/sources/Wikimedia/gerrit/gerrit-git/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeJson.java:[358,23] incompatible types; no instance(s) of type variable(s) K,V exist so that java.util.TreeMap<K,V> conforms to java.util.TreeMap<java.lang.String,com.google.gerrit.server.change.ChangeJson.LabelInfo>
  [ERROR] found   : <K,V>java.util.TreeMap<K,V>
  [ERROR] required: java.util.TreeMap<java.lang.String,com.google.gerrit.server.change.ChangeJson.LabelInfo>
  [ERROR] /home/christian/sources/Wikimedia/gerrit/gerrit-git/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeJson.java:[476,23] incompatible types; no instance(s) of type variable(s) K,V exist so that java.util.TreeMap<K,V> conforms to java.util.TreeMap<java.lang.String,com.google.gerrit.server.change.ChangeJson.LabelInfo>
  [ERROR] found   : <K,V>java.util.TreeMap<K,V>
  [ERROR] required: java.util.TreeMap<java.lang.String,com.google.gerrit.server.change.ChangeJson.LabelInfo>
  [ERROR] -> [Help 1]

when trying to compile using 'mvn compile'. Hence, we revert the above
commit, and work around the type inference problem by directly instantiating
the TreeMaps in a follow-up commit.

Change-Id: Ibaf54e4f51edc80875abac9d15269bf4350682a3
This commit is contained in:
Christian Aistleitner
2013-02-27 17:20:56 +01:00
parent 932a6601d7
commit 84cef7dbd3
2 changed files with 4 additions and 5 deletions

View File

@@ -38,7 +38,7 @@ import com.google.inject.Provider;
import java.util.Collection;
import java.util.List;
import java.util.TreeMap;
import java.util.Map;
public class ReviewerJson {
private final Provider<ReviewDb> db;
@@ -132,7 +132,7 @@ public class ReviewerJson {
public static class ReviewerInfo extends AccountInfo {
final String kind = "gerritcodereview#reviewer";
TreeMap<String, String> approvals;
Map<String, String> approvals;
protected ReviewerInfo(Account.Id id) {
super(id);