[External] : Re: Making Object abstract
daniel.smith at oracle.com
Mon Jun 7 23:04:45 UTC 2021
> On Jun 7, 2021, at 2:46 PM, Dan Heidinga <heidinga at redhat.com> wrote:
> On Mon, Jun 7, 2021 at 3:00 PM Dan Smith <daniel.smith at oracle.com> wrote:
>>> On Jun 7, 2021, at 9:13 AM, Dan Smith <daniel.smith at oracle.com> wrote:
>>> On the other side, I'm not that persuaded by the argument for urgency. We want to encourage a slow migration from 'new Object()' to 'SomeClass.newIdentity()'. It's not going to be completed for a number of years. We can start that migration in 17, or wait another release or two. What's the rush?
>> Just to clarify this, because I know, when it comes to compatibility impact, adoption patterns will tend to have quantum leaps between LTS releases—from 11 to 17 to 26. It's potentially meaningful that "17" is a number in that set.
(Err, I guess the next magic number is 23.)
> Right. "17" is a meaningful number in that set, especially if we see
> the possibility that "new Object();" becomes illegal by "26".
For comparison, the wrapper class constructors first got warnings in 9 (2017), and can probably expect to get errors by 23 (2024). So, nah, I don't see cramming that into a 3-year cycle. More like warnings in ~23 (2024), errors in ~35 (2030). (Even if we have an API point in 17, I don't think we'd anticipate any warnings until JEP 401 is finalized.)
>> Nor do I expect an API point available in 17 to hasten this much, because there won't be any *push* to change source code until JEP 401 comes along with a warning about 'new Object()'.
> Sure javac might not warn now but if it starts to warn in 17 < version
> < 26 then even libraries still targeting 17 can "do the right thing".
Here's the thing though: if you compile with '--release 17', you're not going to get any warnings. You'll get class files that still do 'new java/lang/Object', but these will be future-proof—none of this is a binary problem. Once we turn on the warnings, by '--release 23', we'll definitely have an alternative API point to use. And javac can generate bytecode that uses it, whether you use the "right syntax" or not. We'll gently encourage you to update your sources, and then eventually, for '--release 35' or whatever, report an error.
More information about the valhalla-spec-observers