Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 400386 - [1.8][spec] Broken example in 9.8, discussion box - bullet 2 ?
Summary: [1.8][spec] Broken example in 9.8, discussion box - bullet 2 ?
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 401003
  Show dependency tree
 
Reported: 2013-02-09 23:16 EST by Srikanth Sankaran CLA
Modified: 2019-10-26 18:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2013-02-09 23:16:42 EST
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.
Comment 1 Srikanth Sankaran CLA 2013-02-15 12:36:21 EST
The spec master has acknowledged that this needs investigation and it
is being looked into.
Comment 2 Srikanth Sankaran CLA 2014-01-07 09:04:07 EST
This issue has been reported and acknowledged. Closing this one. Any further
action will be based on spec change.
Comment 3 Stephan Herrmann CLA 2019-10-26 18:10:58 EDT
See also the twist in bug 427694 comment 5 (i.e. a properly typed version - avoiding raw types - is rejected even by javac).