We have noticed thread safety problems in the JDK sources for core reflection. We can fix these by:
making effectively final fields truly final, as was done in
JDK-8062771: Core reflection should use final fields whenever possible
and also by using thread-safe constructs on lazy init-once variables in the tree-shaped data structure rooted by Class objects, most obviously by making fields volatile.
Here are changes we made locally at Google:
We think these would be good to include in JDK update releases.
For jdk9, we can and should make similar changes, but we can be more ambitious and try to improve by ensuring that the initialization is truly once, and perhaps take advantage of new core support for volatile fields expected in jdk9. Or use Unsafe with CAS.