[concurrency-interest] thread safety of java.lang.reflect.Field

Novi novitools.novi at web.de
Thu May 31 05:31:27 EDT 2018


Hello,

I wonder if instances of java.lang.reflect.Field can be shared between
multiple threads as long as the accessibility flag is either not modified
or modified exactly once prior to a safe publication of the field
instances.

In other words, is it legal to cache instances of j.l.r.Field between
multiple threads?

Best Regards,
Novi


PS: The Bean Validation reference implementation Hibernate Validator seems
to cache instances of j.l.r.Field across threads. However, I couldn't find  
any
clue in the Java API documentation whether such a usage is supported or
not.


More information about the Concurrency-interest mailing list