inference for method references: register new variables for raw access

IDEA-189883, IDEA-188976: according to the 15.13.1 search for member is performed in the parameterization (non-raw) type which is a subtype of the first parameter type, in this case no additional variables are required as the type contains type arguments
This commit is contained in:
Anna.Kozlova
2018-04-10 14:01:00 +02:00
parent 6a3df23040
commit 74f6d68ea3
3 changed files with 53 additions and 8 deletions

View File

@@ -0,0 +1,28 @@
import java.util.stream.Stream;
import java.util.Optional;
class SomeClass<T> {
private T id;
public T getId() {
return id;
}
public void n(final Optional<SomeClass<T>> o) {
T otherId = o.map(SomeClass::getId).orElse(null);
}
}
class A {
interface Base<T> {
T foo();
}
interface Sub<S> extends Base<S> { }
void m(Stream<Sub> stream) {
stream.map( Sub::foo);
}
}