Yes, this will still work, although dipping into non-public state
continues to be something we wouldn't recommend that an application rely
on...
-- Kevin
Dr. Michael Paus wrote:
As nobody has stated it explicitly so far I would like to ask what
will happen
to classes in Java9 which access methods that are within the javafx
namespace but
are declared private? Will code like this still work or not?
public static double getPixelScale(Screen screen) throws
NoSuchMethodException, SecurityException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
Method m = Screen.class.getDeclaredMethod("getScale");
m.setAccessible(true);
return ((Float) m.invoke(screen)).doubleValue();
}
This hack for example is currently necessary because there is no other
way to get at
the current pixel scale of a HiDPI screen.