Fwd: Re: Lifting operations from inline classes to reference projections

Brian Goetz brian.goetz at oracle.com
Wed Dec 11 18:09:56 UTC 2019


This was received in the -comments bag.

Translation will be the subject of an upcoming writeup, so stay tuned 
for that.

You could be asking one of several different questions.  If you have an 
inaccessible inline class, then by default, the reference projection is 
also inaccessible.

If you want to expose a public interface but private implementation 
(this is what the migrated Optional would want), then you can do that; 
you declare a public reference projection and a private implementation, 
and you put your factories _on the interface_.


-------- Forwarded Message --------
Subject: 	Re: Lifting operations from inline classes to reference 
projections
Date: 	Thu, 12 Dec 2019 02:53:30 +0900
From: 	Mateusz Romanowski <romanowski.mateusz at gmail.com>
To: 	valhalla-spec-comments at openjdk.java.net



Hi Brian et al,

Could you please show how following package-private inline class would be
translated?

inline class Point {
public Point(int x, int z) {
this.x = x;
this.y = y;
}
public Point sum(Point that) {
return new Point(this.x+that.x,this.y+that.y);
}

private final int x, y;
}

I am wondering how the client of public reference projection would get an
instance of the private implementation inline class.

Thanks,
Mateusz Romanowski


More information about the valhalla-dev mailing list