Correct use of generics in AcceptsCreate#create
The parameter 'I' wasn't bound in any way and didn't provide any value. It's better to use the general wildcard '?' instead. Thus, we need not suppress the warnings for 'unchecked' on all implementations of that method. Change-Id: Icffd2cf9349077bbc4c7c00133a6a666112cfc11
This commit is contained in:
@@ -30,5 +30,5 @@ public interface AcceptsCreate<P extends RestResource> {
|
||||
* returned view object, as it will not be passed.
|
||||
* @throws RestApiException the view cannot be constructed.
|
||||
*/
|
||||
<I> RestModifyView<P, I> create(P parent, IdString id) throws RestApiException;
|
||||
RestModifyView<P, ?> create(P parent, IdString id) throws RestApiException;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,6 @@ public class AccountsCollection
|
||||
return views;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CreateAccount create(TopLevelResource parent, IdString username) {
|
||||
return createAccountFactory.create(username.get());
|
||||
|
||||
@@ -85,7 +85,6 @@ public class EmailsCollection
|
||||
return views;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CreateEmail create(AccountResource parent, IdString email) {
|
||||
return createEmailFactory.create(email.get());
|
||||
|
||||
@@ -97,7 +97,6 @@ public class StarredChanges
|
||||
};
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RestModifyView<AccountResource, EmptyInput> create(AccountResource parent, IdString id)
|
||||
throws UnprocessableEntityException {
|
||||
|
||||
@@ -112,7 +112,6 @@ public class ChangeEdits
|
||||
return new ChangeEditResource(rsrc, edit.get(), id.get());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Create create(ChangeResource parent, IdString id) throws RestApiException {
|
||||
return createFactory.create(id.get());
|
||||
|
||||
@@ -188,7 +188,6 @@ public class GroupsCollection
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CreateGroup create(TopLevelResource root, IdString name) {
|
||||
return createGroup.create(name.get());
|
||||
|
||||
@@ -92,7 +92,6 @@ public class MembersCollection
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public PutMember create(GroupResource group, IdString id) {
|
||||
return new PutMember(put, id.get());
|
||||
|
||||
@@ -87,7 +87,6 @@ public class SubgroupsCollection
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public PutSubgroup create(GroupResource group, IdString id) {
|
||||
return new PutSubgroup(addSubgroups, id.get());
|
||||
|
||||
@@ -66,7 +66,6 @@ public class PluginsCollection
|
||||
return new PluginResource(p);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public InstallPlugin create(TopLevelResource parent, IdString id)
|
||||
throws ResourceNotFoundException, MethodNotAllowedException {
|
||||
|
||||
@@ -98,7 +98,6 @@ public class BranchesCollection
|
||||
return views;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CreateBranch create(ProjectResource parent, IdString name) {
|
||||
return createBranchFactory.create(name.get());
|
||||
|
||||
@@ -82,7 +82,6 @@ class DashboardsCollection
|
||||
return list.get();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RestModifyView<ProjectResource, ?> create(ProjectResource parent, IdString id)
|
||||
throws RestApiException {
|
||||
|
||||
@@ -142,7 +142,6 @@ public class ProjectsCollection
|
||||
return views;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CreateProject create(TopLevelResource parent, IdString name) {
|
||||
return createProjectFactory.create(name.get());
|
||||
|
||||
@@ -58,7 +58,6 @@ public class TagsCollection
|
||||
return views;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CreateTag create(ProjectResource resource, IdString name) {
|
||||
return createTagFactory.create(name.get());
|
||||
|
||||
Reference in New Issue
Block a user