Skip to content

Commit

Permalink
moved @SuppressWarnings("unchecked")
Browse files Browse the repository at this point in the history
  • Loading branch information
yvasyliev committed Oct 20, 2023
1 parent 530db73 commit b97e7ce
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ public void publishPosts(List<Post> posts) {
posts.forEach(this::publishPost);
}

@SuppressWarnings("unchecked")
public <T extends Post> void publishPost(T post) {
var chatId = post.isApproved() ? redTelBot.getChannelId() : redTelBot.getAdminId();
var created = post.getCreated();
var postServiceName = post.getType();

if (context.containsBean(postServiceName)) {
var postService = (PostService<T, ?>) context.getBean(postServiceName);
@SuppressWarnings("unchecked") var postService = (PostService<T, ?>) context.getBean(postServiceName);
try {
var sentMessage = postService.applyWithException(chatId, post);
if (sentMessage.isPresent() && !post.isApproved()) {
Expand Down

0 comments on commit b97e7ce

Please sign in to comment.