Community
Participate
Working Groups
I20111116-0810 public class GenericsSuggestionBug { Set<String> v(Set<String> o) { // return o == null ? Collections .<String>emptySet() : o; return o == null ? Collections .emptySet() : o; } } The code at the top will compile but the one in the bottom doesn't. Can a quick fix be added for the top case? Is the compiler capable of diagnosing this case? Thanks.
(In reply to comment #0) > Can a quick > fix be added for the top case? Quick fix for the top case? But that compiles fine, no? Why is a quick fix needed? For the bottom case I already see a valid quick fix. Did you mean quick assist?
(In reply to comment #1) > Quick fix for the top case? But that compiles fine, no? Why is a quick fix > needed? For the bottom case I already see a valid quick fix. Did you mean quick > assist? I guess you meant a quick fix for the bottom case that will turn it into the one on the top. Moving to JDT/UI.
A case of conditional and generics not mixing well... I guess we can offer 'Add type parameters to method invocation in then clause' (or something like that) quick fix here.
(In reply to comment #2) > (In reply to comment #1) > > Quick fix for the top case? But that compiles fine, no? Why is a quick fix > > needed? For the bottom case I already see a valid quick fix. Did you mean quick > > assist? > > I guess you meant a quick fix for the bottom case that will turn it into the > one on the top. Yes, that's what I meant.