Webrev updated. Field updaters are gone. I intend to commit soon.
On Mon, Dec 8, 2014 at 2:00 PM, Martin Buchholz <marti...@google.com> wrote: > Alright, I'm convinced and will revert to using ordinary volatile > writes instead of CAS. > > Y'all have a deeper understanding of the reflection machinery. > > Martin > > On Mon, Dec 8, 2014 at 1:52 PM, Peter Levart <peter.lev...@gmail.com> wrote: >> >> On 12/08/2014 10:24 PM, Peter Levart wrote: >> >> "Interned" Types can not be guaranteed, since they are rooted on members of >> j.l.Class (Method, Field, Constructor), which can be GC-ed because of >> either: >> >> - class redefinition >> - memory pressure (see j.l.Class.reflectionData field, which points to >> SoftReference<ReflectionData>) >> >> ...and next time you request them, new instances will be created and new >> instances of Types with them. >> >> Regards, Peter >> >> >> Even in the absence of above, the Method, Field, Constructor objects >> obtained from j.l.Class methods are always copied from the "root" objects >> (because they are mutable - setAccessible()) and with copying, you always >> get a "fresh" object that has an uninitialized 'genericInfo' field. >> >> Even in the absence of all above, by CAS-ing, you don't actually get >> "interning", since two Type objects from different sources (for example >> generic return types of two different methods) can be equal, but they will >> not be same objects. So I can't see a purpose here. We would have to >> implement Type interning in a global pool to achieve that (like it is >> guaranteed for j.l.Class objects). >> >> >> Regards, Peter >>