On 2/25/19 5:12 AM, Andrew Leonard wrote:
Hi Mandy, I must admit I don't completely follow the logic of the existing Modifier init of langReflectAccess, the comment indicates a "protocol between java.lang and java.lang.reflect".
That sets up the shared secret for ReflectionFactory to access non-public members in java.lang.reflect.
I can try moving the clinit code from Modifier to AccessibleObject, but I question is there some reason it is there? Would we be sure in moving it we are not missing something?
ReflectionFactory is the internal support for reflection. The methods that access LangReflectAccess shared secrets should have a Method, Field or Constructor in hand. The ReflectionFactory::newField and newMethod that don't take Field/Method parameter are unused (I suspect they were used by the VM native reflection implementation previously. That led me to suggest to move setLangReflectAccess to AccessibleObject. AccessibleObject is initialized very early during startup by the VM. My proposed fix would change the list of classes loaded during early startup but it would need to look at closely. Having a second thought, my proposed fix can be a follow-on clean up. I'm okay with your point fix that resolves JDK-8219378. I will file a JBS issue for the follow-on clean up. What do you think? thanks Mandy