Skip to content

ClassUtils tryCast #100

@ljacqu

Description

@ljacqu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions