On Wed, 4 Mar 2026 11:18:05 GMT, Ivan Walulya <[email protected]> wrote:

> > I just wonder whether we should add a warning on 
> > flatArrayOopDesc::obj_at(int index, TRAPS) quickly stating why the 
> > obj_at(int) version doesn't exist so nobody is tempted to reintroduce it. 
> > It's tempting, the ..., TRAPS) version often have a version without. Until 
> > Frederic explained me what happens there, I think I could have (re-)added 
> > it.
> 
> can we add `inline oop obj_at(int index) const = delete;` with the 
> appropriate comment?

Added a deleted function on `objArrayOopDesc`. Also added a deprecation message 
in hopes that some current or future compiler understands this as a message for 
the delete, or when we eventually get to C++26 we can add it directly to the 
delete statement. _Also tried just the depreciation, but it still marks the 
method as valid from most IDEs / LSPs, even though we compile with deprecation 
warnings and warnings as errors._

I also added a comment about the absence of this function in flatArrayOopDesc, 
I am not sure that warrants a deprecation message, as there is no usable 
alternative suggestion we can give.

And finally I added `inline bool obj_at_is_null(int index) const;` to 
`flatArrayOopDesc` and `objArrayOopDesc` so we can have a none trapping null 
check.

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

PR Comment: https://git.openjdk.org/valhalla/pull/2157#issuecomment-3998809765

Reply via email to