Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassUtils tryCast #100

Closed
ljacqu opened this issue Aug 24, 2023 · 0 comments
Closed

ClassUtils tryCast #100

ljacqu opened this issue Aug 24, 2023 · 0 comments
Milestone

Comments

@ljacqu
Copy link
Owner

ljacqu commented Aug 24, 2023

This produces an unchecked warning:

Class<T> clazz = ...;

if (clazz.isInstance(obj)) {
  return (T) obj;
}

I guess the solution would be to replace (T) obj with clazz.cast(obj) but a method returning Optional<T> would be quite elegant

ljacqu added a commit that referenced this issue Aug 24, 2023
@ljacqu ljacqu added this to the 0.2.0 milestone Aug 24, 2023
@ljacqu ljacqu closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant