boolean (GraphicsDevice device) { Boolean isRetina = devicesToRetinaSupportCacheMap.get(device); if (isRetina != null) { return isRetina; } Method getScaleFactorMethod = null; try { getScaleFactorMethod = Class.forName("sun.awt.CGraphicsDevice").getMethod("getScaleFactor"); } catch (ClassNotFoundException | NoSuchMethodException e) { // not an Oracle Mac JDK or API has been changed getLogger().debug("CGraphicsDevice.getScaleFactor(): not an Oracle Mac JDK or API has been changed"); } catch (Exception e) { getLogger().debug(e); getLogger().debug("CGraphicsDevice.getScaleFactor(): probably it is Java 9"); } try { isRetina = getScaleFactorMethod == null || (Integer)getScaleFactorMethod.invoke(device) != 1; } catch (IllegalAccessException e) { getLogger().debug("CGraphicsDevice.getScaleFactor(): Access issue"); isRetina = false; } catch (InvocationTargetException e) { getLogger().debug("CGraphicsDevice.getScaleFactor(): Invocation issue"); isRetina = false; } catch (IllegalArgumentException e) { getLogger().debug("object is not an instance of declaring class: " + device.getClass().getName()); isRetina = false; } devicesToRetinaSupportCacheMap.put(device, isRetina); return isRetina; }