I have a method looks like this.
public <E extends Enum<E> & Some> void setOther(final E some) {
setOther(ofNullable(some).map(e -> e.name()).orElse(null);
}
Now IntelliJ suggests to use a method reference for e -> e.name()
part.
And I changed it.
public <E extends Enum<E> & Some> void setOther(final E some) {
setOther(ofNullable(some).map(Enum::name).orElse(null);
}
Now compiler complains about it.
... ....java:nnn: warning: [rawtypes] found raw type: Enum
setOther(ofNullable(some).map(Enum::name).orElse(null));
^
Putting @SuppressWarnings({"uncheked"})
doesn't work.
How can I eliminate it? Should I stick to e -> e.name()
?