8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
authorserb
Mon, 28 Jan 2019 17:19:54 -0800
changeset 53673 e04d39094915
parent 53672 f024302abefd
child 53674 1e1b4f09b869
8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration Reviewed-by: aivanov, prr
src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java
src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java
src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDevice.java
src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterGraphicsConfig.java
src/java.desktop/share/classes/java/awt/GraphicsConfiguration.java
src/java.desktop/share/classes/sun/awt/image/BufferedImageDevice.java
src/java.desktop/share/classes/sun/awt/image/BufferedImageGraphicsConfig.java
src/java.desktop/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java
src/java.desktop/share/classes/sun/print/PrinterGraphicsConfig.java
src/java.desktop/share/classes/sun/print/PrinterGraphicsDevice.java
src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java
src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java
src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java
src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c
src/java.desktop/windows/classes/sun/awt/Win32GraphicsConfig.java
src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java
src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java
src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java
src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
--- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.awt.Rectangle;
 import java.awt.Transparency;
 import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 
 import sun.java2d.SurfaceData;
@@ -48,11 +47,6 @@
     }
 
     @Override
-    public BufferedImage createCompatibleImage(int width, int height) {
-        throw new UnsupportedOperationException("not implemented");
-    }
-
-    @Override
     public final Rectangle getBounds() {
         return device.getBounds();
     }
@@ -66,11 +60,6 @@
     }
 
     @Override
