JDK-8195808 : Eliminate dependency on sun.print 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-08
  • Resolved: 2018-06-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
openjfx11 teamFixed
Related Reports
Blocks :  
Blocks :  
Relates :  
Description
The fix for JDK-8088395 introduced a dependency on sun.print, which is an internal package of java.desktop, in javafx.graphics.

The following is used by J2DPrinterJob to pass the owner FX window to the Java2D print dialog:

    onTopClass = Class.forName("sun.print.DialogOnTop");

Comments
Changeset: 60591d72645f Author: prr Date: 2018-06-06 10:46 -0700 URL: http://hg.openjdk.java.net/openjfx/jfx-dev/rt/rev/60591d72645f 8195808: Eliminate dependency on sun.print in javafx.graphics Reviewed-by: kcr ! build.gradle ! dependencies/java.desktop/module-info.java.extra ! modules/javafx.graphics/src/main/java/com/sun/prism/j2d/print/J2DPrinterJob.java + modules/javafx.graphics/src/main/native-prism/PrismPrint.c
06-06-2018

+1
05-06-2018

and again .. with all the files .. http://cr.openjdk.java.net/~prr/8195808.3/
05-06-2018

The .2 webrev is missing the newly added modules/javafx.graphics/src/main/native-prism/PrismPrint.c file.
05-06-2018

Updated webrev: http://cr.openjdk.java.net/~prr/8195808.2/
05-06-2018

Two comments: 1. The dependencies/java.desktop/module-info.java.extra should not be removed yet. The swing exports are still needed for anyone building a custom JDK that includes the javafx bits. Instead you should just remove the one printing entry. 2. In PrismPrint.c it would be a good idea to include the generated header file: #include "com_sun_prism_j2d_print_J2DPrinterJob.h"
05-06-2018

I originally posted a version http://cr.openjdk.java.net/~prr/8195808/ that uses only new standard SE API proposed here http://mail.openjdk.java.net/pipermail/2d-dev/2018-May/009231.html but have now updated both of these to not provide a standard SE API for the native ID It uses JNI code instead : 2d review thread : http://mail.openjdk.java.net/pipermail/2d-dev/2018-June/009270.html Updated FX webrev : http://cr.openjdk.java.net/~prr/8195808.1
04-06-2018

Assign to Phil to propose a solution, which will likely need changes both in FX and in Java2D.
20-03-2018

After talking with the Jigsaw team, it seems we will need a different solution for this dependency, preferably one that can just use public API. I note that until we have public API, the only negative consequence will be that print dialogs that should be on top of other JavaFX windows will not necessarily be on top. And as a workaround, applications can add the needed qualified exports on the command line.
20-03-2018

This is somewhat similar to the (much larger) Swing interop feature in that we really do need to interoperate in a way that likely cannot just use public API. We might need to formalize a private interface using a similar technique to what we did for SWT interop and plan to do for Swing interop.
19-01-2018