JDK-8244711 : [lworld] Javac needs to tweak checks for interface implementation by an inline type.
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-05-11
  • Updated: 2020-05-11
  • Resolved: 2020-05-11
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.
Other
repo-valhallaFixed
Related Reports
Relates :  
Relates :  
Description
https://cr.openjdk.java.net/~briangoetz/valhalla/sov/02-object-model.html calls for an inline class to be an island in the type
system.

So an inline class V at the type system level should answer false to
the question: 

    V <: jlO ?  (V.ref <: jlO)

Likewise if an inline class declaration V spells out that it implements an interface IFoo, it is really V.ref that implements IFoo.

Here is the relevant text from the design document:

// ---

Interfaces
Historically, for a class to implement an interface meant several things:

Conformance. The class has, as members, all the members of the interface.
Transitivity. Any subclasses of this class also implement the interface.
Subtyping. The class type is a subtype of the interface type.
We need to refine this last bullet, subtyping, in a small way to support inline classes; we say that the reference projection of the inline class is a subtype of the interface type. (Identity class types are their own reference projection, so this statement holds for all classes.) Similarly, if an inline class extends an abstract class, this means that the reference projection is a subtype of the abstract class.

// ----
Comments
Changeset: ec1930c0 Author: Srikanth Adayapalam <sadayapalam@openjdk.org> Date: 2020-05-11 13:41:30 +0000 URL: https://git.openjdk.java.net/valhalla/commit/ec1930c0
11-05-2020

Presently, there are a few checks such as - Does a class implement Iterable (enhanced for loop) - Does a class implement AutoCloseable (try with resources) that are likely to be broken for value classes because when the type passed is an inline type Types.asSuper () will return null (as it should.) Rather than asking if V implements I, we should ask whether V.ref implements I. This problem was also reported from external sources. See: https://mail.openjdk.java.net/pipermail/valhalla-dev/2020-May/007281.html
11-05-2020