Q: Why is java.lang.Runtime non-final?

Joe Darcy joe.darcy at oracle.com
Tue Nov 26 03:26:19 UTC 2024


Hello,

On 11/22/2024 9:35 AM, Eirik Bjørsnøs wrote:
> On Fri, Nov 22, 2024 at 4:47 AM Joseph D. Darcy <joe.darcy at oracle.com> 
> wrote:
>
>     PS it would be a "small matter of programming" to write an
>     annotation processor to find the not subclassable public classes
>     in the JDK that were not marked final.
>
> Joe, your bait was too hard to resist.
>
> These are the non-final, not subclassable, public, non-enum classes, 
> in packages with unqualified exports in java.base:
>
>
[...]

> All of these compiles fine with final added. (Note a subclass can 
> access a private constructor if enclosed by the same class (is this 
> called a nest?)
>
> What is the compatibility impact of adding final to the above classes. 
> It will perhaps require a CSR in any case?
>
Yes, these changes would require a CSR. (There would need to be an 
update to the signature tests, if nothing else.)

Unless there are odd circumstances, such changes are well within our 
compatibility policy. (We don't mind if a program like "assert 
java.lang.reflect.Modifier is not final" would fail after the change ;-)

Thanks for checking,

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20241125/5b3be11b/attachment.htm>


More information about the core-libs-dev mailing list