Alan Bateman Alan.Bateman at
Sat Nov 28 15:07:46 UTC 2015

On 28/11/2015 11:37, Doug Lea wrote:
> Does anyone know why the static singleton in java.lang.Runtime is
> not declared as final?
>   public class Runtime {
>       private static Runtime currentRuntime = new Runtime();
> I don't see a reason, so it seems likely that somehow no one
> has noticed before that this should be final (for thread safety and
> optimizability). But it would be nice if someone with access to
> full JCK etc tests made sure that adding "final" didn't break
> anything.
I don't see a reason either. I checked the pre-OpenJDK history and it's 
been like this since 1995. If it's deliberately non-final then I would 
expect a comment.

I just built and ran the tests with it final and don't see any issues.


More information about the core-libs-dev mailing list