On Fri, 30 Jan 2026 04:47:59 GMT, David Holmes <[email protected]> wrote:

>> It can only return a StackTraceElement[] or null. Using a type pattern 
>> seemed nicer here to avoid a null check + explicit cast.
>
> Sorry I have to disagree - a type check screams to me that this could be some 
> other type when it can't. A null check would be better IMO.
> 
> On the matter of the cast, why doesn't getStackTrace0 return STE[] instead of 
> object?

The idiom is nice, but I can see how it might be confusing.

Your question about getStackTrace0 returning Object is a good question. It 
should return STE[] but I didn't want to change it as we want it to go away. In 
the mean-time then it would be clearer and avoid any confusion that it could 
return anything else.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29461#discussion_r2745220496

Reply via email to