mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
continue inference after raw type detected; report raw after all args were processed with raw result only (IDEA-92273)
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
List<String> getList(Function<Object, String> function) {
|
||||
/*
|
||||
* When the first argument below is a raw type it turns red because IDEA thinks the return
|
||||
* type is Collection<>. javac and Eclipse don't care
|
||||
*/
|
||||
return transform(new ArrayList(), new ArrayList<String>(), function);
|
||||
}
|
||||
|
||||
<R, S, T extends Collection<S>> T transform(Iterable<? extends R> oldCollection, T newCollection, Function<R, S> function) {
|
||||
for (R r : oldCollection) {
|
||||
newCollection.add(function.apply(r));
|
||||
}
|
||||
return newCollection;
|
||||
}
|
||||
|
||||
interface Function<X, Y> {
|
||||
Y apply(X input);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user