On Mon, 23 Mar 2026 07:31:46 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>  > 1. It is returning an internal reference (not a copy) to the client. 
> Dilemma here perhaps .. making a copy every time might be inefficient. Is 
> there any impact ?
> 
> It is mentioned in the spec to not modify the return value so maybe we are 
> safeguarded to some extent..
> 
> ```
> <b>Warning </b>: the value returned by this method should not be
>      * be modified, it's a reference to the actual rectangle, not a copy.
> ```

It is one thing to do this for internal API (OK not strictly internal since it 
protected) and another for public API.
Perhaps we need to keep the internal API and wrap it in a public API which 
always returns a copy.
Unless you can show no performance impact of the copy (which I believe the 
public API must do).

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

PR Comment: https://git.openjdk.org/jdk/pull/30209#issuecomment-4144160023

Reply via email to