Consistently don't import Id/Key/NameKey/Entry types

These are often ambiguous without their containing class, not to mention
used inconsistently within single class files. Implement a consistent
policy.

After this change there are exactly two remaining:

$ find . -name \*.java | sort | xargs pcregrep '^import.*\.[A-Z][^.]*\.(NameKey|Key|Id|Entry);'
./java/com/google/gerrit/httpd/CacheBasedWebSession.java:import com.google.gerrit.httpd.WebSessionManager.Key;
./javatests/com/google/gerrit/server/change/ChangeKindCacheImplTest.java:import com.google.gerrit.server.change.ChangeKindCacheImpl.Key;

These are corner cases of a specific cache implementation where the Key
type is less ambiguous, and the full name is long.

Change-Id: I1d2e9eb6c7dec0d09ca42b41dc252786d2024a5a
This commit is contained in:
Dave Borowitz
2019-01-15 08:57:49 -08:00
parent 024e5aa31d
commit db47370011
36 changed files with 83 additions and 104 deletions

View File

@@ -21,7 +21,6 @@ import static java.util.stream.Collectors.toSet;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Comment;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSet.Id;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.patch.PatchListCache;
import com.google.gerrit.server.patch.PatchListNotAvailableException;
@@ -55,7 +54,7 @@ public class PublishCommentUtil {
return;
}
Map<Id, PatchSet> patchSets =
Map<PatchSet.Id, PatchSet> patchSets =
psUtil.getAsMap(notes, drafts.stream().map(d -> psId(notes, d)).collect(toSet()));
for (Comment d : drafts) {
PatchSet ps = patchSets.get(psId(notes, d));