[code-reflection] RFR: Improved error message on OpenCLBackend if Reflect annotation is missing on transitive methods from kernel method

Gary Frost gfrost at openjdk.org
Fri Jan 2 13:08:35 UTC 2026


On Thu, 1 Jan 2026 23:17:42 GMT, Nadeesh TV <ntv at openjdk.org> wrote:

>> On my phone, so analysis limited.
>> 
>> Look at the conditional on line 70 (BufferTagger) it is looking for methods with a code model.... it has no else... my guess is we can detect a call for which we can resolve a  Java.lang.rflect.Method... but which has no CodeModel....
>
> I am assuming that you have missed my comment that I posted couple of minutes ago. 
>> can resolve a Java.lang.rflect.Method... but which has no CodeModel....
> 
> `hat.buffer.S32Array::array(..)` etc.. will also fall into this category not just `squareitWithoutReflectAnnotation`. Therefore, this criteria won't be sufficient.

We can discriminate.  Since kernels (generally) can only call methods on the containing Compute class we can use this.   

The onlly other acceptable calls are on KernelContext, through InterfaceMapped buffers. (S32Array for example)  and possibly to Math.XXX 

So if a call is to a method in the same class as the 'invoker' and it does not have @Reflect annotation then it is in errror.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/798#discussion_r2657687057


More information about the babylon-dev mailing list