Enable and fix Eclipse warnings about redundant type arguments
Since Java 7 it is possible to replace the type arguments required to invoke the constructor of a generic class with an empty set of type parameters (<>) as long as the compiler can infer the type arguments from the context [1]. Enable the Eclipse warning about redundant type arguments, and remove the ones it warns about. [1] http://goo.gl/SG21kM Change-Id: I422882949a6a6a57391580d881f73120b2843a0e
This commit is contained in:
parent
51e708c464
commit
41abb376ca
@ -54,7 +54,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
|
@ -213,11 +213,11 @@ public class HashtagsIT extends AbstractDaemonTest {
|
||||
throws IOException {
|
||||
HashtagsInput input = new HashtagsInput();
|
||||
if (toAdd != null) {
|
||||
input.add = new HashSet<String>(
|
||||
input.add = new HashSet<>(
|
||||
Lists.newArrayList(Splitter.on(CharMatcher.anyOf(",")).split(toAdd)));
|
||||
}
|
||||
if (toRemove != null) {
|
||||
input.remove = new HashSet<String>(
|
||||
input.remove = new HashSet<>(
|
||||
Lists.newArrayList(Splitter.on(CharMatcher.anyOf(",")).split(toRemove)));
|
||||
}
|
||||
return adminSession.post("/changes/" + changeId + "/hashtags/", input);
|
||||
|
@ -71,7 +71,7 @@ public class CommentsIT extends AbstractDaemonTest {
|
||||
ReviewInput input = new ReviewInput();
|
||||
ReviewInput.CommentInput comment = newCommentInfo(
|
||||
file, Comment.Side.REVISION, 1, "comment 1");
|
||||
input.comments = new HashMap<String, List<ReviewInput.CommentInput>>();
|
||||
input.comments = new HashMap<>();
|
||||
input.comments.put(comment.path, Lists.newArrayList(comment));
|
||||
revision(r).review(input);
|
||||
Map<String, List<CommentInfo>> result = getPublishedComments(changeId, revId);
|
||||
|
@ -163,7 +163,7 @@ class H2CacheFactory implements PersistentCacheFactory, LifecycleListener {
|
||||
|
||||
SqlStore<K, V> store = newSqlStore(def.name(), def.keyType(), limit,
|
||||
def.expireAfterWrite(TimeUnit.SECONDS));
|
||||
H2CacheImpl<K, V> cache = new H2CacheImpl<K, V>(
|
||||
H2CacheImpl<K, V> cache = new H2CacheImpl<>(
|
||||
executor, store, def.keyType(),
|
||||
(Cache<K, ValueHolder<V>>) defaultFactory.create(def, true).build());
|
||||
synchronized (caches) {
|
||||
@ -187,9 +187,9 @@ class H2CacheFactory implements PersistentCacheFactory, LifecycleListener {
|
||||
def.expireAfterWrite(TimeUnit.SECONDS));
|
||||
Cache<K, ValueHolder<V>> mem = (Cache<K, ValueHolder<V>>)
|
||||
defaultFactory.create(def, true)
|
||||
.build((CacheLoader<K, V>) new H2CacheImpl.Loader<K, V>(
|
||||
.build((CacheLoader<K, V>) new H2CacheImpl.Loader<>(
|
||||
executor, store, loader));
|
||||
H2CacheImpl<K, V> cache = new H2CacheImpl<K, V>(
|
||||
H2CacheImpl<K, V> cache = new H2CacheImpl<>(
|
||||
executor, store, def.keyType(), mem);
|
||||
caches.add(cache);
|
||||
return cache;
|
||||
|
@ -124,7 +124,7 @@ public class AccessSection extends RefConfigSection implements
|
||||
if (!super.equals(obj) || !(obj instanceof AccessSection)) {
|
||||
return false;
|
||||
}
|
||||
return new HashSet<Permission>(getPermissions()).equals(new HashSet<>(
|
||||
return new HashSet<>(getPermissions()).equals(new HashSet<>(
|
||||
((AccessSection) obj).getPermissions()));
|
||||
}
|
||||
}
|
||||
|
@ -265,8 +265,7 @@ public class Permission implements Comparable<Permission> {
|
||||
if (!name.equals(other.name) || exclusiveGroup != other.exclusiveGroup) {
|
||||
return false;
|
||||
}
|
||||
return new HashSet<PermissionRule>(getRules())
|
||||
.equals(new HashSet<PermissionRule>(other.getRules()));
|
||||
return new HashSet<>(getRules()).equals(new HashSet<>(other.getRules()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,7 +129,7 @@ public class DynamicSet<T> implements Iterable<T> {
|
||||
}
|
||||
|
||||
public static <T> DynamicSet<T> emptySet() {
|
||||
return new DynamicSet<T>(
|
||||
return new DynamicSet<>(
|
||||
Collections.<AtomicReference<Provider<T>>> emptySet());
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ public class WebServer {
|
||||
* by dev_mode_on.js in a JSONP request to "/recompile".)
|
||||
*/
|
||||
private Map<String, String> getBindingProperties(HttpServletRequest request) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Object key : request.getParameterMap().keySet()) {
|
||||
String propName = (String) key;
|
||||
if (!propName.equals("_callback")) {
|
||||
|
@ -93,7 +93,7 @@ public class AccessSectionEditor extends Composite implements
|
||||
|
||||
public AccessSectionEditor(ProjectAccess access) {
|
||||
projectAccess = access;
|
||||
permissionSelector = new ValueListBox<String>(
|
||||
permissionSelector = new ValueListBox<>(
|
||||
new PermissionNameRenderer(access.getCapabilities()));
|
||||
permissionSelector.addValueChangeHandler(new ValueChangeHandler<String>() {
|
||||
@Override
|
||||
|
@ -90,7 +90,7 @@ public class GroupListScreen extends AccountScreen implements FilteredUserInterf
|
||||
// Retrieve one more group than page size to determine if there are more
|
||||
// groups to display
|
||||
GroupMap.match(subname, pageSize + 1, startPosition,
|
||||
new IgnoreOutdatedFilterResultsCallbackWrapper<GroupMap>(this,
|
||||
new IgnoreOutdatedFilterResultsCallbackWrapper<>(this,
|
||||
new GerritCallback<GroupMap>() {
|
||||
@Override
|
||||
public void onSuccess(GroupMap result) {
|
||||
|
@ -104,7 +104,7 @@ public class ProjectListScreen extends Screen implements FilteredUserInterface {
|
||||
// Retrieve one more project than page size to determine if there are more
|
||||
// projects to display
|
||||
ProjectMap.match(subname, pageSize + 1, startPosition,
|
||||
new IgnoreOutdatedFilterResultsCallbackWrapper<ProjectMap>(this,
|
||||
new IgnoreOutdatedFilterResultsCallbackWrapper<>(this,
|
||||
new GerritCallback<ProjectMap>() {
|
||||
@Override
|
||||
public void onSuccess(ProjectMap result) {
|
||||
|
@ -185,7 +185,7 @@ public class ProjectListPopup implements FilteredUserInterface {
|
||||
|
||||
protected void populateProjects() {
|
||||
ProjectMap.match(subname,
|
||||
new IgnoreOutdatedFilterResultsCallbackWrapper<ProjectMap>(this,
|
||||
new IgnoreOutdatedFilterResultsCallbackWrapper<>(this,
|
||||
new GerritCallback<ProjectMap>() {
|
||||
@Override
|
||||
public void onSuccess(final ProjectMap result) {
|
||||
|
@ -108,7 +108,7 @@ class SubIndex {
|
||||
|
||||
notDoneNrtFutures = Sets.newConcurrentHashSet();
|
||||
|
||||
reopenThread = new ControlledRealTimeReopenThread<IndexSearcher>(
|
||||
reopenThread = new ControlledRealTimeReopenThread<>(
|
||||
writer, searcherManager,
|
||||
0.500 /* maximum stale age (seconds) */,
|
||||
0.010 /* minimum stale age (seconds) */);
|
||||
|
@ -181,7 +181,7 @@ public class PatchLineCommentsUtil {
|
||||
db.patchComments().publishedByPatchSet(psId).toList());
|
||||
}
|
||||
notes.load();
|
||||
List<PatchLineComment> comments = new ArrayList<PatchLineComment>();
|
||||
List<PatchLineComment> comments = new ArrayList<>();
|
||||
comments.addAll(notes.getPatchSetComments().get(psId));
|
||||
comments.addAll(notes.getBaseComments().get(psId));
|
||||
return sort(comments);
|
||||
|
@ -135,6 +135,6 @@ public class HashtagsUtil {
|
||||
dbProvider.get());
|
||||
}
|
||||
}
|
||||
return new TreeSet<String>(updatedHashtags);
|
||||
return new TreeSet<>(updatedHashtags);
|
||||
}
|
||||
}
|
||||
|
@ -21,35 +21,35 @@ import java.sql.Timestamp;
|
||||
public class FieldType<T> {
|
||||
/** A single integer-valued field. */
|
||||
public static final FieldType<Integer> INTEGER =
|
||||
new FieldType<Integer>("INTEGER");
|
||||
new FieldType<>("INTEGER");
|
||||
|
||||
/** A single-integer-valued field matched using range queries. */
|
||||
public static final FieldType<Integer> INTEGER_RANGE =
|
||||
new FieldType<Integer>("INTEGER_RANGE");
|
||||
new FieldType<>("INTEGER_RANGE");
|
||||
|
||||
/** A single integer-valued field. */
|
||||
public static final FieldType<Long> LONG =
|
||||
new FieldType<Long>("LONG");
|
||||
new FieldType<>("LONG");
|
||||
|
||||
/** A single date/time-valued field. */
|
||||
public static final FieldType<Timestamp> TIMESTAMP =
|
||||
new FieldType<Timestamp>("TIMESTAMP");
|
||||
new FieldType<>("TIMESTAMP");
|
||||
|
||||
/** A string field searched using exact-match semantics. */
|
||||
public static final FieldType<String> EXACT =
|
||||
new FieldType<String>("EXACT");
|
||||
new FieldType<>("EXACT");
|
||||
|
||||
/** A string field searched using prefix. */
|
||||
public static final FieldType<String> PREFIX =
|
||||
new FieldType<String>("PREFIX");
|
||||
new FieldType<>("PREFIX");
|
||||
|
||||
/** A string field searched using fuzzy-match semantics. */
|
||||
public static final FieldType<String> FULL_TEXT =
|
||||
new FieldType<String>("FULL_TEXT");
|
||||
new FieldType<>("FULL_TEXT");
|
||||
|
||||
/** A field that is only stored as raw bytes and cannot be queried. */
|
||||
public static final FieldType<byte[]> STORED_ONLY =
|
||||
new FieldType<byte[]>("STORED_ONLY");
|
||||
new FieldType<>("STORED_ONLY");
|
||||
|
||||
private final String name;
|
||||
|
||||
|
@ -405,7 +405,7 @@ public class PluginLoader implements LifecycleListener {
|
||||
Iterator<Entry<String, File>> it = from.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<String,File> entry = it.next();
|
||||
to.add(new AbstractMap.SimpleImmutableEntry<String, File>(
|
||||
to.add(new AbstractMap.SimpleImmutableEntry<>(
|
||||
entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class PermissionCollection {
|
||||
List<AccessSection> sections = Lists.newArrayList(sectionToProject.keySet());
|
||||
sorter.sort(ref, sections);
|
||||
|
||||
Set<SeenRule> seen = new HashSet<SeenRule>();
|
||||
Set<SeenRule> seen = new HashSet<>();
|
||||
Set<String> exclusiveGroupPermissions = new HashSet<>();
|
||||
|
||||
HashMap<String, List<PermissionRule>> permissions = new HashMap<>();
|
||||
|
@ -92,7 +92,7 @@ public abstract class Predicate<T> {
|
||||
//
|
||||
return that.getChild(0);
|
||||
}
|
||||
return new NotPredicate<T>(that);
|
||||
return new NotPredicate<>(that);
|
||||
}
|
||||
|
||||
/** Get the children of this predicate, if any. */
|
||||
|
@ -34,8 +34,7 @@ public class BasicChangeRewrites extends QueryRewriter<ChangeData> {
|
||||
null);
|
||||
|
||||
private static final QueryRewriter.Definition<ChangeData, BasicChangeRewrites> mydef =
|
||||
new QueryRewriter.Definition<ChangeData, BasicChangeRewrites>(
|
||||
BasicChangeRewrites.class, BUILDER);
|
||||
new QueryRewriter.Definition<>(BasicChangeRewrites.class, BUILDER);
|
||||
|
||||
@Inject
|
||||
public BasicChangeRewrites() {
|
||||
|
@ -117,8 +117,7 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
|
||||
|
||||
private static final QueryBuilder.Definition<ChangeData, ChangeQueryBuilder> mydef =
|
||||
new QueryBuilder.Definition<ChangeData, ChangeQueryBuilder>(
|
||||
ChangeQueryBuilder.class);
|
||||
new QueryBuilder.Definition<>(ChangeQueryBuilder.class);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Integer getLimit(Predicate<ChangeData> p) {
|
||||
|
@ -61,7 +61,7 @@ public class UniversalGroupBackendTest {
|
||||
public void setup() {
|
||||
user = createNiceMock(IdentifiedUser.class);
|
||||
replay(user);
|
||||
backends = new DynamicSet<GroupBackend>();
|
||||
backends = new DynamicSet<>();
|
||||
backends.add(new SystemGroupBackend());
|
||||
backend = new UniversalGroupBackend(backends);
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class UniversalGroupBackendTest {
|
||||
});
|
||||
replay(member, notMember, backend);
|
||||
|
||||
backends = new DynamicSet<GroupBackend>();
|
||||
backends = new DynamicSet<>();
|
||||
backends.add(backend);
|
||||
backend = new UniversalGroupBackend(backends);
|
||||
|
||||
|
@ -746,7 +746,7 @@ public class SubmoduleOpTest extends LocalDiskRepositoryTestCase {
|
||||
|
||||
expect(schema.submoduleSubscriptions()).andReturn(subscriptions);
|
||||
final ResultSet<SubmoduleSubscription> incorrectSubscriptions =
|
||||
new ListResultSet<SubmoduleSubscription>(Collections
|
||||
new ListResultSet<>(Collections
|
||||
.singletonList(new SubmoduleSubscription(sourceBranchNameKey,
|
||||
targetBranchNameKey, "target-project")));
|
||||
expect(subscriptions.bySubmodule(targetBranchNameKey)).andReturn(
|
||||
|
@ -343,7 +343,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
|
||||
public void hashtagCommit() throws Exception {
|
||||
Change c = newChange();
|
||||
ChangeUpdate update = newUpdate(c, changeOwner);
|
||||
LinkedHashSet<String> hashtags = new LinkedHashSet<String>();
|
||||
LinkedHashSet<String> hashtags = new LinkedHashSet<>();
|
||||
hashtags.add("tag1");
|
||||
hashtags.add("tag2");
|
||||
update.setHashtags(hashtags);
|
||||
@ -362,7 +362,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
|
||||
public void hashtagChangeNotes() throws Exception {
|
||||
Change c = newChange();
|
||||
ChangeUpdate update = newUpdate(c, changeOwner);
|
||||
LinkedHashSet<String> hashtags = new LinkedHashSet<String>();
|
||||
LinkedHashSet<String> hashtags = new LinkedHashSet<>();
|
||||
hashtags.add("tag1");
|
||||
hashtags.add("tag2");
|
||||
update.setHashtags(hashtags);
|
||||
|
@ -79,7 +79,7 @@ public class ProjectControlTest {
|
||||
InMemoryRepository inMemoryRepo = repoManager.createRepository(name);
|
||||
project = new ProjectConfig(name);
|
||||
project.load(inMemoryRepo);
|
||||
repo = new TestRepository<InMemoryRepository>(inMemoryRepo);
|
||||
repo = new TestRepository<>(inMemoryRepo);
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -1060,7 +1060,7 @@ public abstract class AbstractQueryChangesTest {
|
||||
throws Exception {
|
||||
CreateProject create = projectFactory.create(name);
|
||||
create.apply(TLR, new ProjectInput());
|
||||
return new TestRepository<InMemoryRepository>(
|
||||
return new TestRepository<>(
|
||||
repoManager.openRepository(new Project.NameKey(name)));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user