Code review request for 6998871 "Support making the Throwable.stackTrace field immutable"

Rémi Forax forax at univ-mlv.fr
Thu Apr 7 14:24:08 UTC 2011


On 04/07/2011 08:29 AM, Joe Darcy wrote:
> Hello.
>
> Returning to some earlier work, I've developed a proposed fix for
>
>    6998871 "Support making the Throwable.stackTrace field immutable"
>    http://cr.openjdk.java.net/~darcy/6998871.2/
>
> One constructor of Throwable now takes an additional boolean argument 
> to make the stack trace information immutable.  Analogous constructors 
> are added to Exception, RuntimeException, and Error.
>
> Mandy and David have already reviewed the change; I'm interested in 
> getting additional feedback on the design of the API.
>
> Cheers,
>
> -Joe

Joe,
I don't think you need the sentinel in the serialized form,
you have only two states: an immutable stacktrace (stacktrace == null) or
a stacktrace. I think it's better to don't serialize the field 
"stacktrace" if
the stacktrace is immutable.

Also, FILLED_IN_STACK is not necessary, you can use EMPTY_STACKinstead,
or if you find it hard to understand, at least FILLED_IN_STACK should be 
an empty array.

Rémi




More information about the core-libs-dev mailing list