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.
|
* returned view object, as it will not be passed.
|
||||||
* @throws RestApiException the view cannot be constructed.
|
* @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;
|
return views;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public CreateAccount create(TopLevelResource parent, IdString username) {
|
public CreateAccount create(TopLevelResource parent, IdString username) {
|
||||||
return createAccountFactory.create(username.get());
|
return createAccountFactory.create(username.get());
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ public class EmailsCollection
|
|||||||
return views;
|
return views;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public CreateEmail create(AccountResource parent, IdString email) {
|
public CreateEmail create(AccountResource parent, IdString email) {
|
||||||
return createEmailFactory.create(email.get());
|
return createEmailFactory.create(email.get());
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ public class StarredChanges
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public RestModifyView<AccountResource, EmptyInput> create(AccountResource parent, IdString id)
|
public RestModifyView<AccountResource, EmptyInput> create(AccountResource parent, IdString id)
|
||||||
throws UnprocessableEntityException {
|
throws UnprocessableEntityException {
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ public class ChangeEdits
|
|||||||
return new ChangeEditResource(rsrc, edit.get(), id.get());
|
return new ChangeEditResource(rsrc, edit.get(), id.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public Create create(ChangeResource parent, IdString id) throws RestApiException {
|
public Create create(ChangeResource parent, IdString id) throws RestApiException {
|
||||||
return createFactory.create(id.get());
|
return createFactory.create(id.get());
|
||||||
|
|||||||
@@ -188,7 +188,6 @@ public class GroupsCollection
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public CreateGroup create(TopLevelResource root, IdString name) {
|
public CreateGroup create(TopLevelResource root, IdString name) {
|
||||||
return createGroup.create(name.get());
|
return createGroup.create(name.get());
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ public class MembersCollection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public PutMember create(GroupResource group, IdString id) {
|
public PutMember create(GroupResource group, IdString id) {
|
||||||
return new PutMember(put, id.get());
|
return new PutMember(put, id.get());
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ public class SubgroupsCollection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public PutSubgroup create(GroupResource group, IdString id) {
|
public PutSubgroup create(GroupResource group, IdString id) {
|
||||||
return new PutSubgroup(addSubgroups, id.get());
|
return new PutSubgroup(addSubgroups, id.get());
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ public class PluginsCollection
|
|||||||
return new PluginResource(p);
|
return new PluginResource(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public InstallPlugin create(TopLevelResource parent, IdString id)
|
public InstallPlugin create(TopLevelResource parent, IdString id)
|
||||||
throws ResourceNotFoundException, MethodNotAllowedException {
|
throws ResourceNotFoundException, MethodNotAllowedException {
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ public class BranchesCollection
|
|||||||
return views;
|
return views;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public CreateBranch create(ProjectResource parent, IdString name) {
|
public CreateBranch create(ProjectResource parent, IdString name) {
|
||||||
return createBranchFactory.create(name.get());
|
return createBranchFactory.create(name.get());
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class DashboardsCollection
|
|||||||
return list.get();
|
return list.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public RestModifyView<ProjectResource, ?> create(ProjectResource parent, IdString id)
|
public RestModifyView<ProjectResource, ?> create(ProjectResource parent, IdString id)
|
||||||
throws RestApiException {
|
throws RestApiException {
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ public class ProjectsCollection
|
|||||||
return views;
|
return views;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public CreateProject create(TopLevelResource parent, IdString name) {
|
public CreateProject create(TopLevelResource parent, IdString name) {
|
||||||
return createProjectFactory.create(name.get());
|
return createProjectFactory.create(name.get());
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ public class TagsCollection
|
|||||||
return views;
|
return views;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public CreateTag create(ProjectResource resource, IdString name) {
|
public CreateTag create(ProjectResource resource, IdString name) {
|
||||||
return createTagFactory.create(name.get());
|
return createTagFactory.create(name.get());
|
||||||
|
|||||||
Reference in New Issue
Block a user