re: JavaMemoryModel: final, pseudo-final and write protected fields

From: Paul Haahr (haahr@jivetech.com)
Date: Thu Oct 21 1999 - 17:15:01 EDT


> >As for the abomination that System.in, System.out, and System.err are
> >final but can be changed, as long as we're changing specs, why not hit
> >at that one, too?
>
> I'd be happy to hit them, but with what? I think they have to be
> final, because you can't allow arbitrary code to modify them.

My preference would be towards making them final, with the generally
accepted meaning of that modifier. Certainly, allowing sandboxed code
to modify them would appear problematic.

At the cost of an extra level of indirection/delegation (and different
behavior when comparing for identity on the streams), it is possible to
maintain the behavior of setIn/setOut/setErr without ever modifying the
actual static fields.

> I haven't been able to find any code that actually invokes the setIn,
> setOut and setErr functions, so I don't have a feeling for how
> important that is. One suggestion would be to deprecate those
> functions, and see who squeals.

That seems like a reasonable step.

--p



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:20 EDT