On Mon, 19 Jan 2026 17:49:08 GMT, Maurizio Cimadamore <[email protected]> 
wrote:

>> it work but at the end it does a cast to ClassSymbol, unfortunately some 
>> fields can have TypeSymbol as its outermost class. This is use in Symtab, an 
>> anonymous class of TypeSymbol and the build was failing
>
> Ugh -- for now let's add a comment that `outermostClass` was considered and 
> then discarded for the reasons you mention. 
> 
> That said -- the anon class you talk about is (I think) `noSymbol`. I wonder 
> why we're trying to call `outrmostType` on `noSymbol`. That symbol has kind 
> `NIL`. So I wonder what is really going on here? Are we trying to use this 
> visitor on code that has errors?

Turns out that the reason why using `outermostClass` was failing is that the 
logic here is trying to add null checks for `array.length` -- which the 
compiler models as a "fake" field access on the fictional Array class (whose 
owner is `noSymbol`).

We shouldn't attempt to check such fields -- in part because this isn't even a 
proper declared field, but also because only non nullable fields are the issue. 
This problem is easily avoided by first checking for non nullable type _then_ 
calling `outermostClass`

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1926#discussion_r2705950660

Reply via email to