8206240: java.lang.Class.newInstance() is causing caller to leak

Reviewed-by: alanb
This commit is contained in:
Mandy Chung 2018-10-04 13:02:58 -07:00
parent 609d90e98a
commit 46f0fa8c20
10 changed files with 198 additions and 71 deletions

View file

@ -159,4 +159,10 @@ class ReflectAccess implements jdk.internal.reflect.LangReflectAccess {
public <T extends AccessibleObject> T getRoot(T obj) {
return (T) obj.getRoot();
}
public <T> T newInstance(Constructor<T> ctor, Object[] args, Class<?> caller)
throws IllegalAccessException, InstantiationException, InvocationTargetException
{
return ctor.newInstanceWithCaller(args, true, caller);
}
}