Community
Participate
Working Groups
0.6.1 - 9.8, Discussion & motivation box, second bullet says: // --------8< ----------------- Under the current definition, a functional interface may be parameterized in a way that produces distinct abstract methods—that is, multiple methods that cannot be legally overridden with a single declaration. For example: interface I { Object m(); } interface J<S> { S m(); } interface K<T> { T m(); } interface Functional<S,T> extends I, J<S>, K<T> {} Interface Functional is functional—I.m is return-type-substitutable for the other two—but Functional<String,Integer> clearly cannot be implemented with a single method. This situation is acceptable, however: when functional interfaces are implicitly implemented, the overriding effectively occurs generically; instantiation of type parameters only occurs at the use site. In other words, if a lambda expression represents a Functional<String,Integer>, its treatment is similar to that of the following: class FunctionalImpl<S,T> implements Functional<S,T> { ... } Functional<String,Integer> f = new FunctionalImpl<String,Integer>(); // --------8< ----------------- I think this part needs a careful relook - Both javac 8b74 and eclipse refuse to compile this snippet *precisely* for the reason that certain parameterization could run into unrelated return types. Ergo, `Functional' is not even a legal interface - let alone a functional interface.
The spec master has acknowledged that this needs investigation and it is being looked into.
This issue has been reported and acknowledged. Closing this one. Any further action will be based on spec change.
See also the twist in bug 427694 comment 5 (i.e. a properly typed version - avoiding raw types - is rejected even by javac).