-    public ColorModel getColorModel(int transparency) {
-        throw new UnsupportedOperationException("not implemented");
-    }
-
-    @Override
     public AffineTransform getDefaultTransform() {
         double scaleFactor = device.getScaleFactor();
         return AffineTransform.getScaleInstance(scaleFactor, scaleFactor);
--- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,11 +51,7 @@
     private volatile Rectangle bounds;
     private volatile int scale;
 
-    // Array of all GraphicsConfig instances for this device
-    private final GraphicsConfiguration[] configs;
-
-    // Default config (temporarily hard coded)
-    private final int DEFAULT_CONFIG = 0;
+    private final GraphicsConfiguration config;
 
     private static AWTPermission fullScreenExclusivePermission;
 
@@ -64,9 +60,7 @@
 
     public CGraphicsDevice(final int displayID) {
         this.displayID = displayID;
-        configs = new GraphicsConfiguration[] {
-            CGLGraphicsConfig.getConfig(this, displayID, 0)
-        };
+        config = CGLGraphicsConfig.getConfig(this, displayID, 0);
     }
 
     /**
@@ -74,7 +68,7 @@
      */
     @Override
     public GraphicsConfiguration[] getConfigurations() {
-        return configs.clone();
+        return new GraphicsConfiguration[]{config};
     }
 
     /**
@@ -82,7 +76,7 @@
      */
     @Override
     public GraphicsConfiguration getDefaultConfiguration() {
-        return configs[DEFAULT_CONFIG];
+        return config;
     }
 
     /**
--- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -185,11 +185,6 @@
         return pConfigInfo;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.BufferedContextProvider#getContext
-     */
     @Override
     public OGLContext getContext() {
         return context;
@@ -395,11 +390,6 @@
         return vi;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
-     */
     @Override
     public ContextCapabilities getContextCapabilities() {
         return oglCaps;
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDevice.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDevice.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,15 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.*;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+
+public final class CPrinterDevice extends GraphicsDevice {
 
-public class CPrinterDevice extends GraphicsDevice {
-    GraphicsConfiguration gc;
+    private final GraphicsConfiguration config;
 
-    public CPrinterDevice(CPrinterGraphicsConfig gc) {
-        this.gc = gc;
+    public CPrinterDevice(final CPrinterGraphicsConfig config) {
+        this.config = config;
     }
 
     /**
@@ -42,6 +44,7 @@
      * @see #TYPE_PRINTER
      * @see #TYPE_IMAGE_BUFFER
      */
+    @Override
     public int getType() {
         return GraphicsDevice.TYPE_PRINTER;
     }
@@ -52,6 +55,7 @@
      * @return a {@code String} that is the identification
      * of this {@code GraphicsDevice}.
      */
+    @Override
     public String getIDstring() {
         return ("Printer");
     }
@@ -63,8 +67,9 @@
      * objects that are associated with this
      * {@code GraphicsDevice}.
      */
+    @Override
     public GraphicsConfiguration[] getConfigurations() {
-        return new GraphicsConfiguration[] { gc };
+        return new GraphicsConfiguration[]{config};
     }
 
     /**
@@ -73,7 +78,8 @@
      * @return the default {@code GraphicsConfiguration}
      * of this {@code GraphicsDevice}.
      */
+    @Override
     public GraphicsConfiguration getDefaultConfiguration() {
-        return gc;
+        return config;
     }
 }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,29 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.image.*;
-import java.awt.print.*;
+import java.awt.Component;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.Rectangle;
+import java.awt.Transparency;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.VolatileImage;
+import java.awt.print.PageFormat;
 
-public class CPrinterGraphicsConfig extends GraphicsConfiguration {
+public final class CPrinterGraphicsConfig extends GraphicsConfiguration {
+
     public static CPrinterGraphicsConfig getConfig(PageFormat pf) {
         return new CPrinterGraphicsConfig(pf);
     }
 
-    GraphicsDevice gd;
-    PageFormat pf;
+    private final GraphicsDevice device;
+    private final PageFormat pf;
 
     public CPrinterGraphicsConfig(PageFormat pf) {
-        this.gd = new CPrinterDevice(this);
+        this.device = new CPrinterDevice(this);
         this.pf = pf;
     }
 
@@ -53,8 +61,9 @@
      * @return a {@code GraphicsDevice} object that is
      * associated with this {@code GraphicsConfiguration}.
      */
+    @Override
     public GraphicsDevice getDevice() {
-        return gd;
+        return device;
     }
 
     /**
@@ -70,6 +79,7 @@
      * @return a {@code BufferedImage} whose data layout and color
      * model is compatible with this {@code GraphicsConfiguration}.
      */
+    @Override
     public BufferedImage createCompatibleImage(int width, int height) {
         return createCompatibleImage(width, height, Transparency.OPAQUE);
     }
@@ -87,11 +97,13 @@
      * model is compatible with this {@code GraphicsConfiguration}.
      * @see Component#createVolatileImage(int, int)
      */
+    @Override
     public VolatileImage createCompatibleVolatileImage(int width, int height) {
         return createCompatibleVolatileImage(width, height, Transparency.OPAQUE);
     }
 
     // empty implementation (this should not be called)
+    @Override
     public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency) {
         return null;
     }
@@ -114,6 +126,7 @@
      * @see Transparency#BITMASK
      * @see Transparency#TRANSLUCENT
      */
+    @Override
     public BufferedImage createCompatibleImage(int width, int height, int transparency) {
         //+++gdb what to do?
         return null;
@@ -125,6 +138,7 @@
      * @return a {@code ColorModel} object that is associated with
      * this {@code GraphicsConfiguration}.
      */
+    @Override
     public ColorModel getColorModel() {
         return getColorModel(Transparency.OPAQUE);
     }
@@ -138,6 +152,7 @@
      * this {@code GraphicsConfiguration} and supports the
      * specified transparency.
      */
+    @Override
     public ColorModel getColorModel(int transparency) {
         return ColorModel.getRGBdefault();
     }
@@ -161,6 +176,7 @@
      * @return the default {@code AffineTransform} for this
      * {@code GraphicsConfiguration}.
      */
+    @Override
     public AffineTransform getDefaultTransform() {
         return new AffineTransform();
     }
@@ -192,6 +208,7 @@
      * default {@code AffineTransform} so that 72 units in user
      * space is mapped to 1 inch in device space.
      */
+    @Override
     public AffineTransform getNormalizingTransform() {
         return new AffineTransform();
     }
@@ -205,6 +222,7 @@
      * {@code GraphicsConfiguration}.
      * @since 1.3
      */
+    @Override
     public Rectangle getBounds() {
         return new Rectangle(0, 0, (int)pf.getWidth(), (int)pf.getHeight());
     }
--- a/src/java.desktop/share/classes/java/awt/GraphicsConfiguration.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/share/classes/java/awt/GraphicsConfiguration.java	Mon Jan 28 17:19:54 2019 -0800
@@ -104,8 +104,6 @@
  * implements the interface for that capability.
  *
  */
-
-
 public abstract class GraphicsConfiguration {
 
     private static BufferCapabilities defaultBufferCaps;
--- a/src/java.desktop/share/classes/sun/awt/image/BufferedImageDevice.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/share/classes/sun/awt/image/BufferedImageDevice.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,15 +25,15 @@
 
 package sun.awt.image;
 
+import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsDevice;
-import java.awt.GraphicsConfiguration;
+
+public final class BufferedImageDevice extends GraphicsDevice {
 
-public class BufferedImageDevice extends GraphicsDevice
-{
-    GraphicsConfiguration gc;
+    private final GraphicsConfiguration config;
 
-    public BufferedImageDevice(BufferedImageGraphicsConfig gc) {
-        this.gc = gc;
+    public BufferedImageDevice(final BufferedImageGraphicsConfig config) {
+        this.config = config;
     }
 
     /**
@@ -44,6 +44,7 @@
      * @see #TYPE_PRINTER
      * @see #TYPE_IMAGE_BUFFER
      */
+    @Override
     public int getType() {
         return GraphicsDevice.TYPE_IMAGE_BUFFER;
     }
@@ -54,6 +55,7 @@
      * @return a {@code String} that is the identification
      * of this {@code GraphicsDevice}.
      */
+    @Override
     public String getIDstring() {
         return ("BufferedImage");
     }
@@ -65,8 +67,9 @@
      * objects that are associated with this
      * {@code GraphicsDevice}.
      */
+    @Override
     public GraphicsConfiguration[] getConfigurations() {
-        return new GraphicsConfiguration[] { gc };
+        return new GraphicsConfiguration[]{config};
     }
 
     /**
@@ -75,7 +78,8 @@
      * @return the default {@code GraphicsConfiguration}
      * of this {@code GraphicsDevice}.
      */
+    @Override
     public GraphicsConfiguration getDefaultConfiguration() {
-        return gc;
+        return config;
     }
 }
--- a/src/java.desktop/share/classes/sun/awt/image/BufferedImageGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/share/classes/sun/awt/image/BufferedImageGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,10 @@
 
 package sun.awt.image;
 
-import java.awt.AWTException;
 import java.awt.Component;
 import java.awt.Graphics2D;
 import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsDevice;
-import java.awt.ImageCapabilities;
 import java.awt.Rectangle;
 import java.awt.Transparency;
 import java.awt.geom.AffineTransform;
@@ -38,12 +36,10 @@
 import java.awt.image.ColorModel;
 import java.awt.image.DirectColorModel;
 import java.awt.image.Raster;
-import java.awt.image.VolatileImage;
 import java.awt.image.WritableRaster;
 
-public class BufferedImageGraphicsConfig
-    extends GraphicsConfiguration
-{
+public final class BufferedImageGraphicsConfig extends GraphicsConfiguration {
+
     private static final int numconfigs = BufferedImage.TYPE_BYTE_BINARY;
     private static BufferedImageGraphicsConfig[] standardConfigs =
         new BufferedImageGraphicsConfig[numconfigs];
@@ -77,24 +73,20 @@
         return ret;
     }
 
-    GraphicsDevice gd;
-    ColorModel model;
-    Raster raster;
+    private final GraphicsDevice device;
+    private final ColorModel model;
+    private final Raster raster;
     private final double scaleX;
     private final double scaleY;
 
-    public BufferedImageGraphicsConfig(BufferedImage bufImg, Component comp) {
-        this(bufImg, comp, 1, 1);
-    }
-
     public BufferedImageGraphicsConfig(BufferedImage bufImg, Component comp,
                                        double scaleX, double scaleY)
     {
         if (comp == null) {
-            this.gd = new BufferedImageDevice(this);
+            device = new BufferedImageDevice(this);
         } else {
             Graphics2D g2d = (Graphics2D)comp.getGraphics();
-            this.gd = g2d.getDeviceConfiguration().getDevice();
+            device = g2d.getDeviceConfiguration().getDevice();
         }
         this.model = bufImg.getColorModel();
         this.raster = bufImg.getRaster().createCompatibleWritableRaster(1, 1);
@@ -105,8 +97,9 @@
     /**
      * Return the graphics device associated with this configuration.
      */
+    @Override
     public GraphicsDevice getDevice() {
-        return gd;
+        return device;
     }
 
     /**
@@ -118,6 +111,7 @@
      * that is closest to this native device configuration and thus
      * can be optimally blitted to this device.
      */
+    @Override
     public BufferedImage createCompatibleImage(int width, int height) {
         WritableRaster wr = raster.createCompatibleWritableRaster(width, height);
         return new BufferedImage(model, wr, model.isAlphaPremultiplied(), null);
@@ -126,6 +120,7 @@
     /**
      * Returns the color model associated with this configuration.
      */
+    @Override
     public ColorModel getColorModel() {
         return model;
     }
@@ -134,6 +129,7 @@
      * Returns the color model associated with this configuration that
      * supports the specified transparency.
      */
+    @Override
     public ColorModel getColorModel(int transparency) {
 
         if (model.getTransparency() == transparency) {
@@ -160,6 +156,7 @@
      * increasing to the right and Y coordinates increasing downwards.
      * For image buffers, this Transform will be the Identity transform.
      */
+    @Override
     public AffineTransform getDefaultTransform() {
         return AffineTransform.getScaleInstance(scaleX, scaleY);
     }
@@ -183,10 +180,12 @@
      * For image buffers, this Transform will be the Identity transform,
      * since there is no valid distance measurement.
      */
+    @Override
     public AffineTransform getNormalizingTransform() {
         return new AffineTransform();
     }
 
+    @Override
     public Rectangle getBounds() {
         return new Rectangle(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE);
     }
--- a/src/java.desktop/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,20 @@
 
 package sun.java2d;
 
-import java.awt.GraphicsEnvironment;
+import java.awt.Font;
+import java.awt.Graphics2D;
 import java.awt.GraphicsDevice;
-import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
 import java.awt.HeadlessException;
-import java.awt.image.BufferedImage;
-import java.awt.Font;
-import java.util.Locale;
-import sun.awt.FontConfiguration;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+import java.util.Locale;
 
 /**
  * Headless decorator implementation of a SunGraphicsEnvironment
  */
-
-public class HeadlessGraphicsEnvironment extends GraphicsEnvironment {
+public final class HeadlessGraphicsEnvironment extends GraphicsEnvironment {
 
     private GraphicsEnvironment ge;
 
@@ -48,37 +46,41 @@
         this.ge = ge;
     }
 
+    @Override
     public GraphicsDevice[] getScreenDevices()
         throws HeadlessException {
         throw new HeadlessException();
     }
 
+    @Override
     public GraphicsDevice getDefaultScreenDevice()
         throws HeadlessException {
         throw new HeadlessException();
     }
 
+    @Override
     public Point getCenterPoint() throws HeadlessException {
         throw new HeadlessException();
     }
 
+    @Override
     public Rectangle getMaximumWindowBounds() throws HeadlessException {
         throw new HeadlessException();
     }
 
+    @Override
     public Graphics2D createGraphics(BufferedImage img) {
         return ge.createGraphics(img); }
 
+    @Override
     public Font[] getAllFonts() { return ge.getAllFonts(); }
 
+    @Override
     public String[] getAvailableFontFamilyNames() {
         return ge.getAvailableFontFamilyNames(); }
 
+    @Override
     public String[] getAvailableFontFamilyNames(Locale l) {
-        return ge.getAvailableFontFamilyNames(l); }
-
-    /* Used by FontManager : internal API */
-    public GraphicsEnvironment getSunGraphicsEnvironment() {
-        return ge;
+        return ge.getAvailableFontFamilyNames(l);
     }
 }
--- a/src/java.desktop/share/classes/sun/print/PrinterGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/share/classes/sun/print/PrinterGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
 
 import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsDevice;
-
 import java.awt.Rectangle;
 import java.awt.Transparency;
 import java.awt.geom.AffineTransform;
@@ -35,32 +34,35 @@
 import java.awt.image.ColorModel;
 import java.awt.image.DirectColorModel;
 
-public class PrinterGraphicsConfig extends GraphicsConfiguration {
+public final class PrinterGraphicsConfig extends GraphicsConfiguration {
 
     static ColorModel theModel;
 
-    GraphicsDevice gd;
-    int pageWidth, pageHeight;
-    AffineTransform deviceTransform;
+    private final GraphicsDevice device;
+    private final int pageWidth;
+    private final int pageHeight;
+    private final AffineTransform deviceTransform;
 
     public PrinterGraphicsConfig(String printerID, AffineTransform deviceTx,
                                  int pageWid, int pageHgt) {
         this.pageWidth = pageWid;
         this.pageHeight = pageHgt;
         this.deviceTransform = deviceTx;
-        this.gd = new PrinterGraphicsDevice(this, printerID);
+        this.device = new PrinterGraphicsDevice(this, printerID);
     }
 
     /**
      * Return the graphics device associated with this configuration.
      */
+    @Override
     public GraphicsDevice getDevice() {
-        return gd;
+        return device;
     }
 
     /**
      * Returns the color model associated with this configuration.
      */
+    @Override
     public ColorModel getColorModel() {
         if (theModel == null) {
             BufferedImage bufImg =
@@ -75,6 +77,7 @@
      * Returns the color model associated with this configuration that
      * supports the specified transparency.
      */
+    @Override
     public ColorModel getColorModel(int transparency) {
         switch (transparency) {
         case Transparency.OPAQUE:
@@ -97,6 +100,7 @@
      * increasing to the right and Y coordinates increasing downwards.
      * For image buffers, this Transform will be the Identity transform.
      */
+    @Override
     public AffineTransform getDefaultTransform() {
         return new AffineTransform(deviceTransform);
     }
@@ -120,10 +124,12 @@
      * For image buffers, this Transform will be the Identity transform,
      * since there is no valid distance measurement.
      */
+    @Override
     public AffineTransform getNormalizingTransform() {
         return new AffineTransform();
     }
 
+    @Override
     public Rectangle getBounds() {
         return new Rectangle(0, 0, pageWidth, pageHeight);
     }
--- a/src/java.desktop/share/classes/sun/print/PrinterGraphicsDevice.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/share/classes/sun/print/PrinterGraphicsDevice.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
  * questions.
  */
 
-
 package sun.print;
 
 import java.awt.GraphicsConfiguration;
@@ -32,36 +31,40 @@
 
 public final class PrinterGraphicsDevice extends GraphicsDevice {
 
-    String printerID;
-    GraphicsConfiguration graphicsConf;
+    private final String printerID;
+    private final GraphicsConfiguration config;
 
-    protected PrinterGraphicsDevice(GraphicsConfiguration conf, String id) {
+    PrinterGraphicsDevice(GraphicsConfiguration conf, String id) {
         printerID = id;
-        graphicsConf = conf;
+        config = conf;
     }
 
+    @Override
     public int getType() {
         return TYPE_PRINTER;
     }
 
+    @Override
     public String getIDstring() {
         return printerID;
     }
 
+    @Override
     public GraphicsConfiguration[] getConfigurations() {
-        GraphicsConfiguration[] confs = new GraphicsConfiguration[1];
-        confs[0] = graphicsConf;
-        return confs;
+        return new GraphicsConfiguration[]{config};
     }
 
+    @Override
     public GraphicsConfiguration getDefaultConfiguration() {
-        return graphicsConf;
+        return config;
     }
 
+    @Override
     public void setFullScreenWindow(Window w) {
         // Do nothing
     }
 
+    @Override
     public Window getFullScreenWindow() {
         return null;
     }
--- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,32 +28,33 @@
 import java.awt.AWTException;
 import java.awt.BufferCapabilities;
 import java.awt.Component;
-import java.awt.Toolkit;
 import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsDevice;
 import java.awt.Image;
 import java.awt.ImageCapabilities;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
 import java.awt.Transparency;
-import java.awt.image.ColorModel;
 import java.awt.color.ColorSpace;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ColorModel;
 import java.awt.image.ComponentColorModel;
+import java.awt.image.DataBuffer;
 import java.awt.image.DirectColorModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.VolatileImage;
 import java.awt.image.WritableRaster;
-import java.awt.geom.AffineTransform;
-import java.awt.Rectangle;
+
+import sun.awt.image.OffScreenImage;
+import sun.awt.image.SunVolatileImage;
+import sun.awt.image.SurfaceManager;
 import sun.java2d.Disposer;
 import sun.java2d.DisposerRecord;
 import sun.java2d.SurfaceData;
+import sun.java2d.loops.CompositeType;
 import sun.java2d.loops.RenderLoops;
 import sun.java2d.loops.SurfaceType;
-import sun.java2d.loops.CompositeType;
 import sun.java2d.pipe.Region;
 import sun.java2d.x11.X11SurfaceData;
-import sun.awt.image.OffScreenImage;
-import sun.awt.image.SunVolatileImage;
-import sun.awt.image.SurfaceManager;
 
 /**
  * This is an implementation of a GraphicsConfiguration object for a
@@ -65,7 +66,7 @@
 public class X11GraphicsConfig extends GraphicsConfiguration
     implements SurfaceManager.ProxiedGraphicsConfig
 {
-    protected X11GraphicsDevice screen;
+    private final X11GraphicsDevice device;
     protected int visual;
     int depth;
     int colormap;
@@ -116,12 +117,12 @@
                                 int visualnum, int depth,
                                 int colormap, boolean doubleBuffer)
     {
-        this.screen = device;
+        this.device = device;
         this.visual = visualnum;
         this.doubleBuffer = doubleBuffer;
         this.depth = depth;
         this.colormap = colormap;
-        init (visualnum, screen.getScreen());
+        init (visualnum, device.getScreen());
 
         // add a record to the Disposer so that we destroy the native
         // AwtGraphicsConfigData when this object goes away (i.e. after a
@@ -134,8 +135,9 @@
     /**
      * Return the graphics device associated with this configuration.
      */
+    @Override
     public X11GraphicsDevice getDevice() {
-        return screen;
+        return device;
     }
 
     /**
@@ -177,8 +179,9 @@
         return surfaceType;
     }
 
+    @Override
     public Object getProxyKey() {
-        return screen.getProxyKeyFor(getSurfaceType());
+        return device.getProxyKeyFor(getSurfaceType());
     }
 
     /**
@@ -197,6 +200,7 @@
     /**
      * Returns the color model associated with this configuration.
      */
+    @Override
     public synchronized ColorModel getColorModel() {
         if (colorModel == null)  {
             // Force SystemColors to be resolved before we create the CM
@@ -218,6 +222,7 @@
      * Returns the color model associated with this configuration that
      * supports the specified transparency.
      */
+    @Override
     public ColorModel getColorModel(int transparency) {
         switch (transparency) {
         case Transparency.OPAQUE:
@@ -256,6 +261,7 @@
      * increasing to the right and Y coordinates increasing downwards.
      * For image buffers, this Transform will be the Identity transform.
      */
+    @Override
     public AffineTransform getDefaultTransform() {
         double scale = getScale();
         return AffineTransform.getScaleInstance(scale, scale);
@@ -292,9 +298,10 @@
      * For image buffers, this Transform will be the Identity transform,
      * since there is no valid distance measurement.
      */
+    @Override
     public AffineTransform getNormalizingTransform() {
-        double xscale = getXResolution(screen.getScreen()) / 72.0;
-        double yscale = getYResolution(screen.getScreen()) / 72.0;
+        double xscale = getXResolution(device.getScreen()) / 72.0;
+        double yscale = getYResolution(device.getScreen()) / 72.0;
         return new AffineTransform(xscale, 0.0, 0.0, yscale, 0.0, 0.0);
     }
 
@@ -306,7 +313,7 @@
     }
 
     public String toString() {
-        return ("X11GraphicsConfig[dev="+screen+
+        return ("X11GraphicsConfig[dev="+device+
                 ",vis=0x"+Integer.toHexString(visual)+
                 "]");
     }
@@ -321,8 +328,9 @@
         initIDs ();
     }
 
+    @Override
     public Rectangle getBounds() {
-        Rectangle rect = pGetBounds(screen.getScreen());
+        Rectangle rect = pGetBounds(device.getScreen());
         if (getScale() != 1) {
             rect.x = scaleDown(rect.x);
             rect.y = scaleDown(rect.y);
@@ -340,6 +348,7 @@
         }
     }
 
+    @Override
     public BufferCapabilities getBufferCapabilities() {
         if (bufferCaps == null) {
             if (doubleBuffer) {
@@ -351,6 +360,7 @@
         return bufferCaps;
     }
 
+    @Override
     public ImageCapabilities getImageCapabilities() {
         return imageCaps;
     }
@@ -366,6 +376,7 @@
         public X11GCDisposerRecord(long x11CfgData) {
             this.x11ConfigData = x11CfgData;
         }
+        @Override
         public synchronized void dispose() {
             if (x11ConfigData != 0L) {
                 X11GraphicsConfig.dispose(x11ConfigData);
--- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,23 +27,22 @@
 
 import java.awt.AWTPermission;
 import java.awt.DisplayMode;
-import java.awt.GraphicsEnvironment;
+import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsDevice;
-import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
 import java.awt.Rectangle;
 import java.awt.Window;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
-import java.util.HashMap;
-
-import sun.java2d.opengl.GLXGraphicsConfig;
-import sun.java2d.xr.XRGraphicsConfig;
-import sun.java2d.loops.SurfaceType;
 
 import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.SunGraphicsEnvironment;
+import sun.java2d.loops.SurfaceType;
+import sun.java2d.opengl.GLXGraphicsConfig;
+import sun.java2d.xr.XRGraphicsConfig;
 
 /**
  * This is an implementation of a GraphicsDevice object for a single
@@ -76,12 +75,6 @@
      */
     private static native void initIDs();
 
-    static {
-        if (!GraphicsEnvironment.isHeadless()) {
-            initIDs();
-        }
-    }
-
     /**
      * Returns the X11 screen of the device.
      */
@@ -113,6 +106,7 @@
      * @see #TYPE_PRINTER
      * @see #TYPE_IMAGE_BUFFER
      */
+    @Override
     public int getType() {
         return TYPE_RASTER_SCREEN;
     }
@@ -121,6 +115,7 @@
      * Returns the identification string associated with this graphics
      * device.
      */
+    @Override
     public String getIDstring() {
         return ":0."+screen;
     }
@@ -134,6 +129,7 @@
      * Returns all of the graphics
      * configurations associated with this graphics device.
      */
+    @Override
     public GraphicsConfiguration[] getConfigurations() {
         if (configs == null) {
             synchronized (configLock) {
@@ -221,6 +217,7 @@
      * Returns the default graphics configuration
      * associated with this graphics device.
      */
+    @Override
     public GraphicsConfiguration getDefaultConfiguration() {
         if (defaultConfig == null) {
             synchronized (configLock) {
@@ -487,6 +484,7 @@
      * From the DisplayChangedListener interface; called from
      * X11GraphicsEnvironment when the display mode has been changed.
      */
+    @Override
     public synchronized void displayChanged() {
         scale = initScaleFactor();
         // On X11 the visuals do not change, and therefore we don't need
@@ -501,6 +499,7 @@
      * From the DisplayChangedListener interface; devices do not need
      * to react to this event.
      */
+    @Override
     public void paletteChanged() {
     }
 
--- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@
 import java.awt.image.DirectColorModel;
 import java.awt.image.VolatileImage;
 import java.awt.image.WritableRaster;
+
 import sun.awt.X11ComponentPeer;
 import sun.awt.X11GraphicsConfig;
 import sun.awt.X11GraphicsDevice;
@@ -51,15 +52,18 @@
 import sun.java2d.SunGraphics2D;
 import sun.java2d.Surface;
 import sun.java2d.SurfaceData;
+import sun.java2d.opengl.GLXSurfaceData.GLXVSyncOffScreenSurfaceData;
 import sun.java2d.pipe.hw.AccelSurface;
 import sun.java2d.pipe.hw.AccelTypedVolatileImage;
 import sun.java2d.pipe.hw.ContextCapabilities;
-import static sun.java2d.opengl.OGLSurfaceData.*;
-import static sun.java2d.opengl.OGLContext.*;
-import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
-import sun.java2d.opengl.GLXSurfaceData.GLXVSyncOffScreenSurfaceData;
 
-public class GLXGraphicsConfig
+import static sun.java2d.opengl.OGLContext.OGLContextCaps;
+import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_DOUBLEBUFFERED;
+import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_EXT_FBOBJECT;
+import static sun.java2d.opengl.OGLSurfaceData.FBOBJECT;
+import static sun.java2d.opengl.OGLSurfaceData.TEXTURE;
+
+public final class GLXGraphicsConfig
     extends X11GraphicsConfig
     implements OGLGraphicsConfig
 {
@@ -172,11 +176,6 @@
         return pConfigInfo;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.BufferedContextProvider#getContext
-     */
     @Override
     public final OGLContext getContext() {
         return context;
@@ -211,7 +210,7 @@
     }
 
     public String toString() {
-        return ("GLXGraphicsConfig[dev="+screen+
+        return ("GLXGraphicsConfig[dev="+getDevice()+
                 ",vis=0x"+Integer.toHexString(visual)+
                 "]");
     }
@@ -386,11 +385,6 @@
         return imageCaps;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
-     */
     @Override
     public VolatileImage
         createCompatibleVolatileImage(int width, int height,
@@ -414,11 +408,6 @@
         return vi;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
-     */
     @Override
     public ContextCapabilities getContextCapabilities() {
         return oglCaps;
--- a/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,12 +62,6 @@
 struct X11GraphicsConfigIDs {
     jfieldID aData;
     jfieldID bitsPerPixel;
-    jfieldID screen;
-};
-
-/* fieldIDs for X11GraphicsDevice fields that may be accessed from C */
-struct X11GraphicsDeviceIDs {
-    jfieldID screen;
 };
 
 #endif /* _AWT_GRAPHICSENV_H_ */
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,6 @@
     } while (0)
 
 struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
-struct X11GraphicsDeviceIDs x11GraphicsDeviceIDs;
 
 #ifndef HEADLESS
 int awtCreateX11Colormap(AwtGraphicsConfigDataPtr adata);
@@ -152,32 +151,20 @@
 {
     x11GraphicsConfigIDs.aData = NULL;
     x11GraphicsConfigIDs.bitsPerPixel = NULL;
-    x11GraphicsConfigIDs.screen = NULL;
 
     x11GraphicsConfigIDs.aData = (*env)->GetFieldID (env, cls, "aData", "J");
     CHECK_NULL(x11GraphicsConfigIDs.aData);
     x11GraphicsConfigIDs.bitsPerPixel = (*env)->GetFieldID (env, cls, "bitsPerPixel", "I");
     CHECK_NULL(x11GraphicsConfigIDs.bitsPerPixel);
-    x11GraphicsConfigIDs.screen = (*env)->GetFieldID (env, cls, "screen", "Lsun/awt/X11GraphicsDevice;");
-    CHECK_NULL(x11GraphicsConfigIDs.screen);
 
     if (x11GraphicsConfigIDs.aData == NULL ||
-            x11GraphicsConfigIDs.bitsPerPixel == NULL ||
-        x11GraphicsConfigIDs.screen == NULL) {
+            x11GraphicsConfigIDs.bitsPerPixel == NULL) {
 
             JNU_ThrowNoSuchFieldError(env, "Can't find a field");
             return;
         }
 }
 
-JNIEXPORT void JNICALL
-Java_sun_awt_X11GraphicsDevice_initIDs (JNIEnv *env, jclass cls)
-{
-    x11GraphicsDeviceIDs.screen = NULL;
-    x11GraphicsDeviceIDs.screen = (*env)->GetFieldID (env, cls, "screen", "I");
-    DASSERT(x11GraphicsDeviceIDs.screen);
-}
-
 #ifndef HEADLESS
 
 /*
--- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,28 +33,22 @@
 import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
 import java.awt.Image;
-import java.awt.ImageCapabilities;
 import java.awt.Rectangle;
-import java.awt.Toolkit;
 import java.awt.Transparency;
-import java.awt.Window;
 import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 import java.awt.image.DirectColorModel;
-import java.awt.image.Raster;
 import java.awt.image.VolatileImage;
 import java.awt.image.WritableRaster;
 
-import sun.awt.windows.WComponentPeer;
 import sun.awt.image.OffScreenImage;
 import sun.awt.image.SunVolatileImage;
 import sun.awt.image.SurfaceManager;
+import sun.awt.windows.WComponentPeer;
 import sun.java2d.SurfaceData;
-import sun.java2d.InvalidPipeException;
+import sun.java2d.loops.CompositeType;
 import sun.java2d.loops.RenderLoops;
 import sun.java2d.loops.SurfaceType;
-import sun.java2d.loops.CompositeType;
 import sun.java2d.windows.GDIWindowSurfaceData;
 
 /**
@@ -67,7 +61,7 @@
 public class Win32GraphicsConfig extends GraphicsConfiguration
     implements DisplayChangedListener, SurfaceManager.ProxiedGraphicsConfig
 {
-    protected Win32GraphicsDevice screen;
+    private final Win32GraphicsDevice device;
     protected int visual;  //PixelFormatID
     protected RenderLoops solidloops;
 
@@ -98,7 +92,7 @@
      */
     @Deprecated
     public Win32GraphicsConfig(GraphicsDevice device, int visualnum) {
-        this.screen = (Win32GraphicsDevice)device;
+        this.device = (Win32GraphicsDevice)device;
         this.visual = visualnum;
         ((Win32GraphicsDevice)device).addDisplayChangedListener(this);
     }
@@ -106,8 +100,9 @@
     /**
      * Return the graphics device associated with this configuration.
      */
+    @Override
     public Win32GraphicsDevice getDevice() {
-        return screen;
+        return device;
     }
 
     /**
@@ -117,8 +112,9 @@
         return visual;
     }
 
+    @Override
     public Object getProxyKey() {
-        return screen;
+        return device;
     }
 
     /**
@@ -139,8 +135,9 @@
     /**
      * Returns the color model associated with this configuration.
      */
+    @Override
     public synchronized ColorModel getColorModel() {
-        return screen.getColorModel();
+        return device.getColorModel();
     }
 
     /**
@@ -152,13 +149,14 @@
      * to reflect the new situation.
      */
     public ColorModel getDeviceColorModel() {
-        return screen.getDynamicColorModel();
+        return device.getDynamicColorModel();
     }
 
     /**
      * Returns the color model associated with this configuration that
      * supports the specified transparency.
      */
+    @Override
     public ColorModel getColorModel(int transparency) {
         switch (transparency) {
         case Transparency.OPAQUE:
@@ -181,9 +179,10 @@
      * increasing to the right and Y coordinates increasing downwards.
      * For image buffers, this Transform will be the Identity transform.
      */
+    @Override
     public AffineTransform getDefaultTransform() {
-        double scaleX = screen.getDefaultScaleX();
-        double scaleY = screen.getDefaultScaleY();
+        double scaleX = device.getDefaultScaleX();
+        double scaleY = device.getDefaultScaleY();
         return AffineTransform.getScaleInstance(scaleX, scaleY);
     }
 
@@ -206,6 +205,7 @@
      * For image buffers, this Transform will be the Identity transform,
      * since there is no valid distance measurement.
      */
+    @Override
     public AffineTransform getNormalizingTransform() {
         Win32GraphicsEnvironment ge = (Win32GraphicsEnvironment)
             GraphicsEnvironment.getLocalGraphicsEnvironment();
@@ -215,19 +215,22 @@
     }
 
     public String toString() {
-        return (super.toString()+"[dev="+screen+",pixfmt="+visual+"]");
+        return (super.toString()+"[dev="+device+",pixfmt="+visual+"]");
     }
 
     private native Rectangle getBounds(int screen);
 
+    @Override
     public Rectangle getBounds() {
-        return getBounds(screen.getScreen());
+        return getBounds(device.getScreen());
     }
 
+    @Override
     public synchronized void displayChanged() {
         solidloops = null;
     }
 
+    @Override
     public void paletteChanged() {}
 
     /**
--- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,28 +26,27 @@
 package sun.awt;
 
 import java.awt.AWTPermission;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsEnvironment;
 import java.awt.DisplayMode;
 import java.awt.EventQueue;
 import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
 import java.awt.Rectangle;
 import java.awt.Window;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
 import java.awt.event.WindowListener;
-import java.awt.geom.Point2D;
 import java.awt.image.ColorModel;
+import java.awt.peer.WindowPeer;
 import java.util.ArrayList;
 import java.util.Vector;
-import java.awt.peer.WindowPeer;
-import java.security.AccessController;
+
 import sun.awt.windows.WWindowPeer;
 import sun.java2d.SunGraphicsEnvironment;
 import sun.java2d.opengl.WGLGraphicsConfig;
 import sun.java2d.windows.WindowsFlags;
-import sun.security.action.GetPropertyAction;
+
 import static sun.awt.Win32GraphicsEnvironment.debugScaleX;
 import static sun.awt.Win32GraphicsEnvironment.debugScaleY;
 
@@ -131,6 +130,7 @@
      * @see #TYPE_PRINTER
      * @see #TYPE_IMAGE_BUFFER
      */
+    @Override
     public int getType() {
         return TYPE_RASTER_SCREEN;
     }
@@ -189,6 +189,7 @@
      * Returns the identification string associated with this graphics
      * device.
      */
+    @Override
     public String getIDstring() {
         return idString;
     }
@@ -198,6 +199,7 @@
      * Returns all of the graphics
      * configurations associated with this graphics device.
      */
+    @Override
     public GraphicsConfiguration[] getConfigurations() {
         if (configs==null) {
             if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
@@ -290,6 +292,7 @@
      * Returns the default graphics configuration
      * associated with this graphics device.
      */
+    @Override
     public GraphicsConfiguration getDefaultConfiguration() {
         if (defaultConfig == null) {
             // first try to create a WGLGraphicsConfig if OGL is enabled
@@ -329,6 +332,7 @@
         return defaultConfig;
     }
 
+    @Override
     public String toString() {
         return valid ? descString + "]" : descString + ", removed]";
     }
@@ -519,6 +523,7 @@
      * Called from Win32GraphicsEnvironment when the display settings have
      * changed.
      */
+    @Override
     public void displayChanged() {
         dynamicColorModel = null;
         defaultConfig = null;
@@ -532,6 +537,7 @@
      * Part of the DisplayChangedListener interface: devices
      * do not need to react to this event
      */
+    @Override
     public void paletteChanged() {
     }
 
@@ -659,6 +665,7 @@
         // Fix for 6709453. Using invokeLater to avoid listening
         // for the events already posted to the queue.
         EventQueue.invokeLater(new Runnable() {
+            @Override
             public void run() {
                 w.addWindowListener(fsWindowListener);
             }
--- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,14 +49,14 @@
 import static sun.java2d.pipe.hw.AccelSurface.*;
 import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
 
-public class D3DGraphicsConfig
+public final class D3DGraphicsConfig
     extends Win32GraphicsConfig
     implements AccelGraphicsConfig
 {
     private static ImageCapabilities imageCaps = new D3DImageCaps();
 
     private BufferCapabilities bufferCaps;
-    private D3DGraphicsDevice device;
+    private final D3DGraphicsDevice device;
 
     @SuppressWarnings("deprecation")
     protected D3DGraphicsConfig(D3DGraphicsDevice device) {
@@ -107,7 +107,7 @@
 
     @Override
     public String toString() {
-        return ("D3DGraphicsConfig[dev="+screen+",pixfmt="+visual+"]");
+        return ("D3DGraphicsConfig[dev="+device+",pixfmt="+visual+"]");
     }
 
     /**
@@ -263,21 +263,11 @@
         return device;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.BufferedContextProvider#getContext
-     */
     @Override
     public D3DContext getContext() {
         return device.getContext();
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
-     */
     @Override
     public VolatileImage
         createCompatibleVolatileImage(int width, int height,
@@ -313,11 +303,6 @@
         return vi;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
-     */
     @Override
     public ContextCapabilities getContextCapabilities() {
         return device.getContextCapabilities();
--- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,17 +42,19 @@
 import sun.awt.AWTAccessor.ComponentAccessor;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.windows.WWindowPeer;
+import sun.java2d.d3d.D3DContext.D3DContextCaps;
 import sun.java2d.pipe.hw.ContextCapabilities;
 import sun.java2d.windows.WindowsFlags;
-import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
-import sun.java2d.d3d.D3DContext.D3DContextCaps;
+
+import static sun.java2d.d3d.D3DContext.D3DContextCaps.CAPS_DEVICE_OK;
+import static sun.java2d.d3d.D3DContext.D3DContextCaps.CAPS_EMPTY;
 
 /**
  * This class implements D3D-specific functionality, such as fullscreen
  * exclusive mode and display changes.  It is kept separate from
  * Win32GraphicsDevice to help avoid overburdening the parent class.
  */
-public class D3DGraphicsDevice extends Win32GraphicsDevice {
+public final class D3DGraphicsDevice extends Win32GraphicsDevice {
     private D3DContext context;
 
     private static boolean d3dAvailable;
--- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Thu Jan 24 07:15:42 2019 -0800
+++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Mon Jan 28 17:19:54 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 import java.awt.image.DataBuffer;
 import java.awt.image.DirectColorModel;
 import java.awt.image.VolatileImage;
+
 import sun.awt.Win32GraphicsConfig;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.image.SunVolatileImage;
@@ -48,15 +49,19 @@
 import sun.java2d.SunGraphics2D;
 import sun.java2d.Surface;
 import sun.java2d.SurfaceData;
+import sun.java2d.opengl.OGLContext.OGLContextCaps;
 import sun.java2d.pipe.hw.AccelSurface;
 import sun.java2d.pipe.hw.AccelTypedVolatileImage;
 import sun.java2d.pipe.hw.ContextCapabilities;
-import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
-import static sun.java2d.opengl.WGLSurfaceData.*;
-import sun.java2d.opengl.OGLContext.OGLContextCaps;
 import sun.java2d.windows.GDIWindowSurfaceData;
 
-public class WGLGraphicsConfig
+import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_DOUBLEBUFFERED;
+import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_EXT_FBOBJECT;
+import static sun.java2d.opengl.WGLSurfaceData.FBOBJECT;
+import static sun.java2d.opengl.WGLSurfaceData.TEXTURE;
+import static sun.java2d.opengl.WGLSurfaceData.WGLVSyncOffScreenSurfaceData;
+
+public final class WGLGraphicsConfig
     extends Win32GraphicsConfig
     implements OGLGraphicsConfig
 {
@@ -93,10 +98,12 @@
                            new WGLGCDisposerRecord(pConfigInfo));
     }
 
+    @Override
     public Object getProxyKey() {
         return this;
     }
 
+    @Override
     public SurfaceData createManagedSurface(int w, int h, int transparency) {
         return WGLSurfaceData.createData(this, w, h,
                                          getColorModel(transparency),
@@ -127,6 +134,7 @@
             if (cfginfo != 0L) {
                 OGLContext.setScratchSurface(cfginfo);
                 rq.flushAndInvokeNow(new Runnable() {
+                    @Override
                     public void run() {
                         ids[0] = OGLContext.getOGLIdString();
                     }
@@ -157,6 +165,7 @@
             this.screen = screen;
             this.pixfmt = pixfmt;
         }
+        @Override
         public void run() {
             cfginfo = getWGLConfigInfo(screen, pixfmt);
         }
@@ -183,11 +192,6 @@
         return pConfigInfo;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.BufferedContextProvider#getContext
-     */
     @Override
     public final OGLContext getContext() {
         return context;
@@ -198,6 +202,7 @@
         public WGLGCDisposerRecord(long pCfgInfo) {
             this.pCfgInfo = pCfgInfo;
         }
+        @Override
         public void dispose() {
             if (pCfgInfo != 0) {
                 OGLRenderQueue.disposeGraphicsConfig(pCfgInfo);
@@ -242,7 +247,7 @@
 
     @Override
     public String toString() {
-        return ("WGLGraphicsConfig[dev="+screen+",pixfmt="+visual+"]");
+        return ("WGLGraphicsConfig[dev="+getDevice()+",pixfmt="+visual+"]");
     }
 
     /**
@@ -388,6 +393,7 @@
         private WGLImageCaps() {
             super(true);
         }
+        @Override
         public boolean isTrueVolatile() {
             return true;
         }
@@ -398,11 +404,6 @@
         return imageCaps;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
-     */
     @Override
     public VolatileImage
         createCompatibleVolatileImage(int width, int height,
@@ -426,11 +427,6 @@
         return vi;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
-     */
     @Override
     public ContextCapabilities getContextCapabilities() {
         return oglCaps;