Open amandalim857 opened 3 years ago
You can try changing the return type of your method from
public <U> LoggerImpl<U> flatMap(...)
to
public <U> Logger<U> flatMap(...)
Maybe you could also try adding an explicit cast when you are creating the new LoggerImpl<U>
to change <? extends U>
to <U>
?
Change
return new LoggerImpl<U>(mappedVal.get(), newMappedMsg);
to
return new LoggerImpl<U>((U) mappedVal.get(), newMappedMsg);
I used LoggerImpl as the return type and it worked, i'm guessing it's the Logger<? extends U> mappedVal, maybe try changing that to LoggerImpl?
Hi everything else works already for the whole lab, except for an error that pops up only when a specific T is specified in the Logger return type.
The relevant code:
The output is fine when I remove the
Logger<Integer> a =
at the start, so i suspect it has to do w my generic? super/extends
return typeI'm p sure its something simple but I cant figure it out! Help is appreciated thks