JDK-8195806 : Eliminate dependency on sun.font.lookup in javafx.graphics
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 9,10,openjfx11
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-01-19
  • Updated: 2018-06-13
  • Resolved: 2018-03-06
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
The fix for JDK-8088325 introduced a dependency on sun.font.lookup, which is an internal package of java.desktop, in javafx.graphics.

The following is used by PrismFontFactory to lookup the location of the JDK font directory:

    Class<?> c = Class.forName("sun.font.lookup.JDKFontLookup");

 In an effort to eliminate the use of internal packages from core module by javafx.* modules we need an alternative solution. 
Comments
+1 -phil.
05-03-2018

The fix looks fine to me, although I was puzzled by the following: - return - System.getProperty("java.home","") + File.separator + - "lib" + File.separator + "fonts" + File.separator; + return System.getProperty("java.home","") + File.separator + + "lib" + File.separator + "fonts"; Your fix preserves existing behavior, given that the return value from the now-eliminated call to the JDKFontLookup class did not have the trailing File.separator, but I think that might be a bug given how the returned string from this method is used elsewhere in this file. Since this is preexisting, you might choose to address that as well in the follow-up bug (JDK-8198752). If so, please add a comment to that bug. +1 from me (you need a +1 from Phil as well)
27-02-2018

I have removed the dependency on sun.font.lookup in javafx.graphics. Here is the webrev : http://cr.openjdk.java.net/~aghaisas/fx/8195806/webrev.0/ Note : 1. Although the path is hard-coded now, it is essentially the same code as in sun.font.lookup.JDKFontLookup.getJDKFontDir() method. 2. This private method still gets invoked under AccessController.doPrivileged() as eariler - No change in method invocation.
14-02-2018

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

Possible alternative solutions: 1. Hard-code the directory (if unlikely to change) 2. Have the Java2D code set an env variable or some other property at startup that FX could query 3. Something else
22-01-2018