JDK-8202597 : javac is not inducing a notional interface if Object appears in an intersection type
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 10,11
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2018-05-03
  • Updated: 2018-05-12
  • Resolved: 2018-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b13Fixed
Related Reports
Relates :  
Description
class JDK8148354 {
    interface I {}
    interface J { void foo(); }

    public void test() {
        Object o1 = (I & J) System::gc;
        Object o2 = (Object & J) System::gc; // error
        Object o3 = (Object & I & J) System::gc; // error
    }
}

javac believes that Object is not allowed here, but it is:
- "An intersection type that induces a notional functional interface" is a functional interface type (JLS 9.8)
- "If Ck is Object, a notional interface is induced" -- where Ck is derived by mapping each intersection component to its most specific superclass type and then choosing the most specific of these class types -- in these cases, that's Object (JLS 4.9)