JDK-8195800 : Eliminate dependency on sun.reflect.misc in javafx modules
  • Type: Bug
  • Component: javafx
  • Sub-Component: other
  • Affected Version: 9,10,openjfx11
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-01-19
  • Updated: 2018-06-13
  • Resolved: 2018-03-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx11Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
We currently use the following utility classes from sun.reflect.misc to do additional checking for reflective access on behalf of application classes:

sun.reflect.misc.ConstructorUtil
sun.reflect.misc.FieldUtil
sun.reflect.misc.MethodUtil
sun.reflect.misc.ReflectUtil

This is needed to avoid accessing an element on behalf of an application that the application class does not have permission to access.

In an effort to eliminate the use of internal packages from core module by javafx.* modules we need a different solution.
Comments
Changeset: 3bc097d85c79 Author: arapte Date: 2018-03-23 15:06 +0530 URL: http://hg.openjdk.java.net/openjfx/jfx-dev/rt/rev/3bc097d85c79 8195800: Eliminate dependency on sun.reflect.misc in javafx modules Reviewed-by: kcr, mchung, alanb
23-03-2018

The .01 version looks good. +1
22-03-2018

Thanks Kevin & Mandy for the review comments, Please take a look at updated webrev: http://cr.openjdk.java.net/~arapte/fx/8195800/webrev.01/
22-03-2018

As a follow-on, the copied MethodUtil.checkPackageAccess method is likely to be ineffective once the javafx modules are removed from the JDK and are loaded separately via the AppCLassLoader. I filed JDK-8200082 to track this.
21-03-2018

Other than the two comments made on the list, this is ready to go. +1 pending the following changes: 1) Remove the "Create a trampoline class" comment from FieldUtil and noted by Mandy (I note that the copied file has the same mistaken comment) 2) Fix the line endings on the three new .java files (the ones copied from java.base)
21-03-2018

Hi Kevin, Alan, Mandy, Please review the fix webrev: http://cr.openjdk.java.net/~arapte/fx/8195800/webrev.00/ The dependency on below classes is removed, sun.reflect.misc.ConstructorUtil sun.reflect.misc.FieldUtil sun.reflect.misc.ReflectUtil and the same classes are replicated with minimal code in package com.sun.javafx.reflect Verified the change with build & test execution.
20-03-2018

This is a primary priority change
14-03-2018

Once this dependency has been eliminated, then the qualified export can be removed from dependencies/java.base/module-info.java.extra and build.gradle. See the "REMOVING QUALIFIED EXPORTS" comment in JDK-8195798 for instructions.
23-01-2018

We need to make a copy of these classes, possibly stripping away what we don't use, in javafx.base and use that instead. Note that we already did something similar in FX 9 for the Trampoline class to solve a functional bug. See JDK-8177566.
19-01-2018