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:
@@ -89,7 +89,6 @@ import java.util.EnumSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
public class ChangeJson {
|
public class ChangeJson {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ChangeJson.class);
|
private static final Logger log = LoggerFactory.getLogger(ChangeJson.class);
|
||||||
@@ -354,7 +353,7 @@ public class ChangeJson {
|
|||||||
|
|
||||||
private Map<String, LabelInfo> initLabels(ChangeData cd, boolean standard)
|
private Map<String, LabelInfo> initLabels(ChangeData cd, boolean standard)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
TreeMap<String, LabelInfo> labels =
|
Map<String, LabelInfo> labels =
|
||||||
Maps.newTreeMap(LabelOrdering.create(approvalTypes));
|
Maps.newTreeMap(LabelOrdering.create(approvalTypes));
|
||||||
for (SubmitRecord rec : submitRecords(cd)) {
|
for (SubmitRecord rec : submitRecords(cd)) {
|
||||||
if (rec.labels == null) {
|
if (rec.labels == null) {
|
||||||
@@ -472,7 +471,7 @@ public class ChangeJson {
|
|||||||
boolean standard, boolean detailed) throws OrmException {
|
boolean standard, boolean detailed) throws OrmException {
|
||||||
// We can only approximately reconstruct what the submit rule evaluator
|
// We can only approximately reconstruct what the submit rule evaluator
|
||||||
// would have done. These should really come from a stored submit record.
|
// would have done. These should really come from a stored submit record.
|
||||||
TreeMap<String, LabelInfo> labels =
|
Map<String, LabelInfo> labels =
|
||||||
Maps.newTreeMap(LabelOrdering.create(approvalTypes));
|
Maps.newTreeMap(LabelOrdering.create(approvalTypes));
|
||||||
for (PatchSetApproval psa : cd.currentApprovals(db)) {
|
for (PatchSetApproval psa : cd.currentApprovals(db)) {
|
||||||
ApprovalType type = approvalTypes.byId(psa.getCategoryId());
|
ApprovalType type = approvalTypes.byId(psa.getCategoryId());
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import com.google.inject.Provider;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeMap;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ReviewerJson {
|
public class ReviewerJson {
|
||||||
private final Provider<ReviewDb> db;
|
private final Provider<ReviewDb> db;
|
||||||
@@ -132,7 +132,7 @@ public class ReviewerJson {
|
|||||||
|
|
||||||
public static class ReviewerInfo extends AccountInfo {
|
public static class ReviewerInfo extends AccountInfo {
|
||||||
final String kind = "gerritcodereview#reviewer";
|
final String kind = "gerritcodereview#reviewer";
|
||||||
TreeMap<String, String> approvals;
|
Map<String, String> approvals;
|
||||||
|
|
||||||
protected ReviewerInfo(Account.Id id) {
|
protected ReviewerInfo(Account.Id id) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user