[code-reflection] RFR: Adjusted tests to use execution of a method and implementation of the execution model cache [v2]

Adam Sotona asotona at openjdk.org
Fri Feb 28 09:59:48 UTC 2025


On Fri, 28 Feb 2025 09:51:35 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Unfortunately `ClassValue` does not support computation if absent (if more than just the bare class is needed). Maybe if compute returns null and the cached value is added later...?
>
> I believe `ClassValue` is similar to a thread local in how it's used -- e.g. you create an instance of it and stick it in a static final (the javadoc of `ClassValue` is useless in that respect):
> 
> 
> ClassValue<CachedModel> CACHED_MODEL = new ClassValue<>() {
>     @Override
>     CachedModel computeValue() { <logic here> }
> };
> 
> 
> That should work here.

Yes, I'm just having troubles to initiate the ClassValue when I need it (when I have additional arguments).
See my solution.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/331#discussion_r1975137191


More information about the babylon-dev mailing list