RFR: JDK-8211121: Remove sun.reflect.ReflectionFactory::newInstanceForSerialization
Joseph D. Darcy
joe.darcy at oracle.com
Tue Sep 25 23:20:20 UTC 2018
Hi Lance,
Looks fine; thanks,
-Joe
On 9/25/2018 4:10 PM, Lance Andersen wrote:
> Hi all:
>
> JDK-8211121 removes sun.reflect.ReflectionFactory::newInstanceForSerialization which was only used by the java.corba module. It was missed as part of the initial removal of the Java EE modules.
>
> The diff for the change:
> —————
> s$ hg diff src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java
> diff -r a6bdb6d5f167 src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java
> --- a/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java Tue Sep 25 11:31:55 2018 -0700
> +++ b/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java Tue Sep 25 17:32:48 2018 -0400
> @@ -145,66 +145,6 @@
> }
>
> /**
> - * Invokes the supplied constructor, adding the provided protection domains
> - * to the invocation stack before invoking {@code Constructor::newInstance}.
> - * If no {@linkplain System#getSecurityManager() security manager} is present,
> - * or no domains are provided, then this method simply calls
> - * {@code cons.newInstance()}. Otherwise, it invokes the provided constructor
> - * with privileges at the intersection of the current context and the provided
> - * protection domains.
> - *
> - * @param cons A constructor obtained from {@code
> - * newConstructorForSerialization} or {@code
> - * newConstructorForExternalization}.
> - * @param domains An array of protection domains that limit the privileges
> - * with which the constructor is invoked. Can be {@code null}
> - * or empty, in which case privileges are only limited by the
> - * {@linkplain AccessController#getContext() current context}.
> - *
> - * @return A new object built from the provided constructor.
> - *
> - * @throws NullPointerException if {@code cons} is {@code null}.
> - * @throws InstantiationException if thrown by {@code cons.newInstance()}.
> - * @throws InvocationTargetException if thrown by {@code cons.newInstance()}.
> - * @throws IllegalAccessException if thrown by {@code cons.newInstance()}.
> - */
> - public final Object newInstanceForSerialization(Constructor<?> cons,
> - ProtectionDomain[] domains)
> - throws InstantiationException, InvocationTargetException, IllegalAccessException
> - {
> - SecurityManager sm = System.getSecurityManager();
> - if (sm == null || domains == null || domains.length == 0) {
> - return cons.newInstance();
> - } else {
> - JavaSecurityAccess jsa = SharedSecrets.getJavaSecurityAccess();
> - PrivilegedAction<?> pea = () -> {
> - try {
> - return cons.newInstance();
> - } catch (InstantiationException
> - | InvocationTargetException
> - | IllegalAccessException x) {
> - throw new UndeclaredThrowableException(x);
> - }
> - }; // Can't use PrivilegedExceptionAction with jsa
> - try {
> - return jsa.doIntersectionPrivilege(pea,
> - AccessController.getContext(),
> - new AccessControlContext(domains));
> - } catch (UndeclaredThrowableException x) {
> - Throwable cause = x.getCause();
> - if (cause instanceof InstantiationException)
> - throw (InstantiationException) cause;
> - if (cause instanceof InvocationTargetException)
> - throw (InvocationTargetException) cause;
> - if (cause instanceof IllegalAccessException)
> - throw (IllegalAccessException) cause;
> - // not supposed to happen
> - throw x;
> - }
> - }
> - }
> -
> - /**
> * Returns a direct MethodHandle for the {@code readObjectNoData} method on
> * a Serializable class.
> * The first argument of {@link MethodHandle#invoke} is the serializable
> ——————
>
>
>
> Best
> Lance
> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
> Oracle Java Engineering
> 1 Network Drive
> Burlington, MA 01803
> Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>
>
>
>
More information about the core-libs-dev
mailing list