From 83d661a615ac0a7ccddee369d75942563a4a81a7 Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Fri, 16 May 2014 15:46:24 +0400
Subject: [PATCH 001/192] 8043151: KSS:
 javax.swing.plaf.nimbus.AbstractRegionPainter#getComponentColor

Reviewed-by: alexsch, serb
---
 .../javax/swing/plaf/nimbus/AbstractRegionPainter.java       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
index f10dfd4298f..15a10fbf5f9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
@@ -31,6 +31,7 @@ import javax.swing.*;
 import javax.swing.plaf.UIResource;
 import javax.swing.Painter;
 import java.awt.print.PrinterGraphics;
+import sun.reflect.misc.MethodUtil;
 
 /**
  * Convenient base class for defining Painter instances for rendering a
@@ -445,8 +446,8 @@ public abstract class AbstractRegionPainter implements Painter<JComponent> {
             } else {
                 String s = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
                 try {
-                    Method method = c.getClass().getMethod(s);
-                    color = (Color) method.invoke(c);
+                    Method method = MethodUtil.getMethod(c.getClass(), s, null);
+                    color = (Color) MethodUtil.invoke(method, c, null);
                 } catch (Exception e) {
                     //don't do anything, it just didn't work, that's all.
                     //This could be a normal occurance if you use a property
-- 
GitLab


From e01b173e5af5155e1c6c226180ae5baff878a31a Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Fri, 16 May 2014 15:51:57 +0400
Subject: [PATCH 002/192] 8043152: KSS: javax.swing.plaf.synth.SynthContext

Reviewed-by: alexsch, serb
---
 jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java
index 6d89a4a06c8..1730f25d35c 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java
@@ -26,6 +26,7 @@ package javax.swing.plaf.synth;
 
 import javax.swing.*;
 import java.util.*;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * An immutable transient object containing contextual information about
@@ -70,7 +71,7 @@ public class SynthContext {
         }
         if (context == null) {
             try {
-                context = (SynthContext)type.newInstance();
+                context = (SynthContext) ReflectUtil.newInstance(type);
             } catch (IllegalAccessException iae) {
             } catch (InstantiationException ie) {
             }
-- 
GitLab


From df3fb56e9e4d02231709845b0ccc1604721090c5 Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Fri, 16 May 2014 15:57:06 +0400
Subject: [PATCH 003/192] 8043153: KSS:
 javax.swing.plaf.synth.SynthParser#startColor

Reviewed-by: alexsch, serb
---
 jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java
index ef38ae11387..a15bb509e78 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java
@@ -67,6 +67,7 @@ import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
 import com.sun.beans.decoder.DocumentHandler;
+import sun.reflect.misc.ReflectUtil;
 
 class SynthParser extends DefaultHandler {
     //
@@ -648,7 +649,7 @@ class SynthParser extends DefaultHandler {
                     }
                     else {
                         try {
-                            typeClass = Class.forName(typeName.substring(
+                            typeClass = ReflectUtil.forName(typeName.substring(
                                                       0, classIndex));
                         } catch (ClassNotFoundException cnfe) {
                             throw new SAXException("Unknown class: " +
-- 
GitLab


From 86104df3c2a520277364baf54f747d2b8a72a0bc Mon Sep 17 00:00:00 2001
From: Anton Nashatyrev <anashaty@openjdk.org>
Date: Mon, 19 May 2014 16:48:41 +0400
Subject: [PATCH 004/192] 8038000: java.awt.image.RasterFormatException:
 Incorrect scanline stride

Reviewed-by: bae, serb
---
 .../sun/awt/image/ByteBandedRaster.java       |  20 ++-
 .../sun/awt/image/ByteComponentRaster.java    |  20 ++-
 .../sun/awt/image/BytePackedRaster.java       |  19 ++-
 .../sun/awt/image/IntegerComponentRaster.java |  20 ++-
 .../sun/awt/image/ShortBandedRaster.java      |  19 ++-
 .../sun/awt/image/ShortComponentRaster.java   |  20 ++-
 jdk/test/sun/awt/image/bug8038000.java        | 153 ++++++++++++++++++
 7 files changed, 255 insertions(+), 16 deletions(-)
 create mode 100644 jdk/test/sun/awt/image/bug8038000.java

diff --git a/jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java b/jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java
index 78903979d6f..a0431baf4ac 100644
--- a/jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java
+++ b/jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java
@@ -755,10 +755,22 @@ public class ByteBandedRaster extends SunWritableRaster {
                     + scanlineStride);
         }
 
-        for (int i = 0; i < data.length; i++) {
-            if (scanlineStride > data[i].length) {
-                throw new RasterFormatException("Incorrect scanline stride: "
-                    + scanlineStride);
+        if ((long)minX - sampleModelTranslateX < 0 ||
+            (long)minY - sampleModelTranslateY < 0) {
+
+            throw new RasterFormatException("Incorrect origin/translate: (" +
+                    minX + ", " + minY + ") / (" +
+                    sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+        }
+
+
+        if (height > 1 || minY - sampleModelTranslateY > 0) {
+            // buffer should contain at least one scanline
+            for (int i = 0; i < data.length; i++) {
+                if (scanlineStride > data[i].length) {
+                    throw new RasterFormatException("Incorrect scanline stride: "
+                        + scanlineStride);
+                }
             }
         }
 
diff --git a/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java b/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
index 9695d3a0df8..b5f4f7095aa 100644
--- a/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
+++ b/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java
@@ -885,15 +885,31 @@ public class ByteComponentRaster extends SunWritableRaster {
             }
         }
 
+        if ((long)minX - sampleModelTranslateX < 0 ||
+            (long)minY - sampleModelTranslateY < 0) {
+
+            throw new RasterFormatException("Incorrect origin/translate: (" +
+                    minX + ", " + minY + ") / (" +
+                    sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+        }
+
         // we can be sure that width and height are greater than 0
         if (scanlineStride < 0 ||
-            scanlineStride > (Integer.MAX_VALUE / height) ||
-            scanlineStride > data.length)
+            scanlineStride > (Integer.MAX_VALUE / height))
         {
             // integer overflow
             throw new RasterFormatException("Incorrect scanline stride: "
                     + scanlineStride);
         }
+
+        if (height > 1 || minY - sampleModelTranslateY > 0) {
+            // buffer should contain at least one scanline
+            if (scanlineStride > data.length) {
+                throw new RasterFormatException("Incorrect scanline stride: "
+                        + scanlineStride);
+            }
+        }
+
         int lastScanOffset = (height - 1) * scanlineStride;
 
         if (pixelStride < 0 ||
diff --git a/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java b/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java
index da370a30c0d..bd3835d5184 100644
--- a/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java
+++ b/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java
@@ -1386,13 +1386,28 @@ public class BytePackedRaster extends SunWritableRaster {
             throw new RasterFormatException("Invalid raster dimension");
         }
 
+        if ((long)minX - sampleModelTranslateX < 0 ||
+            (long)minY - sampleModelTranslateY < 0) {
+
+            throw new RasterFormatException("Incorrect origin/translate: (" +
+                    minX + ", " + minY + ") / (" +
+                    sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+        }
+
         if (scanlineStride < 0 ||
-            scanlineStride > (Integer.MAX_VALUE / height) ||
-            scanlineStride > data.length)
+            scanlineStride > (Integer.MAX_VALUE / height))
         {
             throw new RasterFormatException("Invalid scanline stride");
         }
 
+        if (height > 1 || minY - sampleModelTranslateY > 0) {
+            // buffer should contain at least one scanline
+            if (scanlineStride > data.length) {
+                throw new RasterFormatException("Incorrect scanline stride: "
+                        + scanlineStride);
+            }
+        }
+
         int lastbit = (dataBitOffset
                        + (height-1) * scanlineStride * 8
                        + (width-1) * pixelBitStride
diff --git a/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java b/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java
index a95ce0d015d..f7e8bf37100 100644
--- a/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java
+++ b/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java
@@ -654,15 +654,31 @@ public class IntegerComponentRaster extends SunWritableRaster {
                                             ") must be >= 0");
         }
 
+        if ((long)minX - sampleModelTranslateX < 0 ||
+            (long)minY - sampleModelTranslateY < 0) {
+
+            throw new RasterFormatException("Incorrect origin/translate: (" +
+                    minX + ", " + minY + ") / (" +
+                    sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+        }
+
         // we can be sure that width and height are greater than 0
         if (scanlineStride < 0 ||
-            scanlineStride > (Integer.MAX_VALUE / height) ||
-            scanlineStride > data.length)
+            scanlineStride > (Integer.MAX_VALUE / height))
         {
             // integer overflow
             throw new RasterFormatException("Incorrect scanline stride: "
                     + scanlineStride);
         }
+
+        if (height > 1 || minY - sampleModelTranslateY > 0) {
+            // buffer should contain at least one scanline
+            if (scanlineStride > data.length) {
+                throw new RasterFormatException("Incorrect scanline stride: "
+                        + scanlineStride);
+            }
+        }
+
         int lastScanOffset = (height - 1) * scanlineStride;
 
         if (pixelStride < 0 ||
diff --git a/jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java b/jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java
index 45ef9eb21f3..ccf7740ad53 100644
--- a/jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java
+++ b/jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java
@@ -754,10 +754,21 @@ public class ShortBandedRaster extends SunWritableRaster {
                     + scanlineStride);
         }
 
-        for (int i = 0; i < data.length; i++) {
-            if (scanlineStride > data[i].length) {
-                throw new RasterFormatException("Incorrect scanline stride: "
-                    + scanlineStride);
+        if ((long)minX - sampleModelTranslateX < 0 ||
+            (long)minY - sampleModelTranslateY < 0) {
+
+            throw new RasterFormatException("Incorrect origin/translate: (" +
+                    minX + ", " + minY + ") / (" +
+                    sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+        }
+
+        if (height > 1 || minY - sampleModelTranslateY > 0) {
+            // buffer should contain at least one scanline
+            for (int i = 0; i < data.length; i++) {
+                if (scanlineStride > data[i].length) {
+                    throw new RasterFormatException("Incorrect scanline stride: "
+                        + scanlineStride);
+                }
             }
         }
 
diff --git a/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java b/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
index 53f3ff3e3e6..14ffe5539cf 100644
--- a/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
+++ b/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java
@@ -819,15 +819,31 @@ public class ShortComponentRaster extends SunWritableRaster {
             }
         }
 
+        if ((long)minX - sampleModelTranslateX < 0 ||
+            (long)minY - sampleModelTranslateY < 0) {
+
+            throw new RasterFormatException("Incorrect origin/translate: (" +
+                    minX + ", " + minY + ") / (" +
+                    sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+        }
+
         // we can be sure that width and height are greater than 0
         if (scanlineStride < 0 ||
-            scanlineStride > (Integer.MAX_VALUE / height) ||
-            scanlineStride > data.length)
+            scanlineStride > (Integer.MAX_VALUE / height))
         {
             // integer overflow
             throw new RasterFormatException("Incorrect scanline stride: "
                     + scanlineStride);
         }
+
+        if (height > 1 || minY - sampleModelTranslateY > 0) {
+            // buffer should contain at least one scanline
+            if (scanlineStride > data.length) {
+                throw new RasterFormatException("Incorrect scanline stride: "
+                        + scanlineStride);
+            }
+        }
+
         int lastScanOffset = (height - 1) * scanlineStride;
 
         if (pixelStride < 0 ||
diff --git a/jdk/test/sun/awt/image/bug8038000.java b/jdk/test/sun/awt/image/bug8038000.java
new file mode 100644
index 00000000000..2bfdc27d2b7
--- /dev/null
+++ b/jdk/test/sun/awt/image/bug8038000.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     8038000
+ *
+ * @summary Verifies that we could create different type of Rasters with height 1
+ * and strideline which exceeds raster width.
+ * Also checks that a set of RasterOp work correctly with such kind of Rasters.
+ *
+ * @run     main bug8038000
+ */
+
+import java.awt.*;
+import java.awt.color.ColorSpace;
+import java.awt.geom.AffineTransform;
+import java.awt.image.*;
+import java.util.Arrays;
+
+public class bug8038000 {
+
+    public static void main(String[] args) throws Exception {
+        new bug8038000().checkOps();
+
+        // No exceptions - Passed
+    }
+
+    private void checkOps() throws Exception {
+
+        RasterOp[] ops = new RasterOp[] {
+                new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                        ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), null),
+                new AffineTransformOp(AffineTransform.getScaleInstance(1, 1.1), null)
+        };
+
+
+        for (RasterOp op: ops) {
+            // Banded rasters
+            checkOp(Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 10, 1, 10,
+                            new int[] {0, 1, 2}, new int[]{2,1,0}, null),
+                    Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 10, 1, 1001,
+                            new int[] {0, 1, 2}, new int[]{2,1,0}, null), op);
+            checkOp(Raster.createBandedRaster(DataBuffer.TYPE_USHORT, 10, 1, 10,
+                    new int[] {0, 1, 2}, new int[]{2,1,0}, null),
+                    Raster.createBandedRaster(DataBuffer.TYPE_USHORT, 10, 1, 1001,
+                            new int[] {0, 1, 2}, new int[]{2,1,0}, null), op);
+            checkOp(Raster.createBandedRaster(DataBuffer.TYPE_INT, 10, 1, 10,
+                    new int[] {0, 1, 2}, new int[]{2,1,0}, null),
+                    Raster.createBandedRaster(DataBuffer.TYPE_INT, 10, 1, 1001,
+                            new int[] {0, 1, 2}, new int[]{2,1,0}, null), op);
+
+            // Interleaved rasters
+            checkOp(Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
+                            10, 1, 30, 3, new int[]{0, 1, 2}, null),
+                    Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
+                            10, 1, 1001, 3, new int[]{0, 1, 2}, null),
+                    op);
+
+            checkOp(Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT,
+                            10, 1, 30, 3, new int[]{0, 1, 2}, null),
+                    Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT,
+                            10, 1, 1001, 3, new int[]{0, 1, 2}, null),
+                    op);
+
+            // Packed rasters
+            checkOp(Raster.createPackedRaster(new DataBufferByte(10), 10, 1, 10,
+                            new int[] {0x01, 0x02, 0x04}, null),
+                    Raster.createPackedRaster(new DataBufferByte(10), 10, 1, 2000,
+                            new int[] {0x01, 0x02, 0x04}, null),
+                    op);
+            checkOp(Raster.createPackedRaster(new DataBufferInt(10), 10, 1, 10,
+                        new int[] {0xff0000, 0x00ff00, 0x0000ff}, null),
+                    Raster.createPackedRaster(new DataBufferInt(10), 10, 1, 20,
+                            new int[] {0xff0000, 0x00ff00, 0x0000ff}, null),
+                    op);
+
+        }
+    }
+
+    /**
+     *  Takes two identical rasters (identical with the exception of scanline stride)
+     *  fills their pixels with identical data, applies the RasterOp to both rasters
+     *  and checks that the result is the same
+     */
+    private void checkOp(WritableRaster wr1, WritableRaster wr2, RasterOp op) {
+        System.out.println("Checking " + op + " with rasters: \n    " + wr1 +
+                "\n    " + wr2);
+        try {
+            WritableRaster r1 = op.filter(fillRaster(wr1), null);
+            WritableRaster r2 = op.filter(fillRaster(wr2), null);
+            compareRasters(r1, r2);
+        } catch (ImagingOpException e) {
+            System.out.println("    Skip: Op is not supported: " + e);
+        }
+    }
+
+    private WritableRaster fillRaster(WritableRaster wr) {
+        int c = 0;
+        for(int x = wr.getMinX(); x < wr.getMinX() + wr.getWidth(); x++) {
+            for(int y = wr.getMinY(); y < wr.getMinY() + wr.getHeight(); y++) {
+                for (int b = 0; b < wr.getNumBands(); b++) {
+                    wr.setSample(x, y, b, c++);
+                }
+            }
+        }
+        return wr;
+    }
+
+    private void compareRasters(Raster r1, Raster r2) {
+        Rectangle bounds = r1.getBounds();
+        if (!bounds.equals(r2.getBounds())) {
+            throw new RuntimeException("Bounds differ.");
+        }
+
+        if (r1.getNumBands() != r2.getNumBands()) {
+            throw new RuntimeException("Bands differ.");
+        }
+
+        int[] b1 = new int[r1.getNumBands()];
+        int[] b2 = new int[r1.getNumBands()];
+
+        for (int x = (int) bounds.getX(); x < bounds.getMaxX(); x++) {
+            for (int y = (int) bounds.getY(); y < bounds.getMaxY(); y++) {
+                r1.getPixel(x,y, b1);
+                r2.getPixel(x,y, b2);
+                if (!Arrays.equals(b1, b2)) {
+                    throw new RuntimeException("Pixels differ.");
+                }
+            }
+        }
+    }
+}
-- 
GitLab


From ba597e32a7902750b50acb4ce34505e3862fcd15 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Mon, 19 May 2014 10:03:58 -0700
Subject: [PATCH 005/192] 8042871: Fix raw and unchecked warnings in sun.audio

Reviewed-by: serb
---
 .../share/classes/sun/audio/AudioDevice.java  | 20 +++++++------------
 .../share/classes/sun/audio/AudioPlayer.java  | 12 +++++------
 .../sun/audio/AudioStreamSequence.java        | 11 +++-------
 3 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/jdk/src/share/classes/sun/audio/AudioDevice.java b/jdk/src/share/classes/sun/audio/AudioDevice.java
index 05c180748f0..6e0804d8aad 100644
--- a/jdk/src/share/classes/sun/audio/AudioDevice.java
+++ b/jdk/src/share/classes/sun/audio/AudioDevice.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -58,10 +58,7 @@ public final class AudioDevice {
 
     private boolean DEBUG = false  /*true*/ ;
 
-    /** Hashtable of audio clips / input streams. */
-    private Hashtable clipStreams;
-
-    private Vector infos;
+    private Vector<Info> infos;
 
     /** Are we currently playing audio? */
     private boolean playing = false;
@@ -81,9 +78,7 @@ public final class AudioDevice {
      * Create an AudioDevice instance.
      */
     private AudioDevice() {
-
-        clipStreams = new Hashtable();
-        infos = new Vector();
+        infos = new Vector<>();
     }
 
 
@@ -161,7 +156,7 @@ public final class AudioDevice {
 
         // is this already playing?  if so, then just return
         for(int i=0; i<infos.size(); i++) {
-            info = (AudioDevice.Info)infos.elementAt(i);
+            info = infos.elementAt(i);
             if( info.in == in ) {
 
                 return;
@@ -290,7 +285,7 @@ public final class AudioDevice {
 
         for(int i=0; i<infos.size(); i++) {
 
-            info = (AudioDevice.Info)infos.elementAt(i);
+            info = infos.elementAt(i);
 
             if( info.in == in ) {
 
@@ -355,7 +350,7 @@ public final class AudioDevice {
 
         for(int i=0; i<infos.size(); i++) {
 
-            info = (AudioDevice.Info)infos.elementAt(i);
+            info = infos.elementAt(i);
 
             if( info.sequencer != null ) {
 
@@ -375,8 +370,7 @@ public final class AudioDevice {
             System.err.println("Audio Device: Streams all closed.");
         }
         // Empty the hash table.
-        clipStreams = new Hashtable();
-        infos = new Vector();
+        infos = new Vector<>();
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/audio/AudioPlayer.java b/jdk/src/share/classes/sun/audio/AudioPlayer.java
index f6e9a30e9e8..58ae9105d4c 100644
--- a/jdk/src/share/classes/sun/audio/AudioPlayer.java
+++ b/jdk/src/share/classes/sun/audio/AudioPlayer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -92,18 +92,16 @@ public final class AudioPlayer extends Thread {
         private static AudioPlayer getAudioPlayer() {
 
             if(DEBUG) { System.out.println("> AudioPlayer.getAudioPlayer()"); }
-            AudioPlayer audioPlayer;
-            PrivilegedAction action = new PrivilegedAction() {
-                    public Object run() {
-                        Thread t = new AudioPlayer();
+            PrivilegedAction<AudioPlayer> action = new PrivilegedAction<AudioPlayer>() {
+                    public AudioPlayer run() {
+                        AudioPlayer t = new AudioPlayer();
                         t.setPriority(MAX_PRIORITY);
                         t.setDaemon(true);
                         t.start();
                         return t;
                     }
                 };
-            audioPlayer = (AudioPlayer) AccessController.doPrivileged(action);
-            return audioPlayer;
+            return  AccessController.doPrivileged(action);
         }
 
         /**
diff --git a/jdk/src/share/classes/sun/audio/AudioStreamSequence.java b/jdk/src/share/classes/sun/audio/AudioStreamSequence.java
index f948070c1ce..178764c1c3d 100644
--- a/jdk/src/share/classes/sun/audio/AudioStreamSequence.java
+++ b/jdk/src/share/classes/sun/audio/AudioStreamSequence.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -44,16 +44,11 @@ import java.util.Enumeration;
  * @author Arthur van Hoff
  */
 public final class AudioStreamSequence extends SequenceInputStream {
-
-        Enumeration e;
-        InputStream in;
-
         /**
          * Create an AudioStreamSequence given an
          * enumeration of streams.
          */
-        public AudioStreamSequence(Enumeration e) {
+        public AudioStreamSequence(Enumeration<? extends InputStream> e) {
             super(e);
         }
-
-    }
+}
-- 
GitLab


From bf464ca61b68443c9c95b0302eb0af3098c4bf76 Mon Sep 17 00:00:00 2001
From: David DeHaven <david.dehaven@oracle.com>
Date: Mon, 19 May 2014 23:21:39 +0400
Subject: [PATCH 006/192] 8026385: [macosx] (awt) setjmp/longjmp changes the
 process signal mask on OS X

Use _setjmp/_longjmp instead

Reviewed-by: prr, anthony
---
 jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c       | 6 ++++++
 jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c       | 6 ++++++
 .../share/native/sun/awt/splashscreen/splashscreen_jpeg.c   | 6 ++++++
 .../share/native/sun/awt/splashscreen/splashscreen_png.c    | 5 +++++
 4 files changed, 23 insertions(+)

diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
index f108dde9f8b..5f7a0364866 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -56,6 +56,12 @@
 #undef MAX
 #define MAX(a,b)        ((a) > (b) ? (a) : (b))
 
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
 /* Cached Java method ids */
 static jmethodID JPEGImageReader_readInputDataID;
 static jmethodID JPEGImageReader_skipInputBytesID;
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
index ba8405c86c3..37b743a0339 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c
@@ -47,6 +47,12 @@
 #include <jpeglib.h>
 #include "jerror.h"
 
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
 /* The method IDs we cache. Note that the last two belongs to the
  * java.io.InputStream class.
  */
diff --git a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
index 8d41c9207d8..e773fd4ee39 100644
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c
@@ -30,6 +30,12 @@
 
 #include <setjmp.h>
 
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
 /* stream input handling */
 
 typedef struct
diff --git a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
index ed6f012d950..aeddf868082 100644
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
@@ -71,7 +71,12 @@ SplashDecodePng(Splash * splash, png_rw_ptr read_func, void *io_ptr)
         goto done;
     }
 
+#ifdef __APPLE__
+    /* use setjmp/longjmp versions that do not save/restore the signal mask */
+    if (_setjmp(png_set_longjmp_fn(png_ptr, _longjmp, sizeof(jmp_buf)))) {
+#else
     if (setjmp(png_jmpbuf(png_ptr))) {
+#endif
         goto done;
     }
 
-- 
GitLab


From 17612e8b46823f984eb204d26b36863abfe99031 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Tue, 20 May 2014 09:36:22 -0700
Subject: [PATCH 007/192] 8042864: Fix raw and unchecked warnings in
 javax.print

Reviewed-by: prr, henryjen
---
 .../javax/print/AttributeException.java       |  2 +-
 .../share/classes/javax/print/DocFlavor.java  |  3 +-
 .../share/classes/javax/print/MimeType.java   | 26 +++----
 .../javax/print/PrintServiceLookup.java       | 78 +++++++++----------
 .../share/classes/javax/print/ServiceUI.java  |  8 +-
 .../share/classes/javax/print/SimpleDoc.java  |  2 +-
 .../print/StreamPrintServiceFactory.java      | 30 ++++---
 .../attribute/AttributeSetUtilities.java      |  2 +-
 .../print/attribute/HashAttributeSet.java     | 13 ++--
 .../print/attribute/SetOfIntegerSyntax.java   | 14 ++--
 .../standard/DialogTypeSelection.java         |  3 +-
 .../print/attribute/standard/MediaSize.java   |  8 +-
 .../standard/PrinterStateReasons.java         | 26 ++++---
 13 files changed, 106 insertions(+), 109 deletions(-)

diff --git a/jdk/src/share/classes/javax/print/AttributeException.java b/jdk/src/share/classes/javax/print/AttributeException.java
index f941e8109f3..136d3376810 100644
--- a/jdk/src/share/classes/javax/print/AttributeException.java
+++ b/jdk/src/share/classes/javax/print/AttributeException.java
@@ -52,7 +52,7 @@ public interface AttributeException {
      *
      * @return unsupported attribute classes
      */
-    public Class[] getUnsupportedAttributes();
+    public Class<?>[] getUnsupportedAttributes();
 
     /**
      * Returns the array of printing attributes for which the Print Service
diff --git a/jdk/src/share/classes/javax/print/DocFlavor.java b/jdk/src/share/classes/javax/print/DocFlavor.java
index d016cb7edb8..eac9d38954d 100644
--- a/jdk/src/share/classes/javax/print/DocFlavor.java
+++ b/jdk/src/share/classes/javax/print/DocFlavor.java
@@ -545,8 +545,7 @@ public class DocFlavor implements Serializable, Cloneable {
      * @exception NullPointerException if paramName is null.
      */
     public String getParameter(String paramName) {
-        return
-            (String)myMimeType.getParameterMap().get(paramName.toLowerCase());
+        return myMimeType.getParameterMap().get(paramName.toLowerCase());
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/print/MimeType.java b/jdk/src/share/classes/javax/print/MimeType.java
index 14251b59bda..8fe5eaf3366 100644
--- a/jdk/src/share/classes/javax/print/MimeType.java
+++ b/jdk/src/share/classes/javax/print/MimeType.java
@@ -117,18 +117,18 @@ class MimeType implements Serializable, Cloneable {
     /**
      * Parameter map entry.
      */
-    private class ParameterMapEntry implements Map.Entry {
+    private class ParameterMapEntry implements Map.Entry<String, String> {
         private int myIndex;
         public ParameterMapEntry(int theIndex) {
             myIndex = theIndex;
         }
-        public Object getKey(){
+        public String getKey(){
             return myPieces[myIndex];
         }
-        public Object getValue(){
+        public String getValue(){
             return myPieces[myIndex+1];
         }
-        public Object setValue (Object value) {
+        public String setValue (String value) {
             throw new UnsupportedOperationException();
         }
         public boolean equals(Object o) {
@@ -145,12 +145,12 @@ class MimeType implements Serializable, Cloneable {
     /**
      * Parameter map entry set iterator.
      */
-    private class ParameterMapEntrySetIterator implements Iterator {
+    private class ParameterMapEntrySetIterator implements Iterator<Map.Entry<String, String>> {
         private int myIndex = 2;
         public boolean hasNext() {
             return myIndex < myPieces.length;
         }
-        public Object next() {
+        public Map.Entry<String, String> next() {
             if (hasNext()) {
                 ParameterMapEntry result = new ParameterMapEntry (myIndex);
                 myIndex += 2;
@@ -167,8 +167,8 @@ class MimeType implements Serializable, Cloneable {
     /**
      * Parameter map entry set.
      */
-    private class ParameterMapEntrySet extends AbstractSet {
-        public Iterator iterator() {
+    private class ParameterMapEntrySet extends AbstractSet<Map.Entry<String, String>> {
+        public Iterator<Map.Entry<String, String>> iterator() {
             return new ParameterMapEntrySetIterator();
         }
         public int size() {
@@ -179,8 +179,8 @@ class MimeType implements Serializable, Cloneable {
     /**
      * Parameter map.
      */
-    private class ParameterMap extends AbstractMap {
-        public Set entrySet() {
+    private class ParameterMap extends AbstractMap<String, String> {
+        public Set<Map.Entry<String, String>> entrySet() {
             if (myEntrySet == null) {
                 myEntrySet = new ParameterMapEntrySet();
             }
@@ -234,7 +234,7 @@ class MimeType implements Serializable, Cloneable {
      *
      * @return  Parameter map for this MIME type object.
      */
-    public Map getParameterMap() {
+    public Map<String, String> getParameterMap() {
         if (myParameterMap == null) {
             myParameterMap = new ParameterMap();
         }
@@ -548,7 +548,7 @@ class MimeType implements Serializable, Cloneable {
         }
         LexicalAnalyzer theLexer = new LexicalAnalyzer (s);
         int theLexemeType;
-        Vector thePieces = new Vector();
+        Vector<String> thePieces = new Vector<>();
         boolean mediaTypeIsText = false;
         boolean parameterNameIsCharset = false;
 
@@ -623,7 +623,7 @@ class MimeType implements Serializable, Cloneable {
 
         // Save the pieces. Parameters are not in ascending order yet.
         int n = thePieces.size();
-        myPieces = (String[]) thePieces.toArray (new String [n]);
+        myPieces = thePieces.toArray (new String [n]);
 
         // Sort the parameters into ascending order using an insertion sort.
         int i, j;
diff --git a/jdk/src/share/classes/javax/print/PrintServiceLookup.java b/jdk/src/share/classes/javax/print/PrintServiceLookup.java
index a466a8a4b38..aece5d1205a 100644
--- a/jdk/src/share/classes/javax/print/PrintServiceLookup.java
+++ b/jdk/src/share/classes/javax/print/PrintServiceLookup.java
@@ -69,8 +69,8 @@ import java.util.ServiceConfigurationError;
 public abstract class PrintServiceLookup {
 
     static class Services {
-        private ArrayList listOfLookupServices = null;
-        private ArrayList registeredServices = null;
+        private ArrayList<PrintServiceLookup> listOfLookupServices = null;
+        private ArrayList<PrintService> registeredServices = null;
     }
 
     private static Services getServicesForContext() {
@@ -83,23 +83,23 @@ public abstract class PrintServiceLookup {
         return services;
     }
 
-    private static ArrayList getListOfLookupServices() {
+    private static ArrayList<PrintServiceLookup> getListOfLookupServices() {
         return getServicesForContext().listOfLookupServices;
     }
 
-    private static ArrayList initListOfLookupServices() {
-        ArrayList listOfLookupServices = new ArrayList();
+    private static ArrayList<PrintServiceLookup> initListOfLookupServices() {
+        ArrayList<PrintServiceLookup> listOfLookupServices = new ArrayList<>();
         getServicesForContext().listOfLookupServices = listOfLookupServices;
         return listOfLookupServices;
     }
 
 
-    private static ArrayList getRegisteredServices() {
+    private static ArrayList<PrintService> getRegisteredServices() {
         return getServicesForContext().registeredServices;
     }
 
-    private static ArrayList initRegisteredServices() {
-        ArrayList registeredServices = new ArrayList();
+    private static ArrayList<PrintService> initRegisteredServices() {
+        ArrayList<PrintService> registeredServices = new ArrayList<>();
         getServicesForContext().registeredServices = registeredServices;
         return registeredServices;
     }
@@ -120,8 +120,8 @@ public abstract class PrintServiceLookup {
     public static final PrintService[]
         lookupPrintServices(DocFlavor flavor,
                             AttributeSet attributes) {
-        ArrayList list = getServices(flavor, attributes);
-        return (PrintService[])(list.toArray(new PrintService[list.size()]));
+        ArrayList<PrintService> list = getServices(flavor, attributes);
+        return list.toArray(new PrintService[list.size()]);
     }
 
 
@@ -148,9 +148,8 @@ public abstract class PrintServiceLookup {
     public static final MultiDocPrintService[]
         lookupMultiDocPrintServices(DocFlavor[] flavors,
                                     AttributeSet attributes) {
-        ArrayList list = getMultiDocServices(flavors, attributes);
-        return (MultiDocPrintService[])
-            list.toArray(new MultiDocPrintService[list.size()]);
+        ArrayList<MultiDocPrintService> list = getMultiDocServices(flavors, attributes);
+        return list.toArray(new MultiDocPrintService[list.size()]);
     }
 
 
@@ -177,10 +176,10 @@ public abstract class PrintServiceLookup {
 
     public static final PrintService lookupDefaultPrintService() {
 
-        Iterator psIterator = getAllLookupServices().iterator();
+        Iterator<PrintServiceLookup> psIterator = getAllLookupServices().iterator();
         while (psIterator.hasNext()) {
             try {
-                PrintServiceLookup lus = (PrintServiceLookup)psIterator.next();
+                PrintServiceLookup lus = psIterator.next();
                 PrintService service = lus.getDefaultPrintService();
                 if (service != null) {
                     return service;
@@ -208,7 +207,8 @@ public abstract class PrintServiceLookup {
      */
     public static boolean registerServiceProvider(PrintServiceLookup sp) {
         synchronized (PrintServiceLookup.class) {
-            Iterator psIterator = getAllLookupServices().iterator();
+            Iterator<PrintServiceLookup> psIterator =
+                getAllLookupServices().iterator();
             while (psIterator.hasNext()) {
                 try {
                     Object lus = psIterator.next();
@@ -249,7 +249,7 @@ public abstract class PrintServiceLookup {
             if (service instanceof StreamPrintService) {
                 return false;
             }
-            ArrayList registeredServices = getRegisteredServices();
+            ArrayList<PrintService> registeredServices = getRegisteredServices();
             if (registeredServices == null) {
                 registeredServices = initRegisteredServices();
             }
@@ -326,9 +326,9 @@ public abstract class PrintServiceLookup {
      */
     public abstract PrintService getDefaultPrintService();
 
-    private static ArrayList getAllLookupServices() {
+    private static ArrayList<PrintServiceLookup> getAllLookupServices() {
         synchronized (PrintServiceLookup.class) {
-            ArrayList listOfLookupServices = getListOfLookupServices();
+            ArrayList<PrintServiceLookup> listOfLookupServices = getListOfLookupServices();
             if (listOfLookupServices != null) {
                 return listOfLookupServices;
             } else {
@@ -336,12 +336,12 @@ public abstract class PrintServiceLookup {
             }
             try {
                 java.security.AccessController.doPrivileged(
-                     new java.security.PrivilegedExceptionAction() {
+                     new java.security.PrivilegedExceptionAction<Object>() {
                         public Object run() {
                             Iterator<PrintServiceLookup> iterator =
                                 ServiceLoader.load(PrintServiceLookup.class).
                                 iterator();
-                            ArrayList los = getListOfLookupServices();
+                            ArrayList<PrintServiceLookup> los = getListOfLookupServices();
                             while (iterator.hasNext()) {
                                 try {
                                     los.add(iterator.next());
@@ -364,14 +364,14 @@ public abstract class PrintServiceLookup {
         }
     }
 
-    private static ArrayList getServices(DocFlavor flavor,
-                                         AttributeSet attributes) {
+    private static ArrayList<PrintService> getServices(DocFlavor flavor,
+                                                       AttributeSet attributes) {
 
-        ArrayList listOfServices = new ArrayList();
-        Iterator psIterator = getAllLookupServices().iterator();
+        ArrayList<PrintService> listOfServices = new ArrayList<>();
+        Iterator<PrintServiceLookup> psIterator = getAllLookupServices().iterator();
         while (psIterator.hasNext()) {
             try {
-                PrintServiceLookup lus = (PrintServiceLookup)psIterator.next();
+                PrintServiceLookup lus = psIterator.next();
                 PrintService[] services=null;
                 if (flavor == null && attributes == null) {
                     try {
@@ -391,7 +391,7 @@ public abstract class PrintServiceLookup {
             }
         }
         /* add any directly registered services */
-        ArrayList registeredServices = null;
+        ArrayList<PrintService> registeredServices = null;
         try {
           SecurityManager security = System.getSecurityManager();
           if (security != null) {
@@ -401,8 +401,7 @@ public abstract class PrintServiceLookup {
         } catch (SecurityException se) {
         }
         if (registeredServices != null) {
-            PrintService[] services = (PrintService[])
-                registeredServices.toArray(
+            PrintService[] services = registeredServices.toArray(
                            new PrintService[registeredServices.size()]);
             for (int i=0; i<services.length; i++) {
                 if (!listOfServices.contains(services[i])) {
@@ -421,15 +420,15 @@ public abstract class PrintServiceLookup {
         return listOfServices;
     }
 
-    private static ArrayList getMultiDocServices(DocFlavor[] flavors,
-                                                 AttributeSet attributes) {
+    private static ArrayList<MultiDocPrintService> getMultiDocServices(DocFlavor[] flavors,
+                                                                       AttributeSet attributes) {
 
 
-        ArrayList listOfServices = new ArrayList();
-        Iterator psIterator = getAllLookupServices().iterator();
+        ArrayList<MultiDocPrintService> listOfServices = new ArrayList<>();
+        Iterator<PrintServiceLookup> psIterator = getAllLookupServices().iterator();
         while (psIterator.hasNext()) {
             try {
-                PrintServiceLookup lus = (PrintServiceLookup)psIterator.next();
+                PrintServiceLookup lus = psIterator.next();
                 MultiDocPrintService[] services  =
                     lus.getMultiDocPrintServices(flavors, attributes);
                 if (services == null) {
@@ -442,7 +441,7 @@ public abstract class PrintServiceLookup {
             }
         }
         /* add any directly registered services */
-        ArrayList registeredServices = null;
+        ArrayList<PrintService> registeredServices = null;
         try {
           SecurityManager security = System.getSecurityManager();
           if (security != null) {
@@ -452,14 +451,13 @@ public abstract class PrintServiceLookup {
         } catch (Exception e) {
         }
         if (registeredServices != null) {
-            PrintService[] services = (PrintService[])
-                registeredServices.toArray(
-                           new PrintService[registeredServices.size()]);
+            PrintService[] services =
+                registeredServices.toArray(new PrintService[registeredServices.size()]);
             for (int i=0; i<services.length; i++) {
                 if (services[i] instanceof MultiDocPrintService &&
                     !listOfServices.contains(services[i])) {
                     if (flavors == null || flavors.length == 0) {
-                        listOfServices.add(services[i]);
+                        listOfServices.add((MultiDocPrintService)services[i]);
                     } else {
                         boolean supported = true;
                         for (int f=0; f<flavors.length; f++) {
@@ -476,7 +474,7 @@ public abstract class PrintServiceLookup {
                             }
                         }
                         if (supported) {
-                            listOfServices.add(services[i]);
+                            listOfServices.add((MultiDocPrintService)services[i]);
                         }
                     }
                 }
diff --git a/jdk/src/share/classes/javax/print/ServiceUI.java b/jdk/src/share/classes/javax/print/ServiceUI.java
index fee1e4529cf..20b23611ed1 100644
--- a/jdk/src/share/classes/javax/print/ServiceUI.java
+++ b/jdk/src/share/classes/javax/print/ServiceUI.java
@@ -228,9 +228,9 @@ public class ServiceUI {
 
         if (dialog.getStatus() == ServiceDialog.APPROVE) {
             PrintRequestAttributeSet newas = dialog.getAttributes();
-            Class dstCategory = Destination.class;
-            Class amCategory = SunAlternateMedia.class;
-            Class fdCategory = Fidelity.class;
+            Class<?> dstCategory = Destination.class;
+            Class<?> amCategory = SunAlternateMedia.class;
+            Class<?> fdCategory = Fidelity.class;
 
             if (attributes.containsKey(dstCategory) &&
                 !newas.containsKey(dstCategory))
@@ -315,7 +315,7 @@ public class ServiceUI {
             Attribute[] usAttrs = asUnsupported.toArray();
 
             for (int i=0; i<usAttrs.length; i++) {
-                Class category = usAttrs[i].getCategory();
+                Class<? extends Attribute> category = usAttrs[i].getCategory();
 
                 if (ps.isAttributeCategorySupported(category)) {
                     Attribute attr =
diff --git a/jdk/src/share/classes/javax/print/SimpleDoc.java b/jdk/src/share/classes/javax/print/SimpleDoc.java
index 8bb812a66f4..3cf0d779086 100644
--- a/jdk/src/share/classes/javax/print/SimpleDoc.java
+++ b/jdk/src/share/classes/javax/print/SimpleDoc.java
@@ -89,7 +89,7 @@ public final class SimpleDoc implements Doc {
            throw new IllegalArgumentException("null argument(s)");
        }
 
-       Class repClass = null;
+       Class<?> repClass = null;
        try {
             String className = flavor.getRepresentationClassName();
             sun.reflect.misc.ReflectUtil.checkPackageAccess(className);
diff --git a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java
index 3199dac2985..dfa91a70fcb 100644
--- a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java
+++ b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java
@@ -59,7 +59,7 @@ import java.util.ServiceConfigurationError;
 public abstract class StreamPrintServiceFactory {
 
     static class Services {
-        private ArrayList listOfFactories = null;
+        private ArrayList<StreamPrintServiceFactory> listOfFactories = null;
     }
 
     private static Services getServices() {
@@ -72,12 +72,12 @@ public abstract class StreamPrintServiceFactory {
         return services;
     }
 
-    private static ArrayList getListOfFactories() {
+    private static ArrayList<StreamPrintServiceFactory> getListOfFactories() {
         return getServices().listOfFactories;
     }
 
-    private static ArrayList initListOfFactories() {
-        ArrayList listOfFactories = new ArrayList();
+    private static ArrayList<StreamPrintServiceFactory> initListOfFactories() {
+        ArrayList<StreamPrintServiceFactory> listOfFactories = new ArrayList<>();
         getServices().listOfFactories = listOfFactories;
         return listOfFactories;
     }
@@ -108,9 +108,8 @@ public abstract class StreamPrintServiceFactory {
          lookupStreamPrintServiceFactories(DocFlavor flavor,
                                            String outputMimeType) {
 
-         ArrayList list = getFactories(flavor, outputMimeType);
-         return (StreamPrintServiceFactory[])
-               (list.toArray(new StreamPrintServiceFactory[list.size()]));
+         ArrayList<StreamPrintServiceFactory> list = getFactories(flavor, outputMimeType);
+         return list.toArray(new StreamPrintServiceFactory[list.size()]);
      }
 
     /** Queries the factory for the document format that is emitted
@@ -162,10 +161,10 @@ public abstract class StreamPrintServiceFactory {
     public abstract StreamPrintService getPrintService(OutputStream out);
 
 
-    private static ArrayList getAllFactories() {
+    private static ArrayList<StreamPrintServiceFactory> getAllFactories() {
         synchronized (StreamPrintServiceFactory.class) {
 
-          ArrayList listOfFactories = getListOfFactories();
+          ArrayList<StreamPrintServiceFactory> listOfFactories = getListOfFactories();
             if (listOfFactories != null) {
                 return listOfFactories;
             } else {
@@ -174,12 +173,12 @@ public abstract class StreamPrintServiceFactory {
 
             try {
                 java.security.AccessController.doPrivileged(
-                     new java.security.PrivilegedExceptionAction() {
+                     new java.security.PrivilegedExceptionAction<Object>() {
                         public Object run() {
                             Iterator<StreamPrintServiceFactory> iterator =
                                 ServiceLoader.load
                                 (StreamPrintServiceFactory.class).iterator();
-                            ArrayList lof = getListOfFactories();
+                            ArrayList<StreamPrintServiceFactory> lof = getListOfFactories();
                             while (iterator.hasNext()) {
                                 try {
                                     lof.add(iterator.next());
@@ -210,17 +209,16 @@ public abstract class StreamPrintServiceFactory {
         return false;
     }
 
-    private static ArrayList getFactories(DocFlavor flavor, String outType) {
+    private static ArrayList<StreamPrintServiceFactory> getFactories(DocFlavor flavor, String outType) {
 
         if (flavor == null && outType == null) {
             return getAllFactories();
         }
 
-        ArrayList list = new ArrayList();
-        Iterator iterator = getAllFactories().iterator();
+        ArrayList<StreamPrintServiceFactory> list = new ArrayList<>();
+        Iterator<StreamPrintServiceFactory> iterator = getAllFactories().iterator();
         while (iterator.hasNext()) {
-            StreamPrintServiceFactory factory =
-                (StreamPrintServiceFactory)iterator.next();
+            StreamPrintServiceFactory factory = iterator.next();
             if ((outType == null ||
                  outType.equalsIgnoreCase(factory.getOutputFormat())) &&
                 (flavor == null ||
diff --git a/jdk/src/share/classes/javax/print/attribute/AttributeSetUtilities.java b/jdk/src/share/classes/javax/print/attribute/AttributeSetUtilities.java
index 42ebc1f512d..2c5896f633f 100644
--- a/jdk/src/share/classes/javax/print/attribute/AttributeSetUtilities.java
+++ b/jdk/src/share/classes/javax/print/attribute/AttributeSetUtilities.java
@@ -523,7 +523,7 @@ public final class AttributeSetUtilities {
     public static Class<?>
         verifyAttributeCategory(Object object, Class<?> interfaceName) {
 
-        Class result = (Class) object;
+        Class<?> result = (Class<?>) object;
         if (interfaceName.isAssignableFrom (result)) {
             return result;
         }
diff --git a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java
index a1995014525..7956794d304 100644
--- a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java
+++ b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java
@@ -48,13 +48,13 @@ public class HashAttributeSet implements AttributeSet, Serializable {
      * or a subinterface thereof.
      * @serial
      */
-    private Class myInterface;
+    private Class<?> myInterface;
 
     /*
      * A HashMap used by the implementation.
      * The serialised form doesn't include this instance variable.
      */
-    private transient HashMap attrMap = new HashMap();
+    private transient HashMap<Class<?>, Attribute> attrMap = new HashMap<>();
 
     /**
      * Write the instance to a stream (ie serialize the object)
@@ -82,7 +82,7 @@ public class HashAttributeSet implements AttributeSet, Serializable {
         throws ClassNotFoundException, IOException {
 
         s.defaultReadObject();
-        attrMap = new HashMap();
+        attrMap = new HashMap<>();
         int count = s.readInt();
         Attribute attr;
         for (int i = 0; i < count; i++) {
@@ -274,10 +274,9 @@ public class HashAttributeSet implements AttributeSet, Serializable {
      *     Attribute Attribute}.
      */
     public Attribute get(Class<?> category) {
-        return (Attribute)
-            attrMap.get(AttributeSetUtilities.
-                        verifyAttributeCategory(category,
-                                                Attribute.class));
+        return attrMap.get(AttributeSetUtilities.
+                           verifyAttributeCategory(category,
+                                                   Attribute.class));
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java
index 344a5941294..67ff40c179c 100644
--- a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java
+++ b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java
@@ -112,7 +112,7 @@ public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
     private static int[][] parse(String members) {
         // Create vector to hold int[] elements, each element being one range
         // parsed out of members.
-        Vector theRanges = new Vector();
+        Vector<int[]> theRanges = new Vector<>();
 
         // Run state machine over members.
         int n = (members == null ? 0 : members.length());
@@ -243,7 +243,7 @@ public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
      * Accumulate the given range (lb .. ub) into the canonical array form
      * into the given vector of int[] objects.
      */
-    private static void accumulate(Vector ranges, int lb,int ub) {
+    private static void accumulate(Vector<int[]> ranges, int lb,int ub) {
         // Make sure range is non-null.
         if (lb <= ub) {
             // Stick range at the back of the vector.
@@ -253,10 +253,10 @@ public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
             // with the existing ranges.
             for (int j = ranges.size()-2; j >= 0; -- j) {
             // Get lower and upper bounds of the two ranges being compared.
-                int[] rangea = (int[]) ranges.elementAt (j);
+                int[] rangea = ranges.elementAt (j);
                 int lba = rangea[0];
                 int uba = rangea[1];
-                int[] rangeb = (int[]) ranges.elementAt (j+1);
+                int[] rangeb = ranges.elementAt (j+1);
                 int lbb = rangeb[0];
                 int ubb = rangeb[1];
 
@@ -293,8 +293,8 @@ public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
     /**
      * Convert the given vector of int[] objects to canonical array form.
      */
-    private static int[][] canonicalArrayForm(Vector ranges) {
-        return (int[][]) ranges.toArray (new int[ranges.size()][]);
+    private static int[][] canonicalArrayForm(Vector<int[]> ranges) {
+        return ranges.toArray (new int[ranges.size()][]);
     }
 
     /**
@@ -323,7 +323,7 @@ public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
     private static int[][] parse(int[][] members) {
         // Create vector to hold int[] elements, each element being one range
         // parsed out of members.
-        Vector ranges = new Vector();
+        Vector<int[]> ranges = new Vector<>();
 
         // Process all integer groups in members.
         int n = (members == null ? 0 : members.length);
diff --git a/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java b/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java
index 0a41fc23830..43cc15ee96a 100644
--- a/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java
+++ b/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java
@@ -26,6 +26,7 @@
 package javax.print.attribute.standard;
 
 import javax.print.attribute.EnumSyntax;
+import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintRequestAttribute;
 
 /**
@@ -110,7 +111,7 @@ public final class DialogTypeSelection extends EnumSyntax
      * @return  Printing attribute class (category), an instance of class
      *          {@link java.lang.Class java.lang.Class}.
      */
-    public final Class getCategory() {
+    public final Class<? extends Attribute> getCategory() {
         return DialogTypeSelection.class;
     }
 
diff --git a/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java b/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java
index e50960e5060..af173a8d6ea 100644
--- a/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java
+++ b/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java
@@ -56,9 +56,9 @@ public class MediaSize extends Size2DSyntax implements Attribute {
 
     private MediaSizeName mediaName;
 
-    private static HashMap mediaMap = new HashMap(100, 10);
+    private static HashMap<MediaSizeName, MediaSize> mediaMap = new HashMap<>(100, 10);
 
-    private static Vector sizeVector = new Vector(100, 10);
+    private static Vector<MediaSize> sizeVector = new Vector<>(100, 10);
 
     /**
      * Construct a new media size attribute from the given floating-point
@@ -174,7 +174,7 @@ public class MediaSize extends Size2DSyntax implements Attribute {
      * with any size.
      */
     public static MediaSize getMediaSizeForName(MediaSizeName media) {
-        return (MediaSize)mediaMap.get(media);
+        return mediaMap.get(media);
     }
 
     /**
@@ -213,7 +213,7 @@ public class MediaSize extends Size2DSyntax implements Attribute {
         float diffy = y;
 
         for (int i=0; i < sizeVector.size() ; i++) {
-            MediaSize mediaSize = (MediaSize)sizeVector.elementAt(i);
+            MediaSize mediaSize = sizeVector.elementAt(i);
             dim = mediaSize.getSize(units);
             if (x == dim[0] && y == dim[1]) {
                 match = mediaSize;
diff --git a/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java b/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java
index de695b78aa0..89b08f311ad 100644
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java
@@ -242,16 +242,18 @@ public final class PrinterStateReasons
         extends AbstractSet<PrinterStateReason>
     {
         private Severity mySeverity;
-        private Set myEntrySet;
 
-        public PrinterStateReasonSet(Severity severity, Set entrySet) {
+        private Set<Map.Entry<PrinterStateReason, Severity>> myEntrySet;
+
+        public PrinterStateReasonSet(Severity severity,
+                                     Set<Map.Entry<PrinterStateReason, Severity>> entrySet) {
             mySeverity = severity;
             myEntrySet = entrySet;
         }
 
         public int size() {
             int result = 0;
-            Iterator iter = iterator();
+            Iterator<PrinterStateReason> iter = iterator();
             while (iter.hasNext()) {
                 iter.next();
                 ++ result;
@@ -259,19 +261,19 @@ public final class PrinterStateReasons
             return result;
         }
 
-        public Iterator iterator() {
+        public Iterator<PrinterStateReason> iterator() {
             return new PrinterStateReasonSetIterator(mySeverity,
                                                      myEntrySet.iterator());
         }
     }
 
-    private class PrinterStateReasonSetIterator implements Iterator {
+    private class PrinterStateReasonSetIterator implements Iterator<PrinterStateReason> {
         private Severity mySeverity;
-        private Iterator myIterator;
-        private Map.Entry myEntry;
+        private Iterator<Map.Entry<PrinterStateReason, Severity>> myIterator;
+        private Map.Entry<PrinterStateReason, Severity> myEntry;
 
         public PrinterStateReasonSetIterator(Severity severity,
-                                             Iterator iterator) {
+                                             Iterator<Map.Entry<PrinterStateReason, Severity>> iterator) {
             mySeverity = severity;
             myIterator = iterator;
             goToNext();
@@ -280,8 +282,8 @@ public final class PrinterStateReasons
         private void goToNext() {
             myEntry = null;
             while (myEntry == null && myIterator.hasNext()) {
-                myEntry = (Map.Entry) myIterator.next();
-                if ((Severity) myEntry.getValue() != mySeverity) {
+                myEntry = myIterator.next();
+                if (myEntry.getValue() != mySeverity) {
                     myEntry = null;
                 }
             }
@@ -291,11 +293,11 @@ public final class PrinterStateReasons
             return myEntry != null;
         }
 
-        public Object next() {
+        public PrinterStateReason next() {
             if (myEntry == null) {
                 throw new NoSuchElementException();
             }
-            Object result = myEntry.getKey();
+            PrinterStateReason result = myEntry.getKey();
             goToNext();
             return result;
         }
-- 
GitLab


From ad5b8ee3f0d1c9ff4b320dc266f80cdae3ce16de Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy <alexsch@openjdk.org>
Date: Wed, 21 May 2014 14:07:06 +0400
Subject: [PATCH 008/192] 8036110: In TextField can only select text visible or
 to the left of the cursor

Reviewed-by: serb, pchelko
---
 .../native/sun/windows/awt_TextField.cpp      |  3 +
 .../SelectionInvisibleTest.java               | 85 +++++++++++++++++++
 2 files changed, 88 insertions(+)
 create mode 100644 jdk/test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java

diff --git a/jdk/src/windows/native/sun/windows/awt_TextField.cpp b/jdk/src/windows/native/sun/windows/awt_TextField.cpp
index c6d3f21ae1d..b37b5c74596 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextField.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_TextField.cpp
@@ -200,7 +200,10 @@ AwtTextField::HandleEvent(MSG *msg, BOOL synthetic)
             si.cbSize = sizeof(si);
             si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
 
+            SendMessage(EM_SHOWSCROLLBAR, SB_HORZ, TRUE);
             VERIFY(::GetScrollInfo(GetHWnd(), SB_HORZ, &si));
+            SendMessage(EM_SHOWSCROLLBAR, SB_HORZ, FALSE);
+
             if (bScrollLeft == TRUE) {
                 si.nPos = si.nPos - si.nPage / 2;
                 si.nPos = max(si.nMin, si.nPos);
diff --git a/jdk/test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java b/jdk/test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java
new file mode 100644
index 00000000000..be451285b97
--- /dev/null
+++ b/jdk/test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextField;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8036110
+ * @author Alexander Scherbatiy
+ * @summary In TextField can only select text visible or to the left
+ * @run main SelectionInvisibleTest
+ */
+
+public class SelectionInvisibleTest {
+
+    private static final String TEXT = "One Two Three Four Five Six Seven Eight Nine ";
+    private static final String LAST_WORD = "Ten";
+
+    public static void main(String[] args) throws Exception {
+
+        Frame frame = new Frame();
+        frame.setSize(300, 200);
+        TextField textField = new TextField(TEXT + LAST_WORD, 30);
+        Panel panel = new Panel(new FlowLayout());
+        panel.add(textField);
+        frame.add(panel);
+        frame.setVisible(true);
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Point point = textField.getLocationOnScreen();
+        int x = point.x + textField.getWidth() / 2;
+        int y = point.y + textField.getHeight() / 2;
+        robot.mouseMove(x, y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        int N = 10;
+        int dx = textField.getWidth() / N;
+        for (int i = 0; i < N; i++) {
+            x += dx;
+            robot.mouseMove(x, y);
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+
+        if (!textField.getSelectedText().endsWith(LAST_WORD)) {
+            throw new RuntimeException("Last word is not selected!");
+        }
+    }
+}
-- 
GitLab


From 74511c3cf51528951366d3292406c38373725c9d Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy <alexsch@openjdk.org>
Date: Wed, 21 May 2014 14:13:17 +0400
Subject: [PATCH 009/192] 8041561: Inconsistent opacity behaviour between
 JCheckBox and JRadioButton

Reviewed-by: malenkov
---
 .../swing/plaf/metal/MetalIconFactory.java    |   6 +-
 .../JRadioButton/8041561/bug8041561.java      | 103 ++++++++++++++++++
 2 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java

diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java
index e74882523d0..4e0b3535208 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java
@@ -1251,8 +1251,10 @@ public class MetalIconFactory implements Serializable {
             g.translate(x, y);
 
             // fill interior
-            g.setColor(interiorColor);
-            g.fillRect(2,2, 9,9);
+            if (c.isOpaque()) {
+                g.setColor(interiorColor);
+                g.fillRect(2, 2, 9, 9);
+            }
 
             // draw Dark Circle (start at top, go clockwise)
             g.setColor(darkCircle);
diff --git a/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java b/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java
new file mode 100644
index 00000000000..79f737ba248
--- /dev/null
+++ b/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8041561
+ * @author Alexander Scherbatiy
+ * @summary Inconsistent opacity behaviour between JCheckBox and JRadioButton
+ * @run main bug8041561
+ */
+public class bug8041561 {
+
+    private static JRadioButton radioButton;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+                    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+                    UIManager.setLookAndFeel(new MetalLookAndFeel());
+                    createAndShowGUI();
+                } catch (UnsupportedLookAndFeelException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Thread.sleep(500);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+                    Point point = radioButton.getLocationOnScreen();
+                    int x = (int) point.getX() + radioButton.getWidth() / 2;
+                    int y = (int) point.getY() + radioButton.getHeight() / 2;
+
+                    Robot robot = new Robot();
+                    Color color = robot.getPixelColor(x, y);
+                    if (!Color.BLUE.equals(color)) {
+                        throw new RuntimeException("JRadioButton is opaque");
+                    }
+                } catch (AWTException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+
+    }
+
+    private static void createAndShowGUI() {
+        JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setBackground(Color.BLUE);
+        radioButton = new JRadioButton();
+        radioButton.setOpaque(false);
+        JPanel panel = new JPanel();
+        panel.setBackground(Color.BLUE);
+        panel.add(radioButton);
+        frame.getContentPane().add(panel);
+        frame.pack();
+        frame.setVisible(true);
+    }
+}
-- 
GitLab


From dd0ba6cac3245153787ddeadd2e931416892b504 Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Wed, 21 May 2014 16:48:04 +0400
Subject: [PATCH 010/192] 8043456: KSS:
 javax.swing.plaf.basic.BasicInternalFrameTitlePane#postClosingEvent

Reviewed-by: alexsch, serb
---
 .../plaf/basic/BasicInternalFrameTitlePane.java      | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index 33b38623425..3c4338fdc76 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -380,15 +380,11 @@ public class BasicInternalFrameTitlePane extends JComponent
         InternalFrameEvent e = new InternalFrameEvent(
             frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
         // Try posting event, unless there's a SecurityManager.
-        if (JInternalFrame.class.getClassLoader() == null) {
-            try {
-                Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
-                return;
-            } catch (SecurityException se) {
-                // Use dispatchEvent instead.
-            }
+        try {
+            Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
+        } catch (SecurityException se) {
+            frame.dispatchEvent(e);
         }
-        frame.dispatchEvent(e);
     }
 
 
-- 
GitLab


From a4fbee71455e8f06be1288a3886b17796ccd1f39 Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Wed, 21 May 2014 10:50:14 -0700
Subject: [PATCH 011/192] 8016451: Scary messages emitted by
 build.tools.generatenimbus.PainterGenerator during build

Reviewed-by: alexsch, anthony
---
 .../generatenimbus/PainterGenerator.java      | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/jdk/make/src/classes/build/tools/generatenimbus/PainterGenerator.java b/jdk/make/src/classes/build/tools/generatenimbus/PainterGenerator.java
index 07b016d75ff..265ab3c9e65 100644
--- a/jdk/make/src/classes/build/tools/generatenimbus/PainterGenerator.java
+++ b/jdk/make/src/classes/build/tools/generatenimbus/PainterGenerator.java
@@ -57,6 +57,9 @@ import java.util.Map;
  * @author  Jasper Potts
  */
 public class PainterGenerator {
+
+    private static final boolean debug = false;
+
     //a handful of counters, incremented whenever the associated object type is encounted.
     //These counters form the basis of the field and method suffixes.
     //These are all 1 based, because I felt like it :-)
@@ -384,16 +387,24 @@ public class PainterGenerator {
         }
 
         if (Float.isNaN(r)) {
-            System.err.println("[Error] Encountered NaN: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            if (debug) {
+                System.err.println("[Error] Encountered NaN: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            }
             return 0;
         } else if (Float.isInfinite(r)) {
-            System.err.println("[Error] Encountered Infinity: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            if (debug) {
+                System.err.println("[Error] Encountered Infinity: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            }
             return 0;
         } else if (r < 0) {
-            System.err.println("[Error] encoded value was less than 0: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            if (debug) {
+                System.err.println("[Error] encoded value was less than 0: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            }
             return 0;
         } else if (r > 3) {
-            System.err.println("[Error] encoded value was greater than 3: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            if (debug) {
+                System.err.println("[Error] encoded value was greater than 3: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+            }
             return 3;
         } else {
             return r;
-- 
GitLab


From ae470d197084728aec6db9baa739729761d0f3e3 Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Wed, 21 May 2014 11:12:18 -0700
Subject: [PATCH 012/192] 8039394: Compiler warnings about C++ exceptions in
 windows printing code

Reviewed-by: bae, jgodinez
---
 .../native/sun/windows/awt_PrintJob.cpp       | 94 +++++++++----------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
index b9d818e0cfd..1b59e71203c 100644
--- a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
@@ -2541,8 +2541,21 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WPrinterJob_textOut
      * rounded advances will drift away from the true advance.
      */
     if (glyphPos != NULL && strLen > 0) {
-         xadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, strLen, sizeof(int));
-         xyadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, strLen, sizeof(int) * 2);
+        try {
+            xadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc,
+                    strLen, sizeof(int));
+            xyadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, strLen,
+                    sizeof(int) * 2);
+        } catch (std::bad_alloc&) {
+            if (xadvances != NULL) {
+                free(xadvances);
+                xadvances = NULL;
+            }
+            if (xyadvances != NULL) {
+                free(xyadvances);
+                xyadvances = NULL;
+            }
+        }
     }
     if (xadvances != NULL && xyadvances != NULL) {
         int *inxAdvances = xadvances;
@@ -2752,8 +2765,12 @@ static jbyte* reverseDIB(jbyte* imageBits, long srcWidth, long srcHeight,
     if ((imgWidthByteSz % sizeof(DWORD)) != 0)
         padBytes = sizeof(DWORD) - (imgWidthByteSz % sizeof(DWORD));
 
-    jbyte* alignedImage = (jbyte*) SAFE_SIZE_ARRAY_ALLOC(safe_Malloc,
+    jbyte* alignedImage = NULL;
+    try {
+        alignedImage = (jbyte*) SAFE_SIZE_ARRAY_ALLOC(safe_Malloc,
             imgWidthByteSz+padBytes, ROUND_TO_LONG(srcHeight));
+    } catch (std::bad_alloc&) {
+    }
     long newImgSize = (imgWidthByteSz+padBytes) * ROUND_TO_LONG(srcHeight);
 
     if (alignedImage != NULL) {
@@ -3355,36 +3372,6 @@ static void pageFormatToSetup(JNIEnv *env, jobject job,
     // Set page size here.
 }
 
-
-/**
- * Return an array of POINTS describing the paper sizes supported
- * by the driver identified by 'deviceName' and 'portName'.
- * If there is an error, then NULL is returned.
- */
-static POINT *getPaperSizeList(LPCTSTR deviceName, LPCTSTR portName) {
-    DWORD numPaperSizes;
-    POINT *paperSizes = NULL;
-
-    SAVE_CONTROLWORD
-    numPaperSizes = DeviceCapabilities(deviceName, portName,
-                                       DC_PAPERSIZE, NULL, NULL);
-
-    if (numPaperSizes > 0) {
-        paperSizes = (POINT *)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(*paperSizes), numPaperSizes);
-
-        DWORD result = DeviceCapabilities(deviceName, portName,
-                                          DC_PAPERSIZE, (LPTSTR) paperSizes,
-                                          NULL);
-        if (result == -1) {
-            free((char *) paperSizes);
-            paperSizes = NULL;
-        }
-    }
-    RESTORE_CONTROLWORD
-
-    return paperSizes;
-}
-
 static WORD getOrientationFromDevMode2(HGLOBAL hDevMode) {
 
     WORD orient = DMORIENT_PORTRAIT;
@@ -3989,20 +3976,33 @@ static void matchPaperSize(HDC printDC, HGLOBAL hDevMode, HGLOBAL hDevNames,
     numPaperSizes = (int)DeviceCapabilities(printer, port, DC_PAPERSIZE,
                                             NULL, NULL);
     if (numPaperSizes > 0) {
-        papers = (WORD*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(WORD), numPaperSizes);
-        paperSizes = (POINT *)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(*paperSizes), numPaperSizes);
-
-        DWORD result1 = DeviceCapabilities(printer, port,
-                                           DC_PAPERS, (LPTSTR) papers, NULL);
-        DWORD result2 = DeviceCapabilities(printer, port,
-                                           DC_PAPERSIZE, (LPTSTR) paperSizes,
-                                           NULL);
-
-        if (result1 == -1 || result2 == -1 ) {
-            free((char *) papers);
-            papers = NULL;
-            free((char *) paperSizes);
-            paperSizes = NULL;
+        try {
+            papers = (WORD*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(WORD), numPaperSizes);
+            paperSizes = (POINT *)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(*paperSizes), numPaperSizes);
+        } catch (std::bad_alloc&) {
+            if (papers != NULL) {
+                free((char*)papers);
+                papers = NULL;
+            }
+            if (paperSizes != NULL) {
+               free((char *)paperSizes);
+               paperSizes = NULL;
+            }
+        }
+
+        if (papers != NULL && paperSizes != NULL) {
+             DWORD result1 = DeviceCapabilities(printer, port,
+                                                DC_PAPERS, (LPTSTR) papers, NULL);
+            DWORD result2 = DeviceCapabilities(printer, port,
+                                               DC_PAPERSIZE, (LPTSTR) paperSizes,
+                                               NULL);
+
+            if (result1 == -1 || result2 == -1 ) {
+                free((char *) papers);
+                papers = NULL;
+                free((char *) paperSizes);
+                paperSizes = NULL;
+            }
         }
     }
 
-- 
GitLab


From 1d4a340a2ba621d78233a2298545bd897fd94d01 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Thu, 22 May 2014 15:46:50 +0400
Subject: [PATCH 013/192] 8043646: libosxapp.dylib fails to build on Mac OS
 10.9 with clang

Reviewed-by: anthony, serb
---
 jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m
index c7dd0b78726..7deb34d0baa 100644
--- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m
+++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m
@@ -36,7 +36,7 @@ static JNIEnv *appKitEnv = NULL;
 static jobject appkitThreadGroup = NULL;
 static BOOL awtEmbedded = NO;
 
-inline void attachCurrentThread(void** env) {
+static inline void attachCurrentThread(void** env) {
     if ([NSThread isMainThread]) {
         JavaVMAttachArgs args;
         args.version = JNI_VERSION_1_4;
-- 
GitLab


From 57d0476f97b58d3afb3cb478501258475ffe6d8f Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Thu, 22 May 2014 21:05:30 +0400
Subject: [PATCH 014/192] 8043627: NPE in SynthContext in plugin mode

Reviewed-by: alexsch, serb, pchelko
---
 .../javax/swing/plaf/synth/SynthButtonUI.java |  4 +-
 .../swing/plaf/synth/SynthColorChooserUI.java |  3 +-
 .../swing/plaf/synth/SynthComboBoxUI.java     |  3 +-
 .../javax/swing/plaf/synth/SynthContext.java  | 47 ++++---------------
 .../swing/plaf/synth/SynthDesktopIconUI.java  |  4 +-
 .../swing/plaf/synth/SynthDesktopPaneUI.java  |  3 +-
 .../swing/plaf/synth/SynthEditorPaneUI.java   |  3 +-
 .../synth/SynthInternalFrameTitlePane.java    |  3 +-
 .../plaf/synth/SynthInternalFrameUI.java      |  3 +-
 .../javax/swing/plaf/synth/SynthLabelUI.java  |  3 +-
 .../javax/swing/plaf/synth/SynthListUI.java   |  3 +-
 .../swing/plaf/synth/SynthMenuBarUI.java      |  3 +-
 .../swing/plaf/synth/SynthMenuItemUI.java     |  6 +--
 .../javax/swing/plaf/synth/SynthMenuUI.java   |  7 +--
 .../swing/plaf/synth/SynthOptionPaneUI.java   |  3 +-
 .../javax/swing/plaf/synth/SynthPanelUI.java  |  3 +-
 .../swing/plaf/synth/SynthPopupMenuUI.java    |  3 +-
 .../swing/plaf/synth/SynthProgressBarUI.java  |  3 +-
 .../swing/plaf/synth/SynthRootPaneUI.java     |  3 +-
 .../swing/plaf/synth/SynthScrollBarUI.java    |  6 +--
 .../swing/plaf/synth/SynthScrollPaneUI.java   |  3 +-
 .../swing/plaf/synth/SynthSeparatorUI.java    |  3 +-
 .../javax/swing/plaf/synth/SynthSliderUI.java |  6 +--
 .../swing/plaf/synth/SynthSpinnerUI.java      |  3 +-
 .../swing/plaf/synth/SynthSplitPaneUI.java    |  9 ++--
 .../swing/plaf/synth/SynthTabbedPaneUI.java   |  6 +--
 .../swing/plaf/synth/SynthTableHeaderUI.java  |  3 +-
 .../javax/swing/plaf/synth/SynthTableUI.java  |  3 +-
 .../swing/plaf/synth/SynthTextAreaUI.java     |  3 +-
 .../swing/plaf/synth/SynthTextFieldUI.java    |  3 +-
 .../swing/plaf/synth/SynthToolBarUI.java      |  8 ++--
 .../swing/plaf/synth/SynthToolTipUI.java      |  3 +-
 .../javax/swing/plaf/synth/SynthTreeUI.java   |  6 +--
 .../swing/plaf/synth/SynthViewportUI.java     |  3 +-
 .../javax/swing/plaf/synth/Test8043627.java   | 39 +++++++++++++++
 35 files changed, 92 insertions(+), 125 deletions(-)
 create mode 100644 jdk/test/javax/swing/plaf/synth/Test8043627.java

diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
index 74e13aaa900..38900d04b43 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
@@ -138,9 +138,7 @@ public class SynthButtonUI extends BasicButtonUI implements
     }
 
     SynthContext getContext(JComponent c, int state) {
-        Region region = SynthLookAndFeel.getRegion(c);
-        return SynthContext.getContext(SynthContext.class, c, region,
-                                       style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java
index 92566845636..72ab2b09a16 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java
@@ -128,8 +128,7 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
index b36b4cf4984..b50e0e4887d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
@@ -208,8 +208,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java
index 1730f25d35c..64b6e536f79 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java
@@ -24,9 +24,9 @@
  */
 package javax.swing.plaf.synth;
 
-import javax.swing.*;
-import java.util.*;
-import sun.reflect.misc.ReflectUtil;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import javax.swing.JComponent;
 
 /**
  * An immutable transient object containing contextual information about
@@ -40,59 +40,32 @@ import sun.reflect.misc.ReflectUtil;
  * @author Scott Violet
  */
 public class SynthContext {
-    private static final Map<Class, List<SynthContext>> contextMap;
+    private static final Queue<SynthContext> queue = new ConcurrentLinkedQueue<>();
 
     private JComponent component;
     private Region region;
     private SynthStyle style;
     private int state;
 
-
-    static {
-        contextMap = new HashMap<Class, List<SynthContext>>();
+    static SynthContext getContext(JComponent c, SynthStyle style, int state) {
+        return getContext(c, SynthLookAndFeel.getRegion(c), style, state);
     }
 
-
-    static SynthContext getContext(Class type, JComponent component,
+    static SynthContext getContext(JComponent component,
                                    Region region, SynthStyle style,
                                    int state) {
-        SynthContext context = null;
-
-        synchronized(contextMap) {
-            List<SynthContext> instances = contextMap.get(type);
-
-            if (instances != null) {
-                int size = instances.size();
-
-                if (size > 0) {
-                    context = instances.remove(size - 1);
-                }
-            }
-        }
+        SynthContext context = queue.poll();
         if (context == null) {
-            try {
-                context = (SynthContext) ReflectUtil.newInstance(type);
-            } catch (IllegalAccessException iae) {
-            } catch (InstantiationException ie) {
-            }
+            context = new SynthContext();
         }
         context.reset(component, region, style, state);
         return context;
     }
 
     static void releaseContext(SynthContext context) {
-        synchronized(contextMap) {
-            List<SynthContext> instances = contextMap.get(context.getClass());
-
-            if (instances == null) {
-                instances = new ArrayList<SynthContext>(5);
-                contextMap.put(context.getClass(), instances);
-            }
-            instances.add(context);
-        }
+        queue.offer(context);
     }
 
-
     SynthContext() {
     }
 
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java
index e10014100d9..8da1fe0cf3b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java
@@ -144,9 +144,7 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        Region region = SynthLookAndFeel.getRegion(c);
-        return SynthContext.getContext(SynthContext.class, c, region,
-                                       style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java
index 40300565b9a..6259171317b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java
@@ -432,8 +432,7 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                     SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java
index 2ccf59268de..69489197d6a 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java
@@ -139,8 +139,7 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java
index abf490ce863..92ad059085d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java
@@ -68,8 +68,7 @@ class SynthInternalFrameTitlePane extends BasicInternalFrameTitlePane
     }
 
     public SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private Region getRegion(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java
index 34c94cdbc8f..c5c1ef7fdad 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java
@@ -141,8 +141,7 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                            SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java
index 45031e99188..22e57e5e4a8 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java
@@ -91,8 +91,7 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI {
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java
index 58a443acb44..6a36a58a14f 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java
@@ -188,8 +188,7 @@ public class SynthListUI extends BasicListUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java
index 9c1f9cba227..1f096646495 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java
@@ -116,8 +116,7 @@ public class SynthMenuBarUI extends BasicMenuBarUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java
index 19ac0a760b3..956f76f1fb3 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java
@@ -170,8 +170,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements
     }
 
     SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     SynthContext getContext(JComponent c, Region region) {
@@ -179,8 +178,7 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements
     }
 
     private SynthContext getContext(JComponent c, Region region, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                                       region, accStyle, state);
+        return SynthContext.getContext(c, region, accStyle, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java
index 3f53f461ecc..7bb66a25c93 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java
@@ -170,9 +170,7 @@ public class SynthMenuUI extends BasicMenuUI
     }
 
     SynthContext getContext(JComponent c, int state) {
-        Region region = SynthLookAndFeel.getRegion(c);
-        return SynthContext.getContext(SynthContext.class, c, region,
-                                       style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     SynthContext getContext(JComponent c, Region region) {
@@ -180,8 +178,7 @@ public class SynthMenuUI extends BasicMenuUI
     }
 
     private SynthContext getContext(JComponent c, Region region, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                                       region, accStyle, state);
+        return SynthContext.getContext(c, region, accStyle, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java
index 42d454cf8d9..de6f2a7135e 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java
@@ -140,8 +140,7 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java
index ddfff5c1597..73f37ff530b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java
@@ -127,8 +127,7 @@ public class SynthPanelUI extends BasicPanelUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java
index d228abab79a..cbb09f29212 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java
@@ -123,8 +123,7 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
index 1afc81bb1f4..c37ce490368 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
@@ -138,8 +138,7 @@ public class SynthProgressBarUI extends BasicProgressBarUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                            SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java
index 0d437de7613..1115fe35551 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java
@@ -80,8 +80,7 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI {
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java
index d3e948d899c..498d69e1e86 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java
@@ -185,8 +185,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private SynthContext getContext(JComponent c, Region region) {
@@ -199,8 +198,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI
         if (region == Region.SCROLL_BAR_THUMB) {
             style = thumbStyle;
         }
-        return SynthContext.getContext(SynthContext.class, c, region, style,
-                                       state);
+        return SynthContext.getContext(c, region, style, state);
     }
 
     private int getComponentState(JComponent c, Region region) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java
index 6b261546408..6b3e29602de 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java
@@ -211,8 +211,7 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java
index 7e759d4e3be..158e16bd5c9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java
@@ -248,8 +248,7 @@ public class SynthSeparatorUI extends SeparatorUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     public void propertyChange(PropertyChangeEvent evt) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java
index 65d461264dc..5cc7cd48606 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java
@@ -722,8 +722,7 @@ public class SynthSliderUI extends BasicSliderUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                            SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private SynthContext getContext(JComponent c, Region subregion) {
@@ -732,14 +731,13 @@ public class SynthSliderUI extends BasicSliderUI
 
     private SynthContext getContext(JComponent c, Region subregion, int state) {
         SynthStyle style = null;
-        Class klass = SynthContext.class;
 
         if (subregion == Region.SLIDER_TRACK) {
             style = sliderTrackStyle;
         } else if (subregion == Region.SLIDER_THUMB) {
             style = sliderThumbStyle;
         }
-        return SynthContext.getContext(klass, c, subregion, style, state);
+        return SynthContext.getContext(c, subregion, style, state);
     }
 
     private int getComponentState(JComponent c, Region region) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java
index d8bc4feea52..a1293dfdadd 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java
@@ -278,8 +278,7 @@ public class SynthSpinnerUI extends BasicSpinnerUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java
index 2c5031c03d6..f82ccb37fab 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java
@@ -209,8 +209,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     SynthContext getContext(JComponent c, Region region) {
@@ -219,11 +218,9 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI
 
     private SynthContext getContext(JComponent c, Region region, int state) {
         if (region == Region.SPLIT_PANE_DIVIDER) {
-            return SynthContext.getContext(SynthContext.class, c, region,
-                                           dividerStyle, state);
+            return SynthContext.getContext(c, region, dividerStyle, state);
         }
-        return SynthContext.getContext(SynthContext.class, c, region,
-                                       style, state);
+        return SynthContext.getContext(c, region, style, state);
     }
 
     private int getComponentState(JComponent c, Region subregion) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
index df09ba5fcfa..211e8a2c331 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
@@ -235,13 +235,11 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c),style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private SynthContext getContext(JComponent c, Region subregion, int state){
         SynthStyle style = null;
-        Class klass = SynthContext.class;
 
         if (subregion == Region.TABBED_PANE_TAB) {
             style = tabStyle;
@@ -252,7 +250,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
         else if (subregion == Region.TABBED_PANE_CONTENT) {
             style = tabContentStyle;
         }
-        return SynthContext.getContext(klass, c, subregion, style, state);
+        return SynthContext.getContext(c, subregion, style, state);
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java
index a988692a4aa..f09f86d6548 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java
@@ -193,8 +193,7 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
index da49bddc4c2..194e9deee84 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
@@ -246,8 +246,7 @@ public class SynthTableUI extends BasicTableUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
 //
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java
index 441698ce0a9..33214dad926 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java
@@ -119,8 +119,7 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI {
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java
index 7028a5a5999..6adb7538e88 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java
@@ -157,8 +157,7 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI {
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
index f65fdd14dc1..51d2fefd17e 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
@@ -178,19 +178,17 @@ public class SynthToolBarUI extends BasicToolBarUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private SynthContext getContext(JComponent c, Region region, SynthStyle style) {
-        return SynthContext.getContext(SynthContext.class, c, region,
+        return SynthContext.getContext(c, region,
                                        style, getComponentState(c, region));
     }
 
     private SynthContext getContext(JComponent c, Region region,
                                     SynthStyle style, int state) {
-        return SynthContext.getContext(SynthContext.class, c, region,
-                                       style, state);
+        return SynthContext.getContext(c, region, style, state);
     }
 
     private int getComponentState(JComponent c, Region region) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java
index afd49f4a7e5..dc42debba7d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java
@@ -107,8 +107,7 @@ public class SynthToolTipUI extends BasicToolTipUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private int getComponentState(JComponent c) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
index a214532ed56..d8107879254 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
@@ -173,8 +173,7 @@ public class SynthTreeUI extends BasicTreeUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                    SynthLookAndFeel.getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private SynthContext getContext(JComponent c, Region region) {
@@ -182,8 +181,7 @@ public class SynthTreeUI extends BasicTreeUI
     }
 
     private SynthContext getContext(JComponent c, Region region, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                                       region, cellStyle, state);
+        return SynthContext.getContext(c, region, cellStyle, state);
     }
 
     private int getComponentState(JComponent c, Region region) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java
index 4c5a9b0cd88..dc3e6c6e1a1 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java
@@ -141,8 +141,7 @@ public class SynthViewportUI extends ViewportUI
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        return SynthContext.getContext(SynthContext.class, c,
-                                       getRegion(c), style, state);
+        return SynthContext.getContext(c, style, state);
     }
 
     private Region getRegion(JComponent c) {
diff --git a/jdk/test/javax/swing/plaf/synth/Test8043627.java b/jdk/test/javax/swing/plaf/synth/Test8043627.java
new file mode 100644
index 00000000000..2a36634a5fd
--- /dev/null
+++ b/jdk/test/javax/swing/plaf/synth/Test8043627.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.JButton;
+import javax.swing.plaf.synth.SynthButtonUI;
+
+/*
+ * @test
+ * @bug 8043627
+ * @summary Tests that SynthContext can be created with SecurityManager installed
+ * @author Sergey Malenkov
+ */
+
+public class Test8043627 {
+    public static void main(String[] args) {
+        System.setSecurityManager(new SecurityManager());
+        new SynthButtonUI().getContext(new JButton());
+    }
+}
-- 
GitLab


From 6a4110296a1a4766e50df356a5f53d8fe7ed99fc Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Thu, 22 May 2014 13:54:08 -0700
Subject: [PATCH 015/192] 8042855: [parfait] Potential null pointer dereference
 in IndicLayoutEngine.cpp

Reviewed-by: bae, srl
---
 jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp | 2 +-
 jdk/src/share/native/sun/font/layout/IndicReordering.cpp   | 6 +++++-
 jdk/src/share/native/sun/font/layout/IndicReordering.h     | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
index d45ebb65985..c50fbae6157 100644
--- a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
+++ b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
@@ -151,7 +151,7 @@ le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[],
     le_int32 outCharCount;
     if (fVersion2) {
         _LETRACE("v2process");
-        outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage);
+        outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage, success);
     } else {
         _LETRACE("reorder");
         outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups, success);
diff --git a/jdk/src/share/native/sun/font/layout/IndicReordering.cpp b/jdk/src/share/native/sun/font/layout/IndicReordering.cpp
index 7753e246535..22bbb7cf839 100644
--- a/jdk/src/share/native/sun/font/layout/IndicReordering.cpp
+++ b/jdk/src/share/native/sun/font/layout/IndicReordering.cpp
@@ -1096,9 +1096,13 @@ void IndicReordering::finalReordering(LEGlyphStorage &glyphStorage, le_int32 cou
 
 
 le_int32 IndicReordering::v2process(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
-                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success)
 {
     const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
+    if (classTable == NULL) {
+        success = LE_MEMORY_ALLOCATION_ERROR;
+        return 0;
+    }
 
     DynamicProperties dynProps[INDIC_BLOCK_SIZE];
     IndicReordering::getDynamicProperties(dynProps,classTable);
diff --git a/jdk/src/share/native/sun/font/layout/IndicReordering.h b/jdk/src/share/native/sun/font/layout/IndicReordering.h
index f90bf1ba224..ca77fe0c64a 100644
--- a/jdk/src/share/native/sun/font/layout/IndicReordering.h
+++ b/jdk/src/share/native/sun/font/layout/IndicReordering.h
@@ -181,7 +181,7 @@ public:
     static void adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage, LEErrorCode& success);
 
     static le_int32 v2process(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
-        LEUnicode *outChars, LEGlyphStorage &glyphStorage);
+        LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success);
 
     static const FeatureMap *getFeatureMap(le_int32 &count);
 
-- 
GitLab


From d09ff6959851a60c50ffab7c95386621ef509b5d Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Thu, 22 May 2014 13:54:52 -0700
Subject: [PATCH 016/192] 8042850: [parfait]: Extra unused entries in ICU
 ScriptCodes enum

Reviewed-by: bae, srl
---
 jdk/src/share/native/sun/font/layout/LEScripts.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/jdk/src/share/native/sun/font/layout/LEScripts.h b/jdk/src/share/native/sun/font/layout/LEScripts.h
index 5524ef31ae3..bb1b07e032f 100644
--- a/jdk/src/share/native/sun/font/layout/LEScripts.h
+++ b/jdk/src/share/native/sun/font/layout/LEScripts.h
@@ -262,12 +262,6 @@ enum ScriptCodes {
     khojScriptCode = 157,
     tirhScriptCode = 158,
 
-/**
- * @stable ICU 52
- */
-    aghbScriptCode = 159,
-    mahjScriptCode = 160,
-
 /**
  * @stable ICU 2.2
  */
-- 
GitLab


From 13b3a50623fde05825fa9e7991de08d43c22f095 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@openjdk.org>
Date: Fri, 23 May 2014 11:04:32 -0400
Subject: [PATCH 017/192] 8043805: Allow using a system-installed libjpeg

Reviewed-by: andrew, anthony, prr
---
 common/autoconf/generated-configure.sh | 77 ++++++++++++++++++++------
 common/autoconf/libraries.m4           | 35 ++++++++++--
 2 files changed, 91 insertions(+), 21 deletions(-)

diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index a146145de81..676ed1e65a9 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -1081,6 +1081,7 @@ enable_freetype_bundling
 with_alsa
 with_alsa_include
 with_alsa_lib
+with_libjpeg
 with_giflib
 with_lcms
 with_libpng
@@ -1938,6 +1939,8 @@ Optional Packages:
                           headers under PATH/include)
   --with-alsa-include     specify directory for the alsa include files
   --with-alsa-lib         specify directory for the alsa library
+  --with-libjpeg          use libjpeg from build system or OpenJDK source
+                          (system, bundled) [bundled]
   --with-giflib           use giflib from build system or OpenJDK source
                           (system, bundled) [bundled]
   --with-lcms             use lcms2 from build system or OpenJDK source
@@ -4253,7 +4256,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1398861894
+DATE_WHEN_GENERATED=1400601642
 
 ###############################################################################
 #
@@ -47176,10 +47179,43 @@ done
   # Check for the jpeg library
   #
 
-  USE_EXTERNAL_LIBJPEG=true
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5
-$as_echo_n "checking for main in -ljpeg... " >&6; }
-if ${ac_cv_lib_jpeg_main+:} false; then :
+
+# Check whether --with-libjpeg was given.
+if test "${with_libjpeg+set}" = set; then :
+  withval=$with_libjpeg;
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libjpeg to use" >&5
+$as_echo_n "checking for which libjpeg to use... " >&6; }
+
+  # default is bundled
+  DEFAULT_LIBJPEG=bundled
+
+  #
+  # if user didn't specify, use DEFAULT_LIBJPEG
+  #
+  if test "x${with_libjpeg}" = "x"; then
+    with_libjpeg=${DEFAULT_LIBJPEG}
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libjpeg}" >&5
+$as_echo "${with_libjpeg}" >&6; }
+
+  if test "x${with_libjpeg}" = "xbundled"; then
+    USE_EXTERNAL_LIBJPEG=false
+  elif test "x${with_libjpeg}" = "xsystem"; then
+    ac_fn_cxx_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+
+else
+   as_fn_error $? "--with-libjpeg=system specified, but jpeglib.h not found!" "$LINENO" 5
+fi
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_CreateDecompress in -ljpeg" >&5
+$as_echo_n "checking for jpeg_CreateDecompress in -ljpeg... " >&6; }
+if ${ac_cv_lib_jpeg_jpeg_CreateDecompress+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -47187,27 +47223,33 @@ LIBS="-ljpeg  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char jpeg_CreateDecompress ();
 int
 main ()
 {
-return main ();
+return jpeg_CreateDecompress ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
-  ac_cv_lib_jpeg_main=yes
+  ac_cv_lib_jpeg_jpeg_CreateDecompress=yes
 else
-  ac_cv_lib_jpeg_main=no
+  ac_cv_lib_jpeg_jpeg_CreateDecompress=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5
-$as_echo "$ac_cv_lib_jpeg_main" >&6; }
-if test "x$ac_cv_lib_jpeg_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_CreateDecompress" >&5
+$as_echo "$ac_cv_lib_jpeg_jpeg_CreateDecompress" >&6; }
+if test "x$ac_cv_lib_jpeg_jpeg_CreateDecompress" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBJPEG 1
 _ACEOF
@@ -47215,13 +47257,16 @@ _ACEOF
   LIBS="-ljpeg $LIBS"
 
 else
-   USE_EXTERNAL_LIBJPEG=false
-      { $as_echo "$as_me:${as_lineno-$LINENO}: Will use jpeg decoder bundled with the OpenJDK source" >&5
-$as_echo "$as_me: Will use jpeg decoder bundled with the OpenJDK source" >&6;}
-
+   as_fn_error $? "--with-libjpeg=system specified, but no libjpeg found" "$LINENO" 5
 fi
 
 
+    USE_EXTERNAL_LIBJPEG=true
+  else
+    as_fn_error $? "Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'" "$LINENO" 5
+  fi
+
+
 
   ###############################################################################
   #
diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4
index 6ee3221ad96..5f9546f0770 100644
--- a/common/autoconf/libraries.m4
+++ b/common/autoconf/libraries.m4
@@ -620,11 +620,36 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
   # Check for the jpeg library
   #
 
-  USE_EXTERNAL_LIBJPEG=true
-  AC_CHECK_LIB(jpeg, main, [],
-      [ USE_EXTERNAL_LIBJPEG=false
-      AC_MSG_NOTICE([Will use jpeg decoder bundled with the OpenJDK source])
-  ])
+  AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
+      [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
+
+  AC_MSG_CHECKING([for which libjpeg to use])
+
+  # default is bundled
+  DEFAULT_LIBJPEG=bundled
+
+  #
+  # if user didn't specify, use DEFAULT_LIBJPEG
+  #
+  if test "x${with_libjpeg}" = "x"; then
+    with_libjpeg=${DEFAULT_LIBJPEG}
+  fi
+
+  AC_MSG_RESULT(${with_libjpeg})
+
+  if test "x${with_libjpeg}" = "xbundled"; then
+    USE_EXTERNAL_LIBJPEG=false
+  elif test "x${with_libjpeg}" = "xsystem"; then
+    AC_CHECK_HEADER(jpeglib.h, [],
+        [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
+    AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
+        [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
+
+    USE_EXTERNAL_LIBJPEG=true
+  else
+    AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
+  fi
+
   AC_SUBST(USE_EXTERNAL_LIBJPEG)
 
   ###############################################################################
-- 
GitLab


From e563c48360d58f0baca9bd0a77ed875808f31c30 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@openjdk.org>
Date: Fri, 23 May 2014 11:04:37 -0400
Subject: [PATCH 018/192] 8043805: Allow using a system-installed libjpeg

Reviewed-by: andrew, anthony, prr
---
 jdk/make/lib/Awt2dLibraries.gmk               | 67 +++++++++++++------
 .../imageio/plugins/jpeg/JPEGImageReader.java |  2 +-
 .../imageio/plugins/jpeg/JPEGImageWriter.java |  2 +-
 .../sun/awt/image/JPEGImageDecoder.java       |  2 +-
 .../native/sun/awt/image/jpeg/imageioJPEG.c   |  2 +-
 5 files changed, 49 insertions(+), 26 deletions(-)

diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 06a5672d00a..c473784f16e 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -709,21 +709,24 @@ $(BUILD_LIBLCMS): $(BUILD_LIBAWT)
 
 ##########################################################################################
 
+BUILD_LIBJAVAJPEG_DIR := $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
+
 ifdef OPENJDK
-  BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
+  BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
 else
-  BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
-  BUILD_LIBJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
-  BUILD_LIBJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
+  BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
+  BUILD_LIBJAVAJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
+  BUILD_LIBJAVAJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJAVAJPEG_CLOSED_SRC)
 endif
 
-BUILD_LIBJPEG_REORDER :=
+BUILD_LIBJAVAJPEG_REORDER :=
 ifeq ($(OPENJDK_TARGET_OS), solaris)
   ifneq ($(OPENJDK_TARGET_CPU), x86_64)
-    BUILD_LIBJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
+    BUILD_LIBJAVAJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
   endif
 endif
 
+
 # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
 # or 'vfork'": this warning indicates that some variable is placed to
 # a register by optimized compiler and it's value might be lost on longjmp().
@@ -735,37 +738,50 @@ endif
 #      $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
 #          \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
 #  ifeq ($(CC_43_OR_NEWER), 1)
-#    BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
+#    BUILD_LIBJAVAJPEG_CFLAGS_linux += -Wno-clobbered
 #  endif
 #endif
 
-$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG, \
-    LIBRARY := jpeg, \
+ifeq ($(USE_EXTERNAL_LIBJPEG), true)
+  LIBJPEG_LIBS := -ljpeg
+  BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
+      imageIOJPEG.c \
+      jpegdecoder.c
+  BUILD_LIBJAVAJPEG_HEADERS :=
+else
+  LIBJPEG_LIBS :=
+  BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
+  BUILD_LIBJAVAJPEG_HEADERS := -I$(BUILD_LIBJAVAJPEG_DIR)
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
+    LIBRARY := javajpeg, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    SRC := $(BUILD_LIBJPEG_CLOSED_SRC) \
-        $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
+    SRC := $(BUILD_LIBJAVAJPEG_CLOSED_SRC) \
+        $(BUILD_LIBJAVAJPEG_DIR), \
+    INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
     LANG := C, \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
-        $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
-        -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
-    MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
-    LDFLAGS := $(LDFLAGS_JDKLIB) \
+        $(BUILD_LIBJAVAJPEG_CLOSED_INCLUDES) \
+        $(BUILD_LIBJAVAJPEG_HEADERS), \
+    MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
+    LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
     LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
     RC_FLAGS := $(RC_FLAGS) \
-        -D "JDK_FNAME=jpeg.dll" \
-        -D "JDK_INTERNAL_NAME=jpeg" \
+        -D "JDK_FNAME=javajpeg.dll" \
+        -D "JDK_INTERNAL_NAME=javajpeg" \
         -D "JDK_FTYPE=0x2L", \
-    REORDER := $(BUILD_LIBJPEG_REORDER), \
+    REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjpeg, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-$(BUILD_LIBJPEG): $(BUILD_LIBJAVA)
+$(BUILD_LIBJAVAJPEG): $(BUILD_LIBJAVA)
 
-BUILD_LIBRARIES += $(BUILD_LIBJPEG)
+BUILD_LIBRARIES += $(BUILD_LIBJAVAJPEG)
 
 ##########################################################################################
 
@@ -1213,6 +1229,13 @@ ifndef BUILD_HEADLESS_ONLY
     GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
   endif
 
+  ifeq ($(USE_EXTERNAL_LIBJPEG), true)
+    LIBJPEG_LDFLAGS := -ljpeg
+  else
+    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
+    LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
+  endif
+
   ifeq ($(USE_EXTERNAL_LIBPNG), false)
     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/libpng
     LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
@@ -1276,12 +1299,12 @@ ifndef BUILD_HEADLESS_ONLY
       LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
-                $(GIFLIB_CFLAGS) $(PNG_CFLAGS), \
+                $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
-                        $(GIFLIB_LDFLAGS) $(PNG_LIBS), \
+                        $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS) $(PNG_LIBS), \
       LDFLAGS_SUFFIX_solaris := -lc, \
       VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
       RC_FLAGS := $(RC_FLAGS) \
diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
index 961255ce8c9..8b6cdcbce13 100644
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
@@ -89,7 +89,7 @@ public class JPEGImageReader extends ImageReader {
         java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction<Void>() {
                 public Void run() {
-                    System.loadLibrary("jpeg");
+                    System.loadLibrary("javajpeg");
                     return null;
                 }
             });
diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
index 1913ef4641f..477e6738b5f 100644
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
@@ -179,7 +179,7 @@ public class JPEGImageWriter extends ImageWriter {
         java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction<Void>() {
                 public Void run() {
-                    System.loadLibrary("jpeg");
+                    System.loadLibrary("javajpeg");
                     return null;
                 }
             });
diff --git a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
index 70dacb195c3..b1fce632d1c 100644
--- a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
+++ b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
@@ -56,7 +56,7 @@ public class JPEGImageDecoder extends ImageDecoder {
         java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction<Void>() {
                 public Void run() {
-                    System.loadLibrary("jpeg");
+                    System.loadLibrary("javajpeg");
                     return null;
                 }
             });
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
index 5f7a0364866..2fb507c0f66 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -51,7 +51,7 @@
 
 /* headers from the JPEG library */
 #include <jpeglib.h>
-#include "jerror.h"
+#include <jerror.h>
 
 #undef MAX
 #define MAX(a,b)        ((a) > (b) ? (a) : (b))
-- 
GitLab


From d454bf5946dff6d32bb6ebf77cf83e61abc198f6 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Fri, 23 May 2014 19:43:14 +0400
Subject: [PATCH 019/192] 8043610: Sorting columns in JFileChooser fails with
 AppContext NPE

Reviewed-by: anthony, alexsch
---
 .../com/sun/java/swing/SwingUtilities3.java   |   6 +-
 jdk/src/share/classes/java/awt/Component.java |   2 +-
 .../share/classes/javax/swing/JComponent.java |  19 ++--
 .../swing/JComponent/8043610/bug8043610.java  | 100 ++++++++++++++++++
 4 files changed, 114 insertions(+), 13 deletions(-)
 create mode 100644 jdk/test/javax/swing/JComponent/8043610/bug8043610.java

diff --git a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
index 1ca240dd743..b50fb2ae1b2 100644
--- a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
+++ b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
@@ -27,6 +27,8 @@ package com.sun.java.swing;
 
 import sun.awt.EventQueueDelegate;
 import sun.awt.AppContext;
+import sun.awt.SunToolkit;
+
 import java.util.Collections;
 import java.util.Map;
 import java.util.WeakHashMap;
@@ -117,8 +119,8 @@ public class SwingUtilities3 {
     public static RepaintManager getDelegateRepaintManager(Component
                                                             component) {
         RepaintManager delegate = null;
-        if (Boolean.TRUE == AppContext.getAppContext().get(
-                                               DELEGATE_REPAINT_MANAGER_KEY)) {
+        if (Boolean.TRUE == SunToolkit.targetToAppContext(component)
+                                      .get(DELEGATE_REPAINT_MANAGER_KEY)) {
             while (delegate == null && component != null) {
                 while (component != null
                          && ! (component instanceof JComponent)) {
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index cd6ae69de1d..0fce6a51b49 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -3411,7 +3411,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
                 (width > 0) && (height > 0)) {
                 PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE,
                                               new Rectangle(x, y, width, height));
-                Toolkit.getEventQueue().postEvent(e);
+                SunToolkit.postEvent(SunToolkit.targetToAppContext(this), e);
             }
         }
     }
diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java
index 2d2745957e7..4eb85b23a53 100644
--- a/jdk/src/share/classes/javax/swing/JComponent.java
+++ b/jdk/src/share/classes/javax/swing/JComponent.java
@@ -63,6 +63,7 @@ import javax.swing.plaf.*;
 import static javax.swing.ClientPropertyKey.*;
 import javax.accessibility.*;
 
+import sun.awt.SunToolkit;
 import sun.swing.SwingUtilities2;
 import sun.swing.UIClientPropertyKey;
 
@@ -4802,7 +4803,8 @@ public abstract class JComponent extends Container implements Serializable,
      * @see RepaintManager#addDirtyRegion
      */
     public void repaint(long tm, int x, int y, int width, int height) {
-        RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width, height);
+        RepaintManager.currentManager(SunToolkit.targetToAppContext(this))
+                      .addDirtyRegion(this, x, y, width, height);
     }
 
 
@@ -4856,7 +4858,7 @@ public abstract class JComponent extends Container implements Serializable,
             // which was causing some people grief.
             return;
         }
-        if (SwingUtilities.isEventDispatchThread()) {
+        if (SunToolkit.isDispatchThreadForAppContext(this)) {
             invalidate();
             RepaintManager.currentManager(this).addInvalidComponent(this);
         }
@@ -4870,15 +4872,12 @@ public abstract class JComponent extends Container implements Serializable,
                 }
                 setFlag(REVALIDATE_RUNNABLE_SCHEDULED, true);
             }
-            Runnable callRevalidate = new Runnable() {
-                public void run() {
-                    synchronized(JComponent.this) {
-                        setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false);
-                    }
-                    revalidate();
+            SunToolkit.executeOnEventHandlerThread(this, () -> {
+                synchronized(JComponent.this) {
+                    setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false);
                 }
-            };
-            SwingUtilities.invokeLater(callRevalidate);
+                revalidate();
+            });
         }
     }
 
diff --git a/jdk/test/javax/swing/JComponent/8043610/bug8043610.java b/jdk/test/javax/swing/JComponent/8043610/bug8043610.java
new file mode 100644
index 00000000000..b4fc89f0552
--- /dev/null
+++ b/jdk/test/javax/swing/JComponent/8043610/bug8043610.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+  @test
+  @bug 8043610
+  @summary Tests that JComponent invalidate, revalidate and repaint methods could
+           be called from any thread
+  @author Petr Pchelko
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class bug8043610 {
+    private static volatile JFrame frame;
+    private static volatile JComponent component;
+
+    public static void main(String[] args) throws Exception {
+        ThreadGroup stubTG = new ThreadGroup(getRootThreadGroup(), "Stub Thread Group");
+        ThreadGroup swingTG = new ThreadGroup(getRootThreadGroup(), "SwingTG");
+        try {
+            Thread stubThread = new Thread(stubTG, SunToolkit::createNewAppContext);
+            stubThread.start();
+            stubThread.join();
+
+            CountDownLatch startSwingLatch = new CountDownLatch(1);
+            new Thread(swingTG, () -> {
+                SunToolkit.createNewAppContext();
+                SwingUtilities.invokeLater(() -> {
+                    frame = new JFrame();
+                    component = new JLabel("Test Text");
+                    frame.add(component);
+                    frame.setBounds(100, 100, 100, 100);
+                    frame.setVisible(true);
+                    startSwingLatch.countDown();
+                });
+            }).start();
+            startSwingLatch.await();
+
+            AtomicReference<Exception> caughtException = new AtomicReference<>();
+            Thread checkThread = new Thread(getRootThreadGroup(), () -> {
+                try {
+                    component.invalidate();
+                    component.revalidate();
+                    component.repaint(new Rectangle(0, 0, 0, 0));
+                } catch (Exception e) {
+                    caughtException.set(e);
+                }
+            });
+            checkThread.start();
+            checkThread.join();
+
+            if (caughtException.get() != null) {
+                throw new RuntimeException("Failed. Caught exception!", caughtException.get());
+            }
+        } finally {
+            new Thread(swingTG, () -> SwingUtilities.invokeLater(() -> {
+                if (frame != null) {
+                    frame.dispose();
+                }
+            })).start();
+        }
+    }
+
+    private static ThreadGroup getRootThreadGroup() {
+        ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
+        ThreadGroup parentTG = currentTG.getParent();
+        while (parentTG != null) {
+            currentTG = parentTG;
+            parentTG = currentTG.getParent();
+        }
+        return currentTG;
+    }
+}
-- 
GitLab


From e6130c49cd9f31c4de2387f97c6a94dfc4e22598 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Fri, 23 May 2014 19:48:25 +0400
Subject: [PATCH 020/192] 8031485: [macosx] Combo box consuming escape key
 events

Reviewed-by: serb, alexsch
---
 .../classes/com/apple/laf/AquaComboBoxUI.java | 12 +--
 .../ConsumedEscTest/ConsumedEscTest.java      | 82 +++++++++++++++++++
 2 files changed, 89 insertions(+), 5 deletions(-)
 create mode 100644 jdk/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java

diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
index c38e108633b..75c7babb58a 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
@@ -522,15 +522,17 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
     };
 
     @SuppressWarnings("serial") // anonymous class
-    private static Action hideAction = new AbstractAction() {
+    private final Action hideAction = new AbstractAction() {
         @Override
         public void actionPerformed(final ActionEvent e) {
             final JComboBox comboBox = (JComboBox)e.getSource();
+            comboBox.firePopupMenuCanceled();
+            comboBox.setPopupVisible(false);
+        }
 
-            if (comboBox.isPopupVisible()) {
-                comboBox.firePopupMenuCanceled();
-                comboBox.setPopupVisible(false);
-            }
+        @Override
+        public boolean isEnabled() {
+            return comboBox.isPopupVisible() && super.isEnabled();
         }
     };
 
diff --git a/jdk/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java b/jdk/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java
new file mode 100644
index 00000000000..2828d7af864
--- /dev/null
+++ b/jdk/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+/*
+  @test
+  @bug 8031485
+  @summary Combo box consuming escape and enter key events
+  @author Petr Pchelko
+  @library ../../../../lib/testlibrary/
+  @build ExtendedRobot
+  @run main ConsumedEscTest
+*/
+public class ConsumedEscTest {
+    private static volatile JFrame frame;
+    private static volatile boolean passed = false;
+
+    public static void main(String... args) throws Exception {
+        try {
+            SwingUtilities.invokeAndWait(() -> {
+                frame = new JFrame();
+                JComboBox<String> combo = new JComboBox<>(new String[]{"one", "two", "three"});
+                JPanel panel = new JPanel();
+                panel.add(combo);
+                combo.requestFocusInWindow();
+                frame.setBounds(100, 150, 300, 100);
+                addAction(panel);
+                frame.add(panel);
+                frame.setVisible(true);
+            });
+
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle();
+            robot.type(KeyEvent.VK_ESCAPE);
+            robot.waitForIdle();
+            if (!passed) {
+                throw new RuntimeException("FAILED: ESC was consumed by combo box");
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+    }
+
+    private static void addAction(JComponent comp) {
+        KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
+        Object actionKey = "cancel";
+        comp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey);
+        Action cancelAction = new AbstractAction() {
+            @Override
+            public void actionPerformed(ActionEvent ev) {
+                passed = true;
+            }
+        };
+        comp.getActionMap().put(actionKey, cancelAction);
+    }
+
+}
-- 
GitLab


From 7a0d4ecc23de5539cf16209e000c5ebc7526b738 Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy <alexsch@openjdk.org>
Date: Mon, 26 May 2014 14:33:49 +0400
Subject: [PATCH 021/192] 8040291: [macosx] Http-Images are not fully loaded
 when using ImageIcon

Reviewed-by: serb, pchelko
---
 .../share/classes/java/awt/MediaTracker.java  |   9 +-
 jdk/src/share/classes/sun/awt/SunToolkit.java |  16 +-
 .../image/MultiResolutionToolkitImage.java    |  13 ++
 .../MultiResolutionToolkitImageTest.java      | 158 ++++++++++++++++++
 4 files changed, 189 insertions(+), 7 deletions(-)
 create mode 100644 jdk/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java

diff --git a/jdk/src/share/classes/java/awt/MediaTracker.java b/jdk/src/share/classes/java/awt/MediaTracker.java
index 4dd0fb5abfe..a551fef73d4 100644
--- a/jdk/src/share/classes/java/awt/MediaTracker.java
+++ b/jdk/src/share/classes/java/awt/MediaTracker.java
@@ -226,7 +226,9 @@ public class MediaTracker implements java.io.Serializable {
         addImageImpl(image, id, w, h);
         Image rvImage = getResolutionVariant(image);
         if (rvImage != null) {
-            addImageImpl(rvImage, id, 2 * w, 2 * h);
+            addImageImpl(rvImage, id,
+                    w == -1 ? -1 : 2 * w,
+                    h == -1 ? -1 : 2 * h);
         }
     }
 
@@ -810,8 +812,9 @@ public class MediaTracker implements java.io.Serializable {
         removeImageImpl(image, id, width, height);
         Image rvImage = getResolutionVariant(image);
         if (rvImage != null) {
-            removeImageImpl(rvImage, id, 2 * width, 2 * height);
-
+            removeImageImpl(rvImage, id,
+                    width == -1 ? -1 : 2 * width,
+                    height == -1 ? -1 : 2 * height);
         }
         notifyAll();    // Notify in case remaining images are "done".
     }
diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java
index 6739a603c5d..434115bfefb 100644
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java
@@ -850,22 +850,30 @@ public abstract class SunToolkit extends Toolkit
 
     private int checkResolutionVariant(Image img, int w, int h, ImageObserver o) {
         ToolkitImage rvImage = getResolutionVariant(img);
+        int rvw = getRVSize(w);
+        int rvh = getRVSize(h);
         // Ignore the resolution variant in case of error
         return (rvImage == null || rvImage.hasError()) ? 0xFFFF :
-                checkImage(rvImage, 2 * w, 2 * h, MultiResolutionToolkitImage.
+                checkImage(rvImage, rvw, rvh, MultiResolutionToolkitImage.
                                 getResolutionVariantObserver(
-                                        img, o, w, h, 2 * w, 2 * h));
+                                        img, o, w, h, rvw, rvh, true));
     }
 
     private boolean prepareResolutionVariant(Image img, int w, int h,
             ImageObserver o) {
 
         ToolkitImage rvImage = getResolutionVariant(img);
+        int rvw = getRVSize(w);
+        int rvh = getRVSize(h);
         // Ignore the resolution variant in case of error
         return rvImage == null || rvImage.hasError() || prepareImage(
-                rvImage, 2 * w, 2 * h,
+                rvImage, rvw, rvh,
                 MultiResolutionToolkitImage.getResolutionVariantObserver(
-                        img, o, w, h, 2 * w, 2 * h));
+                        img, o, w, h, rvw, rvh, true));
+    }
+
+    private static int getRVSize(int size){
+        return size == -1 ? -1 : 2 * size;
     }
 
     private static ToolkitImage getResolutionVariant(Image image) {
diff --git a/jdk/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java b/jdk/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java
index a49c8a7f59c..bde59ab6275 100644
--- a/jdk/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java
+++ b/jdk/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java
@@ -66,6 +66,14 @@ public class MultiResolutionToolkitImage extends ToolkitImage implements MultiRe
             final Image image, final ImageObserver observer,
             final int imgWidth, final int imgHeight,
             final int rvWidth, final int rvHeight) {
+        return getResolutionVariantObserver(image, observer,
+                imgWidth, imgHeight, rvWidth, rvHeight, false);
+    }
+
+    public static ImageObserver getResolutionVariantObserver(
+            final Image image, final ImageObserver observer,
+            final int imgWidth, final int imgHeight,
+            final int rvWidth, final int rvHeight, boolean concatenateInfo) {
 
         if (observer == null) {
             return null;
@@ -92,6 +100,11 @@ public class MultiResolutionToolkitImage extends ToolkitImage implements MultiRe
                                 y /= 2;
                             }
 
+                            if(concatenateInfo){
+                                flags &= ((ToolkitImage) image).
+                                        getImageRep().check(null);
+                            }
+
                             return observer.imageUpdate(
                                     image, flags, x, y, width, height);
                         };
diff --git a/jdk/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java b/jdk/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java
new file mode 100644
index 00000000000..57a54386f0c
--- /dev/null
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import static java.awt.image.ImageObserver.ALLBITS;
+import java.io.File;
+import javax.imageio.ImageIO;
+import sun.awt.OSInfo;
+import sun.awt.SunToolkit;
+import sun.awt.image.MultiResolutionToolkitImage;
+
+/**
+ * @test
+ * @bug 8040291
+ * @author Alexander Scherbatiy
+ * @summary [macosx] Http-Images are not fully loaded when using ImageIcon
+ * @run main MultiResolutionToolkitImageTest
+ */
+public class MultiResolutionToolkitImageTest {
+
+    private static final int IMAGE_WIDTH = 300;
+    private static final int IMAGE_HEIGHT = 200;
+    private static final Color COLOR_1X = Color.GREEN;
+    private static final Color COLOR_2X = Color.BLUE;
+    private static final String IMAGE_NAME_1X = "image.png";
+    private static final String IMAGE_NAME_2X = "image@2x.png";
+    private static final int WAIT_TIME = 400;
+    private static volatile boolean isImageLoaded = false;
+    private static volatile boolean isRVObserverCalled = false;
+
+    public static void main(String[] args) throws Exception {
+
+        if (!checkOS()) {
+            return;
+        }
+        generateImages();
+        testToolkitMultiResolutionImageLoad();
+    }
+
+    static void testToolkitMultiResolutionImageLoad() throws Exception {
+        File imageFile = new File(IMAGE_NAME_1X);
+        String fileName = imageFile.getAbsolutePath();
+        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.prepareImage(image, -1, -1, new LoadImageObserver());
+
+        final long time = WAIT_TIME + System.currentTimeMillis();
+        while ((!isImageLoaded || !isRVObserverCalled)
+                && System.currentTimeMillis() < time) {
+            Thread.sleep(50);
+        }
+
+        if(!isImageLoaded){
+            throw new RuntimeException("Image is not loaded!");
+        }
+
+        if(!isRVObserverCalled){
+            throw new RuntimeException("Resolution Variant observer is not called!");
+        }
+    }
+
+    static void generateImages() throws Exception {
+        if (!new File(IMAGE_NAME_1X).exists()) {
+            generateImage(1);
+        }
+
+        if (!new File(IMAGE_NAME_2X).exists()) {
+            generateImage(2);
+        }
+    }
+
+    static void generateImage(int scale) throws Exception {
+        BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.getGraphics();
+        g.setColor(scale == 1 ? COLOR_1X : COLOR_2X);
+        g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
+        File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
+        ImageIO.write(image, "png", file);
+    }
+
+    static boolean checkOS() {
+        return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
+    }
+
+    static class LoadImageObserver implements ImageObserver {
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y,
+                int width, int height) {
+
+            if (isRVObserver()) {
+                isRVObserverCalled = true;
+                SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+                Image resolutionVariant = getResolutionVariant(img);
+                int rvFlags = toolkit.checkImage(resolutionVariant, width, height,
+                        new IdleImageObserver());
+                if (rvFlags < infoflags) {
+                    throw new RuntimeException("Info flags are greater than"
+                            + " resolution varint info flags");
+                }
+            } else if ((infoflags & ALLBITS) != 0) {
+                isImageLoaded = true;
+            }
+
+            return (infoflags & ALLBITS) == 0;
+        }
+    }
+
+    static boolean isRVObserver() {
+        Exception e = new Exception();
+
+        for (StackTraceElement elem : e.getStackTrace()) {
+            if (elem.getClassName().endsWith("MultiResolutionToolkitImage")) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    static class IdleImageObserver implements ImageObserver {
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y,
+                int width, int height) {
+            return false;
+        }
+    }
+
+    static Image getResolutionVariant(Image image) {
+        return ((MultiResolutionToolkitImage) image).getResolutionVariant();
+    }
+}
-- 
GitLab


From 8fab8231ab42fefd6567f1d62e29155b06c95187 Mon Sep 17 00:00:00 2001
From: Dmitriy Ermashov <dmitriy.ermashov@oracle.com>
Date: Mon, 26 May 2014 15:50:10 +0400
Subject: [PATCH 022/192] 8041915: Move 8 awt tests to OpenJDK regression tests
 tree

Reviewed-by: pchelko, alexsch
---
 .../InvocationEventTest.java                  | 203 +++++++++++
 .../DecoratedExceptions.java                  |  81 +++++
 .../ShapedAndTranslucentWindows/Common.java   | 316 ++++++++++++++++++
 .../FocusAWTTest.java                         | 225 +++++++++++++
 .../ShapedAndTranslucentWindows/Shaped.java   |  69 ++++
 .../ShapedByAPI.java                          |  71 ++++
 .../ShapedTranslucent.java                    |  70 ++++
 .../StaticallyShaped.java                     |  68 ++++
 .../Translucent.java                          |  71 ++++
 jdk/test/lib/testlibrary/ExtendedRobot.java   |  45 ++-
 10 files changed, 1216 insertions(+), 3 deletions(-)
 create mode 100644 jdk/test/java/awt/EventQueue/InvocationEventTest/InvocationEventTest.java
 create mode 100644 jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
 create mode 100644 jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Common.java
 create mode 100644 jdk/test/java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java
 create mode 100644 jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Shaped.java
 create mode 100644 jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedByAPI.java
 create mode 100644 jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucent.java
 create mode 100644 jdk/test/java/awt/Window/ShapedAndTranslucentWindows/StaticallyShaped.java
 create mode 100644 jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Translucent.java

diff --git a/jdk/test/java/awt/EventQueue/InvocationEventTest/InvocationEventTest.java b/jdk/test/java/awt/EventQueue/InvocationEventTest/InvocationEventTest.java
new file mode 100644
index 00000000000..a0d19940340
--- /dev/null
+++ b/jdk/test/java/awt/EventQueue/InvocationEventTest/InvocationEventTest.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.event.*;
+
+/*
+ * @test
+ * @summary  To Test the following assertions in InvovationEvent.
+ * 1.InvocationEvent when dispatched, should invoke the
+ *   run() method of the Runnable Interface.
+ * 2.If catchExceptions is false, Exception should be
+ *   propagated up to the EventDispatchThread's dispatch loop.
+ * 3.If catchExceptions is true, InvocationEvent.getExceptions()
+ *   should return the exception thrown inside thr run() method.
+ * 4.When InvocationEvent object is posted on to the EventQueue,
+ *   InvocationEvent.dispatch() method should be invoked by the
+ *   EventQueue.
+ * 5.If the notifier object is not null, notifyAll() of the
+ *   notifier object should be invoked when the run() method returns.
+ * 6.To test whether the threads are invoked in the right order
+ *   When InvocationEvents are nested.
+ * 7.The getWhen method should return timestamp which is less than
+ *   current System time and greater than the time before it has
+ *   actually happened
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main InvocationEventTest
+ */
+
+public class InvocationEventTest {
+    EventQueue eventQ1 = new EventQueue();
+
+    Object lock = new Object();
+
+    static final int delay = 5000;
+
+    public volatile boolean notifierStatus = false;
+    public Object notifierLock = new Object();
+
+    public volatile boolean threadStatus = false;
+    public volatile boolean childInvoked = false;
+
+    public synchronized void doTest() throws Exception {
+        // Testing assertions 1, 2 and 7:
+        // 1.InvocationEvent when dispatched, should invoke the
+        //   run() method of the Runnable Interface.
+        // 2.If catchExceptions is false, Exception should be
+        //   propagated up to the EventDispatchThread's dispatch loop.
+        // 7.The getWhen method should return timestamp which is less than
+        //   current System time and greater than the time before it has
+        //   actually happened
+
+        long timeBeforeInvoking = System.currentTimeMillis();
+
+        Thread.sleep(10);
+
+        InvocationEvent invoc = new InvocationEvent(this, () -> { threadStatus = true; }, lock, false);
+        invoc.dispatch();
+
+        Thread.sleep(10);
+
+        if (!threadStatus) {
+            synchronized (lock) {
+                lock.wait(delay);
+            }
+        }
+
+        // testing getException() when no exception is thrown
+        if (invoc.getWhen() <= timeBeforeInvoking ||
+                invoc.getWhen() >= System.currentTimeMillis()) {
+            throw new RuntimeException("getWhen method is not getting the time at which event occured");
+        }
+
+        if (invoc.getException() != null) {
+            throw new RuntimeException("InvocationEvent.getException() does not return null " +
+                    "when catchException is false");
+        }
+
+        // testing the normal behaviour of InvocationEvent
+        if (!threadStatus) {
+            throw new RuntimeException("InvocationEvent when dispatched, did not" +
+                    " invoke the run() of the Runnable interface  ");
+        }
+        threadStatus = false;
+
+        // Testing assertion 3:
+        // 3.If catchExceptions is true, InvocationEvent.getExceptions()
+        //   should return the exception thrown inside the run() method.
+        RuntimeException sampleExn = new RuntimeException(" test exception");
+
+        invoc = new InvocationEvent(this, () -> { threadStatus = true; throw sampleExn; }, lock, true);
+        invoc.dispatch();
+        if (!threadStatus) {
+            synchronized (lock) {
+                lock.wait(delay);
+            }
+        }
+        // testing getException() when exception is thrown
+        // Should return the same exception thrown inside the run() method
+        if (!invoc.getException().equals(sampleExn)) {
+            throw new RuntimeException("getException() does not return " +
+                    "the same Exception thrown inside the run() method ");
+        }
+        threadStatus = false;
+
+        // Testing assertions 4 and 5:
+        // 4.When InvocationEvent object is posted on to the EventQueue,
+        //   InvocationEvent.dispatch() method should be invoked by the
+        //   EventQueue.
+        // 5.If the notifier object is not null, notifyAll() of the
+        //   notifier object should be invoked when the run() method returns.
+
+        Thread notify = new Thread(){
+            public void run() {
+                synchronized (this) {
+                    try { wait(); } catch (InterruptedException e) { throw new RuntimeException(e); }
+                }
+                notifierStatus = true;
+                synchronized (notifierLock) {
+                    notifierLock.notifyAll();
+                }
+            }
+        };
+        notify.start();
+
+        while (notify.getState() != Thread.State.WAITING)
+            Thread.sleep(delay/5);
+
+        InvocationEvent invocation = new InvocationEvent(this, () -> { }, (Object) notify, false);
+        eventQ1.postEvent(invocation);
+
+        while(!invocation.isDispatched())
+            synchronized (notifierLock) {
+                notifierLock.wait(delay);
+            }
+
+        while (notify.getState() != Thread.State.TERMINATED)
+            Thread.sleep(delay/5);
+
+        if (!notifierStatus) {
+            throw new RuntimeException("Notifier object did not get notified" +
+                    " When the run method of the Runnable returns ");
+        }
+
+        // Testing assertion 6:
+        // 6.To test whether the threads are invoked in the right order
+        //   When InvocationEvents are nested.
+        Thread thread = new Thread(){
+            public void run() {
+                InvocationEvent evt = new InvocationEvent(this, () -> { childInvoked = true; }, (Object) this, false);
+                new EventQueue().postEvent(evt);
+                synchronized (this) {
+                    try {
+                        wait(delay);
+                    } catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+                threadStatus = true;
+            }
+        };
+
+        invocation = new InvocationEvent(this, thread, lock, false);
+
+        eventQ1.postEvent(invocation);
+
+        while (!invocation.isDispatched())
+            synchronized (lock) {
+                lock.wait(delay);
+            }
+
+        if (!threadStatus || !childInvoked) {
+            throw new RuntimeException("Nesting of InvocationEvents when dispatched," +
+                    " did not invoke the run() of the Runnables properly ");
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        new InvocationEventTest().doTest();
+    }
+}
+
diff --git a/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java b/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
new file mode 100644
index 00000000000..b2a0ddc6fdc
--- /dev/null
+++ b/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary An attempt to set non-trivial background, shape, or translucency
+ *          to a decorated toplevel should end with an exception.
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main DecoratedExceptions
+ */
+public class DecoratedExceptions {
+    public static void main(String args[]) throws Exception{
+        ExtendedRobot robot = new ExtendedRobot();
+        Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(() -> {
+            Frame frame = new Frame("Frame");
+            frame.setBounds(50,50,400,200);
+            try {
+                frame.setOpacity(0.5f);
+                throw new RuntimeException("No exception when Opacity set to a decorated Frame");
+            }catch(IllegalComponentStateException e) {
+            }
+            try {
+                frame.setShape(new Rectangle(50,50,400,200));
+                throw new RuntimeException("No exception when Shape set to a decorated Frame");
+            }catch(IllegalComponentStateException e) {
+            }
+            try {
+                frame.setBackground(new Color(50, 50, 50, 100));
+                throw new RuntimeException("No exception when Alpha background set to a decorated Frame");
+            }catch(IllegalComponentStateException e) {
+            }
+            frame.setVisible(true);
+            Dialog dialog = new Dialog( frame );
+            try {
+                dialog.setOpacity(0.5f);
+                throw new RuntimeException("No exception when Opacity set to a decorated Dialog");
+            }catch(IllegalComponentStateException e) {
+            }
+            try {
+                dialog.setShape(new Rectangle(50,50,400,200));
+                throw new RuntimeException("No exception when Shape set to a decorated Dialog");
+            }catch(IllegalComponentStateException e) {
+            }
+            try {
+                dialog.setBackground(new Color(50, 50, 50, 100));
+                throw new RuntimeException("No exception when Alpha background set to a decorated Dialog");
+            }catch(IllegalComponentStateException e) {
+            }
+            dialog.setVisible(true);
+        });
+        robot.waitForIdle(1000);
+    }
+}
diff --git a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Common.java b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Common.java
new file mode 100644
index 00000000000..8927642ecf8
--- /dev/null
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Common.java
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.geom.Area;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.security.SecureRandom;
+
+
+/*
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ */
+public abstract class Common {
+
+    ExtendedRobot robot;
+    Class<? extends Frame> windowClass;
+    Frame background;
+    BufferedImage foreground;
+    Window window;
+    Container componentsContainer;
+
+    float opacity = 1.0f;
+    static final int STATIC_STEP = 30;
+    static final int STATIC_WIDTH = 25;
+    static final int STATIC_BLOCKS = 30;
+    static final Color BG_COLOR = Color.BLUE;
+    static final Color FG_COLOR = Color.RED;
+    static final int delay = 1000;
+    static final SecureRandom random = new SecureRandom();
+    static final int dl = 100;
+    static final Class[] WINDOWS_TO_TEST = { Window.class, Frame.class, Dialog.class };
+
+    public Common(Class windowClass, float opacity) throws Exception{
+        this.opacity = opacity;
+        robot = new ExtendedRobot();
+        this.windowClass = windowClass;
+        EventQueue.invokeAndWait(this::initBackgroundFrame);
+        EventQueue.invokeAndWait(this::initGUI);
+    }
+
+    public Common(Class windowClass) throws Exception{
+        this(windowClass, 1.0f);
+    }
+
+    public void doTest() throws Exception {
+        robot.waitForIdle(delay);
+    };
+
+    public void dispose() {
+        window.dispose();
+        background.dispose();
+    }
+
+    public abstract void applyShape();
+
+    public void applyDynamicShape() {
+        final Area a = new Area();
+        Dimension size = window.getSize();
+        for (int x = 0; x < 3; x++) {
+            for (int y = 0; y < 3; y++) {
+                a.add(new Area(new Rectangle2D.Double(
+                        x * size.getWidth() / 17*6, y * size.getHeight() / 17*6,
+                        size.getWidth() / 17*5, size.getHeight() / 17*5)));
+            }
+        }
+        window.setShape(a);
+    }
+
+    public void applyStaticShape() {
+        final Area a = new Area();
+        for (int x = 0; x < STATIC_BLOCKS; x++) {
+            for (int y = 0; y < STATIC_BLOCKS; y++) {
+                a.add(new Area(new Rectangle2D.Float(
+                        x*STATIC_STEP, y*STATIC_STEP,
+                        STATIC_WIDTH, STATIC_WIDTH)));
+            }
+        }
+        window.setShape(a);
+    }
+
+    public BufferedImage getForegroundWindow() throws Exception {
+        final BufferedImage f[] = new BufferedImage[1];
+        EventQueue.invokeAndWait( () -> {
+            f[0] = new BufferedImage(window.getWidth(),
+                    window.getHeight(), BufferedImage.TYPE_INT_RGB);
+            window.printAll(f[0].createGraphics());
+        });
+        robot.waitForIdle(delay);
+        return f[0];
+    }
+
+    public static boolean checkTranslucencyMode(GraphicsDevice.WindowTranslucency mode) {
+
+        if (!GraphicsEnvironment
+                .getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice()
+                .isWindowTranslucencySupported(mode)){
+            System.out.println(mode+" translucency mode isn't supported");
+            return false;
+        } else {
+            return true;
+        }
+
+    }
+
+    public void applyAppDragNResizeSupport() {
+        MouseAdapter m = new MouseAdapter() {
+
+            private Point dragOrigin = null;
+            private Dimension origSize = null;
+            private Point origLoc = null;
+            private boolean left = false;
+            private boolean top = false;
+            private boolean bottom = false;
+            private boolean right = false;
+
+            public void mousePressed(MouseEvent e) {
+                dragOrigin = e.getLocationOnScreen();
+                origSize = window.getSize();
+                origLoc = window.getLocationOnScreen();
+                right = (origLoc.x + window.getWidth() - dragOrigin.x) < 5;
+                left = !right && dragOrigin.x - origLoc.x < 5;
+                bottom = (origLoc.y + window.getHeight() - dragOrigin.y) < 5;
+                top = !bottom && dragOrigin.y - origLoc.y < 5;
+            }
+
+            public void mouseReleased(MouseEvent e) { resize(e); }
+            public void mouseDragged(MouseEvent e) { resize(e); }
+
+            void resize(MouseEvent e) {
+                Point dragDelta = e.getLocationOnScreen();
+                dragDelta.translate(-dragOrigin.x, -dragOrigin.y);
+                Point newLoc = new Point(origLoc);
+                newLoc.translate(dragDelta.x, dragDelta.y);
+                Dimension newSize = new Dimension(origSize);
+                if (left || right) {
+                    newSize.width += right ? dragDelta.x : -dragDelta.x;
+                }
+                if (top || bottom) {
+                    newSize.height += bottom ? dragDelta.y : -dragDelta.y;
+                }
+                if (right || (top || bottom) && !left) {
+                    newLoc.x = origLoc.x;
+                }
+                if (bottom || (left || right) && !top) {
+                    newLoc.y = origLoc.y;
+                }
+                window.setBounds(newLoc.x, newLoc.y, newSize.width, newSize.height);
+            }
+        };
+        for (Component comp : window.getComponents()) {
+            comp.addMouseListener(m);
+            comp.addMouseMotionListener(m);
+        }
+
+        window.addMouseListener(m);
+        window.addMouseMotionListener(m);
+    }
+
+    public void checkTranslucentShape() throws Exception {
+        foreground = getForegroundWindow();
+        Point[] points = new Point[4];
+
+        Dimension size = window.getSize();
+        Point location = window.getLocationOnScreen();
+
+        points[0] = new Point(20, 20);
+        points[1] = new Point(20, size.height-20);
+        points[2] = new Point(size.width-20, 20);
+        points[3] = new Point(size.width-20, size.height-20);
+
+        for (Point p : points){
+            p.translate(location.x, location.y);
+            Color actual = robot.getPixelColor(p.x, p.y);
+            if (actual.equals(BG_COLOR)|| actual.equals(FG_COLOR))
+                throw new RuntimeException("Error in point "+p+": "+actual+" equals to foreground or background color");
+            else
+                System.out.println("OK with foreground point "+p);
+        }
+    }
+
+    public void checkStaticShape() throws Exception {
+        Point[] points = new Point[4];
+
+        Dimension size = window.getSize();
+        int xFactor = (int) Math.floor(size.getWidth()/STATIC_STEP)-1;
+        int yFactor = (int) Math.floor(size.getHeight()/STATIC_STEP)-1;
+
+        // background
+        points[0] = new Point((STATIC_STEP+STATIC_WIDTH)/2, (STATIC_STEP+STATIC_WIDTH)/2);
+        points[1] = new Point(STATIC_STEP*xFactor+(STATIC_STEP+STATIC_WIDTH)/2, STATIC_STEP*yFactor+(STATIC_STEP+STATIC_WIDTH)/2);
+        points[2] = new Point((STATIC_STEP+STATIC_WIDTH)/2, STATIC_STEP*yFactor+(STATIC_STEP+STATIC_WIDTH)/2);
+        points[3] = new Point(STATIC_STEP*xFactor+(STATIC_STEP+STATIC_WIDTH)/2, (STATIC_STEP+STATIC_WIDTH)/2);
+        checkShape(points, true);
+
+        // foreground
+        if (opacity < 1.0f){
+            checkTranslucentShape();
+        } else {
+            points[0] = new Point((STATIC_WIDTH) / 2, (STATIC_WIDTH) / 2);
+            points[1] = new Point(STATIC_STEP * xFactor + (STATIC_WIDTH) / 2, STATIC_STEP * yFactor + (STATIC_WIDTH) / 2);
+            points[2] = new Point((STATIC_WIDTH) / 2, STATIC_STEP * yFactor + (STATIC_WIDTH) / 2);
+            points[3] = new Point(STATIC_STEP * xFactor + (STATIC_WIDTH) / 2, (STATIC_WIDTH) / 2);
+            checkShape(points, false);
+        }
+    }
+
+    public void checkDynamicShape() throws Exception {
+        Point[] points = new Point[4];
+
+        Dimension size = window.getSize();
+
+        int blockSizeX = (int) (size.getWidth() / 17);
+        int blockSizeY = (int) (size.getHeight() / 17);
+
+        // background
+        points[0] = new Point((int) (blockSizeX * 5.5), (int) (blockSizeY * 5.5));
+        points[1] = new Point((int) (size.getWidth() - blockSizeX * 5.5), (int) (size.getHeight() - blockSizeY * 5.5));
+        points[2] = new Point((int) (blockSizeX * 5.5), (int) (size.getHeight() - blockSizeY * 5.5));
+        points[3] = new Point((int) (size.getWidth() - blockSizeX * 5.5), (int) (blockSizeY * 5.5));
+        checkShape(points, true);
+
+        // foreground
+        if (opacity < 1.0f){
+            checkTranslucentShape();
+        } else {
+            points[0] = new Point(3 * blockSizeX, 3 * blockSizeY);
+            points[1] = new Point(14 * blockSizeX, 14 * blockSizeY);
+            points[2] = new Point(3 * blockSizeX, 14 * blockSizeY);
+            points[3] = new Point(14 * blockSizeX, 3 * blockSizeY);
+            checkShape(points, false);
+        }
+    }
+
+    public void checkShape(Point[] points, boolean areBackgroundPoints) throws Exception {
+
+        Point location = window.getLocationOnScreen();
+
+        for (Point p : points) {
+            p.translate(location.x, location.y);
+            if (areBackgroundPoints) {
+                if (!robot.getPixelColor(p.x, p.y).equals(BG_COLOR))
+                    throw new RuntimeException("Background point " + p + " color " + robot.getPixelColor(p.x, p.y) +
+                            " does not equal to background color " + BG_COLOR);
+                else
+                    System.out.println("OK with background point " + p);
+            } else {
+                if (robot.getPixelColor(p.x, p.y).equals(BG_COLOR))
+                    throw new RuntimeException("Foreground point " + p +
+                            " equals to background color " + BG_COLOR);
+                else
+                    System.out.println("OK with foreground point " + p);
+            }
+        }
+    }
+
+    public void initBackgroundFrame() {
+        background = new Frame();
+        background.setUndecorated(true);
+        background.setBackground(BG_COLOR);
+        background.setSize(500, 500);
+        background.setLocation(dl, dl);
+        background.setVisible(true);
+    }
+
+    public void initGUI() {
+        if (windowClass.equals(Frame.class)) {
+            window = new Frame();
+            ((Frame) window).setUndecorated(true);
+        } else  if (windowClass.equals(Dialog.class)) {
+            window = new Dialog(background);
+            ((Dialog) window).setUndecorated(true);
+        } else {
+            window = new Window(background);
+        }
+
+        window.setBackground(FG_COLOR);
+        componentsContainer = new Panel();
+        window.add(componentsContainer, BorderLayout.CENTER);
+        window.setLocation(2 * dl, 2 * dl);
+        window.setSize(255, 255);
+        if (opacity < 1.0f)
+            window.setOpacity(opacity);
+        window.addComponentListener(new ComponentAdapter() {
+            public void componentResized(ComponentEvent e) {
+                applyShape();
+            }
+        });
+        applyShape();
+        window.setVisible(true);
+        applyAppDragNResizeSupport();
+        window.toFront();
+    }
+}
diff --git a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java
new file mode 100644
index 00000000000..81f94f7839c
--- /dev/null
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowFocusListener;
+import java.awt.geom.Area;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Rectangle2D;
+import java.util.HashMap;
+
+/*
+ * @test
+ * @bug 8013450
+ * @summary Check if the window events (Focus and Activation) are triggered correctly
+ *          when clicked on visible and clipped areas.
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main FocusAWTTest
+ */
+
+public class FocusAWTTest extends Common {
+
+    ExtendedRobot robot;
+    int dx;
+    int dy;
+    static final int x = 20;
+    static final int y = 400;
+
+    static volatile HashMap<String, Boolean> flags = new HashMap<String, Boolean>();
+    static {
+        flags.put("backgroundWindowActivated", false);
+        flags.put("backgroundWindowDeactivated", false);
+        flags.put("backgroundWindowGotFocus", false);
+        flags.put("backgroundWindowLostFocus", false);
+        flags.put("foregroundWindowGotFocus", false);
+        flags.put("foregroundWindowLostFocus", false);
+        flags.put("foregroundWindowActivated", false);
+        flags.put("foregroundWindowDeactivated", false);
+    }
+
+    public static void main(String[] ignored) throws Exception{
+        if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+            for (Class<Window> windowClass: WINDOWS_TO_TEST) {
+                new FocusAWTTest(windowClass).doTest();
+            }
+    }
+
+    public FocusAWTTest(Class windowClass) throws Exception {
+        super(windowClass);
+        this.robot = new ExtendedRobot();
+        robot.waitForIdle();
+        EventQueue.invokeAndWait(() -> {
+            dx = background.getX() - x;
+            dy = background.getY() - y;
+        });
+        robot.waitForIdle();
+    }
+
+    @Override
+    public void initBackgroundFrame() {
+        background = new Frame();
+        background.setSize(300, 300);
+        background.setLocation(x, y);
+        background.setFocusable(true);
+        background.setFocusableWindowState(true);
+
+        background.addWindowFocusListener(new WindowFocusListener() {
+            public void windowGainedFocus(WindowEvent e) { flags.put("backgroundWindowGotFocus", true); }
+            public void windowLostFocus(WindowEvent e) { flags.put("backgroundWindowLostFocus", true); }
+        });
+
+        background.addWindowListener(new WindowAdapter() {
+            public void windowActivated(WindowEvent e) { flags.put("backgroundWindowActivated", true); }
+            public void windowDeactivated(WindowEvent e) { flags.put("backgroundWindowDeactivated", true); }
+        });
+        background.add(new TextArea());
+        background.setVisible(true);
+    }
+
+    @Override
+    public void initGUI() {
+        if (windowClass.equals(Frame.class)) {
+            window = new Frame() {
+                public void paint(Graphics g) {
+                    g.setColor(Color.BLUE);
+                    g.fillRect(0, 0, 200, 200);
+                }
+            };
+            ((Frame) window).setUndecorated(true);
+        } else if (windowClass.equals(Dialog.class)) {
+            window = new Dialog(background) {
+                public void paint(Graphics g) {
+                    g.setColor(Color.BLUE);
+                    g.fillRect(0, 0, 200, 200);
+                }
+            };
+            ((Dialog) window).setUndecorated(true);
+        } else {
+            window = new Window(background) {
+                public void paint(Graphics g) {
+                    g.setColor(Color.BLUE);
+                    g.fillRect(0, 0, 200, 200);
+                }
+            };
+            window.setFocusable(true);
+            window.setFocusableWindowState(true);
+        }
+
+        window.setPreferredSize(new Dimension(200, 200));
+        window.setLocation(70 + dx, 450 + dy);
+        window.setLayout(new BorderLayout());
+
+        window.addWindowFocusListener(new WindowFocusListener() {
+            public void windowGainedFocus(WindowEvent e) { flags.put("foregroundWindowGotFocus", true); }
+            public void windowLostFocus(WindowEvent e) { flags.put("foregroundWindowLostFocus", true); }
+        });
+
+        window.addWindowListener(new WindowAdapter() {
+            public void windowActivated(WindowEvent e) { flags.put("foregroundWindowActivated", true); }
+            public void windowDeactivated(WindowEvent e) { flags.put("foregroundWindowDeactivated", true); }
+        });
+
+        applyShape();
+        window.pack();
+        window.setAlwaysOnTop(true);
+        window.setVisible(true);
+    }
+
+    public void doTest() throws Exception {
+        super.doTest();
+        final Point wls = new Point();
+        final Dimension size = new Dimension();
+        EventQueue.invokeAndWait(() -> {
+            window.requestFocus();
+            wls.setLocation(window.getLocationOnScreen());
+            window.getSize(size);
+        });
+
+        robot.waitForIdle();
+
+        check(wls.x + size.width - 5, wls.y + 5, wls.x + size.width / 3, wls.y + size.height / 3);
+        check(wls.x + size.width / 2, wls.y + size.height / 2, wls.x + size.width * 2 / 3, wls.y + size.height * 2 / 3);
+
+        EventQueue.invokeAndWait(() -> {
+            background.dispose();
+            window.dispose();
+        });
+
+        robot.waitForIdle();
+    }
+
+    @Override
+    public void applyShape() {
+        Shape shape;
+        Area a = new Area(new Rectangle2D.Float(0, 0, 200, 200));
+        GeneralPath gp;
+        gp = new GeneralPath();
+        gp.moveTo(190, 0);
+        gp.lineTo(200, 0);
+        gp.lineTo(200, 10);
+        gp.lineTo(10, 200);
+        gp.lineTo(0, 200);
+        gp.lineTo(0, 190);
+        gp.closePath();
+        a.subtract(new Area(gp));
+        shape = a;
+
+        window.setShape(shape);
+    }
+
+    private void check(int xb, int yb, int xw, int yw) throws Exception {
+        checkClick(xb, yb, "backgroundWindowGotFocus");
+        checkClick(xw, yw, "foregroundWindowGotFocus");
+        checkClick(xb, yb, "foregroundWindowLostFocus");
+        checkClick(xw, yw, "backgroundWindowLostFocus");
+
+        if (window instanceof Dialog || window instanceof Frame) {
+            checkClick(xb, yb, "backgroundWindowActivated");
+            checkClick(xw, yw, "foregroundWindowActivated");
+            checkClick(xb, yb, "foregroundWindowDeactivated");
+            checkClick(xw, yw, "backgroundWindowDeactivated");
+        }
+
+    }
+
+    private void checkClick(int x, int y, String flag) throws Exception {
+        System.out.println("Trying to click point " + x + ", " + y + ", looking for " + flag + " to trigger.");
+
+        flags.put(flag, false);
+
+        robot.mouseMove(x, y);
+        robot.click();
+        int i = 0;
+        while (i < 5000 && !flags.get(flag)) {
+            robot.waitForIdle(50);
+            i += 50;
+        }
+
+        if (!flags.get(flag))
+            throw new RuntimeException(flag + " is not triggered for click on point " + x + ", " + y + " for " + windowClass + "!");
+    }
+}
diff --git a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Shaped.java b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Shaped.java
new file mode 100644
index 00000000000..8061465e51f
--- /dev/null
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Shaped.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+
+/*
+ * @test
+ * @summary Check if dynamically shaped window is moved and resized
+ *          by robot correctly
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main Shaped
+ */
+public class Shaped extends Common{
+
+    public static void main(String[] args) throws Exception {
+        if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+            for (Class<Window> windowClass: WINDOWS_TO_TEST){
+                new Shaped(windowClass).doTest();
+            }
+    }
+
+    public Shaped(Class windowClass) throws Exception{
+        super(windowClass);
+    }
+    public void applyShape(){ applyDynamicShape(); }
+
+    public void doTest() throws Exception{
+        super.doTest();
+
+        checkDynamicShape();
+
+        // Drag
+        Point location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + dl, location.y + 5, location.x + dl + random.nextInt(dl), location.y + random.nextInt(dl));
+        robot.waitForIdle(delay);
+        checkDynamicShape();
+
+        // Resize
+        location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + 4, location.y + 4, location.x + random.nextInt(2*dl)-dl, location.y + random.nextInt(2*dl)-dl);
+        robot.waitForIdle(delay);
+        checkDynamicShape();
+
+        dispose();
+    }
+}
diff --git a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedByAPI.java b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedByAPI.java
new file mode 100644
index 00000000000..00d5193740b
--- /dev/null
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedByAPI.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+
+/*
+ * @test
+ * @summary Check if dynamically shaped window is moved and resized
+ *          using API correctly
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @run main ShapedByAPI
+ */
+public class ShapedByAPI extends Common {
+
+    public static void main(String[] args) throws Exception {
+        if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+            for (Class<Window> windowClass: WINDOWS_TO_TEST){
+                new ShapedByAPI(windowClass).doTest();
+            }
+    }
+
+    public ShapedByAPI(Class windowClass) throws Exception{
+        super(windowClass);
+    }
+    public void applyShape(){ applyDynamicShape(); }
+
+    public void doTest() throws Exception{
+        super.doTest();
+
+        checkDynamicShape();
+
+        EventQueue.invokeAndWait(() -> {
+            Point location = window.getLocationOnScreen();
+            location.translate(random.nextInt(dl), random.nextInt(dl));
+            window.setLocation(location);
+        });
+        robot.waitForIdle(delay);
+        checkDynamicShape();
+
+        EventQueue.invokeAndWait(() -> {
+            Dimension size = window.getSize();
+            window.setSize(size.width+random.nextInt(2*dl)-dl, size.height+random.nextInt(2*dl)-dl);
+        });
+        robot.waitForIdle(delay);
+        checkDynamicShape();
+
+        dispose();
+    }
+}
diff --git a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucent.java b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucent.java
new file mode 100644
index 00000000000..cb98c4450e2
--- /dev/null
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucent.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check if a translucent shaped window is dragged and
+ *          resized correctly.
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main ShapedTranslucent
+ */
+public class ShapedTranslucent extends Common {
+
+    public static void main(String[] args) throws Exception {
+        if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT) &&
+            checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+            for (Class<Window> windowClass: WINDOWS_TO_TEST){
+                new ShapedTranslucent(windowClass).doTest();
+            }
+    }
+
+    public ShapedTranslucent(Class windowClass) throws Exception{
+        super(windowClass, 0.3f);
+    }
+
+    public void applyShape(){ applyDynamicShape(); }
+
+    public void doTest() throws Exception{
+        super.doTest();
+
+        checkDynamicShape();
+
+        // Drag
+        Point location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + dl, location.y + 5, location.x + dl + random.nextInt(dl), location.y + random.nextInt(dl));
+        robot.waitForIdle(delay);
+        checkDynamicShape();
+
+        // Resize
+        location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + 4, location.y + 4, location.x + random.nextInt(2*dl)-dl, location.y + random.nextInt(2*dl)-dl);
+        robot.waitForIdle(delay);
+        checkDynamicShape();
+
+        dispose();
+    }
+}
diff --git a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/StaticallyShaped.java b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/StaticallyShaped.java
new file mode 100644
index 00000000000..7d48847b682
--- /dev/null
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/StaticallyShaped.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+
+/*
+ * @test
+ * @summary Check if statically shaped window is dragged and resized
+ *          correctly.
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main StaticallyShaped
+ */
+
+public class StaticallyShaped extends Common {
+
+    public static void main(String[] args) throws Exception {
+        if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+            for (Class<Window> windowClass: WINDOWS_TO_TEST){
+                new StaticallyShaped(windowClass).doTest();
+            }
+    }
+
+    public StaticallyShaped(Class windowClass) throws Exception{ super(windowClass); }
+    public void applyShape(){ applyStaticShape(); }
+
+    public void doTest() throws Exception{
+        super.doTest();
+
+        checkStaticShape();
+
+        // Drag
+        Point location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + dl, location.y + 5, location.x + dl + random.nextInt(dl), location.y + random.nextInt(dl));
+        robot.waitForIdle(delay);
+        checkStaticShape();
+
+        // Resize
+        location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + 4, location.y + 4, location.x + random.nextInt(2*dl)-dl, location.y + random.nextInt(2*dl)-dl);
+        robot.waitForIdle(delay);
+        checkStaticShape();
+
+        dispose();
+    }
+}
diff --git a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Translucent.java b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Translucent.java
new file mode 100644
index 00000000000..024885362c9
--- /dev/null
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Translucent.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check if translucent window is dragged and resized
+            correctly.
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main Translucent
+ */
+public class Translucent extends Common {
+
+    public static void main(String[] args) throws Exception {
+        if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT) &&
+            checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+            for (Class<Window> windowClass: WINDOWS_TO_TEST){
+                new Translucent(windowClass).doTest();
+            }
+    }
+
+    public Translucent(Class windowClass) throws Exception{
+        super(windowClass, 0.3f);
+    }
+
+    public void applyShape(){ }
+
+    public void doTest() throws Exception{
+        super.doTest();
+
+        checkTranslucentShape();
+
+        // Drag
+        Point location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + dl, location.y + 5, location.x + dl + random.nextInt(dl), location.y + random.nextInt(dl));
+        robot.waitForIdle(delay);
+        checkTranslucentShape();
+
+        // Resize
+        location = window.getLocationOnScreen();
+        robot.dragAndDrop(location.x + 4, location.y + 4, location.x + random.nextInt(2*dl)-dl, location.y + random.nextInt(2*dl)-dl);
+        robot.waitForIdle(delay);
+        checkTranslucentShape();
+
+        dispose();
+        robot.waitForIdle(delay);
+    }
+}
diff --git a/jdk/test/lib/testlibrary/ExtendedRobot.java b/jdk/test/lib/testlibrary/ExtendedRobot.java
index d28aca0f642..725bd82c7a8 100644
--- a/jdk/test/lib/testlibrary/ExtendedRobot.java
+++ b/jdk/test/lib/testlibrary/ExtendedRobot.java
@@ -25,7 +25,6 @@
 
 import sun.awt.ExtendedKeyCodes;
 import sun.awt.SunToolkit;
-import sun.security.action.GetIntegerAction;
 
 import java.awt.AWTException;
 import java.awt.Robot;
@@ -34,8 +33,6 @@ import java.awt.Toolkit;
 import java.awt.Point;
 import java.awt.MouseInfo;
 import java.awt.event.InputEvent;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 
 /**
  * ExtendedRobot is a subclass of {@link java.awt.Robot}. It provides some convenience methods that are
@@ -312,6 +309,48 @@ public class ExtendedRobot extends Robot {
         mouseMove(position.x, position.y);
     }
 
+
+    /**
+     * Emulate native drag and drop process using {@code InputEvent.BUTTON1_DOWN_MASK}.
+     * The method successively moves mouse cursor to point with coordinates
+     * ({@code fromX}, {@code fromY}), presses mouse button 1, drag mouse to
+     * point with coordinates ({@code toX}, {@code toY}) and releases mouse
+     * button 1 at last.
+     *
+     * @param   fromX   Source point x coordinate
+     * @param   fromY   Source point y coordinate
+     * @param   toX     Destination point x coordinate
+     * @param   toY     Destination point y coordinate
+     *
+     * @see     #mousePress(int)
+     * @see     #glide(int, int, int, int)
+     */
+    public void dragAndDrop(int fromX, int fromY, int toX, int toY){
+        mouseMove(fromX, fromY);
+        mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        waitForIdle();
+        glide(toX, toY);
+        mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        waitForIdle();
+    }
+
+    /**
+     * Emulate native drag and drop process using {@code InputEvent.BUTTON1_DOWN_MASK}.
+     * The method successively moves mouse cursor to point {@code from},
+     * presses mouse button 1, drag mouse to point {@code to} and releases
+     * mouse button 1 at last.
+     *
+     * @param   from    Source point
+     * @param   to      Destination point
+     *
+     * @see     #mousePress(int)
+     * @see     #glide(int, int, int, int)
+     * @see     #dragAndDrop(int, int, int, int)
+     */
+    public void dragAndDrop(Point from, Point to){
+        dragAndDrop(from.x, from.y, to.x, to.y);
+    }
+
     /**
      * Successively presses and releases a given key.
      * <p>
-- 
GitLab


From 4239598cedeb7ad875077f6ffb7fb71ac27d6782 Mon Sep 17 00:00:00 2001
From: Peter Brunet <peter.brunet@oracle.com>
Date: Mon, 26 May 2014 16:37:25 +0400
Subject: [PATCH 023/192] 8009883: REGRESSION:
 test/closed/javax/swing/AbstractButton/4246045/bug4246045.java fails

Remove redundant focus handler that was causing a second focus event

Reviewed-by: alexsch, pchelko
---
 jdk/src/share/classes/javax/swing/JComponent.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java
index 4eb85b23a53..c7bd205aac6 100644
--- a/jdk/src/share/classes/javax/swing/JComponent.java
+++ b/jdk/src/share/classes/javax/swing/JComponent.java
@@ -3679,8 +3679,8 @@ public abstract class JComponent extends Container implements Serializable,
         private volatile transient int propertyListenersCount = 0;
 
         /**
-         * This field duplicates the one in java.awt.Component.AccessibleAWTComponent,
-         * so it has been deprecated.
+         * This field duplicates the function of the accessibleAWTFocusHandler field
+         * in java.awt.Component.AccessibleAWTComponent, so it has been deprecated.
          */
         @Deprecated
         protected FocusListener accessibleFocusHandler = null;
@@ -3738,14 +3738,10 @@ public abstract class JComponent extends Container implements Serializable,
          * @param listener  the PropertyChangeListener to be added
          */
         public void addPropertyChangeListener(PropertyChangeListener listener) {
-            if (accessibleFocusHandler == null) {
-                accessibleFocusHandler = new AccessibleFocusHandler();
-            }
             if (accessibleContainerHandler == null) {
                 accessibleContainerHandler = new AccessibleContainerHandler();
             }
             if (propertyListenersCount++ == 0) {
-                JComponent.this.addFocusListener(accessibleFocusHandler);
                 JComponent.this.addContainerListener(accessibleContainerHandler);
             }
             super.addPropertyChangeListener(listener);
@@ -3760,7 +3756,6 @@ public abstract class JComponent extends Container implements Serializable,
          */
         public void removePropertyChangeListener(PropertyChangeListener listener) {
             if (--propertyListenersCount == 0) {
-                JComponent.this.removeFocusListener(accessibleFocusHandler);
                 JComponent.this.removeContainerListener(accessibleContainerHandler);
             }
             super.removePropertyChangeListener(listener);
-- 
GitLab


From 13c62bc476fd73d92ebf279aeee06078d6ed084b Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Mon, 26 May 2014 18:01:59 +0400
Subject: [PATCH 024/192] 8019180: Use JComboBox as it's own ActionListener
 leads to unexpected behaviour

Reviewed-by: alexsch, serb
---
 .../share/classes/javax/swing/JComboBox.java  | 16 +++--
 .../swing/JComboBox/8019180/Test8019180.java  | 68 +++++++++++++++++++
 2 files changed, 77 insertions(+), 7 deletions(-)
 create mode 100644 jdk/test/javax/swing/JComboBox/8019180/Test8019180.java

diff --git a/jdk/src/share/classes/javax/swing/JComboBox.java b/jdk/src/share/classes/javax/swing/JComboBox.java
index ceec992b31d..febc6b8e576 100644
--- a/jdk/src/share/classes/javax/swing/JComboBox.java
+++ b/jdk/src/share/classes/javax/swing/JComboBox.java
@@ -1308,13 +1308,15 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
      * do not call or override.
      */
     public void actionPerformed(ActionEvent e) {
-        Object newItem = getEditor().getItem();
-        setPopupVisible(false);
-        getModel().setSelectedItem(newItem);
-        String oldCommand = getActionCommand();
-        setActionCommand("comboBoxEdited");
-        fireActionEvent();
-        setActionCommand(oldCommand);
+        ComboBoxEditor editor = getEditor();
+        if ((editor != null) && (e != null) && (editor == e.getSource())) {
+            setPopupVisible(false);
+            getModel().setSelectedItem(editor.getItem());
+            String oldCommand = getActionCommand();
+            setActionCommand("comboBoxEdited");
+            fireActionEvent();
+            setActionCommand(oldCommand);
+        }
     }
 
     /**
diff --git a/jdk/test/javax/swing/JComboBox/8019180/Test8019180.java b/jdk/test/javax/swing/JComboBox/8019180/Test8019180.java
new file mode 100644
index 00000000000..d089f998eb3
--- /dev/null
+++ b/jdk/test/javax/swing/JComboBox/8019180/Test8019180.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+/*
+ * @test
+ * @bug 8019180
+ * @summary Tests that combobox works if it is used as action listener
+ * @author Sergey Malenkov
+ */
+
+public class Test8019180 implements Runnable {
+    private static final CountDownLatch LATCH = new CountDownLatch(1);
+    private static final String[] ITEMS = {"First", "Second", "Third", "Fourth"};
+
+    public static void main(String[] args) throws InterruptedException {
+        SwingUtilities.invokeLater(new Test8019180());
+        LATCH.await();
+    }
+
+    private JComboBox<String> test;
+
+    @Override
+    public void run() {
+        if (this.test == null) {
+            this.test = new JComboBox<>(ITEMS);
+            this.test.addActionListener(this.test);
+            JFrame frame = new JFrame();
+            frame.add(test);
+            frame.pack();
+            frame.setVisible(true);
+            SwingUtilities.invokeLater(this);
+        } else {
+            int index = this.test.getSelectedIndex();
+            this.test.setSelectedIndex(1 + index);
+            if (0 > this.test.getSelectedIndex()) {
+                System.err.println("ERROR: no selection");
+                System.exit(8019180);
+            }
+            SwingUtilities.getWindowAncestor(this.test).dispose();
+            LATCH.countDown();
+        }
+    }
+}
-- 
GitLab


From 2a52417897a5667233b09043a529a22a50163706 Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Tue, 27 May 2014 12:50:51 -0700
Subject: [PATCH 025/192] 8035301: Eliminate dependency on sun.text from font
 code

Reviewed-by: mchung, jgodinez
---
 jdk/src/share/classes/java/awt/font/StyledParagraph.java        | 2 +-
 jdk/src/share/classes/java/awt/font/TextLayout.java             | 2 +-
 jdk/src/share/classes/java/awt/font/TextLine.java               | 2 +-
 jdk/src/share/classes/sun/{text => font}/CodePointIterator.java | 2 +-
 jdk/src/share/classes/sun/font/FontResolver.java                | 1 -
 5 files changed, 4 insertions(+), 5 deletions(-)
 rename jdk/src/share/classes/sun/{text => font}/CodePointIterator.java (99%)

diff --git a/jdk/src/share/classes/java/awt/font/StyledParagraph.java b/jdk/src/share/classes/java/awt/font/StyledParagraph.java
index 2087fa09455..380fa36e918 100644
--- a/jdk/src/share/classes/java/awt/font/StyledParagraph.java
+++ b/jdk/src/share/classes/java/awt/font/StyledParagraph.java
@@ -38,9 +38,9 @@ import java.text.AttributedCharacterIterator.Attribute;
 import java.util.Vector;
 import java.util.HashMap;
 import java.util.Map;
+import sun.font.CodePointIterator;
 import sun.font.Decoration;
 import sun.font.FontResolver;
-import sun.text.CodePointIterator;
 
 /**
  * This class stores Font, GraphicAttribute, and Decoration intervals
diff --git a/jdk/src/share/classes/java/awt/font/TextLayout.java b/jdk/src/share/classes/java/awt/font/TextLayout.java
index 08d779427a1..45da5af89c6 100644
--- a/jdk/src/share/classes/java/awt/font/TextLayout.java
+++ b/jdk/src/share/classes/java/awt/font/TextLayout.java
@@ -60,13 +60,13 @@ import java.util.Map;
 import java.util.HashMap;
 import java.util.Hashtable;
 import sun.font.AttributeValues;
+import sun.font.CodePointIterator;
 import sun.font.CoreMetrics;
 import sun.font.Decoration;
 import sun.font.FontLineMetrics;
 import sun.font.FontResolver;
 import sun.font.GraphicComponent;
 import sun.font.LayoutPathImpl;
-import sun.text.CodePointIterator;
 
 /**
  *
diff --git a/jdk/src/share/classes/java/awt/font/TextLine.java b/jdk/src/share/classes/java/awt/font/TextLine.java
index 9efcdc32de2..c1c4e899997 100644
--- a/jdk/src/share/classes/java/awt/font/TextLine.java
+++ b/jdk/src/share/classes/java/awt/font/TextLine.java
@@ -50,6 +50,7 @@ import java.util.Hashtable;
 import java.util.Map;
 import sun.font.AttributeValues;
 import sun.font.BidiUtils;
+import sun.font.CodePointIterator;
 import sun.font.CoreMetrics;
 import sun.font.Decoration;
 import sun.font.FontLineMetrics;
@@ -60,7 +61,6 @@ import sun.font.LayoutPathImpl.EmptyPath;
 import sun.font.LayoutPathImpl.SegmentPathBuilder;
 import sun.font.TextLabelFactory;
 import sun.font.TextLineComponent;
-import sun.text.CodePointIterator;
 
 import java.awt.geom.Line2D;
 
diff --git a/jdk/src/share/classes/sun/text/CodePointIterator.java b/jdk/src/share/classes/sun/font/CodePointIterator.java
similarity index 99%
rename from jdk/src/share/classes/sun/text/CodePointIterator.java
rename to jdk/src/share/classes/sun/font/CodePointIterator.java
index 519ad9e93b3..179e049db60 100644
--- a/jdk/src/share/classes/sun/text/CodePointIterator.java
+++ b/jdk/src/share/classes/sun/font/CodePointIterator.java
@@ -33,7 +33,7 @@
  * patents. This notice and attribution to IBM may not be removed.
  */
 
-package sun.text;
+package sun.font;
 
 import java.text.CharacterIterator;
 
diff --git a/jdk/src/share/classes/sun/font/FontResolver.java b/jdk/src/share/classes/sun/font/FontResolver.java
index b5d2fe9077d..607dc804cfa 100644
--- a/jdk/src/share/classes/sun/font/FontResolver.java
+++ b/jdk/src/share/classes/sun/font/FontResolver.java
@@ -36,7 +36,6 @@ import java.awt.font.TextAttribute;
 import java.text.AttributedCharacterIterator;
 import java.util.ArrayList;
 import java.util.Map;
-import sun.text.CodePointIterator;
 
 /**
  * This class maps an individual character to a Font family which can
-- 
GitLab


From d674dee4f2676d684ceb6da3bea4cdc324d49bef Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy <alexsch@openjdk.org>
Date: Wed, 28 May 2014 15:36:10 +0400
Subject: [PATCH 026/192] 8043705: Can't exit color chooser dialog when running
 as an applet

Reviewed-by: serb, pchelko
---
 .../classes/sun/awt/windows/WWindowPeer.java  |   5 +-
 .../windows/native/sun/windows/awt_Dialog.cpp |   3 +-
 .../Dialog/CloseDialog/CloseDialogTest.java   | 116 ++++++++++++++++++
 3 files changed, 121 insertions(+), 3 deletions(-)
 create mode 100644 jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java

diff --git a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
index 33f27ac5694..51bf8379408 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
@@ -450,8 +450,9 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
      * active window is always at the end.
      */
     @SuppressWarnings("unchecked")
-    public static long[] getActiveWindowHandles() {
-        AppContext appContext = AppContext.getAppContext();
+    public static long[] getActiveWindowHandles(Component target) {
+        AppContext appContext = SunToolkit.targetToAppContext(target);
+        if (appContext == null) return null;
         synchronized (appContext) {
             List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
             if (l == null) {
diff --git a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp
index cbba78e3b7b..7bb201b49af 100644
--- a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp
@@ -464,7 +464,8 @@ void AwtDialog::ModalActivateNextWindow(HWND dialogHWnd,
                                              &exc,
                                              "sun/awt/windows/WWindowPeer",
                                              "getActiveWindowHandles",
-                                             "()[J").l;
+                                             "(Ljava/awt/Component;)[J",
+                                             dialogTarget).l;
     if (exc == JNI_TRUE) {
         throw std::bad_alloc();
     }
diff --git a/jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java b/jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java
new file mode 100644
index 00000000000..0a6288d896d
--- /dev/null
+++ b/jdk/test/java/awt/Dialog/CloseDialog/CloseDialogTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.io.*;
+import javax.swing.*;
+import sun.awt.SunToolkit;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * @test
+ * @bug 8043705
+ * @summary Can't exit color chooser dialog when running as an applet
+ * @run main CloseDialogTest
+ */
+public class CloseDialogTest {
+
+    private static volatile Frame frame;
+    private static volatile Dialog dialog;
+    private static volatile InputStream testErrorStream;
+    private static final PrintStream systemErrStream = System.err;
+    private static final AtomicReference<Exception> caughtException
+            = new AtomicReference<>();
+
+    public static void main(String[] args) throws Exception {
+
+        // redirect System err
+        PipedOutputStream errorOutputStream = new PipedOutputStream();
+        testErrorStream = new PipedInputStream(errorOutputStream);
+        System.setErr(new PrintStream(errorOutputStream));
+
+        ThreadGroup swingTG = new ThreadGroup(getRootThreadGroup(), "SwingTG");
+        try {
+            new Thread(swingTG, () -> {
+                SunToolkit.createNewAppContext();
+                SwingUtilities.invokeLater(() -> {
+                    frame = new Frame();
+                    frame.setSize(300, 300);
+                    frame.setVisible(true);
+
+                    dialog = new Dialog(frame);
+                    dialog.setSize(200, 200);
+                    dialog.setModal(true);
+                    dialog.setVisible(true);
+                });
+            }).start();
+
+            Thread.sleep(400);
+
+            Thread disposeThread = new Thread(swingTG, () ->
+                    SwingUtilities.invokeLater(() -> {
+                try {
+                    while (dialog == null || !dialog.isVisible()) {
+                        Thread.sleep(100);
+                    }
+                    dialog.setVisible(false);
+                    dialog.dispose();
+                    frame.dispose();
+                } catch (Exception e) {
+                    caughtException.set(e);
+                }
+            }));
+            disposeThread.start();
+            disposeThread.join();
+            Thread.sleep(500);
+
+            // read System err
+            final char[] buffer = new char[2048];
+            System.err.print("END");
+            System.setErr(systemErrStream);
+            try (Reader in = new InputStreamReader(testErrorStream, "UTF-8")) {
+                int size = in.read(buffer, 0, buffer.length);
+                String errorString = new String(buffer, 0, size);
+                if (!errorString.startsWith("END")) {
+                    System.err.println(errorString.
+                            substring(0, errorString.length() - 4));
+                    throw new RuntimeException("Error output is not empty!");
+                }
+            }
+        } finally {
+            if (caughtException.get() != null) {
+                throw new RuntimeException("Failed. Caught exception!",
+                        caughtException.get());
+            }
+        }
+    }
+
+    private static ThreadGroup getRootThreadGroup() {
+        ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+        while (threadGroup.getParent() != null) {
+            threadGroup = threadGroup.getParent();
+        }
+        return threadGroup;
+    }
+}
-- 
GitLab


From 86e0ce97e6364a898dbc575dcb184e69ae5a92e5 Mon Sep 17 00:00:00 2001
From: Anton Nashatyrev <anashaty@openjdk.org>
Date: Thu, 29 May 2014 17:31:41 +0400
Subject: [PATCH 027/192] 8028617: Dvorak keyboard mapping not honored when
 ctrl key pressed

Reviewed-by: pchelko, anthony
---
 .../classes/sun/lwawt/macosx/CEmbeddedFrame.java       |  3 ++-
 .../classes/sun/lwawt/macosx/CPlatformResponder.java   |  7 +++++--
 .../macosx/classes/sun/lwawt/macosx/CPlatformView.java |  2 +-
 jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java   | 10 ++++++++--
 jdk/src/macosx/native/sun/awt/AWTView.m                |  7 +++++--
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
index dd718c0ca0b..c241aae3cc0 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
@@ -97,7 +97,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
     public void handleKeyEvent(int eventType, int modifierFlags, String characters,
                                String charsIgnoringMods, boolean isRepeat, short keyCode,
                                boolean needsKeyTyped) {
-        responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped, isRepeat);
+        responder.handleKeyEvent(eventType, modifierFlags, characters, charsIgnoringMods,
+                keyCode, needsKeyTyped, isRepeat);
     }
 
     public void handleInputEvent(String text) {
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
index d8d1555450c..591c16d2879 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
@@ -125,7 +125,7 @@ final class CPlatformResponder {
     /**
      * Handles key events.
      */
-    void handleKeyEvent(int eventType, int modifierFlags, String chars,
+    void handleKeyEvent(int eventType, int modifierFlags, String chars, String charsIgnoringModifiers,
                         short keyCode, boolean needsKeyTyped, boolean needsKeyReleased) {
         boolean isFlagsChangedEvent =
             isNpapiCallback ? (eventType == CocoaConstants.NPCocoaEventFlagsChanged) :
@@ -153,7 +153,10 @@ final class CPlatformResponder {
                 testChar = chars.charAt(0);
             }
 
-            int[] in = new int[] {testChar, isDeadChar ? 1 : 0, modifierFlags, keyCode};
+            char testCharIgnoringModifiers = charsIgnoringModifiers != null && charsIgnoringModifiers.length() > 0 ?
+                    charsIgnoringModifiers.charAt(0) : KeyEvent.CHAR_UNDEFINED;
+
+            int[] in = new int[] {testCharIgnoringModifiers, isDeadChar ? 1 : 0, modifierFlags, keyCode};
             int[] out = new int[3]; // [jkeyCode, jkeyLocation, deadChar]
 
             postsTyped = NSEvent.nsToJavaKeyInfo(in, out);
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
index e81371b4751..3c2cd2325e4 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
@@ -200,7 +200,7 @@ public class CPlatformView extends CFRetainedResource {
     }
 
     private void deliverKeyEvent(NSEvent event) {
-        responder.handleKeyEvent(event.getType(), event.getModifierFlags(),
+        responder.handleKeyEvent(event.getType(), event.getModifierFlags(), event.getCharacters(),
                                  event.getCharactersIgnoringModifiers(), event.getKeyCode(), true, false);
     }
 
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java b/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
index ddb74d42b02..d30a39cdfb9 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
@@ -47,13 +47,15 @@ final class NSEvent {
 
     // Key event information
     private short keyCode;
+    private String characters;
     private String charactersIgnoringModifiers;
 
     // Called from native
-    NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
+    NSEvent(int type, int modifierFlags, short keyCode, String characters, String charactersIgnoringModifiers) {
         this.type = type;
         this.modifierFlags = modifierFlags;
         this.keyCode = keyCode;
+        this.characters = characters;
         this.charactersIgnoringModifiers = charactersIgnoringModifiers;
     }
 
@@ -121,12 +123,16 @@ final class NSEvent {
         return charactersIgnoringModifiers;
     }
 
+    String getCharacters() {
+        return characters;
+    }
+
     @Override
     public String toString() {
         return "NSEvent[" + getType() + " ," + getModifierFlags() + " ,"
                 + getClickCount() + " ," + getButtonNumber() + " ," + getX() + " ,"
                 + getY() + " ," + getAbsX() + " ," + getAbsY()+ " ," + getKeyCode() + " ,"
-                + getCharactersIgnoringModifiers() + "]";
+                + getCharacters() + " ," + getCharactersIgnoringModifiers() + "]";
     }
 
     /*
diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m
index 830fb77e82b..a59ff1a51ae 100644
--- a/jdk/src/macosx/native/sun/awt/AWTView.m
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m
@@ -440,17 +440,20 @@ AWT_ASSERT_APPKIT_THREAD;
     JNIEnv *env = [ThreadUtilities getJNIEnv];
 
     jstring characters = NULL;
+    jstring charactersIgnoringModifiers = NULL;
     if ([event type] != NSFlagsChanged) {
         characters = JNFNSToJavaString(env, [event characters]);
+        charactersIgnoringModifiers = JNFNSToJavaString(env, [event charactersIgnoringModifiers]);
     }
 
     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
-    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
+    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;Ljava/lang/String;)V");
     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
                                   [event modifierFlags],
                                   [event keyCode],
-                                  characters);
+                                  characters,
+                                  charactersIgnoringModifiers);
     CHECK_NULL(jEvent);
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
-- 
GitLab


From db6fa669549e17c09452df05972542f69970cbaa Mon Sep 17 00:00:00 2001
From: Anton Nashatyrev <anashaty@openjdk.org>
Date: Fri, 30 May 2014 11:20:03 +0400
Subject: [PATCH 028/192] 8032788: ImageIcon constructor throws an NPE and
 hangs when passed a null String parameter

Reviewed-by: pchelko, serb
---
 .../sun/awt/image/FileImageSource.java        |  4 ++
 jdk/test/java/awt/image/ImageIconHang.java    | 48 +++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 jdk/test/java/awt/image/ImageIconHang.java

diff --git a/jdk/src/share/classes/sun/awt/image/FileImageSource.java b/jdk/src/share/classes/sun/awt/image/FileImageSource.java
index f448b0723ce..8f75aa81b1c 100644
--- a/jdk/src/share/classes/sun/awt/image/FileImageSource.java
+++ b/jdk/src/share/classes/sun/awt/image/FileImageSource.java
@@ -48,6 +48,10 @@ public class FileImageSource extends InputStreamImageSource {
     }
 
     protected ImageDecoder getDecoder() {
+        if (imagefile == null) {
+            return null;
+        }
+
         InputStream is;
         try {
             is = new BufferedInputStream(new FileInputStream(imagefile));
diff --git a/jdk/test/java/awt/image/ImageIconHang.java b/jdk/test/java/awt/image/ImageIconHang.java
new file mode 100644
index 00000000000..25d6a219d39
--- /dev/null
+++ b/jdk/test/java/awt/image/ImageIconHang.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @bug     8032788
+ * @summary Checks that null filename argument is processed correctly
+ *
+ * @run     main ImageIconHang
+ */
+public class ImageIconHang {
+    public static void main(String[] args) throws Exception {
+        Image image = Toolkit.getDefaultToolkit().getImage((String) null);
+        MediaTracker mt = new MediaTracker(new Component() {});
+        mt.addImage(image, 1);
+        mt.waitForID(1, 5000);
+
+        int status = mt.statusID(1, false);
+
+        System.out.println("Status: " + status);
+
+        if (status != MediaTracker.ERRORED) {
+            throw new RuntimeException("MediaTracker.waitForID() hung.");
+        }
+    }
+}
-- 
GitLab


From 7f80153eb206011d7b7b8294bfcd9fb47c9809a3 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Fri, 30 May 2014 14:06:50 +0400
Subject: [PATCH 029/192] 8040113: File not initialized in
 src/share/native/sun/awt/giflib/dgif_lib.c

Reviewed-by: pchelko, prr
---
 jdk/src/share/native/sun/awt/giflib/dgif_lib.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/jdk/src/share/native/sun/awt/giflib/dgif_lib.c b/jdk/src/share/native/sun/awt/giflib/dgif_lib.c
index 1a9e2cce125..d6d2a3ce448 100644
--- a/jdk/src/share/native/sun/awt/giflib/dgif_lib.c
+++ b/jdk/src/share/native/sun/awt/giflib/dgif_lib.c
@@ -195,6 +195,11 @@ DGifOpen(void *userData,
     GifFileType *GifFile;
     GifFilePrivateType *Private;
 
+    if (!readFunc) {
+        _GifError = D_GIF_ERR_READ_FAILED;
+        return NULL;
+    }
+
     GifFile = (GifFileType *)malloc(sizeof(GifFileType));
     if (GifFile == NULL) {
         _GifError = D_GIF_ERR_NOT_ENOUGH_MEM;
-- 
GitLab


From a666497db87eb504e772f29bcb419d932b068504 Mon Sep 17 00:00:00 2001
From: Yuri Nesterenko <yan@openjdk.org>
Date: Fri, 30 May 2014 14:23:25 +0400
Subject: [PATCH 030/192] 8044172: [TEST_BUG] Move regtests for 4523758 and
 AltPlusNumberKeyCombinationsTest to jdk

Reviewed-by: pchelko
---
 .../AltPlusNumberKeyCombinationsTest.java     | 307 ++++++++++++++++++
 .../swing/JComboBox/4523758/bug4523758.java   | 182 +++++++++++
 2 files changed, 489 insertions(+)
 create mode 100644 jdk/test/java/awt/keyboard/AltPlusNumberKeyCombinationsTest/AltPlusNumberKeyCombinationsTest.java
 create mode 100644 jdk/test/javax/swing/JComboBox/4523758/bug4523758.java

diff --git a/jdk/test/java/awt/keyboard/AltPlusNumberKeyCombinationsTest/AltPlusNumberKeyCombinationsTest.java b/jdk/test/java/awt/keyboard/AltPlusNumberKeyCombinationsTest/AltPlusNumberKeyCombinationsTest.java
new file mode 100644
index 00000000000..9088018e258
--- /dev/null
+++ b/jdk/test/java/awt/keyboard/AltPlusNumberKeyCombinationsTest/AltPlusNumberKeyCombinationsTest.java
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * Test that it is possible to type "Alt code" on Windows.
+ * Windows-only test.
+ */
+/*
+@test
+@summary Test that it is possible to type "Alt code" on Windows.
+@library ../../../../lib/testlibrary
+@build ExtendedRobot
+@run main AltPlusNumberKeyCombinationsTest
+*/
+public class AltPlusNumberKeyCombinationsTest {
+
+    private Frame frame;
+    private TextField tf;
+    private TextArea ta;
+
+    private static int delay = 500;
+    private static String euroChar = "\u20AC";
+    private static String accChar = "\u00E3";
+
+    private boolean passed = true;
+    private ExtendedRobot robot;
+
+    public AltPlusNumberKeyCombinationsTest() {
+        try {
+            Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(new Runnable() {
+                public void run() {
+                    initializeGUI();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Test failed;", e.getCause());
+        }
+    }
+
+    private void initializeGUI() {
+        frame = new Frame("AltPlusNumberKeyCombinationsTest");
+        frame.setLayout(new FlowLayout());
+
+        tf = new TextField(15);
+        frame.add(tf);
+
+        ta = new TextArea(8, 20);
+        frame.add(ta);
+
+        frame.setSize(250,400);
+        frame.setVisible(true);
+    }
+
+
+    private void doTest() throws Exception {
+        robot = new ExtendedRobot();
+        robot.setAutoDelay(100);
+
+        robot.waitForIdle(delay);
+
+        robot.mouseMove((int) ta.getLocationOnScreen().x + ta.getSize().width / 2,
+                        (int) ta.getLocationOnScreen().y + ta.getSize().height / 2);
+        robot.waitForIdle(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_RIGHT);
+        robot.keyRelease(KeyEvent.VK_RIGHT);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        robot.waitForIdle(delay);
+
+        if (! "".equals(ta.getText())) {
+            System.err.println("FAIL: Symbol typed in the text area when ALT + RIGHT ARROW keys typed");
+            passed = false;
+        }
+
+        try {
+            Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(new Runnable() {
+                public void run() {
+                    ta.setText("");
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Test failed;", e.getCause());
+        }
+
+        // getLockingKeyState works on Windows;
+        // Alt code only make sense on Windows;
+        // so don't check availability of this and just use it.
+        if( Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_NUM_LOCK) ) {
+            robot.keyPress(KeyEvent.VK_NUM_LOCK);
+            robot.keyRelease(KeyEvent.VK_NUM_LOCK);
+        }
+
+        robot.mouseMove((int) tf.getLocationOnScreen().x + tf.getSize().width / 2,
+                        (int) tf.getLocationOnScreen().y + tf.getSize().height / 2);
+        robot.waitForIdle(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_NUMPAD0);
+        robot.keyRelease(KeyEvent.VK_NUMPAD0);
+        robot.keyPress(KeyEvent.VK_NUMPAD1);
+        robot.keyRelease(KeyEvent.VK_NUMPAD1);
+        robot.keyPress(KeyEvent.VK_NUMPAD2);
+        robot.keyRelease(KeyEvent.VK_NUMPAD2);
+        robot.keyPress(KeyEvent.VK_NUMPAD8);
+        robot.keyRelease(KeyEvent.VK_NUMPAD8);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        robot.waitForIdle(delay);
+
+        if (! euroChar.equals(tf.getText())) {
+            System.err.println("FAIL: Euro symbol not typed in the text field when " +
+                               "ALT + NUMPAD 1,2,8 keys typed");
+            passed = false;
+        }
+
+        try {
+            Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(new Runnable() {
+                public void run() {
+                    tf.setText("");
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Test failed;", e.getCause());
+        }
+
+        robot.mouseMove((int) ta.getLocationOnScreen().x + ta.getSize().width / 2,
+                        (int) ta.getLocationOnScreen().y + ta.getSize().height / 2);
+        robot.waitForIdle(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_NUMPAD0);
+        robot.keyRelease(KeyEvent.VK_NUMPAD0);
+        robot.keyPress(KeyEvent.VK_NUMPAD1);
+        robot.keyRelease(KeyEvent.VK_NUMPAD1);
+        robot.keyPress(KeyEvent.VK_NUMPAD2);
+        robot.keyRelease(KeyEvent.VK_NUMPAD2);
+        robot.keyPress(KeyEvent.VK_NUMPAD8);
+        robot.keyRelease(KeyEvent.VK_NUMPAD8);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        robot.waitForIdle(delay);
+
+        if (! euroChar.equals(ta.getText())) {
+            System.err.println("FAIL: Euro symbol not typed in the text area when " +
+                               "ALT + NUMPAD 1,2,8 keys typed");
+            passed = false;
+        }
+
+        try {
+            Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(new Runnable() {
+                public void run() {
+                    ta.setText("");
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Test failed;", e.getCause());
+        }
+
+        robot.mouseMove((int) tf.getLocationOnScreen().x + tf.getSize().width / 2,
+                        (int) tf.getLocationOnScreen().y + tf.getSize().height / 2);
+        robot.waitForIdle(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_NUMPAD0);
+        robot.keyRelease(KeyEvent.VK_NUMPAD0);
+        robot.keyPress(KeyEvent.VK_NUMPAD2);
+        robot.keyRelease(KeyEvent.VK_NUMPAD2);
+        robot.keyPress(KeyEvent.VK_NUMPAD2);
+        robot.keyRelease(KeyEvent.VK_NUMPAD2);
+        robot.keyPress(KeyEvent.VK_NUMPAD7);
+        robot.keyRelease(KeyEvent.VK_NUMPAD7);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        robot.waitForIdle(delay);
+
+        if (! accChar.equals(tf.getText())) {
+            System.err.println("FAIL: Symbol not typed in the text field when " +
+                               "ALT + NUMPAD 2,2,7 keys typed");
+            passed = false;
+        }
+
+        try {
+            Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(new Runnable() {
+                public void run() {
+                    tf.setText("");
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Test failed;", e.getCause());
+        }
+
+        robot.mouseMove((int) ta.getLocationOnScreen().x + ta.getSize().width / 2,
+                        (int) ta.getLocationOnScreen().y + ta.getSize().height / 2);
+        robot.waitForIdle(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_NUMPAD0);
+        robot.keyRelease(KeyEvent.VK_NUMPAD0);
+        robot.keyPress(KeyEvent.VK_NUMPAD2);
+        robot.keyRelease(KeyEvent.VK_NUMPAD2);
+        robot.keyPress(KeyEvent.VK_NUMPAD2);
+        robot.keyRelease(KeyEvent.VK_NUMPAD2);
+        robot.keyPress(KeyEvent.VK_NUMPAD7);
+        robot.keyRelease(KeyEvent.VK_NUMPAD7);
+        robot.keyRelease(KeyEvent.VK_ALT);
+
+        robot.waitForIdle(delay);
+
+        if (! accChar.equals(ta.getText())) {
+            System.err.println("FAIL: Symbol not typed in the text field when " +
+                               "ALT + NUMPAD 2,2,7 keys typed");
+            passed = false;
+        }
+
+        try {
+            Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(new Runnable() {
+                public void run() {
+                    ta.setText("");
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Test failed;", e.getCause());
+        }
+
+        if (! passed) {
+            System.err.println("Test failed");
+            captureScreenAndSave();
+            throw new RuntimeException("Test failed");
+        } else {
+            System.out.println("Test passed");
+        }
+    }
+
+    public static void main(String[] args) {
+        if (System.getProperty("os.name").indexOf("Win") == -1) {
+            System.out.println("This test is supposed to be run only on Windows! Marking as passed..");
+            return;
+        }
+        try {
+            AltPlusNumberKeyCombinationsTest test = new AltPlusNumberKeyCombinationsTest();
+            test.doTest();
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Fail; "+e.getMessage());
+        }
+    }
+
+    /**
+     * Do screen capture and save it as image
+     */
+    private static void captureScreenAndSave() {
+
+        try {
+            Robot robot = new Robot();
+            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+            Rectangle rectangle = new Rectangle(0, 0, screenSize.width, screenSize.height);
+            System.out.println("About to screen capture - " + rectangle);
+            java.awt.image.BufferedImage image = robot.createScreenCapture(rectangle);
+            javax.imageio.ImageIO.write(image, "jpg", new java.io.File("ScreenImage.jpg"));
+            robot.delay(3000);
+        } catch (Throwable t) {
+            System.out.println("WARNING: Exception thrown while screen capture!");
+            t.printStackTrace();
+        }
+    }
+}
diff --git a/jdk/test/javax/swing/JComboBox/4523758/bug4523758.java b/jdk/test/javax/swing/JComboBox/4523758/bug4523758.java
new file mode 100644
index 00000000000..423f89d8bff
--- /dev/null
+++ b/jdk/test/javax/swing/JComboBox/4523758/bug4523758.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 4523758
+ * @summary Directly check that torn-off combo works
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main bug4523758
+ */
+/*
+ * There is another regression test for this bug created by ssi with a
+ * fix. It is purely AWT and designed to verify the (absence of) underlying Component issue.
+ * This functional test does test, well, functionality of the swing control.
+ *
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+public class bug4523758 {
+
+    private JFrame frame;
+    private JToolBar tools;
+    private JComboBox combo;
+
+    private boolean passed = true;
+    private boolean itemStateChanged = false;
+    private Object itemLock = new Object();
+
+    private static int delay = 500;
+    private static final int WAIT_EVENT_DELAY = 60000;
+
+    public bug4523758() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    initializeGUI();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Failed to initialize GUI");
+        }
+    }
+
+    private void initializeGUI() {
+        frame = new JFrame("bug4523758");
+        tools = new JToolBar();
+        frame.getContentPane().add(tools, BorderLayout.NORTH);
+        combo = new JComboBox(new Object[] { "Red", "Orange", "Yellow",
+            "Green", "Blue", "Indigo", "Violet"});
+        combo.addItemListener(new ItemListener() {
+            public void itemStateChanged(ItemEvent event) {
+                itemStateChanged = true;
+                synchronized (itemLock) {
+                    try {
+                        itemLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+        tools.add(combo);
+        frame.setSize(250,400);
+        frame.setLocation(700, 0);
+        frame.setVisible(true);
+    }
+
+    private void doTest() throws Exception {
+        ExtendedRobot robot = new ExtendedRobot();
+        robot.waitForIdle(1000);
+
+        final Point cl = combo.getLocationOnScreen();
+        final Dimension cs = combo.getSize();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame.dispose();
+            }
+        });
+        robot.waitForIdle(delay);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame.setSize((int) cl.x - 700 + cs.width,
+                              (int) cl.y + cs.height - 5);
+                frame.setVisible(true);
+            }
+        });
+
+        robot.waitForIdle(delay*2);
+        Point comboLocation = combo.getLocationOnScreen();
+        Dimension comboSize = combo.getSize();
+
+        robot.mouseMove((int) comboLocation.x + comboSize.width / 2,
+                        (int) comboLocation.y + 5);
+        robot.waitForIdle(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(100);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle(delay);
+
+        robot.mouseMove((int) comboLocation.x + comboSize.width / 2,
+                        (int) comboLocation.y + 60);
+        robot.waitForIdle(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(100);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle(delay);
+
+        if (! itemStateChanged) {
+            synchronized (itemLock) {
+                try {
+                    itemLock.wait(WAIT_EVENT_DELAY);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! itemStateChanged) {
+            System.err.println("FAIL: ItemEvent not triggered when mouse clicked on combo box drop down");
+            passed = false;
+        }
+
+        if (! passed) {
+            System.err.println("Test failed!");
+            captureScreenAndSave();
+            throw new RuntimeException("FAIL");
+        } else {
+            System.out.println("Test passed!");
+        }
+    }
+
+    public static void main(String[] args) {
+        try {
+            bug4523758 test = new bug4523758();
+            test.doTest();
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("FAIL");
+        }
+    }
+
+    /**
+     * Do screen capture and save it as image
+     */
+    private static void captureScreenAndSave() {
+
+        try {
+            Robot robot = new Robot();
+            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+            Rectangle rectangle = new Rectangle(0, 0, screenSize.width, screenSize.height);
+            System.out.println("About to screen capture - " + rectangle);
+            java.awt.image.BufferedImage image = robot.createScreenCapture(rectangle);
+            javax.imageio.ImageIO.write(image, "jpg", new java.io.File("ScreenImage.jpg"));
+            robot.delay(3000);
+        } catch (Throwable t) {
+            System.out.println("WARNING: Exception thrown while screen capture!");
+            t.printStackTrace();
+        }
+    }
+}
-- 
GitLab


From e0716258fc6b555bfa7033c58666f4d17ea5a687 Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Fri, 30 May 2014 15:24:42 +0400
Subject: [PATCH 031/192] 8007563: When checking the default behaviour for a
 scroll tab layout and checking the 'opaque' checkbox, the area behind tabs is
 not red

Reviewed-by: alexsch, serb
---
 .../swing/plaf/metal/MetalTabbedPaneUI.java   |   5 +-
 .../JTabbedPane/8007563/Test8007563.java      | 124 ++++++++++++++++++
 2 files changed, 126 insertions(+), 3 deletions(-)
 create mode 100644 jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java

diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
index 75dc959ca3d..0a54a878534 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
@@ -806,9 +806,8 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
 
         // Paint the background for the tab area
         if ( tabPane.isOpaque() ) {
-            Color bg = UIManager.getColor("TabbedPane.tabAreaBackground");
-            if (bg != null) {
-                g.setColor(bg);
+            if (!c.isBackgroundSet() && (tabAreaBackground != null)) {
+                g.setColor(tabAreaBackground);
             }
             else {
                 g.setColor( c.getBackground() );
diff --git a/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java b/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java
new file mode 100644
index 00000000000..5f73173df34
--- /dev/null
+++ b/jdk/test/javax/swing/JTabbedPane/8007563/Test8007563.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Robot;
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTabbedPane;
+
+import static javax.swing.UIManager.*;
+import static javax.swing.SwingUtilities.*;
+
+/*
+ * @test
+ * @bug 8007563
+ * @summary Tests JTabbedPane background
+ * @author Sergey Malenkov
+ */
+
+public class Test8007563 implements Runnable {
+    private static final ArrayList<String> LIST = new ArrayList<>();
+    private static final LookAndFeelInfo[] INFO = getInstalledLookAndFeels();
+    private static final CountDownLatch LATCH = new CountDownLatch(INFO.length);
+    private static Robot ROBOT;
+
+    public static void main(String[] args) throws Exception {
+        ROBOT = new Robot();
+        invokeLater(new Test8007563());
+        LATCH.await();
+        if (!LIST.isEmpty()) {
+            throw new Error(LIST.toString());
+        }
+    }
+
+    private static void addOpaqueError(boolean opaque) {
+        LIST.add(getLookAndFeel().getName() + " opaque=" + opaque);
+    }
+
+    private static boolean updateLookAndFeel() {
+        int index = (int) LATCH.getCount() - 1;
+        if (index >= 0) {
+            try {
+                LookAndFeelInfo info = INFO[index];
+                System.err.println("L&F: " + info.getName());
+                setLookAndFeel(info.getClassName());
+                return true;
+            } catch (Exception exception) {
+                exception.printStackTrace();
+            }
+        }
+        return false;
+    }
+
+    private JFrame frame;
+    private JTabbedPane pane;
+
+    public void run() {
+        if (this.frame == null) {
+            if (!updateLookAndFeel()) {
+                return;
+            }
+            this.pane = new JTabbedPane();
+            this.pane.setOpaque(false);
+            this.pane.setBackground(Color.RED);
+            for (int i = 0; i < 3; i++) {
+                this.pane.addTab("Tab " + i, new JLabel("Content area " + i));
+            }
+            this.frame = new JFrame(getClass().getSimpleName());
+            this.frame.getContentPane().setBackground(Color.BLUE);
+            this.frame.add(this.pane);
+            this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+            this.frame.setSize(400, 200);
+            this.frame.setLocationRelativeTo(null);
+            this.frame.setVisible(true);
+        } else {
+            Point point = new Point(this.pane.getWidth() - 2, 2);
+            convertPointToScreen(point, this.pane);
+            Color actual = ROBOT.getPixelColor(point.x, point.y);
+
+            boolean opaque = this.pane.isOpaque();
+            Color expected = opaque
+                    ? this.pane.getBackground()
+                    : this.frame.getContentPane().getBackground();
+
+            if (!expected.equals(actual)){
+                addOpaqueError(opaque);
+            }
+            if (!opaque) {
+                this.pane.setOpaque(true);
+                this.pane.repaint();
+            } else {
+                this.frame.dispose();
+                this.frame = null;
+                this.pane = null;
+                LATCH.countDown();
+            }
+
+        }
+        invokeLater(this);
+    }
+}
-- 
GitLab


From 19759f801ccb580c9f4521eb576407c2db67f2cd Mon Sep 17 00:00:00 2001
From: Alexander Zvegintsev <azvegint@openjdk.org>
Date: Fri, 30 May 2014 13:16:51 +0400
Subject: [PATCH 032/192] 8031471: Test
 closed/java/awt/dnd/FileDialogDropTargetTest/FileDialogDropTargetTest.java
 fails on Solaris zones virtual hosts

Reviewed-by: anthony, serb
---
 .../classes/sun/awt/X11/XErrorHandlerUtil.java    | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java b/jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
index 4bdf0ecb0dc..037b7329ecd 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -97,6 +97,7 @@ public final class XErrorHandlerUtil {
      * @param handler the synthetic error handler to set
      */
     public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
+        XSync();
         saved_error = null;
         current_error_handler = handler;
     }
@@ -105,15 +106,9 @@ public final class XErrorHandlerUtil {
      * Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
      */
     public static void RESTORE_XERROR_HANDLER() {
-        RESTORE_XERROR_HANDLER(true);
-    }
-
-    private static void RESTORE_XERROR_HANDLER(boolean doXSync) {
-        if (doXSync) {
-            // Wait until all requests are processed by the X server
-            // and only then uninstall the error handler.
-            XSync();
-        }
+        // Wait until all requests are processed by the X server
+        // and only then uninstall the error handler.
+        XSync();
         current_error_handler = null;
     }
 
-- 
GitLab


From b57d6c9a4faa1af5c6bf6eb03ced32ae49c494e7 Mon Sep 17 00:00:00 2001
From: Dmitry Markov <dmarkov@openjdk.org>
Date: Mon, 2 Jun 2014 14:20:02 +0400
Subject: [PATCH 033/192] 8042465: Applet menus not rendering when browser is
 full screen on Mac

Reviewed-by: anthony, pchelko
---
 .../sun/lwawt/macosx/CPlatformWindow.java     |  2 ++
 jdk/src/macosx/native/sun/awt/AWTWindow.m     |  6 ++++-
 .../classes/javax/swing/PopupFactory.java     | 26 +++++++++++++++++--
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index edf25ddb313..190894934b9 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -119,6 +119,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
     static final int NONACTIVATING = 1 << 24;
     static final int IS_DIALOG = 1 << 25;
     static final int IS_MODAL = 1 << 26;
+    static final int IS_POPUP = 1 << 27;
 
     static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
 
@@ -318,6 +319,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
             styleBits = SET(styleBits, TEXTURED, false);
             // Popups in applets don't activate applet's process
             styleBits = SET(styleBits, NONACTIVATING, true);
+            styleBits = SET(styleBits, IS_POPUP, true);
         }
 
         if (Window.Type.UTILITY.equals(target.getType())) {
diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m
index 6a9c1166e84..5cb5621a159 100644
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -252,6 +252,10 @@ AWT_ASSERT_APPKIT_THREAD;
     self.ownerWindow = owner;
     [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)];
 
+    if (IS(self.styleBits, IS_POPUP)) {
+        [self.nsWindow setCollectionBehavior:(1 << 8) /*NSWindowCollectionBehaviorFullScreenAuxiliary*/]; 
+    }
+
     return self;
 }
 
diff --git a/jdk/src/share/classes/javax/swing/PopupFactory.java b/jdk/src/share/classes/javax/swing/PopupFactory.java
index 20b21c7a274..695ef2bb76b 100644
--- a/jdk/src/share/classes/javax/swing/PopupFactory.java
+++ b/jdk/src/share/classes/javax/swing/PopupFactory.java
@@ -25,10 +25,14 @@
 
 package javax.swing;
 
+import sun.awt.EmbeddedFrame;
+import sun.awt.OSInfo;
+
 import java.applet.Applet;
 import java.awt.*;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -226,7 +230,12 @@ public class PopupFactory {
         case MEDIUM_WEIGHT_POPUP:
             return getMediumWeightPopup(owner, contents, ownerX, ownerY);
         case HEAVY_WEIGHT_POPUP:
-            return getHeavyWeightPopup(owner, contents, ownerX, ownerY);
+            Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
+            if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
+                OSInfo.OSType.MACOSX) && (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
+                ((HeavyWeightPopup)popup).setCacheEnabled(false);
+            }
+            return popup;
         }
         return null;
     }
@@ -294,6 +303,8 @@ public class PopupFactory {
         private static final Object heavyWeightPopupCacheKey =
                  new StringBuffer("PopupFactory.heavyWeightPopupCache");
 
+        private volatile boolean isCacheEnabled = true;
+
         /**
          * Returns either a new or recycled <code>Popup</code> containing
          * the specified children.
@@ -448,12 +459,23 @@ public class PopupFactory {
             }
         }
 
+        /**
+         * Enables or disables cache for current object.
+         */
+        void setCacheEnabled(boolean enable) {
+            isCacheEnabled = enable;
+        }
+
         //
         // Popup methods
         //
         public void hide() {
             super.hide();
-            recycleHeavyWeightPopup(this);
+            if (isCacheEnabled) {
+                recycleHeavyWeightPopup(this);
+            } else {
+                this._dispose();
+            }
         }
 
         /**
-- 
GitLab


From ffed33a4916ae264c6af8088d2e7ef0ee44fcc00 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Mon, 2 Jun 2014 15:25:43 +0400
Subject: [PATCH 034/192] 8043807: Incorrect StackTrace in IOException thrown
 from ClipboardTransferable

Reviewed-by: anthony, serb
---
 .../classes/sun/awt/datatransfer/ClipboardTransferable.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java b/jdk/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java
index 6c3a4d18c06..f8c02601497 100644
--- a/jdk/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java
+++ b/jdk/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java
@@ -153,7 +153,7 @@ public class ClipboardTransferable implements Transferable {
         Object ret = flavorsToData.get(flavor);
         if (ret instanceof IOException) {
             // rethrow IOExceptions generated while fetching data
-            throw (IOException)ret;
+            throw new IOException("Exception fetching data: ", (IOException)ret);
         } else if (ret instanceof DataFactory) {
             // Now we can render the data
             DataFactory factory = (DataFactory)ret;
-- 
GitLab


From e563a70ab70083a5a7bbc2e6f58cf128d73c9fb9 Mon Sep 17 00:00:00 2001
From: Mikael Auno <miauno@openjdk.org>
Date: Mon, 2 Jun 2014 17:21:15 +0200
Subject: [PATCH 035/192] 8044540:
 serviceability/sa/jmap-hashcode/Test8028623.java should be quarantined

Reviewed-by: sla
---
 hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
index 6f4b2fd689a..815b3f606ca 100644
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
@@ -26,6 +26,7 @@
  * @bug 8028623
  * @summary Test hashing of extended characters in Serviceability Agent.
  * @library /testlibrary
+ * @ignore 8044416
  * @build com.oracle.java.testlibrary.*
  * @compile -encoding utf8 Test8028623.java
  * @run main Test8028623
-- 
GitLab


From 333b1ed5ba4a818196f0635839e6bfe0922f00fc Mon Sep 17 00:00:00 2001
From: Otavio Goncalves de Santana <otaviopolianasantana@gmail.com>
Date: Tue, 3 Jun 2014 11:18:03 -0400
Subject: [PATCH 036/192] 8044460: Cleanup new Boolean and single character
 strings

Reviewed-by: pchelko, serb, rriggs
---
 .../share/classes/com/sun/java/swing/plaf/gtk/Metacity.java | 2 +-
 jdk/src/share/classes/javax/swing/JEditorPane.java          | 2 +-
 .../share/classes/javax/swing/plaf/nimbus/NimbusStyle.java  | 2 +-
 jdk/src/share/classes/sun/applet/AppletClassLoader.java     | 4 ++--
 jdk/src/share/classes/sun/awt/FontConfiguration.java        | 4 ++--
 jdk/src/share/classes/sun/font/SunFontManager.java          | 3 +--
 jdk/src/share/classes/sun/font/Type1Font.java               | 6 +++---
 7 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
index 72167580a92..8c40e755d51 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
@@ -547,7 +547,7 @@ class Metacity implements SynthConstants {
                             i = strLowerCase.indexOf("<stringvalue>", i);
                             if (i > 0) {
                                 i += "<stringvalue>".length();
-                                int i2 = str.indexOf("<", i);
+                                int i2 = str.indexOf('<', i);
                                 return str.substring(i, i2);
                             }
                         }
diff --git a/jdk/src/share/classes/javax/swing/JEditorPane.java b/jdk/src/share/classes/javax/swing/JEditorPane.java
index c1382125237..bc738185d20 100644
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java
@@ -965,7 +965,7 @@ public class JEditorPane extends JTextComponent {
         // The type could have optional info is part of it,
         // for example some charset info.  We need to strip that
         // of and save it.
-        int parm = type.indexOf(";");
+        int parm = type.indexOf(';');
         if (parm > -1) {
             // Save the paramList.
             String paramList = type.substring(parm);
diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java
index e38a0789e3c..bcdae78da79 100644
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java
@@ -653,7 +653,7 @@ public final class NimbusStyle extends SynthStyle {
 
         // strip off the prefix, if there is one.
         String fullKey = key.toString();
-        String partialKey = fullKey.substring(fullKey.indexOf(".") + 1);
+        String partialKey = fullKey.substring(fullKey.indexOf('.') + 1);
 
         Object obj = null;
         int xstate = getExtendedState(ctx, v);
diff --git a/jdk/src/share/classes/sun/applet/AppletClassLoader.java b/jdk/src/share/classes/sun/applet/AppletClassLoader.java
index f732ad22425..72358e80fa2 100644
--- a/jdk/src/share/classes/sun/applet/AppletClassLoader.java
+++ b/jdk/src/share/classes/sun/applet/AppletClassLoader.java
@@ -168,7 +168,7 @@ public class AppletClassLoader extends URLClassLoader {
      */
     protected Class findClass(String name) throws ClassNotFoundException {
 
-        int index = name.indexOf(";");
+        int index = name.indexOf(';');
         String cookie = "";
         if(index != -1) {
                 cookie = name.substring(index, name.length());
@@ -608,7 +608,7 @@ public class AppletClassLoader extends URLClassLoader {
 
         // deal with URL rewriting
         String cookie = null;
-        int index = name.indexOf(";");
+        int index = name.indexOf(';');
         if(index != -1) {
                 cookie = name.substring(index, name.length());
                 name = name.substring(0, index);
diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java
index c234b534633..b4deecebc8a 100644
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java
@@ -272,9 +272,9 @@ public abstract class FontConfiguration {
             if (configFile != null) {
                 return configFile;
             }
-            int decimalPointIndex = osVersion.indexOf(".");
+            int decimalPointIndex = osVersion.indexOf('.');
             if (decimalPointIndex != -1) {
-                osMajorVersion = osVersion.substring(0, osVersion.indexOf("."));
+                osMajorVersion = osVersion.substring(0, osVersion.indexOf('.'));
                 configFile = findImpl(baseName + "." + osName + "." + osMajorVersion);
                 if (configFile != null) {
                     return configFile;
diff --git a/jdk/src/share/classes/sun/font/SunFontManager.java b/jdk/src/share/classes/sun/font/SunFontManager.java
index 998713b4494..3266268b315 100644
--- a/jdk/src/share/classes/sun/font/SunFontManager.java
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java
@@ -2872,8 +2872,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
                 new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             SecurityManager sm = System.getSecurityManager();
-                            return new Boolean
-                                (sm instanceof sun.applet.AppletSecurity);
+                            return sm instanceof sun.applet.AppletSecurity;
                         }
                     });
         return appletSM.booleanValue();
diff --git a/jdk/src/share/classes/sun/font/Type1Font.java b/jdk/src/share/classes/sun/font/Type1Font.java
index fca68cbfea3..c738315d607 100644
--- a/jdk/src/share/classes/sun/font/Type1Font.java
+++ b/jdk/src/share/classes/sun/font/Type1Font.java
@@ -492,7 +492,7 @@ public class Type1Font extends FileFont {
 
         //Conversion: Expand abbreviations in style portion (everything after '-'),
         //            replace '-' with space and insert missing spaces
-        pos = name.indexOf("-");
+        pos = name.indexOf('-');
         if (pos >= 0) {
             res =  expandName(name.substring(0, pos), false);
             res += " " + expandName(name.substring(pos+1), true);
@@ -513,8 +513,8 @@ public class Type1Font extends FileFont {
         //Conversion: Truncate style portion (everything after '-')
         //            and insert missing spaces
 
-        if (tmp.indexOf("-") > 0) {
-            tmp = tmp.substring(0, tmp.indexOf("-"));
+        if (tmp.indexOf('-') > 0) {
+            tmp = tmp.substring(0, tmp.indexOf('-'));
         }
 
         return expandName(tmp, false);
-- 
GitLab


From faa3d72cb09d9f948f45aaceb28022b285f8cc59 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Tue, 3 Jun 2014 09:22:59 -0700
Subject: [PATCH 037/192] 8042860: Fix raw and unchecked warnings in java.beans

Reviewed-by: malenkov, alanb, mduigou
---
 .../classes/java/beans/EventHandler.java      |   4 +-
 .../java/beans/EventSetDescriptor.java        |   4 +-
 .../java/beans/IndexedPropertyDescriptor.java |   6 +-
 .../classes/java/beans/Introspector.java      |   8 +-
 .../share/classes/java/beans/MetaData.java    |   4 +-
 .../java/beans/PropertyDescriptor.java        |   4 +-
 .../BeanContextServiceAvailableEvent.java     |  10 +-
 .../BeanContextServiceProvider.java           |   6 +-
 .../BeanContextServiceRevokedEvent.java       |  10 +-
 .../beancontext/BeanContextServices.java      |  14 +-
 .../BeanContextServicesSupport.java           | 154 +++++++++---------
 .../beans/beancontext/BeanContextSupport.java |  53 +++---
 12 files changed, 142 insertions(+), 135 deletions(-)

diff --git a/jdk/src/share/classes/java/beans/EventHandler.java b/jdk/src/share/classes/java/beans/EventHandler.java
index 470991e11bd..dd41750f2f1 100644
--- a/jdk/src/share/classes/java/beans/EventHandler.java
+++ b/jdk/src/share/classes/java/beans/EventHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -446,7 +446,7 @@ public class EventHandler implements InvocationHandler {
         }
 
         if (listenerMethodName == null || listenerMethodName.equals(methodName)) {
-            Class[] argTypes = null;
+            Class<?>[] argTypes = null;
             Object[] newArgs = null;
 
             if (eventPropertyName == null) {     // Nullary method.
diff --git a/jdk/src/share/classes/java/beans/EventSetDescriptor.java b/jdk/src/share/classes/java/beans/EventSetDescriptor.java
index 78bc44d2978..ca8dbadb04e 100644
--- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java
+++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -81,7 +81,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
         String eventName = NameGenerator.capitalize(eventSetName) + "Event";
         Method[] listenerMethods = getListenerMethods();
         if (listenerMethods.length > 0) {
-            Class[] args = getParameterTypes(getClass0(), listenerMethods[0]);
+            Class<?>[] args = getParameterTypes(getClass0(), listenerMethods[0]);
             // Check for EventSet compliance. Special case for vetoableChange. See 4529996
             if (!"vetoableChange".equals(eventSetName) && !args[0].getName().endsWith(eventName)) {
                 throw new IntrospectionException("Method \"" + listenerMethodName +
diff --git a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
index 1f329a31c55..84f20ee4a1a 100644
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -353,7 +353,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
         Class<?> indexedPropertyType = null;
 
         if (indexedReadMethod != null) {
-            Class params[] = getParameterTypes(getClass0(), indexedReadMethod);
+            Class<?>[] params = getParameterTypes(getClass0(), indexedReadMethod);
             if (params.length != 1) {
                 throw new IntrospectionException("bad indexed read method arg count");
             }
@@ -366,7 +366,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
             }
         }
         if (indexedWriteMethod != null) {
-            Class params[] = getParameterTypes(getClass0(), indexedWriteMethod);
+            Class<?>[] params = getParameterTypes(getClass0(), indexedWriteMethod);
             if (params.length != 2) {
                 throw new IntrospectionException("bad indexed write method arg count");
             }
diff --git a/jdk/src/share/classes/java/beans/Introspector.java b/jdk/src/share/classes/java/beans/Introspector.java
index 10efa7ae5a8..469238a601e 100644
--- a/jdk/src/share/classes/java/beans/Introspector.java
+++ b/jdk/src/share/classes/java/beans/Introspector.java
@@ -1384,7 +1384,7 @@ public class Introspector {
      * parameter list on a given class.
      */
     private static Method internalFindMethod(Class<?> start, String methodName,
-                                                 int argCount, Class args[]) {
+                                                 int argCount, Class<?> args[]) {
         // For overriden methods we need to find the most derived version.
         // So we start with the given class and walk up the superclass chain.
 
@@ -1426,7 +1426,7 @@ public class Introspector {
         // Now check any inherited interfaces.  This is necessary both when
         // the argument class is itself an interface, and when the argument
         // class is an abstract class.
-        Class ifcs[] = start.getInterfaces();
+        Class<?>[] ifcs = start.getInterfaces();
         for (int i = 0 ; i < ifcs.length; i++) {
             // Note: The original implementation had both methods calling
             // the 3 arg method. This is preserved but perhaps it should
@@ -1459,7 +1459,7 @@ public class Introspector {
      * @return the method or null if not found
      */
     static Method findMethod(Class<?> cls, String methodName, int argCount,
-                             Class args[]) {
+                             Class<?>[] args) {
         if (methodName == null) {
             return null;
         }
@@ -1502,7 +1502,7 @@ public class Introspector {
      * Return true iff the given method throws the given exception.
      */
     private boolean throwsException(Method method, Class<?> exception) {
-        Class exs[] = method.getExceptionTypes();
+        Class<?>[] exs = method.getExceptionTypes();
         for (int i = 0; i < exs.length; i++) {
             if (exs[i] == exception) {
                 return true;
diff --git a/jdk/src/share/classes/java/beans/MetaData.java b/jdk/src/share/classes/java/beans/MetaData.java
index 3ae1e0375f9..d0e7108179d 100644
--- a/jdk/src/share/classes/java/beans/MetaData.java
+++ b/jdk/src/share/classes/java/beans/MetaData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -1401,7 +1401,7 @@ static final class sun_swing_PrintColorUIResource_PersistenceDelegate extends Pe
     }
 
     private static boolean isValid(Constructor<?> constructor, String[] names) {
-        Class[] parameters = constructor.getParameterTypes();
+        Class<?>[] parameters = constructor.getParameterTypes();
         if (names.length != parameters.length) {
             return false;
         }
diff --git a/jdk/src/share/classes/java/beans/PropertyDescriptor.java b/jdk/src/share/classes/java/beans/PropertyDescriptor.java
index 07149f9752d..fb0b349c000 100644
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -112,7 +112,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
         // If this class or one of its base classes allow PropertyChangeListener,
         // then we assume that any properties we discover are "bound".
         // See Introspector.getTargetPropertyInfo() method.
-        Class[] args = { PropertyChangeListener.class };
+        Class<?>[] args = { PropertyChangeListener.class };
         this.bound = null != Introspector.findMethod(beanClass, "addPropertyChangeListener", args.length, args);
     }
 
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java
index c1034ef73cc..24eb66aa96f 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -47,7 +47,7 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent {
      * @param bcs The context in which the service has become available
      * @param sc A <code>Class</code> reference to the newly available service
      */
-    public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
+    public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class<?> sc) {
         super((BeanContext)bcs);
 
         serviceClass = sc;
@@ -65,13 +65,13 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent {
      * Gets the service class that is the subject of this notification.
      * @return A <code>Class</code> reference to the newly available service
      */
-    public Class getServiceClass() { return serviceClass; }
+    public Class<?> getServiceClass() { return serviceClass; }
 
     /**
      * Gets the list of service dependent selectors.
      * @return the current selectors available from the service
      */
-    public Iterator getCurrentServiceSelectors() {
+    public Iterator<?> getCurrentServiceSelectors() {
         return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
     }
 
@@ -82,5 +82,5 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent {
     /**
      * A <code>Class</code> reference to the newly available service
      */
-    protected Class                      serviceClass;
+    protected Class<?>                   serviceClass;
 }
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceProvider.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceProvider.java
index 5e724ca325f..104051e3952 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceProvider.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -70,7 +70,7 @@ public interface BeanContextServiceProvider {
     *
     * @return a reference to the requested service
     */
-    Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector);
+    Object getService(BeanContextServices bcs, Object requestor, Class<?> serviceClass, Object serviceSelector);
 
     /**
      * Invoked by <code>BeanContextServices</code>,
@@ -100,5 +100,5 @@ public interface BeanContextServiceProvider {
      * @param serviceClass  the specified service
      * @return   the current service selectors for the specified serviceClass
      */
-    Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass);
+    Iterator<?> getCurrentServiceSelectors(BeanContextServices bcs, Class<?> serviceClass);
 }
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java
index 30d99862903..b886e30a86f 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -46,7 +46,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
      * @param sc the service that is being revoked
      * @param invalidate <code>true</code> for immediate revocation
      */
-    public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class sc, boolean invalidate) {
+    public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class<?> sc, boolean invalidate) {
         super((BeanContext)bcs);
 
         serviceClass    = sc;
@@ -67,7 +67,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
      * @return A <code>Class</code> reference to the
      * service that is being revoked
      */
-    public Class getServiceClass() { return serviceClass; }
+    public Class<?> getServiceClass() { return serviceClass; }
 
     /**
      * Checks this event to determine whether or not
@@ -76,7 +76,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
      * @return <code>true</code> if the service being revoked is of the
      * same class as the specified service
      */
-    public boolean isServiceClass(Class service) {
+    public boolean isServiceClass(Class<?> service) {
         return serviceClass.equals(service);
     }
 
@@ -94,6 +94,6 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
     /**
      * A <code>Class</code> reference to the service that is being revoked.
      */
-    protected Class                      serviceClass;
+    protected Class<?>                   serviceClass;
     private   boolean                    invalidateRefs;
 }
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java
index 0348817bfe8..62652ec5443 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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,7 +62,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
      * associated with the service
      * @return true if the service was successful added, false otherwise
      */
-    boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider);
+    boolean addService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider);
 
     /**
      * BeanContextServiceProviders wishing to remove
@@ -83,7 +83,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
      * terminate service to all currently outstanding references
      * to the specified service.
      */
-    void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
+    void revokeService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
 
     /**
      * Reports whether or not a given service is
@@ -91,7 +91,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
      * @param serviceClass the service in question
      * @return true if the service is available
      */
-    boolean hasService(Class serviceClass);
+    boolean hasService(Class<?> serviceClass);
 
     /**
      * A <code>BeanContextChild</code>, or any arbitrary object
@@ -113,7 +113,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
      * @return a reference to this context's named
      * Service as requested or <code>null</code>
      */
-    Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
+    Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
 
     /**
      * Releases a <code>BeanContextChild</code>'s
@@ -131,7 +131,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
      * @return an <code>Iterator</code> consisting of the
      * currently available services
      */
-    Iterator getCurrentServiceClasses();
+    Iterator<?> getCurrentServiceClasses();
 
     /**
      * Gets the list of service dependent service parameters
@@ -142,7 +142,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
      * @return the currently available service selectors
      * for the named serviceClass
      */
-    Iterator getCurrentServiceSelectors(Class serviceClass);
+    Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass);
 
     /**
      * Adds a <code>BeanContextServicesListener</code> to this BeanContext
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
index 41cfa9d7a89..507e8ec0215 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -129,9 +129,8 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
     public void initialize() {
         super.initialize();
-
-        services     = new HashMap(serializable + 1);
-        bcsListeners = new ArrayList(1);
+        services     = new HashMap<>(serializable + 1);
+        bcsListeners = new ArrayList<>(1);
     }
 
     /**
@@ -169,7 +168,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
             // create an instance of a service ref
 
-            BCSSCServiceClassRef(Class sc, BeanContextServiceProvider bcsp, boolean delegated) {
+            BCSSCServiceClassRef(Class<?> sc, BeanContextServiceProvider bcsp, boolean delegated) {
                 super();
 
                 serviceClass     = sc;
@@ -183,7 +182,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
             // add a requestor and assoc listener
 
             void addRequestor(Object requestor, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
-                BeanContextServiceRevokedListener cbcsrl = (BeanContextServiceRevokedListener)requestors.get(requestor);
+                BeanContextServiceRevokedListener cbcsrl = requestors.get(requestor);
 
                 if (cbcsrl != null && !cbcsrl.equals(bcsrl))
                     throw new TooManyListenersException();
@@ -200,7 +199,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
             // check a requestors listener
 
             void verifyRequestor(Object requestor, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
-                BeanContextServiceRevokedListener cbcsrl = (BeanContextServiceRevokedListener)requestors.get(requestor);
+                BeanContextServiceRevokedListener cbcsrl = requestors.get(requestor);
 
                 if (cbcsrl != null && !cbcsrl.equals(bcsrl))
                     throw new TooManyListenersException();
@@ -230,15 +229,18 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
             }
 
-            Iterator cloneOfEntries() {
-                return ((HashMap)requestors.clone()).entrySet().iterator();
+            @SuppressWarnings("unchecked") // Cast from clone
+            Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> cloneOfEntries() {
+                return ((HashMap<Object, BeanContextServiceRevokedListener>)requestors.clone()).entrySet().iterator();
             }
 
-            Iterator entries() { return requestors.entrySet().iterator(); }
+            Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> entries() {
+                return requestors.entrySet().iterator();
+            }
 
             boolean isEmpty() { return requestors.isEmpty(); }
 
-            Class getServiceClass() { return serviceClass; }
+            Class<?> getServiceClass() { return serviceClass; }
 
             BeanContextServiceProvider getServiceProvider() {
                 return serviceProvider;
@@ -281,7 +283,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
              * fields
              */
 
-            Class                               serviceClass;
+            Class<?>                            serviceClass;
 
             BeanContextServiceProvider          serviceProvider;
             int                                 serviceRefs;
@@ -289,7 +291,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
             BeanContextServiceProvider          delegateProvider; // proxy
             int                                 delegateRefs;
 
-            HashMap                             requestors = new HashMap(1);
+            HashMap<Object, BeanContextServiceRevokedListener> requestors = new HashMap<>(1);
         }
 
         /*
@@ -322,16 +324,16 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
         // note usage of service per requestor, per service
 
-        synchronized void usingService(Object requestor, Object service, Class serviceClass, BeanContextServiceProvider bcsp, boolean isDelegated, BeanContextServiceRevokedListener bcsrl)  throws TooManyListenersException, UnsupportedOperationException {
+        synchronized void usingService(Object requestor, Object service, Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean isDelegated, BeanContextServiceRevokedListener bcsrl)  throws TooManyListenersException, UnsupportedOperationException {
 
             // first, process mapping from serviceClass to requestor(s)
 
             BCSSCServiceClassRef serviceClassRef = null;
 
             if (serviceClasses == null)
-                serviceClasses = new HashMap(1);
+                serviceClasses = new HashMap<>(1);
             else
-                serviceClassRef = (BCSSCServiceClassRef)serviceClasses.get(serviceClass);
+                serviceClassRef = serviceClasses.get(serviceClass);
 
             if (serviceClassRef == null) { // new service being used ...
                 serviceClassRef = new BCSSCServiceClassRef(serviceClass, bcsp, isDelegated);
@@ -348,20 +350,20 @@ public class      BeanContextServicesSupport extends BeanContextSupport
             // now handle mapping from requestor to service(s)
 
             BCSSCServiceRef serviceRef = null;
-            Map             services   = null;
+            Map<Object , BCSSCServiceRef> services   = null;
 
             if (serviceRequestors == null) {
-                serviceRequestors = new HashMap(1);
+                serviceRequestors = new HashMap<>(1);
             } else {
-                services = (Map)serviceRequestors.get(requestor);
+                services = serviceRequestors.get(requestor);
             }
 
             if (services == null) {
-                services = new HashMap(1);
+                services = new HashMap<>(1);
 
                 serviceRequestors.put(requestor, services);
             } else
-                serviceRef = (BCSSCServiceRef)services.get(service);
+                serviceRef = services.get(service);
 
             if (serviceRef == null) {
                 serviceRef = new BCSSCServiceRef(serviceClassRef, isDelegated);
@@ -377,11 +379,11 @@ public class      BeanContextServicesSupport extends BeanContextSupport
         synchronized void releaseService(Object requestor, Object service) {
             if (serviceRequestors == null) return;
 
-            Map services = (Map)serviceRequestors.get(requestor);
+            Map<Object, BCSSCServiceRef> services = serviceRequestors.get(requestor);
 
             if (services == null) return; // oops its not there anymore!
 
-            BCSSCServiceRef serviceRef = (BCSSCServiceRef)services.get(service);
+            BCSSCServiceRef serviceRef = services.get(service);
 
             if (serviceRef == null) return; // oops its not there anymore!
 
@@ -418,33 +420,33 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
         // revoke a service
 
-        synchronized void revokeService(Class serviceClass, boolean isDelegated, boolean revokeNow) {
+        synchronized void revokeService(Class<?> serviceClass, boolean isDelegated, boolean revokeNow) {
             if (serviceClasses == null) return;
 
-            BCSSCServiceClassRef serviceClassRef = (BCSSCServiceClassRef)serviceClasses.get(serviceClass);
+            BCSSCServiceClassRef serviceClassRef = serviceClasses.get(serviceClass);
 
             if (serviceClassRef == null) return;
 
-            Iterator i = serviceClassRef.cloneOfEntries();
+            Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> i = serviceClassRef.cloneOfEntries();
 
             BeanContextServiceRevokedEvent bcsre       = new BeanContextServiceRevokedEvent(BeanContextServicesSupport.this.getBeanContextServicesPeer(), serviceClass, revokeNow);
             boolean                        noMoreRefs  = false;
 
             while (i.hasNext() && serviceRequestors != null) {
-                Map.Entry                         entry    = (Map.Entry)i.next();
-                BeanContextServiceRevokedListener listener = (BeanContextServiceRevokedListener)entry.getValue();
+                Map.Entry<Object,BeanContextServiceRevokedListener> entry    = i.next();
+                BeanContextServiceRevokedListener listener = entry.getValue();
 
                 if (revokeNow) {
                     Object  requestor = entry.getKey();
-                    Map     services  = (Map)serviceRequestors.get(requestor);
+                    Map<Object, BCSSCServiceRef> services  = serviceRequestors.get(requestor);
 
                     if (services != null) {
-                        Iterator i1 = services.entrySet().iterator();
+                        Iterator<Map.Entry<Object, BCSSCServiceRef>> i1 = services.entrySet().iterator();
 
                         while (i1.hasNext()) {
-                            Map.Entry       tmp        = (Map.Entry)i1.next();
+                            Map.Entry<Object, BCSSCServiceRef> tmp        = i1.next();
 
-                            BCSSCServiceRef serviceRef = (BCSSCServiceRef)tmp.getValue();
+                            BCSSCServiceRef serviceRef = tmp.getValue();
                             if (serviceRef.getServiceClassRef().equals(serviceClassRef) && isDelegated == serviceRef.isDelegated()) {
                                 i1.remove();
                             }
@@ -479,19 +481,19 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
             if (serviceRequestors == null) return;
 
-            Iterator requestors = serviceRequestors.entrySet().iterator();
+            Iterator<Map.Entry<Object, Map<Object, BCSSCServiceRef>>> requestors = serviceRequestors.entrySet().iterator();
 
             while(requestors.hasNext()) {
-                Map.Entry            tmp       = (Map.Entry)requestors.next();
+                Map.Entry<Object, Map<Object, BCSSCServiceRef>> tmp = requestors.next();
                 Object               requestor = tmp.getKey();
-                Iterator             services  = ((Map)tmp.getValue()).entrySet().iterator();
+                Iterator<Map.Entry<Object, BCSSCServiceRef>> services  = tmp.getValue().entrySet().iterator();
 
                 requestors.remove();
 
                 while (services.hasNext()) {
-                    Map.Entry       entry   = (Map.Entry)services.next();
+                    Map.Entry<Object, BCSSCServiceRef> entry   = services.next();
                     Object          service = entry.getKey();
-                    BCSSCServiceRef sref    = (BCSSCServiceRef)entry.getValue();
+                    BCSSCServiceRef sref    = entry.getValue();
 
                     BCSSCServiceClassRef       scref = sref.getServiceClassRef();
 
@@ -513,32 +515,32 @@ public class      BeanContextServicesSupport extends BeanContextSupport
         void revokeAllDelegatedServicesNow() {
             if (serviceClasses == null) return;
 
-            Iterator serviceClassRefs  =
-                new HashSet(serviceClasses.values()).iterator();
+            Iterator<BCSSCServiceClassRef> serviceClassRefs  =
+                new HashSet<>(serviceClasses.values()).iterator();
 
             while (serviceClassRefs.hasNext()) {
-                BCSSCServiceClassRef serviceClassRef = (BCSSCServiceClassRef)serviceClassRefs.next();
+                BCSSCServiceClassRef serviceClassRef = serviceClassRefs.next();
 
                 if (!serviceClassRef.isDelegated()) continue;
 
-                Iterator i = serviceClassRef.cloneOfEntries();
+                Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> i = serviceClassRef.cloneOfEntries();
                 BeanContextServiceRevokedEvent bcsre       = new BeanContextServiceRevokedEvent(BeanContextServicesSupport.this.getBeanContextServicesPeer(), serviceClassRef.getServiceClass(), true);
                 boolean                        noMoreRefs  = false;
 
                 while (i.hasNext()) {
-                    Map.Entry                         entry     = (Map.Entry)i.next();
-                    BeanContextServiceRevokedListener listener  = (BeanContextServiceRevokedListener)entry.getValue();
+                    Map.Entry<Object, BeanContextServiceRevokedListener> entry     = i.next();
+                    BeanContextServiceRevokedListener listener  = entry.getValue();
 
                     Object                            requestor = entry.getKey();
-                    Map                               services  = (Map)serviceRequestors.get(requestor);
+                    Map<Object, BCSSCServiceRef>      services  = serviceRequestors.get(requestor);
 
                     if (services != null) {
-                        Iterator i1 = services.entrySet().iterator();
+                        Iterator<Map.Entry<Object, BCSSCServiceRef>> i1 = services.entrySet().iterator();
 
                         while (i1.hasNext()) {
-                            Map.Entry       tmp        = (Map.Entry)i1.next();
+                            Map.Entry<Object, BCSSCServiceRef>   tmp        = i1.next();
 
-                            BCSSCServiceRef serviceRef = (BCSSCServiceRef)tmp.getValue();
+                            BCSSCServiceRef serviceRef = tmp.getValue();
                             if (serviceRef.getServiceClassRef().equals(serviceClassRef) && serviceRef.isDelegated()) {
                                 i1.remove();
                             }
@@ -568,8 +570,8 @@ public class      BeanContextServicesSupport extends BeanContextSupport
          * fields
          */
 
-        private transient HashMap       serviceClasses;
-        private transient HashMap       serviceRequestors;
+        private transient HashMap<Class<?>, BCSSCServiceClassRef> serviceClasses;
+        private transient HashMap<Object, Map<Object, BeanContextServicesSupport.BCSSChild.BCSSCServiceRef>> serviceRequestors;
     }
 
     /**
@@ -597,7 +599,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
         protected static class BCSSServiceProvider implements Serializable {
             private static final long serialVersionUID = 861278251667444782L;
 
-            BCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
+            BCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp) {
                 super();
 
                 serviceProvider = bcsp;
@@ -627,7 +629,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
          * @return a service provider without overriding addService()
          */
 
-        protected BCSSServiceProvider createBCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
+        protected BCSSServiceProvider createBCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp) {
             return new BCSSServiceProvider(sc, bcsp);
         }
 
@@ -671,7 +673,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * @param bcsp the service provider
      */
 
-    public boolean addService(Class serviceClass, BeanContextServiceProvider bcsp) {
+    public boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp) {
         return addService(serviceClass, bcsp, true);
     }
 
@@ -683,7 +685,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * @return true if the service was successfully added
      */
 
-    protected boolean addService(Class serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) {
+    protected boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) {
 
         if (serviceClass == null) throw new NullPointerException("serviceClass");
         if (bcsp         == null) throw new NullPointerException("bcsp");
@@ -704,7 +706,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
                 fireServiceAdded(bcssae);
 
                 synchronized(children) {
-                    Iterator i = children.keySet().iterator();
+                    Iterator<Object> i = children.keySet().iterator();
 
                     while (i.hasNext()) {
                         Object c = i.next();
@@ -727,7 +729,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * @param revokeCurrentServicesNow whether or not to revoke the service
      */
 
-    public void revokeService(Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
+    public void revokeService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
 
         if (serviceClass == null) throw new NullPointerException("serviceClass");
         if (bcsp         == null) throw new NullPointerException("bcsp");
@@ -735,7 +737,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
         synchronized(BeanContext.globalHierarchyLock) {
             if (!services.containsKey(serviceClass)) return;
 
-            BCSSServiceProvider bcsssp = (BCSSServiceProvider)services.get(serviceClass);
+            BCSSServiceProvider bcsssp = services.get(serviceClass);
 
             if (!bcsssp.getServiceProvider().equals(bcsp))
                 throw new IllegalArgumentException("service provider mismatch");
@@ -744,7 +746,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
             if (bcsp instanceof Serializable) serializable--;
 
-            Iterator i = bcsChildren(); // get the BCSChild values.
+            Iterator<BeanContextSupport.BCSChild> i = bcsChildren(); // get the BCSChild values.
 
             while (i.hasNext()) {
                 ((BCSSChild)i.next()).revokeService(serviceClass, false, revokeCurrentServicesNow);
@@ -758,7 +760,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * has a service, which may be delegated
      */
 
-    public synchronized boolean hasService(Class serviceClass) {
+    public synchronized boolean hasService(Class<?> serviceClass) {
         if (serviceClass == null) throw new NullPointerException("serviceClass");
 
         synchronized(BeanContext.globalHierarchyLock) {
@@ -791,7 +793,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
             nestingCtxt = bcs;
         }
 
-        public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) {
+        public Object getService(BeanContextServices bcs, Object requestor, Class<?> serviceClass, Object serviceSelector) {
             Object service = null;
 
             try {
@@ -807,12 +809,12 @@ public class      BeanContextServicesSupport extends BeanContextSupport
             nestingCtxt.releaseService(bcs, requestor, service);
         }
 
-        public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) {
+        public Iterator<?> getCurrentServiceSelectors(BeanContextServices bcs, Class<?> serviceClass) {
             return nestingCtxt.getCurrentServiceSelectors(serviceClass);
         }
 
         public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {
-            Iterator i = bcsChildren(); // get the BCSChild values.
+            Iterator<BeanContextSupport.BCSChild> i = bcsChildren(); // get the BCSChild values.
 
             while (i.hasNext()) {
                 ((BCSSChild)i.next()).revokeService(bcsre.getServiceClass(), true, bcsre.isCurrentServiceInvalidNow());
@@ -832,7 +834,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * obtain a service which may be delegated
      */
 
-     public Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
+     public Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
         if (child        == null) throw new NullPointerException("child");
         if (serviceClass == null) throw new NullPointerException("serviceClass");
         if (requestor    == null) throw new NullPointerException("requestor");
@@ -847,7 +849,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
             if (bcsc == null) throw new IllegalArgumentException("not a child of this context"); // not a child ...
 
-            BCSSServiceProvider bcsssp = (BCSSServiceProvider)services.get(serviceClass);
+            BCSSServiceProvider bcsssp = services.get(serviceClass);
 
             if (bcsssp != null) {
                 BeanContextServiceProvider bcsp = bcsssp.getServiceProvider();
@@ -918,7 +920,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * @return an iterator for all the currently registered service classes.
      */
 
-    public Iterator getCurrentServiceClasses() {
+    public Iterator<Object> getCurrentServiceClasses() {
         return new BCSIterator(services.keySet().iterator());
     }
 
@@ -927,9 +929,9 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * (if any) available for the specified service.
      */
 
-    public Iterator getCurrentServiceSelectors(Class serviceClass) {
+    public Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass) {
 
-        BCSSServiceProvider bcsssp = (BCSSServiceProvider)services.get(serviceClass);
+        BCSSServiceProvider bcsssp = services.get(serviceClass);
 
         return bcsssp != null ? new BCSIterator(bcsssp.getServiceProvider().getCurrentServiceSelectors(getBeanContextServicesPeer(), serviceClass)) : null;
     }
@@ -950,7 +952,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
             fireServiceAdded(bcssae);
 
-            Iterator i;
+            Iterator<Object> i;
 
             synchronized(children) {
                 i = children.keySet().iterator();
@@ -982,7 +984,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
             fireServiceRevoked(bcssre);
 
-            Iterator i;
+            Iterator<Object> i;
 
             synchronized(children) {
                 i = children.keySet().iterator();
@@ -1085,7 +1087,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * Fires a <tt>BeanContextServiceEvent</tt> notifying of a new service.
      * @param serviceClass the service class
      */
-    protected final void fireServiceAdded(Class serviceClass) {
+    protected final void fireServiceAdded(Class<?> serviceClass) {
         BeanContextServiceAvailableEvent bcssae = new BeanContextServiceAvailableEvent(getBeanContextServicesPeer(), serviceClass);
 
         fireServiceAdded(bcssae);
@@ -1129,7 +1131,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * @param serviceClass the service class
      * @param revokeNow whether or not the event should be revoked now
      */
-    protected final void fireServiceRevoked(Class serviceClass, boolean revokeNow) {
+    protected final void fireServiceRevoked(Class<?> serviceClass, boolean revokeNow) {
         Object[]                       copy;
         BeanContextServiceRevokedEvent bcsre = new BeanContextServiceRevokedEvent(getBeanContextServicesPeer(), serviceClass, revokeNow);
 
@@ -1159,14 +1161,14 @@ public class      BeanContextServicesSupport extends BeanContextSupport
 
         int count = 0;
 
-        Iterator i = services.entrySet().iterator();
+        Iterator<Map.Entry<Object, BCSSServiceProvider>> i = services.entrySet().iterator();
 
         while (i.hasNext() && count < serializable) {
-            Map.Entry           entry = (Map.Entry)i.next();
+            Map.Entry<Object, BCSSServiceProvider> entry = i.next();
             BCSSServiceProvider bcsp  = null;
 
              try {
-                bcsp = (BCSSServiceProvider)entry.getValue();
+                bcsp = entry.getValue();
              } catch (ClassCastException cce) {
                 continue;
              }
@@ -1201,7 +1203,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
         int count = serializable;
 
         while (count > 0) {
-            services.put(ois.readObject(), ois.readObject());
+            services.put(ois.readObject(), (BCSSServiceProvider)ois.readObject());
             count--;
         }
     }
@@ -1236,7 +1238,7 @@ public class      BeanContextServicesSupport extends BeanContextSupport
      * all accesses to the <code> protected transient HashMap services </code>
      * field should be synchronized on that object
      */
-    protected transient HashMap                  services;
+    protected transient HashMap<Object, BCSSServiceProvider>  services;
 
     /**
      * The number of instances of a serializable <tt>BeanContextServceProvider</tt>.
@@ -1253,5 +1255,5 @@ public class      BeanContextServicesSupport extends BeanContextSupport
     /**
      * List of <tt>BeanContextServicesListener</tt> objects.
      */
-    protected transient ArrayList                bcsListeners;
+    protected transient ArrayList<BeanContextServicesListener> bcsListeners;
 }
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java
index e8cd43b6293..4845650e745 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java
@@ -254,7 +254,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * currently nested in this <tt>BeanContext</tt>.
      * @return an <tt>Iterator</tt> of the nested children
      */
-    public Iterator iterator() {
+    public Iterator<Object> iterator() {
         synchronized(children) {
             return new BCSIterator(children.keySet().iterator());
         }
@@ -292,14 +292,14 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * a noop remove() method.
      */
 
-    protected static final class BCSIterator implements Iterator {
-        BCSIterator(Iterator i) { super(); src = i; }
+    protected static final class BCSIterator implements Iterator<Object> {
+        BCSIterator(Iterator<?> i) { super(); src = i; }
 
         public boolean hasNext() { return src.hasNext(); }
-        public Object  next()    { return src.next();    }
+        public Object       next()    { return src.next();    }
         public void    remove()  { /* do nothing */      }
 
-        private Iterator src;
+        private Iterator<?> src;
     }
 
     /************************************************************************/
@@ -504,7 +504,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
                 throw new IllegalStateException();
             }
 
-            BCSChild bcsc  = (BCSChild)children.get(targetChild);
+            BCSChild bcsc  = children.get(targetChild);
             BCSChild pbcsc = null;
             Object   peer  = null;
 
@@ -533,7 +533,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
                     children.remove(targetChild);
 
                     if (bcsc.isProxyPeer()) {
-                        pbcsc = (BCSChild)children.get(peer = bcsc.getProxyPeer());
+                        pbcsc = children.get(peer = bcsc.getProxyPeer());
                         children.remove(peer);
                     }
                 }
@@ -566,9 +566,10 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * in the collection are children of
      * this <tt>BeanContext</tt>, false if not.
      */
+    @SuppressWarnings("rawtypes")
     public boolean containsAll(Collection c) {
         synchronized(children) {
-            Iterator i = c.iterator();
+            Iterator<?> i = c.iterator();
             while (i.hasNext())
                 if(!contains(i.next()))
                     return false;
@@ -583,6 +584,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * @throws UnsupportedOperationException thrown unconditionally by this implementation
      * @return this implementation unconditionally throws {@code UnsupportedOperationException}
      */
+    @SuppressWarnings("rawtypes")
     public boolean addAll(Collection c) {
         throw new UnsupportedOperationException();
     }
@@ -594,6 +596,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * @return this implementation unconditionally throws {@code UnsupportedOperationException}
 
      */
+    @SuppressWarnings("rawtypes")
     public boolean removeAll(Collection c) {
         throw new UnsupportedOperationException();
     }
@@ -605,6 +608,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * @throws UnsupportedOperationException thrown unconditionally by this implementation
      * @return this implementation unconditionally throws {@code UnsupportedOperationException}
      */
+    @SuppressWarnings("rawtypes")
     public boolean retainAll(Collection c) {
         throw new UnsupportedOperationException();
     }
@@ -763,7 +767,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
         }
 
         synchronized(children) {
-            for (Iterator i = children.keySet().iterator(); i.hasNext();) {
+            for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
                 Object c = i.next();
 
                 try {
@@ -790,7 +794,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
 
             // lets also tell the Children that can that they may not use their GUI's
             synchronized(children) {
-                for (Iterator i = children.keySet().iterator(); i.hasNext();) {
+                for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
                     Visibility v = getChildVisibility(i.next());
 
                     if (v != null) v.dontUseGui();
@@ -809,7 +813,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
 
             // lets also tell the Children that can that they may use their GUI's
             synchronized(children) {
-                for (Iterator i = children.keySet().iterator(); i.hasNext();) {
+                for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
                     Visibility v = getChildVisibility(i.next());
 
                     if (v != null) v.okToUseGui();
@@ -841,7 +845,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * of this <tt>BeanContext</tt>.
      * @return an iterator for all the current BCSChild values
      */
-    protected Iterator bcsChildren() { synchronized(children) { return children.values().iterator();  } }
+    protected Iterator<BCSChild> bcsChildren() { synchronized(children) { return children.values().iterator();  } }
 
     /**
      * called by writeObject after defaultWriteObject() but prior to
@@ -896,7 +900,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * @param coll the <tt>Collection</tt> to serialize
      * @throws IOException if serialization failed
      */
-    protected final void serialize(ObjectOutputStream oos, Collection coll) throws IOException {
+    protected final void serialize(ObjectOutputStream oos, Collection<?> coll) throws IOException {
         int      count   = 0;
         Object[] objects = coll.toArray();
 
@@ -926,6 +930,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * @throws IOException if deserialization failed
      * @throws ClassNotFoundException if needed classes are not found
      */
+    @SuppressWarnings({"rawtypes", "unchecked"})
     protected final void deserialize(ObjectInputStream ois, Collection coll) throws IOException, ClassNotFoundException {
         int count = 0;
 
@@ -953,10 +958,10 @@ public class      BeanContextSupport extends BeanContextChildSupport
         int count = 0;
 
         synchronized(children) {
-            Iterator i = children.entrySet().iterator();
+            Iterator<Map.Entry<Object, BCSChild>> i = children.entrySet().iterator();
 
             while (i.hasNext() && count < serializable) {
-                Map.Entry entry = (Map.Entry)i.next();
+                Map.Entry<Object, BCSChild> entry = i.next();
 
                 if (entry.getKey() instanceof Serializable) {
                     try {
@@ -1082,7 +1087,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
             if (serializable > 0 && this.equals(getBeanContextPeer()))
                 readChildren(ois);
 
-            deserialize(ois, bcmListeners = new ArrayList(1));
+            deserialize(ois, bcmListeners = new ArrayList<>(1));
         }
     }
 
@@ -1101,7 +1106,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
             ) {
                 if (!validatePendingRemove(source)) {
                     throw new PropertyVetoException("current BeanContext vetoes setBeanContext()", pce);
-                } else ((BCSChild)children.get(source)).setRemovePending(true);
+                } else children.get(source).setRemovePending(true);
             }
         }
     }
@@ -1117,13 +1122,13 @@ public class      BeanContextSupport extends BeanContextChildSupport
         synchronized(children) {
             if ("beanContext".equals(propertyName) &&
                 containsKey(source)                    &&
-                ((BCSChild)children.get(source)).isRemovePending()) {
+                children.get(source).isRemovePending()) {
                 BeanContext bc = getBeanContextPeer();
 
                 if (bc.equals(pce.getOldValue()) && !bc.equals(pce.getNewValue())) {
                     remove(source, false);
                 } else {
-                    ((BCSChild)children.get(source)).setRemovePending(false);
+                    children.get(source).setRemovePending(false);
                 }
             }
         }
@@ -1312,8 +1317,8 @@ public class      BeanContextSupport extends BeanContextChildSupport
      */
 
     protected synchronized void initialize() {
-        children     = new HashMap(serializable + 1);
-        bcmListeners = new ArrayList(1);
+        children     = new HashMap<>(serializable + 1);
+        bcmListeners = new ArrayList<>(1);
 
         childPCL = new PropertyChangeListener() {
 
@@ -1359,7 +1364,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * @param second the second object
      * @return true if equal, false if not
      */
-    protected static final boolean classEquals(Class first, Class second) {
+    protected static final boolean classEquals(Class<?> first, Class<?> second) {
         return first.equals(second) || first.getName().equals(second.getName());
     }
 
@@ -1373,7 +1378,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * all accesses to the <code> protected HashMap children </code> field
      * shall be synchronized on that object.
      */
-    protected transient HashMap         children;
+    protected transient HashMap<Object, BCSChild>         children;
 
     private             int             serializable  = 0; // children serializable
 
@@ -1381,7 +1386,7 @@ public class      BeanContextSupport extends BeanContextChildSupport
      * all accesses to the <code> protected ArrayList bcmListeners </code> field
      * shall be synchronized on that object.
      */
-    protected transient ArrayList       bcmListeners;
+    protected transient ArrayList<BeanContextMembershipListener> bcmListeners;
 
     //
 
-- 
GitLab


From 628e9352544d8034ece43f2c5202e26fd2370c99 Mon Sep 17 00:00:00 2001
From: Sergey Malenkov <malenkov@openjdk.org>
Date: Tue, 3 Jun 2014 21:03:35 +0400
Subject: [PATCH 038/192] 7084904: Introspector returns isX() from base
 package-private class that throws exception

Reviewed-by: serb
---
 .../Introspector/7084904/Test7084904.java     | 50 +++++++++++++++++++
 .../beans/Introspector/7084904/bean/Base.java | 29 +++++++++++
 .../Introspector/7084904/bean/Derived.java    | 26 ++++++++++
 3 files changed, 105 insertions(+)
 create mode 100644 jdk/test/java/beans/Introspector/7084904/Test7084904.java
 create mode 100644 jdk/test/java/beans/Introspector/7084904/bean/Base.java
 create mode 100644 jdk/test/java/beans/Introspector/7084904/bean/Derived.java

diff --git a/jdk/test/java/beans/Introspector/7084904/Test7084904.java b/jdk/test/java/beans/Introspector/7084904/Test7084904.java
new file mode 100644
index 00000000000..ded9c160d95
--- /dev/null
+++ b/jdk/test/java/beans/Introspector/7084904/Test7084904.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import bean.Derived;
+import java.lang.reflect.Method;
+/*
+ * @test
+ * @bug 7084904
+ * @summary Compares reflection and bean introspection
+ * @author Sergey Malenkov
+ */
+public class Test7084904 {
+    public static void main(String[] args) throws Exception {
+        System.setSecurityManager(new SecurityManager());
+        Derived bean = new Derived();
+        Class<?> type = bean.getClass();
+        Method method1 = test("reflection", bean, type.getMethod("isAllowed"));
+        Method method2 = test("bean introspection", bean, BeanUtils.getPropertyDescriptor(type, "allowed").getReadMethod());
+        if (!method1.equals(method2)) {
+            throw new Error("first method is not equal to the second one");
+        }
+    }
+
+    private static Method test(String name, Object bean, Method method) throws Exception {
+        System.out.println("\n === use " + name + " ===");
+        System.out.println(method);
+        System.out.println("declaring " + method.getDeclaringClass());
+        System.out.println("invocation result: " + method.invoke(bean));
+        return method;
+    }
+}
diff --git a/jdk/test/java/beans/Introspector/7084904/bean/Base.java b/jdk/test/java/beans/Introspector/7084904/bean/Base.java
new file mode 100644
index 00000000000..7efc9a03b8c
--- /dev/null
+++ b/jdk/test/java/beans/Introspector/7084904/bean/Base.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package bean;
+
+class Base {
+    public boolean isAllowed() {
+        return true;
+    }
+}
diff --git a/jdk/test/java/beans/Introspector/7084904/bean/Derived.java b/jdk/test/java/beans/Introspector/7084904/bean/Derived.java
new file mode 100644
index 00000000000..4c506bb409c
--- /dev/null
+++ b/jdk/test/java/beans/Introspector/7084904/bean/Derived.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package bean;
+
+public class Derived extends Base {
+}
-- 
GitLab


From f14291c31836827d74187b6576bd41c0eddad71e Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Tue, 3 Jun 2014 12:32:25 -0700
Subject: [PATCH 039/192] 8044694: Fix finally lint warnings in sun.print

Reviewed-by: prr
---
 jdk/src/share/classes/sun/print/PSPrinterJob.java   | 2 +-
 jdk/src/solaris/classes/sun/print/UnixPrintJob.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/jdk/src/share/classes/sun/print/PSPrinterJob.java b/jdk/src/share/classes/sun/print/PSPrinterJob.java
index fdaeb349992..325bfd8e718 100644
--- a/jdk/src/share/classes/sun/print/PSPrinterJob.java
+++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java
@@ -708,8 +708,8 @@ public class PSPrinterJob extends RasterPrinterJob {
                     }
                 } finally {
                     pw.flush();
-                    throw new IOException(sw.toString());
                 }
+                throw new IOException(sw.toString());
             }
         }
 
diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
index 57939732315..366a62f0e49 100644
--- a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
@@ -992,8 +992,8 @@ public class UnixPrintJob implements CancelablePrintJob {
                     }
                 } finally {
                     pw.flush();
-                    throw new IOException(sw.toString());
                 }
+                throw new IOException(sw.toString());
             }
         }
 
-- 
GitLab


From c7056f1df17a6b1c860c6f87234818c1e8742039 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Tue, 3 Jun 2014 17:03:29 -0700
Subject: [PATCH 040/192] 8044698: Fix finally lint warnings in javax.swing

Reviewed-by: prr, henryjen
---
 jdk/src/share/classes/javax/swing/JEditorPane.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/share/classes/javax/swing/JEditorPane.java b/jdk/src/share/classes/javax/swing/JEditorPane.java
index bc738185d20..bf2e28fbd37 100644
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java
@@ -679,8 +679,8 @@ public class JEditorPane extends JTextComponent {
                         }
                     });
                 }
-                return (pageLoaded ? page : old);
             }
+            return (pageLoaded ? page : old);
         }
 
         /**
-- 
GitLab


From 8dc26f1a171284dbb206f44ccfa2048f09502636 Mon Sep 17 00:00:00 2001
From: Staffan Larsen <sla@openjdk.org>
Date: Wed, 4 Jun 2014 11:05:30 +0200
Subject: [PATCH 041/192] 8044107: Add Diagnostic Command to list all
 ClassLoaders

Reviewed-by: mgerdin, stefank
---
 .../share/vm/classfile/classLoaderData.cpp    |   6 +
 .../share/vm/classfile/classLoaderData.hpp    |   1 +
 .../share/vm/classfile/classLoaderStats.cpp   | 167 ++++++++++++++++++
 .../share/vm/classfile/classLoaderStats.hpp   | 152 ++++++++++++++++
 hotspot/src/share/vm/memory/metaspace.cpp     |  11 ++
 hotspot/src/share/vm/memory/metaspace.hpp     |   3 +
 .../src/share/vm/runtime/vm_operations.hpp    |   1 +
 .../share/vm/services/diagnosticCommand.cpp   |   2 +
 .../dcmd/ClassLoaderStatsTest.java            | 155 ++++++++++++++++
 9 files changed, 498 insertions(+)
 create mode 100644 hotspot/src/share/vm/classfile/classLoaderStats.cpp
 create mode 100644 hotspot/src/share/vm/classfile/classLoaderStats.hpp
 create mode 100644 hotspot/test/serviceability/dcmd/ClassLoaderStatsTest.java

diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp
index bc88beb4343..efbde89ee30 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp
@@ -624,6 +624,12 @@ void ClassLoaderDataGraph::always_strong_oops_do(OopClosure* f, KlassClosure* kl
   }
 }
 
+void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
+  for (ClassLoaderData* cld = _head; cl != NULL && cld != NULL; cld = cld->next()) {
+    cl->do_cld(cld);
+  }
+}
+
 void ClassLoaderDataGraph::classes_do(KlassClosure* klass_closure) {
   for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
     cld->classes_do(klass_closure);
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp
index 5be3caa6515..964e4289ffe 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp
@@ -77,6 +77,7 @@ class ClassLoaderDataGraph : public AllStatic {
   static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim);
   static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
   static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
+  static void cld_do(CLDClosure* cl);
   static void classes_do(KlassClosure* klass_closure);
   static void classes_do(void f(Klass* const));
   static void methods_do(void f(Method*));
diff --git a/hotspot/src/share/vm/classfile/classLoaderStats.cpp b/hotspot/src/share/vm/classfile/classLoaderStats.cpp
new file mode 100644
index 00000000000..4eb98ed321c
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/classLoaderStats.cpp
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/classLoaderStats.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+
+class ClassStatsClosure : public KlassClosure {
+public:
+  int _num_classes;
+
+  ClassStatsClosure() :
+    _num_classes(0) {
+  }
+
+  virtual void do_klass(Klass* k) {
+    _num_classes++;
+  }
+};
+
+
+void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {
+  oop cl = cld->class_loader();
+  ClassLoaderStats* cls;
+
+  // The hashtable key is the ClassLoader oop since we want to account
+  // for "real" classes and anonymous classes together
+  ClassLoaderStats** cls_ptr = _stats->get(cl);
+  if (cls_ptr == NULL) {
+    cls = new ClassLoaderStats();
+    _stats->put(cl, cls);
+    _total_loaders++;
+  } else {
+    cls = *cls_ptr;
+  }
+
+  if (!cld->is_anonymous()) {
+    cls->_cld = cld;
+  }
+
+  cls->_class_loader = cl;
+  if (cl != NULL) {
+    cls->_parent = java_lang_ClassLoader::parent(cl);
+    addEmptyParents(cls->_parent);
+  }
+
+  ClassStatsClosure csc;
+  cld->classes_do(&csc);
+  if(cld->is_anonymous()) {
+    cls->_anon_classes_count += csc._num_classes;
+  } else {
+    cls->_classes_count = csc._num_classes;
+  }
+  _total_classes += csc._num_classes;
+
+  Metaspace* ms = cld->metaspace_or_null();
+  if (ms != NULL) {
+    if(cld->is_anonymous()) {
+      cls->_anon_chunk_sz += ms->allocated_chunks_bytes();
+      cls->_anon_block_sz += ms->allocated_blocks_bytes();
+    } else {
+      cls->_chunk_sz = ms->allocated_chunks_bytes();
+      cls->_block_sz = ms->allocated_blocks_bytes();
+    }
+    _total_chunk_sz += ms->allocated_chunks_bytes();
+    _total_block_sz += ms->allocated_blocks_bytes();
+  }
+}
+
+
+// Handles the difference in pointer width on 32 and 64 bit platforms
+#ifdef _LP64
+  #define SPACE "%8s"
+#else
+  #define SPACE "%s"
+#endif
+
+
+bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats* const& cls) {
+  Klass* class_loader_klass = (cls->_class_loader == NULL ? NULL : cls->_class_loader->klass());
+  Klass* parent_klass = (cls->_parent == NULL ? NULL : cls->_parent->klass());
+
+  _out->print(INTPTR_FORMAT "  " INTPTR_FORMAT "  " INTPTR_FORMAT "  " UINTX_FORMAT_W(6) "  " SIZE_FORMAT_W(8) "  " SIZE_FORMAT_W(8) "  ",
+      p2i(class_loader_klass), p2i(parent_klass), p2i(cls->_cld),
+      cls->_classes_count,
+      cls->_chunk_sz, cls->_block_sz);
+  if (class_loader_klass != NULL) {
+    _out->print("%s", class_loader_klass->external_name());
+  } else {
+    _out->print("<boot class loader>");
+  }
+  _out->cr();
+  if (cls->_anon_classes_count > 0) {
+    _out->print_cr(SPACE SPACE SPACE "                                    " UINTX_FORMAT_W(6) "  " SIZE_FORMAT_W(8) "  " SIZE_FORMAT_W(8) "   + unsafe anonymous classes",
+        "", "", "",
+        cls->_anon_classes_count,
+        cls->_anon_chunk_sz, cls->_anon_block_sz);
+  }
+  return true;
+}
+
+
+void ClassLoaderStatsClosure::print() {
+  _out->print_cr("ClassLoader" SPACE " Parent" SPACE "      CLD*" SPACE "       Classes   ChunkSz   BlockSz  Type", "", "", "");
+  _stats->iterate(this);
+  _out->print("Total = " UINTX_FORMAT_W(-6), _total_loaders);
+  _out->print(SPACE SPACE SPACE "                      ", "", "", "");
+  _out->print_cr(UINTX_FORMAT_W(6) "  " SIZE_FORMAT_W(8) "  " SIZE_FORMAT_W(8) "  ",
+      _total_classes,
+      _total_chunk_sz,
+      _total_block_sz);
+  _out->print_cr("ChunkSz: Total size of all allocated metaspace chunks");
+  _out->print_cr("BlockSz: Total size of all allocated metaspace blocks (each chunk has several blocks)");
+}
+
+
+void ClassLoaderStatsClosure::addEmptyParents(oop cl) {
+  while (cl != NULL && java_lang_ClassLoader::loader_data(cl) == NULL) {
+    // This classloader has not loaded any classes
+    ClassLoaderStats** cls_ptr = _stats->get(cl);
+    if (cls_ptr == NULL) {
+      // It does not exist in our table - add it
+      ClassLoaderStats* cls = new ClassLoaderStats();
+      cls->_class_loader = cl;
+      cls->_parent = java_lang_ClassLoader::parent(cl);
+      _stats->put(cl, cls);
+      _total_loaders++;
+    }
+
+    cl = java_lang_ClassLoader::parent(cl);
+  }
+}
+
+
+void ClassLoaderStatsVMOperation::doit() {
+  ClassLoaderStatsClosure clsc (_out);
+  ClassLoaderDataGraph::cld_do(&clsc);
+  clsc.print();
+}
+
+
+void ClassLoaderStatsDCmd::execute(DCmdSource source, TRAPS) {
+  ClassLoaderStatsVMOperation op(output());
+  VMThread::execute(&op);
+}
diff --git a/hotspot/src/share/vm/classfile/classLoaderStats.hpp b/hotspot/src/share/vm/classfile/classLoaderStats.hpp
new file mode 100644
index 00000000000..89e0e473b3b
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/classLoaderStats.hpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_CLASSLOADERSTATS_HPP
+#define SHARE_VM_CLASSFILE_CLASSLOADERSTATS_HPP
+
+
+#include "classfile/classLoaderData.hpp"
+#include "oops/klass.hpp"
+#include "oops/oopsHierarchy.hpp"
+#include "runtime/vm_operations.hpp"
+#include "services/diagnosticCommand.hpp"
+#include "utilities/resourceHash.hpp"
+
+
+class ClassLoaderStatsDCmd : public DCmd {
+public:
+  ClassLoaderStatsDCmd(outputStream* output, bool heap) :
+    DCmd(output, heap) {
+  }
+
+  static const char* name() {
+    return "VM.classloader_stats";
+  }
+
+  static const char* description() {
+    return "Print statistics about all ClassLoaders.";
+  }
+
+  static const char* impact() {
+    return "Low";
+  }
+
+  virtual void execute(DCmdSource source, TRAPS);
+
+  static int num_arguments() {
+    return 0;
+  }
+
+  static const JavaPermission permission() {
+    JavaPermission p = {"java.lang.management.ManagementPermission",
+                        "monitor", NULL};
+    return p;
+  }
+};
+
+
+class ClassLoaderStats : public ResourceObj {
+public:
+  ClassLoaderData*  _cld;
+  oop               _class_loader;
+  oop               _parent;
+
+  size_t            _chunk_sz;
+  size_t            _block_sz;
+  uintx             _classes_count;
+
+  size_t            _anon_chunk_sz;
+  size_t            _anon_block_sz;
+  uintx             _anon_classes_count;
+
+  ClassLoaderStats() :
+    _cld(0),
+    _class_loader(0),
+    _parent(0),
+    _chunk_sz(0),
+    _block_sz(0),
+    _classes_count(0),
+    _anon_block_sz(0),
+    _anon_chunk_sz(0),
+    _anon_classes_count(0) {
+  }
+};
+
+
+class ClassLoaderStatsClosure : public CLDClosure {
+protected:
+  static bool oop_equals(oop const& s1, oop const& s2) {
+    return s1 == s2;
+  }
+
+  static unsigned oop_hash(oop const& s1) {
+    unsigned hash = (unsigned)((uintptr_t)&s1);
+    return hash ^ (hash >> LogMinObjAlignment);
+  }
+
+  typedef ResourceHashtable<oop, ClassLoaderStats*,
+      ClassLoaderStatsClosure::oop_hash, ClassLoaderStatsClosure::oop_equals> StatsTable;
+
+  outputStream* _out;
+  StatsTable* _stats;
+  uintx   _total_loaders;
+  uintx   _total_classes;
+  size_t  _total_chunk_sz;
+  size_t  _total_block_sz;
+
+public:
+  ClassLoaderStatsClosure(outputStream* out) :
+    _out(out),
+    _total_loaders(0),
+    _total_block_sz(0),
+    _total_chunk_sz(0),
+    _total_classes(0),
+    _stats(new StatsTable()) {
+  }
+
+  virtual void do_cld(ClassLoaderData* cld);
+  virtual bool do_entry(oop const& key, ClassLoaderStats* const& cls);
+  void print();
+
+private:
+  void addEmptyParents(oop cl);
+};
+
+
+class ClassLoaderStatsVMOperation : public VM_Operation {
+  outputStream* _out;
+
+public:
+  ClassLoaderStatsVMOperation(outputStream* out) :
+    _out(out) {
+  }
+
+  VMOp_Type type() const {
+    return VMOp_ClassLoaderStatsOperation;
+  }
+
+  void doit();
+};
+
+#endif // SHARE_VM_CLASSFILE_CLASSLOADERSTATS_HPP
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index cd5fceff2d0..4dce7a9c3cc 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -697,6 +697,7 @@ class SpaceManager : public CHeapObj<mtClass> {
   size_t allocated_blocks_words() const { return _allocated_blocks_words; }
   size_t allocated_blocks_bytes() const { return _allocated_blocks_words * BytesPerWord; }
   size_t allocated_chunks_words() const { return _allocated_chunks_words; }
+  size_t allocated_chunks_bytes() const { return _allocated_chunks_words * BytesPerWord; }
   size_t allocated_chunks_count() const { return _allocated_chunks_count; }
 
   bool is_humongous(size_t word_size) { return word_size > medium_chunk_size(); }
@@ -3349,6 +3350,16 @@ size_t Metaspace::capacity_bytes_slow(MetadataType mdtype) const {
   return capacity_words_slow(mdtype) * BytesPerWord;
 }
 
+size_t Metaspace::allocated_blocks_bytes() const {
+  return vsm()->allocated_blocks_bytes() +
+      (using_class_space() ? class_vsm()->allocated_blocks_bytes() : 0);
+}
+
+size_t Metaspace::allocated_chunks_bytes() const {
+  return vsm()->allocated_chunks_bytes() +
+      (using_class_space() ? class_vsm()->allocated_chunks_bytes() : 0);
+}
+
 void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
   assert(!SafepointSynchronize::is_at_safepoint()
          || Thread::current()->is_VM_thread(), "should be the VM thread");
diff --git a/hotspot/src/share/vm/memory/metaspace.hpp b/hotspot/src/share/vm/memory/metaspace.hpp
index 22e21b80d3d..453fef5deee 100644
--- a/hotspot/src/share/vm/memory/metaspace.hpp
+++ b/hotspot/src/share/vm/memory/metaspace.hpp
@@ -225,6 +225,9 @@ class Metaspace : public CHeapObj<mtClass> {
   size_t used_bytes_slow(MetadataType mdtype) const;
   size_t capacity_bytes_slow(MetadataType mdtype) const;
 
+  size_t allocated_blocks_bytes() const;
+  size_t allocated_chunks_bytes() const;
+
   static MetaWord* allocate(ClassLoaderData* loader_data, size_t word_size,
                             bool read_only, MetaspaceObj::Type type, TRAPS);
   void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp
index 8f2f0ba06f7..4e32a3adfa2 100644
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp
@@ -98,6 +98,7 @@
   template(LinuxDllLoad)                          \
   template(RotateGCLog)                           \
   template(WhiteBoxOperation)                     \
+  template(ClassLoaderStatsOperation)             \
 
 class VM_Operation: public CHeapObj<mtInternal> {
  public:
diff --git a/hotspot/src/share/vm/services/diagnosticCommand.cpp b/hotspot/src/share/vm/services/diagnosticCommand.cpp
index ca031f87963..892e2ce57b6 100644
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderStats.hpp"
 #include "gc_implementation/shared/vmGCOperations.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/os.hpp"
@@ -58,6 +59,7 @@ void DCmdRegistrant::register_dcmds(){
 #endif // INCLUDE_SERVICES
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RotateGCLogDCmd>(full_export, true, false));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
 
   // Enhanced JMX Agent Support
   // These commands won't be exported via the DiagnosticCommandMBean until an
diff --git a/hotspot/test/serviceability/dcmd/ClassLoaderStatsTest.java b/hotspot/test/serviceability/dcmd/ClassLoaderStatsTest.java
new file mode 100644
index 00000000000..0b229a8a9a1
--- /dev/null
+++ b/hotspot/test/serviceability/dcmd/ClassLoaderStatsTest.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ *
+ * @build ClassLoaderStatsTest DcmdUtil
+ * @run main ClassLoaderStatsTest
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.StringReader;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class ClassLoaderStatsTest {
+
+    // ClassLoader         Parent              CLD*               Classes   ChunkSz   BlockSz  Type
+    // 0x00000007c0215928  0x0000000000000000  0x0000000000000000       0         0         0  org.eclipse.osgi.baseadaptor.BaseAdaptor$1
+    // 0x00000007c0009868  0x0000000000000000  0x00007fc52aebcc80       1      6144      3768  sun.reflect.DelegatingClassLoader
+    // 0x00000007c0009868  0x0000000000000000  0x00007fc52b8916d0       1      6144      3688  sun.reflect.DelegatingClassLoader
+    // 0x00000007c0009868  0x00000007c0038ba8  0x00007fc52afb8760       1      6144      3688  sun.reflect.DelegatingClassLoader
+    // 0x00000007c0009868  0x0000000000000000  0x00007fc52afbb1a0       1      6144      3688  sun.reflect.DelegatingClassLoader
+    // 0x0000000000000000  0x0000000000000000  0x00007fc523416070    5019  30060544  29956216  <boot classloader>
+    //                                                                455   1210368    672848   + unsafe anonymous classes
+    // 0x00000007c016b5c8  0x00000007c0038ba8  0x00007fc52a995000       5      8192      5864  org.netbeans.StandardModule$OneModuleClassLoader
+    // 0x00000007c0009868  0x00000007c016b5c8  0x00007fc52ac13640       1      6144      3896  sun.reflect.DelegatingClassLoader
+    // ...
+
+    static Pattern clLine = Pattern.compile("0x\\p{XDigit}*\\s*0x\\p{XDigit}*\\s*0x\\p{XDigit}*\\s*(\\d*)\\s*(\\d*)\\s*(\\d*)\\s*(.*)");
+    static Pattern anonLine = Pattern.compile("\\s*(\\d*)\\s*(\\d*)\\s*(\\d*)\\s*.*");
+
+    public static DummyClassLoader dummyloader;
+
+    public static void main(String arg[]) throws Exception {
+
+        // create a classloader and load our special class
+        dummyloader = new DummyClassLoader();
+        Class<?> c = Class.forName("TestClass", true, dummyloader);
+        if (c.getClassLoader() != dummyloader) {
+            throw new RuntimeException("TestClass defined by wrong classloader: " + c.getClassLoader());
+        }
+
+        String result = DcmdUtil.executeDcmd("VM.classloader_stats");
+        BufferedReader r = new BufferedReader(new StringReader(result));
+        String line;
+        while((line = r.readLine()) != null) {
+            Matcher m = clLine.matcher(line);
+            if (m.matches()) {
+                // verify that DummyClassLoader has loaded 1 class and 1 anonymous class
+                if (m.group(4).equals("ClassLoaderStatsTest$DummyClassLoader")) {
+                    System.out.println("line: " + line);
+                    if (!m.group(1).equals("1")) {
+                        throw new Exception("Should have loaded 1 class: " + line);
+                    }
+                    checkPositiveInt(m.group(2));
+                    checkPositiveInt(m.group(3));
+
+                    String next = r.readLine();
+                    System.out.println("next: " + next);
+                    Matcher m1 = anonLine.matcher(next);
+                    m1.matches();
+                    if (!m1.group(1).equals("1")) {
+                        throw new Exception("Should have loaded 1 anonymous class, but found : " + m1.group(1));
+                    }
+                    checkPositiveInt(m1.group(2));
+                    checkPositiveInt(m1.group(3));
+                }
+            }
+        }
+    }
+
+    private static void checkPositiveInt(String s) throws Exception {
+        if (Integer.parseInt(s) <= 0) {
+            throw new Exception("Value should have been > 0: " + s);
+        }
+    }
+
+    public static class DummyClassLoader extends ClassLoader {
+
+        public static final String CLASS_NAME = "TestClass";
+
+        static ByteBuffer readClassFile(String name)
+        {
+            File f = new File(System.getProperty("test.classes", "."),
+                              name);
+            try (FileInputStream fin = new FileInputStream(f);
+                 FileChannel fc = fin.getChannel())
+            {
+                return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+            } catch (IOException e) {
+                throw new RuntimeException("Can't open file: " + name, e);
+            }
+        }
+
+        protected Class<?> loadClass(String name, boolean resolve)
+            throws ClassNotFoundException
+        {
+            Class<?> c;
+            if (!"TestClass".equals(name)) {
+                c = super.loadClass(name, resolve);
+            } else {
+                // should not delegate to the system class loader
+                c = findClass(name);
+                if (resolve) {
+                    resolveClass(c);
+                }
+            }
+            return c;
+        }
+
+        protected Class<?> findClass(String name)
+            throws ClassNotFoundException
+        {
+            if (!"TestClass".equals(name)) {
+                throw new ClassNotFoundException("Unexpected class: " + name);
+            }
+            return defineClass(name, readClassFile(name + ".class"), null);
+        }
+    } /* DummyClassLoader */
+
+}
+
+class TestClass {
+    static {
+        // force creation of anonymous class (for the lambdaform)
+        Runnable r = () -> System.out.println("Hello");
+        r.run();
+    }
+}
-- 
GitLab


From 61a1a26d7a6064c3b4ba7a00536786c2e9b225ea Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Wed, 4 Jun 2014 16:55:06 +0400
Subject: [PATCH 042/192] 8041129: [OGL] surface->sw blit is extremely slow
 8017626: [OGL] Translucent VolatileImages don't paint correctly

Reviewed-by: bae, flar
---
 .../sun/java2d/opengl/OGLBlitLoops.java       |  12 +-
 .../native/sun/java2d/opengl/OGLBlitLoops.c   |  82 +++++++--
 .../DrawImage/IncorrectAlphaSurface2SW.java   | 161 +++++++++++++++++
 .../DrawImage/IncorrectDestinationOffset.java | 164 ++++++++++++++++++
 .../DrawImage/IncorrectSourceOffset.java      | 100 +++++++++++
 5 files changed, 496 insertions(+), 23 deletions(-)
 create mode 100644 jdk/test/java/awt/image/DrawImage/IncorrectAlphaSurface2SW.java
 create mode 100644 jdk/test/java/awt/image/DrawImage/IncorrectDestinationOffset.java
 create mode 100644 jdk/test/java/awt/image/DrawImage/IncorrectSourceOffset.java

diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
index 64459c1145e..aeab20823bb 100644
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -71,6 +71,8 @@ class OGLBlitLoops {
             // surface->sw ops
             new OGLSurfaceToSwBlit(SurfaceType.IntArgb,
                                    OGLSurfaceData.PF_INT_ARGB),
+            new OGLSurfaceToSwBlit(SurfaceType.IntArgbPre,
+                                   OGLSurfaceData.PF_INT_ARGB_PRE),
 
             // sw->surface ops
             blitIntArgbPreToSurface,
@@ -505,12 +507,12 @@ class OGLRTTSurfaceToSurfaceTransform extends TransformBlit {
     }
 }
 
-class OGLSurfaceToSwBlit extends Blit {
+final class OGLSurfaceToSwBlit extends Blit {
 
-    private int typeval;
+    private final int typeval;
 
-    // REMIND: destination will actually be opaque/premultiplied...
-    OGLSurfaceToSwBlit(SurfaceType dstType, int typeval) {
+    // destination will actually be ArgbPre or Argb
+    OGLSurfaceToSwBlit(final SurfaceType dstType,final int typeval) {
         super(OGLSurfaceData.OpenGLSurface,
               CompositeType.SrcNoEa,
               dstType);
diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c b/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c
index 828298672e8..fa9a2fe34a5 100644
--- a/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -34,6 +34,10 @@
 #include "OGLSurfaceData.h"
 #include "GraphicsPrimitiveMgr.h"
 
+#include <stdlib.h> // malloc
+#include <string.h> // memcpy
+#include "IntArgbPre.h"
+
 extern OGLPixelFormat PixelFormats[];
 
 /**
@@ -335,6 +339,9 @@ OGLBlitToSurfaceViaTexture(OGLContext *oglc, SurfaceDataRasInfo *srcInfo,
                                         0, 0, sw, sh,
                                         pf->format, pf->type,
                                         srcInfo->rasBase);
+
+                    j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+                    j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
                 }
 
                 // the texture image is "right side up", so we align the
@@ -696,6 +703,50 @@ OGLBlitLoops_Blit(JNIEnv *env,
     SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
 }
 
+/**
+ * This method makes vertical flip of the provided area of Surface and convert
+ * pixel's data from argbPre to argb format if requested.
+ */
+void flip(void *pDst, juint w, juint h, jint scanStride, jboolean convert) {
+    const size_t clippedStride = 4 * w;
+    void *tempRow = (h > 1 && !convert) ? malloc(clippedStride) : NULL;
+    juint i = 0;
+    juint step = 0;
+    // vertical flip and convert argbpre to argb if necessary
+    for (; i < h / 2; ++i) {
+        juint *r1 = PtrAddBytes(pDst, (i * scanStride));
+        juint *r2 = PtrAddBytes(pDst, (h - i - 1) * scanStride);
+        if (tempRow) {
+            // fast path
+            memcpy(tempRow, r1, clippedStride);
+            memcpy(r1, r2, clippedStride);
+            memcpy(r2, tempRow, clippedStride);
+        } else {
+            // slow path
+            for (step = 0; step < w; ++step) {
+                juint tmp = r1[step];
+                if (convert) {
+                    LoadIntArgbPreTo1IntArgb(r2, 0, step, r1[step]);
+                    LoadIntArgbPreTo1IntArgb(&tmp, 0, 0, r2[step]);
+                } else {
+                    r1[step] = r2[step];
+                    r2[step] = tmp;
+                }
+            }
+        }
+    }
+    // convert the middle line if necessary
+    if (convert && h % 2) {
+        juint *r1 = PtrAddBytes(pDst, (i * scanStride));
+        for (step = 0; step < w; ++step) {
+            LoadIntArgbPreTo1IntArgb(r1, 0, step, r1[step]);
+        }
+    }
+    if (tempRow) {
+        free(tempRow);
+    }
+}
+
 /**
  * Specialized blit method for copying a native OpenGL "Surface" (pbuffer,
  * window, etc.) to a system memory ("Sw") surface.
@@ -758,7 +809,9 @@ OGLBlitLoops_SurfaceToSwBlit(JNIEnv *env, OGLContext *oglc,
             width = srcInfo.bounds.x2 - srcInfo.bounds.x1;
             height = srcInfo.bounds.y2 - srcInfo.bounds.y1;
 
-            j2d_glPixelStorei(GL_PACK_SKIP_PIXELS, dstx);
+            pDst = PtrAddBytes(pDst, dstx * dstInfo.pixelStride);
+            pDst = PtrAddBytes(pDst, dsty * dstInfo.scanStride);
+
             j2d_glPixelStorei(GL_PACK_ROW_LENGTH,
                               dstInfo.scanStride / dstInfo.pixelStride);
             j2d_glPixelStorei(GL_PACK_ALIGNMENT, pf.alignment);
@@ -779,27 +832,20 @@ OGLBlitLoops_SurfaceToSwBlit(JNIEnv *env, OGLContext *oglc,
 
             // this accounts for lower-left origin of the source region
             srcx = srcOps->xOffset + srcx;
-            srcy = srcOps->yOffset + srcOps->height - (srcy + 1);
-
-            // we must read one scanline at a time because there is no way
-            // to read starting at the top-left corner of the source region
-            while (height > 0) {
-                j2d_glPixelStorei(GL_PACK_SKIP_ROWS, dsty);
-                j2d_glReadPixels(srcx, srcy, width, 1,
-                                 pf.format, pf.type, pDst);
-                srcy--;
-                dsty++;
-                height--;
-            }
-
+            srcy = srcOps->yOffset + srcOps->height - srcy - height;
+
+            // Note that glReadPixels() is extremely slow!
+            // So we call it only once and flip the image using memcpy.
+            j2d_glReadPixels(srcx, srcy, width, height,
+                             pf.format, pf.type, pDst);
+            // It was checked above that width and height are positive.
+            flip(pDst, (juint) width, (juint) height, dstInfo.scanStride,
+                 !pf.isPremult && !srcOps->isOpaque);
 #ifdef MACOSX
             if (srcOps->isOpaque) {
                 j2d_glPixelTransferf(GL_ALPHA_BIAS, 0.0);
             }
 #endif
-
-            j2d_glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
-            j2d_glPixelStorei(GL_PACK_SKIP_ROWS, 0);
             j2d_glPixelStorei(GL_PACK_ROW_LENGTH, 0);
             j2d_glPixelStorei(GL_PACK_ALIGNMENT, 4);
         }
diff --git a/jdk/test/java/awt/image/DrawImage/IncorrectAlphaSurface2SW.java b/jdk/test/java/awt/image/DrawImage/IncorrectAlphaSurface2SW.java
new file mode 100644
index 00000000000..e6fb519d7af
--- /dev/null
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectAlphaSurface2SW.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import static java.awt.Transparency.TRANSLUCENT;
+import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR;
+import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE;
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE;
+
+/**
+ * @test
+ * @bug 8017626
+ * @summary Tests drawing transparent volatile image to transparent BI.
+ *          Results of the blit compatibleImage to transparent BI used for
+ *          comparison.
+ * @author Sergey Bylokhov
+ */
+public final class IncorrectAlphaSurface2SW {
+
+    private static final int[] SCALES = {1, 2, 4, 8};
+    private static final int[] SIZES = {1, 2, 3, 127, 128, 254, 255, 256};
+    private static final int[] dstTypes = {TYPE_INT_ARGB, TYPE_INT_ARGB_PRE,
+            TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE};
+    private static final int[] srcTypes = {TRANSLUCENT};
+
+
+    public static void main(final String[] args) throws IOException {
+        GraphicsEnvironment ge = GraphicsEnvironment
+                .getLocalGraphicsEnvironment();
+        GraphicsConfiguration gc = ge.getDefaultScreenDevice()
+                                     .getDefaultConfiguration();
+        BufferedImage destVI;
+        BufferedImage destBI;
+        BufferedImage sourceBI;
+        VolatileImage sourceVI;
+
+        for (final int s : SIZES) {
+            for (final int srcType : srcTypes) {
+                for (final int dstType : dstTypes) {
+                    for (final int scale : SCALES) {
+                        int sw = s * scale;
+                        destVI = new BufferedImage(sw, sw, dstType);
+                        destBI = new BufferedImage(sw, sw, dstType);
+                        sourceBI = gc.createCompatibleImage(sw, sw, srcType);
+                        sourceVI = gc.createCompatibleVolatileImage(s, s, srcType);
+
+                        // draw to dest BI using compatible image
+                        fill(sourceBI, s);
+                        Graphics2D big = destBI.createGraphics();
+                        big.setComposite(AlphaComposite.Src);
+                        big.drawImage(sourceBI, 0, 0, sw, sw, null);
+                        big.dispose();
+
+                        // draw to dest BI using compatible image
+                        fill(sourceVI, s);
+                        drawVItoBI(gc, destVI, sourceVI);
+
+                        validate(destVI, destBI);
+                        sourceVI.flush();
+                    }
+                }
+            }
+        }
+        System.out.println("Test PASSED");
+    }
+
+    private static void drawVItoBI(GraphicsConfiguration gc,
+                                   BufferedImage bi, VolatileImage vi) {
+        while (true) {
+            vi.validate(gc);
+            fill(vi, vi.getHeight());
+            if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
+                try {
+                    Thread.sleep(100);
+                } catch (final InterruptedException ignored) {
+                }
+                continue;
+            }
+
+            Graphics2D big = bi.createGraphics();
+            big.setComposite(AlphaComposite.Src);
+            big.drawImage(vi, 0, 0, bi.getWidth(), bi.getHeight(), null);
+            big.dispose();
+
+            if (vi.contentsLost()) {
+                try {
+                    Thread.sleep(100);
+                } catch (final InterruptedException ignored) {
+                }
+                continue;
+            }
+            break;
+        }
+    }
+
+    private static void validate(BufferedImage bi, BufferedImage gold)
+            throws IOException {
+        for (int x = 0; x < bi.getWidth(); ++x) {
+            for (int y = 0; y < bi.getHeight(); ++y) {
+                if (gold.getRGB(x, y) != bi.getRGB(x, y)) {
+                    System.err.println("Expected color = " + gold.getRGB(x, y));
+                    System.err.println("Actual color = " + bi.getRGB(x, y));
+                    ImageIO.write(gold, "png", new File("gold.png"));
+                    ImageIO.write(bi, "png", new File("bi.png"));
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+        }
+    }
+
+    /**
+     * Fills the whole image using different alpha for each row.
+     *
+     * @param image to fill
+     */
+    private static void fill(final Image image, final int size) {
+        Graphics2D graphics = (Graphics2D) image.getGraphics();
+        graphics.setComposite(AlphaComposite.Src);
+        graphics.setColor(Color.GREEN);
+        graphics.fillRect(0, 0, image.getWidth(null), image.getHeight(null));
+        int row = image.getHeight(null) / size;
+        for (int i = 0; i < size; ++i) {
+            graphics.setColor(new Color(23, 127, 189, i));
+            graphics.fillRect(0, i * row, image.getWidth(null), row);
+        }
+        graphics.dispose();
+    }
+}
diff --git a/jdk/test/java/awt/image/DrawImage/IncorrectDestinationOffset.java b/jdk/test/java/awt/image/DrawImage/IncorrectDestinationOffset.java
new file mode 100644
index 00000000000..66fafdf5756
--- /dev/null
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectDestinationOffset.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 8041129
+ * @summary Destination offset should be correct in case of Surface->SW blit.
+ *          Destination outside of the drawing area should be untouched.
+ * @author Sergey Bylokhov
+ */
+public final class IncorrectDestinationOffset {
+
+    private static final int SIZE = 128;
+    private static final double[] SCALES = {0.25, 0.5, 1, 1.5, 2.0, 4};
+
+    public static void main(final String[] args) throws IOException {
+        GraphicsEnvironment ge = GraphicsEnvironment
+                .getLocalGraphicsEnvironment();
+        GraphicsConfiguration gc = ge.getDefaultScreenDevice()
+                                     .getDefaultConfiguration();
+        VolatileImage vi = gc.createCompatibleVolatileImage(SIZE, SIZE);
+        BufferedImage bi = new BufferedImage(SIZE, SIZE,
+                                             BufferedImage.TYPE_INT_ARGB);
+        for (double scale : SCALES) {
+            while (true) {
+                // initialize Volatile Image
+                vi.validate(gc);
+                Graphics2D g2d = vi.createGraphics();
+                g2d.setColor(Color.green);
+                g2d.fillRect(0, 0, SIZE, SIZE);
+                g2d.dispose();
+
+                if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
+                    try {
+                        Thread.sleep(100);
+                    } catch (InterruptedException ignored) {
+                    }
+                    continue;
+                }
+                // Draw the VolatileImage to BI with scale and offsets
+                Graphics2D g = bi.createGraphics();
+                g.setComposite(AlphaComposite.Src);
+                g.setColor(Color.RED);
+                g.fillRect(0, 0, SIZE / 2, SIZE / 2);
+                g.setColor(Color.BLUE);
+                g.fillRect(SIZE / 2, 0, SIZE / 2, SIZE / 2);
+                g.setColor(Color.ORANGE);
+                g.fillRect(0, SIZE / 2, SIZE / 2, SIZE / 2);
+                g.setColor(Color.MAGENTA);
+                g.fillRect(SIZE / 2, SIZE / 2, SIZE / 2, SIZE / 2);
+
+                int point2draw = (int) (100 * scale);
+                int size2draw = (int) (SIZE * scale);
+                g.drawImage(vi, point2draw, point2draw, size2draw, size2draw,
+                            null);
+                g.dispose();
+
+                if (vi.contentsLost()) {
+                    try {
+                        Thread.sleep(100);
+                    } catch (InterruptedException ignored) {
+                    }
+                    continue;
+                }
+                validate(bi, point2draw, size2draw);
+                break;
+            }
+        }
+    }
+
+    private static void validate(BufferedImage bi, int point2draw,
+                                 int size2draw)
+            throws IOException {
+        for (int x = 0; x < SIZE; ++x) {
+            for (int y = 0; y < SIZE; ++y) {
+                if (isInsideGreenArea(point2draw, size2draw, x, y)) {
+                    if (bi.getRGB(x, y) != Color.green.getRGB()) {
+                        ImageIO.write(bi, "png", new File("image.png"));
+                        throw new RuntimeException("Test failed.");
+                    }
+                } else {
+                    if (isRedArea(x, y)) {
+                        if (bi.getRGB(x, y) != Color.red.getRGB()) {
+                            ImageIO.write(bi, "png", new File("image.png"));
+                            throw new RuntimeException("Test failed.");
+                        }
+                    }
+                    if (isBlueArea(x, y)) {
+                        if (bi.getRGB(x, y) != Color.blue.getRGB()) {
+                            ImageIO.write(bi, "png", new File("image.png"));
+                            throw new RuntimeException("Test failed.");
+                        }
+                    }
+                    if (isOrangeArea(x, y)) {
+                        if (bi.getRGB(x, y) != Color.orange.getRGB()) {
+                            ImageIO.write(bi, "png", new File("image.png"));
+                            throw new RuntimeException("Test failed.");
+                        }
+                    }
+                    if (isMagentaArea(x, y)) {
+                        if (bi.getRGB(x, y) != Color.magenta.getRGB()) {
+                            ImageIO.write(bi, "png", new File("image.png"));
+                            throw new RuntimeException("Test failed.");
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private static boolean isRedArea(int x, int y) {
+        return x < SIZE / 2 && y < SIZE / 2;
+    }
+
+    private static boolean isBlueArea(int x, int y) {
+        return x >= SIZE / 2 && y < SIZE / 2;
+    }
+
+    private static boolean isOrangeArea(int x, int y) {
+        return x < SIZE / 2 && y >= SIZE / 2;
+    }
+
+    private static boolean isMagentaArea(int x, int y) {
+        return x >= SIZE / 2 && y >= SIZE / 2;
+    }
+
+    private static boolean isInsideGreenArea(int point2draw, int size2draw,
+                                             int x, int y) {
+        return x >= point2draw && x < point2draw + size2draw && y >=
+                point2draw && y < point2draw + size2draw;
+    }
+}
diff --git a/jdk/test/java/awt/image/DrawImage/IncorrectSourceOffset.java b/jdk/test/java/awt/image/DrawImage/IncorrectSourceOffset.java
new file mode 100644
index 00000000000..5dd4f490b64
--- /dev/null
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectSourceOffset.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 8041129
+ * @summary Tests asymmetric source offsets.
+ * @author Sergey Bylokhov
+ */
+public final class IncorrectSourceOffset {
+
+    public static void main(final String[] args) throws IOException {
+        GraphicsEnvironment ge = GraphicsEnvironment
+                .getLocalGraphicsEnvironment();
+        GraphicsConfiguration gc = ge.getDefaultScreenDevice()
+                                     .getDefaultConfiguration();
+        VolatileImage vi = gc.createCompatibleVolatileImage(511, 255);
+        BufferedImage bi = new BufferedImage(511, 255,
+                                             BufferedImage.TYPE_INT_ARGB);
+        BufferedImage gold = new BufferedImage(511, 255,
+                                               BufferedImage.TYPE_INT_ARGB);
+        fill(gold);
+        while (true) {
+            vi.validate(gc);
+            fill(vi);
+            if (vi.validate(gc) != VolatileImage.IMAGE_OK) {
+                try {
+                    Thread.sleep(100);
+                } catch (final InterruptedException ignored) {
+                }
+                continue;
+            }
+
+            Graphics2D big = bi.createGraphics();
+            big.drawImage(vi, 7, 11, 127, 111, 7, 11, 127, 111, null);
+            big.dispose();
+            if (vi.contentsLost()) {
+                try {
+                    Thread.sleep(100);
+                } catch (final InterruptedException ignored) {
+                }
+                continue;
+            }
+            break;
+        }
+
+        for (int x = 7; x < 127; ++x) {
+            for (int y = 11; y < 111; ++y) {
+                if (gold.getRGB(x, y) != bi.getRGB(x, y)) {
+                    ImageIO.write(gold, "png", new File("gold.png"));
+                    ImageIO.write(bi, "png", new File("bi.png"));
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+        }
+    }
+
+    private static void fill(Image image) {
+        Graphics2D graphics = (Graphics2D) image.getGraphics();
+        graphics.setComposite(AlphaComposite.Src);
+        for (int i = 0; i < image.getHeight(null); ++i) {
+            graphics.setColor(new Color(i, 0, 0));
+            graphics.fillRect(0, i, image.getWidth(null), 1);
+        }
+        graphics.dispose();
+    }
+}
-- 
GitLab


From e31033ff1a8ff0053bb5dfa7f121539e7ef8df72 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Wed, 4 Jun 2014 17:14:56 +0400
Subject: [PATCH 043/192] 8043979: Javadoc cleanup of javax.sound.sampled
 package

Reviewed-by: pchelko, azvegint
---
 .../javax/sound/sampled/AudioFileFormat.java  |  196 ++-
 .../javax/sound/sampled/AudioFormat.java      |  460 ++++---
 .../javax/sound/sampled/AudioInputStream.java |  200 +--
 .../javax/sound/sampled/AudioPermission.java  |   58 +-
 .../javax/sound/sampled/AudioSystem.java      | 1088 ++++++++---------
 .../javax/sound/sampled/BooleanControl.java   |  127 +-
 .../classes/javax/sound/sampled/Clip.java     |  240 ++--
 .../javax/sound/sampled/CompoundControl.java  |   66 +-
 .../classes/javax/sound/sampled/Control.java  |   79 +-
 .../classes/javax/sound/sampled/DataLine.java |  408 +++----
 .../javax/sound/sampled/EnumControl.java      |  130 +-
 .../javax/sound/sampled/FloatControl.java     |  382 +++---
 .../classes/javax/sound/sampled/Line.java     |  311 +++--
 .../javax/sound/sampled/LineEvent.java        |  148 +--
 .../javax/sound/sampled/LineListener.java     |   41 +-
 .../sampled/LineUnavailableException.java     |   31 +-
 .../classes/javax/sound/sampled/Mixer.java    |  343 +++---
 .../classes/javax/sound/sampled/Port.java     |  104 +-
 .../javax/sound/sampled/ReverbType.java       |  168 ++-
 .../javax/sound/sampled/SourceDataLine.java   |  197 ++-
 .../javax/sound/sampled/TargetDataLine.java   |  170 ++-
 .../UnsupportedAudioFileException.java        |   21 +-
 .../sound/sampled/spi/AudioFileReader.java    |    2 +-
 .../sampled/spi/FormatConversionProvider.java |    8 +-
 24 files changed, 2318 insertions(+), 2660 deletions(-)

diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java
index 63f43dcc160..31a279d56ee 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java
@@ -25,36 +25,29 @@
 
 package javax.sound.sampled;
 
-import java.io.File;
-import java.io.OutputStream;
-import java.io.IOException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-
 /**
- * An instance of the <code>AudioFileFormat</code> class describes
- * an audio file, including the file type, the file's length in bytes,
- * the length in sample frames of the audio data contained in the file,
- * and the format of the audio data.
+ * An instance of the {@code AudioFileFormat} class describes an audio file,
+ * including the file type, the file's length in bytes, the length in sample
+ * frames of the audio data contained in the file, and the format of the audio
+ * data.
  * <p>
- * The <code>{@link AudioSystem}</code> class includes methods for determining the format
- * of an audio file, obtaining an audio input stream from an audio file, and
+ * The {@link AudioSystem} class includes methods for determining the format of
+ * an audio file, obtaining an audio input stream from an audio file, and
  * writing an audio file from an audio input stream.
- *
- * <p>An <code>AudioFileFormat</code> object can
- * include a set of properties. A property is a pair of key and value:
- * the key is of type <code>String</code>, the associated property
- * value is an arbitrary object.
- * Properties specify additional informational
- * meta data (like a author, copyright, or file duration).
- * Properties are optional information, and file reader and file
- * writer implementations are not required to provide or
- * recognize properties.
- *
- * <p>The following table lists some common properties that should
- * be used in implementations:
+ * <p>
+ * An {@code AudioFileFormat} object can include a set of properties. A property
+ * is a pair of key and value: the key is of type {@code String}, the associated
+ * property value is an arbitrary object. Properties specify additional
+ * informational meta data (like a author, copyright, or file duration).
+ * Properties are optional information, and file reader and file writer
+ * implementations are not required to provide or recognize properties.
+ * <p>
+ * The following table lists some common properties that should be used in
+ * implementations:
  *
  * <table border=1>
  *  <caption>Audio File Format Properties</caption>
@@ -104,17 +97,13 @@ import java.util.Map;
  */
 public class AudioFileFormat {
 
-
-    // INSTANCE VARIABLES
-
-
     /**
      * File type.
      */
     private Type type;
 
     /**
-     * File length in bytes
+     * File length in bytes.
      */
     private int byteLength;
 
@@ -124,25 +113,26 @@ public class AudioFileFormat {
     private AudioFormat format;
 
     /**
-     * Audio data length in sample frames
+     * Audio data length in sample frames.
      */
     private int frameLength;
 
-
-    /** The set of properties */
+    /**
+     * The set of properties.
+     */
     private HashMap<String, Object> properties;
 
-
     /**
-     * Constructs an audio file format object.
-     * This protected constructor is intended for use by providers of file-reading
-     * services when returning information about an audio file or about supported audio file
-     * formats.
-     * @param type the type of the audio file
-     * @param byteLength the length of the file in bytes, or <code>AudioSystem.NOT_SPECIFIED</code>
-     * @param format the format of the audio data contained in the file
-     * @param frameLength the audio data length in sample frames, or <code>AudioSystem.NOT_SPECIFIED</code>
+     * Constructs an audio file format object. This protected constructor is
+     * intended for use by providers of file-reading services when returning
+     * information about an audio file or about supported audio file formats.
      *
+     * @param  type the type of the audio file
+     * @param  byteLength the length of the file in bytes, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
+     * @param  format the format of the audio data contained in the file
+     * @param  frameLength the audio data length in sample frames, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      * @see #getType
      */
     protected AudioFileFormat(Type type, int byteLength, AudioFormat format, int frameLength) {
@@ -154,14 +144,15 @@ public class AudioFileFormat {
         this.properties = null;
     }
 
-
     /**
-     * Constructs an audio file format object.
-     * This public constructor may be used by applications to describe the
-     * properties of a requested audio file.
-     * @param type the type of the audio file
-     * @param format the format of the audio data contained in the file
-     * @param frameLength the audio data length in sample frames, or <code>AudioSystem.NOT_SPECIFIED</code>
+     * Constructs an audio file format object. This public constructor may be
+     * used by applications to describe the properties of a requested audio
+     * file.
+     *
+     * @param  type the type of the audio file
+     * @param  format the format of the audio data contained in the file
+     * @param  frameLength the audio data length in sample frames, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      */
     public AudioFileFormat(Type type, AudioFormat format, int frameLength) {
 
@@ -170,19 +161,16 @@ public class AudioFileFormat {
     }
 
     /**
-     * Construct an audio file format object with a set of
-     * defined properties.
+     * Construct an audio file format object with a set of defined properties.
      * This public constructor may be used by applications to describe the
-     * properties of a requested audio file. The properties map
-     * will be copied to prevent any changes to it.
-     *
-     * @param type        the type of the audio file
-     * @param format      the format of the audio data contained in the file
-     * @param frameLength the audio data length in sample frames, or
-     *                    <code>AudioSystem.NOT_SPECIFIED</code>
-     * @param properties  a <code>Map&lt;String,Object&gt;</code> object
-     *        with properties
+     * properties of a requested audio file. The properties map will be copied
+     * to prevent any changes to it.
      *
+     * @param  type the type of the audio file
+     * @param  format the format of the audio data contained in the file
+     * @param  frameLength the audio data length in sample frames, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
+     * @param  properties a {@code Map<String, Object>} object with properties
      * @since 1.5
      */
     public AudioFileFormat(Type type, AudioFormat format,
@@ -191,11 +179,10 @@ public class AudioFileFormat {
         this.properties = new HashMap<String, Object>(properties);
     }
 
-
     /**
-     * Obtains the audio file type, such as <code>WAVE</code> or <code>AU</code>.
-     * @return the audio file type
+     * Obtains the audio file type, such as {@code WAVE} or {@code AU}.
      *
+     * @return the audio file type
      * @see Type#WAVE
      * @see Type#AU
      * @see Type#AIFF
@@ -207,7 +194,9 @@ public class AudioFileFormat {
     }
 
     /**
-     * Obtains the size in bytes of the entire audio file (not just its audio data).
+     * Obtains the size in bytes of the entire audio file (not just its audio
+     * data).
+     *
      * @return the audio file length in bytes
      * @see AudioSystem#NOT_SPECIFIED
      */
@@ -217,6 +206,7 @@ public class AudioFileFormat {
 
     /**
      * Obtains the format of the audio data contained in the audio file.
+     *
      * @return the audio data format
      */
     public AudioFormat getFormat() {
@@ -224,7 +214,9 @@ public class AudioFileFormat {
     }
 
     /**
-     * Obtains the length of the audio data contained in the file, expressed in sample frames.
+     * Obtains the length of the audio data contained in the file, expressed in
+     * sample frames.
+     *
      * @return the number of sample frames of audio data in the file
      * @see AudioSystem#NOT_SPECIFIED
      */
@@ -233,18 +225,15 @@ public class AudioFileFormat {
     }
 
     /**
-     * Obtain an unmodifiable map of properties.
-     * The concept of properties is further explained in
-     * the {@link AudioFileFormat class description}.
-     *
-     * @return a <code>Map&lt;String,Object&gt;</code> object containing
-     *         all properties. If no properties are recognized, an empty map is
-     *         returned.
+     * Obtain an unmodifiable map of properties. The concept of properties is
+     * further explained in the {@link AudioFileFormat class description}.
      *
+     * @return a {@code Map<String, Object>} object containing all properties.
+     *         If no properties are recognized, an empty map is returned.
      * @see #getProperty(String)
      * @since 1.5
      */
-    public Map<String,Object> properties() {
+    public Map<String, Object> properties() {
         Map<String,Object> ret;
         if (properties == null) {
             ret = new HashMap<String,Object>(0);
@@ -254,20 +243,16 @@ public class AudioFileFormat {
         return Collections.unmodifiableMap(ret);
     }
 
-
     /**
-     * Obtain the property value specified by the key.
-     * The concept of properties is further explained in
-     * the {@link AudioFileFormat class description}.
-     *
-     * <p>If the specified property is not defined for a
-     * particular file format, this method returns
-     * <code>null</code>.
-     *
-     * @param key the key of the desired property
-     * @return the value of the property with the specified key,
-     *         or <code>null</code> if the property does not exist.
+     * Obtain the property value specified by the key. The concept of properties
+     * is further explained in the {@link AudioFileFormat class description}.
+     * <p>
+     * If the specified property is not defined for a particular file format,
+     * this method returns {@code null}.
      *
+     * @param  key the key of the desired property
+     * @return the value of the property with the specified key, or {@code null}
+     *         if the property does not exist
      * @see #properties()
      * @since 1.5
      */
@@ -278,11 +263,12 @@ public class AudioFileFormat {
         return properties.get(key);
     }
 
-
     /**
      * Provides a string representation of the file format.
+     *
      * @return the file format as a string
      */
+    @Override
     public String toString() {
 
         StringBuffer buf = new StringBuffer();
@@ -307,11 +293,9 @@ public class AudioFileFormat {
         return new String(buf);
     }
 
-
     /**
-     * An instance of the <code>Type</code> class represents one of the
-     * standard types of audio file.  Static instances are provided for the
-     * common types.
+     * An instance of the {@code Type} class represents one of the standard
+     * types of audio file. Static instances are provided for the common types.
      */
     public static class Type {
 
@@ -342,9 +326,6 @@ public class AudioFileFormat {
          */
         public static final Type SND = new Type("SND", "snd");
 
-
-        // INSTANCE VARIABLES
-
         /**
          * File type name.
          */
@@ -355,27 +336,22 @@ public class AudioFileFormat {
          */
         private final String extension;
 
-
-        // CONSTRUCTOR
-
         /**
          * Constructs a file type.
-         * @param name the string that names the file type
-         * @param extension the string that commonly marks the file type
-         * without leading dot.
+         *
+         * @param  name the string that names the file type
+         * @param  extension the string that commonly marks the file type
+         *         without leading dot
          */
         public Type(String name, String extension) {
-
             this.name = name;
             this.extension = extension;
         }
 
-
-        // METHODS
-
         /**
-         * Finalizes the equals method
+         * Finalizes the equals method.
          */
+        @Override
         public final boolean equals(Object obj) {
             if (toString() == null) {
                 return (obj != null) && (obj.toString() == null);
@@ -387,8 +363,9 @@ public class AudioFileFormat {
         }
 
         /**
-         * Finalizes the hashCode method
+         * Finalizes the hashCode method.
          */
+        @Override
         public final int hashCode() {
             if (toString() == null) {
                 return 0;
@@ -397,22 +374,23 @@ public class AudioFileFormat {
         }
 
         /**
-         * Provides the file type's name as the <code>String</code> representation
-         * of the file type.
+         * Provides the file type's name as the {@code String} representation of
+         * the file type.
+         *
          * @return the file type's name
          */
+        @Override
         public final String toString() {
             return name;
         }
 
         /**
          * Obtains the common file name extension for this file type.
+         *
          * @return file type extension
          */
         public String getExtension() {
             return extension;
         }
-
-    } // class Type
-
-} // class AudioFileFormat
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java
index cd084fcd32d..9ea70f975f1 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java
@@ -30,59 +30,63 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
- * <code>AudioFormat</code> is the class that specifies a particular arrangement of data in a sound stream.
- * By examining the information stored in the audio format, you can discover how to interpret the bits in the
- * binary sound data.
+ * {@code AudioFormat} is the class that specifies a particular arrangement of
+ * data in a sound stream. By examining the information stored in the audio
+ * format, you can discover how to interpret the bits in the binary sound data.
  * <p>
- * Every data line has an audio format associated with its data stream. The audio format of a source (playback) data line indicates
- * what kind of data the data line expects to receive for output.  For a target (capture) data line, the audio format specifies the kind
- * of the data that can be read from the line.
- * Sound files also have audio formats, of course.  The <code>{@link AudioFileFormat}</code>
- * class encapsulates an <code>AudioFormat</code> in addition to other,
- * file-specific information.  Similarly, an <code>{@link AudioInputStream}</code> has an
- * <code>AudioFormat</code>.
+ * Every data line has an audio format associated with its data stream. The
+ * audio format of a source (playback) data line indicates what kind of data the
+ * data line expects to receive for output. For a target (capture) data line,
+ * the audio format specifies the kind of the data that can be read from the
+ * line.
+ * Sound files also have audio formats, of course. The {@link AudioFileFormat}
+ * class encapsulates an {@code AudioFormat} in addition to other, file-specific
+ * information. Similarly, an {@link AudioInputStream} has an
+ * {@code AudioFormat}.
  * <p>
- * The <code>AudioFormat</code> class accommodates a number of common sound-file encoding techniques, including
- * pulse-code modulation (PCM), mu-law encoding, and a-law encoding.  These encoding techniques are predefined,
- * but service providers can create new encoding types.
- * The encoding that a specific format uses is named by its <code>encoding</code> field.
- *<p>
- * In addition to the encoding, the audio format includes other properties that further specify the exact
- * arrangement of the data.
- * These include the number of channels, sample rate, sample size, byte order, frame rate, and frame size.
- * Sounds may have different numbers of audio channels: one for mono, two for stereo.
- * The sample rate measures how many "snapshots" (samples) of the sound pressure are taken per second, per channel.
- * (If the sound is stereo rather than mono, two samples are actually measured at each instant of time: one for the left channel,
- * and another for the right channel; however, the sample rate still measures the number per channel, so the rate is the same
- * regardless of the number of channels.   This is the standard use of the term.)
- * The sample size indicates how many bits are used to store each snapshot; 8 and 16 are typical values.
- * For 16-bit samples (or any other sample size larger than a byte),
- * byte order is important; the bytes in each sample are arranged in
- * either the "little-endian" or "big-endian" style.
- * For encodings like PCM, a frame consists of the set of samples for all channels at a given
- * point in time, and so the size of a frame (in bytes) is always equal to the size of a sample (in bytes) times
- * the number of channels.  However, with some other sorts of encodings a frame can contain
- * a bundle of compressed data for a whole series of samples, as well as additional, non-sample
- * data.  For such encodings, the sample rate and sample size refer to the data after it is decoded into PCM,
- * and so they are completely different from the frame rate and frame size.
- *
- * <p>An <code>AudioFormat</code> object can include a set of
- * properties. A property is a pair of key and value: the key
- * is of type <code>String</code>, the associated property
- * value is an arbitrary object. Properties specify
- * additional format specifications, like the bit rate for
- * compressed formats. Properties are mainly used as a means
- * to transport additional information of the audio format
- * to and from the service providers. Therefore, properties
- * are ignored in the {@link #matches(AudioFormat)} method.
- * However, methods which rely on the installed service
- * providers, like {@link AudioSystem#isConversionSupported
- * (AudioFormat, AudioFormat) isConversionSupported} may consider
- * properties, depending on the respective service provider
- * implementation.
- *
- * <p>The following table lists some common properties which
- * service providers should use, if applicable:
+ * The {@code AudioFormat} class accommodates a number of common sound-file
+ * encoding techniques, including pulse-code modulation (PCM), mu-law encoding,
+ * and a-law encoding. These encoding techniques are predefined, but service
+ * providers can create new encoding types. The encoding that a specific format
+ * uses is named by its {@code encoding} field.
+ * <p>
+ * In addition to the encoding, the audio format includes other properties that
+ * further specify the exact arrangement of the data. These include the number
+ * of channels, sample rate, sample size, byte order, frame rate, and frame
+ * size. Sounds may have different numbers of audio channels: one for mono, two
+ * for stereo. The sample rate measures how many "snapshots" (samples) of the
+ * sound pressure are taken per second, per channel. (If the sound is stereo
+ * rather than mono, two samples are actually measured at each instant of time:
+ * one for the left channel, and another for the right channel; however, the
+ * sample rate still measures the number per channel, so the rate is the same
+ * regardless of the number of channels. This is the standard use of the term.)
+ * The sample size indicates how many bits are used to store each snapshot; 8
+ * and 16 are typical values. For 16-bit samples (or any other sample size
+ * larger than a byte), byte order is important; the bytes in each sample are
+ * arranged in either the "little-endian" or "big-endian" style. For encodings
+ * like PCM, a frame consists of the set of samples for all channels at a given
+ * point in time, and so the size of a frame (in bytes) is always equal to the
+ * size of a sample (in bytes) times the number of channels. However, with some
+ * other sorts of encodings a frame can contain a bundle of compressed data for
+ * a whole series of samples, as well as additional, non-sample data. For such
+ * encodings, the sample rate and sample size refer to the data after it is
+ * decoded into PCM, and so they are completely different from the frame rate
+ * and frame size.
+ * <p>
+ * An {@code AudioFormat} object can include a set of properties. A property is
+ * a pair of key and value: the key is of type {@code String}, the associated
+ * property value is an arbitrary object. Properties specify additional format
+ * specifications, like the bit rate for compressed formats. Properties are
+ * mainly used as a means to transport additional information of the audio
+ * format to and from the service providers. Therefore, properties are ignored
+ * in the {@link #matches(AudioFormat)} method. However, methods which rely on
+ * the installed service providers, like
+ * {@link AudioSystem#isConversionSupported (AudioFormat, AudioFormat)
+ * isConversionSupported} may consider properties, depending on the respective
+ * service provider implementation.
+ * <p>
+ * The following table lists some common properties which service providers
+ * should use, if applicable:
  *
  * <table border=0>
  *  <caption>Audio Format Properties</caption>
@@ -99,7 +103,7 @@ import java.util.Map;
  *  <tr>
  *   <td>&quot;vbr&quot;</td>
  *   <td>{@link java.lang.Boolean Boolean}</td>
- *   <td><code>true</code>, if the file is encoded in variable bit
+ *   <td>{@code true}, if the file is encoded in variable bit
  *       rate (VBR)</td>
  *  </tr>
  *  <tr>
@@ -108,11 +112,10 @@ import java.util.Map;
  *   <td>encoding/conversion quality, 1..100</td>
  *  </tr>
  * </table>
- *
- * <p>Vendors of service providers (plugins) are encouraged
- * to seek information about other already established
- * properties in third party plugins, and follow the same
- * conventions.
+ * <p>
+ * Vendors of service providers (plugins) are encouraged to seek information
+ * about other already established properties in third party plugins, and follow
+ * the same conventions.
  *
  * @author Kara Kytle
  * @author Florian Bomers
@@ -124,16 +127,14 @@ import java.util.Map;
  */
 public class AudioFormat {
 
-    // INSTANCE VARIABLES
-
-
     /**
      * The audio encoding technique used by this format.
      */
     protected Encoding encoding;
 
     /**
-     * The number of samples played or recorded per second, for sounds that have this format.
+     * The number of samples played or recorded per second, for sounds that have
+     * this format.
      */
     protected float sampleRate;
 
@@ -153,34 +154,37 @@ public class AudioFormat {
     protected int frameSize;
 
     /**
-     * The number of frames played or recorded per second, for sounds that have this format.
+     * The number of frames played or recorded per second, for sounds that have
+     * this format.
      */
     protected float frameRate;
 
     /**
-     * Indicates whether the audio data is stored in big-endian or little-endian order.
+     * Indicates whether the audio data is stored in big-endian or little-endian
+     * order.
      */
     protected boolean bigEndian;
 
-
-    /** The set of properties */
+    /**
+     * The set of properties.
+     */
     private HashMap<String, Object> properties;
 
-
     /**
-     * Constructs an <code>AudioFormat</code> with the given parameters.
-     * The encoding specifies the convention used to represent the data.
-     * The other parameters are further explained in the {@link AudioFormat
-     * class description}.
-     * @param encoding                  the audio encoding technique
-     * @param sampleRate                the number of samples per second
-     * @param sampleSizeInBits  the number of bits in each sample
-     * @param channels                  the number of channels (1 for mono, 2 for stereo, and so on)
-     * @param frameSize                 the number of bytes in each frame
-     * @param frameRate                 the number of frames per second
-     * @param bigEndian                 indicates whether the data for a single sample
-     *                                                  is stored in big-endian byte order (<code>false</code>
-     *                                                  means little-endian)
+     * Constructs an {@code AudioFormat} with the given parameters. The encoding
+     * specifies the convention used to represent the data. The other parameters
+     * are further explained in the {@link AudioFormat class description}.
+     *
+     * @param  encoding the audio encoding technique
+     * @param  sampleRate the number of samples per second
+     * @param  sampleSizeInBits the number of bits in each sample
+     * @param  channels the number of channels (1 for mono, 2 for stereo,
+     *         and so on)
+     * @param  frameSize the number of bytes in each frame
+     * @param  frameRate the number of frames per second
+     * @param  bigEndian indicates whether the data for a single sample is
+     *         stored in big-endian byte order ({@code false} means
+     *         little-endian)
      */
     public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
                        int channels, int frameSize, float frameRate, boolean bigEndian) {
@@ -195,25 +199,22 @@ public class AudioFormat {
         this.properties = null;
     }
 
-
     /**
-     * Constructs an <code>AudioFormat</code> with the given parameters.
-     * The encoding specifies the convention used to represent the data.
-     * The other parameters are further explained in the {@link AudioFormat
-     * class description}.
-     * @param encoding         the audio encoding technique
-     * @param sampleRate       the number of samples per second
-     * @param sampleSizeInBits the number of bits in each sample
-     * @param channels         the number of channels (1 for mono, 2 for
-     *                         stereo, and so on)
-     * @param frameSize        the number of bytes in each frame
-     * @param frameRate        the number of frames per second
-     * @param bigEndian        indicates whether the data for a single sample
-     *                         is stored in big-endian byte order
-     *                         (<code>false</code> means little-endian)
-     * @param properties       a <code>Map&lt;String,Object&gt;</code> object
-     *                         containing format properties
+     * Constructs an {@code AudioFormat} with the given parameters. The encoding
+     * specifies the convention used to represent the data. The other parameters
+     * are further explained in the {@link AudioFormat class description}.
      *
+     * @param  encoding the audio encoding technique
+     * @param  sampleRate the number of samples per second
+     * @param  sampleSizeInBits the number of bits in each sample
+     * @param  channels the number of channels (1 for mono, 2 for stereo, and so
+     *         on)
+     * @param  frameSize the number of bytes in each frame
+     * @param  frameRate the number of frames per second
+     * @param  bigEndian indicates whether the data for a single sample is
+     *         stored in big-endian byte order ({@code false} means little-endian)
+     * @param  properties a {@code Map<String, Object>} object containing format
+     *         properties
      * @since 1.5
      */
     public AudioFormat(Encoding encoding, float sampleRate,
@@ -225,20 +226,20 @@ public class AudioFormat {
         this.properties = new HashMap<String, Object>(properties);
     }
 
-
     /**
-     * Constructs an <code>AudioFormat</code> with a linear PCM encoding and
-     * the given parameters.  The frame size is set to the number of bytes
-     * required to contain one sample from each channel, and the frame rate
-     * is set to the sample rate.
+     * Constructs an {@code AudioFormat} with a linear PCM encoding and the
+     * given parameters. The frame size is set to the number of bytes required
+     * to contain one sample from each channel, and the frame rate is set to the
+     * sample rate.
      *
-     * @param sampleRate                the number of samples per second
-     * @param sampleSizeInBits  the number of bits in each sample
-     * @param channels                  the number of channels (1 for mono, 2 for stereo, and so on)
-     * @param signed                    indicates whether the data is signed or unsigned
-     * @param bigEndian                 indicates whether the data for a single sample
-     *                                                  is stored in big-endian byte order (<code>false</code>
-     *                                                  means little-endian)
+     * @param  sampleRate the number of samples per second
+     * @param  sampleSizeInBits the number of bits in each sample
+     * @param  channels the number of channels (1 for mono, 2 for stereo, and so
+     *         on)
+     * @param  signed indicates whether the data is signed or unsigned
+     * @param  bigEndian indicates whether the data for a single sample is
+     *         stored in big-endian byte order ({@code false} means
+     *         little-endian)
      */
     public AudioFormat(float sampleRate, int sampleSizeInBits,
                        int channels, boolean signed, boolean bigEndian) {
@@ -269,19 +270,17 @@ public class AudioFormat {
     }
 
     /**
-     * Obtains the sample rate.
-     * For compressed formats, the return value is the sample rate of the uncompressed
-     * audio data.
-     * When this AudioFormat is used for queries (e.g. {@link
-     * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
-     * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
-     * DataLine.Info#getFormats() DataLine.Info.getFormats}), a sample rate of
-     * <code>AudioSystem.NOT_SPECIFIED</code> means that any sample rate is
-     * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
-     * the sample rate is not defined for this audio format.
-     * @return the number of samples per second,
-     * or <code>AudioSystem.NOT_SPECIFIED</code>
+     * Obtains the sample rate. For compressed formats, the return value is the
+     * sample rate of the uncompressed audio data. When this AudioFormat is used
+     * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+     * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
+     * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample rate
+     * of {@code AudioSystem.NOT_SPECIFIED} means that any sample rate is
+     * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+     * sample rate is not defined for this audio format.
      *
+     * @return the number of samples per second, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      * @see #getFrameRate()
      * @see AudioSystem#NOT_SPECIFIED
      */
@@ -291,19 +290,18 @@ public class AudioFormat {
     }
 
     /**
-     * Obtains the size of a sample.
-     * For compressed formats, the return value is the sample size of the
-     * uncompressed audio data.
-     * When this AudioFormat is used for queries (e.g. {@link
-     * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
-     * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
-     * DataLine.Info#getFormats() DataLine.Info.getFormats}), a sample size of
-     * <code>AudioSystem.NOT_SPECIFIED</code> means that any sample size is
-     * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
-     * the sample size is not defined for this audio format.
-     * @return the number of bits in each sample,
-     * or <code>AudioSystem.NOT_SPECIFIED</code>
+     * Obtains the size of a sample. For compressed formats, the return value is
+     * the sample size of the uncompressed audio data. When this AudioFormat is
+     * used for queries (e.g. {@link AudioSystem#isConversionSupported(
+     * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
+     * capabilities (e.g.
+     * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample size
+     * of {@code AudioSystem.NOT_SPECIFIED} means that any sample size is
+     * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+     * sample size is not defined for this audio format.
      *
+     * @return the number of bits in each sample, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      * @see #getFrameSize()
      * @see AudioSystem#NOT_SPECIFIED
      */
@@ -313,16 +311,15 @@ public class AudioFormat {
     }
 
     /**
-     * Obtains the number of channels.
-     * When this AudioFormat is used for queries (e.g. {@link
-     * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
-     * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
-     * DataLine.Info#getFormats() DataLine.Info.getFormats}), a return value of
-     * <code>AudioSystem.NOT_SPECIFIED</code> means that any (positive) number of channels is
-     * acceptable.
-     * @return The number of channels (1 for mono, 2 for stereo, etc.),
-     * or <code>AudioSystem.NOT_SPECIFIED</code>
+     * Obtains the number of channels. When this AudioFormat is used for queries
+     * (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
+     * AudioSystem.isConversionSupported}) or capabilities (e.g.
+     * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a return
+     * value of {@code AudioSystem.NOT_SPECIFIED} means that any (positive)
+     * number of channels is acceptable.
      *
+     * @return The number of channels (1 for mono, 2 for stereo, etc.), or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      * @see AudioSystem#NOT_SPECIFIED
      */
     public int getChannels() {
@@ -331,17 +328,16 @@ public class AudioFormat {
     }
 
     /**
-     * Obtains the frame size in bytes.
-     * When this AudioFormat is used for queries (e.g. {@link
-     * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
-     * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
-     * DataLine.Info#getFormats() DataLine.Info.getFormats}), a frame size of
-     * <code>AudioSystem.NOT_SPECIFIED</code> means that any frame size is
-     * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
-     * the frame size is not defined for this audio format.
-     * @return the number of bytes per frame,
-     * or <code>AudioSystem.NOT_SPECIFIED</code>
+     * Obtains the frame size in bytes. When this AudioFormat is used for
+     * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+     * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
+     * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame size
+     * of {@code AudioSystem.NOT_SPECIFIED} means that any frame size is
+     * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+     * frame size is not defined for this audio format.
      *
+     * @return the number of bytes per frame, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      * @see #getSampleSizeInBits()
      * @see AudioSystem#NOT_SPECIFIED
      */
@@ -351,17 +347,17 @@ public class AudioFormat {
     }
 
     /**
-     * Obtains the frame rate in frames per second.
-     * When this AudioFormat is used for queries (e.g. {@link
-     * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
-     * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
-     * DataLine.Info#getFormats() DataLine.Info.getFormats}), a frame rate of
-     * <code>AudioSystem.NOT_SPECIFIED</code> means that any frame rate is
-     * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
-     * the frame rate is not defined for this audio format.
-     * @return the number of frames per second,
-     * or <code>AudioSystem.NOT_SPECIFIED</code>
+     * Obtains the frame rate in frames per second. When this AudioFormat is
+     * used for queries (e.g. {@link AudioSystem#isConversionSupported(
+     * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
+     * capabilities (e.g.
+     * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame rate
+     * of {@code AudioSystem.NOT_SPECIFIED} means that any frame rate is
+     * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+     * frame rate is not defined for this audio format.
      *
+     * @return the number of frames per second, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      * @see #getSampleRate()
      * @see AudioSystem#NOT_SPECIFIED
      */
@@ -370,29 +366,25 @@ public class AudioFormat {
         return frameRate;
     }
 
-
     /**
      * Indicates whether the audio data is stored in big-endian or little-endian
-     * byte order.  If the sample size is not more than one byte, the return value is
-     * irrelevant.
-     * @return <code>true</code> if the data is stored in big-endian byte order,
-     * <code>false</code> if little-endian
+     * byte order. If the sample size is not more than one byte, the return
+     * value is irrelevant.
+     *
+     * @return {@code true} if the data is stored in big-endian byte order,
+     *         {@code false} if little-endian
      */
     public boolean isBigEndian() {
 
         return bigEndian;
     }
 
-
     /**
-     * Obtain an unmodifiable map of properties.
-     * The concept of properties is further explained in
-     * the {@link AudioFileFormat class description}.
-     *
-     * @return a <code>Map&lt;String,Object&gt;</code> object containing
-     *         all properties. If no properties are recognized, an empty map is
-     *         returned.
+     * Obtain an unmodifiable map of properties. The concept of properties is
+     * further explained in the {@link AudioFileFormat class description}.
      *
+     * @return a {@code Map<String, Object>} object containing all properties.
+     *         If no properties are recognized, an empty map is returned.
      * @see #getProperty(String)
      * @since 1.5
      */
@@ -406,20 +398,16 @@ public class AudioFormat {
         return Collections.unmodifiableMap(ret);
     }
 
-
     /**
-     * Obtain the property value specified by the key.
-     * The concept of properties is further explained in
-     * the {@link AudioFileFormat class description}.
-     *
-     * <p>If the specified property is not defined for a
-     * particular file format, this method returns
-     * <code>null</code>.
-     *
-     * @param key the key of the desired property
-     * @return the value of the property with the specified key,
-     *         or <code>null</code> if the property does not exist.
+     * Obtain the property value specified by the key. The concept of properties
+     * is further explained in the {@link AudioFileFormat class description}.
+     * <p>
+     * If the specified property is not defined for a particular file format,
+     * this method returns {@code null}.
      *
+     * @param  key the key of the desired property
+     * @return the value of the property with the specified key, or {@code null}
+     *         if the property does not exist
      * @see #properties()
      * @since 1.5
      */
@@ -430,21 +418,18 @@ public class AudioFormat {
         return properties.get(key);
     }
 
-
     /**
-     * Indicates whether this format matches the one specified.
-     * To match, two formats must have the same encoding,
-     * and consistent values of the number of channels, sample rate, sample size,
-     * frame rate, and frame size.
-     * The values of the property are consistent if they are equal
-     * or the specified format has the property value
-     * {@code AudioSystem.NOT_SPECIFIED}.
-     * The byte order (big-endian or little-endian) must be the same
-     * if the sample size is greater than one byte.
+     * Indicates whether this format matches the one specified. To match, two
+     * formats must have the same encoding, and consistent values of the number
+     * of channels, sample rate, sample size, frame rate, and frame size. The
+     * values of the property are consistent if they are equal or the specified
+     * format has the property value {@code AudioSystem.NOT_SPECIFIED}. The byte
+     * order (big-endian or little-endian) must be the same if the sample size
+     * is greater than one byte.
      *
-     * @param format format to test for match
+     * @param  format format to test for match
      * @return {@code true} if this format matches the one specified,
-     *         {@code false} otherwise.
+     *         {@code false} otherwise
      */
     public boolean matches(AudioFormat format) {
         if (format.getEncoding().equals(getEncoding())
@@ -465,14 +450,14 @@ public class AudioFormat {
         return false;
     }
 
-
     /**
-     * Returns a string that describes the format, such as:
-     * "PCM SIGNED 22050 Hz 16 bit mono big-endian".  The contents of the string
-     * may vary between implementations of Java Sound.
+     * Returns a string that describes the format, such as: "PCM SIGNED 22050 Hz
+     * 16 bit mono big-endian". The contents of the string may vary between
+     * implementations of Java Sound.
      *
      * @return a string that describes the format parameters
      */
+    @Override
     public String toString() {
         String sEncoding = "";
         if (getEncoding() != null) {
@@ -546,42 +531,36 @@ public class AudioFormat {
     }
 
     /**
-     * The <code>Encoding</code> class  names the  specific type of data representation
-     * used for an audio stream.   The encoding includes aspects of the
-     * sound format other than the number of channels, sample rate, sample size,
-     * frame rate, frame size, and byte order.
+     * The {@code Encoding} class names the specific type of data representation
+     * used for an audio stream. The encoding includes aspects of the sound
+     * format other than the number of channels, sample rate, sample size, frame
+     * rate, frame size, and byte order.
      * <p>
      * One ubiquitous type of audio encoding is pulse-code modulation (PCM),
      * which is simply a linear (proportional) representation of the sound
-     * waveform.  With PCM, the number stored in each sample is proportional
-     * to the instantaneous amplitude of the sound pressure at that point in
-     * time.  The numbers may be signed or unsigned integers or floats.
-     * Besides PCM, other encodings include mu-law and a-law, which are nonlinear
-     * mappings of the sound amplitude that are often used for recording speech.
+     * waveform. With PCM, the number stored in each sample is proportional to
+     * the instantaneous amplitude of the sound pressure at that point in time.
+     * The numbers may be signed or unsigned integers or floats. Besides PCM,
+     * other encodings include mu-law and a-law, which are nonlinear mappings of
+     * the sound amplitude that are often used for recording speech.
      * <p>
      * You can use a predefined encoding by referring to one of the static
-     * objects created by this class, such as PCM_SIGNED or
-     * PCM_UNSIGNED.  Service providers can create new encodings, such as
-     * compressed audio formats, and make
-     * these available through the <code>{@link AudioSystem}</code> class.
+     * objects created by this class, such as PCM_SIGNED or PCM_UNSIGNED.
+     * Service providers can create new encodings, such as compressed audio
+     * formats, and make these available through the {@link AudioSystem} class.
      * <p>
-     * The <code>Encoding</code> class is static, so that all
-     * <code>AudioFormat</code> objects that have the same encoding will refer
-     * to the same object (rather than different instances of the same class).
-     * This allows matches to be made by checking that two format's encodings
-     * are equal.
+     * The {@code Encoding} class is static, so that all {@code AudioFormat}
+     * objects that have the same encoding will refer to the same object (rather
+     * than different instances of the same class). This allows matches to be
+     * made by checking that two format's encodings are equal.
      *
+     * @author Kara Kytle
      * @see AudioFormat
      * @see javax.sound.sampled.spi.FormatConversionProvider
-     *
-     * @author Kara Kytle
      * @since 1.3
      */
     public static class Encoding {
 
-
-        // ENCODING DEFINES
-
         /**
          * Specifies signed, linear PCM data.
          */
@@ -609,31 +588,24 @@ public class AudioFormat {
          */
         public static final Encoding ALAW = new Encoding("ALAW");
 
-
-        // INSTANCE VARIABLES
-
         /**
          * Encoding name.
          */
         private String name;
 
-
-        // CONSTRUCTOR
-
         /**
          * Constructs a new encoding.
-         * @param name  the name of the new type of encoding
+         *
+         * @param  name the name of the new type of encoding
          */
         public Encoding(String name) {
             this.name = name;
         }
 
-
-        // METHODS
-
         /**
-         * Finalizes the equals method
+         * Finalizes the equals method.
          */
+        @Override
         public final boolean equals(Object obj) {
             if (toString() == null) {
                 return (obj != null) && (obj.toString() == null);
@@ -645,8 +617,9 @@ public class AudioFormat {
         }
 
         /**
-         * Finalizes the hashCode method
+         * Finalizes the hashCode method.
          */
+        @Override
         public final int hashCode() {
             if (toString() == null) {
                 return 0;
@@ -655,16 +628,17 @@ public class AudioFormat {
         }
 
         /**
-         * Provides the <code>String</code> representation of the encoding.  This <code>String</code> is
-         * the same name that was passed to the constructor.  For the predefined encodings, the name
-         * is similar to the encoding's variable (field) name.  For example, <code>PCM_SIGNED.toString()</code> returns
-         * the name "pcm_signed".
+         * Provides the {@code String} representation of the encoding. This
+         * {@code String} is the same name that was passed to the constructor.
+         * For the predefined encodings, the name is similar to the encoding's
+         * variable (field) name. For example, {@code PCM_SIGNED.toString()}
+         * returns the name "pcm_signed".
          *
          * @return the encoding name
          */
+        @Override
         public final String toString() {
             return name;
         }
-
-    } // class Encoding
+    }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioInputStream.java b/jdk/src/share/classes/javax/sound/sampled/AudioInputStream.java
index ea4162fa2f3..14e7b537f1b 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioInputStream.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,27 +25,24 @@
 
 package javax.sound.sampled;
 
-import java.io.InputStream;
-import java.io.PushbackInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
 
 /**
  * An audio input stream is an input stream with a specified audio format and
- * length.  The length is expressed in sample frames, not bytes.
- * Several methods are provided for reading a certain number of bytes from
- * the stream, or an unspecified number of bytes.
- * The audio input stream keeps track  of the last byte that was read.
- * You can skip over an arbitrary number of bytes to get to a later position
- * for reading. An audio input stream may support marks.  When you set a mark,
- * the current position is remembered so that you can return to it later.
+ * length. The length is expressed in sample frames, not bytes. Several methods
+ * are provided for reading a certain number of bytes from the stream, or an
+ * unspecified number of bytes. The audio input stream keeps track of the last
+ * byte that was read. You can skip over an arbitrary number of bytes to get to
+ * a later position for reading. An audio input stream may support marks. When
+ * you set a mark, the current position is remembered so that you can return to
+ * it later.
  * <p>
- * The <code>AudioSystem</code> class includes many methods that manipulate
- * <code>AudioInputStream</code> objects.
- * For example, the methods let you:
+ * The {@code AudioSystem} class includes many methods that manipulate
+ * {@code AudioInputStream} objects. For example, the methods let you:
  * <ul>
- * <li> obtain an
- * audio input stream from an external audio file, stream, or URL
+ * <li> obtain an audio input stream from an external audio file, stream, or URL
  * <li> write an external file from an audio input stream
  * <li> convert an audio input stream to a different audio format
  * </ul>
@@ -53,16 +50,15 @@ import java.io.IOException;
  * @author David Rivas
  * @author Kara Kytle
  * @author Florian Bomers
- *
  * @see AudioSystem
- * @see Clip#open(AudioInputStream) Clip.open(AudioInputStream)
+ * @see Clip#open(AudioInputStream)
  * @since 1.3
  */
 public class AudioInputStream extends InputStream {
 
     /**
-     * The <code>InputStream</code> from which this <code>AudioInputStream</code>
-     * object was constructed.
+     * The {@code InputStream} from which this {@code AudioInputStream} object
+     * was constructed.
      */
     private InputStream stream;
 
@@ -92,35 +88,34 @@ public class AudioInputStream extends InputStream {
     private long markpos;
 
     /**
-     * When the underlying stream could only return
-     * a non-integral number of frames, store
-     * the remainder in a temporary buffer
+     * When the underlying stream could only return a non-integral number of
+     * frames, store the remainder in a temporary buffer.
      */
     private byte[] pushBackBuffer = null;
 
     /**
-     * number of valid bytes in the pushBackBuffer
+     * number of valid bytes in the pushBackBuffer.
      */
     private int pushBackLen = 0;
 
     /**
-     * MarkBuffer at mark position
+     * MarkBuffer at mark position.
      */
     private byte[] markPushBackBuffer = null;
 
     /**
-     * number of valid bytes in the markPushBackBuffer
+     * number of valid bytes in the markPushBackBuffer.
      */
     private int markPushBackLen = 0;
 
-
     /**
-     * Constructs an audio input stream that has the requested format and length in sample frames,
-     * using audio data from the specified input stream.
-     * @param stream the stream on which this <code>AudioInputStream</code>
-     * object is based
-     * @param format the format of this stream's audio data
-     * @param length the length in sample frames of the data in this stream
+     * Constructs an audio input stream that has the requested format and length
+     * in sample frames, using audio data from the specified input stream.
+     *
+     * @param  stream the stream on which this {@code AudioInputStream} object
+     *         is based
+     * @param  format the format of this stream's audio data
+     * @param  length the length in sample frames of the data in this stream
      */
     public AudioInputStream(InputStream stream, AudioFormat format, long length) {
 
@@ -141,12 +136,12 @@ public class AudioInputStream extends InputStream {
         markpos = 0;
     }
 
-
     /**
-     * Constructs an audio input stream that reads its data from the target
-     * data line indicated.  The format of the stream is the same as that of
-     * the target data line, and the length is AudioSystem#NOT_SPECIFIED.
-     * @param line the target data line from which this stream obtains its data.
+     * Constructs an audio input stream that reads its data from the target data
+     * line indicated. The format of the stream is the same as that of the
+     * target data line, and the length is AudioSystem#NOT_SPECIFIED.
+     *
+     * @param  line the target data line from which this stream obtains its data
      * @see AudioSystem#NOT_SPECIFIED
      */
     public AudioInputStream(TargetDataLine line) {
@@ -164,29 +159,29 @@ public class AudioInputStream extends InputStream {
         markpos = 0;
     }
 
-
     /**
      * Obtains the audio format of the sound data in this audio input stream.
+     *
      * @return an audio format object describing this stream's format
      */
     public AudioFormat getFormat() {
         return format;
     }
 
-
     /**
-     * Obtains the length of the stream, expressed in sample frames rather than bytes.
+     * Obtains the length of the stream, expressed in sample frames rather than
+     * bytes.
+     *
      * @return the length in sample frames
      */
     public long getFrameLength() {
         return frameLength;
     }
 
-
     /**
-     * Reads the next byte of data from the audio input stream.  The audio input
-     * stream's frame size must be one byte, or an <code>IOException</code>
-     * will be thrown.
+     * Reads the next byte of data from the audio input stream. The audio input
+     * stream's frame size must be one byte, or an {@code IOException} will be
+     * thrown.
      *
      * @return the next byte of data, or -1 if the end of the stream is reached
      * @throws IOException if an input or output error occurs
@@ -194,6 +189,7 @@ public class AudioInputStream extends InputStream {
      * @see #read(byte[])
      * @see #available
      */
+    @Override
     public int read() throws IOException {
         if( frameSize != 1 ) {
             throw new IOException("cannot read a single byte if frame size > 1");
@@ -208,50 +204,50 @@ public class AudioInputStream extends InputStream {
         return data[0] & 0xFF;
     }
 
-
     /**
-     * Reads some number of bytes from the audio input stream and stores them into
-     * the buffer array <code>b</code>. The number of bytes actually read is
-     * returned as an integer. This method blocks until input data is
-     * available, the end of the stream is detected, or an exception is thrown.
-     * <p>This method will always read an integral number of frames.
-     * If the length of the array is not an integral number
-     * of frames, a maximum of <code>b.length - (b.length % frameSize)
-     * </code> bytes will be read.
+     * Reads some number of bytes from the audio input stream and stores them
+     * into the buffer array {@code b}. The number of bytes actually read is
+     * returned as an integer. This method blocks until input data is available,
+     * the end of the stream is detected, or an exception is thrown.
+     * <p>
+     * This method will always read an integral number of frames. If the length
+     * of the array is not an integral number of frames, a maximum of
+     * {@code b.length - (b.length % frameSize)} bytes will be read.
      *
-     * @param b the buffer into which the data is read
-     * @return the total number of bytes read into the buffer, or -1 if there
-     * is no more data because the end of the stream has been reached
+     * @param  b the buffer into which the data is read
+     * @return the total number of bytes read into the buffer, or -1 if there is
+     *         no more data because the end of the stream has been reached
      * @throws IOException if an input or output error occurs
      * @see #read(byte[], int, int)
      * @see #read()
      * @see #available
      */
+    @Override
     public int read(byte[] b) throws IOException {
         return read(b,0,b.length);
     }
 
-
     /**
      * Reads up to a specified maximum number of bytes of data from the audio
      * stream, putting them into the given byte array.
-     * <p>This method will always read an integral number of frames.
-     * If <code>len</code> does not specify an integral number
-     * of frames, a maximum of <code>len - (len % frameSize)
-     * </code> bytes will be read.
+     * <p>
+     * This method will always read an integral number of frames. If {@code len}
+     * does not specify an integral number of frames, a maximum of
+     * {@code len - (len % frameSize)} bytes will be read.
      *
-     * @param b the buffer into which the data is read
-     * @param off the offset, from the beginning of array <code>b</code>, at which
-     * the data will be written
-     * @param len the maximum number of bytes to read
-     * @return the total number of bytes read into the buffer, or -1 if there
-     * is no more data because the end of the stream has been reached
+     * @param  b the buffer into which the data is read
+     * @param  off the offset, from the beginning of array {@code b}, at which
+     *         the data will be written
+     * @param  len the maximum number of bytes to read
+     * @return the total number of bytes read into the buffer, or -1 if there is
+     *         no more data because the end of the stream has been reached
      * @throws IOException if an input or output error occurs
      * @see #read(byte[])
      * @see #read()
      * @see #skip
      * @see #available
      */
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
 
         // make sure we don't read fractions of a frame.
@@ -313,16 +309,17 @@ public class AudioInputStream extends InputStream {
         return bytesRead;
     }
 
-
     /**
-     * Skips over and discards a specified number of bytes from this
-     * audio input stream.
-     * @param n the requested number of bytes to be skipped
+     * Skips over and discards a specified number of bytes from this audio input
+     * stream.
+     *
+     * @param  n the requested number of bytes to be skipped
      * @return the actual number of bytes skipped
      * @throws IOException if an input or output error occurs
      * @see #read
      * @see #available
      */
+    @Override
     public long skip(long n) throws IOException {
 
         // make sure not to skip fractional frames
@@ -351,21 +348,23 @@ public class AudioInputStream extends InputStream {
 
     }
 
-
     /**
-     * Returns the maximum number of bytes that can be read (or skipped over) from this
-     * audio input stream without blocking.  This limit applies only to the next invocation of
-     * a <code>read</code> or <code>skip</code> method for this audio input stream; the limit
-     * can vary each time these methods are invoked.
-     * Depending on the underlying stream,an IOException may be thrown if this
-     * stream is closed.
-     * @return the number of bytes that can be read from this audio input stream without blocking
+     * Returns the maximum number of bytes that can be read (or skipped over)
+     * from this audio input stream without blocking. This limit applies only
+     * to the next invocation of a {@code read} or {@code skip} method for this
+     * audio input stream; the limit can vary each time these methods are
+     * invoked. Depending on the underlying stream, an IOException may be thrown
+     * if this stream is closed.
+     *
+     * @return the number of bytes that can be read from this audio input stream
+     *         without blocking
      * @throws IOException if an input or output error occurs
      * @see #read(byte[], int, int)
      * @see #read(byte[])
      * @see #read()
      * @see #skip
      */
+    @Override
     public int available() throws IOException {
 
         int temp = stream.available();
@@ -378,25 +377,26 @@ public class AudioInputStream extends InputStream {
         }
     }
 
-
     /**
-     * Closes this audio input stream and releases any system resources associated
-     * with the stream.
+     * Closes this audio input stream and releases any system resources
+     * associated with the stream.
+     *
      * @throws IOException if an input or output error occurs
      */
+    @Override
     public void close() throws IOException {
         stream.close();
     }
 
-
     /**
      * Marks the current position in this audio input stream.
-     * @param readlimit the maximum number of bytes that can be read before
-     * the mark position becomes invalid.
+     *
+     * @param  readlimit the maximum number of bytes that can be read before the
+     *         mark position becomes invalid.
      * @see #reset
      * @see #markSupported
      */
-
+    @Override
     public void mark(int readlimit) {
 
         stream.mark(readlimit);
@@ -413,14 +413,15 @@ public class AudioInputStream extends InputStream {
         }
     }
 
-
     /**
-     * Repositions this audio input stream to the position it had at the time its
-     * <code>mark</code> method was last invoked.
-     * @throws IOException if an input or output error occurs.
+     * Repositions this audio input stream to the position it had at the time
+     * its {@code mark} method was last invoked.
+     *
+     * @throws IOException if an input or output error occurs
      * @see #mark
      * @see #markSupported
      */
+    @Override
     public void reset() throws IOException {
 
         stream.reset();
@@ -435,21 +436,21 @@ public class AudioInputStream extends InputStream {
         }
     }
 
-
     /**
-     * Tests whether this audio input stream supports the <code>mark</code> and
-     * <code>reset</code> methods.
-     * @return <code>true</code> if this stream supports the <code>mark</code>
-     * and <code>reset</code> methods; <code>false</code> otherwise
+     * Tests whether this audio input stream supports the {@code mark} and
+     * {@code reset} methods.
+     *
+     * @return {@code true} if this stream supports the {@code mark} and
+     *         {@code reset} methods; {@code false} otherwise
      * @see #mark
      * @see #reset
      */
+    @Override
     public boolean markSupported() {
 
         return stream.markSupported();
     }
 
-
     /**
      * Private inner class that makes a TargetDataLine look like an InputStream.
      */
@@ -460,19 +461,19 @@ public class AudioInputStream extends InputStream {
          */
         TargetDataLine line;
 
-
         TargetDataLineInputStream(TargetDataLine line) {
             super();
             this.line = line;
         }
 
-
+        @Override
         public int available() throws IOException {
             return line.available();
         }
 
         //$$fb 2001-07-16: added this method to correctly close the underlying TargetDataLine.
         // fixes bug 4479984
+        @Override
         public void close() throws IOException {
             // the line needs to be flushed and stopped to avoid a dead lock...
             // Probably related to bugs 4417527, 4334868, 4383457
@@ -483,6 +484,7 @@ public class AudioInputStream extends InputStream {
             line.close();
         }
 
+        @Override
         public int read() throws IOException {
 
             byte[] b = new byte[1];
@@ -502,7 +504,7 @@ public class AudioInputStream extends InputStream {
             return value;
         }
 
-
+        @Override
         public int read(byte[] b, int off, int len) throws IOException {
             try {
                 return line.read(b, off, len);
diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioPermission.java b/jdk/src/share/classes/javax/sound/sampled/AudioPermission.java
index 4e7dcef9602..13655254bf0 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioPermission.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioPermission.java
@@ -28,18 +28,18 @@ package javax.sound.sampled;
 import java.security.BasicPermission;
 
 /**
- * The <code>AudioPermission</code> class represents access rights to the audio
- * system resources.  An <code>AudioPermission</code> contains a target name
- * but no actions list; you either have the named permission or you don't.
+ * The {@code AudioPermission} class represents access rights to the audio
+ * system resources. An {@code AudioPermission} contains a target name but no
+ * actions list; you either have the named permission or you don't.
  * <p>
  * The target name is the name of the audio permission (see the table below).
- * The names follow the hierarchical property-naming convention. Also, an asterisk
- * can be used to represent all the audio permissions.
+ * The names follow the hierarchical property-naming convention. Also, an
+ * asterisk can be used to represent all the audio permissions.
  * <p>
- * The following table lists the possible <code>AudioPermission</code> target names.
- * For each name, the table provides a description of exactly what that permission
- * allows, as well as a discussion of the risks of granting code the permission.
- *
+ * The following table lists the possible {@code AudioPermission} target names.
+ * For each name, the table provides a description of exactly what that
+ * permission allows, as well as a discussion of the risks of granting code the
+ * permission.
  *
  * <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
  * <tr>
@@ -57,7 +57,7 @@ import java.security.BasicPermission;
  * applications because the audio from one line may be mixed with other audio
  * being played on the system, or because manipulation of a mixer affects the
  * audio for all lines using that mixer.</td>
- *</tr>
+ * </tr>
  *
  * <tr>
  * <td>record</td>
@@ -68,42 +68,40 @@ import java.security.BasicPermission;
  * applications because manipulation of a mixer affects the audio for all lines
  * using that mixer.
  * This permission can enable an applet or application to eavesdrop on a user.</td>
- *</tr>
- *</table>
- *<p>
+ * </tr>
+ * </table>
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public class AudioPermission extends BasicPermission {
+
     private static final long serialVersionUID = -5518053473477801126L;
 
     /**
-     * Creates a new <code>AudioPermission</code> object that has the specified
-     * symbolic name, such as "play" or "record". An asterisk can be used to indicate
-     * all audio permissions.
-     * @param name the name of the new <code>AudioPermission</code>
+     * Creates a new {@code AudioPermission} object that has the specified
+     * symbolic name, such as "play" or "record". An asterisk can be used to
+     * indicate all audio permissions.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @param  name the name of the new {@code AudioPermission}
+     * @throws NullPointerException if {@code name} is {@code null}
+     * @throws IllegalArgumentException if {@code name} is empty
      */
-    public AudioPermission(String name) {
-
+    public AudioPermission(final String name) {
         super(name);
     }
 
     /**
-     * Creates a new <code>AudioPermission</code> object that has the specified
-     * symbolic name, such as "play" or "record".  The <code>actions</code>
-     * parameter is currently unused and should be <code>null</code>.
-     * @param name the name of the new <code>AudioPermission</code>
-     * @param actions (unused; should be <code>null</code>)
+     * Creates a new {@code AudioPermission} object that has the specified
+     * symbolic name, such as "play" or "record". The {@code actions} parameter
+     * is currently unused and should be {@code null}.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @param  name the name of the new {@code AudioPermission}
+     * @param  actions (unused; should be {@code null})
+     * @throws NullPointerException if {@code name} is {@code null}
+     * @throws IllegalArgumentException if {@code name} is empty
      */
-    public AudioPermission(String name, String actions) {
-
+    public AudioPermission(final String name, final String actions) {
         super(name, actions);
     }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java
index 235ed234276..7b5428b1c19 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java
@@ -50,29 +50,24 @@ import com.sun.media.sound.JDK13Services;
 
 
 /**
- * The <code>AudioSystem</code> class acts as the entry point to the
- * sampled-audio system resources. This class lets you query and
- * access the mixers that are installed on the system.
- * <code>AudioSystem</code> includes a number of
- * methods for converting audio data between different formats, and for
- * translating between audio files and streams. It also provides a method
- * for obtaining a <code>{@link Line}</code> directly from the
- * <code>AudioSystem</code> without dealing explicitly
+ * The {@code AudioSystem} class acts as the entry point to the sampled-audio
+ * system resources. This class lets you query and access the mixers that are
+ * installed on the system. {@code AudioSystem} includes a number of methods for
+ * converting audio data between different formats, and for translating between
+ * audio files and streams. It also provides a method for obtaining a
+ * {@link Line} directly from the {@code AudioSystem} without dealing explicitly
  * with mixers.
- *
- * <p>Properties can be used to specify the default mixer
- * for specific line types.
- * Both system properties and a properties file are considered.
- * The <code>sound.properties</code> properties file is read from
- * an implementation-specific location (typically it is the <code>lib</code>
- * directory in the Java installation directory).
- * If a property exists both as a system property and in the
- * properties file, the system property takes precedence. If none is
- * specified, a suitable default is chosen among the available devices.
- * The syntax of the properties file is specified in
- * {@link java.util.Properties#load(InputStream) Properties.load}. The
- * following table lists the available property keys and which methods
- * consider them:
+ * <p>
+ * Properties can be used to specify the default mixer for specific line types.
+ * Both system properties and a properties file are considered. The
+ * {@code sound.properties} properties file is read from an
+ * implementation-specific location (typically it is the {@code lib} directory
+ * in the Java installation directory). If a property exists both as a system
+ * property and in the properties file, the system property takes precedence.
+ * If none is specified, a suitable default is chosen among the available
+ * devices. The syntax of the properties file is specified in
+ * {@link java.util.Properties#load(InputStream) Properties.load}. The following
+ * table lists the available property keys and which methods consider them:
  *
  * <table border=0>
  *  <caption>Audio System Property Keys</caption>
@@ -82,84 +77,68 @@ import com.sun.media.sound.JDK13Services;
  *   <th>Affected Method(s)</th>
  *  </tr>
  *  <tr>
- *   <td><code>javax.sound.sampled.Clip</code></td>
+ *   <td>{@code javax.sound.sampled.Clip}</td>
  *   <td>{@link Clip}</td>
  *   <td>{@link #getLine}, {@link #getClip}</td>
  *  </tr>
  *  <tr>
- *   <td><code>javax.sound.sampled.Port</code></td>
+ *   <td>{@code javax.sound.sampled.Port}</td>
  *   <td>{@link Port}</td>
  *   <td>{@link #getLine}</td>
  *  </tr>
  *  <tr>
- *   <td><code>javax.sound.sampled.SourceDataLine</code></td>
+ *   <td>{@code javax.sound.sampled.SourceDataLine}</td>
  *   <td>{@link SourceDataLine}</td>
  *   <td>{@link #getLine}, {@link #getSourceDataLine}</td>
  *  </tr>
  *  <tr>
- *   <td><code>javax.sound.sampled.TargetDataLine</code></td>
+ *   <td>{@code javax.sound.sampled.TargetDataLine}</td>
  *   <td>{@link TargetDataLine}</td>
  *   <td>{@link #getLine}, {@link #getTargetDataLine}</td>
  *  </tr>
  * </table>
  *
- * The property value consists of the provider class name
- * and the mixer name, separated by the hash mark (&quot;#&quot;).
- * The provider class name is the fully-qualified
- * name of a concrete {@link javax.sound.sampled.spi.MixerProvider
- * mixer provider} class. The mixer name is matched against
- * the <code>String</code> returned by the <code>getName</code>
- * method of <code>Mixer.Info</code>.
- * Either the class name, or the mixer name may be omitted.
- * If only the class name is specified, the trailing hash mark
- * is optional.
- *
- * <p>If the provider class is specified, and it can be
- * successfully retrieved from the installed providers, the list of
- * <code>Mixer.Info</code> objects is retrieved
- * from the provider. Otherwise, or when these mixers
- * do not provide a subsequent match, the list is retrieved
- * from {@link #getMixerInfo} to contain
- * all available <code>Mixer.Info</code> objects.
- *
- * <p>If a mixer name is specified, the resulting list of
- * <code>Mixer.Info</code> objects is searched:
- * the first one with a matching name, and whose
- * <code>Mixer</code> provides the
+ * The property value consists of the provider class name and the mixer name,
+ * separated by the hash mark (&quot;#&quot;). The provider class name is the
+ * fully-qualified name of a concrete
+ * {@link javax.sound.sampled.spi.MixerProvider mixer provider} class. The mixer
+ * name is matched against the {@code String} returned by the {@code getName}
+ * method of {@code Mixer.Info}. Either the class name, or the mixer name may be
+ * omitted. If only the class name is specified, the trailing hash mark is
+ * optional.
+ * <p>
+ * If the provider class is specified, and it can be successfully retrieved from
+ * the installed providers, the list of {@code Mixer.Info} objects is retrieved
+ * from the provider. Otherwise, or when these mixers do not provide a
+ * subsequent match, the list is retrieved from {@link #getMixerInfo} to contain
+ * all available {@code Mixer.Info} objects.
+ * <p>
+ * If a mixer name is specified, the resulting list of {@code Mixer.Info}
+ * objects is searched: the first one with a matching name, and whose
+ * {@code Mixer} provides the respective line interface, will be returned. If no
+ * matching {@code Mixer.Info} object is found, or the mixer name is not
+ * specified, the first mixer from the resulting list, which provides the
  * respective line interface, will be returned.
- * If no matching <code>Mixer.Info</code> object
- * is found, or the mixer name is not specified,
- * the first mixer from the resulting
- * list, which provides the respective line
- * interface, will be returned.
  *
- * For example, the property <code>javax.sound.sampled.Clip</code>
- * with a value
- * <code>&quot;com.sun.media.sound.MixerProvider#SunClip&quot;</code>
- * will have the following consequences when
- * <code>getLine</code> is called requesting a <code>Clip</code>
- * instance:
- * if the class <code>com.sun.media.sound.MixerProvider</code> exists
- * in the list of installed mixer providers,
- * the first <code>Clip</code> from the first mixer with name
- * <code>&quot;SunClip&quot;</code> will be returned. If it cannot
- * be found, the first <code>Clip</code> from the first mixer
- * of the specified provider will be returned, regardless of name.
- * If there is none, the first <code>Clip</code> from the first
- * <code>Mixer</code> with name
- * <code>&quot;SunClip&quot;</code> in the list of all mixers
- * (as returned by <code>getMixerInfo</code>) will be returned,
- * or, if not found, the first <code>Clip</code> of the first
- * <code>Mixer</code>that can be found in the list of all
- * mixers is returned.
- * If that fails, too, an <code>IllegalArgumentException</code>
- * is thrown.
+ * For example, the property {@code javax.sound.sampled.Clip} with a value
+ * {@code "com.sun.media.sound.MixerProvider#SunClip"}
+ * will have the following consequences when {@code getLine} is called
+ * requesting a {@code Clip} instance: if the class
+ * {@code com.sun.media.sound.MixerProvider} exists in the list of installed
+ * mixer providers, the first {@code Clip} from the first mixer with name
+ * {@code "SunClip"} will be returned. If it cannot be found, the
+ * first {@code Clip} from the first mixer of the specified provider will be
+ * returned, regardless of name. If there is none, the first {@code Clip} from
+ * the first {@code Mixer} with name {@code "SunClip"} in the list of
+ * all mixers (as returned by {@code getMixerInfo}) will be returned, or, if not
+ * found, the first {@code Clip} of the first {@code Mixer} that can be found in
+ * the list of all mixers is returned. If that fails, too, an
+ * {@code IllegalArgumentException} is thrown.
  *
  * @author Kara Kytle
  * @author Florian Bomers
  * @author Matthias Pfisterer
  * @author Kevin P. Smith
- *
  * @see AudioFormat
  * @see AudioInputStream
  * @see Mixer
@@ -170,13 +149,12 @@ import com.sun.media.sound.JDK13Services;
 public class AudioSystem {
 
     /**
-     * An integer that stands for an unknown numeric value.
-     * This value is appropriate only for signed quantities that do not
-     * normally take negative values.  Examples include file sizes, frame
-     * sizes, buffer sizes, and sample rates.
-     * A number of Java Sound constructors accept
-     * a value of <code>NOT_SPECIFIED</code> for such parameters.  Other
-     * methods may also accept or return this value, as documented.
+     * An integer that stands for an unknown numeric value. This value is
+     * appropriate only for signed quantities that do not normally take negative
+     * values. Examples include file sizes, frame sizes, buffer sizes, and
+     * sample rates. A number of Java Sound constructors accept a value of
+     * {@code NOT_SPECIFIED} for such parameters. Other methods may also accept
+     * or return this value, as documented.
      */
     public static final int NOT_SPECIFIED = -1;
 
@@ -186,12 +164,13 @@ public class AudioSystem {
     private AudioSystem() {
     }
 
-
     /**
-     * Obtains an array of mixer info objects that represents
-     * the set of audio mixers that are currently installed on the system.
-     * @return an array of info objects for the currently installed mixers.  If no mixers
-     * are available on the system, an array of length 0 is returned.
+     * Obtains an array of mixer info objects that represents the set of audio
+     * mixers that are currently installed on the system.
+     *
+     * @return an array of info objects for the currently installed mixers. If
+     *         no mixers are available on the system, an array of length 0 is
+     *         returned.
      * @see #getMixer
      */
     public static Mixer.Info[] getMixerInfo() {
@@ -201,16 +180,16 @@ public class AudioSystem {
         return allInfos;
     }
 
-
     /**
      * Obtains the requested audio mixer.
-     * @param info a <code>Mixer.Info</code> object representing the desired
-     * mixer, or <code>null</code> for the system default mixer
+     *
+     * @param  info a {@code Mixer.Info} object representing the desired mixer,
+     *         or {@code null} for the system default mixer
      * @return the requested mixer
-     * @throws SecurityException if the requested mixer
-     * is unavailable because of security restrictions
-     * @throws IllegalArgumentException if the info object does not represent
-     * a mixer installed on the system
+     * @throws SecurityException if the requested mixer is unavailable because
+     *         of security restrictions
+     * @throws IllegalArgumentException if the info object does not represent a
+     *         mixer installed on the system
      * @see #getMixerInfo
      */
     public static Mixer getMixer(Mixer.Info info) {
@@ -259,17 +238,17 @@ public class AudioSystem {
                                            + (info!=null?info.toString():"null"));
     }
 
-
     //$$fb 2002-11-26: fix for 4757930: DOC: AudioSystem.getTarget/SourceLineInfo() is ambiguous
+
     /**
-     * Obtains information about all source lines of a particular type that are supported
-     * by the installed mixers.
-     * @param info a <code>Line.Info</code> object that specifies the kind of
-     * lines about which information is requested
-     * @return an array of <code>Line.Info</code> objects describing source lines matching
-     * the type requested.  If no matching source lines are supported, an array of length 0
-     * is returned.
+     * Obtains information about all source lines of a particular type that are
+     * supported by the installed mixers.
      *
+     * @param  info a {@code Line.Info} object that specifies the kind of lines
+     *         about which information is requested
+     * @return an array of {@code Line.Info} objects describing source lines
+     *         matching the type requested. If no matching source lines are
+     *         supported, an array of length 0 is returned.
      * @see Mixer#getSourceLineInfo(Line.Info)
      */
     public static Line.Info[] getSourceLineInfo(Line.Info info) {
@@ -300,16 +279,15 @@ public class AudioSystem {
         return returnedArray;
     }
 
-
     /**
-     * Obtains information about all target lines of a particular type that are supported
-     * by the installed mixers.
-     * @param info a <code>Line.Info</code> object that specifies the kind of
-     * lines about which information is requested
-     * @return an array of <code>Line.Info</code> objects describing target lines matching
-     * the type requested.  If no matching target lines are supported, an array of length 0
-     * is returned.
+     * Obtains information about all target lines of a particular type that are
+     * supported by the installed mixers.
      *
+     * @param  info a {@code Line.Info} object that specifies the kind of lines
+     *         about which information is requested
+     * @return an array of {@code Line.Info} objects describing target lines
+     *         matching the type requested. If no matching target lines are
+     *         supported, an array of length 0 is returned.
      * @see Mixer#getTargetLineInfo(Line.Info)
      */
     public static Line.Info[] getTargetLineInfo(Line.Info info) {
@@ -340,15 +318,15 @@ public class AudioSystem {
         return returnedArray;
     }
 
-
     /**
-     * Indicates whether the system supports any lines that match
-     * the specified <code>Line.Info</code> object.  A line is supported if
-     * any installed mixer supports it.
-     * @param info a <code>Line.Info</code> object describing the line for which support is queried
-     * @return <code>true</code> if at least one matching line is
-     * supported, otherwise <code>false</code>
+     * Indicates whether the system supports any lines that match the specified
+     * {@code Line.Info} object. A line is supported if any installed mixer
+     * supports it.
      *
+     * @param  info a {@code Line.Info} object describing the line for which
+     *         support is queried
+     * @return {@code true} if at least one matching line is supported,
+     *         otherwise {@code false}
      * @see Mixer#isLineSupported(Line.Info)
      */
     public static boolean isLineSupported(Line.Info info) {
@@ -371,40 +349,36 @@ public class AudioSystem {
 
     /**
      * Obtains a line that matches the description in the specified
-     * <code>Line.Info</code> object.
-     *
-     * <p>If a <code>DataLine</code> is requested, and <code>info</code>
-     * is an instance of <code>DataLine.Info</code> specifying at least
-     * one fully qualified audio format, the last one
-     * will be used as the default format of the returned
-     * <code>DataLine</code>.
+     * {@code Line.Info} object.
+     * <p>
+     * If a {@code DataLine} is requested, and {@code info} is an instance of
+     * {@code DataLine.Info} specifying at least one fully qualified audio
+     * format, the last one will be used as the default format of the returned
+     * {@code DataLine}.
+     * <p>
+     * If system properties
+     * {@code javax.sound.sampled.Clip},
+     * {@code javax.sound.sampled.Port},
+     * {@code javax.sound.sampled.SourceDataLine} and
+     * {@code javax.sound.sampled.TargetDataLine} are defined or they are
+     * defined in the file "sound.properties", they are used to retrieve default
+     * lines. For details, refer to the {@link AudioSystem class description}.
      *
-     * <p>If system properties
-     * <code>javax.sound.sampled.Clip</code>,
-     * <code>javax.sound.sampled.Port</code>,
-     * <code>javax.sound.sampled.SourceDataLine</code> and
-     * <code>javax.sound.sampled.TargetDataLine</code> are defined
-     * or they are defined in the file &quot;sound.properties&quot;,
-     * they are used to retrieve default lines.
-     * For details, refer to the {@link AudioSystem class description}.
+     * If the respective property is not set, or the mixer requested in the
+     * property is not installed or does not provide the requested line, all
+     * installed mixers are queried for the requested line type. A Line will be
+     * returned from the first mixer providing the requested line type.
      *
-     * If the respective property is not set, or the mixer
-     * requested in the property is not installed or does not provide the
-     * requested line, all installed mixers are queried for the
-     * requested line type. A Line will be returned from the first mixer
-     * providing the requested line type.
-     *
-     * @param info a <code>Line.Info</code> object describing the desired kind of line
+     * @param  info a {@code Line.Info} object describing the desired kind of
+     *         line
      * @return a line of the requested kind
-     *
-     * @throws LineUnavailableException if a matching line
-     * is not available due to resource restrictions
-     * @throws SecurityException if a matching line
-     * is not available due to security restrictions
-     * @throws IllegalArgumentException if the system does not
-     * support at least one line matching the specified
-     * <code>Line.Info</code> object
-     * through any installed mixer
+     * @throws LineUnavailableException if a matching line is not available due
+     *         to resource restrictions
+     * @throws SecurityException if a matching line is not available due to
+     *         security restrictions
+     * @throws IllegalArgumentException if the system does not support at least
+     *         one line matching the specified {@code Line.Info} object through
+     *         any installed mixer
      */
     public static Line getLine(Line.Info info) throws LineUnavailableException {
         LineUnavailableException lue = null;
@@ -479,37 +453,30 @@ public class AudioSystem {
                                            info.toString() + " is supported.");
     }
 
-
     /**
-     * Obtains a clip that can be used for playing back
-     * an audio file or an audio stream. The returned clip
-     * will be provided by the default system mixer, or,
-     * if not possible, by any other mixer installed in the
-     * system that supports a <code>Clip</code>
-     * object.
-     *
-     * <p>The returned clip must be opened with the
-     * <code>open(AudioFormat)</code> or
-     * <code>open(AudioInputStream)</code> method.
-     *
-     * <p>This is a high-level method that uses <code>getMixer</code>
-     * and <code>getLine</code> internally.
-     *
-     * <p>If the system property
-     * <code>javax.sound.sampled.Clip</code>
-     * is defined or it is defined in the file &quot;sound.properties&quot;,
-     * it is used to retrieve the default clip.
-     * For details, refer to the {@link AudioSystem class description}.
+     * Obtains a clip that can be used for playing back an audio file or an
+     * audio stream. The returned clip will be provided by the default system
+     * mixer, or, if not possible, by any other mixer installed in the system
+     * that supports a {@code Clip} object.
+     * <p>
+     * The returned clip must be opened with the {@code open(AudioFormat)} or
+     * {@code open(AudioInputStream)} method.
+     * <p>
+     * This is a high-level method that uses {@code getMixer} and
+     * {@code getLine} internally.
+     * <p>
+     * If the system property {@code javax.sound.sampled.Clip} is defined or it
+     * is defined in the file "sound.properties", it is used to retrieve the
+     * default clip. For details, refer to the
+     * {@link AudioSystem class description}.
      *
      * @return the desired clip object
-     *
-     * @throws LineUnavailableException if a clip object
-     * is not available due to resource restrictions
-     * @throws SecurityException if a clip object
-     * is not available due to security restrictions
-     * @throws IllegalArgumentException if the system does not
-     * support at least one clip instance through any installed mixer
-     *
+     * @throws LineUnavailableException if a clip object is not available due to
+     *         resource restrictions
+     * @throws SecurityException if a clip object is not available due to
+     *         security restrictions
+     * @throws IllegalArgumentException if the system does not support at least
+     *         one clip instance through any installed mixer
      * @see #getClip(Mixer.Info)
      * @since 1.5
      */
@@ -522,29 +489,26 @@ public class AudioSystem {
         return (Clip) AudioSystem.getLine(info);
     }
 
-
     /**
-     * Obtains a clip from the specified mixer that can be
-     * used for playing back an audio file or an audio stream.
-     *
-     * <p>The returned clip must be opened with the
-     * <code>open(AudioFormat)</code> or
-     * <code>open(AudioInputStream)</code> method.
+     * Obtains a clip from the specified mixer that can be used for playing back
+     * an audio file or an audio stream.
+     * <p>
+     * The returned clip must be opened with the {@code open(AudioFormat)} or
+     * {@code open(AudioInputStream)} method.
+     * <p>
+     * This is a high-level method that uses {@code getMixer} and
+     * {@code getLine} internally.
      *
-     * <p>This is a high-level method that uses <code>getMixer</code>
-     * and <code>getLine</code> internally.
-     *
-     * @param mixerInfo a <code>Mixer.Info</code> object representing the
-     * desired mixer, or <code>null</code> for the system default mixer
+     * @param  mixerInfo a {@code Mixer.Info} object representing the desired
+     *         mixer, or {@code null} for the system default mixer
      * @return a clip object from the specified mixer
      *
-     * @throws LineUnavailableException if a clip
-     * is not available from this mixer due to resource restrictions
-     * @throws SecurityException if a clip
-     * is not available from this mixer due to security restrictions
-     * @throws IllegalArgumentException if the system does not
-     * support at least one clip through the specified mixer
-     *
+     * @throws LineUnavailableException if a clip is not available from this
+     *         mixer due to resource restrictions
+     * @throws SecurityException if a clip is not available from this mixer due
+     *         to security restrictions
+     * @throws IllegalArgumentException if the system does not support at least
+     *         one clip through the specified mixer
      * @see #getClip()
      * @since 1.5
      */
@@ -558,45 +522,38 @@ public class AudioSystem {
         return (Clip) mixer.getLine(info);
     }
 
-
     /**
-     * Obtains a source data line that can be used for playing back
-     * audio data in the format specified by the
-     * <code>AudioFormat</code> object. The returned line
-     * will be provided by the default system mixer, or,
-     * if not possible, by any other mixer installed in the
-     * system that supports a matching
-     * <code>SourceDataLine</code> object.
-     *
-     * <p>The returned line should be opened with the
-     * <code>open(AudioFormat)</code> or
-     * <code>open(AudioFormat, int)</code> method.
-     *
-     * <p>This is a high-level method that uses <code>getMixer</code>
-     * and <code>getLine</code> internally.
-     *
-     * <p>The returned <code>SourceDataLine</code>'s default
-     * audio format will be initialized with <code>format</code>.
-     *
-     * <p>If the system property
-     * <code>javax.sound.sampled.SourceDataLine</code>
-     * is defined or it is defined in the file &quot;sound.properties&quot;,
-     * it is used to retrieve the default source data line.
-     * For details, refer to the {@link AudioSystem class description}.
-     *
-     * @param format an <code>AudioFormat</code> object specifying
-     *        the supported audio format of the returned line,
-     *        or <code>null</code> for any audio format
-     * @return the desired <code>SourceDataLine</code> object
-     *
-     * @throws LineUnavailableException if a matching source data line
-     *         is not available due to resource restrictions
-     * @throws SecurityException if a matching source data line
-     *         is not available due to security restrictions
-     * @throws IllegalArgumentException if the system does not
-     *         support at least one source data line supporting the
-     *         specified audio format through any installed mixer
+     * Obtains a source data line that can be used for playing back audio data
+     * in the format specified by the {@code AudioFormat} object. The returned
+     * line will be provided by the default system mixer, or, if not possible,
+     * by any other mixer installed in the system that supports a matching
+     * {@code SourceDataLine} object.
+     * <p>
+     * The returned line should be opened with the {@code open(AudioFormat)} or
+     * {@code open(AudioFormat, int)} method.
+     * <p>
+     * This is a high-level method that uses {@code getMixer} and
+     * {@code getLine} internally.
+     * <p>
+     * The returned {@code SourceDataLine}'s default audio format will be
+     * initialized with {@code format}.
+     * <p>
+     * If the system property {@code javax.sound.sampled.SourceDataLine} is
+     * defined or it is defined in the file "sound.properties", it is used to
+     * retrieve the default source data line. For details, refer to the
+     * {@link AudioSystem class description}.
      *
+     * @param  format an {@code AudioFormat} object specifying the supported
+     *         audio format of the returned line, or {@code null} for any audio
+     *         format
+     * @return the desired {@code SourceDataLine} object
+     * @throws LineUnavailableException if a matching source data line is not
+     *         available due to resource restrictions
+     * @throws SecurityException if a matching source data line is not available
+     *         due to security restrictions
+     * @throws IllegalArgumentException if the system does not support at least
+     *         one source data line supporting the specified audio format
+     *         through any installed mixer
      * @see #getSourceDataLine(AudioFormat, Mixer.Info)
      * @since 1.5
      */
@@ -606,41 +563,33 @@ public class AudioSystem {
         return (SourceDataLine) AudioSystem.getLine(info);
     }
 
-
     /**
-     * Obtains a source data line that can be used for playing back
-     * audio data in the format specified by the
-     * <code>AudioFormat</code> object, provided by the mixer
-     * specified by the <code>Mixer.Info</code> object.
-     *
-     * <p>The returned line should be opened with the
-     * <code>open(AudioFormat)</code> or
-     * <code>open(AudioFormat, int)</code> method.
-     *
-     * <p>This is a high-level method that uses <code>getMixer</code>
-     * and <code>getLine</code> internally.
-     *
-     * <p>The returned <code>SourceDataLine</code>'s default
-     * audio format will be initialized with <code>format</code>.
-     *
-     * @param format an <code>AudioFormat</code> object specifying
-     *        the supported audio format of the returned line,
-     *        or <code>null</code> for any audio format
-     * @param mixerinfo a <code>Mixer.Info</code> object representing
-     *        the desired mixer, or <code>null</code> for the system
-     *        default mixer
-     * @return the desired <code>SourceDataLine</code> object
-     *
-     * @throws LineUnavailableException if a matching source data
-     *         line is not available from the specified mixer due
-     *         to resource restrictions
-     * @throws SecurityException if a matching source data line
-     *         is not available from the specified mixer due to
-     *         security restrictions
-     * @throws IllegalArgumentException if the specified mixer does
-     *         not support at least one source data line supporting
-     *         the specified audio format
+     * Obtains a source data line that can be used for playing back audio data
+     * in the format specified by the {@code AudioFormat} object, provided by
+     * the mixer specified by the {@code Mixer.Info} object.
+     * <p>
+     * The returned line should be opened with the {@code open(AudioFormat)} or
+     * {@code open(AudioFormat, int)} method.
+     * <p>
+     * This is a high-level method that uses {@code getMixer} and
+     * {@code getLine} internally.
+     * <p>
+     * The returned {@code SourceDataLine}'s default audio format will be
+     * initialized with {@code format}.
      *
+     * @param  format an {@code AudioFormat} object specifying the supported
+     *         audio format of the returned line, or {@code null} for any audio
+     *         format
+     * @param  mixerinfo a {@code Mixer.Info} object representing the desired
+     *         mixer, or {@code null} for the system default mixer
+     * @return the desired {@code SourceDataLine} object
+     * @throws LineUnavailableException if a matching source data line is not
+     *         available from the specified mixer due to resource restrictions
+     * @throws SecurityException if a matching source data line is not available
+     *         from the specified mixer due to security restrictions
+     * @throws IllegalArgumentException if the specified mixer does not support
+     *         at least one source data line supporting the specified audio
+     *         format
      * @see #getSourceDataLine(AudioFormat)
      * @since 1.5
      */
@@ -650,47 +599,40 @@ public class AudioSystem {
         DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
         Mixer mixer = AudioSystem.getMixer(mixerinfo);
         return (SourceDataLine) mixer.getLine(info);
-  }
-
+    }
 
     /**
-     * Obtains a target data line that can be used for recording
-     * audio data in the format specified by the
-     * <code>AudioFormat</code> object. The returned line
-     * will be provided by the default system mixer, or,
-     * if not possible, by any other mixer installed in the
-     * system that supports a matching
-     * <code>TargetDataLine</code> object.
-     *
-     * <p>The returned line should be opened with the
-     * <code>open(AudioFormat)</code> or
-     * <code>open(AudioFormat, int)</code> method.
-     *
-     * <p>This is a high-level method that uses <code>getMixer</code>
-     * and <code>getLine</code> internally.
-     *
-     * <p>The returned <code>TargetDataLine</code>'s default
-     * audio format will be initialized with <code>format</code>.
-     *
-     * <p>If the system property
-     * {@code javax.sound.sampled.TargetDataLine}
-     * is defined or it is defined in the file &quot;sound.properties&quot;,
-     * it is used to retrieve the default target data line.
-     * For details, refer to the {@link AudioSystem class description}.
-     *
-     * @param format an <code>AudioFormat</code> object specifying
-     *        the supported audio format of the returned line,
-     *        or <code>null</code> for any audio format
-     * @return the desired <code>TargetDataLine</code> object
-     *
-     * @throws LineUnavailableException if a matching target data line
-     *         is not available due to resource restrictions
-     * @throws SecurityException if a matching target data line
-     *         is not available due to security restrictions
-     * @throws IllegalArgumentException if the system does not
-     *         support at least one target data line supporting the
-     *         specified audio format through any installed mixer
+     * Obtains a target data line that can be used for recording audio data in
+     * the format specified by the {@code AudioFormat} object. The returned line
+     * will be provided by the default system mixer, or, if not possible, by any
+     * other mixer installed in the system that supports a matching
+     * {@code TargetDataLine} object.
+     * <p>
+     * The returned line should be opened with the {@code open(AudioFormat)} or
+     * {@code open(AudioFormat, int)} method.
+     * <p>
+     * This is a high-level method that uses {@code getMixer} and
+     * {@code getLine} internally.
+     * <p>
+     * The returned {@code TargetDataLine}'s default audio format will be
+     * initialized with {@code format}.
+     * <p>
+     * If the system property {@code javax.sound.sampled.TargetDataLine} is
+     * defined or it is defined in the file "sound.properties", it is used to
+     * retrieve the default target data line. For details, refer to the
+     * {@link AudioSystem class description}.
      *
+     * @param  format an {@code AudioFormat} object specifying the supported
+     *         audio format of the returned line, or {@code null} for any audio
+     *         format
+     * @return the desired {@code TargetDataLine} object
+     * @throws LineUnavailableException if a matching target data line is not
+     *         available due to resource restrictions
+     * @throws SecurityException if a matching target data line is not available
+     *         due to security restrictions
+     * @throws IllegalArgumentException if the system does not support at least
+     *         one target data line supporting the specified audio format
+     *         through any installed mixer
      * @see #getTargetDataLine(AudioFormat, Mixer.Info)
      * @see AudioPermission
      * @since 1.5
@@ -702,41 +644,33 @@ public class AudioSystem {
         return (TargetDataLine) AudioSystem.getLine(info);
     }
 
-
-
     /**
-     * Obtains a target data line that can be used for recording
-     * audio data in the format specified by the
-     * <code>AudioFormat</code> object, provided by the mixer
-     * specified by the <code>Mixer.Info</code> object.
-     *
-     * <p>The returned line should be opened with the
-     * <code>open(AudioFormat)</code> or
-     * <code>open(AudioFormat, int)</code> method.
-     *
-     * <p>This is a high-level method that uses <code>getMixer</code>
-     * and <code>getLine</code> internally.
-     *
-     * <p>The returned <code>TargetDataLine</code>'s default
-     * audio format will be initialized with <code>format</code>.
-     *
-     * @param format an <code>AudioFormat</code> object specifying
-     *        the supported audio format of the returned line,
-     *        or <code>null</code> for any audio format
-     * @param mixerinfo a <code>Mixer.Info</code> object representing the
-     *        desired mixer, or <code>null</code> for the system default mixer
-     * @return the desired <code>TargetDataLine</code> object
-     *
-     * @throws LineUnavailableException if a matching target data
-     *         line is not available from the specified mixer due
-     *         to resource restrictions
-     * @throws SecurityException if a matching target data line
-     *         is not available from the specified mixer due to
-     *         security restrictions
-     * @throws IllegalArgumentException if the specified mixer does
-     *         not support at least one target data line supporting
-     *         the specified audio format
+     * Obtains a target data line that can be used for recording audio data in
+     * the format specified by the {@code AudioFormat} object, provided by the
+     * mixer specified by the {@code Mixer.Info} object.
+     * <p>
+     * The returned line should be opened with the {@code open(AudioFormat)} or
+     * {@code open(AudioFormat, int)} method.
+     * <p>
+     * This is a high-level method that uses {@code getMixer} and
+     * {@code getLine} internally.
+     * <p>
+     * The returned {@code TargetDataLine}'s default audio format will be
+     * initialized with {@code format}.
      *
+     * @param  format an {@code AudioFormat} object specifying the supported
+     *         audio format of the returned line, or {@code null} for any audio
+     *         format
+     * @param  mixerinfo a {@code Mixer.Info} object representing the desired
+     *         mixer, or {@code null} for the system default mixer
+     * @return the desired {@code TargetDataLine} object
+     * @throws LineUnavailableException if a matching target data line is not
+     *         available from the specified mixer due to resource restrictions
+     * @throws SecurityException if a matching target data line is not available
+     *         from the specified mixer due to security restrictions
+     * @throws IllegalArgumentException if the specified mixer does not support
+     *         at least one target data line supporting the specified audio
+     *         format
      * @see #getTargetDataLine(AudioFormat)
      * @see AudioPermission
      * @since 1.5
@@ -750,17 +684,19 @@ public class AudioSystem {
         return (TargetDataLine) mixer.getLine(info);
     }
 
-
     // $$fb 2002-04-12: fix for 4662082: behavior of AudioSystem.getTargetEncodings() methods doesn't match the spec
+
     /**
-     * Obtains the encodings that the system can obtain from an
-     * audio input stream with the specified encoding using the set
-     * of installed format converters.
-     * @param sourceEncoding the encoding for which conversion support
-     * is queried
-     * @return array of encodings.  If <code>sourceEncoding</code>is not supported,
-     * an array of length 0 is returned. Otherwise, the array will have a length
-     * of at least 1, representing <code>sourceEncoding</code> (no conversion).
+     * Obtains the encodings that the system can obtain from an audio input
+     * stream with the specified encoding using the set of installed format
+     * converters.
+     *
+     * @param  sourceEncoding the encoding for which conversion support is
+     *         queried
+     * @return array of encodings. If {@code sourceEncoding}is not supported, an
+     *         array of length 0 is returned. Otherwise, the array will have a
+     *         length of at least 1, representing {@code sourceEncoding}
+     *         (no conversion).
      */
     public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding) {
 
@@ -783,18 +719,18 @@ public class AudioSystem {
         return encs2;
     }
 
-
-
     // $$fb 2002-04-12: fix for 4662082: behavior of AudioSystem.getTargetEncodings() methods doesn't match the spec
+
     /**
-     * Obtains the encodings that the system can obtain from an
-     * audio input stream with the specified format using the set
-     * of installed format converters.
-     * @param sourceFormat the audio format for which conversion
-     * is queried
-     * @return array of encodings. If <code>sourceFormat</code>is not supported,
-     * an array of length 0 is returned. Otherwise, the array will have a length
-     * of at least 1, representing the encoding of <code>sourceFormat</code> (no conversion).
+     * Obtains the encodings that the system can obtain from an audio input
+     * stream with the specified format using the set of installed format
+     * converters.
+     *
+     * @param  sourceFormat the audio format for which conversion is queried
+     * @return array of encodings. If {@code sourceFormat}is not supported, an
+     *         array of length 0 is returned. Otherwise, the array will have a
+     *         length of at least 1, representing the encoding of
+     *         {@code sourceFormat} (no conversion).
      */
     public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
 
@@ -826,15 +762,14 @@ public class AudioSystem {
         return encs2;
     }
 
-
     /**
-     * Indicates whether an audio input stream of the specified encoding
-     * can be obtained from an audio input stream that has the specified
-     * format.
-     * @param targetEncoding the desired encoding after conversion
-     * @param sourceFormat the audio format before conversion
-     * @return <code>true</code> if the conversion is supported,
-     * otherwise <code>false</code>
+     * Indicates whether an audio input stream of the specified encoding can be
+     * obtained from an audio input stream that has the specified format.
+     *
+     * @param  targetEncoding the desired encoding after conversion
+     * @param  sourceFormat the audio format before conversion
+     * @return {@code true} if the conversion is supported, otherwise
+     *         {@code false}
      */
     public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
 
@@ -850,12 +785,12 @@ public class AudioSystem {
         return false;
     }
 
-
     /**
-     * Obtains an audio input stream of the indicated encoding, by converting the
-     * provided audio input stream.
-     * @param targetEncoding the desired encoding after conversion
-     * @param sourceStream the stream to be converted
+     * Obtains an audio input stream of the indicated encoding, by converting
+     * the provided audio input stream.
+     *
+     * @param  targetEncoding the desired encoding after conversion
+     * @param  sourceStream the stream to be converted
      * @return an audio input stream of the indicated encoding
      * @throws IllegalArgumentException if the conversion is not supported
      * @see #getTargetEncodings(AudioFormat.Encoding)
@@ -878,15 +813,15 @@ public class AudioSystem {
         throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat());
     }
 
-
     /**
-     * Obtains the formats that have a particular encoding and that the system can
-     * obtain from a stream of the specified format using the set of
+     * Obtains the formats that have a particular encoding and that the system
+     * can obtain from a stream of the specified format using the set of
      * installed format converters.
-     * @param targetEncoding the desired encoding after conversion
-     * @param sourceFormat the audio format before conversion
-     * @return array of formats.  If no formats of the specified
-     * encoding are supported, an array of length 0 is returned.
+     *
+     * @param  targetEncoding the desired encoding after conversion
+     * @param  sourceFormat the audio format before conversion
+     * @return array of formats. If no formats of the specified encoding are
+     *         supported, an array of length 0 is returned.
      */
     public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
 
@@ -918,16 +853,15 @@ public class AudioSystem {
         return fmts2;
     }
 
-
     /**
-     * Indicates whether an audio input stream of a specified format
-     * can be obtained from an audio input stream of another specified format.
-     * @param targetFormat the desired audio format after conversion
-     * @param sourceFormat the audio format before conversion
-     * @return <code>true</code> if the conversion is supported,
-     * otherwise <code>false</code>
+     * Indicates whether an audio input stream of a specified format can be
+     * obtained from an audio input stream of another specified format.
+     *
+     * @param  targetFormat the desired audio format after conversion
+     * @param  sourceFormat the audio format before conversion
+     * @return {@code true} if the conversion is supported, otherwise
+     *         {@code false}
      */
-
     public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) {
 
         List codecs = getFormatConversionProviders();
@@ -941,15 +875,15 @@ public class AudioSystem {
         return false;
     }
 
-
     /**
      * Obtains an audio input stream of the indicated format, by converting the
      * provided audio input stream.
-     * @param targetFormat the desired audio format after conversion
-     * @param sourceStream the stream to be converted
+     *
+     * @param  targetFormat the desired audio format after conversion
+     * @param  sourceStream the stream to be converted
      * @return an audio input stream of the indicated format
      * @throws IllegalArgumentException if the conversion is not supported
-     * #see #getTargetEncodings(AudioFormat)
+     * @see #getTargetEncodings(AudioFormat)
      * @see #getTargetFormats(AudioFormat.Encoding, AudioFormat)
      * @see #isConversionSupported(AudioFormat, AudioFormat)
      * @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream)
@@ -974,20 +908,22 @@ public class AudioSystem {
         throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat());
     }
 
-
     /**
-     * Obtains the audio file format of the provided input stream.  The stream must
-     * point to valid audio file data.  The implementation of this method may require
-     * multiple parsers to examine the stream to determine whether they support it.
-     * These parsers must be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support these operations, this method may fail
-     * with an <code>IOException</code>.
-     * @param stream the input stream from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the stream's audio file format
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the provided input stream. The stream
+     * must point to valid audio file data. The implementation of this method
+     * may require multiple parsers to examine the stream to determine whether
+     * they support it. These parsers must be able to mark the stream, read
+     * enough data to determine whether they support the stream, and, if not,
+     * reset the stream's read pointer to its original position. If the input
+     * stream does not support these operations, this method may fail with an
+     * {@code IOException}.
+     *
+     * @param  stream the input stream from which file format information should
+     *         be extracted
+     * @return an {@code AudioFileFormat} object describing the stream's audio
+     *         file format
+     * @throws UnsupportedAudioFileException if the stream does not point to
+     *         valid audio file data recognized by the system
      * @throws IOException if an input/output exception occurs
      * @see InputStream#markSupported
      * @see InputStream#mark
@@ -1016,13 +952,15 @@ public class AudioSystem {
     }
 
     /**
-     * Obtains the audio file format of the specified URL.  The URL must
-     * point to valid audio file data.
-     * @param url the URL from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the specified URL. The URL must point to
+     * valid audio file data.
+     *
+     * @param  url the URL from which file format information should be
+     *         extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the URL does not point to valid
+     *         audio file data recognized by the system
      * @throws IOException if an input/output exception occurs
      */
     public static AudioFileFormat getAudioFileFormat(URL url)
@@ -1049,13 +987,15 @@ public class AudioSystem {
     }
 
     /**
-     * Obtains the audio file format of the specified <code>File</code>.  The <code>File</code> must
-     * point to valid audio file data.
-     * @param file the <code>File</code> from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the specified {@code File}. The
+     * {@code File} must point to valid audio file data.
+     *
+     * @param  file the {@code File} from which file format information should
+     *         be extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the {@code File} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
     public static AudioFileFormat getAudioFileFormat(File file)
@@ -1081,22 +1021,22 @@ public class AudioSystem {
         }
     }
 
-
     /**
-     * Obtains an audio input stream from the provided input stream.  The stream must
-     * point to valid audio file data.  The implementation of this method may
-     * require multiple parsers to
-     * examine the stream to determine whether they support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support these operation, this method may fail
-     * with an <code>IOException</code>.
-     * @param stream the input stream from which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data contained
-     * in the input stream.
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
+     * Obtains an audio input stream from the provided input stream. The stream
+     * must point to valid audio file data. The implementation of this method
+     * may require multiple parsers to examine the stream to determine whether
+     * they support it. These parsers must be able to mark the stream, read
+     * enough data to determine whether they support the stream, and, if not,
+     * reset the stream's read pointer to its original position. If the input
+     * stream does not support these operation, this method may fail with an
+     * {@code IOException}.
+     *
+     * @param  stream the input stream from which the {@code AudioInputStream}
+     *         should be constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         contained in the input stream
+     * @throws UnsupportedAudioFileException if the stream does not point to
+     *         valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @see InputStream#markSupported
      * @see InputStream#mark
@@ -1125,14 +1065,15 @@ public class AudioSystem {
     }
 
     /**
-     * Obtains an audio input stream from the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
+     * Obtains an audio input stream from the URL provided. The URL must point
+     * to valid audio file data.
+     *
+     * @param  url the URL for which the {@code AudioInputStream} should be
+     *         constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         pointed to by the URL
+     * @throws UnsupportedAudioFileException if the URL does not point to valid
+     *         audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
     public static AudioInputStream getAudioInputStream(URL url)
@@ -1159,14 +1100,15 @@ public class AudioSystem {
     }
 
     /**
-     * Obtains an audio input stream from the provided <code>File</code>.  The <code>File</code> must
-     * point to valid audio file data.
-     * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the <code>File</code>
-     * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
-     * file data recognized by the system
+     * Obtains an audio input stream from the provided {@code File}. The
+     * {@code File} must point to valid audio file data.
+     *
+     * @param  file the {@code File} for which the {@code AudioInputStream}
+     *         should be constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         pointed to by the {@code File}
+     * @throws UnsupportedAudioFileException if the {@code File} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
     public static AudioInputStream getAudioInputStream(File file)
@@ -1192,11 +1134,12 @@ public class AudioSystem {
         }
     }
 
-
     /**
-     * Obtains the file types for which file writing support is provided by the system.
-     * @return array of unique file types.  If no file types are supported,
-     * an array of length 0 is returned.
+     * Obtains the file types for which file writing support is provided by the
+     * system.
+     *
+     * @return array of unique file types. If no file types are supported, an
+     *         array of length 0 is returned.
      */
     public static AudioFileFormat.Type[] getAudioFileTypes() {
         List providers = getAudioFileWriters();
@@ -1214,13 +1157,13 @@ public class AudioSystem {
         return returnTypes;
     }
 
-
     /**
-     * Indicates whether file writing support for the specified file type is provided
-     * by the system.
-     * @param fileType the file type for which write capabilities are queried
-     * @return <code>true</code> if the file type is supported,
-     * otherwise <code>false</code>
+     * Indicates whether file writing support for the specified file type is
+     * provided by the system.
+     *
+     * @param  fileType the file type for which write capabilities are queried
+     * @return {@code true} if the file type is supported, otherwise
+     *         {@code false}
      */
     public static boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
 
@@ -1235,14 +1178,14 @@ public class AudioSystem {
         return false;
     }
 
-
     /**
-     * Obtains the file types that the system can write from the
-     * audio input stream specified.
-     * @param stream the audio input stream for which audio file type support
-     * is queried
-     * @return array of file types.  If no file types are supported,
-     * an array of length 0 is returned.
+     * Obtains the file types that the system can write from the audio input
+     * stream specified.
+     *
+     * @param  stream the audio input stream for which audio file type
+     *         support is queried
+     * @return array of file types. If no file types are supported, an array of
+     *         length 0 is returned.
      */
     public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
         List providers = getAudioFileWriters();
@@ -1260,14 +1203,14 @@ public class AudioSystem {
         return returnTypes;
     }
 
-
     /**
      * Indicates whether an audio file of the specified file type can be written
      * from the indicated audio input stream.
-     * @param fileType the file type for which write capabilities are queried
-     * @param stream the stream for which file-writing support is queried
-     * @return <code>true</code> if the file type is supported for this audio input stream,
-     * otherwise <code>false</code>
+     *
+     * @param  fileType the file type for which write capabilities are queried
+     * @param  stream the stream for which file-writing support is queried
+     * @return {@code true} if the file type is supported for this audio input
+     *         stream, otherwise {@code false}
      */
     public static boolean isFileTypeSupported(AudioFileFormat.Type fileType,
                                               AudioInputStream stream) {
@@ -1283,25 +1226,24 @@ public class AudioSystem {
         return false;
     }
 
-
     /**
-     * Writes a stream of bytes representing an audio file of the specified file type
-     * to the output stream provided.  Some file types require that
-     * the length be written into the file header; such files cannot be written from
-     * start to finish unless the length is known in advance.  An attempt
-     * to write a file of such a type will fail with an IOException if the length in
-     * the audio file type is <code>AudioSystem.NOT_SPECIFIED</code>.
+     * Writes a stream of bytes representing an audio file of the specified file
+     * type to the output stream provided. Some file types require that the
+     * length be written into the file header; such files cannot be written from
+     * start to finish unless the length is known in advance. An attempt to
+     * write a file of such a type will fail with an IOException if the length
+     * in the audio file type is {@code AudioSystem.NOT_SPECIFIED}.
      *
-     * @param stream the audio input stream containing audio data to be
-     * written to the file
-     * @param fileType the kind of audio file to write
-     * @param out the stream to which the file data should be written
+     * @param  stream the audio input stream containing audio data to be written
+     *         to the file
+     * @param  fileType the kind of audio file to write
+     * @param  out the stream to which the file data should be written
      * @return the number of bytes written to the output stream
      * @throws IOException if an input/output exception occurs
-     * @throws IllegalArgumentException if the file type is not supported by
-     * the system
+     * @throws IllegalArgumentException if the file type is not supported by the
+     *         system
      * @see #isFileTypeSupported
-     * @see     #getAudioFileTypes
+     * @see #getAudioFileTypes
      */
     public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
                             OutputStream out) throws IOException {
@@ -1328,20 +1270,20 @@ public class AudioSystem {
         }
     }
 
-
     /**
-     * Writes a stream of bytes representing an audio file of the specified file type
-     * to the external file provided.
-     * @param stream the audio input stream containing audio data to be
-     * written to the file
-     * @param fileType the kind of audio file to write
-     * @param out the external file to which the file data should be written
+     * Writes a stream of bytes representing an audio file of the specified file
+     * type to the external file provided.
+     *
+     * @param  stream the audio input stream containing audio data to be written
+     *         to the file
+     * @param  fileType the kind of audio file to write
+     * @param  out the external file to which the file data should be written
      * @return the number of bytes written to the file
      * @throws IOException if an I/O exception occurs
-     * @throws IllegalArgumentException if the file type is not supported by
-     * the system
+     * @throws IllegalArgumentException if the file type is not supported by the
+     *         system
      * @see #isFileTypeSupported
-     * @see     #getAudioFileTypes
+     * @see #getAudioFileTypes
      */
     public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
                             File out) throws IOException {
@@ -1368,7 +1310,6 @@ public class AudioSystem {
         }
     }
 
-
     // METHODS FOR INTERNAL IMPLEMENTATION USE
 
     /**
@@ -1378,55 +1319,54 @@ public class AudioSystem {
         return getProviders(MixerProvider.class);
     }
 
-
     /**
-     * Obtains the set of format converters (codecs, transcoders, etc.)
-     * that are currently installed on the system.
-     * @return an array of
-     * {@link javax.sound.sampled.spi.FormatConversionProvider
-     * FormatConversionProvider}
-     * objects representing the available format converters.  If no format
-     * converters readers are available on the system, an array of length 0 is
-     * returned.
+     * Obtains the set of format converters (codecs, transcoders, etc.) that are
+     * currently installed on the system.
+     *
+     * @return an array of {@link javax.sound.sampled.spi.FormatConversionProvider
+     *         FormatConversionProvider} objects representing the available
+     *         format converters. If no format converters readers are available
+     *         on the system, an array of length 0 is returned.
      */
     private static List getFormatConversionProviders() {
         return getProviders(FormatConversionProvider.class);
     }
 
-
     /**
-     * Obtains the set of audio file readers that are currently installed on the system.
-     * @return a List of
-     * {@link javax.sound.sampled.spi.AudioFileReader
-     * AudioFileReader}
-     * objects representing the installed audio file readers.  If no audio file
-     * readers are available on the system, an empty List is returned.
+     * Obtains the set of audio file readers that are currently installed on the
+     * system.
+     *
+     * @return a List of {@link javax.sound.sampled.spi.AudioFileReader
+     *         AudioFileReader} objects representing the installed audio file
+     *         readers. If no audio file readers are available on the system, an
+     *         empty List is returned.
      */
     private static List getAudioFileReaders() {
         return getProviders(AudioFileReader.class);
     }
 
-
     /**
-     * Obtains the set of audio file writers that are currently installed on the system.
-     * @return a List of
-     * {@link javax.sound.samples.spi.AudioFileWriter AudioFileWriter}
-     * objects representing the available audio file writers.  If no audio file
-     * writers are available on the system, an empty List is returned.
+     * Obtains the set of audio file writers that are currently installed on the
+     * system.
+     *
+     * @return a List of {@link javax.sound.sampled.spi.AudioFileWriter
+     *         AudioFileWriter} objects representing the available audio file
+     *         writers. If no audio file writers are available on the system, an
+     *         empty List is returned.
      */
     private static List getAudioFileWriters() {
         return getProviders(AudioFileWriter.class);
     }
 
-
-
-    /** Attempts to locate and return a default Mixer that provides lines
-     * of the specified type.
+    /**
+     * Attempts to locate and return a default Mixer that provides lines of the
+     * specified type.
      *
-     * @param providers the installed mixer providers
-     * @param info The requested line type
-     * TargetDataLine.class, Clip.class or Port.class.
-     * @return a Mixer that matches the requirements, or null if no default mixer found
+     * @param  providers the installed mixer providers
+     * @param  info The requested line type TargetDataLine.class, Clip.class or
+     *         Port.class
+     * @return a Mixer that matches the requirements, or null if no default
+     *         mixer found
      */
     private static Mixer getDefaultMixer(List providers, Line.Info info) {
         Class lineClass = info.getLineClass();
@@ -1469,16 +1409,13 @@ public class AudioSystem {
         return null;
     }
 
-
-
-    /** Return a MixerProvider of a given class from the list of
-        MixerProviders.
-
-        This method never requires the returned Mixer to do mixing.
-        @param providerClassName The class name of the provider to be returned.
-        @param providers The list of MixerProviders that is searched.
-        @return A MixerProvider of the requested class, or null if none is
-        found.
+    /**
+     * Return a MixerProvider of a given class from the list of MixerProviders.
+     * This method never requires the returned Mixer to do mixing.
+     *
+     * @param  providerClassName The class name of the provider to be returned
+     * @param  providers The list of MixerProviders that is searched
+     * @return A MixerProvider of the requested class, or null if none is found
      */
     private static MixerProvider getNamedProvider(String providerClassName,
                                                   List providers) {
@@ -1491,15 +1428,14 @@ public class AudioSystem {
         return null;
     }
 
-
-    /** Return a Mixer with a given name from a given MixerProvider.
-      This method never requires the returned Mixer to do mixing.
-      @param mixerName The name of the Mixer to be returned.
-      @param provider The MixerProvider to check for Mixers.
-      @param info The type of line the returned Mixer is required to
-      support.
-
-      @return A Mixer matching the requirements, or null if none is found.
+    /**
+     * Return a Mixer with a given name from a given MixerProvider. This method
+     * never requires the returned Mixer to do mixing.
+     *
+     * @param  mixerName The name of the Mixer to be returned
+     * @param  provider The MixerProvider to check for Mixers
+     * @param  info The type of line the returned Mixer is required to support
+     * @return A Mixer matching the requirements, or null if none is found
      */
     private static Mixer getNamedMixer(String mixerName,
                                        MixerProvider provider,
@@ -1516,14 +1452,14 @@ public class AudioSystem {
         return null;
     }
 
-
-    /** From a List of MixerProviders, return a Mixer with a given name.
-        This method never requires the returned Mixer to do mixing.
-        @param mixerName The name of the Mixer to be returned.
-        @param providers The List of MixerProviders to check for Mixers.
-        @param info The type of line the returned Mixer is required to
-        support.
-        @return A Mixer matching the requirements, or null if none is found.
+    /**
+     * From a List of MixerProviders, return a Mixer with a given name. This
+     * method never requires the returned Mixer to do mixing.
+     *
+     * @param  mixerName The name of the Mixer to be returned
+     * @param  providers The List of MixerProviders to check for Mixers
+     * @param  info The type of line the returned Mixer is required to support
+     * @return A Mixer matching the requirements, or null if none is found
      */
     private static Mixer getNamedMixer(String mixerName,
                                        List providers,
@@ -1538,16 +1474,14 @@ public class AudioSystem {
         return null;
     }
 
-
-    /** From a given MixerProvider, return the first appropriate Mixer.
-        @param provider The MixerProvider to check for Mixers.
-        @param info The type of line the returned Mixer is required to
-        support.
-        @param isMixingRequired If true, only Mixers that support mixing are
-        returned for line types of SourceDataLine and Clip.
-
-        @return A Mixer that is considered appropriate, or null
-        if none is found.
+    /**
+     * From a given MixerProvider, return the first appropriate Mixer.
+     *
+     * @param  provider The MixerProvider to check for Mixers
+     * @param  info The type of line the returned Mixer is required to support
+     * @param  isMixingRequired If true, only Mixers that support mixing are
+     *         returned for line types of SourceDataLine and Clip
+     * @return A Mixer that is considered appropriate, or null if none is found
      */
     private static Mixer getFirstMixer(MixerProvider provider,
                                        Line.Info info,
@@ -1562,15 +1496,14 @@ public class AudioSystem {
         return null;
     }
 
-
-    /** Checks if a Mixer is appropriate.
-        A Mixer is considered appropriate if it support the given line type.
-        If isMixingRequired is true and the line type is an output one
-        (SourceDataLine, Clip), the mixer is appropriate if it supports
-        at least 2 (concurrent) lines of the given type.
-
-        @return true if the mixer is considered appropriate according to the
-        rules given above, false otherwise.
+    /**
+     * Checks if a Mixer is appropriate. A Mixer is considered appropriate if it
+     * support the given line type. If isMixingRequired is true and the line
+     * type is an output one (SourceDataLine, Clip), the mixer is appropriate if
+     * it supports at least 2 (concurrent) lines of the given type.
+     *
+     * @return {@code true} if the mixer is considered appropriate according to
+     *         the rules given above, {@code false} otherwise
      */
     private static boolean isAppropriateMixer(Mixer mixer,
                                               Line.Info lineInfo,
@@ -1588,19 +1521,16 @@ public class AudioSystem {
         return true;
     }
 
-
-
     /**
-     * Like getMixerInfo, but return List
+     * Like getMixerInfo, but return List.
      */
     private static List getMixerInfoList() {
         List providers = getMixerProviders();
         return getMixerInfoList(providers);
     }
 
-
     /**
-     * Like getMixerInfo, but return List
+     * Like getMixerInfo, but return List.
      */
     private static List getMixerInfoList(List providers) {
         List infos = new ArrayList();
@@ -1619,12 +1549,12 @@ public class AudioSystem {
         return infos;
     }
 
-
     /**
-     * Obtains the set of services currently installed on the system
-     * using the SPI mechanism in 1.3.
-     * @return a List of instances of providers for the requested service.
-     * If no providers are available, a vector of length 0 will be returned.
+     * Obtains the set of services currently installed on the system using the
+     * SPI mechanism in 1.3.
+     *
+     * @return a List of instances of providers for the requested service. If no
+     *         providers are available, a vector of length 0 will be returned.
      */
     private static List getProviders(Class providerClass) {
         return JDK13Services.getProviders(providerClass);
diff --git a/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java b/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java
index e48e06c339c..4f81d7c6514 100644
--- a/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java
+++ b/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,34 +26,29 @@
 package javax.sound.sampled;
 
 /**
- * A <code>BooleanControl</code> provides the ability to switch between
- * two possible settings that affect a line's audio.  The settings are boolean
- * values (<code>true</code> and <code>false</code>).  A graphical user interface
- * might represent the control by a two-state button, an on/off switch, two
- * mutually exclusive buttons, or a checkbox (among other possibilities).
- * For example, depressing a button might activate a
- * <code>{@link BooleanControl.Type#MUTE MUTE}</code> control to silence
- * the line's audio.
+ * A {@code BooleanControl} provides the ability to switch between two possible
+ * settings that affect a line's audio. The settings are boolean values
+ * ({@code true} and {@code false}). A graphical user interface might represent
+ * the control by a two-state button, an on/off switch, two mutually exclusive
+ * buttons, or a checkbox (among other possibilities). For example, depressing a
+ * button might activate a {@link BooleanControl.Type#MUTE MUTE} control to
+ * silence the line's audio.
  * <p>
- * As with other <code>{@link Control}</code> subclasses, a method is
- * provided that returns string labels for the values, suitable for
- * display in the user interface.
+ * As with other {@code Control} subclasses, a method is provided that returns
+ * string labels for the values, suitable for display in the user interface.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public abstract class BooleanControl extends Control {
 
-
-    // INSTANCE VARIABLES
-
     /**
-     * The <code>true</code> state label, such as "true" or "on."
+     * The {@code true} state label, such as "true" or "on".
      */
     private final String trueStateLabel;
 
     /**
-     * The <code>false</code> state label, such as "false" or "off."
+     * The {@code false} state label, such as "false" or "off".
      */
     private final String falseStateLabel;
 
@@ -62,19 +57,15 @@ public abstract class BooleanControl extends Control {
      */
     private boolean value;
 
-
-    // CONSTRUCTORS
-
-
     /**
      * Constructs a new boolean control object with the given parameters.
      *
-     * @param type the type of control represented this float control object
-     * @param initialValue the initial control value
-     * @param trueStateLabel the label for the state represented by <code>true</code>,
-     * such as "true" or "on."
-     * @param falseStateLabel the label for the state represented by <code>false</code>,
-     * such as "false" or "off."
+     * @param  type the type of control represented this float control object
+     * @param  initialValue the initial control value
+     * @param  trueStateLabel the label for the state represented by
+     *         {@code true}, such as "true" or "on"
+     * @param  falseStateLabel the label for the state represented by
+     *         {@code false}, such as "false" or "off"
      */
     protected BooleanControl(Type type, boolean initialValue, String trueStateLabel, String falseStateLabel) {
 
@@ -84,110 +75,88 @@ public abstract class BooleanControl extends Control {
         this.falseStateLabel = falseStateLabel;
     }
 
-
     /**
-     * Constructs a new boolean control object with the given parameters.
-     * The labels for the <code>true</code> and <code>false</code> states
-     * default to "true" and "false."
+     * Constructs a new boolean control object with the given parameters. The
+     * labels for the {@code true} and {@code false} states default to "true"
+     * and "false".
      *
-     * @param type the type of control represented by this float control object
-     * @param initialValue the initial control value
+     * @param  type the type of control represented by this float control object
+     * @param  initialValue the initial control value
      */
     protected BooleanControl(Type type, boolean initialValue) {
         this(type, initialValue, "true", "false");
     }
 
-
-    // METHODS
-
-
     /**
-     * Sets the current value for the control.  The default
-     * implementation simply sets the value as indicated.
-     * Some controls require that their line be open before they can be affected
-     * by setting a value.
-     * @param value desired new value.
+     * Sets the current value for the control. The default implementation simply
+     * sets the value as indicated. Some controls require that their line be
+     * open before they can be affected by setting a value.
+     *
+     * @param  value desired new value
      */
     public void setValue(boolean value) {
         this.value = value;
     }
 
-
-
     /**
      * Obtains this control's current value.
-     * @return current value.
+     *
+     * @return current value
      */
     public boolean getValue() {
         return value;
     }
 
-
     /**
      * Obtains the label for the specified state.
-     * @param state the state whose label will be returned
-     * @return the label for the specified state, such as "true" or "on"
-     * for <code>true</code>, or "false" or "off" for <code>false</code>.
+     *
+     * @param  state the state whose label will be returned
+     * @return the label for the specified state, such as "true" or "on" for
+     *         {@code true}, or "false" or "off" for {@code false}
      */
     public String getStateLabel(boolean state) {
         return ((state == true) ? trueStateLabel : falseStateLabel);
     }
 
-
-
-    // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
     /**
-     * Provides a string representation of the control
+     * Provides a string representation of the control.
+     *
      * @return a string description
      */
+    @Override
     public String toString() {
         return new String(super.toString() + " with current value: " + getStateLabel(getValue()));
     }
 
-
-    // INNER CLASSES
-
-
     /**
-     * An instance of the <code>BooleanControl.Type</code> class identifies one kind of
-     * boolean control.  Static instances are provided for the
-     * common types.
+     * An instance of the {@code BooleanControl.Type} class identifies one kind
+     * of boolean control. Static instances are provided for the common types.
      *
      * @author Kara Kytle
      * @since 1.3
      */
     public static class Type extends Control.Type {
 
-
-        // TYPE DEFINES
-
-
         /**
-         * Represents a control for the mute status of a line.
-         * Note that mute status does not affect gain.
+         * Represents a control for the mute status of a line. Note that mute
+         * status does not affect gain.
          */
         public static final Type MUTE                           = new Type("Mute");
 
         /**
-         * Represents a control for whether reverberation is applied
-         * to a line.  Note that the status of this control not affect
-         * the reverberation settings for a line, but does affect whether
-         * these settings are used.
+         * Represents a control for whether reverberation is applied to a line.
+         * Note that the status of this control not affect the reverberation
+         * settings for a line, but does affect whether these settings are used.
          */
         public static final Type APPLY_REVERB           = new Type("Apply Reverb");
 
-
-        // CONSTRUCTOR
-
-
         /**
          * Constructs a new boolean control type.
-         * @param name  the name of the new boolean control type
+         *
+         * @param name the name of the new boolean control type
          */
-        protected Type(String name) {
+        protected Type(final String name) {
             super(name);
         }
-    } // class Type
+    }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/Clip.java b/jdk/src/share/classes/javax/sound/sampled/Clip.java
index 03965f35528..5ed01df832c 100644
--- a/jdk/src/share/classes/javax/sound/sampled/Clip.java
+++ b/jdk/src/share/classes/javax/sound/sampled/Clip.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,188 +25,184 @@
 
 package javax.sound.sampled;
 
-import java.io.InputStream;
 import java.io.IOException;
 
 /**
- * The <code>Clip</code> interface represents a special kind of data line whose
- * audio data can be loaded prior to playback, instead of being streamed in
- * real time.
+ * The {@code Clip} interface represents a special kind of data line whose audio
+ * data can be loaded prior to playback, instead of being streamed in real time.
  * <p>
- * Because the data is pre-loaded and has a known length, you can set a clip
- * to start playing at any position in its audio data.  You can also create a
- * loop, so that when the clip is played it will cycle repeatedly.  Loops are
- * specified with a starting and ending sample frame, along with the number of
- * times that the loop should be played.
+ * Because the data is pre-loaded and has a known length, you can set a clip to
+ * start playing at any position in its audio data. You can also create a loop,
+ * so that when the clip is played it will cycle repeatedly. Loops are specified
+ * with a starting and ending sample frame, along with the number of times that
+ * the loop should be played.
  * <p>
- * Clips may be obtained from a <code>{@link Mixer}</code> that supports lines
- * of this type.  Data is loaded into a clip when it is opened.
+ * Clips may be obtained from a {@link Mixer} that supports lines of this type.
+ * Data is loaded into a clip when it is opened.
  * <p>
- * Playback of an audio clip may be started and stopped using the <code>start</code>
- * and <code>stop</code> methods.  These methods do not reset the media position;
- * <code>start</code> causes playback to continue from the position where playback
- * was last stopped.  To restart playback from the beginning of the clip's audio
- * data, simply follow the invocation of <code>{@link DataLine#stop stop}</code>
- * with setFramePosition(0), which rewinds the media to the beginning
- * of the clip.
+ * Playback of an audio clip may be started and stopped using the
+ * {@link #start start} and {@link #stop stop} methods. These methods do not
+ * reset the media position; {@code start} causes playback to continue from the
+ * position where playback was last stopped. To restart playback from the
+ * beginning of the clip's audio data, simply follow the invocation of
+ * {@code stop} with {@code setFramePosition(0)}, which rewinds the media to the
+ * beginning of the clip.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public interface Clip extends DataLine {
 
-
     /**
      * A value indicating that looping should continue indefinitely rather than
      * complete after a specific number of loops.
+     *
      * @see #loop
      */
-    public static final int LOOP_CONTINUOUSLY = -1;
+    int LOOP_CONTINUOUSLY = -1;
 
     /**
-     * Opens the clip, meaning that it should acquire any required
-     * system resources and become operational.  The clip is opened
-     * with the format and audio data indicated.
-     * If this operation succeeds, the line is marked as open and an
-     * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched
-     * to the line's listeners.
+     * Opens the clip, meaning that it should acquire any required system
+     * resources and become operational. The clip is opened with the format and
+     * audio data indicated. If this operation succeeds, the line is marked as
+     * open and an {@link LineEvent.Type#OPEN OPEN} event is dispatched to the
+     * line's listeners.
      * <p>
-     * Invoking this method on a line which is already open is illegal
-     * and may result in an IllegalStateException.
+     * Invoking this method on a line which is already open is illegal and may
+     * result in an {@code IllegalStateException}.
      * <p>
-     * Note that some lines, once closed, cannot be reopened.  Attempts
-     * to reopen such a line will always result in a
-     * <code>{@link LineUnavailableException}</code>.
+     * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+     * such a line will always result in a {@code LineUnavailableException}.
      *
-     * @param format the format of the supplied audio data
-     * @param data a byte array containing audio data to load into the clip
-     * @param offset the point at which to start copying, expressed in
-     * <em>bytes</em> from the beginning of the array
-     * @param bufferSize the number of <em>bytes</em>
-     * of data to load into the clip from the array.
-     * @throws LineUnavailableException if the line cannot be
-     * opened due to resource restrictions
-     * @throws IllegalArgumentException if the buffer size does not represent
-     * an integral number of sample frames,
-     * or if <code>format</code> is not fully specified or invalid
+     * @param  format the format of the supplied audio data
+     * @param  data a byte array containing audio data to load into the clip
+     * @param  offset the point at which to start copying, expressed in
+     *         <em>bytes</em> from the beginning of the array
+     * @param  bufferSize the number of <em>bytes</em> of data to load into the
+     *         clip from the array
+     * @throws LineUnavailableException if the line cannot be opened due to
+     *         resource restrictions
+     * @throws IllegalArgumentException if the buffer size does not represent an
+     *         integral number of sample frames, or if {@code format} is not
+     *         fully specified or invalid
      * @throws IllegalStateException if the line is already open
-     * @throws SecurityException if the line cannot be
-     * opened due to security restrictions
-     *
+     * @throws SecurityException if the line cannot be opened due to security
+     *         restrictions
      * @see #close
      * @see #isOpen
      * @see LineListener
      */
-    public void open(AudioFormat format, byte[] data, int offset, int bufferSize) throws LineUnavailableException;
+    void open(AudioFormat format, byte[] data, int offset, int bufferSize)
+            throws LineUnavailableException;
 
     /**
-     * Opens the clip with the format and audio data present in the provided audio
-     * input stream.  Opening a clip means that it should acquire any required
-     * system resources and become operational.  If this operation
-     * input stream.  If this operation
-     * succeeds, the line is marked open and an
-     * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched
-     * to the line's listeners.
+     * Opens the clip with the format and audio data present in the provided
+     * audio input stream. Opening a clip means that it should acquire any
+     * required system resources and become operational. If this operation input
+     * stream. If this operation succeeds, the line is marked open and an
+     * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+     * listeners.
      * <p>
-     * Invoking this method on a line which is already open is illegal
-     * and may result in an IllegalStateException.
+     * Invoking this method on a line which is already open is illegal and may
+     * result in an {@code IllegalStateException}.
      * <p>
-     * Note that some lines, once closed, cannot be reopened.  Attempts
-     * to reopen such a line will always result in a
-     * <code>{@link LineUnavailableException}</code>.
+     * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+     * such a line will always result in a {@code LineUnavailableException}.
      *
-     * @param stream an audio input stream from which audio data will be read into
-     * the clip
-     * @throws LineUnavailableException if the line cannot be
-     * opened due to resource restrictions
-     * @throws IOException if an I/O exception occurs during reading of
-     * the stream
-     * @throws IllegalArgumentException if the stream's audio format
-     * is not fully specified or invalid
+     * @param  stream an audio input stream from which audio data will be read
+     *         into the clip
+     * @throws LineUnavailableException if the line cannot be opened due to
+     *         resource restrictions
+     * @throws IOException if an I/O exception occurs during reading of the
+     *         stream
+     * @throws IllegalArgumentException if the stream's audio format is not
+     *         fully specified or invalid
      * @throws IllegalStateException if the line is already open
-     * @throws SecurityException if the line cannot be
-     * opened due to security restrictions
-     *
+     * @throws SecurityException if the line cannot be opened due to security
+     *         restrictions
      * @see #close
      * @see #isOpen
      * @see LineListener
      */
-    public void open(AudioInputStream stream) throws LineUnavailableException, IOException;
+    void open(AudioInputStream stream)
+            throws LineUnavailableException, IOException;
 
     /**
      * Obtains the media length in sample frames.
-     * @return the media length, expressed in sample frames,
-     * or <code>AudioSystem.NOT_SPECIFIED</code> if the line is not open.
+     *
+     * @return the media length, expressed in sample frames, or
+     *         {@code AudioSystem.NOT_SPECIFIED} if the line is not open
      * @see AudioSystem#NOT_SPECIFIED
      */
-    public int getFrameLength();
+    int getFrameLength();
 
     /**
-     * Obtains the media duration in microseconds
-     * @return the media duration, expressed in microseconds,
-     * or <code>AudioSystem.NOT_SPECIFIED</code> if the line is not open.
+     * Obtains the media duration in microseconds.
+     *
+     * @return the media duration, expressed in microseconds, or
+     *         {@code AudioSystem.NOT_SPECIFIED} if the line is not open
      * @see AudioSystem#NOT_SPECIFIED
      */
-    public long getMicrosecondLength();
+    long getMicrosecondLength();
 
     /**
-     * Sets the media position in sample frames.  The position is zero-based;
-     * the first frame is frame number zero.  When the clip begins playing the
-     * next time, it will start by playing the frame at this position.
+     * Sets the media position in sample frames. The position is zero-based; the
+     * first frame is frame number zero. When the clip begins playing the next
+     * time, it will start by playing the frame at this position.
      * <p>
      * To obtain the current position in sample frames, use the
-     * <code>{@link DataLine#getFramePosition getFramePosition}</code>
-     * method of <code>DataLine</code>.
+     * {@link DataLine#getFramePosition getFramePosition} method of
+     * {@code DataLine}.
      *
-     * @param frames the desired new media position, expressed in sample frames
+     * @param  frames the desired new media position, expressed in sample frames
      */
-    public void setFramePosition(int frames);
+    void setFramePosition(int frames);
 
     /**
-     * Sets the media position in microseconds.  When the clip begins playing the
-     * next time, it will start at this position.
-     * The level of precision is not guaranteed.  For example, an implementation
-     * might calculate the microsecond position from the current frame position
-     * and the audio sample frame rate.  The precision in microseconds would
-     * then be limited to the number of microseconds per sample frame.
+     * Sets the media position in microseconds. When the clip begins playing the
+     * next time, it will start at this position. The level of precision is not
+     * guaranteed. For example, an implementation might calculate the
+     * microsecond position from the current frame position and the audio sample
+     * frame rate. The precision in microseconds would then be limited to the
+     * number of microseconds per sample frame.
      * <p>
      * To obtain the current position in microseconds, use the
-     * <code>{@link DataLine#getMicrosecondPosition getMicrosecondPosition}</code>
-     * method of <code>DataLine</code>.
+     * {@link DataLine#getMicrosecondPosition getMicrosecondPosition} method of
+     * {@code DataLine}.
      *
-     * @param microseconds the desired new media position, expressed in microseconds
+     * @param  microseconds the desired new media position, expressed in
+     *         microseconds
      */
-    public void setMicrosecondPosition(long microseconds);
+    void setMicrosecondPosition(long microseconds);
 
     /**
-     * Sets the first and last sample frames that will be played in
-     * the loop.  The ending point must be greater than
-     * or equal to the starting point, and both must fall within the
-     * the size of the loaded media.  A value of 0 for the starting
-     * point means the beginning of the loaded media.  Similarly, a value of -1
-     * for the ending point indicates the last frame of the media.
-     * @param start the loop's starting position, in sample frames (zero-based)
-     * @param end the loop's ending position, in sample frames (zero-based), or
-     * -1 to indicate the final frame
-     * @throws IllegalArgumentException if the requested
-     * loop points cannot be set, usually because one or both falls outside
-     * the media's duration or because the ending point is
-     * before the starting point
+     * Sets the first and last sample frames that will be played in the loop.
+     * The ending point must be greater than or equal to the starting point, and
+     * both must fall within the the size of the loaded media. A value of 0 for
+     * the starting point means the beginning of the loaded media. Similarly, a
+     * value of -1 for the ending point indicates the last frame of the media.
+     *
+     * @param  start the loop's starting position, in sample frames (zero-based)
+     * @param  end the loop's ending position, in sample frames (zero-based),
+     *         or -1 to indicate the final frame
+     * @throws IllegalArgumentException if the requested loop points cannot be
+     *         set, usually because one or both falls outside the media's
+     *         duration or because the ending point is before the starting point
      */
-    public void setLoopPoints(int start, int end);
+    void setLoopPoints(int start, int end);
 
     /**
-     * Starts looping playback from the current position.   Playback will
-     * continue to the loop's end point, then loop back to the loop start point
-     * <code>count</code> times, and finally continue playback to the end of
-     * the clip.
+     * Starts looping playback from the current position. Playback will continue
+     * to the loop's end point, then loop back to the loop start point
+     * {@code count} times, and finally continue playback to the end of the
+     * clip.
      * <p>
      * If the current position when this method is invoked is greater than the
-     * loop end point, playback simply continues to the
-     * end of the clip without looping.
+     * loop end point, playback simply continues to the end of the clip without
+     * looping.
      * <p>
-     * A <code>count</code> value of 0 indicates that any current looping should
-     * cease and playback should continue to the end of the clip.  The behavior
+     * A {@code count} value of 0 indicates that any current looping should
+     * cease and playback should continue to the end of the clip. The behavior
      * is undefined when this method is invoked with any other value during a
      * loop operation.
      * <p>
@@ -214,10 +210,10 @@ public interface Clip extends DataLine {
      * cleared; the behavior of subsequent loop and start requests is not
      * affected by an interrupted loop operation.
      *
-     * @param count the number of times playback should loop back from the
-     * loop's end position to the loop's  start position, or
-     * <code>{@link #LOOP_CONTINUOUSLY}</code> to indicate that looping should
-     * continue until interrupted
+     * @param  count the number of times playback should loop back from the
+     *         loop's end position to the loop's start position, or
+     *         {@link #LOOP_CONTINUOUSLY} to indicate that looping should
+     *         continue until interrupted
      */
-    public void loop(int count);
+    void loop(int count);
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java b/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java
index 1c7ba46ede9..50c92a5efe2 100644
--- a/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java
+++ b/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,55 +26,37 @@
 package javax.sound.sampled;
 
 /**
- * A <code>CompoundControl</code>, such as a graphic equalizer, provides control
- * over two or more related properties, each of which is itself represented as
- * a <code>Control</code>.
+ * A {@code CompoundControl}, such as a graphic equalizer, provides control over
+ * two or more related properties, each of which is itself represented as a
+ * {@code Control}.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public abstract class CompoundControl extends Control {
 
-
-    // TYPE DEFINES
-
-
-    // INSTANCE VARIABLES
-
-
     /**
      * The set of member controls.
      */
     private Control[] controls;
 
-
-
-    // CONSTRUCTORS
-
-
     /**
      * Constructs a new compound control object with the given parameters.
      *
-     * @param type the type of control represented this compound control object
-     * @param memberControls the set of member controls
+     * @param  type the type of control represented this compound control object
+     * @param  memberControls the set of member controls
      */
     protected CompoundControl(Type type, Control[] memberControls) {
-
         super(type);
         this.controls = memberControls;
     }
 
-
-
-    // METHODS
-
-
     /**
      * Returns the set of member controls that comprise the compound control.
-     * @return the set of member controls.
+     *
+     * @return the set of member controls
      */
     public Control[] getMemberControls() {
-
         Control[] localArray = new Control[controls.length];
 
         for (int i = 0; i < controls.length; i++) {
@@ -84,14 +66,12 @@ public abstract class CompoundControl extends Control {
         return localArray;
     }
 
-
-    // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
     /**
-     * Provides a string representation of the control
+     * Provides a string representation of the control.
+     *
      * @return a string description
      */
+    @Override
     public String toString() {
 
         StringBuffer buf = new StringBuffer();
@@ -108,13 +88,9 @@ public abstract class CompoundControl extends Control {
         return new String(getType() + " Control containing " + buf + " Controls.");
     }
 
-
-    // INNER CLASSES
-
-
     /**
-     * An instance of the <code>CompoundControl.Type</code> inner class identifies one kind of
-     * compound control.  Static instances are provided for the
+     * An instance of the {@code CompoundControl.Type} inner class identifies
+     * one kind of compound control. Static instances are provided for the
      * common types.
      *
      * @author Kara Kytle
@@ -122,19 +98,13 @@ public abstract class CompoundControl extends Control {
      */
     public static class Type extends Control.Type {
 
-
-        // TYPE DEFINES
-
-        // CONSTRUCTOR
-
-
         /**
          * Constructs a new compound control type.
-         * @param name  the name of the new compound control type
+         *
+         * @param  name the name of the new compound control type
          */
-        protected Type(String name) {
+        protected Type(final String name) {
             super(name);
         }
-    } // class Type
-
-} // class CompoundControl
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/Control.java b/jdk/src/share/classes/javax/sound/sampled/Control.java
index 6b8b9c6a5e4..a3257b8539e 100644
--- a/jdk/src/share/classes/javax/sound/sampled/Control.java
+++ b/jdk/src/share/classes/javax/sound/sampled/Control.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,121 +26,102 @@
 package javax.sound.sampled;
 
 /**
- * {@link Line Lines} often have a set of controls, such as gain and pan, that affect
- * the audio signal passing through the line.  Java Sound's <code>Line</code> objects
- * let you obtain a particular control object by passing its class as the
- * argument to a {@link Line#getControl(Control.Type) getControl} method.
+ * {@link Line Lines} often have a set of controls, such as gain and pan, that
+ * affect the audio signal passing through the line. Java Sound's {@code Line}
+ * objects let you obtain a particular control object by passing its class as
+ * the argument to a {@link Line#getControl(Control.Type) getControl} method.
  * <p>
  * Because the various types of controls have different purposes and features,
- * all of their functionality is accessed from the subclasses that define
- * each kind of control.
+ * all of their functionality is accessed from the subclasses that define each
+ * kind of control.
  *
  * @author Kara Kytle
- *
  * @see Line#getControls
  * @see Line#isControlSupported
  * @since 1.3
  */
 public abstract class Control {
 
-
-    // INSTANCE VARIABLES
-
     /**
      * The control type.
      */
     private final Type type;
 
-
-
-    // CONSTRUCTORS
-
     /**
      * Constructs a Control with the specified type.
-     * @param type the kind of control desired
+     *
+     * @param  type the kind of control desired
      */
     protected Control(Type type) {
         this.type = type;
     }
 
-
-    // METHODS
-
     /**
      * Obtains the control's type.
-     * @return the control's type.
+     *
+     * @return the control's type
      */
     public Type getType() {
         return type;
     }
 
-
-    // ABSTRACT METHODS
-
     /**
      * Obtains a String describing the control type and its current state.
-     * @return a String representation of the Control.
+     *
+     * @return a String representation of the Control
      */
+    @Override
     public String toString() {
         return new String(getType() + " Control");
     }
 
-
     /**
-     * An instance of the <code>Type</code> class represents the type of
-     * the control.  Static instances are provided for the
-     * common types.
+     * An instance of the {@code Type} class represents the type of the control.
+     * Static instances are provided for the common types.
      */
     public static class Type {
 
-        // CONTROL TYPE DEFINES
-
-        // INSTANCE VARIABLES
-
         /**
          * Type name.
          */
         private String name;
 
-
-        // CONSTRUCTOR
-
         /**
-         * Constructs a new control type with the name specified.
-         * The name should be a descriptive string appropriate for
-         * labelling the control in an application, such as "Gain" or "Balance."
-         * @param name  the name of the new control type.
+         * Constructs a new control type with the name specified. The name
+         * should be a descriptive string appropriate for labelling the control
+         * in an application, such as "Gain" or "Balance".
+         *
+         * @param  name the name of the new control type
          */
         protected Type(String name) {
             this.name = name;
         }
 
-
-        // METHODS
-
         /**
-         * Finalizes the equals method
+         * Finalizes the equals method.
          */
+        @Override
         public final boolean equals(Object obj) {
             return super.equals(obj);
         }
 
         /**
-         * Finalizes the hashCode method
+         * Finalizes the hashCode method.
          */
+        @Override
         public final int hashCode() {
             return super.hashCode();
         }
 
         /**
-         * Provides the <code>String</code> representation of the control type.  This <code>String</code> is
-         * the same name that was passed to the constructor.
+         * Provides the {@code String} representation of the control type. This
+         * {@code String} is the same name that was passed to the constructor.
          *
          * @return the control type name
          */
+        @Override
         public final String toString() {
             return name;
         }
-    } // class Type
-
-} // class Control
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/DataLine.java b/jdk/src/share/classes/javax/sound/sampled/DataLine.java
index d0030c9baae..7bba329caec 100644
--- a/jdk/src/share/classes/javax/sound/sampled/DataLine.java
+++ b/jdk/src/share/classes/javax/sound/sampled/DataLine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,40 +28,35 @@ package javax.sound.sampled;
 import java.util.Arrays;
 
 /**
- * <code>DataLine</code> adds media-related functionality to its
- * superinterface, <code>{@link Line}</code>.  This functionality includes
- * transport-control methods that start, stop, drain, and flush
- * the audio data that passes through the line.  A data line can also
- * report the current position, volume, and audio format of the media.
- * Data lines are used for output of audio by means of the
- * subinterfaces <code>{@link SourceDataLine}</code> or
- * <code>{@link Clip}</code>, which allow an application program to write data.  Similarly,
- * audio input is handled by the subinterface <code>{@link TargetDataLine}</code>,
- * which allows data to be read.
+ * {@code DataLine} adds media-related functionality to its superinterface,
+ * {@code Line}. This functionality includes transport-control methods that
+ * start, stop, drain, and flush the audio data that passes through the line. A
+ * data line can also report the current position, volume, and audio format of
+ * the media. Data lines are used for output of audio by means of the
+ * subinterfaces {@link SourceDataLine} or {@link Clip}, which allow an
+ * application program to write data. Similarly, audio input is handled by the
+ * subinterface {@link TargetDataLine}, which allows data to be read.
  * <p>
- * A data line has an internal buffer in which
- * the incoming or outgoing audio data is queued.  The
- * <code>{@link #drain()}</code> method blocks until this internal buffer
- * becomes empty, usually because all queued data has been processed.  The
- * <code>{@link #flush()}</code> method discards any available queued data
- * from the internal buffer.
+ * A data line has an internal buffer in which the incoming or outgoing audio
+ * data is queued. The {@link #drain()} method blocks until this internal buffer
+ * becomes empty, usually because all queued data has been processed. The
+ * {@link #flush()} method discards any available queued data from the internal
+ * buffer.
  * <p>
- * A data line produces <code>{@link LineEvent.Type#START START}</code> and
- * <code>{@link LineEvent.Type#STOP STOP}</code> events whenever
- * it begins or ceases active presentation or capture of data.  These events
- * can be generated in response to specific requests, or as a result of
- * less direct state changes.  For example, if <code>{@link #start()}</code> is called
- * on an inactive data line, and data is available for capture or playback, a
- * <code>START</code> event will be generated shortly, when data playback
- * or capture actually begins.  Or, if the flow of data to an active data
- * line is constricted so that a gap occurs in the presentation of data,
- * a <code>STOP</code> event is generated.
+ * A data line produces {@link LineEvent.Type#START START} and
+ * {@link LineEvent.Type#STOP STOP} events whenever it begins or ceases active
+ * presentation or capture of data. These events can be generated in response to
+ * specific requests, or as a result of less direct state changes. For example,
+ * if {@link #start()} is called on an inactive data line, and data is available
+ * for capture or playback, a {@code START} event will be generated shortly,
+ * when data playback or capture actually begins. Or, if the flow of data to an
+ * active data line is constricted so that a gap occurs in the presentation of
+ * data, a {@code STOP} event is generated.
  * <p>
  * Mixers often support synchronized control of multiple data lines.
  * Synchronization can be established through the Mixer interface's
- * <code>{@link Mixer#synchronize synchronize}</code> method.
- * See the description of the <code>{@link Mixer Mixer}</code> interface
- * for a more complete description.
+ * {@link Mixer#synchronize synchronize} method. See the description of the
+ * {@link Mixer Mixer} interface for a more complete description.
  *
  * @author Kara Kytle
  * @see LineEvent
@@ -69,220 +64,217 @@ import java.util.Arrays;
  */
 public interface DataLine extends Line {
 
-
     /**
-     * Drains queued data from the line by continuing data I/O until the
-     * data line's internal buffer has been emptied.
-     * This method blocks until the draining is complete.  Because this is a
-     * blocking method, it should be used with care.  If <code>drain()</code>
-     * is invoked on a stopped line that has data in its queue, the method will
-     * block until the line is running and the data queue becomes empty.  If
-     * <code>drain()</code> is invoked by one thread, and another continues to
-     * fill the data queue, the operation will not complete.
-     * This method always returns when the data line is closed.
+     * Drains queued data from the line by continuing data I/O until the data
+     * line's internal buffer has been emptied. This method blocks until the
+     * draining is complete. Because this is a blocking method, it should be
+     * used with care. If {@code drain()} is invoked on a stopped line that has
+     * data in its queue, the method will block until the line is running and
+     * the data queue becomes empty. If {@code drain()} is invoked by one
+     * thread, and another continues to fill the data queue, the operation will
+     * not complete. This method always returns when the data line is closed.
      *
      * @see #flush()
      */
-    public void drain();
+    void drain();
 
     /**
-     * Flushes queued data from the line.  The flushed data is discarded.
-     * In some cases, not all queued data can be discarded.  For example, a
-     * mixer can flush data from the buffer for a specific input line, but any
-     * unplayed data already in the output buffer (the result of the mix) will
-     * still be played.  You can invoke this method after pausing a line (the
-     * normal case) if you want to skip the "stale" data when you restart
-     * playback or capture. (It is legal to flush a line that is not stopped,
-     * but doing so on an active line is likely to cause a discontinuity in the
-     * data, resulting in a perceptible click.)
+     * Flushes queued data from the line. The flushed data is discarded. In some
+     * cases, not all queued data can be discarded. For example, a mixer can
+     * flush data from the buffer for a specific input line, but any unplayed
+     * data already in the output buffer (the result of the mix) will still be
+     * played. You can invoke this method after pausing a line (the normal case)
+     * if you want to skip the "stale" data when you restart playback or
+     * capture. (It is legal to flush a line that is not stopped, but doing so
+     * on an active line is likely to cause a discontinuity in the data,
+     * resulting in a perceptible click.)
      *
      * @see #stop()
      * @see #drain()
      */
-    public void flush();
+    void flush();
 
     /**
-     * Allows a line to engage in data I/O.  If invoked on a line
-     * that is already running, this method does nothing.  Unless the data in
-     * the buffer has been flushed, the line resumes I/O starting
-     * with the first frame that was unprocessed at the time the line was
-     * stopped. When audio capture or playback starts, a
-     * <code>{@link LineEvent.Type#START START}</code> event is generated.
+     * Allows a line to engage in data I/O. If invoked on a line that is already
+     * running, this method does nothing. Unless the data in the buffer has been
+     * flushed, the line resumes I/O starting with the first frame that was
+     * unprocessed at the time the line was stopped. When audio capture or
+     * playback starts, a {@link LineEvent.Type#START START} event is generated.
      *
      * @see #stop()
      * @see #isRunning()
      * @see LineEvent
      */
-    public void start();
+    void start();
 
     /**
-     * Stops the line.  A stopped line should cease I/O activity.
-     * If the line is open and running, however, it should retain the resources required
-     * to resume activity.  A stopped line should retain any audio data in its buffer
-     * instead of discarding it, so that upon resumption the I/O can continue where it left off,
-     * if possible.  (This doesn't guarantee that there will never be discontinuities beyond the
-     * current buffer, of course; if the stopped condition continues
-     * for too long, input or output samples might be dropped.)  If desired, the retained data can be
-     * discarded by invoking the <code>flush</code> method.
-     * When audio capture or playback stops, a <code>{@link LineEvent.Type#STOP STOP}</code> event is generated.
+     * Stops the line. A stopped line should cease I/O activity. If the line is
+     * open and running, however, it should retain the resources required to
+     * resume activity. A stopped line should retain any audio data in its
+     * buffer instead of discarding it, so that upon resumption the I/O can
+     * continue where it left off, if possible. (This doesn't guarantee that
+     * there will never be discontinuities beyond the current buffer, of course;
+     * if the stopped condition continues for too long, input or output samples
+     * might be dropped.) If desired, the retained data can be discarded by
+     * invoking the {@code flush} method. When audio capture or playback stops,
+     * a {@link LineEvent.Type#STOP STOP} event is generated.
      *
      * @see #start()
      * @see #isRunning()
      * @see #flush()
      * @see LineEvent
      */
-    public void stop();
+    void stop();
 
     /**
-     * Indicates whether the line is running.  The default is <code>false</code>.
-     * An open line begins running when the first data is presented in response to an
-     * invocation of the <code>start</code> method, and continues
-     * until presentation ceases in response to a call to <code>stop</code> or
-     * because playback completes.
-     * @return <code>true</code> if the line is running, otherwise <code>false</code>
+     * Indicates whether the line is running. The default is {@code false}. An
+     * open line begins running when the first data is presented in response to
+     * an invocation of the {@code start} method, and continues until
+     * presentation ceases in response to a call to {@code stop} or because
+     * playback completes.
+     *
+     * @return {@code true} if the line is running, otherwise {@code false}
      * @see #start()
      * @see #stop()
      */
-    public boolean isRunning();
+    boolean isRunning();
 
     /**
-     * Indicates whether the line is engaging in active I/O (such as playback
-     * or capture).  When an inactive line becomes active, it sends a
-     * <code>{@link LineEvent.Type#START START}</code> event to its listeners.  Similarly, when
-     * an active line becomes inactive, it sends a
-     * <code>{@link LineEvent.Type#STOP STOP}</code> event.
-     * @return <code>true</code> if the line is actively capturing or rendering
-     * sound, otherwise <code>false</code>
+     * Indicates whether the line is engaging in active I/O (such as playback or
+     * capture). When an inactive line becomes active, it sends a
+     * {@link LineEvent.Type#START START} event to its listeners. Similarly,
+     * when an active line becomes inactive, it sends a
+     * {@link LineEvent.Type#STOP STOP} event.
+     *
+     * @return {@code true} if the line is actively capturing or rendering
+     *         sound, otherwise {@code false}
      * @see #isOpen
      * @see #addLineListener
      * @see #removeLineListener
      * @see LineEvent
      * @see LineListener
      */
-    public boolean isActive();
+    boolean isActive();
 
     /**
      * Obtains the current format (encoding, sample rate, number of channels,
      * etc.) of the data line's audio data.
-     *
-     * <p>If the line is not open and has never been opened, it returns
-     * the default format. The default format is an implementation
-     * specific audio format, or, if the <code>DataLine.Info</code>
-     * object, which was used to retrieve this <code>DataLine</code>,
-     * specifies at least one fully qualified audio format, the
-     * last one will be used as the default format. Opening the
-     * line with a specific audio format (e.g.
-     * {@link SourceDataLine#open(AudioFormat)}) will override the
-     * default format.
+     * <p>
+     * If the line is not open and has never been opened, it returns the default
+     * format. The default format is an implementation specific audio format,
+     * or, if the {@code DataLine.Info} object, which was used to retrieve this
+     * {@code DataLine}, specifies at least one fully qualified audio format,
+     * the last one will be used as the default format. Opening the line with a
+     * specific audio format (e.g. {@link SourceDataLine#open(AudioFormat)})
+     * will override the default format.
      *
      * @return current audio data format
      * @see AudioFormat
      */
-    public AudioFormat getFormat();
+    AudioFormat getFormat();
 
     /**
-     * Obtains the maximum number of bytes of data that will fit in the data line's
-     * internal buffer.  For a source data line, this is the size of the buffer to
-     * which data can be written.  For a target data line, it is the size of
-     * the buffer from which data can be read.  Note that
-     * the units used are bytes, but will always correspond to an integral
-     * number of sample frames of audio data.
+     * Obtains the maximum number of bytes of data that will fit in the data
+     * line's internal buffer. For a source data line, this is the size of the
+     * buffer to which data can be written. For a target data line, it is the
+     * size of the buffer from which data can be read. Note that the units used
+     * are bytes, but will always correspond to an integral number of sample
+     * frames of audio data.
      *
      * @return the size of the buffer in bytes
      */
-    public int getBufferSize();
+    int getBufferSize();
 
     /**
      * Obtains the number of bytes of data currently available to the
-     * application for processing in the data line's internal buffer.  For a
+     * application for processing in the data line's internal buffer. For a
      * source data line, this is the amount of data that can be written to the
-     * buffer without blocking.  For a target data line, this is the amount of data
-     * available to be read by the application.  For a clip, this value is always
-     * 0 because the audio data is loaded into the buffer when the clip is opened,
-     * and persists without modification until the clip is closed.
+     * buffer without blocking. For a target data line, this is the amount of
+     * data available to be read by the application. For a clip, this value is
+     * always 0 because the audio data is loaded into the buffer when the clip
+     * is opened, and persists without modification until the clip is closed.
      * <p>
-     * Note that the units used are bytes, but will always
-     * correspond to an integral number of sample frames of audio data.
+     * Note that the units used are bytes, but will always correspond to an
+     * integral number of sample frames of audio data.
      * <p>
-     * An application is guaranteed that a read or
-     * write operation of up to the number of bytes returned from
-     * <code>available()</code> will not block; however, there is no guarantee
-     * that attempts to read or write more data will block.
+     * An application is guaranteed that a read or write operation of up to the
+     * number of bytes returned from {@code available()} will not block;
+     * however, there is no guarantee that attempts to read or write more data
+     * will block.
      *
      * @return the amount of data available, in bytes
      */
-    public int available();
+    int available();
 
     /**
-     * Obtains the current position in the audio data, in sample frames.
-     * The frame position measures the number of sample
-     * frames captured by, or rendered from, the line since it was opened.
-     * This return value will wrap around after 2^31 frames. It is recommended
-     * to use <code>getLongFramePosition</code> instead.
+     * Obtains the current position in the audio data, in sample frames. The
+     * frame position measures the number of sample frames captured by, or
+     * rendered from, the line since it was opened. This return value will wrap
+     * around after 2^31 frames. It is recommended to use
+     * {@code getLongFramePosition} instead.
      *
      * @return the number of frames already processed since the line was opened
      * @see #getLongFramePosition()
      */
-    public int getFramePosition();
-
+    int getFramePosition();
 
     /**
-     * Obtains the current position in the audio data, in sample frames.
-     * The frame position measures the number of sample
-     * frames captured by, or rendered from, the line since it was opened.
+     * Obtains the current position in the audio data, in sample frames. The
+     * frame position measures the number of sample frames captured by, or
+     * rendered from, the line since it was opened.
      *
      * @return the number of frames already processed since the line was opened
      * @since 1.5
      */
-    public long getLongFramePosition();
-
+    long getLongFramePosition();
 
     /**
-     * Obtains the current position in the audio data, in microseconds.
-     * The microsecond position measures the time corresponding to the number
-     * of sample frames captured by, or rendered from, the line since it was opened.
-     * The level of precision is not guaranteed.  For example, an implementation
-     * might calculate the microsecond position from the current frame position
-     * and the audio sample frame rate.  The precision in microseconds would
-     * then be limited to the number of microseconds per sample frame.
+     * Obtains the current position in the audio data, in microseconds. The
+     * microsecond position measures the time corresponding to the number of
+     * sample frames captured by, or rendered from, the line since it was
+     * opened. The level of precision is not guaranteed. For example, an
+     * implementation might calculate the microsecond position from the current
+     * frame position and the audio sample frame rate. The precision in
+     * microseconds would then be limited to the number of microseconds per
+     * sample frame.
      *
-     * @return the number of microseconds of data processed since the line was opened
+     * @return the number of microseconds of data processed since the line was
+     *         opened
      */
-    public long getMicrosecondPosition();
+    long getMicrosecondPosition();
 
     /**
-     * Obtains the current volume level for the line.  This level is a measure
-     * of the signal's current amplitude, and should not be confused with the
-     * current setting of a gain control. The range is from 0.0 (silence) to
-     * 1.0 (maximum possible amplitude for the sound waveform).  The units
-     * measure linear amplitude, not decibels.
+     * Obtains the current volume level for the line. This level is a measure of
+     * the signal's current amplitude, and should not be confused with the
+     * current setting of a gain control. The range is from 0.0 (silence) to 1.0
+     * (maximum possible amplitude for the sound waveform). The units measure
+     * linear amplitude, not decibels.
      *
      * @return the current amplitude of the signal in this line, or
-     * <code>{@link AudioSystem#NOT_SPECIFIED}</code>
+     *         {@link AudioSystem#NOT_SPECIFIED}
      */
-    public float getLevel();
+    float getLevel();
 
     /**
      * Besides the class information inherited from its superclass,
-     * <code>DataLine.Info</code> provides additional information specific to data lines.
-     * This information includes:
+     * {@code DataLine.Info} provides additional information specific to data
+     * lines. This information includes:
      * <ul>
      * <li> the audio formats supported by the data line
      * <li> the minimum and maximum sizes of its internal buffer
      * </ul>
-     * Because a <code>Line.Info</code> knows the class of the line its describes, a
-     * <code>DataLine.Info</code> object can describe <code>DataLine</code>
-     * subinterfaces such as <code>{@link SourceDataLine}</code>,
-     * <code>{@link TargetDataLine}</code>, and <code>{@link Clip}</code>.
-     * You can query a mixer for lines of any of these types, passing an appropriate
-     * instance of <code>DataLine.Info</code> as the argument to a method such as
-     * <code>{@link Mixer#getLine Mixer.getLine(Line.Info)}</code>.
+     * Because a {@code Line.Info} knows the class of the line its describes, a
+     * {@code DataLine.Info} object can describe {@code DataLine} subinterfaces
+     * such as {@link SourceDataLine}, {@link TargetDataLine}, and {@link Clip}.
+     * You can query a mixer for lines of any of these types, passing an
+     * appropriate instance of {@code DataLine.Info} as the argument to a method
+     * such as {@link Mixer#getLine(Line.Info)}.
      *
      * @see Line.Info
      * @author Kara Kytle
      * @since 1.3
      */
-    public static class Info extends Line.Info {
+    class Info extends Line.Info {
 
         private final AudioFormat[] formats;
         private final int minBufferSize;
@@ -290,14 +282,17 @@ public interface DataLine extends Line {
 
         /**
          * Constructs a data line's info object from the specified information,
-         * which includes a set of supported audio formats and a range for the buffer size.
-         * This constructor is typically used by mixer implementations
-         * when returning information about a supported line.
+         * which includes a set of supported audio formats and a range for the
+         * buffer size. This constructor is typically used by mixer
+         * implementations when returning information about a supported line.
          *
-         * @param lineClass the class of the data line described by the info object
-         * @param formats set of formats supported
-         * @param minBufferSize minimum buffer size supported by the data line, in bytes
-         * @param maxBufferSize maximum buffer size supported by the data line, in bytes
+         * @param  lineClass the class of the data line described by the info
+         *         object
+         * @param  formats set of formats supported
+         * @param  minBufferSize minimum buffer size supported by the data
+         *         line, in bytes
+         * @param  maxBufferSize maximum buffer size supported by the data
+         *         line, in bytes
          */
         public Info(Class<?> lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize) {
 
@@ -313,16 +308,16 @@ public interface DataLine extends Line {
             this.maxBufferSize = maxBufferSize;
         }
 
-
         /**
          * Constructs a data line's info object from the specified information,
-         * which includes a single audio format and a desired buffer size.
-         * This constructor is typically used by an application to
-         * describe a desired line.
+         * which includes a single audio format and a desired buffer size. This
+         * constructor is typically used by an application to describe a desired
+         * line.
          *
-         * @param lineClass the class of the data line described by the info object
-         * @param format desired format
-         * @param bufferSize desired buffer size in bytes
+         * @param  lineClass the class of the data line described by the info
+         *         object
+         * @param  format desired format
+         * @param  bufferSize desired buffer size in bytes
          */
         public Info(Class<?> lineClass, AudioFormat format, int bufferSize) {
 
@@ -338,39 +333,36 @@ public interface DataLine extends Line {
             this.maxBufferSize = bufferSize;
         }
 
-
         /**
          * Constructs a data line's info object from the specified information,
-         * which includes a single audio format.
-         * This constructor is typically used by an application to
-         * describe a desired line.
+         * which includes a single audio format. This constructor is typically
+         * used by an application to describe a desired line.
          *
-         * @param lineClass the class of the data line described by the info object
-         * @param format desired format
+         * @param  lineClass the class of the data line described by the info
+         *         object
+         * @param  format desired format
          */
         public Info(Class<?> lineClass, AudioFormat format) {
             this(lineClass, format, AudioSystem.NOT_SPECIFIED);
         }
 
-
         /**
-         * Obtains a set of audio formats supported by the data line.
-         * Note that <code>isFormatSupported(AudioFormat)</code> might return
-         * <code>true</code> for certain additional formats that are missing from
-         * the set returned by <code>getFormats()</code>.  The reverse is not
-         * the case: <code>isFormatSupported(AudioFormat)</code> is guaranteed to return
-         * <code>true</code> for all formats returned by <code>getFormats()</code>.
-         *
+         * Obtains a set of audio formats supported by the data line. Note that
+         * {@code isFormatSupported(AudioFormat)} might return {@code true} for
+         * certain additional formats that are missing from the set returned by
+         * {@code getFormats()}. The reverse is not the case:
+         * {@code isFormatSupported(AudioFormat)} is guaranteed to return
+         * {@code true} for all formats returned by {@code getFormats()}.
+         * <p>
          * Some fields in the AudioFormat instances can be set to
          * {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED NOT_SPECIFIED}
-         * if that field does not apply to the format,
-         * or if the format supports a wide range of values for that field.
-         * For example, a multi-channel device supporting up to
-         * 64 channels, could set the channel field in the
-         * <code>AudioFormat</code> instances returned by this
-         * method to <code>NOT_SPECIFIED</code>.
+         * if that field does not apply to the format, or if the format supports
+         * a wide range of values for that field. For example, a multi-channel
+         * device supporting up to 64 channels, could set the channel field in
+         * the {@code AudioFormat} instances returned by this method to
+         * {@code NOT_SPECIFIED}.
          *
-         * @return a set of supported audio formats.
+         * @return a set of supported audio formats
          * @see #isFormatSupported(AudioFormat)
          */
         public AudioFormat[] getFormats() {
@@ -379,11 +371,12 @@ public interface DataLine extends Line {
 
         /**
          * Indicates whether this data line supports a particular audio format.
-         * The default implementation of this method simply returns <code>true</code> if
-         * the specified format matches any of the supported formats.
+         * The default implementation of this method simply returns {@code true}
+         * if the specified format matches any of the supported formats.
          *
-         * @param format the audio format for which support is queried.
-         * @return <code>true</code> if the format is supported, otherwise <code>false</code>
+         * @param  format the audio format for which support is queried
+         * @return {@code true} if the format is supported, otherwise
+         *         {@code false}
          * @see #getFormats
          * @see AudioFormat#matches
          */
@@ -400,32 +393,36 @@ public interface DataLine extends Line {
 
         /**
          * Obtains the minimum buffer size supported by the data line.
-         * @return minimum buffer size in bytes, or <code>AudioSystem.NOT_SPECIFIED</code>
+         *
+         * @return minimum buffer size in bytes, or
+         *         {@code AudioSystem.NOT_SPECIFIED}
          */
         public int getMinBufferSize() {
             return minBufferSize;
         }
 
-
         /**
          * Obtains the maximum buffer size supported by the data line.
-         * @return maximum buffer size in bytes, or <code>AudioSystem.NOT_SPECIFIED</code>
+         *
+         * @return maximum buffer size in bytes, or
+         *         {@code AudioSystem.NOT_SPECIFIED}
          */
         public int getMaxBufferSize() {
             return maxBufferSize;
         }
 
-
         /**
-         * Determines whether the specified info object matches this one.
-         * To match, the superclass match requirements must be met.  In
-         * addition, this object's minimum buffer size must be at least as
-         * large as that of the object specified, its maximum buffer size must
-         * be at most as large as that of the object specified, and all of its
-         * formats must match formats supported by the object specified.
-         * @return <code>true</code> if this object matches the one specified,
-         * otherwise <code>false</code>.
+         * Determines whether the specified info object matches this one. To
+         * match, the superclass match requirements must be met. In addition,
+         * this object's minimum buffer size must be at least as large as that
+         * of the object specified, its maximum buffer size must be at most as
+         * large as that of the object specified, and all of its formats must
+         * match formats supported by the object specified.
+         *
+         * @return {@code true} if this object matches the one specified,
+         *         otherwise {@code false}
          */
+        @Override
         public boolean matches(Line.Info info) {
 
             if (! (super.matches(info)) ) {
@@ -467,8 +464,10 @@ public interface DataLine extends Line {
 
         /**
          * Obtains a textual description of the data line info.
+         *
          * @return a string description
          */
+        @Override
         public String toString() {
 
             StringBuffer buf = new StringBuffer();
@@ -489,6 +488,5 @@ public interface DataLine extends Line {
 
             return new String(super.toString() + buf);
         }
-    } // class Info
-
-} // interface DataLine
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/EnumControl.java b/jdk/src/share/classes/javax/sound/sampled/EnumControl.java
index d9f4baccbda..c029f224ebc 100644
--- a/jdk/src/share/classes/javax/sound/sampled/EnumControl.java
+++ b/jdk/src/share/classes/javax/sound/sampled/EnumControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,83 +26,63 @@
 package javax.sound.sampled;
 
 /**
- * A <code>EnumControl</code> provides control over a set of
- * discrete possible values, each represented by an object.  In a
- * graphical user interface, such a control might be represented
- * by a set of buttons, each of which chooses one value or setting.  For
- * example, a reverb control might provide several preset reverberation
- * settings, instead of providing continuously adjustable parameters
- * of the sort that would be represented by <code>{@link FloatControl}</code>
+ * A {@code EnumControl} provides control over a set of discrete possible values
+ * , each represented by an object. In a graphical user interface, such a
+ * control might be represented by a set of buttons, each of which chooses one
+ * value or setting. For example, a reverb control might provide several preset
+ * reverberation settings, instead of providing continuously adjustable
+ * parameters of the sort that would be represented by {@link FloatControl}
  * objects.
  * <p>
- * Controls that provide a choice between only two settings can often be implemented
- * instead as a <code>{@link BooleanControl}</code>, and controls that provide
- * a set of values along some quantifiable dimension might be implemented
- * instead as a <code>FloatControl</code> with a coarse resolution.
- * However, a key feature of <code>EnumControl</code> is that the returned values
- * are arbitrary objects, rather than numerical or boolean values.  This means that each
- * returned object can provide further information.  As an example, the settings
- * of a <code>{@link EnumControl.Type#REVERB REVERB}</code> control are instances of
- * <code>{@link ReverbType}</code> that can be queried for the parameter values
- * used for each setting.
+ * Controls that provide a choice between only two settings can often be
+ * implemented instead as a {@link BooleanControl}, and controls that provide a
+ * set of values along some quantifiable dimension might be implemented instead
+ * as a {@code FloatControl} with a coarse resolution. However, a key feature of
+ * {@code EnumControl} is that the returned values are arbitrary objects, rather
+ * than numerical or boolean values. This means that each returned object can
+ * provide further information. As an example, the settings of a
+ * {@link EnumControl.Type#REVERB REVERB} control are instances of
+ * {@link ReverbType} that can be queried for the parameter values used for each
+ * setting.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public abstract class EnumControl extends Control {
 
-
-    // TYPE DEFINES
-
-
-    // INSTANCE VARIABLES
-
-
     /**
      * The set of possible values.
      */
     private Object[] values;
 
-
     /**
      * The current value.
      */
     private Object value;
 
-
-
-    // CONSTRUCTORS
-
-
     /**
      * Constructs a new enumerated control object with the given parameters.
      *
-     * @param type the type of control represented this enumerated control object
-     * @param values the set of possible values for the control
-     * @param value the initial control value
+     * @param  type the type of control represented this enumerated control
+     *         object
+     * @param  values the set of possible values for the control
+     * @param  value the initial control value
      */
     protected EnumControl(Type type, Object[] values, Object value) {
-
         super(type);
-
         this.values = values;
         this.value = value;
     }
 
-
-
-    // METHODS
-
-
     /**
-     * Sets the current value for the control.  The default implementation
-     * simply sets the value as indicated.  If the value indicated is not
-     * supported, an IllegalArgumentException is thrown.
-     * Some controls require that their line be open before they can be affected
-     * by setting a value.
-     * @param value the desired new value
+     * Sets the current value for the control. The default implementation simply
+     * sets the value as indicated. If the value indicated is not supported, an
+     * {@code IllegalArgumentException} is thrown. Some controls require that
+     * their line be open before they can be affected by setting a value.
+     *
+     * @param  value the desired new value
      * @throws IllegalArgumentException if the value indicated does not fall
-     * within the allowable range
+     *         within the allowable range
      */
     public void setValue(Object value) {
         if (!isValueSupported(value)) {
@@ -112,18 +92,18 @@ public abstract class EnumControl extends Control {
         this.value = value;
     }
 
-
     /**
      * Obtains this control's current value.
+     *
      * @return the current value
      */
     public Object getValue() {
         return value;
     }
 
-
     /**
      * Returns the set of possible values for this control.
+     *
      * @return the set of possible values
      */
     public Object[] getValues() {
@@ -137,12 +117,11 @@ public abstract class EnumControl extends Control {
         return localArray;
     }
 
-
     /**
      * Indicates whether the value specified is supported.
-     * @param value the value for which support is queried
-     * @return <code>true</code> if the value is supported,
-     * otherwise <code>false</code>
+     *
+     * @param  value the value for which support is queried
+     * @return {@code true} if the value is supported, otherwise {@code false}
      */
     private boolean isValueSupported(Object value) {
 
@@ -157,58 +136,43 @@ public abstract class EnumControl extends Control {
         return false;
     }
 
-
-
-    // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
     /**
      * Provides a string representation of the control.
+     *
      * @return a string description
      */
+    @Override
     public String toString() {
         return new String(getType() + " with current value: " + getValue());
     }
 
-
-    // INNER CLASSES
-
-
     /**
-     * An instance of the <code>EnumControl.Type</code> inner class identifies one kind of
-     * enumerated control.  Static instances are provided for the
-     * common types.
-     *
-     * @see EnumControl
+     * An instance of the {@code EnumControl.Type} inner class identifies one
+     * kind of enumerated control. Static instances are provided for the common
+     * types.
      *
      * @author Kara Kytle
+     * @see EnumControl
      * @since 1.3
      */
     public static class Type extends Control.Type {
 
-
-        // TYPE DEFINES
-
         /**
          * Represents a control over a set of possible reverberation settings.
          * Each reverberation setting is described by an instance of the
-         * {@link ReverbType} class.  (To access these settings,
-         * invoke <code>{@link EnumControl#getValues}</code> on an
-         * enumerated control of type <code>REVERB</code>.)
+         * {@link ReverbType} class. (To access these settings, invoke
+         * {@link EnumControl#getValues} on an enumerated control of type
+         * {@code REVERB}.)
          */
         public static final Type REVERB         = new Type("Reverb");
 
-
-        // CONSTRUCTOR
-
-
         /**
          * Constructs a new enumerated control type.
-         * @param name  the name of the new enumerated control type
+         *
+         * @param  name the name of the new enumerated control type
          */
-        protected Type(String name) {
+        protected Type(final String name) {
             super(name);
         }
-    } // class Type
-
-} // class EnumControl
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/FloatControl.java b/jdk/src/share/classes/javax/sound/sampled/FloatControl.java
index b2678d11428..27d59fefe1f 100644
--- a/jdk/src/share/classes/javax/sound/sampled/FloatControl.java
+++ b/jdk/src/share/classes/javax/sound/sampled/FloatControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,39 +26,31 @@
 package javax.sound.sampled;
 
 /**
- * A <code>FloatControl</code> object provides control over a range of
- * floating-point values.  Float controls are often
- * represented in graphical user interfaces by continuously
- * adjustable objects such as sliders or rotary knobs.  Concrete subclasses
- * of <code>FloatControl</code> implement controls, such as gain and pan, that
- * affect a line's audio signal in some way that an application can manipulate.
- * The <code>{@link FloatControl.Type}</code>
- * inner class provides static instances of types that are used to
- * identify some common kinds of float control.
+ * A {@code FloatControl} object provides control over a range of floating-point
+ * values. Float controls are often represented in graphical user interfaces by
+ * continuously adjustable objects such as sliders or rotary knobs. Concrete
+ * subclasses of {@code FloatControl} implement controls, such as gain and pan,
+ * that affect a line's audio signal in some way that an application can
+ * manipulate. The {@link FloatControl.Type} inner class provides static
+ * instances of types that are used to identify some common kinds of float
+ * control.
  * <p>
- * The <code>FloatControl</code> abstract class provides methods to set and get
- * the control's current floating-point value.  Other methods obtain the possible
+ * The {@code FloatControl} abstract class provides methods to set and get the
+ * control's current floating-point value. Other methods obtain the possible
  * range of values and the control's resolution (the smallest increment between
- * returned values).  Some float controls allow ramping to a
- * new value over a specified period of time.  <code>FloatControl</code> also
- * includes methods that return string labels for the minimum, maximum, and midpoint
- * positions of the control.
- *
- * @see Line#getControls
- * @see Line#isControlSupported
+ * returned values). Some float controls allow ramping to a new value over a
+ * specified period of time. {@code FloatControl} also includes methods that
+ * return string labels for the minimum, maximum, and midpoint positions of the
+ * control.
  *
  * @author David Rivas
  * @author Kara Kytle
+ * @see Line#getControls
+ * @see Line#isControlSupported
  * @since 1.3
  */
 public abstract class FloatControl extends Control {
 
-
-    // INSTANCE VARIABLES
-
-
-    // FINAL VARIABLES
-
     /**
      * The minimum supported value.
      */
@@ -75,66 +67,60 @@ public abstract class FloatControl extends Control {
     private float precision;
 
     /**
-     * The smallest time increment in which a value change
-     * can be effected during a value shift, in microseconds.
+     * The smallest time increment in which a value change can be effected
+     * during a value shift, in microseconds.
      */
     private int updatePeriod;
 
-
     /**
-     * A label for the units in which the control values are expressed,
-     * such as "dB" for decibels.
+     * A label for the units in which the control values are expressed, such as
+     * "dB" for decibels.
      */
     private final String units;
 
     /**
-     * A label for the minimum value, such as "Left."
+     * A label for the minimum value, such as "Left".
      */
     private final String minLabel;
 
     /**
-     * A label for the maximum value, such as "Right."
+     * A label for the maximum value, such as "Right".
      */
     private final String maxLabel;
 
     /**
-     * A label for the mid-point value, such as "Center."
+     * A label for the mid-point value, such as "Center".
      */
     private final String midLabel;
 
-
-    // STATE VARIABLES
-
     /**
      * The current value.
      */
     private float value;
 
-
-
-    // CONSTRUCTORS
-
-
     /**
-     * Constructs a new float control object with the given parameters
-     *
-     * @param type the kind of control represented by this float control object
-     * @param minimum the smallest value permitted for the control
-     * @param maximum the largest value permitted for the control
-     * @param precision the resolution or granularity of the control.
-     * This is the size of the increment between discrete valid values.
-     * @param updatePeriod the smallest time interval, in microseconds, over which the control
-     * can change from one discrete value to the next during a {@link #shift(float,float,int) shift}
-     * @param initialValue the value that the control starts with when constructed
-     * @param units the label for the units in which the control's values are expressed,
-     * such as "dB" or "frames per second"
-     * @param minLabel the label for the minimum value, such as "Left" or "Off"
-     * @param midLabel the label for the midpoint value, such as "Center" or "Default"
-     * @param maxLabel the label for the maximum value, such as "Right" or "Full"
+     * Constructs a new float control object with the given parameters.
      *
-     * @throws IllegalArgumentException if {@code minimum} is greater
-     *     than {@code maximum} or {@code initialValue} does not fall
-     *     within the allowable range
+     * @param  type the kind of control represented by this float control object
+     * @param  minimum the smallest value permitted for the control
+     * @param  maximum the largest value permitted for the control
+     * @param  precision the resolution or granularity of the control. This is
+     *         the size of the increment between discrete valid values.
+     * @param  updatePeriod the smallest time interval, in microseconds, over
+     *         which the control can change from one discrete value to the next
+     *         during a {@link #shift(float,float,int) shift}
+     * @param  initialValue the value that the control starts with when
+     *         constructed
+     * @param  units the label for the units in which the control's values are
+     *         expressed, such as "dB" or "frames per second"
+     * @param  minLabel the label for the minimum value, such as "Left" or "Off"
+     * @param  midLabel the label for the midpoint value, such as "Center" or
+     *         "Default"
+     * @param  maxLabel the label for the maximum value, such as "Right" or
+     *         "Full"
+     * @throws IllegalArgumentException if {@code minimum} is greater than
+     *         {@code maximum} or {@code initialValue} does not fall within the
+     *         allowable range
      */
     protected FloatControl(Type type, float minimum, float maximum,
             float precision, int updatePeriod, float initialValue,
@@ -169,26 +155,26 @@ public abstract class FloatControl extends Control {
         this.maxLabel = ( (maxLabel == null) ? "" : maxLabel);
     }
 
-
     /**
-     * Constructs a new float control object with the given parameters.
-     * The labels for the minimum, maximum, and mid-point values are set
-     * to zero-length strings.
-     *
-     * @param type the kind of control represented by this float control object
-     * @param minimum the smallest value permitted for the control
-     * @param maximum the largest value permitted for the control
-     * @param precision the resolution or granularity of the control.
-     * This is the size of the increment between discrete valid values.
-     * @param updatePeriod the smallest time interval, in microseconds, over which the control
-     * can change from one discrete value to the next during a {@link #shift(float,float,int) shift}
-     * @param initialValue the value that the control starts with when constructed
-     * @param units the label for the units in which the control's values are expressed,
-     * such as "dB" or "frames per second"
+     * Constructs a new float control object with the given parameters. The
+     * labels for the minimum, maximum, and mid-point values are set to
+     * zero-length strings.
      *
-     * @throws IllegalArgumentException if {@code minimum} is greater
-     *     than {@code maximum} or {@code initialValue} does not fall
-     *     within the allowable range
+     * @param  type the kind of control represented by this float control object
+     * @param  minimum the smallest value permitted for the control
+     * @param  maximum the largest value permitted for the control
+     * @param  precision the resolution or granularity of the control. This is
+     *         the size of the increment between discrete valid values.
+     * @param  updatePeriod the smallest time interval, in microseconds, over
+     *         which the control can change from one discrete value to the next
+     *         during a {@link #shift(float,float,int) shift}
+     * @param  initialValue the value that the control starts with when
+     *         constructed
+     * @param  units the label for the units in which the control's values are
+     *         expressed, such as "dB" or "frames per second"
+     * @throws IllegalArgumentException if {@code minimum} is greater than
+     *         {@code maximum} or {@code initialValue} does not fall within the
+     *         allowable range
      */
     protected FloatControl(Type type, float minimum, float maximum,
             float precision, int updatePeriod, float initialValue, String units) {
@@ -196,21 +182,16 @@ public abstract class FloatControl extends Control {
                 initialValue, units, "", "", "");
     }
 
-
-
-    // METHODS
-
-
     /**
-     * Sets the current value for the control.  The default implementation
-     * simply sets the value as indicated.  If the value indicated is greater
-     * than the maximum value, or smaller than the minimum value, an
-     * IllegalArgumentException is thrown.
-     * Some controls require that their line be open before they can be affected
-     * by setting a value.
-     * @param newValue desired new value
+     * Sets the current value for the control. The default implementation simply
+     * sets the value as indicated. If the value indicated is greater than the
+     * maximum value, or smaller than the minimum value, an
+     * {@code IllegalArgumentException} is thrown. Some controls require that
+     * their line be open before they can be affected by setting a value.
+     *
+     * @param  newValue desired new value
      * @throws IllegalArgumentException if the value indicated does not fall
-     * within the allowable range
+     *         within the allowable range
      */
     public void setValue(float newValue) {
 
@@ -225,113 +206,114 @@ public abstract class FloatControl extends Control {
         value = newValue;
     }
 
-
     /**
      * Obtains this control's current value.
+     *
      * @return the current value
      */
     public float getValue() {
         return value;
     }
 
-
     /**
      * Obtains the maximum value permitted.
+     *
      * @return the maximum allowable value
      */
     public float getMaximum() {
         return maximum;
     }
 
-
     /**
      * Obtains the minimum value permitted.
+     *
      * @return the minimum allowable value
      */
     public float getMinimum() {
         return minimum;
     }
 
-
     /**
-     * Obtains the label for the units in which the control's values are expressed,
-     * such as "dB" or "frames per second."
+     * Obtains the label for the units in which the control's values are
+     * expressed, such as "dB" or "frames per second."
+     *
      * @return the units label, or a zero-length string if no label
      */
     public String getUnits() {
         return units;
     }
 
-
     /**
-     * Obtains the label for the minimum value, such as "Left" or "Off."
-     * @return the minimum value label, or a zero-length string if no label      * has been set
+     * Obtains the label for the minimum value, such as "Left" or "Off".
+     *
+     * @return the minimum value label, or a zero-length string if no label has
+     *         been set
      */
     public String getMinLabel() {
         return minLabel;
     }
 
-
     /**
-     * Obtains the label for the mid-point value, such as "Center" or "Default."
-     * @return the mid-point value label, or a zero-length string if no label    * has been set
+     * Obtains the label for the mid-point value, such as "Center" or "Default".
+     *
+     * @return the mid-point value label, or a zero-length string if no label
+     *         has been set
      */
     public String getMidLabel() {
         return midLabel;
     }
 
-
     /**
-     * Obtains the label for the maximum value, such as "Right" or "Full."
-     * @return the maximum value label, or a zero-length string if no label      * has been set
+     * Obtains the label for the maximum value, such as "Right" or "Full".
+     *
+     * @return the maximum value label, or a zero-length string if no label has
+     *         been set
      */
     public String getMaxLabel() {
         return maxLabel;
     }
 
-
     /**
-     * Obtains the resolution or granularity of the control, in the units
-     * that the control measures.
-     * The precision is the size of the increment between discrete valid values
-     * for this control, over the set of supported floating-point values.
+     * Obtains the resolution or granularity of the control, in the units that
+     * the control measures. The precision is the size of the increment between
+     * discrete valid values for this control, over the set of supported
+     * floating-point values.
+     *
      * @return the control's precision
      */
     public float getPrecision() {
         return precision;
     }
 
-
     /**
-     * Obtains the smallest time interval, in microseconds, over which the control's value can
-     * change during a shift.  The update period is the inverse of the frequency with which
-     * the control updates its value during a shift.  If the implementation does not support value shifting over
-     * time, it should set the control's value to the final value immediately
-     * and return -1 from this method.
+     * Obtains the smallest time interval, in microseconds, over which the
+     * control's value can change during a shift. The update period is the
+     * inverse of the frequency with which the control updates its value during
+     * a shift. If the implementation does not support value shifting over time,
+     * it should set the control's value to the final value immediately and
+     * return -1 from this method.
      *
-     * @return update period in microseconds, or -1 if shifting over time is unsupported
+     * @return update period in microseconds, or -1 if shifting over time is
+     *         unsupported
      * @see #shift
      */
     public int getUpdatePeriod() {
         return updatePeriod;
     }
 
-
     /**
-     * Changes the control value from the initial value to the final
-     * value linearly over the specified time period, specified in microseconds.
-     * This method returns without blocking; it does not wait for the shift
-     * to complete.  An implementation should complete the operation within the time
-     * specified.  The default implementation simply changes the value
-     * to the final value immediately.
-     *
-     * @param from initial value at the beginning of the shift
-     * @param to final value after the shift
-     * @param microseconds maximum duration of the shift in microseconds
+     * Changes the control value from the initial value to the final value
+     * linearly over the specified time period, specified in microseconds. This
+     * method returns without blocking; it does not wait for the shift to
+     * complete. An implementation should complete the operation within the time
+     * specified. The default implementation simply changes the value to the
+     * final value immediately.
      *
+     * @param  from initial value at the beginning of the shift
+     * @param  to final value after the shift
+     * @param  microseconds maximum duration of the shift in microseconds
      * @throws IllegalArgumentException if either {@code from} or {@code to}
-     *     value does not fall within the allowable range
-     *
+     *         value does not fall within the allowable range
      * @see #getUpdatePeriod
      */
     public void shift(float from, float to, int microseconds) {
@@ -347,12 +329,9 @@ public abstract class FloatControl extends Control {
         setValue(to);
     }
 
-
-    // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
     /**
-     * Provides a string representation of the control
+     * Provides a string representation of the control.
+     *
      * @return a string description
      */
     public String toString() {
@@ -360,55 +339,45 @@ public abstract class FloatControl extends Control {
                           " (range: " + minimum + " - " + maximum + ")");
     }
 
-
-    // INNER CLASSES
-
-
     /**
-     * An instance of the <code>FloatControl.Type</code> inner class identifies one kind of
-     * float control.  Static instances are provided for the
-     * common types.
+     * An instance of the {@code FloatControl.Type} inner class identifies one
+     * kind of float control. Static instances are provided for the common
+     * types.
      *
      * @author Kara Kytle
      * @since 1.3
      */
     public static class Type extends Control.Type {
 
-
-        // TYPE DEFINES
-
-
-        // GAIN TYPES
-
         /**
          * Represents a control for the overall gain on a line.
          * <p>
          * Gain is a quantity in decibels (dB) that is added to the intrinsic
-         * decibel level of the audio signal--that is, the level of
-         * the signal before it is altered by the gain control.  A positive
-         * gain amplifies (boosts) the signal's volume, and a negative gain
-         * attenuates (cuts) it.
+         * decibel level of the audio signal--that is, the level of the signal
+         * before it is altered by the gain control. A positive gain amplifies
+         * (boosts) the signal's volume, and a negative gain attenuates(cuts)it.
          * The gain setting defaults to a value of 0.0 dB, meaning the signal's
-         * loudness is unaffected.   Note that gain measures dB, not amplitude.
+         * loudness is unaffected. Note that gain measures dB, not amplitude.
          * The relationship between a gain in decibels and the corresponding
          * linear amplitude multiplier is:
          *
-         *<CENTER><CODE> linearScalar = pow(10.0, gainDB/20.0) </CODE></CENTER>
+         * <CENTER>{@code linearScalar = pow(10.0, gainDB/20.0)}</CENTER>
          * <p>
-         * The <code>FloatControl</code> class has methods to impose a maximum and
-         * minimum allowable value for gain.  However, because an audio signal might
-         * already be at a high amplitude, the maximum setting does not guarantee
-         * that the signal will be undistorted when the gain is applied to it (unless
-         * the maximum is zero or negative). To avoid numeric overflow from excessively
-         * large gain settings, a gain control can implement
-         * clipping, meaning that the signal's amplitude will be limited to the maximum
-         * value representable by its audio format, instead of wrapping around.
+         * The {@code FloatControl} class has methods to impose a maximum and
+         * minimum allowable value for gain. However, because an audio signal
+         * might already be at a high amplitude, the maximum setting does not
+         * guarantee that the signal will be undistorted when the gain is
+         * applied to it (unless the maximum is zero or negative). To avoid
+         * numeric overflow from excessively large gain settings, a gain control
+         * can implement clipping, meaning that the signal's amplitude will be
+         * limited to the maximum value representable by its audio format,
+         * instead of wrapping around.
          * <p>
-         * These comments apply to gain controls in general, not just master gain controls.
-         * A line can have more than one gain control.  For example, a mixer (which is
-         * itself a line) might have a master gain control, an auxiliary return control,
-         * a reverb return control, and, on each of its source lines, an individual aux
-         * send and reverb send.
+         * These comments apply to gain controls in general, not just master
+         * gain controls. A line can have more than one gain control. For
+         * example, a mixer (which is itself a line) might have a master gain
+         * control, an auxiliary return control, a reverb return control, and,
+         * on each of its source lines, an individual aux send and reverb send.
          *
          * @see #AUX_SEND
          * @see #AUX_RETURN
@@ -435,9 +404,9 @@ public abstract class FloatControl extends Control {
         public static final Type AUX_RETURN                     = new Type("AUX Return");
 
         /**
-         * Represents a control for the pre-reverb gain on a line.
-         * This control may be used to affect how much
-         * of a line's signal is directed to a mixer's internal reverberation unit.
+         * Represents a control for the pre-reverb gain on a line. This control
+         * may be used to affect how much of a line's signal is directed to a
+         * mixer's internal reverberation unit.
          *
          * @see #MASTER_GAIN
          * @see #REVERB_RETURN
@@ -446,18 +415,15 @@ public abstract class FloatControl extends Control {
         public static final Type REVERB_SEND            = new Type("Reverb Send");
 
         /**
-         * Represents a control for the post-reverb gain on a line.
-         * This control may be used to control the relative amplitude
-         * of the signal returned from an internal reverberation unit.
+         * Represents a control for the post-reverb gain on a line. This control
+         * may be used to control the relative amplitude of the signal returned
+         * from an internal reverberation unit.
          *
          * @see #MASTER_GAIN
          * @see #REVERB_SEND
          */
         public static final Type REVERB_RETURN          = new Type("Reverb Return");
 
-
-        // VOLUME
-
         /**
          * Represents a control for the volume on a line.
          */
@@ -466,64 +432,52 @@ public abstract class FloatControl extends Control {
          */
         public static final Type VOLUME                         = new Type("Volume");
 
-
-        // PAN
-
         /**
-         * Represents a control for the relative pan (left-right positioning)
-         * of the signal.  The signal may be mono; the pan setting affects how
-         * it is distributed by the mixer in a stereo mix.  The valid range of values is -1.0
-         * (left channel only) to 1.0 (right channel
-         * only).  The default is 0.0 (centered).
+         * Represents a control for the relative pan (left-right positioning) of
+         * the signal. The signal may be mono; the pan setting affects how it is
+         * distributed by the mixer in a stereo mix. The valid range of values
+         * is -1.0 (left channel only) to 1.0 (right channel only). The default
+         * is 0.0 (centered).
          *
          * @see #BALANCE
          */
         public static final Type PAN                            = new Type("Pan");
 
-
-        // BALANCE
-
         /**
          * Represents a control for the relative balance of a stereo signal
-         * between two stereo speakers.  The valid range of values is -1.0 (left channel only) to 1.0 (right channel
-         * only).  The default is 0.0 (centered).
+         * between two stereo speakers. The valid range of values is -1.0 (left
+         * channel only) to 1.0 (right channel only). The default is 0.0
+         * (centered).
          *
          * @see #PAN
          */
         public static final Type BALANCE                        = new Type("Balance");
 
-
-        // SAMPLE RATE
-
         /**
-         * Represents a control that changes the sample rate of audio playback.  The net effect
-         * of changing the sample rate depends on the relationship between
-         * the media's natural rate and the rate that is set via this control.
-         * The natural rate is the sample rate that is specified in the data line's
-         * <code>AudioFormat</code> object.  For example, if the natural rate
-         * of the media is 11025 samples per second and the sample rate is set
-         * to 22050 samples per second, the media will play back at twice the
-         * normal speed.
+         * Represents a control that changes the sample rate of audio playback.
+         * The net effect of changing the sample rate depends on the
+         * relationship between the media's natural rate and the rate that is
+         * set via this control. The natural rate is the sample rate that is
+         * specified in the data line's {@code AudioFormat} object. For example,
+         * if the natural rate of the media is 11025 samples per second and the
+         * sample rate is set to 22050 samples per second, the media will play
+         * back at twice the normal speed.
          * <p>
-         * Changing the sample rate with this control does not affect the data line's
-         * audio format.  Also note that whenever you change a sound's sample rate, a
-         * change in the sound's pitch results.  For example, doubling the sample
-         * rate has the effect of doubling the frequencies in the sound's spectrum,
-         * which raises the pitch by an octave.
+         * Changing the sample rate with this control does not affect the data
+         * line's audio format. Also note that whenever you change a sound's
+         * sample rate, a change in the sound's pitch results. For example,
+         * doubling the sample rate has the effect of doubling the frequencies
+         * in the sound's spectrum, which raises the pitch by an octave.
          */
         public static final Type SAMPLE_RATE            = new Type("Sample Rate");
 
-
-        // CONSTRUCTOR
-
         /**
          * Constructs a new float control type.
-         * @param name  the name of the new float control type
+         *
+         * @param name the name of the new float control type
          */
-        protected Type(String name) {
+        protected Type(final String name) {
             super(name);
         }
-
-    } // class Type
-
-} // class FloatControl
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/Line.java b/jdk/src/share/classes/javax/sound/sampled/Line.java
index dfab63470cc..0b9d96c0b89 100644
--- a/jdk/src/share/classes/javax/sound/sampled/Line.java
+++ b/jdk/src/share/classes/javax/sound/sampled/Line.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,96 +26,90 @@
 package javax.sound.sampled;
 
 /**
- * The <code>Line</code> interface represents a mono or multi-channel
- * audio feed. A line is an element of the digital audio
- * "pipeline," such as a mixer, an input or output port,
- * or a data path into or out of a mixer.
+ * The {@code Line} interface represents a mono or multi-channel audio feed. A
+ * line is an element of the digital audio "pipeline," such as a mixer, an input
+ * or output port, or a data path into or out of a mixer.
  * <p>
- * A line can have controls, such as gain, pan, and reverb.
- * The controls themselves are instances of classes that extend the
- * base <code>{@link Control}</code> class.
- * The <code>Line</code> interface provides two accessor methods for
- * obtaining the line's controls: <code>{@link #getControls getControls}</code> returns the
- * entire set, and <code>{@link #getControl getControl}</code> returns a single control of
- * specified type.
+ * A line can have controls, such as gain, pan, and reverb. The controls
+ * themselves are instances of classes that extend the base {@link Control}
+ * class. The {@code Line} interface provides two accessor methods for obtaining
+ * the line's controls: {@link #getControls getControls} returns the entire set,
+ * and {@link #getControl getControl} returns a single control of specified
+ * type.
  * <p>
- * Lines exist in various states at different times.  When a line opens, it reserves system
- * resources for itself, and when it closes, these resources are freed for
- * other objects or applications. The <code>{@link #isOpen()}</code> method lets
- * you discover whether a line is open or closed.
- * An open line need not be processing data, however.  Such processing is
- * typically initiated by subinterface methods such as
- * <code>{@link SourceDataLine#write SourceDataLine.write}</code> and
- * <code>{@link TargetDataLine#read TargetDataLine.read}</code>.
- *<p>
- * You can register an object to receive notifications whenever the line's
- * state changes.  The object must implement the <code>{@link LineListener}</code>
- * interface, which consists of the single method
- * <code>{@link LineListener#update update}</code>.
- * This method will be invoked when a line opens and closes (and, if it's a
- * {@link DataLine}, when it starts and stops).
- *<p>
- * An object can be registered to listen to multiple lines.  The event it
- * receives in its <code>update</code> method will specify which line created
- * the event, what type of event it was
- * (<code>OPEN</code>, <code>CLOSE</code>, <code>START</code>, or <code>STOP</code>),
- * and how many sample frames the line had processed at the time the event occurred.
+ * Lines exist in various states at different times. When a line opens, it
+ * reserves system resources for itself, and when it closes, these resources are
+ * freed for other objects or applications. The {@link #isOpen()} method lets
+ * you discover whether a line is open or closed. An open line need not be
+ * processing data, however. Such processing is typically initiated by
+ * subinterface methods such as
+ * {@link SourceDataLine#write SourceDataLine.write} and
+ * {@link TargetDataLine#read TargetDataLine.read}.
+ * <p>
+ * You can register an object to receive notifications whenever the line's state
+ * changes. The object must implement the {@link LineListener} interface, which
+ * consists of the single method {@link LineListener#update update}. This method
+ * will be invoked when a line opens and closes (and, if it's a {@link DataLine}
+ * , when it starts and stops).
+ * <p>
+ * An object can be registered to listen to multiple lines. The event it
+ * receives in its {@code update} method will specify which line created the
+ * event, what type of event it was ({@code OPEN}, {@code CLOSE}, {@code START},
+ * or {@code STOP}), and how many sample frames the line had processed at the
+ * time the event occurred.
  * <p>
  * Certain line operations, such as open and close, can generate security
  * exceptions if invoked by unprivileged code when the line is a shared audio
  * resource.
  *
  * @author Kara Kytle
- *
  * @see LineEvent
  * @since 1.3
  */
 public interface Line extends AutoCloseable {
 
     /**
-     * Obtains the <code>Line.Info</code> object describing this
-     * line.
+     * Obtains the {@code Line.Info} object describing this line.
+     *
      * @return description of the line
      */
-    public Line.Info getLineInfo();
+    Line.Info getLineInfo();
 
     /**
-     * Opens the line, indicating that it should acquire any required
-     * system resources and become operational.
-     * If this operation
-     * succeeds, the line is marked as open, and an <code>OPEN</code> event is dispatched
-     * to the line's listeners.
+     * Opens the line, indicating that it should acquire any required system
+     * resources and become operational. If this operation succeeds, the line is
+     * marked as open, and an {@code OPEN} event is dispatched to the line's
+     * listeners.
      * <p>
-     * Note that some lines, once closed, cannot be reopened.  Attempts
-     * to reopen such a line will always result in an <code>LineUnavailableException</code>.
+     * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+     * such a line will always result in an {@code LineUnavailableException}.
      * <p>
-     * Some types of lines have configurable properties that may affect
-     * resource allocation.   For example, a <code>DataLine</code> must
-     * be opened with a particular format and buffer size.  Such lines
-     * should provide a mechanism for configuring these properties, such
-     * as an additional <code>open</code> method or methods which allow
-     * an application to specify the desired settings.
+     * Some types of lines have configurable properties that may affect resource
+     * allocation. For example, a {@code DataLine} must be opened with a
+     * particular format and buffer size. Such lines should provide a mechanism
+     * for configuring these properties, such as an additional {@code open}
+     * method or methods which allow an application to specify the desired
+     * settings.
      * <p>
      * This method takes no arguments, and opens the line with the current
-     * settings.  For <code>{@link SourceDataLine}</code> and
-     * <code>{@link TargetDataLine}</code> objects, this means that the line is
-     * opened with default settings.  For a <code>{@link Clip}</code>, however,
-     * the buffer size is determined when data is loaded.  Since this method does not
-     * allow the application to specify any data to load, an IllegalArgumentException
-     * is thrown. Therefore, you should instead use one of the <code>open</code> methods
-     * provided in the <code>Clip</code> interface to load data into the <code>Clip</code>.
+     * settings. For {@link SourceDataLine} and {@link TargetDataLine} objects,
+     * this means that the line is opened with default settings. For a
+     * {@link Clip}, however, the buffer size is determined when data is loaded.
+     * Since this method does not allow the application to specify any data to
+     * load, an {@code IllegalArgumentException} is thrown. Therefore, you
+     * should instead use one of the {@code open} methods provided in the
+     * {@code Clip} interface to load data into the {@code Clip}.
      * <p>
-     * For <code>DataLine</code>'s, if the <code>DataLine.Info</code>
-     * object which was used to retrieve the line, specifies at least
-     * one fully qualified audio format, the last one will be used
-     * as the default format.
-     *
-     * @throws IllegalArgumentException if this method is called on a Clip instance.
-     * @throws LineUnavailableException if the line cannot be
-     * opened due to resource restrictions.
-     * @throws SecurityException if the line cannot be
-     * opened due to security restrictions.
+     * For {@code DataLine}'s, if the {@code DataLine.Info} object which was
+     * used to retrieve the line, specifies at least one fully qualified audio
+     * format, the last one will be used as the default format.
      *
+     * @throws IllegalArgumentException if this method is called on a Clip
+     *         instance
+     * @throws LineUnavailableException if the line cannot be opened due to
+     *         resource restrictions
+     * @throws SecurityException if the line cannot be opened due to security
+     *         restrictions
      * @see #close
      * @see #isOpen
      * @see LineEvent
@@ -123,133 +117,128 @@ public interface Line extends AutoCloseable {
      * @see Clip#open(AudioFormat, byte[], int, int)
      * @see Clip#open(AudioInputStream)
      */
-    public void open() throws LineUnavailableException;
-
+    void open() throws LineUnavailableException;
 
     /**
-     * Closes the line, indicating that any system resources
-     * in use by the line can be released.  If this operation
-     * succeeds, the line is marked closed and a <code>CLOSE</code> event is dispatched
-     * to the line's listeners.
-     * @throws SecurityException if the line cannot be
-     * closed due to security restrictions.
+     * Closes the line, indicating that any system resources in use by the line
+     * can be released. If this operation succeeds, the line is marked closed
+     * and a {@code CLOSE} event is dispatched to the line's listeners.
      *
+     * @throws SecurityException if the line cannot be closed due to security
+     *         restrictions
      * @see #open
      * @see #isOpen
      * @see LineEvent
      */
-    public void close();
-
-
+    @Override
+    void close();
 
     /**
-     * Indicates whether the line is open, meaning that it has reserved
-     * system resources and is operational, although it might not currently be
-     * playing or capturing sound.
-     * @return <code>true</code> if the line is open, otherwise <code>false</code>
+     * Indicates whether the line is open, meaning that it has reserved system
+     * resources and is operational, although it might not currently be playing
+     * or capturing sound.
      *
+     * @return {@code true} if the line is open, otherwise {@code false}
      * @see #open()
      * @see #close()
      */
-    public boolean isOpen();
-
+    boolean isOpen();
 
     /**
-     * Obtains the set of controls associated with this line.
-     * Some controls may only be available when the line is open.
-     * If there are no controls, this method returns an array of length 0.
+     * Obtains the set of controls associated with this line. Some controls may
+     * only be available when the line is open. If there are no controls, this
+     * method returns an array of length 0.
+     *
      * @return the array of controls
      * @see #getControl
      */
-    public Control[] getControls();
+    Control[] getControls();
 
     /**
-     * Indicates whether the line supports a control of the specified type.
-     * Some controls may only be available when the line is open.
-     * @param control the type of the control for which support is queried
-     * @return <code>true</code> if at least one control of the specified type is
-     * supported, otherwise <code>false</code>.
+     * Indicates whether the line supports a control of the specified type. Some
+     * controls may only be available when the line is open.
+     *
+     * @param  control the type of the control for which support is queried
+     * @return {@code true} if at least one control of the specified type is
+     *         supported, otherwise {@code false}
      */
-    public boolean isControlSupported(Control.Type control);
-
+    boolean isControlSupported(Control.Type control);
 
     /**
-     * Obtains a control of the specified type,
-     * if there is any.
-     * Some controls may only be available when the line is open.
-     * @param control the type of the requested control
+     * Obtains a control of the specified type, if there is any. Some controls
+     * may only be available when the line is open.
+     *
+     * @param  control the type of the requested control
      * @return a control of the specified type
-     * @throws IllegalArgumentException if a control of the specified type
-     * is not supported
+     * @throws IllegalArgumentException if a control of the specified type is
+     *         not supported
      * @see #getControls
      * @see #isControlSupported(Control.Type control)
      */
-    public Control getControl(Control.Type control);
-
+    Control getControl(Control.Type control);
 
     /**
-     * Adds a listener to this line.  Whenever the line's status changes, the
-     * listener's <code>update()</code> method is called with a <code>LineEvent</code> object
-     * that describes the change.
-     * @param listener the object to add as a listener to this line
+     * Adds a listener to this line. Whenever the line's status changes, the
+     * listener's {@code update()} method is called with a {@code LineEvent}
+     * object that describes the change.
+     *
+     * @param  listener the object to add as a listener to this line
      * @see #removeLineListener
      * @see LineListener#update
      * @see LineEvent
      */
-    public void addLineListener(LineListener listener);
-
+    void addLineListener(LineListener listener);
 
     /**
      * Removes the specified listener from this line's list of listeners.
-     * @param listener listener to remove
+     *
+     * @param  listener listener to remove
      * @see #addLineListener
      */
-    public void removeLineListener(LineListener listener);
-
+    void removeLineListener(LineListener listener);
 
     /**
-     * A <code>Line.Info</code> object contains information about a line.
-     * The only information provided by <code>Line.Info</code> itself
-     * is the Java class of the line.
-     * A subclass of <code>Line.Info</code> adds other kinds of information
-     * about the line.  This additional information depends on which <code>Line</code>
-     * subinterface is implemented by the kind of line that the <code>Line.Info</code>
-     * subclass describes.
+     * A {@code Line.Info} object contains information about a line. The only
+     * information provided by {@code Line.Info} itself is the Java class of the
+     * line. A subclass of {@code Line.Info} adds other kinds of information
+     * about the line. This additional information depends on which {@code Line}
+     * subinterface is implemented by the kind of line that the
+     * {@code Line.Info} subclass describes.
      * <p>
-     * A <code>Line.Info</code> can be retrieved using various methods of
-     * the <code>Line</code>, <code>Mixer</code>, and <code>AudioSystem</code>
-     * interfaces.  Other such methods let you pass a <code>Line.Info</code> as
-     * an argument, to learn whether lines matching the specified configuration
-     * are available and to obtain them.
+     * A {@code Line.Info} can be retrieved using various methods of the
+     * {@code Line}, {@code Mixer}, and {@code AudioSystem} interfaces. Other
+     * such methods let you pass a {@code Line.Info} as an argument, to learn
+     * whether lines matching the specified configuration are available and to
+     * obtain them.
      *
      * @author Kara Kytle
-     *
-     * @see Line#getLineInfo
-     * @see Mixer#getSourceLineInfo
-     * @see Mixer#getTargetLineInfo
-     * @see Mixer#getLine <code>Mixer.getLine(Line.Info)</code>
-     * @see Mixer#getSourceLineInfo(Line.Info) <code>Mixer.getSourceLineInfo(Line.Info)</code>
-     * @see Mixer#getSourceLineInfo(Line.Info) <code>Mixer.getTargetLineInfo(Line.Info)</code>
-     * @see Mixer#isLineSupported <code>Mixer.isLineSupported(Line.Info)</code>
-     * @see AudioSystem#getLine <code>AudioSystem.getLine(Line.Info)</code>
-     * @see AudioSystem#getSourceLineInfo <code>AudioSystem.getSourceLineInfo(Line.Info)</code>
-     * @see AudioSystem#getTargetLineInfo <code>AudioSystem.getTargetLineInfo(Line.Info)</code>
-     * @see AudioSystem#isLineSupported <code>AudioSystem.isLineSupported(Line.Info)</code>
+     * @see Line#getLineInfo()
+     * @see Mixer#getSourceLineInfo()
+     * @see Mixer#getTargetLineInfo()
+     * @see Mixer#getLine(Line.Info)
+     * @see Mixer#getSourceLineInfo(Line.Info)
+     * @see Mixer#getTargetLineInfo(Line.Info)
+     * @see Mixer#isLineSupported(Line.Info)
+     * @see AudioSystem#getLine(Line.Info)
+     * @see AudioSystem#getSourceLineInfo(Line.Info)
+     * @see AudioSystem#getTargetLineInfo(Line.Info)
+     * @see AudioSystem#isLineSupported(Line.Info)
      * @since 1.3
      */
-    public static class Info {
+    class Info {
 
         /**
          * The class of the line described by the info object.
          */
         private final Class lineClass;
 
-
         /**
-         * Constructs an info object that describes a line of the specified class.
-         * This constructor is typically used by an application to
+         * Constructs an info object that describes a line of the specified
+         * class. This constructor is typically used by an application to
          * describe a desired line.
-         * @param lineClass the class of the line that the new Line.Info object describes
+         *
+         * @param  lineClass the class of the line that the new Line.Info object
+         *         describes
          */
         public Info(Class<?> lineClass) {
 
@@ -260,33 +249,29 @@ public interface Line extends AutoCloseable {
             }
         }
 
-
-
         /**
          * Obtains the class of the line that this Line.Info object describes.
+         *
          * @return the described line's class
          */
         public Class<?> getLineClass() {
             return lineClass;
         }
 
-
         /**
-         * Indicates whether the specified info object matches this one.
-         * To match, the specified object must be identical to or
-         * a special case of this one.  The specified info object
-         * must be either an instance of the same class as this one,
-         * or an instance of a sub-type of this one.  In addition, the
-         * attributes of the specified object must be compatible with the
-         * capabilities of this one.  Specifically, the routing configuration
-         * for the specified info object must be compatible with that of this
-         * one.
-         * Subclasses may add other criteria to determine whether the two objects
-         * match.
+         * Indicates whether the specified info object matches this one. To
+         * match, the specified object must be identical to or a special case of
+         * this one. The specified info object must be either an instance of
+         * the same class as this one, or an instance of a sub-type of this one.
+         * In addition, the attributes of the specified object must be
+         * compatible with the capabilities of this one. Specifically, the
+         * routing configuration for the specified info object must be
+         * compatible with that of this one. Subclasses may add other criteria
+         * to determine whether the two objects match.
          *
-         * @param info the info object which is being compared to this one
-         * @return <code>true</code> if the specified object matches this one,
-         * <code>false</code> otherwise
+         * @param  info the info object which is being compared to this one
+         * @return {@code true} if the specified object matches this one,
+         *         {@code false} otherwise
          */
         public boolean matches(Info info) {
 
@@ -320,7 +305,6 @@ public interface Line extends AutoCloseable {
                 return false;
             }
 
-
             // this.isAssignableFrom(that)  =>  this is same or super to that
             //                                                          =>      this is at least as general as that
             //                                                          =>      that may be subtype of this
@@ -332,11 +316,12 @@ public interface Line extends AutoCloseable {
             return true;
         }
 
-
         /**
          * Obtains a textual description of the line info.
+         *
          * @return a string description
          */
+        @Override
         public String toString() {
 
             String fullPackagePath = "javax.sound.sampled.";
@@ -353,7 +338,5 @@ public interface Line extends AutoCloseable {
 
             return finalString;
         }
-
-    } // class Info
-
-} // interface Line
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/LineEvent.java b/jdk/src/share/classes/javax/sound/sampled/LineEvent.java
index ff5b90f1ba1..035c38f74f5 100644
--- a/jdk/src/share/classes/javax/sound/sampled/LineEvent.java
+++ b/jdk/src/share/classes/javax/sound/sampled/LineEvent.java
@@ -25,61 +25,64 @@
 
 package javax.sound.sampled;
 
+import java.util.EventObject;
+
 /**
- * The <code>LineEvent</code> class encapsulates information that a line
- * sends its listeners whenever the line opens, closes, starts, or stops.
- * Each of these four state changes is represented by a corresponding
- * type of event.  A listener receives the event as a parameter to its
- * {@link LineListener#update update} method.  By querying the event,
- * the listener can learn the type of event, the line responsible for
- * the event, and how much data the line had processed when the event occurred.
- *
- * <p>Although this class implements Serializable, attempts to
- * serialize a <code>LineEvent</code> object will fail.
+ * The {@code LineEvent} class encapsulates information that a line sends its
+ * listeners whenever the line opens, closes, starts, or stops. Each of these
+ * four state changes is represented by a corresponding type of event. A
+ * listener receives the event as a parameter to its
+ * {@link LineListener#update update} method. By querying the event, the
+ * listener can learn the type of event, the line responsible for the event, and
+ * how much data the line had processed when the event occurred.
+ * <p>
+ * Although this class implements Serializable, attempts to serialize a
+ * {@code LineEvent} object will fail.
  *
  * @author Kara Kytle
- *
  * @see Line
  * @see LineListener#update
  * @since 1.3
  *
  * @serial exclude
  */
-public class LineEvent extends java.util.EventObject {
-    private static final long serialVersionUID = -1274246333383880410L;
+public class LineEvent extends EventObject {
 
-    // INSTANCE VARIABLES
+    private static final long serialVersionUID = -1274246333383880410L;
 
     /**
-     * The kind of line event (<code>OPEN</code>, <code>CLOSE</code>,
-     * <code>START</code>, or <code>STOP</code>).
-     * @see #getType
+     * The kind of line event ({@code OPEN}, {@code CLOSE}, {@code START}, or
+     * {@code STOP}).
+     *
      * @serial
+     * @see #getType
      */
     private final Type type;
 
     /**
      * The media position when the event occurred, expressed in sample frames.
-     * Note that this field is only relevant to certain events generated by
-     * data lines, such as <code>START</code> and <code>STOP</code>.  For
-     * events generated by lines that do not count sample frames, and for any
-     * other events for which this value is not known, the position value
-     * should be {@link AudioSystem#NOT_SPECIFIED}.
+     * Note that this field is only relevant to certain events generated by data
+     * lines, such as {@code START} and {@code STOP}. For events generated by
+     * lines that do not count sample frames, and for any other events for which
+     * this value is not known, the position value should be
+     * {@link AudioSystem#NOT_SPECIFIED}.
+     *
      * @serial
      * @see #getFramePosition
      */
     private final long position;
 
-
     /**
-     * Constructs a new event of the specified type, originating from the specified line.
-     * @param line the source of this event
-     * @param type the event type (<code>OPEN</code>, <code>CLOSE</code>, <code>START</code>, or <code>STOP</code>)
-     * @param position the number of sample frames that the line had already processed when the event occurred,
-     * or {@link AudioSystem#NOT_SPECIFIED}
+     * Constructs a new event of the specified type, originating from the
+     * specified line.
      *
-     * @throws IllegalArgumentException if <code>line</code> is
-     * <code>null</code>.
+     * @param  line the source of this event
+     * @param  type the event type ({@code OPEN}, {@code CLOSE}, {@code START},
+     *         or {@code STOP})
+     * @param  position the number of sample frames that the line had already
+     *         processed when the event occurred, or
+     *         {@link AudioSystem#NOT_SPECIFIED}
+     * @throws IllegalArgumentException if {@code line} is {@code null}.
      */
     public LineEvent(Line line, Type type, long position) {
 
@@ -90,6 +93,7 @@ public class LineEvent extends java.util.EventObject {
 
     /**
      * Obtains the audio line that is the source of this event.
+     *
      * @return the line responsible for this event
      */
     public final Line getLine() {
@@ -97,11 +101,11 @@ public class LineEvent extends java.util.EventObject {
         return (Line)getSource();
     }
 
-
     /**
      * Obtains the event's type.
+     *
      * @return this event's type ({@link Type#OPEN}, {@link Type#CLOSE},
-     * {@link Type#START}, or {@link Type#STOP})
+     *         {@link Type#START}, or {@link Type#STOP})
      */
     public final Type getType() {
 
@@ -109,21 +113,24 @@ public class LineEvent extends java.util.EventObject {
     }
 
     /**
-     * Obtains the position in the line's audio data when the event occurred, expressed in sample frames.
-     * For example, if a source line had already played back 14 sample frames at the time it was
-     * paused, the pause event would report the line's position as 14.  The next frame to be processed
-     * would be frame number 14 using zero-based numbering, or 15 using one-based numbering.
+     * Obtains the position in the line's audio data when the event occurred,
+     * expressed in sample frames. For example, if a source line had already
+     * played back 14 sample frames at the time it was paused, the pause event
+     * would report the line's position as 14. The next frame to be processed
+     * would be frame number 14 using zero-based numbering, or 15 using
+     * one-based numbering.
      * <p>
-     * Note that this field is relevant only to certain events generated by
-     * data lines, such as <code>START</code> and <code>STOP</code>.  For
-     * events generated by lines that do not count sample frames, and for any
-     * other events for which this value is not known, the position value
-     * should be {@link AudioSystem#NOT_SPECIFIED}.
+     * Note that this field is relevant only to certain events generated by data
+     * lines, such as {@code START} and {@code STOP}. For events generated by
+     * lines that do not count sample frames, and for any other events for which
+     * this value is not known, the position value should be
+     * {@link AudioSystem#NOT_SPECIFIED}.
      *
      * @return the line's position as a sample frame number
      */
     /*
-     * $$kk: 04.20.99: note to myself: should make sure our implementation is consistent with this.
+     * $$kk: 04.20.99: note to myself: should make sure our implementation is
+     * consistent with this.
      * which is a reasonable definition....
      */
     public final long getFramePosition() {
@@ -132,10 +139,12 @@ public class LineEvent extends java.util.EventObject {
     }
 
     /**
-     * Obtains a string representation of the event.  The contents of the string may vary
-     * between implementations of Java Sound.
-     * @return a string describing the event.
+     * Obtains a string representation of the event. The contents of the string
+     * may vary between implementations of Java Sound.
+     *
+     * @return a string describing the event
      */
+    @Override
     public String toString() {
         String sType = "";
         if (type != null) sType = type.toString()+" ";
@@ -148,16 +157,15 @@ public class LineEvent extends java.util.EventObject {
         return new String(sType + "event from line " + sLine);
     }
 
-
     /**
-     * The LineEvent.Type inner class identifies what kind of event occurred on a line.
-     * Static instances are provided for the common types (OPEN, CLOSE, START, and STOP).
+     * The LineEvent.Type inner class identifies what kind of event occurred on
+     * a line. Static instances are provided for the common types (OPEN, CLOSE,
+     * START, and STOP).
      *
      * @see LineEvent#getType()
      */
     public static class Type {
 
-
         /**
          * Type name.
          */
@@ -166,82 +174,84 @@ public class LineEvent extends java.util.EventObject {
 
         /**
          * Constructs a new event type.
-         * @param name name of the type
+         *
+         * @param  name name of the type
          */
         protected Type(String name) {
             this.name = name;
         }
 
-
         //$$fb 2002-11-26: fix for 4695001: SPEC: description of equals() method contains typo
+
         /**
          * Indicates whether the specified object is equal to this event type,
-         * returning <code>true</code> if the objects are identical.
-         * @param obj the reference object with which to compare
-         * @return <code>true</code> if this event type is the same as
-         * <code>obj</code>; <code>false</code> otherwise
+         * returning {@code true} if the objects are identical.
+         *
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if this event type is the same as {@code obj};
+         *         {@code false} otherwise
          */
+        @Override
         public final boolean equals(Object obj) {
             return super.equals(obj);
         }
 
-
         /**
          * Finalizes the hashcode method.
          */
+        @Override
         public final int hashCode() {
             return super.hashCode();
         }
 
-
         /**
          * Returns the type name as the string representation.
          */
+        @Override
         public String toString() {
             return name;
         }
 
-
         // LINE EVENT TYPE DEFINES
 
         /**
          * A type of event that is sent when a line opens, reserving system
          * resources for itself.
+         *
          * @see #CLOSE
          * @see Line#open
          */
         public static final Type OPEN   = new Type("Open");
 
-
         /**
          * A type of event that is sent when a line closes, freeing the system
          * resources it had obtained when it was opened.
+         *
          * @see #OPEN
          * @see Line#close
          */
         public static final Type CLOSE  = new Type("Close");
 
-
         /**
          * A type of event that is sent when a line begins to engage in active
          * input or output of audio data in response to a
          * {@link DataLine#start start} request.
+         *
          * @see #STOP
          * @see DataLine#start
          */
         public static final Type START  = new Type("Start");
 
-
         /**
-         * A type of event that is sent when a line ceases active input or output
-         * of audio data in response to a {@link DataLine#stop stop} request,
-         * or because the end of media has been reached.
+         * A type of event that is sent when a line ceases active input or
+         * output of audio data in response to a {@link DataLine#stop stop}
+         * request, or because the end of media has been reached.
+         *
          * @see #START
          * @see DataLine#stop
          */
         public static final Type STOP   = new Type("Stop");
 
-
         /**
          * A type of event that is sent when a line ceases to engage in active
          * input or output of audio data because the end of media has been reached.
@@ -255,7 +265,6 @@ public class LineEvent extends java.util.EventObject {
          */
         //public static final Type EOM  = new Type("EOM");
 
-
         /**
          * A type of event that is sent when a line begins to engage in active
          * input or output of audio data.  Examples of when this happens are
@@ -268,7 +277,6 @@ public class LineEvent extends java.util.EventObject {
          */
         //public static final Type ACTIVE       = new Type("ACTIVE");
 
-
         /**
          * A type of event that is sent when a line ceases active input or output
          * of audio data.
@@ -276,7 +284,5 @@ public class LineEvent extends java.util.EventObject {
          * @see DataLine#stop
          */
         //public static final Type INACTIVE     = new Type("INACTIVE");
-
-    } // class Type
-
-} // class LineEvent
+    }
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/LineListener.java b/jdk/src/share/classes/javax/sound/sampled/LineListener.java
index 57d6468007d..5d0434d6d86 100644
--- a/jdk/src/share/classes/javax/sound/sampled/LineListener.java
+++ b/jdk/src/share/classes/javax/sound/sampled/LineListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,44 +25,27 @@
 
 package javax.sound.sampled;
 
-
+import java.util.EventListener;
 
 /**
- * Instances of classes that implement the <code>LineListener</code> interface can register to
- * receive events when a line's status changes.
+ * Instances of classes that implement the {@code LineListener} interface can
+ * register to receive events when a line's status changes.
  *
  * @author Kara Kytle
- *
  * @see Line
  * @see Line#addLineListener
  * @see Line#removeLineListener
  * @see LineEvent
- *
  * @since 1.3
  */
-/*
- * Instances of classes that implement the <code>LineListener</code> interface can register to
- * receive events when a line's status changes.
- *
- * @see Line
- * @see Line#addLineListener
- * @see Line#removeLineListener
- * @see LineEvent
- *
- * @author Kara Kytle
- */
-public interface LineListener extends java.util.EventListener {
+public interface LineListener extends EventListener {
 
     /**
-     * Informs the listener that a line's state has changed.  The listener can then invoke
-     * <code>LineEvent</code> methods to obtain information about the event.
-     * @param event a line event that describes the change
-     */
-    /*
-     * Informs the listener that a line's state has changed.  The listener can then invoke
-     * <code>LineEvent</code> methods to obtain information about the event.
-     * @param event a line event that describes the change
+     * Informs the listener that a line's state has changed. The listener can
+     * then invoke {@code LineEvent} methods to obtain information about the
+     * event.
+     *
+     * @param  event a line event that describes the change
      */
-    public void update(LineEvent event);
-
-} // interface LineListener
+    void update(LineEvent event);
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/LineUnavailableException.java b/jdk/src/share/classes/javax/sound/sampled/LineUnavailableException.java
index 1e72f75061e..701d8ee499a 100644
--- a/jdk/src/share/classes/javax/sound/sampled/LineUnavailableException.java
+++ b/jdk/src/share/classes/javax/sound/sampled/LineUnavailableException.java
@@ -26,43 +26,32 @@
 package javax.sound.sampled;
 
 /**
- * A <code>LineUnavailableException</code> is an exception indicating that a
- * line cannot be opened because it is unavailable.  This situation
- * arises most commonly when a requested line is already in use
- * by another application.
+ * A {@code LineUnavailableException} is an exception indicating that a line
+ * cannot be opened because it is unavailable. This situation arises most
+ * commonly when a requested line is already in use by another application.
  *
  * @author Kara Kytle
  * @since 1.3
  */
-/*
- * A <code>LinenavailableException</code> is an exception indicating that a
- * line annot be opened because it is unavailable.  This situation
- * arises most commonly when a line is requested when it is already in use
- * by another application.
- *
- * @author Kara Kytle
- */
-
 public class LineUnavailableException extends Exception {
+
     private static final long serialVersionUID = -2046718279487432130L;
 
     /**
-     * Constructs a <code>LineUnavailableException</code> that has
-     * <code>null</code> as its error detail message.
+     * Constructs a {@code LineUnavailableException} that has {@code null} as
+     * its error detail message.
      */
     public LineUnavailableException() {
-
         super();
     }
 
     /**
-     * Constructs a <code>LineUnavailableException</code> that has
-     * the specified detail message.
+     * Constructs a {@code LineUnavailableException} that has the specified
+     * detail message.
      *
-     * @param message a string containing the error detail message
+     * @param  message a string containing the error detail message
      */
-    public LineUnavailableException(String message) {
-
+    public LineUnavailableException(final String message) {
         super(message);
     }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/Mixer.java b/jdk/src/share/classes/javax/sound/sampled/Mixer.java
index 755ab913342..87784ec62f1 100644
--- a/jdk/src/share/classes/javax/sound/sampled/Mixer.java
+++ b/jdk/src/share/classes/javax/sound/sampled/Mixer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,30 +25,27 @@
 
 package javax.sound.sampled;
 
-
 /**
- * A mixer is an audio device with one or more lines.  It need not be
- * designed for mixing audio signals.  A mixer that actually mixes audio
- * has multiple input (source) lines and at least one output (target) line.
- * The former are often instances of classes that implement
- * <code>{@link SourceDataLine}</code>,
- * and the latter, <code>{@link TargetDataLine}</code>.  <code>{@link Port}</code>
- * objects, too, are either source lines or target lines.
- * A mixer can accept prerecorded, loopable sound as input, by having
- * some of its source lines be instances of objects that implement the
- * <code>{@link Clip}</code> interface.
+ * A mixer is an audio device with one or more lines. It need not be designed
+ * for mixing audio signals. A mixer that actually mixes audio has multiple
+ * input (source) lines and at least one output (target) line. The former are
+ * often instances of classes that implement {@link SourceDataLine}, and the
+ * latter, {@link TargetDataLine}. {@link Port} objects, too, are either source
+ * lines or target lines. A mixer can accept prerecorded, loopable sound as
+ * input, by having some of its source lines be instances of objects that
+ * implement the {@link Clip} interface.
  * <p>
- * Through methods of the <code>Line</code> interface, which <code>Mixer</code> extends,
- * a mixer might provide a set of controls that are global to the mixer.  For example,
- * the mixer can have a master gain control.  These global controls are distinct
- * from the controls belonging to each of the mixer's individual lines.
+ * Through methods of the {@code Line} interface, which {@code Mixer} extends, a
+ * mixer might provide a set of controls that are global to the mixer. For
+ * example, the mixer can have a master gain control. These global controls are
+ * distinct from the controls belonging to each of the mixer's individual lines.
  * <p>
- * Some mixers, especially
- * those with internal digital mixing capabilities, may provide
- * additional capabilities by implementing the <code>DataLine</code> interface.
+ * Some mixers, especially those with internal digital mixing capabilities, may
+ * provide additional capabilities by implementing the {@code DataLine}
+ * interface.
  * <p>
- * A mixer can support synchronization of its lines.  When one line in
- * a synchronized group is started or stopped, the other lines in the group
+ * A mixer can support synchronization of its lines. When one line in a
+ * synchronized group is started or stopped, the other lines in the group
  * automatically start or stop simultaneously with the explicitly affected one.
  *
  * @author Kara Kytle
@@ -59,198 +56,201 @@ public interface Mixer extends Line {
     /**
      * Obtains information about this mixer, including the product's name,
      * version, vendor, etc.
+     *
      * @return a mixer info object that describes this mixer
      * @see Mixer.Info
      */
-    public Info getMixerInfo();
-
+    Info getMixerInfo();
 
     /**
-     * Obtains information about the set of source lines supported
-     * by this mixer.
-     * Some source lines may only be available when this mixer is open.
-     * @return array of <code>Line.Info</code> objects representing source lines
-     * for this mixer.  If no source lines are supported,
-     * an array of length 0 is returned.
+     * Obtains information about the set of source lines supported by this
+     * mixer. Some source lines may only be available when this mixer is open.
+     *
+     * @return array of {@code Line.Info} objects representing source lines for
+     *         this mixer. If no source lines are supported, an array of length
+     *         0 is returned.
      */
-    public Line.Info[] getSourceLineInfo();
+    Line.Info[] getSourceLineInfo();
 
     /**
-     * Obtains information about the set of target lines supported
-     * by this mixer.
-     * Some target lines may only be available when this mixer is open.
-     * @return array of <code>Line.Info</code> objects representing target lines
-     * for this mixer.  If no target lines are supported,
-     * an array of length 0 is returned.
+     * Obtains information about the set of target lines supported by this
+     * mixer. Some target lines may only be available when this mixer is open.
+     *
+     * @return array of {@code Line.Info} objects representing target lines for
+     *         this mixer. If no target lines are supported, an array of length
+     *         0 is returned.
      */
-    public Line.Info[] getTargetLineInfo();
-
+    Line.Info[] getTargetLineInfo();
 
     /**
-     * Obtains information about source lines of a particular type supported
-     * by the mixer.
-     * Some source lines may only be available when this mixer is open.
-     * @param info a <code>Line.Info</code> object describing lines about which information
-     * is queried
-     * @return an array of <code>Line.Info</code> objects describing source lines matching
-     * the type requested.  If no matching source lines are supported, an array of length 0
-     * is returned.
+     * Obtains information about source lines of a particular type supported by
+     * the mixer. Some source lines may only be available when this mixer is
+     * open.
+     *
+     * @param  info a {@code Line.Info} object describing lines about which
+     *         information is queried
+     * @return an array of {@code Line.Info} objects describing source lines
+     *         matching the type requested. If no matching source lines are
+     *         supported, an array of length 0 is returned.
      */
-    public Line.Info[] getSourceLineInfo(Line.Info info);
-
+    Line.Info[] getSourceLineInfo(Line.Info info);
 
     /**
-     * Obtains information about target lines of a particular type supported
-     * by the mixer.
-     * Some target lines may only be available when this mixer is open.
-     * @param info a <code>Line.Info</code> object describing lines about which information
-     * is queried
-     * @return an array of <code>Line.Info</code> objects describing target lines matching
-     * the type requested.  If no matching target lines are supported, an array of length 0
-     * is returned.
+     * Obtains information about target lines of a particular type supported by
+     * the mixer. Some target lines may only be available when this mixer is
+     * open.
+     *
+     * @param  info a {@code Line.Info} object describing lines about which
+     *         information is queried
+     * @return an array of {@code Line.Info} objects describing target lines
+     *         matching the type requested. If no matching target lines are
+     *         supported, an array of length 0 is returned.
      */
-    public Line.Info[] getTargetLineInfo(Line.Info info);
-
+    Line.Info[] getTargetLineInfo(Line.Info info);
 
     /**
-     * Indicates whether the mixer supports a line (or lines) that match
-     * the specified <code>Line.Info</code> object.
-     * Some lines may only be supported when this mixer is open.
-     * @param info describes the line for which support is queried
-     * @return <code>true</code> if at least one matching line is
-     * supported, <code>false</code> otherwise
+     * Indicates whether the mixer supports a line (or lines) that match the
+     * specified {@code Line.Info} object. Some lines may only be supported when
+     * this mixer is open.
+     *
+     * @param  info describes the line for which support is queried
+     * @return {@code true} if at least one matching line is supported,
+     *         {@code false} otherwise
      */
-    public boolean isLineSupported(Line.Info info);
+    boolean isLineSupported(Line.Info info);
 
     /**
      * Obtains a line that is available for use and that matches the description
-     * in the specified <code>Line.Info</code> object.
-     *
-     * <p>If a <code>DataLine</code> is requested, and <code>info</code>
-     * is an instance of <code>DataLine.Info</code> specifying at
-     * least one fully qualified audio format, the last one
-     * will be used as the default format of the returned
-     * <code>DataLine</code>.
+     * in the specified {@code Line.Info} object.
+     * <p>
+     * If a {@code DataLine} is requested, and {@code info} is an instance of
+     * {@code DataLine.Info} specifying at least one fully qualified audio
+     * format, the last one will be used as the default format of the returned
+     * {@code DataLine}.
      *
-     * @param info describes the desired line
+     * @param  info describes the desired line
      * @return a line that is available for use and that matches the description
-     * in the specified {@code Line.Info} object
-     * @throws LineUnavailableException if a matching line
-     * is not available due to resource restrictions
-     * @throws IllegalArgumentException if this mixer does
-     * not support any lines matching the description
-     * @throws SecurityException if a matching line
-     * is not available due to security restrictions
+     *         in the specified {@code Line.Info} object
+     * @throws LineUnavailableException if a matching line is not available due
+     *         to resource restrictions
+     * @throws IllegalArgumentException if this mixer does not support any lines
+     *         matching the description
+     * @throws SecurityException if a matching line is not available due to
+     *         security restrictions
      */
-    public Line getLine(Line.Info info) throws LineUnavailableException;
+    Line getLine(Line.Info info) throws LineUnavailableException;
 
     //$$fb 2002-04-12: fix for 4667258: behavior of Mixer.getMaxLines(Line.Info) method doesn't match the spec
     /**
-     * Obtains the approximate maximum number of lines of the requested type that can be open
-     * simultaneously on the mixer.
+     * Obtains the approximate maximum number of lines of the requested type
+     * that can be open simultaneously on the mixer.
+     *
+     * Certain types of mixers do not have a hard bound and may allow opening
+     * more lines. Since certain lines are a shared resource, a mixer may not be
+     * able to open the maximum number of lines if another process has opened
+     * lines of this mixer.
      *
-     * Certain types of mixers do not have a hard bound and may allow opening more lines.
-     * Since certain lines are a shared resource, a mixer may not be able to open the maximum
-     * number of lines if another process has opened lines of this mixer.
+     * The requested type is any line that matches the description in the
+     * provided {@code Line.Info} object. For example, if the info object
+     * represents a speaker port, and the mixer supports exactly one speaker
+     * port, this method should return 1. If the info object represents a
+     * source data line and the mixer supports the use of 32 source data lines
+     * simultaneously, the return value should be 32. If there is no limit, this
+     * function returns {@code AudioSystem.NOT_SPECIFIED}.
      *
-     * The requested type is any line that matches the description in
-     * the provided <code>Line.Info</code> object.  For example, if the info
-     * object represents a speaker
-     * port, and the mixer supports exactly one speaker port, this method
-     * should return 1.  If the info object represents a source data line
-     * and the mixer supports the use of 32 source data lines simultaneously,
-     * the return value should be 32.
-     * If there is no limit, this function returns <code>AudioSystem.NOT_SPECIFIED</code>.
-     * @param info a <code>Line.Info</code> that describes the line for which
-     * the number of supported instances is queried
-     * @return the maximum number of matching lines supported, or <code>AudioSystem.NOT_SPECIFIED</code>
+     * @param  info a {@code Line.Info} that describes the line for which the
+     *         number of supported instances is queried
+     * @return the maximum number of matching lines supported, or
+     *         {@code AudioSystem.NOT_SPECIFIED}
      */
-    public int getMaxLines(Line.Info info);
-
+    int getMaxLines(Line.Info info);
 
     /**
      * Obtains the set of all source lines currently open to this mixer.
      *
-     * @return the source lines currently open to the mixer.
-     * If no source lines are currently open to this mixer,  an
-     * array of length 0 is returned.
-     * @throws SecurityException if the matching lines
-     * are not available due to security restrictions
+     * @return the source lines currently open to the mixer. If no source lines
+     *         are currently open to this mixer, an array of length 0 is
+     *         returned.
+     * @throws SecurityException if the matching lines are not available due to
+     *         security restrictions
      */
-    public Line[] getSourceLines();
+    Line[] getSourceLines();
 
     /**
      * Obtains the set of all target lines currently open from this mixer.
      *
-     * @return target lines currently open from the mixer.
-     * If no target lines are currently open from this mixer, an
-     * array of length 0 is returned.
-     * @throws SecurityException if the matching lines
-     * are not available due to security restrictions
+     * @return target lines currently open from the mixer. If no target lines
+     *         are currently open from this mixer, an array of length 0 is
+     *         returned.
+     * @throws SecurityException if the matching lines are not available due to
+     *         security restrictions
      */
-    public Line[] getTargetLines();
+    Line[] getTargetLines();
 
     /**
-     * Synchronizes two or more lines.  Any subsequent command that starts or stops
-     * audio playback or capture for one of these lines will exert the
-     * same effect on the other lines in the group, so that they start or stop playing or
-     * capturing data simultaneously.
-     *
-     * @param lines the lines that should be synchronized
-     * @param maintainSync <code>true</code> if the synchronization
-     * must be precisely maintained (i.e., the synchronization must be sample-accurate)
-     * at all times during operation of the lines , or <code>false</code>
-     * if precise synchronization is required only during start and stop operations
+     * Synchronizes two or more lines. Any subsequent command that starts or
+     * stops audio playback or capture for one of these lines will exert the
+     * same effect on the other lines in the group, so that they start or stop
+     * playing or capturing data simultaneously.
      *
+     * @param  lines the lines that should be synchronized
+     * @param  maintainSync {@code true} if the synchronization must be
+     *         precisely maintained (i.e., the synchronization must be
+     *         sample-accurate) at all times during operation of the lines, or
+     *         {@code false} if precise synchronization is required only during
+     *         start and stop operations
      * @throws IllegalArgumentException if the lines cannot be synchronized.
-     * This may occur if the lines are of different types or have different
-     * formats for which this mixer does not support synchronization, or if
-     * all lines specified do not belong to this mixer.
+     *         This may occur if the lines are of different types or have
+     *         different formats for which this mixer does not support
+     *         synchronization, or if all lines specified do not belong to this
+     *         mixer.
      */
-    public void synchronize(Line[] lines, boolean maintainSync);
+    void synchronize(Line[] lines, boolean maintainSync);
 
     /**
-     * Releases synchronization for the specified lines.  The array must
-     * be identical to one for which synchronization has already been
-     * established; otherwise an exception may be thrown.  However, <code>null</code>
-     * may be specified, in which case all currently synchronized lines that belong
-     * to this mixer are unsynchronized.
-     * @param lines the synchronized lines for which synchronization should be
-     * released, or <code>null</code> for all this mixer's synchronized lines
+     * Releases synchronization for the specified lines. The array must be
+     * identical to one for which synchronization has already been established;
+     * otherwise an exception may be thrown. However, {@code null} may be
+     * specified, in which case all currently synchronized lines that belong to
+     * this mixer are unsynchronized.
      *
+     * @param  lines the synchronized lines for which synchronization should be
+     *         released, or {@code null} for all this mixer's synchronized
+     *         lines
      * @throws IllegalArgumentException if the lines cannot be unsynchronized.
-     * This may occur if the argument specified does not exactly match a set
-     * of lines for which synchronization has already been established.
+     *         This may occur if the argument specified does not exactly match
+     *         a set of lines for which synchronization has already been
+     *         established.
      */
-    public void unsynchronize(Line[] lines);
-
+    void unsynchronize(Line[] lines);
 
     /**
-     * Reports whether this mixer supports synchronization of the specified set of lines.
-     *
-     * @param lines the set of lines for which synchronization support is queried
-     * @param maintainSync <code>true</code> if the synchronization
-     * must be precisely maintained (i.e., the synchronization must be sample-accurate)
-     * at all times during operation of the lines , or <code>false</code>
-     * if precise synchronization is required only during start and stop operations
+     * Reports whether this mixer supports synchronization of the specified set
+     * of lines.
      *
-     * @return <code>true</code> if the lines can be synchronized, <code>false</code>
-     * otherwise
+     * @param  lines the set of lines for which synchronization support is
+     *         queried
+     * @param  maintainSync {@code true} if the synchronization must be
+     *         precisely maintained (i.e., the synchronization must be
+     *         sample-accurate) at all times during operation of the lines, or
+     *         {@code false} if precise synchronization is required only during
+     *         start and stop operations
+     * @return {@code true} if the lines can be synchronized, {@code false}
+     *         otherwise
      */
-    public boolean isSynchronizationSupported(Line[] lines, boolean maintainSync);
-
+    boolean isSynchronizationSupported(Line[] lines, boolean maintainSync);
 
     /**
-     * The <code>Mixer.Info</code> class represents information about an audio mixer,
+     * The {@code Mixer.Info} class represents information about an audio mixer,
      * including the product's name, version, and vendor, along with a textual
-     * description.  This information may be retrieved through the
-     * {@link Mixer#getMixerInfo() getMixerInfo}
-     * method of the <code>Mixer</code> interface.
+     * description. This information may be retrieved through the
+     * {@link Mixer#getMixerInfo() getMixerInfo} method of the {@code Mixer}
+     * interface.
      *
      * @author Kara Kytle
      * @since 1.3
      */
-    public static class Info {
+    class Info {
 
         /**
          * Mixer name.
@@ -273,13 +273,14 @@ public interface Mixer extends Line {
         private final String version;
 
         /**
-         * Constructs a mixer's info object, passing it the given
-         * textual information.
-         * @param name the name of the mixer
-         * @param vendor the company who manufactures or creates the hardware
-         * or software mixer
-         * @param description descriptive text about the mixer
-         * @param version version information for the mixer
+         * Constructs a mixer's info object, passing it the given textual
+         * information.
+         *
+         * @param  name the name of the mixer
+         * @param  vendor the company who manufactures or creates the
+         *         hardware or software mixer
+         * @param  description descriptive text about the mixer
+         * @param  version version information for the mixer
          */
         protected Info(String name, String vendor, String description, String version) {
 
@@ -289,15 +290,16 @@ public interface Mixer extends Line {
             this.version = version;
         }
 
-
         /**
-         * Indicates whether two info objects are equal, returning <code>true</code> if
-         * they are identical.
-         * @param obj the reference object with which to compare this info
-         * object
-         * @return <code>true</code> if this info object is the same as the
-         * <code>obj</code> argument; <code>false</code> otherwise
+         * Indicates whether two info objects are equal, returning {@code true}
+         * if they are identical.
+         *
+         * @param  obj the reference object with which to compare this info
+         *         object
+         * @return {@code true} if this info object is the same as the
+         *         {@code obj} argument; {@code false} otherwise
          */
+        @Override
         public final boolean equals(Object obj) {
             return super.equals(obj);
         }
@@ -307,12 +309,14 @@ public interface Mixer extends Line {
          *
          * @return the hashcode for this object
          */
+        @Override
         public final int hashCode() {
             return super.hashCode();
         }
 
         /**
          * Obtains the name of the mixer.
+         *
          * @return a string that names the mixer
          */
         public final String getName() {
@@ -321,6 +325,7 @@ public interface Mixer extends Line {
 
         /**
          * Obtains the vendor of the mixer.
+         *
          * @return a string that names the mixer's vendor
          */
         public final String getVendor() {
@@ -329,6 +334,7 @@ public interface Mixer extends Line {
 
         /**
          * Obtains the description of the mixer.
+         *
          * @return a textual description of the mixer
          */
         public final String getDescription() {
@@ -337,6 +343,7 @@ public interface Mixer extends Line {
 
         /**
          * Obtains the version of the mixer.
+         *
          * @return textual version information for the mixer
          */
         public final String getVersion() {
@@ -345,10 +352,12 @@ public interface Mixer extends Line {
 
         /**
          * Provides a string representation of the mixer info.
+         *
          * @return a string describing the info object
          */
+        @Override
         public final String toString() {
             return (name + ", version " + version);
         }
-    } // class Info
+    }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/Port.java b/jdk/src/share/classes/javax/sound/sampled/Port.java
index 04b67a8fa3e..61f40c761a5 100644
--- a/jdk/src/share/classes/javax/sound/sampled/Port.java
+++ b/jdk/src/share/classes/javax/sound/sampled/Port.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,41 +25,36 @@
 
 package javax.sound.sampled;
 
-
 /**
  * Ports are simple lines for input or output of audio to or from audio devices.
- * Common examples of ports that act as source lines (mixer inputs) include the microphone,
- * line input, and CD-ROM drive.  Ports that act as target lines (mixer outputs) include the
- * speaker, headphone, and line output.  You can access port using a <code>{@link Port.Info}</code>
- * object.
+ * Common examples of ports that act as source lines (mixer inputs) include the
+ * microphone, line input, and CD-ROM drive. Ports that act as target lines
+ * (mixer outputs) include the speaker, headphone, and line output. You can
+ * access port using a {@link Port.Info} object.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public interface Port extends Line {
 
-
-    // INNER CLASSES
-
-
     /**
-     * The <code>Port.Info</code> class extends <code>{@link Line.Info}</code>
-     * with additional information specific to ports, including the port's name
-     * and whether it is a source or a target for its mixer.
-     * By definition, a port acts as either a source or a target to its mixer,
-     * but not both.  (Audio input ports are sources; audio output ports are targets.)
+     * The {@code Port.Info} class extends {@code Line.Info} with additional
+     * information specific to ports, including the port's name and whether it
+     * is a source or a target for its mixer. By definition, a port acts as
+     * either a source or a target to its mixer, but not both. (Audio input
+     * ports are sources; audio output ports are targets.)
      * <p>
-     * To learn what ports are available, you can retrieve port info objects through the
-     * <code>{@link Mixer#getSourceLineInfo getSourceLineInfo}</code> and
-     * <code>{@link Mixer#getTargetLineInfo getTargetLineInfo}</code>
-     * methods of the <code>Mixer</code> interface.  Instances of the
-     * <code>Port.Info</code> class may also be constructed and used to obtain
-     * lines matching the parameters specified in the <code>Port.Info</code> object.
+     * To learn what ports are available, you can retrieve port info objects
+     * through the {@link Mixer#getSourceLineInfo getSourceLineInfo} and
+     * {@link Mixer#getTargetLineInfo getTargetLineInfo} methods of the
+     * {@code Mixer} interface. Instances of the {@code Port.Info} class may
+     * also be constructed and used to obtain lines matching the parameters
+     * specified in the {@code Port.Info} object.
      *
      * @author Kara Kytle
      * @since 1.3
      */
-    public static class Info extends Line.Info {
+    class Info extends Line.Info {
 
 
         // AUDIO PORT TYPE DEFINES
@@ -68,7 +63,8 @@ public interface Port extends Line {
         // SOURCE PORTS
 
         /**
-         * A type of port that gets audio from a built-in microphone or a microphone jack.
+         * A type of port that gets audio from a built-in microphone or a
+         * microphone jack.
          */
         public static final Info MICROPHONE = new Info(Port.class,"MICROPHONE", true);
 
@@ -86,7 +82,8 @@ public interface Port extends Line {
         // TARGET PORTS
 
         /**
-         * A type of port that sends audio to a built-in speaker or a speaker jack.
+         * A type of port that sends audio to a built-in speaker or a speaker
+         * jack.
          */
         public static final Info SPEAKER = new Info(Port.class,"SPEAKER", false);
 
@@ -113,19 +110,16 @@ public interface Port extends Line {
         private String name;
         private boolean isSource;
 
-
-        // CONSTRUCTOR
-
         /**
-         * Constructs a port's info object from the information given.
-         * This constructor is typically used by an implementation
-         * of Java Sound to describe a supported line.
+         * Constructs a port's info object from the information given. This
+         * constructor is typically used by an implementation of Java Sound to
+         * describe a supported line.
          *
-         * @param lineClass the class of the port described by the info object.
-         * @param name the string that names the port
-         * @param isSource <code>true</code> if the port is a source port (such
-         * as a microphone), <code>false</code> if the port is a target port
-         * (such as a speaker).
+         * @param  lineClass the class of the port described by the info object
+         * @param  name the string that names the port
+         * @param  isSource {@code true} if the port is a source port (such as a
+         *         microphone), {@code false} if the port is a target port
+         *         (such as a speaker)
          */
         public Info(Class<?> lineClass, String name, boolean isSource) {
 
@@ -134,11 +128,9 @@ public interface Port extends Line {
             this.isSource = isSource;
         }
 
-
-        // METHODS
-
         /**
          * Obtains the name of the port.
+         *
          * @return the string that names the port
          */
         public String getName() {
@@ -147,20 +139,23 @@ public interface Port extends Line {
 
         /**
          * Indicates whether the port is a source or a target for its mixer.
-         * @return <code>true</code> if the port is a source port (such
-         * as a microphone), <code>false</code> if the port is a target port
-         * (such as a speaker).
+         *
+         * @return {@code true} if the port is a source port (such as a
+         *         microphone), {@code false} if the port is a target port
+         *         (such as a speaker)
          */
         public boolean isSource() {
             return isSource;
         }
 
         /**
-         * Indicates whether this info object specified matches this one.
-         * To match, the match requirements of the superclass must be
-         * met and the types must be equal.
-         * @param info the info object for which the match is queried
+         * Indicates whether this info object specified matches this one. To
+         * match, the match requirements of the superclass must be met and the
+         * types must be equal.
+         *
+         * @param  info the info object for which the match is queried
          */
+        @Override
         public boolean matches(Line.Info info) {
 
             if (! (super.matches(info)) ) {
@@ -178,31 +173,30 @@ public interface Port extends Line {
             return true;
         }
 
-
         /**
-         * Finalizes the equals method
+         * Finalizes the equals method.
          */
+        @Override
         public final boolean equals(Object obj) {
             return super.equals(obj);
         }
 
         /**
-         * Finalizes the hashCode method
+         * Finalizes the hashCode method.
          */
+        @Override
         public final int hashCode() {
             return super.hashCode();
         }
 
-
-
         /**
-         * Provides a <code>String</code> representation
-         * of the port.
-         * @return  a string that describes the port
+         * Provides a {@code String} representation of the port.
+         *
+         * @return a string that describes the port
          */
+        @Override
         public final String toString() {
             return (name + ((isSource == true) ? " source" : " target") + " port");
         }
-
-    } // class Info
+    }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/ReverbType.java b/jdk/src/share/classes/javax/sound/sampled/ReverbType.java
index 7afd7aefe56..e308b0f9402 100644
--- a/jdk/src/share/classes/javax/sound/sampled/ReverbType.java
+++ b/jdk/src/share/classes/javax/sound/sampled/ReverbType.java
@@ -25,46 +25,41 @@
 
 package javax.sound.sampled;
 
-
 /**
- * The <code>ReverbType</code> class provides methods for
- * accessing various reverberation settings to be applied to
- * an audio signal.
+ * The {@code ReverbType} class provides methods for accessing various
+ * reverberation settings to be applied to an audio signal.
  * <p>
- * Reverberation simulates the reflection of sound off of
- * the walls, ceiling, and floor of a room.  Depending on
- * the size of the room, and how absorbent or reflective the materials in the
- * room's surfaces are, the sound might bounce around for a
- * long time before dying away.
+ * Reverberation simulates the reflection of sound off of the walls, ceiling,
+ * and floor of a room. Depending on the size of the room, and how absorbent or
+ * reflective the materials in the room's surfaces are, the sound might bounce
+ * around for a long time before dying away.
  * <p>
- * The reverberation parameters provided by <code>ReverbType</code> consist
- * of the delay time and intensity of early reflections, the delay time and
- * intensity of late reflections, and an overall decay time.
- * Early reflections are the initial individual low-order reflections of the
- * direct signal off the surfaces in the room.
- * The late Reflections are the dense, high-order reflections that characterize
- * the room's reverberation.
- * The delay times for the start of these two reflection types give the listener
- * a sense of the overall size and complexity of the room's shape and contents.
- * The larger the room, the longer the reflection delay times.
- * The early and late reflections' intensities define the gain (in decibels) of the reflected
- * signals as compared to the direct signal.  These intensities give the
- * listener an impression of the absorptive nature of the surfaces and objects
- * in the room.
+ * The reverberation parameters provided by {@code ReverbType} consist of the
+ * delay time and intensity of early reflections, the delay time and intensity
+ * of late reflections, and an overall decay time. Early reflections are the
+ * initial individual low-order reflections of the direct signal off the
+ * surfaces in the room. The late Reflections are the dense, high-order
+ * reflections that characterize the room's reverberation. The delay times for
+ * the start of these two reflection types give the listener a sense of the
+ * overall size and complexity of the room's shape and contents. The larger the
+ * room, the longer the reflection delay times. The early and late reflections'
+ * intensities define the gain (in decibels) of the reflected signals as
+ * compared to the direct signal. These intensities give the listener an
+ * impression of the absorptive nature of the surfaces and objects in the room.
  * The decay time defines how long the reverberation takes to exponentially
- * decay until it is no longer perceptible ("effective zero").
- * The larger and less absorbent the surfaces, the longer the decay time.
+ * decay until it is no longer perceptible ("effective zero"). The larger and
+ * less absorbent the surfaces, the longer the decay time.
  * <p>
- * The set of parameters defined here may not include all aspects of reverberation
- * as specified by some systems.  For example, the Midi Manufacturer's Association
- * (MMA) has an Interactive Audio Special Interest Group (IASIG), which has a
- * 3-D Working Group that has defined a Level 2 Spec (I3DL2).  I3DL2
- * supports filtering of reverberation and
- * control of reverb density.  These properties are not included in the JavaSound 1.0
- * definition of a reverb control.  In such a case, the implementing system
- * should either extend the defined reverb control to include additional
- * parameters, or else interpret the system's additional capabilities in a way that fits
- * the model described here.
+ * The set of parameters defined here may not include all aspects of
+ * reverberation as specified by some systems. For example, the Midi
+ * Manufacturer's Association (MMA) has an Interactive Audio Special Interest
+ * Group (IASIG), which has a 3-D Working Group that has defined a Level 2 Spec
+ * (I3DL2). I3DL2 supports filtering of reverberation and control of reverb
+ * density. These properties are not included in the JavaSound 1.0 definition of
+ * a reverb control. In such a case, the implementing system should either
+ * extend the defined reverb control to include additional parameters, or else
+ * interpret the system's additional capabilities in a way that fits the model
+ * described here.
  * <p>
  * If implementing JavaSound on a I3DL2-compliant device:
  * <ul>
@@ -72,8 +67,8 @@ package javax.sound.sampled;
  * <li>Density parameters are set to midway between minimum and maximum
  * </ul>
  * <p>
- * The following table shows what parameter values an implementation might use for a
- * representative set of reverberation settings.
+ * The following table shows what parameter values an implementation might use
+ * for a representative set of reverberation settings.
  * <p>
  *
  * <b>Reverberation Types and Parameters</b>
@@ -142,7 +137,7 @@ package javax.sound.sampled;
 public class ReverbType {
 
     /**
-     * Descriptive name of the reverb type..
+     * Descriptive name of the reverb type.
      */
     private String name;
 
@@ -167,20 +162,25 @@ public class ReverbType {
     private float lateReflectionIntensity;
 
     /**
-     * Total decay time
+     * Total decay time.
      */
     private int decayTime;
 
-
     /**
      * Constructs a new reverb type that has the specified reverberation
      * parameter values.
-     * @param name the name of the new reverb type, or a zero-length <code>String</code>
-     * @param earlyReflectionDelay the new type's early reflection delay time in microseconds
-     * @param earlyReflectionIntensity the new type's early reflection intensity in dB
-     * @param lateReflectionDelay the new type's late reflection delay time in microseconds
-     * @param lateReflectionIntensity the new type's late reflection intensity in dB
-     * @param decayTime the new type's decay time in microseconds
+     *
+     * @param  name the name of the new reverb type, or a zero-length
+     *         {@code String}
+     * @param  earlyReflectionDelay the new type's early reflection delay time
+     *         in microseconds
+     * @param  earlyReflectionIntensity the new type's early reflection
+     *         intensity in dB
+     * @param  lateReflectionDelay the new type's late reflection delay time in
+     *         microseconds
+     * @param  lateReflectionIntensity the new type's late reflection intensity
+     *         in dB
+     * @param  decayTime the new type's decay time in microseconds
      */
     protected ReverbType(String name, int earlyReflectionDelay, float earlyReflectionIntensity, int lateReflectionDelay, float lateReflectionIntensity, int decayTime) {
 
@@ -192,9 +192,9 @@ public class ReverbType {
         this.decayTime = decayTime;
     }
 
-
     /**
      * Obtains the name of this reverb type.
+     *
      * @return the name of this reverb type
      * @since 1.5
      */
@@ -202,89 +202,88 @@ public class ReverbType {
             return name;
     }
 
-
     /**
-     * Returns the early reflection delay time in microseconds.
-     * This is the amount of time between when the direct signal is
-     * heard and when the first early reflections are heard.
-     * @return  early reflection delay time for this reverb type, in microseconds
+     * Returns the early reflection delay time in microseconds. This is the
+     * amount of time between when the direct signal is heard and when the first
+     * early reflections are heard.
+     *
+     * @return early reflection delay time for this reverb type, in microseconds
      */
     public final int getEarlyReflectionDelay() {
         return earlyReflectionDelay;
     }
 
-
     /**
-     * Returns the early reflection intensity in decibels.
-     * This is the amplitude attenuation of the first early reflections
-     * relative to the direct signal.
-     * @return  early reflection intensity for this reverb type, in dB
+     * Returns the early reflection intensity in decibels. This is the amplitude
+     * attenuation of the first early reflections relative to the direct signal.
+     *
+     * @return early reflection intensity for this reverb type, in dB
      */
     public final float getEarlyReflectionIntensity() {
         return earlyReflectionIntensity;
     }
 
-
     /**
-     * Returns the late reflection delay time in microseconds.
-     * This is the amount of time between when the first early reflections
-     * are heard and when the first late reflections are heard.
-     * @return  late reflection delay time for this reverb type, in microseconds
+     * Returns the late reflection delay time in microseconds. This is the
+     * amount of time between when the first early reflections are heard and
+     * when the first late reflections are heard.
+     *
+     * @return late reflection delay time for this reverb type, in microseconds
      */
     public final int getLateReflectionDelay() {
         return lateReflectionDelay;
     }
 
-
     /**
-     * Returns the late reflection intensity in decibels.
-     * This is the amplitude attenuation of the first late reflections
-     * relative to the direct signal.
-     * @return  late reflection intensity for this reverb type, in dB
+     * Returns the late reflection intensity in decibels. This is the amplitude
+     * attenuation of the first late reflections relative to the direct signal.
+     *
+     * @return late reflection intensity for this reverb type, in dB
      */
     public final float getLateReflectionIntensity() {
         return lateReflectionIntensity;
     }
 
-
     /**
-     * Obtains the decay time, which is the amount of time over which the
-     * late reflections attenuate to effective zero.  The effective zero
-     * value is implementation-dependent.
-     * @return  the decay time of the late reflections, in microseconds
+     * Obtains the decay time, which is the amount of time over which the late
+     * reflections attenuate to effective zero. The effective zero value is
+     * implementation-dependent.
+     *
+     * @return the decay time of the late reflections, in microseconds
      */
     public final int getDecayTime() {
         return decayTime;
     }
 
-
     /**
      * Indicates whether the specified object is equal to this reverb type,
-     * returning <code>true</code> if the objects are identical.
-     * @param obj the reference object with which to compare
-     * @return <code>true</code> if this reverb type is the same as
-     * <code>obj</code>; <code>false</code> otherwise
+     * returning {@code true} if the objects are identical.
+     *
+     * @param  obj the reference object with which to compare
+     * @return {@code true} if this reverb type is the same as {@code obj};
+     *         {@code false} otherwise
      */
+    @Override
     public final boolean equals(Object obj) {
         return super.equals(obj);
     }
 
-
     /**
      * Finalizes the hashcode method.
      */
+    @Override
     public final int hashCode() {
         return super.hashCode();
     }
 
-
     /**
-     * Provides a <code>String</code> representation of the reverb type,
-     * including its name and its parameter settings.
-     * The exact contents of the string may vary between implementations of
-     * Java Sound.
+     * Provides a {@code String} representation of the reverb type, including
+     * its name and its parameter settings. The exact contents of the string may
+     * vary between implementations of Java Sound.
+     *
      * @return reverberation type name and description
      */
+    @Override
     public final String toString() {
 
         //$$fb2001-07-20: fix for bug 4385060: The "name" attribute of class "ReverbType" is not accessible.
@@ -295,5 +294,4 @@ public class ReverbType {
                 " ns, late reflection intensity " + lateReflectionIntensity +
                 " dB, decay time " +  decayTime);
     }
-
-} // class ReverbType
+}
diff --git a/jdk/src/share/classes/javax/sound/sampled/SourceDataLine.java b/jdk/src/share/classes/javax/sound/sampled/SourceDataLine.java
index 5cfbccf2ccd..7749b3a86fc 100644
--- a/jdk/src/share/classes/javax/sound/sampled/SourceDataLine.java
+++ b/jdk/src/share/classes/javax/sound/sampled/SourceDataLine.java
@@ -25,36 +25,35 @@
 
 package javax.sound.sampled;
 
-
 /**
- * A source data line is a data line to which data may be written.  It acts as
- * a source to its mixer. An application writes audio bytes to a source data line,
- * which handles the buffering of the bytes and delivers them to the mixer.
- * The mixer may mix the samples with those from other sources and then deliver
- * the mix to a target such as an output port (which may represent an audio output
+ * A source data line is a data line to which data may be written. It acts as a
+ * source to its mixer. An application writes audio bytes to a source data line,
+ * which handles the buffering of the bytes and delivers them to the mixer. The
+ * mixer may mix the samples with those from other sources and then deliver the
+ * mix to a target such as an output port (which may represent an audio output
  * device on a sound card).
  * <p>
  * Note that the naming convention for this interface reflects the relationship
- * between the line and its mixer.  From the perspective of an application,
- * a source data line may act as a target for audio data.
+ * between the line and its mixer. From the perspective of an application, a
+ * source data line may act as a target for audio data.
  * <p>
  * A source data line can be obtained from a mixer by invoking the
- * <code>{@link Mixer#getLine getLine}</code> method of <code>Mixer</code> with
- * an appropriate <code>{@link DataLine.Info}</code> object.
+ * {@link Mixer#getLine getLine} method of {@code Mixer} with an appropriate
+ * {@link DataLine.Info} object.
  * <p>
- * The <code>SourceDataLine</code> interface provides a method for writing
- * audio data to the data line's buffer. Applications that play or mix
- * audio should write data to the source data line quickly enough to keep the
- * buffer from underflowing (emptying), which could cause discontinuities in
- * the audio that are perceived as clicks.  Applications can use the
- * <code>{@link DataLine#available available}</code> method defined in the
- * <code>DataLine</code> interface to determine the amount of data currently
- * queued in the data line's buffer.  The amount of data which can be written
- * to the buffer without blocking is the difference between the buffer size
- * and the amount of queued data.  If the delivery of audio output
- * stops due to underflow, a <code>{@link LineEvent.Type#STOP STOP}</code> event is
- * generated.  A <code>{@link LineEvent.Type#START START}</code> event is generated
- * when the audio output resumes.
+ * The {@code SourceDataLine} interface provides a method for writing audio data
+ * to the data line's buffer. Applications that play or mix audio should write
+ * data to the source data line quickly enough to keep the buffer from
+ * underflowing (emptying), which could cause discontinuities in the audio that
+ * are perceived as clicks. Applications can use the
+ * {@link DataLine#available available} method defined in the {@code DataLine}
+ * interface to determine the amount of data currently queued in the data line's
+ * buffer. The amount of data which can be written to the buffer without
+ * blocking is the difference between the buffer size and the amount of queued
+ * data. If the delivery of audio output stops due to underflow, a
+ * {@link LineEvent.Type#STOP STOP} event is generated. A
+ * {@link LineEvent.Type#START START} event is generated when the audio output
+ * resumes.
  *
  * @author Kara Kytle
  * @see Mixer
@@ -64,138 +63,130 @@ package javax.sound.sampled;
  */
 public interface SourceDataLine extends DataLine {
 
-
     /**
      * Opens the line with the specified format and suggested buffer size,
-     * causing the line to acquire any required
-     * system resources and become operational.
+     * causing the line to acquire any required system resources and become
+     * operational.
      * <p>
      * The buffer size is specified in bytes, but must represent an integral
-     * number of sample frames.  Invoking this method with a requested buffer
+     * number of sample frames. Invoking this method with a requested buffer
      * size that does not meet this requirement may result in an
-     * IllegalArgumentException.  The actual buffer size for the open line may
-     * differ from the requested buffer size.  The value actually set may be
-     * queried by subsequently calling <code>{@link DataLine#getBufferSize}</code>.
+     * {@code IllegalArgumentException}. The actual buffer size for the open
+     * line may differ from the requested buffer size. The value actually set
+     * may be queried by subsequently calling {@link DataLine#getBufferSize}.
      * <p>
      * If this operation succeeds, the line is marked as open, and an
-     * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
-     * line's listeners.
+     * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+     * listeners.
      * <p>
-     * Invoking this method on a line which is already open is illegal
-     * and may result in an <code>IllegalStateException</code>.
+     * Invoking this method on a line which is already open is illegal and may
+     * result in an {@code IllegalStateException}.
      * <p>
-     * Note that some lines, once closed, cannot be reopened.  Attempts
-     * to reopen such a line will always result in a
-     * <code>LineUnavailableException</code>.
+     * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+     * such a line will always result in a {@code LineUnavailableException}.
      *
-     * @param format the desired audio format
-     * @param bufferSize the desired buffer size
-     * @throws LineUnavailableException if the line cannot be
-     * opened due to resource restrictions
-     * @throws IllegalArgumentException if the buffer size does not represent
-     * an integral number of sample frames,
-     * or if <code>format</code> is not fully specified or invalid
+     * @param  format the desired audio format
+     * @param  bufferSize the desired buffer size
+     * @throws LineUnavailableException if the line cannot be opened due to
+     *         resource restrictions
+     * @throws IllegalArgumentException if the buffer size does not represent an
+     *         integral number of sample frames, or if {@code format} is not
+     *         fully specified or invalid
      * @throws IllegalStateException if the line is already open
-     * @throws SecurityException if the line cannot be
-     * opened due to security restrictions
-     *
+     * @throws SecurityException if the line cannot be opened due to security
+     *         restrictions
      * @see #open(AudioFormat)
      * @see Line#open
      * @see Line#close
      * @see Line#isOpen
      * @see LineEvent
      */
-    public void open(AudioFormat format, int bufferSize) throws LineUnavailableException;
-
+    void open(AudioFormat format, int bufferSize)
+            throws LineUnavailableException;
 
     /**
      * Opens the line with the specified format, causing the line to acquire any
      * required system resources and become operational.
-     *
      * <p>
      * The implementation chooses a buffer size, which is measured in bytes but
-     * which encompasses an integral number of sample frames.  The buffer size
+     * which encompasses an integral number of sample frames. The buffer size
      * that the system has chosen may be queried by subsequently calling
-     * <code>{@link DataLine#getBufferSize}</code>.
+     * {@link DataLine#getBufferSize}.
      * <p>
      * If this operation succeeds, the line is marked as open, and an
-     * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
-     * line's listeners.
+     * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+     * listeners.
      * <p>
-     * Invoking this method on a line which is already open is illegal
-     * and may result in an <code>IllegalStateException</code>.
+     * Invoking this method on a line which is already open is illegal and may
+     * result in an {@code IllegalStateException}.
      * <p>
-     * Note that some lines, once closed, cannot be reopened.  Attempts
-     * to reopen such a line will always result in a
-     * <code>LineUnavailableException</code>.
+     * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+     * such a line will always result in a {@code LineUnavailableException}.
      *
-     * @param format the desired audio format
-     * @throws LineUnavailableException if the line cannot be
-     * opened due to resource restrictions
-     * @throws IllegalArgumentException if <code>format</code>
-     * is not fully specified or invalid
+     * @param  format the desired audio format
+     * @throws LineUnavailableException if the line cannot be opened due to
+     *         resource restrictions
+     * @throws IllegalArgumentException if {@code format} is not fully specified
+     *         or invalid
      * @throws IllegalStateException if the line is already open
-     * @throws SecurityException if the line cannot be
-     * opened due to security restrictions
-     *
+     * @throws SecurityException if the line cannot be opened due to security
+     *         restrictions
      * @see #open(AudioFormat, int)
      * @see Line#open
      * @see Line#close
      * @see Line#isOpen
      * @see LineEvent
      */
-    public void open(AudioFormat format) throws LineUnavailableException;
-
+    void open(AudioFormat format) throws LineUnavailableException;
 
     /**
-     * Writes audio data to the mixer via this source data line.  The requested
-     * number of bytes of data are read from the specified array,
-     * starting at the given offset into the array, and written to the data
-     * line's buffer.  If the caller attempts to write more data than can
-     * currently be written (see <code>{@link DataLine#available available}</code>),
-     * this method blocks until the requested amount of data has been written.
-     * This applies even if the requested amount of data to write is greater
-     * than the data line's buffer size.  However, if the data line is closed,
-     * stopped, or flushed before the requested amount has been written,
-     * the method no longer blocks, but returns the number of bytes
-     * written thus far.
+     * Writes audio data to the mixer via this source data line. The requested
+     * number of bytes of data are read from the specified array, starting at
+     * the given offset into the array, and written to the data line's buffer.
+     * If the caller attempts to write more data than can currently be written
+     * (see {@link DataLine#available available}), this method blocks until the
+     * requested amount of data has been written. This applies even if the
+     * requested amount of data to write is greater than the data line's buffer
+     * size. However, if the data line is closed, stopped, or flushed before the
+     * requested amount has been written, the method no longer blocks, but
+     * returns the number of bytes written thus far.
      * <p>
-     * The number of bytes that can be written without blocking can be ascertained
-     * using the <code>{@link DataLine#available available}</code> method of the
-     * <code>DataLine</code> interface.  (While it is guaranteed that
-     * this number of bytes can be written without blocking, there is no guarantee
-     * that attempts to write additional data will block.)
+     * The number of bytes that can be written without blocking can be
+     * ascertained using the {@link DataLine#available available} method of the
+     * {@code DataLine} interface. (While it is guaranteed that this number of
+     * bytes can be written without blocking, there is no guarantee that
+     * attempts to write additional data will block.)
      * <p>
-     * The number of bytes to write must represent an integral number of
-     * sample frames, such that:
+     * The number of bytes to write must represent an integral number of sample
+     * frames, such that:
      * <br>
-     * <center><code>[ bytes written ] % [frame size in bytes ] == 0</code></center>
+     * <center>{@code [ bytes written ] % [frame size in bytes ] == 0}</center>
      * <br>
-     * The return value will always meet this requirement.  A request to write a
-     * number of bytes representing a non-integral number of sample frames cannot
-     * be fulfilled and may result in an <code>IllegalArgumentException</code>.
+     * The return value will always meet this requirement. A request to write a
+     * number of bytes representing a non-integral number of sample frames
+     * cannot be fulfilled and may result in an
+     * {@code IllegalArgumentException}.
      *
-     * @param b a byte array containing data to be written to the data line
-     * @param len the length, in bytes, of the valid data in the array
-     * (in other words, the requested amount of data to write, in bytes)
-     * @param off the offset from the beginning of the array, in bytes
+     * @param  b a byte array containing data to be written to the data line
+     * @param  len the length, in bytes, of the valid data in the array (in
+     *         other words, the requested amount of data to write, in bytes)
+     * @param  off the offset from the beginning of the array, in bytes
      * @return the number of bytes actually written
      * @throws IllegalArgumentException if the requested number of bytes does
-     * not represent an integral number of sample frames,
-     * or if <code>len</code> is negative
-     * @throws ArrayIndexOutOfBoundsException if <code>off</code> is negative,
-     * or <code>off+len</code> is greater than the length of the array
-     * <code>b</code>.
-     *
+     *         not represent an integral number of sample frames, or if
+     *         {@code len} is negative
+     * @throws ArrayIndexOutOfBoundsException if {@code off} is negative, or
+     *         {@code off+len} is greater than the length of the array {@code b}
      * @see TargetDataLine#read
      * @see DataLine#available
      */
-    public int write(byte[] b, int off, int len);
+    int write(byte[] b, int off, int len);
 
     /**
      * Obtains the number of sample frames of audio data that can be written to
-     * the mixer, via this data line, without blocking.  Note that the return
+     * the mixer, via this data line, without blocking. Note that the return
      * value measures sample frames, not bytes.
+     *
      * @return the number of sample frames currently available for writing
      * @see TargetDataLine#availableRead
      */
diff --git a/jdk/src/share/classes/javax/sound/sampled/TargetDataLine.java b/jdk/src/share/classes/javax/sound/sampled/TargetDataLine.java
index a6f14269240..acacdbcccae 100644
--- a/jdk/src/share/classes/javax/sound/sampled/TargetDataLine.java
+++ b/jdk/src/share/classes/javax/sound/sampled/TargetDataLine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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,29 +26,28 @@
 package javax.sound.sampled;
 
 /**
- * A target data line is a type of <code>{@link DataLine}</code> from which
- * audio data can be read.  The most common example is a data line that gets
- * its data from an audio capture device.  (The device is implemented as a
- * mixer that writes to the target data line.)
+ * A target data line is a type of {@link DataLine} from which audio data can be
+ * read. The most common example is a data line that gets its data from an audio
+ * capture device. (The device is implemented as a mixer that writes to the
+ * target data line.)
  * <p>
  * Note that the naming convention for this interface reflects the relationship
- * between the line and its mixer.  From the perspective of an application,
- * a target data line may act as a source for audio data.
+ * between the line and its mixer. From the perspective of an application, a
+ * target data line may act as a source for audio data.
  * <p>
  * The target data line can be obtained from a mixer by invoking the
- * <code>{@link Mixer#getLine getLine}</code>
- * method of <code>Mixer</code> with an appropriate
- * <code>{@link DataLine.Info}</code> object.
+ * {@link Mixer#getLine getLine} method of {@code Mixer} with an appropriate
+ * {@link DataLine.Info} object.
  * <p>
- * The <code>TargetDataLine</code> interface provides a method for reading the
- * captured data from the target data line's buffer.Applications
- * that record audio should read data from the target data line quickly enough
- * to keep the buffer from overflowing, which could cause discontinuities in
- * the captured data that are perceived as clicks.  Applications can use the
- * <code>{@link DataLine#available available}</code> method defined in the
- * <code>DataLine</code> interface to determine the amount of data currently
- * queued in the data line's buffer.  If the buffer does overflow,
- * the oldest queued data is discarded and replaced by new data.
+ * The {@code TargetDataLine} interface provides a method for reading the
+ * captured data from the target data line's buffer. Applications that record
+ * audio should read data from the target data line quickly enough to keep the
+ * buffer from overflowing, which could cause discontinuities in the captured
+ * data that are perceived as clicks. Applications can use the
+ * {@link DataLine#available available} method defined in the {@code DataLine}
+ * interface to determine the amount of data currently queued in the data line's
+ * buffer. If the buffer does overflow, the oldest queued data is discarded and
+ * replaced by new data.
  *
  * @author Kara Kytle
  * @see Mixer
@@ -58,133 +57,126 @@ package javax.sound.sampled;
  */
 public interface TargetDataLine extends DataLine {
 
-
     /**
      * Opens the line with the specified format and requested buffer size,
      * causing the line to acquire any required system resources and become
      * operational.
      * <p>
      * The buffer size is specified in bytes, but must represent an integral
-     * number of sample frames.  Invoking this method with a requested buffer
+     * number of sample frames. Invoking this method with a requested buffer
      * size that does not meet this requirement may result in an
-     * IllegalArgumentException.  The actual buffer size for the open line may
-     * differ from the requested buffer size.  The value actually set may be
-     * queried by subsequently calling <code>{@link DataLine#getBufferSize}</code>
+     * {@code IllegalArgumentException}. The actual buffer size for the open
+     * line may differ from the requested buffer size. The value actually set
+     * may be queried by subsequently calling {@link DataLine#getBufferSize}
      * <p>
      * If this operation succeeds, the line is marked as open, and an
-     * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
-     * line's listeners.
+     * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+     * listeners.
      * <p>
-     * Invoking this method on a line that is already open is illegal
-     * and may result in an <code>IllegalStateException</code>.
+     * Invoking this method on a line that is already open is illegal and may
+     * result in an {@code IllegalStateException}.
      * <p>
-     * Some lines, once closed, cannot be reopened.  Attempts
-     * to reopen such a line will always result in a
-     * <code>LineUnavailableException</code>.
+     * Some lines, once closed, cannot be reopened. Attempts to reopen such a
+     * line will always result in a {@code LineUnavailableException}.
      *
-     * @param format the desired audio format
-     * @param bufferSize the desired buffer size, in bytes.
-     * @throws LineUnavailableException if the line cannot be
-     * opened due to resource restrictions
-     * @throws IllegalArgumentException if the buffer size does not represent
-     * an integral number of sample frames,
-     * or if <code>format</code> is not fully specified or invalid
+     * @param  format the desired audio format
+     * @param  bufferSize the desired buffer size, in bytes
+     * @throws LineUnavailableException if the line cannot be opened due to
+     *         resource restrictions
+     * @throws IllegalArgumentException if the buffer size does not represent an
+     *         integral number of sample frames, or if {@code format} is not
+     *         fully specified or invalid
      * @throws IllegalStateException if the line is already open
-     * @throws SecurityException if the line cannot be
-     * opened due to security restrictions
-     *
+     * @throws SecurityException if the line cannot be opened due to security
+     *         restrictions
      * @see #open(AudioFormat)
      * @see Line#open
      * @see Line#close
      * @see Line#isOpen
      * @see LineEvent
      */
-    public void open(AudioFormat format, int bufferSize) throws LineUnavailableException;
-
+    void open(AudioFormat format, int bufferSize) throws LineUnavailableException;
 
     /**
      * Opens the line with the specified format, causing the line to acquire any
      * required system resources and become operational.
-     *
      * <p>
      * The implementation chooses a buffer size, which is measured in bytes but
-     * which encompasses an integral number of sample frames.  The buffer size
-     * that the system has chosen may be queried by subsequently calling <code>{@link DataLine#getBufferSize}</code>
+     * which encompasses an integral number of sample frames. The buffer size
+     * that the system has chosen may be queried by subsequently calling
+     * {@link DataLine#getBufferSize}
      * <p>
      * If this operation succeeds, the line is marked as open, and an
-     * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
-     * line's listeners.
+     * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+     * listeners.
      * <p>
-     * Invoking this method on a line that is already open is illegal
-     * and may result in an <code>IllegalStateException</code>.
+     * Invoking this method on a line that is already open is illegal and may
+     * result in an {@code IllegalStateException}.
      * <p>
-     * Some lines, once closed, cannot be reopened.  Attempts
-     * to reopen such a line will always result in a
-     * <code>LineUnavailableException</code>.
+     * Some lines, once closed, cannot be reopened. Attempts to reopen such a
+     * line will always result in a {@code LineUnavailableException}.
      *
-     * @param format the desired audio format
-     * @throws LineUnavailableException if the line cannot be
-     * opened due to resource restrictions
-     * @throws IllegalArgumentException if <code>format</code>
-     * is not fully specified or invalid
+     * @param  format the desired audio format
+     * @throws LineUnavailableException if the line cannot be opened due to
+     *         resource restrictions
+     * @throws IllegalArgumentException if {@code format} is not fully specified
+     *         or invalid
      * @throws IllegalStateException if the line is already open
-     * @throws SecurityException if the line cannot be
-     * opened due to security restrictions
-     *
+     * @throws SecurityException if the line cannot be opened due to security
+     *         restrictions
      * @see #open(AudioFormat, int)
      * @see Line#open
      * @see Line#close
      * @see Line#isOpen
      * @see LineEvent
      */
-    public void open(AudioFormat format) throws LineUnavailableException;
-
+    void open(AudioFormat format) throws LineUnavailableException;
 
     /**
-     * Reads audio data from the data line's input buffer.   The requested
-     * number of bytes is read into the specified array, starting at
-     * the specified offset into the array in bytes.  This method blocks until
-     * the requested amount of data has been read.  However, if the data line
-     * is closed, stopped, drained, or flushed before the requested amount has
-     * been read, the method no longer blocks, but returns the number of bytes
-     * read thus far.
+     * Reads audio data from the data line's input buffer. The requested number
+     * of bytes is read into the specified array, starting at the specified
+     * offset into the array in bytes. This method blocks until the requested
+     * amount of data has been read. However, if the data line is closed,
+     * stopped, drained, or flushed before the requested amount has been read,
+     * the method no longer blocks, but returns the number of bytes read thus
+     * far.
      * <p>
      * The number of bytes that can be read without blocking can be ascertained
-     * using the <code>{@link DataLine#available available}</code> method of the
-     * <code>DataLine</code> interface.  (While it is guaranteed that
-     * this number of bytes can be read without blocking, there is no guarantee
-     * that attempts to read additional data will block.)
+     * using the {@link DataLine#available available} method of the
+     * {@code DataLine} interface. (While it is guaranteed that this number of
+     * bytes can be read without blocking, there is no guarantee that attempts
+     * to read additional data will block.)
      * <p>
      * The number of bytes to be read must represent an integral number of
      * sample frames, such that:
      * <br>
-     * <center><code>[ bytes read ] % [frame size in bytes ] == 0</code></center>
+     * <center>{@code [ bytes read ] % [frame size in bytes ] == 0}</center>
      * <br>
-     * The return value will always meet this requirement.  A request to read a
-     * number of bytes representing a non-integral number of sample frames cannot
-     * be fulfilled and may result in an IllegalArgumentException.
+     * The return value will always meet this requirement. A request to read a
+     * number of bytes representing a non-integral number of sample frames
+     * cannot be fulfilled and may result in an IllegalArgumentException.
      *
-     * @param b a byte array that will contain the requested input data when
-     * this method returns
-     * @param off the offset from the beginning of the array, in bytes
-     * @param len the requested number of bytes to read
+     * @param  b a byte array that will contain the requested input data when
+     *         this method returns
+     * @param  off the offset from the beginning of the array, in bytes
+     * @param  len the requested number of bytes to read
      * @return the number of bytes actually read
      * @throws IllegalArgumentException if the requested number of bytes does
-     * not represent an integral number of sample frames.
-     * or if <code>len</code> is negative.
-     * @throws ArrayIndexOutOfBoundsException if <code>off</code> is negative,
-     * or <code>off+len</code> is greater than the length of the array
-     * <code>b</code>.
+     *         not represent an integral number of sample frames, or if
+     *         {@code len} is negative
+     * @throws ArrayIndexOutOfBoundsException if {@code off} is negative, or
+     *         {@code off+len} is greater than the length of the array {@code b}
      *
      * @see SourceDataLine#write
      * @see DataLine#available
      */
-    public int read(byte[] b, int off, int len);
+    int read(byte[] b, int off, int len);
 
     /**
      * Obtains the number of sample frames of audio data that can be read from
-     * the target data line without blocking.  Note that the return value
+     * the target data line without blocking. Note that the return value
      * measures sample frames, not bytes.
+     *
      * @return the number of sample frames currently available for reading
      * @see SourceDataLine#availableWrite
      */
diff --git a/jdk/src/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java b/jdk/src/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java
index 45acd480f35..31d68160995 100644
--- a/jdk/src/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java
+++ b/jdk/src/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java
@@ -26,33 +26,32 @@
 package javax.sound.sampled;
 
 /**
- * An <code>UnsupportedAudioFileException</code> is an exception indicating that an
- * operation failed because a file did not contain valid data of a recognized file
- * type and format.
+ * An {@code UnsupportedAudioFileException} is an exception indicating that an
+ * operation failed because a file did not contain valid data of a recognized
+ * file type and format.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public class UnsupportedAudioFileException extends Exception {
+
     private static final long serialVersionUID = -139127412623160368L;
 
     /**
-     * Constructs a <code>UnsupportedAudioFileException</code> that has
-     * <code>null</code> as its error detail message.
+     * Constructs a {@code UnsupportedAudioFileException} that has {@code null}
+     * as its error detail message.
      */
     public UnsupportedAudioFileException() {
-
         super();
     }
 
     /**
-     * Constructs a <code>UnsupportedAudioFileException</code> that has
-     * the specified detail message.
+     * Constructs a {@code UnsupportedAudioFileException} that has the specified
+     * detail message.
      *
-     * @param message a string containing the error detail message
+     * @param  message a string containing the error detail message
      */
-    public UnsupportedAudioFileException(String message) {
-
+    public UnsupportedAudioFileException(final String message) {
         super(message);
     }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java
index cc476452126..daa75556785 100644
--- a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java
@@ -108,7 +108,7 @@ public abstract class AudioFileReader {
      * @param  stream the input stream from which the {@code AudioInputStream}
      *         should be constructed
      * @return an {@code AudioInputStream} object based on the audio file data
-     *         contained in the input stream.
+     *         contained in the input stream
      * @throws UnsupportedAudioFileException if the stream does not point to
      *         valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
diff --git a/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java b/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java
index 7693087c9d9..8cb7fb68d5f 100644
--- a/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java
@@ -117,7 +117,7 @@ public abstract class FormatConversionProvider {
      * are supported for this source format, an array of length 0 is returned.
      *
      * @param  sourceFormat format of the incoming data
-     * @return array of supported target format encodings.
+     * @return array of supported target format encodings
      */
     public abstract Encoding[] getTargetEncodings(AudioFormat sourceFormat);
 
@@ -150,7 +150,7 @@ public abstract class FormatConversionProvider {
      *
      * @param  targetEncoding desired encoding of the stream after processing
      * @param  sourceFormat format of the incoming data
-     * @return array of supported target formats.
+     * @return array of supported target formats
      */
     public abstract AudioFormat[] getTargetFormats(Encoding targetEncoding,
                                                    AudioFormat sourceFormat);
@@ -187,7 +187,7 @@ public abstract class FormatConversionProvider {
      * @return stream from which processed data with the specified target
      *         encoding may be read
      * @throws IllegalArgumentException if the format combination supplied is
-     *         not supported.
+     *         not supported
      */
     public abstract AudioInputStream getAudioInputStream(
             Encoding targetEncoding, AudioInputStream sourceStream);
@@ -202,7 +202,7 @@ public abstract class FormatConversionProvider {
      * @return stream from which processed data with the specified format may be
      *         read
      * @throws IllegalArgumentException if the format combination supplied is
-     *         not supported.
+     *         not supported
      */
     public abstract AudioInputStream getAudioInputStream(
             AudioFormat targetFormat, AudioInputStream sourceStream);
-- 
GitLab


From 28f895afc925d1df857a1ea2739b046e643498f2 Mon Sep 17 00:00:00 2001
From: Yuri Nesterenko <yan@openjdk.org>
Date: Wed, 4 Jun 2014 17:24:13 +0400
Subject: [PATCH 044/192] 8044157: [TEST_BUG] Improve recently submitted
 AWT_Mixing tests

Reviewed-by: pchelko
---
 .../java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java   | 5 -----
 .../Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java  | 1 +
 .../AWT_Mixing/HierarchyBoundsListenerMixingTest.java    | 9 ++++-----
 .../Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java   | 2 ++
 .../awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java  | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java | 4 ++++
 .../AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java    | 2 ++
 .../awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java    | 2 ++
 .../AWT_Mixing/JGlassPaneInternalFrameOverlapping.java   | 5 ++++-
 .../awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java | 5 ++++-
 .../Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java | 3 +++
 .../awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java | 3 +++
 .../Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java  | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java    | 2 ++
 .../Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java   | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JListOverlapping.java     | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java  | 5 ++++-
 .../Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java  | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java    | 2 ++
 .../awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java     | 3 +++
 .../AWT_Mixing/JProgressBarInGlassPaneOverlapping.java   | 2 ++
 .../awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java   | 2 ++
 .../AWT_Mixing/JScrollBarInGlassPaneOverlapping.java     | 2 ++
 .../awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java     | 2 ++
 .../awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java    | 3 +++
 .../Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java   | 2 ++
 .../AWT_Mixing/JSpinnerInGlassPaneOverlapping.java       | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java  | 2 ++
 .../awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java     | 5 ++++-
 .../Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java  | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JTableOverlapping.java    | 2 ++
 .../AWT_Mixing/JTextAreaInGlassPaneOverlapping.java      | 2 ++
 .../java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java | 2 ++
 .../AWT_Mixing/JTextFieldInGlassPaneOverlapping.java     | 2 ++
 .../awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java     | 2 ++
 .../AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java  | 2 ++
 .../awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java  | 2 ++
 .../java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java  | 5 ++++-
 .../java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java | 9 ++++++---
 .../java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java    | 3 +++
 .../awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java   | 2 ++
 .../java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java  | 3 ++-
 .../awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java | 1 +
 .../java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java  | 5 ++++-
 46 files changed, 113 insertions(+), 20 deletions(-)

diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java b/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java
index a7380cece35..17f76a6e3d3 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java
@@ -63,11 +63,6 @@ public class FrameBorderCounter {
             public void run() {
                 frame = new Frame("Frame");
                 frame.setBounds(200, 200, 100, 100);
-                frame.addWindowListener(new WindowAdapter() {
-                    public void windowClosing(WindowEvent e) {
-                        System.exit(0);
-                    }
-                });
                 frame.setVisible(true);
             }
         });
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java
index 6b7ba1cc60e..06ffe239a2f 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java
@@ -30,6 +30,7 @@ import java.lang.reflect.InvocationTargetException;
 import javax.swing.JFrame;
 import javax.swing.SpringLayout;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * Base class for testing overlapping of Swing and AWT component put into GlassPane.
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java b/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java
index 13e600b30e5..b9f8cabe239 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java
@@ -76,7 +76,6 @@ public class HierarchyBoundsListenerMixingTest {
             @Override
             public void windowClosing(WindowEvent event) {
                 System.err.println("User closed the window");
-                System.exit(1);
             }
         });
 
@@ -131,7 +130,7 @@ public class HierarchyBoundsListenerMixingTest {
             Thread.sleep(delay * 10);
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException("Robot creation exception.");
         }
 
         robot.mouseMove((int) components[0].getLocationOnScreen().x + components[0].getSize().width / 2,
@@ -595,7 +594,7 @@ class Sysout {
     public static void createDialogWithInstructions(String[] instructions) {
         dialog = new TestDialog(new Frame(), "Instructions");
         dialog.printInstructions(instructions);
-        dialog.setVisible(true);
+        //dialog.setVisible(true);
         println("Any messages for the tester will display here.");
     }
 
@@ -603,7 +602,7 @@ class Sysout {
         dialog = new TestDialog(new Frame(), "Instructions");
         String[] defInstr = {"Instructions will appear here. ", ""};
         dialog.printInstructions(defInstr);
-        dialog.setVisible(true);
+        //dialog.setVisible(true);
         println("Any messages for the tester will display here.");
     }
 
@@ -643,7 +642,7 @@ class TestDialog extends Dialog {
 
         pack();
 
-        setVisible(true);
+        //setVisible(true);
     }// TestDialog()
 
     //DO NOT call this directly, go through Sysout
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java
index 11aef8209bd..867a28b34a3 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JButton
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JButtonInGlassPaneOverlapping
  */
 public class JButtonInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java
index 119c131cc85..42070fa3ee0 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JButton
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JButtonOverlapping
  */
 public class JButtonOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java
index c756041db65..a21633b6b5f 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java
@@ -31,6 +31,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JColorChooser
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JColorChooserOverlapping
  */
 public class JColorChooserOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java
index b0887068a09..8d69f7156f7 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java
@@ -30,6 +30,8 @@ import java.awt.event.ActionListener;
 import javax.swing.BoxLayout;
 import javax.swing.JComboBox;
 import javax.swing.JFrame;
+import test.java.awt.regtesthelpers.Util;
+
 
 /**
  * AWT/Swing overlapping test for {@link javax.swing.JCombobox } component.
@@ -40,6 +42,8 @@ import javax.swing.JFrame;
 @test
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JComboBoxOverlapping
  */
 public class JComboBoxOverlapping extends OverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java
index d14f078aa2d..1c406a808b4 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java
@@ -33,6 +33,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JEditorPaneInGlassPaneOverlapping
  */
 public class JEditorPaneInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java
index 513ca0dce7f..6b0bf6d66ab 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java
@@ -31,6 +31,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JEditorPaneOverlapping
  */
 public class JEditorPaneOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java
index 3e2575375e8..e647875b059 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java
@@ -31,6 +31,7 @@ import java.awt.event.MouseEvent;
 import javax.swing.JFrame;
 import javax.swing.JInternalFrame;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test with JInternalFrame being put in GlassPane.
@@ -43,6 +44,8 @@ import javax.swing.SwingUtilities;
 @bug 6637655 6985776
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JGlassPaneInternalFrameOverlapping
  */
 public class JGlassPaneInternalFrameOverlapping extends OverlappingTestBase {
@@ -63,7 +66,7 @@ public class JGlassPaneInternalFrameOverlapping extends OverlappingTestBase {
             });
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException("Where is internal frame?");
         }
         // run robot
         Robot robot = Util.createRobot();
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java
index 43e060a2438..2103c63f688 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java
@@ -32,6 +32,7 @@ import java.awt.event.MouseEvent;
 import javax.swing.JFrame;
 import javax.swing.JInternalFrame;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test with JInternalFrame being moved in GlassPane.
@@ -44,6 +45,8 @@ import javax.swing.SwingUtilities;
 @bug 6637655 6981919
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JGlassPaneMoveOverlapping
  */
 public class JGlassPaneMoveOverlapping extends OverlappingTestBase {
@@ -70,7 +73,7 @@ public class JGlassPaneMoveOverlapping extends OverlappingTestBase {
             });
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException("Where is internal frame?");
         }
 
         // run robot
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java
index 99a9e015921..78e624323eb 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java
@@ -30,6 +30,7 @@ import javax.swing.JButton;
 import javax.swing.JDesktopPane;
 import javax.swing.JFrame;
 import javax.swing.JInternalFrame;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for {@link javax.swing.JInternalFrame } component during move.
@@ -40,6 +41,8 @@ import javax.swing.JInternalFrame;
 @bug 6985399
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JInternalFrameMoveOverlapping
  */
 public class JInternalFrameMoveOverlapping extends OverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java
index 320a82adcce..17e3165e01c 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java
@@ -30,6 +30,7 @@ import javax.swing.JButton;
 import javax.swing.JDesktopPane;
 import javax.swing.JFrame;
 import javax.swing.JInternalFrame;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for {@link javax.swing.JInternalFrame } component.
@@ -39,6 +40,8 @@ import javax.swing.JInternalFrame;
 @test
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JInternalFrameOverlapping
  */
 public class JInternalFrameOverlapping extends OverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java
index bdde7409344..a469774db82 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java
@@ -33,6 +33,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JLabelInGlassPaneOverlapping
  */
 public class JLabelInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java
index e6038bc8038..658a99db561 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JLabelOverlapping
  */
 public class JLabelOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java
index 4a2e1419bae..5a9123f5020 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JList
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JListInGlassPaneOverlapping
  */
 public class JListInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java
index 76ee46ccbfa..bed4a98503a 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java
@@ -31,6 +31,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JList
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JListOverlapping
  */
 public class JListOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java
index 5ae75bd55b7..b6816fb877b 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java
@@ -36,6 +36,7 @@ import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
 import javax.swing.JSeparator;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for {@link javax.swing.JMenuBar } and {@link javax.swing.JSeparator} components.
@@ -46,6 +47,8 @@ import javax.swing.SwingUtilities;
 @test
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JMenuBarOverlapping
  */
 public class JMenuBarOverlapping extends OverlappingTestBase {
@@ -132,7 +135,7 @@ public class JMenuBarOverlapping extends OverlappingTestBase {
             });
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException("Where is separator?");
         }
         sepLoc.translate(20, 1);
         clickAndBlink(robot, sepLoc, false);
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java
index 189a17b000f..078557831a9 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java
@@ -33,6 +33,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JPanel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JPanelInGlassPaneOverlapping
  */
 public class JPanelInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java
index 5decd49d461..a8ca9e67baf 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JPanel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JPanelOverlapping
  */
 public class JPanelOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java
index fead4e441fd..ba72f755360 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java
@@ -33,6 +33,7 @@ import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
 import javax.swing.SpringLayout;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for {@link javax.swing.JPopupMenu } component.
@@ -43,6 +44,8 @@ import javax.swing.SwingUtilities;
 @test
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JPopupMenuOverlapping
  */
 public class JPopupMenuOverlapping extends OverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java
index 1f60eefe5d6..be104e1fed1 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java
@@ -33,6 +33,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JProgressBar
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JProgressBarInGlassPaneOverlapping
  */
 public class JProgressBarInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java
index 3db75cc6e4d..c1c9aab77a2 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JProgressBar
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JProgressBarOverlapping
  */
 public class JProgressBarOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java
index a12a6f8b5af..33d1a483998 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java
@@ -36,6 +36,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JScrollBar
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JScrollBarInGlassPaneOverlapping
  */
 public class JScrollBarInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java
index 9a3dd8e0a8a..8271f5b272a 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java
@@ -35,6 +35,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JScrollBar
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JScrollBarOverlapping
  */
 public class JScrollBarOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java
index d4ae51d38e4..f7205cec299 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java
@@ -32,6 +32,7 @@ import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for {@link javax.swing.JScrollPane } component.
@@ -41,6 +42,8 @@ import javax.swing.SwingUtilities;
 @test
 @summary Overlapping test for javax.swing.JScrollPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JScrollPaneOverlapping
  */
 public class JScrollPaneOverlapping extends OverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java
index 8cdafc17903..ece5ea80537 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java
@@ -33,6 +33,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JSlider
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JSliderInGlassPaneOverlapping
  */
 public class JSliderInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java
index f6553db0311..bf28c046d7a 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JSlider
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JSliderOverlapping
  */
 public class JSliderOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java
index 1c60597c5a2..805f111d4cf 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java
@@ -35,6 +35,8 @@ import javax.swing.event.ChangeListener;
 @test
 @summary Simple Overlapping test for javax.swing.JSpinner
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JSpinnerInGlassPaneOverlapping
  */
 public class JSpinnerInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java
index 90e4e5b85e9..be06e8bc670 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java
@@ -34,6 +34,8 @@ import javax.swing.event.ChangeListener;
 @test
 @summary Simple Overlapping test for javax.swing.JSpinner
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JSpinnerOverlapping
  */
 public class JSpinnerOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java
index c4f2265824a..2af8101ef97 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java
@@ -36,6 +36,7 @@ import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.JSplitPane;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for {@link javax.swing.JSplitPane } component.
@@ -47,6 +48,8 @@ import javax.swing.SwingUtilities;
 @bug 6986109
 @summary Overlapping test for javax.swing.JSplitPane
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JSplitPaneOverlapping
  */
 public class JSplitPaneOverlapping extends OverlappingTestBase {
@@ -99,7 +102,7 @@ public class JSplitPaneOverlapping extends OverlappingTestBase {
             });
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException("Where is splitter?");
         }
         // run robot
         Robot robot = Util.createRobot();
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java
index af4803b9c50..634d707857c 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java
@@ -35,6 +35,8 @@ import javax.swing.event.TableModelListener;
 @test
 @summary Simple Overlapping test for JTable
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JTableInGlassPaneOverlapping
  */
 public class JTableInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java
index d96732feedc..bea7c6bcf88 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java
@@ -31,6 +31,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for JTable
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JTableOverlapping
  */
 public class JTableOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java
index dba86e2747f..7b7fb405af9 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java
@@ -33,6 +33,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JTextAreaInGlassPaneOverlapping
  */
 public class JTextAreaInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java
index 51f2b5ffddb..683e47f9f6c 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JTextAreaOverlapping
  */
 public class JTextAreaOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java
index d6dd69436ea..0f58c9cbd40 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java
@@ -33,6 +33,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JTextFieldInGlassPaneOverlapping
  */
 public class JTextFieldInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java
index ffaecdcb589..01f71df838f 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JLabel
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JTextFieldOverlapping
  */
 public class JTextFieldOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java
index 3c4a62d9f50..33657f2c9ca 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java
@@ -32,6 +32,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JToggleButton
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JToggleButtonInGlassPaneOverlapping
  */
 public class JToggleButtonInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java
index 3b311d71e10..0ca9aee2597 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java
@@ -31,6 +31,8 @@ import javax.swing.*;
 @test
 @summary Simple Overlapping test for javax.swing.JToggleButton
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main JToggleButtonOverlapping
  */
 public class JToggleButtonOverlapping extends SimpleOverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java
index fd15ca1dc85..dbb01bb8047 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java
@@ -29,6 +29,7 @@ import java.awt.event.InputEvent;
 import javax.swing.JFrame;
 import javax.swing.SpringLayout;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test.
@@ -40,6 +41,8 @@ import javax.swing.SwingUtilities;
 @bug 6777370
 @summary Issues when resizing the JFrame with HW components
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main MixingFrameResizing
  */
 public class MixingFrameResizing extends OverlappingTestBase {
@@ -77,7 +80,7 @@ public class MixingFrameResizing extends OverlappingTestBase {
             });
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException("Where is frame?");
         }
         Robot robot = Util.createRobot();
         robot.setAutoDelay(ROBOT_DELAY/2);
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java
index d7e46b9ffc6..4b94b4f5f0c 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java
@@ -26,6 +26,7 @@ import java.awt.*;
 import java.awt.event.InputEvent;
 import javax.swing.*;
 import java.io.*;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for Panel and JPanel behavior during resizing.
@@ -36,6 +37,8 @@ import java.io.*;
 @bug 6786219
 @summary Issues when resizing the frame after mixing of heavy weight & light weight components
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @build FrameBorderCounter
 @run main MixingPanelsResizing
  */
@@ -365,7 +368,7 @@ class Sysout {
     public static void createDialogWithInstructions(String[] instructions) {
         dialog = new TestDialog(new Frame(), "Instructions");
         dialog.printInstructions(instructions);
-        dialog.setVisible(true);
+        //dialog.setVisible(true);
         println("Any messages for the tester will display here.");
     }
 
@@ -373,7 +376,7 @@ class Sysout {
         dialog = new TestDialog(new Frame(), "Instructions");
         String[] defInstr = {"Instructions will appear here. ", ""};
         dialog.printInstructions(defInstr);
-        dialog.setVisible(true);
+        //dialog.setVisible(true);
         println("Any messages for the tester will display here.");
     }
 
@@ -413,7 +416,7 @@ class TestDialog extends Dialog {
 
         pack();
 
-        setVisible(true);
+        //setVisible(true);
     }// TestDialog()
 
     //DO NOT call this directly, go through Sysout
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java
index fcfd9ce12be..d0e2f8f77c4 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java
@@ -33,6 +33,7 @@ import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import javax.swing.JButton;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for opaque Swing components.
@@ -44,6 +45,8 @@ import javax.swing.SwingUtilities;
 @test
 @bug 6776743
 @summary Opaque overlapping test for each AWT component
+@library ../../regtesthelpers
+@build Util
 @run main OpaqueOverlapping
  */
 public class OpaqueOverlapping extends OverlappingTestBase {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java
index 896b096b4bb..fa4b103159b 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java
@@ -31,6 +31,8 @@
 @test
 @bug 6994264
 @summary Opaque overlapping test for Choice AWT component
+@library ../../regtesthelpers
+@build Util
 @run main OpaqueOverlappingChoice
  */
 public class OpaqueOverlappingChoice extends OpaqueOverlapping  {
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java
index f3730b89302..fd72ddac80f 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java
@@ -31,6 +31,7 @@ import java.util.ArrayList;
 import javax.swing.*;
 import sun.awt.*;
 import java.io.*;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * <p>This class provides basis for AWT Mixing testing.
@@ -131,7 +132,7 @@ public abstract class OverlappingTestBase {
                 isFrameBorderCalculated = true;
             } catch (IOException e) {
                 e.printStackTrace();
-                System.exit(1);
+                throw new RuntimeException("Problem calculating a native border size");
             }
         }
         return borderShift;
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java
index 4d81127a772..fb79a0a2ba7 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java
@@ -24,6 +24,7 @@
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * Base class for testing overlapping of Swing and AWT component put into one frame.
diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java
index 22e1e7730cd..923bb8a5707 100644
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java
@@ -37,6 +37,7 @@ import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
 
 /**
  * AWT/Swing overlapping test for viewport
@@ -49,6 +50,8 @@ import javax.swing.SwingUtilities;
 @bug 6778882
 @summary Viewport overlapping test for each AWT component
 @author sergey.grinev@oracle.com: area=awt.mixing
+@library ../../regtesthelpers
+@build Util
 @run main ViewportOverlapping
  */
 public class ViewportOverlapping extends OverlappingTestBase {
@@ -116,7 +119,7 @@ public class ViewportOverlapping extends OverlappingTestBase {
             });
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException("Problem preparing test GUI.");
         }
         // run robot
         Robot robot = Util.createRobot();
-- 
GitLab


From fc858b5c962152c0b007eb357b2780dc0e7c0119 Mon Sep 17 00:00:00 2001
From: Henry Jen <henryjen@openjdk.org>
Date: Thu, 5 Jun 2014 10:37:24 -0700
Subject: [PATCH 045/192] 8044855: Add missing @since tag under java.beans.*

Reviewed-by: prr, malenkov
---
 jdk/src/share/classes/java/beans/BeanDescriptor.java     | 2 ++
 jdk/src/share/classes/java/beans/BeanInfo.java           | 2 ++
 jdk/src/share/classes/java/beans/Beans.java              | 4 ++++
 jdk/src/share/classes/java/beans/Customizer.java         | 2 ++
 jdk/src/share/classes/java/beans/EventSetDescriptor.java | 2 ++
 jdk/src/share/classes/java/beans/FeatureDescriptor.java  | 4 ++++
 .../classes/java/beans/IndexedPropertyDescriptor.java    | 6 ++++++
 .../share/classes/java/beans/IntrospectionException.java | 2 ++
 jdk/src/share/classes/java/beans/Introspector.java       | 9 +++++++++
 jdk/src/share/classes/java/beans/MethodDescriptor.java   | 2 ++
 .../share/classes/java/beans/ParameterDescriptor.java    | 2 ++
 .../share/classes/java/beans/PropertyChangeEvent.java    | 2 ++
 .../share/classes/java/beans/PropertyChangeListener.java | 1 +
 .../share/classes/java/beans/PropertyChangeSupport.java  | 7 +++++++
 jdk/src/share/classes/java/beans/PropertyDescriptor.java | 3 +++
 jdk/src/share/classes/java/beans/PropertyEditor.java     | 2 ++
 .../share/classes/java/beans/PropertyEditorManager.java  | 2 ++
 .../share/classes/java/beans/PropertyEditorSupport.java  | 2 ++
 .../share/classes/java/beans/PropertyVetoException.java  | 1 +
 jdk/src/share/classes/java/beans/SimpleBeanInfo.java     | 2 ++
 .../share/classes/java/beans/VetoableChangeListener.java | 1 +
 .../share/classes/java/beans/VetoableChangeSupport.java  | 7 +++++++
 jdk/src/share/classes/java/beans/Visibility.java         | 2 ++
 23 files changed, 69 insertions(+)

diff --git a/jdk/src/share/classes/java/beans/BeanDescriptor.java b/jdk/src/share/classes/java/beans/BeanDescriptor.java
index fee54153bd3..10912ed7f4d 100644
--- a/jdk/src/share/classes/java/beans/BeanDescriptor.java
+++ b/jdk/src/share/classes/java/beans/BeanDescriptor.java
@@ -33,6 +33,8 @@ import java.lang.ref.Reference;
  * <p>
  * This is one of the kinds of descriptor returned by a BeanInfo object,
  * which also returns descriptors for properties, method, and events.
+ *
+ * @since 1.1
  */
 
 public class BeanDescriptor extends FeatureDescriptor {
diff --git a/jdk/src/share/classes/java/beans/BeanInfo.java b/jdk/src/share/classes/java/beans/BeanInfo.java
index bb43f2fd4e8..92be1eb81a4 100644
--- a/jdk/src/share/classes/java/beans/BeanInfo.java
+++ b/jdk/src/share/classes/java/beans/BeanInfo.java
@@ -48,6 +48,8 @@ import java.awt.Image;
  * the {@code SimpleBeanInfo} class to define specific information.
  * <p>
  * See also the {@link Introspector} class to learn more about bean behavior.
+ *
+ * @since 1.1
  */
 public interface BeanInfo {
 
diff --git a/jdk/src/share/classes/java/beans/Beans.java b/jdk/src/share/classes/java/beans/Beans.java
index 5bf13fa7d09..cd864899ea6 100644
--- a/jdk/src/share/classes/java/beans/Beans.java
+++ b/jdk/src/share/classes/java/beans/Beans.java
@@ -56,6 +56,8 @@ import java.util.Vector;
 
 /**
  * This class provides some general purpose beans control methods.
+ *
+ * @since 1.1
  */
 
 public class Beans {
@@ -96,6 +98,7 @@ public class Beans {
      * @exception ClassNotFoundException if the class of a serialized
      *              object could not be found.
      * @exception IOException if an I/O error occurs.
+     * @since 1.2
      */
 
     public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException {
@@ -152,6 +155,7 @@ public class Beans {
      * @exception ClassNotFoundException if the class of a serialized
      *              object could not be found.
      * @exception IOException if an I/O error occurs.
+     * @since 1.2
      */
 
     public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
diff --git a/jdk/src/share/classes/java/beans/Customizer.java b/jdk/src/share/classes/java/beans/Customizer.java
index 07d70631e78..5dcd03b0b5a 100644
--- a/jdk/src/share/classes/java/beans/Customizer.java
+++ b/jdk/src/share/classes/java/beans/Customizer.java
@@ -33,6 +33,8 @@ package java.beans;
  * it can be instantiated inside an AWT dialog or panel.
  * <P>
  * Each customizer should have a null constructor.
+ *
+ * @since 1.1
  */
 
 public interface Customizer {
diff --git a/jdk/src/share/classes/java/beans/EventSetDescriptor.java b/jdk/src/share/classes/java/beans/EventSetDescriptor.java
index ca8dbadb04e..d05d2f79375 100644
--- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java
+++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java
@@ -36,6 +36,8 @@ import java.lang.reflect.Modifier;
  * The given group of events are all delivered as method calls on a single
  * event listener interface, and an event listener object can be registered
  * via a call on a registration method supplied by the event source.
+ *
+ * @since 1.1
  */
 public class EventSetDescriptor extends FeatureDescriptor {
 
diff --git a/jdk/src/share/classes/java/beans/FeatureDescriptor.java b/jdk/src/share/classes/java/beans/FeatureDescriptor.java
index 75f06f33fc2..6a82de9f971 100644
--- a/jdk/src/share/classes/java/beans/FeatureDescriptor.java
+++ b/jdk/src/share/classes/java/beans/FeatureDescriptor.java
@@ -46,6 +46,8 @@ import java.util.Map.Entry;
  * <p>
  * In addition it provides an extension mechanism so that arbitrary
  * attribute/value pairs can be associated with a design feature.
+ *
+ * @since 1.1
  */
 
 public class FeatureDescriptor {
@@ -145,6 +147,7 @@ public class FeatureDescriptor {
      * important for presenting to humans.
      *
      * @return True if this feature should be preferentially shown to human users.
+     * @since 1.2
      */
     public boolean isPreferred() {
         return preferred;
@@ -156,6 +159,7 @@ public class FeatureDescriptor {
      *
      * @param preferred  True if this feature should be preferentially shown
      *                   to human users.
+     * @since 1.2
      */
     public void setPreferred(boolean preferred) {
         this.preferred = preferred;
diff --git a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
index 84f20ee4a1a..9449421eae2 100644
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
@@ -36,6 +36,8 @@ import java.lang.reflect.Method;
  * An indexed property may also provide simple non-indexed read and write
  * methods.  If these are present, they read and write arrays of the type
  * returned by the indexed read method.
+ *
+ * @since 1.1
  */
 
 public class IndexedPropertyDescriptor extends PropertyDescriptor {
@@ -209,6 +211,8 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
      * @param readMethod The new indexed read method.
      * @throws IntrospectionException if an exception occurs during
      * introspection.
+     *
+     * @since 1.2
      */
     public synchronized void setIndexedReadMethod(Method readMethod)
         throws IntrospectionException {
@@ -288,6 +292,8 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
      * @param writeMethod The new indexed write method.
      * @throws IntrospectionException if an exception occurs during
      * introspection.
+     *
+     * @since 1.2
      */
     public synchronized void setIndexedWriteMethod(Method writeMethod)
         throws IntrospectionException {
diff --git a/jdk/src/share/classes/java/beans/IntrospectionException.java b/jdk/src/share/classes/java/beans/IntrospectionException.java
index c9cf2eeb44b..432ba99e93b 100644
--- a/jdk/src/share/classes/java/beans/IntrospectionException.java
+++ b/jdk/src/share/classes/java/beans/IntrospectionException.java
@@ -32,6 +32,8 @@ package java.beans;
  * to a Class object, not being able to resolve a string method name,
  * or specifying a method name that has the wrong type signature for
  * its intended use.
+ *
+ * @since 1.1
  */
 
 public
diff --git a/jdk/src/share/classes/java/beans/Introspector.java b/jdk/src/share/classes/java/beans/Introspector.java
index 469238a601e..44bddc6a9c5 100644
--- a/jdk/src/share/classes/java/beans/Introspector.java
+++ b/jdk/src/share/classes/java/beans/Introspector.java
@@ -90,6 +90,8 @@ import sun.reflect.misc.ReflectUtil;
  * For more information about introspection and design patterns, please
  * consult the
  *  <a href="http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html">JavaBeans&trade; specification</a>.
+ *
+ * @since 1.1
  */
 
 public class Introspector {
@@ -97,14 +99,17 @@ public class Introspector {
     // Flags that can be used to control getBeanInfo:
     /**
      * Flag to indicate to use of all beaninfo.
+     * @since 1.2
      */
     public final static int USE_ALL_BEANINFO           = 1;
     /**
      * Flag to indicate to ignore immediate beaninfo.
+     * @since 1.2
      */
     public final static int IGNORE_IMMEDIATE_BEANINFO  = 2;
     /**
      * Flag to indicate to ignore all beaninfo.
+     * @since 1.2
      */
     public final static int IGNORE_ALL_BEANINFO        = 3;
 
@@ -214,6 +219,7 @@ public class Introspector {
      * @return  A BeanInfo object describing the target bean.
      * @exception IntrospectionException if an exception occurs during
      *              introspection.
+     * @since 1.2
      */
     public static BeanInfo getBeanInfo(Class<?> beanClass, int flags)
                                                 throws IntrospectionException {
@@ -354,6 +360,8 @@ public class Introspector {
      * not normally required.  It is normally only needed by advanced
      * tools that update existing "Class" objects in-place and need
      * to make the Introspector re-analyze existing Class objects.
+     *
+     * @since 1.2
      */
 
     public static void flushCaches() {
@@ -377,6 +385,7 @@ public class Introspector {
      *
      * @param clz  Class object to be flushed.
      * @throws NullPointerException If the Class object is null.
+     * @since 1.2
      */
     public static void flushFromCaches(Class<?> clz) {
         if (clz == null) {
diff --git a/jdk/src/share/classes/java/beans/MethodDescriptor.java b/jdk/src/share/classes/java/beans/MethodDescriptor.java
index 1e169046746..ca295be74dc 100644
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java
@@ -34,6 +34,8 @@ import java.util.ArrayList;
 /**
  * A MethodDescriptor describes a particular method that a Java Bean
  * supports for external access from other components.
+ *
+ * @since 1.1
  */
 
 public class MethodDescriptor extends FeatureDescriptor {
diff --git a/jdk/src/share/classes/java/beans/ParameterDescriptor.java b/jdk/src/share/classes/java/beans/ParameterDescriptor.java
index 3b7013f4ad0..243df016ea0 100644
--- a/jdk/src/share/classes/java/beans/ParameterDescriptor.java
+++ b/jdk/src/share/classes/java/beans/ParameterDescriptor.java
@@ -32,6 +32,8 @@ package java.beans;
  * class.
  * <p>
  * Currently all our state comes from the FeatureDescriptor base class.
+ *
+ * @since 1.1
  */
 
 public class ParameterDescriptor extends FeatureDescriptor {
diff --git a/jdk/src/share/classes/java/beans/PropertyChangeEvent.java b/jdk/src/share/classes/java/beans/PropertyChangeEvent.java
index eeaa6512730..ec7d8ed51c0 100644
--- a/jdk/src/share/classes/java/beans/PropertyChangeEvent.java
+++ b/jdk/src/share/classes/java/beans/PropertyChangeEvent.java
@@ -43,6 +43,8 @@ import java.util.EventObject;
  * An event source may send a null object as the name to indicate that an
  * arbitrary set of if its properties have changed.  In this case the
  * old and new values should also be null.
+ *
+ * @since 1.1
  */
 public class PropertyChangeEvent extends EventObject {
     private static final long serialVersionUID = 7042693688939648123L;
diff --git a/jdk/src/share/classes/java/beans/PropertyChangeListener.java b/jdk/src/share/classes/java/beans/PropertyChangeListener.java
index 5b78d482439..70d50a85caf 100644
--- a/jdk/src/share/classes/java/beans/PropertyChangeListener.java
+++ b/jdk/src/share/classes/java/beans/PropertyChangeListener.java
@@ -29,6 +29,7 @@ package java.beans;
  * A "PropertyChange" event gets fired whenever a bean changes a "bound"
  * property.  You can register a PropertyChangeListener with a source
  * bean so as to be notified of any bound property updates.
+ * @since 1.1
  */
 
 public interface PropertyChangeListener extends java.util.EventListener {
diff --git a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java
index d55ae76efc8..40e58ae1e5d 100644
--- a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java
+++ b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java
@@ -77,6 +77,7 @@ import java.util.Map.Entry;
  * non-serializable listeners will be skipped during serialization.
  *
  * @see VetoableChangeSupport
+ * @since 1.1
  */
 public class PropertyChangeSupport implements Serializable {
     private PropertyChangeListenerMap map = new PropertyChangeListenerMap();
@@ -191,6 +192,7 @@ public class PropertyChangeSupport implements Serializable {
      *
      * @param propertyName  The name of the property to listen on.
      * @param listener  The PropertyChangeListener to be added
+     * @since 1.2
      */
     public void addPropertyChangeListener(
                 String propertyName,
@@ -216,6 +218,7 @@ public class PropertyChangeSupport implements Serializable {
      *
      * @param propertyName  The name of the property that was listened on.
      * @param listener  The PropertyChangeListener to be removed
+     * @since 1.2
      */
     public void removePropertyChangeListener(
                 String propertyName,
@@ -277,6 +280,7 @@ public class PropertyChangeSupport implements Serializable {
      * @param propertyName  the programmatic name of the property that was changed
      * @param oldValue      the old value of the property
      * @param newValue      the new value of the property
+     * @since 1.2
      */
     public void firePropertyChange(String propertyName, int oldValue, int newValue) {
         if (oldValue != newValue) {
@@ -297,6 +301,7 @@ public class PropertyChangeSupport implements Serializable {
      * @param propertyName  the programmatic name of the property that was changed
      * @param oldValue      the old value of the property
      * @param newValue      the new value of the property
+     * @since 1.2
      */
     public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
         if (oldValue != newValue) {
@@ -312,6 +317,7 @@ public class PropertyChangeSupport implements Serializable {
      * No event is fired if the given event's old and new values are equal and non-null.
      *
      * @param event  the {@code PropertyChangeEvent} to be fired
+     * @since 1.2
      */
     public void firePropertyChange(PropertyChangeEvent event) {
         Object oldValue = event.getOldValue();
@@ -410,6 +416,7 @@ public class PropertyChangeSupport implements Serializable {
      *
      * @param propertyName  the property name.
      * @return true if there are one or more listeners for the given property
+     * @since 1.2
      */
     public boolean hasListeners(String propertyName) {
         return this.map.hasListeners(propertyName);
diff --git a/jdk/src/share/classes/java/beans/PropertyDescriptor.java b/jdk/src/share/classes/java/beans/PropertyDescriptor.java
index fb0b349c000..9f26590418f 100644
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java
@@ -32,6 +32,7 @@ import java.lang.reflect.Constructor;
 /**
  * A PropertyDescriptor describes one property that a Java Bean
  * exports via a pair of accessor methods.
+ * @since 1.1
  */
 public class PropertyDescriptor extends FeatureDescriptor {
 
@@ -244,6 +245,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
      *
      * @param readMethod The new read method.
      * @throws IntrospectionException if the read method is invalid
+     * @since 1.2
      */
     public synchronized void setReadMethod(Method readMethod)
                                 throws IntrospectionException {
@@ -314,6 +316,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
      *
      * @param writeMethod The new write method.
      * @throws IntrospectionException if the write method is invalid
+     * @since 1.2
      */
     public synchronized void setWriteMethod(Method writeMethod)
                                 throws IntrospectionException {
diff --git a/jdk/src/share/classes/java/beans/PropertyEditor.java b/jdk/src/share/classes/java/beans/PropertyEditor.java
index 041cb805d9e..69ad2c04074 100644
--- a/jdk/src/share/classes/java/beans/PropertyEditor.java
+++ b/jdk/src/share/classes/java/beans/PropertyEditor.java
@@ -51,6 +51,8 @@ package java.beans;
  * or support setAsText.
  * <p>
  * Each PropertyEditor should have a null constructor.
+ *
+ * @since 1.1
  */
 
 public interface PropertyEditor {
diff --git a/jdk/src/share/classes/java/beans/PropertyEditorManager.java b/jdk/src/share/classes/java/beans/PropertyEditorManager.java
index 46ec87de944..ae664b8c4cc 100644
--- a/jdk/src/share/classes/java/beans/PropertyEditorManager.java
+++ b/jdk/src/share/classes/java/beans/PropertyEditorManager.java
@@ -48,6 +48,8 @@ package java.beans;
  * Default PropertyEditors will be provided for the Java primitive types
  * "boolean", "byte", "short", "int", "long", "float", and "double"; and
  * for the classes java.lang.String. java.awt.Color, and java.awt.Font.
+ *
+ * @since 1.1
  */
 
 public class PropertyEditorManager {
diff --git a/jdk/src/share/classes/java/beans/PropertyEditorSupport.java b/jdk/src/share/classes/java/beans/PropertyEditorSupport.java
index 1569c652e97..cfc350fbb20 100644
--- a/jdk/src/share/classes/java/beans/PropertyEditorSupport.java
+++ b/jdk/src/share/classes/java/beans/PropertyEditorSupport.java
@@ -31,6 +31,8 @@ import java.beans.*;
  * This is a support class to help build property editors.
  * <p>
  * It can be used either as a base class or as a delegate.
+ *
+ * @since 1.1
  */
 
 public class PropertyEditorSupport implements PropertyEditor {
diff --git a/jdk/src/share/classes/java/beans/PropertyVetoException.java b/jdk/src/share/classes/java/beans/PropertyVetoException.java
index 27a2f82f341..86220b18785 100644
--- a/jdk/src/share/classes/java/beans/PropertyVetoException.java
+++ b/jdk/src/share/classes/java/beans/PropertyVetoException.java
@@ -29,6 +29,7 @@ package java.beans;
 /**
  * A PropertyVetoException is thrown when a proposed change to a
  * property represents an unacceptable value.
+ * @since 1.1
  */
 
 public
diff --git a/jdk/src/share/classes/java/beans/SimpleBeanInfo.java b/jdk/src/share/classes/java/beans/SimpleBeanInfo.java
index 29fd9cc4b5a..7b97e414ebb 100644
--- a/jdk/src/share/classes/java/beans/SimpleBeanInfo.java
+++ b/jdk/src/share/classes/java/beans/SimpleBeanInfo.java
@@ -34,6 +34,8 @@ package java.beans;
  * When the introspector sees the "noop" values, it will apply low
  * level introspection and design patterns to automatically analyze
  * the target bean.
+ *
+ * @since 1.1
  */
 
 public class SimpleBeanInfo implements BeanInfo {
diff --git a/jdk/src/share/classes/java/beans/VetoableChangeListener.java b/jdk/src/share/classes/java/beans/VetoableChangeListener.java
index 898fd82fb4b..9edc175375d 100644
--- a/jdk/src/share/classes/java/beans/VetoableChangeListener.java
+++ b/jdk/src/share/classes/java/beans/VetoableChangeListener.java
@@ -29,6 +29,7 @@ package java.beans;
  * A VetoableChange event gets fired whenever a bean changes a "constrained"
  * property.  You can register a VetoableChangeListener with a source bean
  * so as to be notified of any constrained property updates.
+ * @since 1.1
  */
 public interface VetoableChangeListener extends java.util.EventListener {
     /**
diff --git a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java
index 293ae5af2c6..14902cc6276 100644
--- a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java
+++ b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java
@@ -77,6 +77,7 @@ import java.util.Map.Entry;
  * non-serializable listeners will be skipped during serialization.
  *
  * @see PropertyChangeSupport
+ * @since 1.1
  */
 public class VetoableChangeSupport implements Serializable {
     private VetoableChangeListenerMap map = new VetoableChangeListenerMap();
@@ -191,6 +192,7 @@ public class VetoableChangeSupport implements Serializable {
      *
      * @param propertyName  The name of the property to listen on.
      * @param listener  The VetoableChangeListener to be added
+     * @since 1.2
      */
     public void addVetoableChangeListener(
                                 String propertyName,
@@ -216,6 +218,7 @@ public class VetoableChangeSupport implements Serializable {
      *
      * @param propertyName  The name of the property that was listened on.
      * @param listener  The VetoableChangeListener to be removed
+     * @since 1.2
      */
     public void removeVetoableChangeListener(
                                 String propertyName,
@@ -292,6 +295,7 @@ public class VetoableChangeSupport implements Serializable {
      * @param oldValue      the old value of the property
      * @param newValue      the new value of the property
      * @throws PropertyVetoException if one of listeners vetoes the property update
+     * @since 1.2
      */
     public void fireVetoableChange(String propertyName, int oldValue, int newValue)
             throws PropertyVetoException {
@@ -320,6 +324,7 @@ public class VetoableChangeSupport implements Serializable {
      * @param oldValue      the old value of the property
      * @param newValue      the new value of the property
      * @throws PropertyVetoException if one of listeners vetoes the property update
+     * @since 1.2
      */
     public void fireVetoableChange(String propertyName, boolean oldValue, boolean newValue)
             throws PropertyVetoException {
@@ -343,6 +348,7 @@ public class VetoableChangeSupport implements Serializable {
      *
      * @param event  the {@code PropertyChangeEvent} to be fired
      * @throws PropertyVetoException if one of listeners vetoes the property update
+     * @since 1.2
      */
     public void fireVetoableChange(PropertyChangeEvent event)
             throws PropertyVetoException {
@@ -399,6 +405,7 @@ public class VetoableChangeSupport implements Serializable {
      *
      * @param propertyName  the property name.
      * @return true if there are one or more listeners for the given property
+     * @since 1.2
      */
     public boolean hasListeners(String propertyName) {
         return this.map.hasListeners(propertyName);
diff --git a/jdk/src/share/classes/java/beans/Visibility.java b/jdk/src/share/classes/java/beans/Visibility.java
index af413833879..5aab3f3afe7 100644
--- a/jdk/src/share/classes/java/beans/Visibility.java
+++ b/jdk/src/share/classes/java/beans/Visibility.java
@@ -34,6 +34,8 @@ package java.beans;
  * This interface is for expert developers, and is not needed
  * for normal simple beans.  To avoid confusing end-users we
  * avoid using getXXX setXXX design patterns for these methods.
+ *
+ * @since 1.1
  */
 
 public interface Visibility {
-- 
GitLab


From e26ff7211c1400e149ef258abc4ddf2560564100 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Wed, 11 Jun 2014 14:21:12 +0400
Subject: [PATCH 046/192] 8041644: [OGL] clip is ignored during surface->sw
 blit

Reviewed-by: bae, prr
---
 .../sun/java2d/opengl/OGLBlitLoops.java       |  56 ++++++
 .../DrawImage/IncorrectClipSurface2SW.java    | 166 ++++++++++++++++++
 2 files changed, 222 insertions(+)
 create mode 100644 jdk/test/java/awt/image/DrawImage/IncorrectClipSurface2SW.java

diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
index aeab20823bb..54cfaf1f58f 100644
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
@@ -510,6 +510,7 @@ class OGLRTTSurfaceToSurfaceTransform extends TransformBlit {
 final class OGLSurfaceToSwBlit extends Blit {
 
     private final int typeval;
+    private WeakReference<SurfaceData> srcTmp;
 
     // destination will actually be ArgbPre or Argb
     OGLSurfaceToSwBlit(final SurfaceType dstType,final int typeval) {
@@ -519,11 +520,66 @@ final class OGLSurfaceToSwBlit extends Blit {
         this.typeval = typeval;
     }
 
+    private synchronized void complexClipBlit(SurfaceData src, SurfaceData dst,
+                                              Composite comp, Region clip,
+                                              int sx, int sy, int dx, int dy,
+                                              int w, int h) {
+        SurfaceData cachedSrc = null;
+        if (srcTmp != null) {
+            // use cached intermediate surface, if available
+            cachedSrc = srcTmp.get();
+        }
+
+        // We can convert argb_pre data from OpenGL surface in two places:
+        // - During OpenGL surface -> SW blit
+        // - During SW -> SW blit
+        // The first one is faster when we use opaque OGL surface, because in
+        // this case we simply skip conversion and use color components as is.
+        // Because of this we align intermediate buffer type with type of
+        // destination not source.
+        final int type = typeval == OGLSurfaceData.PF_INT_ARGB_PRE ?
+                         BufferedImage.TYPE_INT_ARGB_PRE :
+                         BufferedImage.TYPE_INT_ARGB;
+
+        src = convertFrom(this, src, sx, sy, w, h, cachedSrc, type);
+
+        // copy intermediate SW to destination SW using complex clip
+        final Blit performop = Blit.getFromCache(src.getSurfaceType(),
+                                                 CompositeType.SrcNoEa,
+                                                 dst.getSurfaceType());
+        performop.Blit(src, dst, comp, clip, 0, 0, dx, dy, w, h);
+
+        if (src != cachedSrc) {
+            // cache the intermediate surface
+            srcTmp = new WeakReference<>(src);
+        }
+    }
+
     public void Blit(SurfaceData src, SurfaceData dst,
                      Composite comp, Region clip,
                      int sx, int sy, int dx, int dy,
                      int w, int h)
     {
+        if (clip != null) {
+            clip = clip.getIntersectionXYWH(dx, dy, w, h);
+            // At the end this method will flush the RenderQueue, we should exit
+            // from it as soon as possible.
+            if (clip.isEmpty()) {
+                return;
+            }
+            sx += clip.getLoX() - dx;
+            sy += clip.getLoY() - dy;
+            dx = clip.getLoX();
+            dy = clip.getLoY();
+            w = clip.getWidth();
+            h = clip.getHeight();
+
+            if (!clip.isRectangular()) {
+                complexClipBlit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
+                return;
+            }
+        }
+
         OGLRenderQueue rq = OGLRenderQueue.getInstance();
         rq.lock();
         try {
diff --git a/jdk/test/java/awt/image/DrawImage/IncorrectClipSurface2SW.java b/jdk/test/java/awt/image/DrawImage/IncorrectClipSurface2SW.java
new file mode 100644
index 00000000000..3c972b661ea
--- /dev/null
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectClipSurface2SW.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Ellipse2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import static java.awt.geom.Rectangle2D.Double;
+
+/**
+ * @test
+ * @bug 8041644
+ * @summary Tests drawing volatile image to BI using different clip.
+ *          Results of the blit compatibleImage to BI used for comparison.
+ * @author Sergey Bylokhov
+ * @run main/othervm -Dsun.java2d.d3d=false IncorrectClipSurface2SW
+ */
+public final class IncorrectClipSurface2SW {
+
+    private static int[] SCALES = {1, 2, 4};
+    private static int[] SIZES = {127, 3, 2, 1};
+    private static final Shape[] SHAPES = {new Rectangle(0, 0, 0, 0),
+                                           new Rectangle(0, 0, 1, 1),
+                                           new Rectangle(0, 1, 1, 1),
+                                           new Rectangle(1, 0, 1, 1),
+                                           new Rectangle(1, 1, 1, 1),
+
+                                           new Ellipse2D.Double(0, 0, 1, 1),
+                                           new Ellipse2D.Double(0, 1, 1, 1),
+                                           new Ellipse2D.Double(1, 0, 1, 1),
+                                           new Ellipse2D.Double(1, 1, 1, 1),
+                                           new Ellipse2D.Double(.25, .25, .5,
+                                                                .5),
+
+                                           new Double(0, 0, 0.5, 0.5),
+                                           new Double(0, 0.5, 0.5, 0.5),
+                                           new Double(0.5, 0, 0.5, 0.5),
+                                           new Double(0.5, 0.5, 0.5, 0.5),
+                                           new Double(0.25, 0.25, 0.5, 0.5),
+                                           new Double(0, 0.25, 1, 0.5),
+                                           new Double(0.25, 0, 0.5, 1),
+
+                                           new Double(.10, .10, .20, .20),
+                                           new Double(.75, .75, .20, .20),
+                                           new Double(.75, .10, .20, .20),
+                                           new Double(.10, .75, .20, .20),};
+
+    public static void main(final String[] args) throws IOException {
+        GraphicsEnvironment ge = GraphicsEnvironment
+                .getLocalGraphicsEnvironment();
+        GraphicsConfiguration gc = ge.getDefaultScreenDevice()
+                                     .getDefaultConfiguration();
+        AffineTransform at;
+        for (final int size : SIZES) {
+            for (final int scale : SCALES) {
+                final int sw = size * scale;
+                at = AffineTransform.getScaleInstance(sw, sw);
+                for (Shape clip : SHAPES) {
+                    clip = at.createTransformedShape(clip);
+                    for (Shape to : SHAPES) {
+                        to = at.createTransformedShape(to);
+                        // Prepare test images
+                        VolatileImage vi = getVolatileImage(gc, size);
+                        BufferedImage bi = getBufferedImage(sw);
+                        // Prepare gold images
+                        BufferedImage goldvi = getCompatibleImage(gc, size);
+                        BufferedImage goldbi = getBufferedImage(sw);
+                        draw(clip, to, vi, bi, scale);
+                        draw(clip, to, goldvi, goldbi, scale);
+                        validate(bi, goldbi);
+                    }
+                }
+            }
+        }
+    }
+
+    private static void draw(Shape clip, Shape to, Image vi, BufferedImage bi,
+                             int scale) {
+        Graphics2D big = bi.createGraphics();
+        big.setComposite(AlphaComposite.Src);
+        big.setClip(clip);
+        Rectangle toBounds = to.getBounds();
+        int x1 = toBounds.x;
+
+        int y1 = toBounds.y;
+        int x2 = x1 + toBounds.width;
+        int y2 = y1 + toBounds.height;
+        big.drawImage(vi, x1, y1, x2, y2, 0, 0, toBounds.width / scale,
+                      toBounds.height / scale, null);
+        big.dispose();
+        vi.flush();
+    }
+
+    private static BufferedImage getBufferedImage(int sw) {
+        BufferedImage bi = new BufferedImage(sw, sw,
+                                             BufferedImage.TYPE_INT_ARGB);
+        Graphics2D g2d = bi.createGraphics();
+        g2d.setColor(Color.RED);
+        g2d.fillRect(0, 0, sw, sw);
+        return bi;
+    }
+
+    private static VolatileImage getVolatileImage(GraphicsConfiguration gc,
+                                                  int size) {
+        VolatileImage vi = gc.createCompatibleVolatileImage(size, size);
+        Graphics2D g2d = vi.createGraphics();
+        g2d.setColor(Color.GREEN);
+        g2d.fillRect(0, 0, size, size);
+        return vi;
+    }
+
+    private static BufferedImage getCompatibleImage(GraphicsConfiguration gc,
+                                                    int size) {
+        BufferedImage image = gc.createCompatibleImage(size, size);
+        Graphics2D g2d = image.createGraphics();
+        g2d.setColor(Color.GREEN);
+        g2d.fillRect(0, 0, size, size);
+        return image;
+    }
+
+    private static void validate(BufferedImage bi, BufferedImage goldbi)
+            throws IOException {
+        for (int x = 0; x < bi.getWidth(); ++x) {
+            for (int y = 0; y < bi.getHeight(); ++y) {
+                if (goldbi.getRGB(x, y) != bi.getRGB(x, y)) {
+                    ImageIO.write(bi, "png", new File("actual.png"));
+                    ImageIO.write(goldbi, "png", new File("expected.png"));
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+        }
+    }
+}
-- 
GitLab


From d1927658370b8568cb0997e37fa3a3d9ba65b486 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Wed, 11 Jun 2014 14:38:50 +0400
Subject: [PATCH 047/192] 8042103: Deserialization of empty
 java.awt.geom.Path2D will cause an exception

Reviewed-by: bae, flar
---
 .../share/classes/java/awt/geom/Path2D.java   |  6 ++-
 .../java/awt/geom/Path2D/EmptyCapacity.java   | 42 +++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 jdk/test/java/awt/geom/Path2D/EmptyCapacity.java

diff --git a/jdk/src/share/classes/java/awt/geom/Path2D.java b/jdk/src/share/classes/java/awt/geom/Path2D.java
index 7a401d36cf4..d75adf0cb57 100644
--- a/jdk/src/share/classes/java/awt/geom/Path2D.java
+++ b/jdk/src/share/classes/java/awt/geom/Path2D.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, 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
@@ -285,6 +285,8 @@ public abstract class Path2D implements Shape, Cloneable {
                 int grow = size;
                 if (grow > EXPAND_MAX) {
                     grow = EXPAND_MAX;
+                } else if (grow == 0) {
+                    grow = 1;
                 }
                 pointTypes = Arrays.copyOf(pointTypes, size+grow);
             }
@@ -1121,6 +1123,8 @@ public abstract class Path2D implements Shape, Cloneable {
                 int grow = size;
                 if (grow > EXPAND_MAX) {
                     grow = EXPAND_MAX;
+                } else if (grow == 0) {
+                    grow = 1;
                 }
                 pointTypes = Arrays.copyOf(pointTypes, size+grow);
             }
diff --git a/jdk/test/java/awt/geom/Path2D/EmptyCapacity.java b/jdk/test/java/awt/geom/Path2D/EmptyCapacity.java
new file mode 100644
index 00000000000..9f6d9c18dc8
--- /dev/null
+++ b/jdk/test/java/awt/geom/Path2D/EmptyCapacity.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.geom.Path2D;
+
+/**
+ * @test
+ * @bug 8042103
+ * @summary Path2D.moveTo() should work if empty initial capacity was set.
+ * @author Sergey Bylokhov
+ */
+public final class EmptyCapacity {
+
+    public static void main(final String[] args) {
+        final Path2D path1 = new Path2D.Double(Path2D.WIND_EVEN_ODD, 0);
+        path1.moveTo(10, 10);
+        path1.lineTo(20, 20);
+        final Path2D path2 = new Path2D.Float(Path2D.WIND_EVEN_ODD, 0);
+        path2.moveTo(10, 10);
+        path2.lineTo(20, 20);
+    }
+}
-- 
GitLab


From 57efe4955f0eb38608ece15c3c08f9259e808666 Mon Sep 17 00:00:00 2001
From: Dmitriy Ermashov <dmitriy.ermashov@oracle.com>
Date: Wed, 11 Jun 2014 17:23:56 +0400
Subject: [PATCH 048/192] 8043972: Remove wrong copyright notice in
 jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java

Reviewed-by: anthony
---
 .../awt/Frame/DecoratedExceptions/DecoratedExceptions.java    | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java b/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
index b2a0ddc6fdc..8dca632bb57 100644
--- a/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
+++ b/jdk/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java
@@ -20,10 +20,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
- */
 
 import java.awt.*;
 
-- 
GitLab


From 8538800448bf5872fcdbb86609e2969be41b9ffe Mon Sep 17 00:00:00 2001
From: Henry Jen <henryjen@openjdk.org>
Date: Thu, 5 Jun 2014 13:59:01 -0700
Subject: [PATCH 049/192] 8044551: Fix raw and unchecked lint warnings in
 platform-specific sun.awt files 8044396: Fix raw and unchecked lint warnings
 in platform-specific sun.java2d.*

Reviewed-by: darcy, prr
---
 .../windows/classes/sun/awt/Win32FontManager.java    | 10 ++++------
 .../windows/classes/sun/awt/Win32GraphicsDevice.java |  8 ++++----
 .../classes/sun/awt/shell/Win32ShellFolder2.java     | 12 ++++++------
 .../sun/awt/shell/Win32ShellFolderManager2.java      |  4 ++--
 .../sun/awt/windows/WDragSourceContextPeer.java      |  6 ++++--
 .../classes/sun/awt/windows/WFontConfiguration.java  | 12 ++++++------
 .../classes/sun/awt/windows/WFontMetrics.java        |  4 ++--
 .../classes/sun/awt/windows/WInputMethod.java        |  9 +++++----
 .../windows/classes/sun/awt/windows/WToolkit.java    |  1 +
 .../windows/classes/sun/java2d/d3d/D3DBlitLoops.java |  6 +++---
 .../classes/sun/java2d/d3d/D3DGraphicsDevice.java    |  5 ++---
 .../sun/java2d/windows/GDIWindowSurfaceData.java     |  2 +-
 .../classes/sun/java2d/windows/WindowsFlags.java     |  2 +-
 13 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/jdk/src/windows/classes/sun/awt/Win32FontManager.java b/jdk/src/windows/classes/sun/awt/Win32FontManager.java
index 5e925f3ce45..68136e98f4e 100644
--- a/jdk/src/windows/classes/sun/awt/Win32FontManager.java
+++ b/jdk/src/windows/classes/sun/awt/Win32FontManager.java
@@ -42,8 +42,6 @@ import sun.awt.windows.WFontConfiguration;
 import sun.font.FontManager;
 import sun.font.SunFontManager;
 import sun.font.TrueTypeFont;
-import sun.java2d.HeadlessGraphicsEnvironment;
-import sun.java2d.SunGraphicsEnvironment;
 
 /**
  * The X11 implementation of {@link FontManager}.
@@ -56,7 +54,7 @@ public class Win32FontManager extends SunFontManager {
 
     static {
 
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
 
                 public Object run() {
                     String eudcFile = getEUDCFontFile();
@@ -90,7 +88,7 @@ public class Win32FontManager extends SunFontManager {
 
     public Win32FontManager() {
         super();
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 public Object run() {
 
                     /* Register the JRE fonts so that the native platform can
@@ -227,7 +225,7 @@ public class Win32FontManager extends SunFontManager {
         final String[] dirs = getPlatformFontDirs(true);
         if (dirs.length > 1) {
             String dir = (String)
-                AccessController.doPrivileged(new PrivilegedAction() {
+                AccessController.doPrivileged(new PrivilegedAction<Object>() {
                         public Object run() {
                             for (int i=0; i<dirs.length; i++) {
                                 String path =
@@ -272,7 +270,7 @@ public class Win32FontManager extends SunFontManager {
             fontsForPrinting = null;
         }
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     File f1 = new File(pathName);
                     String[] ls = f1.list(SunFontManager.getInstance().
diff --git a/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java b/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java
index d7cfc58e1e8..8ff76dc7e13 100644
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java
@@ -172,7 +172,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
 
             int max = getMaxConfigs(screen);
             int defaultPixID = getDefaultPixID(screen);
-            Vector v = new Vector( max );
+            Vector<GraphicsConfiguration> v = new Vector<>( max );
             if (defaultPixID == 0) {
                 // Workaround for failing GDI calls
                 defaultConfig = Win32GraphicsConfig.getConfig(this,
@@ -437,7 +437,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
     protected native void configDisplayMode(int screen, WindowPeer w, int width,
                                           int height, int bitDepth,
                                           int refreshRate);
-    protected native void enumDisplayModes(int screen, ArrayList modes);
+    protected native void enumDisplayModes(int screen, ArrayList<DisplayMode> modes);
 
     @Override
     public synchronized DisplayMode getDisplayMode() {
@@ -447,12 +447,12 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
 
     @Override
     public synchronized DisplayMode[] getDisplayModes() {
-        ArrayList modes = new ArrayList();
+        ArrayList<DisplayMode> modes = new ArrayList<>();
         enumDisplayModes(screen, modes);
         int listSize = modes.size();
         DisplayMode[] retArray = new DisplayMode[listSize];
         for (int i = 0; i < listSize; i++) {
-            retArray[i] = (DisplayMode)modes.get(i);
+            retArray[i] = modes.get(i);
         }
         return retArray;
     }
diff --git a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
index 696633917a2..42975132b15 100644
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
@@ -894,10 +894,10 @@ final class Win32ShellFolder2 extends ShellFolder {
 
     // Icons
 
-    private static Map smallSystemImages = new HashMap();
-    private static Map largeSystemImages = new HashMap();
-    private static Map smallLinkedSystemImages = new HashMap();
-    private static Map largeLinkedSystemImages = new HashMap();
+    private static Map<Integer, Image> smallSystemImages = new HashMap<>();
+    private static Map<Integer, Image> largeSystemImages = new HashMap<>();
+    private static Map<Integer, Image> smallLinkedSystemImages = new HashMap<>();
+    private static Map<Integer, Image> largeLinkedSystemImages = new HashMap<>();
 
     // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
     private static native long getIShellIcon(long pIShellFolder);
@@ -970,13 +970,13 @@ final class Win32ShellFolder2 extends ShellFolder {
                             // These are cached per type (using the index in the system image list)
                             int index = getIconIndex(parentIShellIcon, relativePIDL);
                             if (index > 0) {
-                                Map imageCache;
+                                Map<Integer, Image> imageCache;
                                 if (isLink()) {
                                     imageCache = getLargeIcon ? largeLinkedSystemImages : smallLinkedSystemImages;
                                 } else {
                                     imageCache = getLargeIcon ? largeSystemImages : smallSystemImages;
                                 }
-                                newIcon = (Image) imageCache.get(Integer.valueOf(index));
+                                newIcon = imageCache.get(Integer.valueOf(index));
                                 if (newIcon == null) {
                                     long hIcon = getIcon(getAbsolutePath(), getLargeIcon);
                                     newIcon = makeIcon(hIcon, getLargeIcon);
diff --git a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
index 269eff2e421..426a0eb77ff 100644
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
@@ -414,14 +414,14 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
         return false;
     }
 
-    private static List topFolderList = null;
+    private static List<Win32ShellFolder2> topFolderList = null;
     static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
         boolean special1 = sf1.isSpecial();
         boolean special2 = sf2.isSpecial();
 
         if (special1 || special2) {
             if (topFolderList == null) {
-                ArrayList tmpTopFolderList = new ArrayList();
+                ArrayList<Win32ShellFolder2> tmpTopFolderList = new ArrayList<>();
                 tmpTopFolderList.add(Win32ShellFolderManager2.getPersonal());
                 tmpTopFolderList.add(Win32ShellFolderManager2.getDesktop());
                 tmpTopFolderList.add(Win32ShellFolderManager2.getDrives());
diff --git a/jdk/src/windows/classes/sun/awt/windows/WDragSourceContextPeer.java b/jdk/src/windows/classes/sun/awt/windows/WDragSourceContextPeer.java
index 36280f2e571..360d842834b 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WDragSourceContextPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WDragSourceContextPeer.java
@@ -29,6 +29,7 @@ import java.awt.Component;
 import java.awt.Cursor;
 import java.awt.Image;
 import java.awt.Point;
+import java.awt.datatransfer.DataFlavor;
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBufferInt;
 
@@ -76,8 +77,9 @@ final class WDragSourceContextPeer extends SunDragSourceContextPeer {
         return theInstance;
     }
 
+    @Override
     protected void startDrag(Transferable trans,
-                             long[] formats, Map formatMap) {
+                             long[] formats, Map<Long, DataFlavor> formatMap) {
 
         long nativeCtxtLocal = 0;
 
@@ -153,7 +155,7 @@ final class WDragSourceContextPeer extends SunDragSourceContextPeer {
                                  InputEvent nativeTrigger,
                                  int actions,
                                  long[] formats,
-                                 Map formatMap);
+                                 Map<Long, DataFlavor> formatMap);
 
     /**
      * downcall into native code
diff --git a/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java b/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java
index 7315b97db77..4cd88216bca 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WFontConfiguration.java
@@ -53,7 +53,7 @@ public final class WFontConfiguration extends FontConfiguration {
     @Override
     protected void initReorderMap() {
         if (encoding.equalsIgnoreCase("windows-31j")) {
-            localeMap = new Hashtable();
+            localeMap = new Hashtable<>();
             /* Substitute Mincho for Gothic in this one case.
              * Note the windows fontconfig files already contain the mapping:
              * filename.MS_Mincho=MSMINCHO.TTC
@@ -67,7 +67,7 @@ public final class WFontConfiguration extends FontConfiguration {
             localeMap.put("dialoginput.italic.japanese", "MS Mincho");
             localeMap.put("dialoginput.bolditalic.japanese", "MS Mincho");
         }
-        reorderMap = new HashMap();
+        reorderMap = new HashMap<>();
         reorderMap.put("UTF-8.hi", "devanagari");
         reorderMap.put("windows-1255", "hebrew");
         reorderMap.put("x-windows-874", "thai");
@@ -118,7 +118,7 @@ public final class WFontConfiguration extends FontConfiguration {
 
     @Override
     protected String makeAWTFontName(String platformFontName, String characterSubsetName) {
-        String windowsCharset = (String) subsetCharsetMap.get(characterSubsetName);
+        String windowsCharset = subsetCharsetMap.get(characterSubsetName);
         if (windowsCharset == null) {
             windowsCharset = "DEFAULT_CHARSET";
         }
@@ -127,7 +127,7 @@ public final class WFontConfiguration extends FontConfiguration {
 
     @Override
     protected String getEncoding(String awtFontName, String characterSubsetName) {
-        String encoding = (String) subsetEncodingMap.get(characterSubsetName);
+        String encoding = subsetEncodingMap.get(characterSubsetName);
         if (encoding == null) {
             encoding = "default";
         }
@@ -174,8 +174,8 @@ public final class WFontConfiguration extends FontConfiguration {
         return fontName;
     }
 
-    private static HashMap subsetCharsetMap = new HashMap();
-    private static HashMap subsetEncodingMap = new HashMap();
+    private static HashMap<String, String> subsetCharsetMap = new HashMap<>();
+    private static HashMap<String, String> subsetEncodingMap = new HashMap<>();
     private static String textInputCharset;
 
     private void initTables(String defaultEncoding) {
diff --git a/jdk/src/windows/classes/sun/awt/windows/WFontMetrics.java b/jdk/src/windows/classes/sun/awt/windows/WFontMetrics.java
index 01dae69c91a..8d8a9515df7 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WFontMetrics.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WFontMetrics.java
@@ -199,10 +199,10 @@ final class WFontMetrics extends FontMetrics {
 
     native void init();
 
-    static Hashtable table = new Hashtable();
+    static Hashtable<Font, FontMetrics> table = new Hashtable<>();
 
     static FontMetrics getFontMetrics(Font font) {
-        FontMetrics fm = (FontMetrics)table.get(font);
+        FontMetrics fm = table.get(font);
         if (fm == null) {
             table.put(font, fm = new WFontMetrics(font));
         }
diff --git a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java
index de7c478c087..1d3c413dfc3 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java
@@ -86,26 +86,27 @@ final class WInputMethod extends InputMethodAdapter
 
     // Initialize highlight mapping table
     static {
+        @SuppressWarnings({"rawtypes", "unchecked"})
         Map<TextAttribute,Object> styles[] = new Map[4];
         HashMap<TextAttribute,Object> map;
 
         // UNSELECTED_RAW_TEXT_HIGHLIGHT
-        map = new HashMap(1);
+        map = new HashMap<>(1);
         map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
         styles[0] = Collections.unmodifiableMap(map);
 
         // SELECTED_RAW_TEXT_HIGHLIGHT
-        map = new HashMap(1);
+        map = new HashMap<>(1);
         map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_GRAY);
         styles[1] = Collections.unmodifiableMap(map);
 
         // UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
-        map = new HashMap(1);
+        map = new HashMap<>(1);
         map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
         styles[2] = Collections.unmodifiableMap(map);
 
         // SELECTED_CONVERTED_TEXT_HIGHLIGHT
-        map = new HashMap(4);
+        map = new HashMap<>(4);
         Color navyBlue = new Color(0, 0, 128);
         map.put(TextAttribute.FOREGROUND, navyBlue);
         map.put(TextAttribute.BACKGROUND, Color.white);
diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
index 2a27c2df9cc..d33b991d7f8 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -843,6 +843,7 @@ public final class WToolkit extends SunToolkit implements Runnable {
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public <T extends DragGestureRecognizer> T
         createDragGestureRecognizer(Class<T> abstractRecognizerClass,
                                     DragSource ds, Component c, int srcActions,
diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
index b7b09e7b6dd..94495da083e 100644
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
@@ -717,7 +717,7 @@ class D3DTextureToSurfaceTransform extends TransformBlit {
 class D3DGeneralBlit extends Blit {
 
     private Blit performop;
-    private WeakReference srcTmp;
+    private WeakReference<SurfaceData> srcTmp;
 
     D3DGeneralBlit(SurfaceType dstType,
                    CompositeType compType,
@@ -739,7 +739,7 @@ class D3DGeneralBlit extends Blit {
         SurfaceData cachedSrc = null;
         if (srcTmp != null) {
             // use cached intermediate surface, if available
-            cachedSrc = (SurfaceData)srcTmp.get();
+            cachedSrc = srcTmp.get();
         }
 
         // convert source to IntArgbPre
@@ -752,7 +752,7 @@ class D3DGeneralBlit extends Blit {
 
         if (src != cachedSrc) {
             // cache the intermediate surface
-            srcTmp = new WeakReference(src);
+            srcTmp = new WeakReference<>(src);
         }
     }
 }
diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java
index bf6134648c3..d30f1720bfc 100644
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java
@@ -41,7 +41,6 @@ import sun.awt.Win32GraphicsDevice;
 import sun.awt.windows.WWindowPeer;
 import sun.java2d.pipe.hw.ContextCapabilities;
 import sun.java2d.windows.WindowsFlags;
-import static sun.java2d.pipe.BufferedOpCodes.*;
 import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
 import sun.java2d.d3d.D3DContext.D3DContextCaps;
 
@@ -383,9 +382,9 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
     }
 
     private static native void enumDisplayModesNative(int screen,
-                                                      ArrayList modes);
+                                                      ArrayList<DisplayMode> modes);
     @Override
-    protected void enumDisplayModes(final int screen, final ArrayList modes) {
+    protected void enumDisplayModes(final int screen, final ArrayList<DisplayMode> modes) {
         D3DRenderQueue rq = D3DRenderQueue.getInstance();
         rq.lock();
         try {
diff --git a/jdk/src/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java b/jdk/src/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java
index 49d9261bbd3..04ba1464001 100644
--- a/jdk/src/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java
+++ b/jdk/src/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java
@@ -75,7 +75,7 @@ public class GDIWindowSurfaceData extends SurfaceData {
     public static final SurfaceType ThreeByteBgrGdi =
         SurfaceType.ThreeByteBgr.deriveSubType(DESC_GDI);
 
-    private static native void initIDs(Class xorComp);
+    private static native void initIDs(Class<?> xorComp);
 
     static {
         initIDs(XORComposite.class);
diff --git a/jdk/src/windows/classes/sun/java2d/windows/WindowsFlags.java b/jdk/src/windows/classes/sun/java2d/windows/WindowsFlags.java
index a6d265fd3f8..b8fc7510471 100644
--- a/jdk/src/windows/classes/sun/java2d/windows/WindowsFlags.java
+++ b/jdk/src/windows/classes/sun/java2d/windows/WindowsFlags.java
@@ -201,7 +201,7 @@ public class WindowsFlags {
 
     private static void initJavaFlags() {
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction()
+            new java.security.PrivilegedAction<Object>()
         {
             public Object run() {
                 magPresent = getBooleanProp(
-- 
GitLab


From 61431e72a805d76d30f6206a57d3d0ecac78fd31 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Thu, 5 Jun 2014 23:17:05 -0700
Subject: [PATCH 050/192] 8044553: Fix raw and unchecked lint warnings in
 javax.sound.*

Reviewed-by: prr
---
 .../javax/sound/midi/MidiFileFormat.java      |   1 +
 .../classes/javax/sound/midi/MidiSystem.java  | 155 ++++++++--------
 .../javax/sound/midi/SoundbankResource.java   |   4 +-
 .../share/classes/javax/sound/midi/Track.java |  14 +-
 .../javax/sound/sampled/AudioFileFormat.java  |   3 +-
 .../javax/sound/sampled/AudioFormat.java      |   3 +-
 .../javax/sound/sampled/AudioSystem.java      | 166 +++++++++---------
 .../classes/javax/sound/sampled/Line.java     |   2 +-
 8 files changed, 178 insertions(+), 170 deletions(-)

diff --git a/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java b/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java
index 0d496490dd0..c34bb6d1900 100644
--- a/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java
+++ b/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java
@@ -266,6 +266,7 @@ public class MidiFileFormat {
      * @see #getProperty(String)
      * @since 1.5
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     public Map<String,Object> properties() {
         Map<String,Object> ret;
         if (properties == null) {
diff --git a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java
index c661e23304d..d6ef5432978 100644
--- a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java
+++ b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java
@@ -187,17 +187,17 @@ public class MidiSystem {
      * an array of length 0 is returned.
      */
     public static MidiDevice.Info[] getMidiDeviceInfo() {
-        List allInfos = new ArrayList();
-        List providers = getMidiDeviceProviders();
+        List<MidiDevice.Info> allInfos = new ArrayList<>();
+        List<MidiDeviceProvider> providers = getMidiDeviceProviders();
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
+            MidiDeviceProvider provider = providers.get(i);
             MidiDevice.Info[] tmpinfo = provider.getDeviceInfo();
             for (int j = 0; j < tmpinfo.length; j++) {
                 allInfos.add( tmpinfo[j] );
             }
         }
-        MidiDevice.Info[] infosArray = (MidiDevice.Info[]) allInfos.toArray(new MidiDevice.Info[0]);
+        MidiDevice.Info[] infosArray = allInfos.toArray(new MidiDevice.Info[0]);
         return infosArray;
     }
 
@@ -214,10 +214,10 @@ public class MidiSystem {
      * @see #getMidiDeviceInfo
      */
     public static MidiDevice getMidiDevice(MidiDevice.Info info) throws MidiUnavailableException {
-        List providers = getMidiDeviceProviders();
+        List<MidiDeviceProvider> providers = getMidiDeviceProviders();
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
+            MidiDeviceProvider provider = providers.get(i);
             if (provider.isDeviceSupported(info)) {
                 MidiDevice device = provider.getDevice(info);
                 return device;
@@ -528,10 +528,10 @@ public class MidiSystem {
         SoundbankReader sp = null;
         Soundbank s = null;
 
-        List providers = getSoundbankReaders();
+        List<SoundbankReader> providers = getSoundbankReaders();
 
         for(int i = 0; i < providers.size(); i++) {
-            sp = (SoundbankReader)providers.get(i);
+            sp = providers.get(i);
             s = sp.getSoundbank(stream);
 
             if( s!= null) {
@@ -559,10 +559,10 @@ public class MidiSystem {
         SoundbankReader sp = null;
         Soundbank s = null;
 
-        List providers = getSoundbankReaders();
+        List<SoundbankReader> providers = getSoundbankReaders();
 
         for(int i = 0; i < providers.size(); i++) {
-            sp = (SoundbankReader)providers.get(i);
+            sp = providers.get(i);
             s = sp.getSoundbank(url);
 
             if( s!= null) {
@@ -591,10 +591,10 @@ public class MidiSystem {
         SoundbankReader sp = null;
         Soundbank s = null;
 
-        List providers = getSoundbankReaders();
+        List<SoundbankReader> providers = getSoundbankReaders();
 
         for(int i = 0; i < providers.size(); i++) {
-            sp = (SoundbankReader)providers.get(i);
+            sp = providers.get(i);
             s = sp.getSoundbank(file);
 
             if( s!= null) {
@@ -641,11 +641,11 @@ public class MidiSystem {
     public static MidiFileFormat getMidiFileFormat(InputStream stream)
         throws InvalidMidiDataException, IOException {
 
-        List providers = getMidiFileReaders();
+        List<MidiFileReader> providers = getMidiFileReaders();
         MidiFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiFileReader reader = (MidiFileReader) providers.get(i);
+            MidiFileReader reader =  providers.get(i);
             try {
                 format = reader.getMidiFileFormat( stream ); // throws IOException
                 break;
@@ -687,11 +687,11 @@ public class MidiSystem {
     public static MidiFileFormat getMidiFileFormat(URL url)
         throws InvalidMidiDataException, IOException {
 
-        List providers = getMidiFileReaders();
+        List<MidiFileReader> providers = getMidiFileReaders();
         MidiFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiFileReader reader = (MidiFileReader) providers.get(i);
+            MidiFileReader reader = providers.get(i);
             try {
                 format = reader.getMidiFileFormat( url ); // throws IOException
                 break;
@@ -733,11 +733,11 @@ public class MidiSystem {
     public static MidiFileFormat getMidiFileFormat(File file)
         throws InvalidMidiDataException, IOException {
 
-        List providers = getMidiFileReaders();
+        List<MidiFileReader> providers = getMidiFileReaders();
         MidiFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiFileReader reader = (MidiFileReader) providers.get(i);
+            MidiFileReader reader = providers.get(i);
             try {
                 format = reader.getMidiFileFormat( file ); // throws IOException
                 break;
@@ -788,11 +788,11 @@ public class MidiSystem {
     public static Sequence getSequence(InputStream stream)
         throws InvalidMidiDataException, IOException {
 
-        List providers = getMidiFileReaders();
+        List<MidiFileReader> providers = getMidiFileReaders();
         Sequence sequence = null;
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiFileReader reader = (MidiFileReader) providers.get(i);
+            MidiFileReader reader = providers.get(i);
             try {
                 sequence = reader.getSequence( stream ); // throws IOException
                 break;
@@ -832,11 +832,11 @@ public class MidiSystem {
     public static Sequence getSequence(URL url)
         throws InvalidMidiDataException, IOException {
 
-        List providers = getMidiFileReaders();
+        List<MidiFileReader> providers = getMidiFileReaders();
         Sequence sequence = null;
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiFileReader reader = (MidiFileReader) providers.get(i);
+            MidiFileReader reader = providers.get(i);
             try {
                 sequence = reader.getSequence( url ); // throws IOException
                 break;
@@ -876,11 +876,11 @@ public class MidiSystem {
     public static Sequence getSequence(File file)
         throws InvalidMidiDataException, IOException {
 
-        List providers = getMidiFileReaders();
+        List<MidiFileReader> providers = getMidiFileReaders();
         Sequence sequence = null;
 
         for(int i = 0; i < providers.size(); i++) {
-            MidiFileReader reader = (MidiFileReader) providers.get(i);
+            MidiFileReader reader = providers.get(i);
             try {
                 sequence = reader.getSequence( file ); // throws IOException
                 break;
@@ -905,13 +905,13 @@ public class MidiSystem {
      */
     public static int[] getMidiFileTypes() {
 
-        List providers = getMidiFileWriters();
-        Set allTypes = new HashSet();
+        List<MidiFileWriter> providers = getMidiFileWriters();
+        Set<Integer> allTypes = new HashSet<>();
 
         // gather from all the providers
 
         for (int i = 0; i < providers.size(); i++ ) {
-            MidiFileWriter writer = (MidiFileWriter) providers.get(i);
+            MidiFileWriter writer = providers.get(i);
             int[] types = writer.getMidiFileTypes();
             for (int j = 0; j < types.length; j++ ) {
                 allTypes.add(new Integer(types[j]));
@@ -919,9 +919,9 @@ public class MidiSystem {
         }
         int resultTypes[] = new int[allTypes.size()];
         int index = 0;
-        Iterator iterator = allTypes.iterator();
+        Iterator<Integer> iterator = allTypes.iterator();
         while (iterator.hasNext()) {
-            Integer integer = (Integer) iterator.next();
+            Integer integer = iterator.next();
             resultTypes[index++] = integer.intValue();
         }
         return resultTypes;
@@ -937,10 +937,10 @@ public class MidiSystem {
      */
     public static boolean isFileTypeSupported(int fileType) {
 
-        List providers = getMidiFileWriters();
+        List<MidiFileWriter> providers = getMidiFileWriters();
 
         for (int i = 0; i < providers.size(); i++ ) {
-            MidiFileWriter writer = (MidiFileWriter) providers.get(i);
+            MidiFileWriter writer = providers.get(i);
             if( writer.isFileTypeSupported(fileType)) {
                 return true;
             }
@@ -959,13 +959,13 @@ public class MidiSystem {
      */
     public static int[] getMidiFileTypes(Sequence sequence) {
 
-        List providers = getMidiFileWriters();
-        Set allTypes = new HashSet();
+        List<MidiFileWriter> providers = getMidiFileWriters();
+        Set<Integer> allTypes = new HashSet<>();
 
         // gather from all the providers
 
         for (int i = 0; i < providers.size(); i++ ) {
-            MidiFileWriter writer = (MidiFileWriter) providers.get(i);
+            MidiFileWriter writer = providers.get(i);
             int[] types = writer.getMidiFileTypes(sequence);
             for (int j = 0; j < types.length; j++ ) {
                 allTypes.add(new Integer(types[j]));
@@ -973,9 +973,9 @@ public class MidiSystem {
         }
         int resultTypes[] = new int[allTypes.size()];
         int index = 0;
-        Iterator iterator = allTypes.iterator();
+        Iterator<Integer> iterator = allTypes.iterator();
         while (iterator.hasNext()) {
-            Integer integer = (Integer) iterator.next();
+            Integer integer = iterator.next();
             resultTypes[index++] = integer.intValue();
         }
         return resultTypes;
@@ -993,10 +993,10 @@ public class MidiSystem {
      */
     public static boolean isFileTypeSupported(int fileType, Sequence sequence) {
 
-        List providers = getMidiFileWriters();
+        List<MidiFileWriter> providers = getMidiFileWriters();
 
         for (int i = 0; i < providers.size(); i++ ) {
-            MidiFileWriter writer = (MidiFileWriter) providers.get(i);
+            MidiFileWriter writer = providers.get(i);
             if( writer.isFileTypeSupported(fileType,sequence)) {
                 return true;
             }
@@ -1020,12 +1020,12 @@ public class MidiSystem {
      */
     public static int write(Sequence in, int fileType, OutputStream out) throws IOException {
 
-        List providers = getMidiFileWriters();
+        List<MidiFileWriter> providers = getMidiFileWriters();
         //$$fb 2002-04-17: Fix for 4635287: Standard MidiFileWriter cannot write empty Sequences
         int bytesWritten = -2;
 
         for (int i = 0; i < providers.size(); i++ ) {
-            MidiFileWriter writer = (MidiFileWriter) providers.get(i);
+            MidiFileWriter writer = providers.get(i);
             if( writer.isFileTypeSupported( fileType, in ) ) {
 
                 bytesWritten = writer.write(in, fileType, out);
@@ -1054,12 +1054,12 @@ public class MidiSystem {
      */
     public static int write(Sequence in, int type, File out) throws IOException {
 
-        List providers = getMidiFileWriters();
+        List<MidiFileWriter> providers = getMidiFileWriters();
         //$$fb 2002-04-17: Fix for 4635287: Standard MidiFileWriter cannot write empty Sequences
         int bytesWritten = -2;
 
         for (int i = 0; i < providers.size(); i++ ) {
-            MidiFileWriter writer = (MidiFileWriter) providers.get(i);
+            MidiFileWriter writer = providers.get(i);
             if( writer.isFileTypeSupported( type, in ) ) {
 
                 bytesWritten = writer.write(in, type, out);
@@ -1075,24 +1075,24 @@ public class MidiSystem {
 
 
     // HELPER METHODS
-
-    private static List getMidiDeviceProviders() {
-        return getProviders(MidiDeviceProvider.class);
+    @SuppressWarnings("unchecked")
+    private static List<MidiDeviceProvider> getMidiDeviceProviders() {
+        return (List<MidiDeviceProvider>) getProviders(MidiDeviceProvider.class);
     }
 
-
-    private static List getSoundbankReaders() {
-        return getProviders(SoundbankReader.class);
+    @SuppressWarnings("unchecked")
+    private static List<SoundbankReader> getSoundbankReaders() {
+        return (List<SoundbankReader>) getProviders(SoundbankReader.class);
     }
 
-
-    private static List getMidiFileWriters() {
-        return getProviders(MidiFileWriter.class);
+    @SuppressWarnings("unchecked")
+    private static List<MidiFileWriter> getMidiFileWriters() {
+        return (List<MidiFileWriter>) getProviders(MidiFileWriter.class);
     }
 
-
-    private static List getMidiFileReaders() {
-        return getProviders(MidiFileReader.class);
+    @SuppressWarnings("unchecked")
+    private static List<MidiFileReader> getMidiFileReaders() {
+        return (List<MidiFileReader>) getProviders(MidiFileReader.class);
     }
 
 
@@ -1109,7 +1109,7 @@ public class MidiSystem {
      * Sequencer.class, Receiver.class or Transmitter.class.
      * @throws  MidiUnavalableException on failure.
      */
-    private static MidiDevice getDefaultDeviceWrapper(Class deviceClass)
+    private static MidiDevice getDefaultDeviceWrapper(Class<?> deviceClass)
         throws MidiUnavailableException{
         try {
             return getDefaultDevice(deviceClass);
@@ -1128,8 +1128,8 @@ public class MidiSystem {
      * Sequencer.class, Receiver.class or Transmitter.class.
      * @throws  IllegalArgumentException on failure.
      */
-    private static MidiDevice getDefaultDevice(Class deviceClass) {
-        List providers = getMidiDeviceProviders();
+    private static MidiDevice getDefaultDevice(Class<?> deviceClass) {
+        List<MidiDeviceProvider> providers = getMidiDeviceProviders();
         String providerClassName = JDK13Services.getDefaultProviderClassName(deviceClass);
         String instanceName = JDK13Services.getDefaultInstanceName(deviceClass);
         MidiDevice device;
@@ -1179,9 +1179,10 @@ public class MidiSystem {
         @return A MidiDeviceProvider of the requested class, or null if none
         is found.
     */
-    private static MidiDeviceProvider getNamedProvider(String providerClassName, List providers) {
+    private static MidiDeviceProvider getNamedProvider(String providerClassName,
+                                                       List<MidiDeviceProvider> providers) {
         for(int i = 0; i < providers.size(); i++) {
-            MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
+            MidiDeviceProvider provider = providers.get(i);
             if (provider.getClass().getName().equals(providerClassName)) {
                 return provider;
             }
@@ -1200,7 +1201,7 @@ public class MidiSystem {
     */
     private static MidiDevice getNamedDevice(String deviceName,
                                              MidiDeviceProvider provider,
-                                             Class deviceClass) {
+                                             Class<?> deviceClass) {
         MidiDevice device;
         // try to get MIDI port
         device = getNamedDevice(deviceName, provider, deviceClass,
@@ -1232,7 +1233,7 @@ public class MidiSystem {
      */
     private static MidiDevice getNamedDevice(String deviceName,
                                              MidiDeviceProvider provider,
-                                             Class deviceClass,
+                                             Class<?> deviceClass,
                                              boolean allowSynthesizer,
                                              boolean allowSequencer) {
         MidiDevice.Info[] infos = provider.getDeviceInfo();
@@ -1259,8 +1260,8 @@ public class MidiSystem {
         @return A Mixer matching the requirements, or null if none is found.
     */
     private static MidiDevice getNamedDevice(String deviceName,
-                                             List providers,
-                                             Class deviceClass) {
+                                             List<MidiDeviceProvider> providers,
+                                             Class<?> deviceClass) {
         MidiDevice device;
         // try to get MIDI port
         device = getNamedDevice(deviceName, providers, deviceClass,
@@ -1292,12 +1293,12 @@ public class MidiSystem {
         @return A Mixer matching the requirements, or null if none is found.
      */
     private static MidiDevice getNamedDevice(String deviceName,
-                                             List providers,
-                                             Class deviceClass,
+                                             List<MidiDeviceProvider> providers,
+                                             Class<?> deviceClass,
                                              boolean allowSynthesizer,
                                              boolean allowSequencer) {
         for(int i = 0; i < providers.size(); i++) {
-            MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
+            MidiDeviceProvider provider = providers.get(i);
             MidiDevice device = getNamedDevice(deviceName, provider,
                                                deviceClass,
                                                allowSynthesizer,
@@ -1318,7 +1319,7 @@ public class MidiSystem {
         appropriate device is found.
     */
     private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
-                                             Class deviceClass) {
+                                             Class<?> deviceClass) {
         MidiDevice device;
         // try to get MIDI port
         device = getFirstDevice(provider, deviceClass,
@@ -1348,7 +1349,7 @@ public class MidiSystem {
         appropriate device is found.
      */
     private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
-                                             Class deviceClass,
+                                             Class<?> deviceClass,
                                              boolean allowSynthesizer,
                                              boolean allowSequencer) {
         MidiDevice.Info[] infos = provider.getDeviceInfo();
@@ -1371,8 +1372,8 @@ public class MidiSystem {
         @return A MidiDevice that is considered appropriate, or null
         if none is found.
     */
-    private static MidiDevice getFirstDevice(List providers,
-                                             Class deviceClass) {
+    private static MidiDevice getFirstDevice(List<MidiDeviceProvider> providers,
+                                             Class<?> deviceClass) {
         MidiDevice device;
         // try to get MIDI port
         device = getFirstDevice(providers, deviceClass,
@@ -1402,12 +1403,12 @@ public class MidiSystem {
         @return A MidiDevice that is considered appropriate, or null
         if none is found.
      */
-    private static MidiDevice getFirstDevice(List providers,
-                                             Class deviceClass,
+    private static MidiDevice getFirstDevice(List<MidiDeviceProvider> providers,
+                                             Class<?> deviceClass,
                                              boolean allowSynthesizer,
                                              boolean allowSequencer) {
         for(int i = 0; i < providers.size(); i++) {
-            MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
+            MidiDeviceProvider provider = providers.get(i);
             MidiDevice device = getFirstDevice(provider, deviceClass,
                                                allowSynthesizer,
                                                allowSequencer);
@@ -1441,11 +1442,11 @@ public class MidiSystem {
         rules given above, false otherwise.
     */
     private static boolean isAppropriateDevice(MidiDevice device,
-                                               Class deviceClass,
+                                               Class<?> deviceClass,
                                                boolean allowSynthesizer,
                                                boolean allowSequencer) {
         if (deviceClass.isInstance(device)) {
-            // This clause is for deviceClass being either Synthesizer
+           // This clause is for deviceClass being either Synthesizer
             // or Sequencer.
             return true;
         } else {
@@ -1479,7 +1480,7 @@ public class MidiSystem {
      * @return a List of instances of providers for the requested service.
      * If no providers are available, a List of length 0 will be returned.
      */
-    private static List getProviders(Class providerClass) {
-        return JDK13Services.getProviders(providerClass);
+     private static List<?> getProviders(Class<?> providerClass) {
+         return JDK13Services.getProviders(providerClass);
     }
 }
diff --git a/jdk/src/share/classes/javax/sound/midi/SoundbankResource.java b/jdk/src/share/classes/javax/sound/midi/SoundbankResource.java
index 87c0864a627..52ba8f78feb 100644
--- a/jdk/src/share/classes/javax/sound/midi/SoundbankResource.java
+++ b/jdk/src/share/classes/javax/sound/midi/SoundbankResource.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -83,7 +83,7 @@ public abstract class SoundbankResource {
     /**
      * The class used to represent the sample's data.
      */
-    private final Class dataClass;
+    private final Class<?> dataClass;
 
 
     /**
diff --git a/jdk/src/share/classes/javax/sound/midi/Track.java b/jdk/src/share/classes/javax/sound/midi/Track.java
index 4e54a8aa3dd..d9e0f438b6c 100644
--- a/jdk/src/share/classes/javax/sound/midi/Track.java
+++ b/jdk/src/share/classes/javax/sound/midi/Track.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -66,10 +66,10 @@ public class Track {
     // TODO: use arrays for faster access
 
     // the list containing the events
-    private ArrayList eventsList = new ArrayList();
+    private ArrayList<MidiEvent> eventsList = new ArrayList<>();
 
     // use a hashset to detect duplicate events in add(MidiEvent)
-    private HashSet set = new HashSet();
+    private HashSet<MidiEvent> set = new HashSet<>();
 
     private MidiEvent eotEvent;
 
@@ -108,7 +108,7 @@ public class Track {
                 // get the last event
                 MidiEvent lastEvent = null;
                 if (eventsCount > 0) {
-                    lastEvent = (MidiEvent) eventsList.get(eventsCount - 1);
+                    lastEvent = eventsList.get(eventsCount - 1);
                 }
                 // sanity check that we have a correct end-of-track
                 if (lastEvent != eotEvent) {
@@ -148,7 +148,7 @@ public class Track {
                 // tick order
                 int i = eventsCount;
                 for ( ; i > 0; i--) {
-                    if (event.getTick() >= ((MidiEvent)eventsList.get(i-1)).getTick()) {
+                    if (event.getTick() >= (eventsList.get(i-1)).getTick()) {
                         break;
                     }
                 }
@@ -220,7 +220,7 @@ public class Track {
     public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException {
         try {
             synchronized(eventsList) {
-                return (MidiEvent)eventsList.get(index);
+                return eventsList.get(index);
             }
         } catch (IndexOutOfBoundsException ioobe) {
             throw new ArrayIndexOutOfBoundsException(ioobe.getMessage());
@@ -253,7 +253,7 @@ public class Track {
         long ret = 0;
         synchronized (eventsList) {
             if (eventsList.size() > 0) {
-                ret = ((MidiEvent)eventsList.get(eventsList.size() - 1)).getTick();
+                ret = (eventsList.get(eventsList.size() - 1)).getTick();
             }
         }
         return ret;
diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java
index 31a279d56ee..9c6ba5a3e4e 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java
@@ -233,10 +233,11 @@ public class AudioFileFormat {
      * @see #getProperty(String)
      * @since 1.5
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     public Map<String, Object> properties() {
         Map<String,Object> ret;
         if (properties == null) {
-            ret = new HashMap<String,Object>(0);
+            ret = new HashMap<>(0);
         } else {
             ret = (Map<String,Object>) (properties.clone());
         }
diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java
index 9ea70f975f1..39264aacf84 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java
@@ -388,10 +388,11 @@ public class AudioFormat {
      * @see #getProperty(String)
      * @since 1.5
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone.
     public Map<String,Object> properties() {
         Map<String,Object> ret;
         if (properties == null) {
-            ret = new HashMap<String,Object>(0);
+            ret = new HashMap<>(0);
         } else {
             ret = (Map<String,Object>) (properties.clone());
         }
diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java
index 7b5428b1c19..459ef997855 100644
--- a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java
@@ -175,8 +175,8 @@ public class AudioSystem {
      */
     public static Mixer.Info[] getMixerInfo() {
 
-        List infos = getMixerInfoList();
-        Mixer.Info[] allInfos = (Mixer.Info[]) infos.toArray(new Mixer.Info[infos.size()]);
+        List<Mixer.Info> infos = getMixerInfoList();
+        Mixer.Info[] allInfos = infos.toArray(new Mixer.Info[infos.size()]);
         return allInfos;
     }
 
@@ -195,12 +195,12 @@ public class AudioSystem {
     public static Mixer getMixer(Mixer.Info info) {
 
         Mixer mixer = null;
-        List providers = getMixerProviders();
+        List<MixerProvider> providers = getMixerProviders();
 
         for(int i = 0; i < providers.size(); i++ ) {
 
             try {
-                return ((MixerProvider)providers.get(i)).getMixer(info);
+                return providers.get(i).getMixer(info);
 
             } catch (IllegalArgumentException e) {
             } catch (NullPointerException e) {
@@ -217,7 +217,7 @@ public class AudioSystem {
         if (info == null) {
             for(int i = 0; i < providers.size(); i++ ) {
                 try {
-                    MixerProvider provider = (MixerProvider) providers.get(i);
+                    MixerProvider provider = providers.get(i);
                     Mixer.Info[] infos = provider.getMixerInfo();
                     // start from 0 to last device (do not reverse this order)
                     for (int ii = 0; ii < infos.length; ii++) {
@@ -253,7 +253,7 @@ public class AudioSystem {
      */
     public static Line.Info[] getSourceLineInfo(Line.Info info) {
 
-        Vector vector = new Vector();
+        Vector<Line.Info> vector = new Vector<>();
         Line.Info[] currentInfoArray;
 
         Mixer mixer;
@@ -273,7 +273,7 @@ public class AudioSystem {
         Line.Info[] returnedArray = new Line.Info[vector.size()];
 
         for (int i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vector.get(i);
+            returnedArray[i] = vector.get(i);
         }
 
         return returnedArray;
@@ -292,7 +292,7 @@ public class AudioSystem {
      */
     public static Line.Info[] getTargetLineInfo(Line.Info info) {
 
-        Vector vector = new Vector();
+        Vector<Line.Info> vector = new Vector<>();
         Line.Info[] currentInfoArray;
 
         Mixer mixer;
@@ -312,7 +312,7 @@ public class AudioSystem {
         Line.Info[] returnedArray = new Line.Info[vector.size()];
 
         for (int i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vector.get(i);
+            returnedArray[i] = vector.get(i);
         }
 
         return returnedArray;
@@ -382,7 +382,7 @@ public class AudioSystem {
      */
     public static Line getLine(Line.Info info) throws LineUnavailableException {
         LineUnavailableException lue = null;
-        List providers = getMixerProviders();
+        List<MixerProvider> providers = getMixerProviders();
 
 
         // 1: try from default mixer for this line class
@@ -401,7 +401,7 @@ public class AudioSystem {
 
         // 2: if that doesn't work, try to find any mixing mixer
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             Mixer.Info[] infos = provider.getMixerInfo();
 
             for (int j = 0; j < infos.length; j++) {
@@ -423,7 +423,7 @@ public class AudioSystem {
 
         // 3: if that didn't work, try to find any non-mixing mixer
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             Mixer.Info[] infos = provider.getMixerInfo();
             for (int j = 0; j < infos.length; j++) {
                 try {
@@ -700,14 +700,14 @@ public class AudioSystem {
      */
     public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding) {
 
-        List codecs = getFormatConversionProviders();
-        Vector encodings = new Vector();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
+        Vector<AudioFormat.Encoding> encodings = new Vector<>();
 
         AudioFormat.Encoding encs[] = null;
 
         // gather from all the codecs
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if( codec.isSourceEncodingSupported( sourceEncoding ) ) {
                 encs = codec.getTargetEncodings();
                 for (int j = 0; j < encs.length; j++) {
@@ -715,7 +715,7 @@ public class AudioSystem {
                 }
             }
         }
-        AudioFormat.Encoding encs2[] = (AudioFormat.Encoding[]) encodings.toArray(new AudioFormat.Encoding[0]);
+        AudioFormat.Encoding encs2[] = encodings.toArray(new AudioFormat.Encoding[0]);
         return encs2;
     }
 
@@ -735,8 +735,8 @@ public class AudioSystem {
     public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
 
 
-        List codecs = getFormatConversionProviders();
-        Vector encodings = new Vector();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
+        Vector<AudioFormat.Encoding[]> encodings = new Vector<>();
 
         int size = 0;
         int index = 0;
@@ -745,7 +745,7 @@ public class AudioSystem {
         // gather from all the codecs
 
         for(int i=0; i<codecs.size(); i++ ) {
-            encs = ((FormatConversionProvider) codecs.get(i)).getTargetEncodings(sourceFormat);
+            encs = codecs.get(i).getTargetEncodings(sourceFormat);
             size += encs.length;
             encodings.addElement( encs );
         }
@@ -754,7 +754,7 @@ public class AudioSystem {
 
         AudioFormat.Encoding encs2[] = new AudioFormat.Encoding[size];
         for(int i=0; i<encodings.size(); i++ ) {
-            encs = (AudioFormat.Encoding [])(encodings.get(i));
+            encs = encodings.get(i);
             for(int j=0; j<encs.length; j++ ) {
                 encs2[index++] = encs[j];
             }
@@ -774,10 +774,10 @@ public class AudioSystem {
     public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
 
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if(codec.isConversionSupported(targetEncoding,sourceFormat) ) {
                 return true;
             }
@@ -801,10 +801,10 @@ public class AudioSystem {
     public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding,
                                                        AudioInputStream sourceStream) {
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i = 0; i < codecs.size(); i++) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if( codec.isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) {
                 return codec.getAudioInputStream( targetEncoding, sourceStream );
             }
@@ -825,8 +825,8 @@ public class AudioSystem {
      */
     public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
 
-        List codecs = getFormatConversionProviders();
-        Vector formats = new Vector();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
+        Vector<AudioFormat[]> formats = new Vector<>();
 
         int size = 0;
         int index = 0;
@@ -835,7 +835,7 @@ public class AudioSystem {
         // gather from all the codecs
 
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
             size += fmts.length;
             formats.addElement( fmts );
@@ -845,7 +845,7 @@ public class AudioSystem {
 
         AudioFormat fmts2[] = new AudioFormat[size];
         for(int i=0; i<formats.size(); i++ ) {
-            fmts = (AudioFormat [])(formats.get(i));
+            fmts = formats.get(i);
             for(int j=0; j<fmts.length; j++ ) {
                 fmts2[index++] = fmts[j];
             }
@@ -864,10 +864,10 @@ public class AudioSystem {
      */
     public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) {
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i=0; i<codecs.size(); i++ ) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if(codec.isConversionSupported(targetFormat, sourceFormat) ) {
                 return true;
             }
@@ -895,10 +895,10 @@ public class AudioSystem {
             return sourceStream;
         }
 
-        List codecs = getFormatConversionProviders();
+        List<FormatConversionProvider> codecs = getFormatConversionProviders();
 
         for(int i = 0; i < codecs.size(); i++) {
-            FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
+            FormatConversionProvider codec = codecs.get(i);
             if(codec.isConversionSupported(targetFormat,sourceStream.getFormat()) ) {
                 return codec.getAudioInputStream(targetFormat,sourceStream);
             }
@@ -931,11 +931,11 @@ public class AudioSystem {
     public static AudioFileFormat getAudioFileFormat(InputStream stream)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 format = reader.getAudioFileFormat( stream ); // throws IOException
                 break;
@@ -966,11 +966,11 @@ public class AudioSystem {
     public static AudioFileFormat getAudioFileFormat(URL url)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 format = reader.getAudioFileFormat( url ); // throws IOException
                 break;
@@ -1001,11 +1001,11 @@ public class AudioSystem {
     public static AudioFileFormat getAudioFileFormat(File file)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioFileFormat format = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 format = reader.getAudioFileFormat( file ); // throws IOException
                 break;
@@ -1044,11 +1044,11 @@ public class AudioSystem {
     public static AudioInputStream getAudioInputStream(InputStream stream)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioInputStream audioStream = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 audioStream = reader.getAudioInputStream( stream ); // throws IOException
                 break;
@@ -1079,11 +1079,11 @@ public class AudioSystem {
     public static AudioInputStream getAudioInputStream(URL url)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioInputStream audioStream = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 audioStream = reader.getAudioInputStream( url ); // throws IOException
                 break;
@@ -1114,11 +1114,11 @@ public class AudioSystem {
     public static AudioInputStream getAudioInputStream(File file)
         throws UnsupportedAudioFileException, IOException {
 
-        List providers = getAudioFileReaders();
+        List<AudioFileReader> providers = getAudioFileReaders();
         AudioInputStream audioStream = null;
 
         for(int i = 0; i < providers.size(); i++ ) {
-            AudioFileReader reader = (AudioFileReader) providers.get(i);
+            AudioFileReader reader = providers.get(i);
             try {
                 audioStream = reader.getAudioInputStream( file ); // throws IOException
                 break;
@@ -1142,17 +1142,17 @@ public class AudioSystem {
      *         array of length 0 is returned.
      */
     public static AudioFileFormat.Type[] getAudioFileTypes() {
-        List providers = getAudioFileWriters();
-        Set returnTypesSet = new HashSet();
+        List<AudioFileWriter> providers = getAudioFileWriters();
+        Set<AudioFileFormat.Type> returnTypesSet = new HashSet<>();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             AudioFileFormat.Type[] fileTypes = writer.getAudioFileTypes();
             for(int j=0; j < fileTypes.length; j++) {
                 returnTypesSet.add(fileTypes[j]);
             }
         }
-        AudioFileFormat.Type returnTypes[] = (AudioFileFormat.Type[])
+        AudioFileFormat.Type returnTypes[] =
             returnTypesSet.toArray(new AudioFileFormat.Type[0]);
         return returnTypes;
     }
@@ -1167,10 +1167,10 @@ public class AudioSystem {
      */
     public static boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             if (writer.isFileTypeSupported(fileType)) {
                 return true;
             }
@@ -1188,17 +1188,17 @@ public class AudioSystem {
      *         length 0 is returned.
      */
     public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
-        List providers = getAudioFileWriters();
-        Set returnTypesSet = new HashSet();
+        List<AudioFileWriter> providers = getAudioFileWriters();
+        Set<AudioFileFormat.Type> returnTypesSet = new HashSet<>();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             AudioFileFormat.Type[] fileTypes = writer.getAudioFileTypes(stream);
             for(int j=0; j < fileTypes.length; j++) {
                 returnTypesSet.add(fileTypes[j]);
             }
         }
-        AudioFileFormat.Type returnTypes[] = (AudioFileFormat.Type[])
+        AudioFileFormat.Type returnTypes[] =
             returnTypesSet.toArray(new AudioFileFormat.Type[0]);
         return returnTypes;
     }
@@ -1215,10 +1215,10 @@ public class AudioSystem {
     public static boolean isFileTypeSupported(AudioFileFormat.Type fileType,
                                               AudioInputStream stream) {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             if(writer.isFileTypeSupported(fileType, stream)) {
                 return true;
             }
@@ -1248,12 +1248,12 @@ public class AudioSystem {
     public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
                             OutputStream out) throws IOException {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
         int bytesWritten = 0;
         boolean flag = false;
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             try {
                 bytesWritten = writer.write( stream, fileType, out ); // throws IOException
                 flag = true;
@@ -1288,12 +1288,12 @@ public class AudioSystem {
     public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
                             File out) throws IOException {
 
-        List providers = getAudioFileWriters();
+        List<AudioFileWriter> providers = getAudioFileWriters();
         int bytesWritten = 0;
         boolean flag = false;
 
         for(int i=0; i < providers.size(); i++) {
-            AudioFileWriter writer = (AudioFileWriter) providers.get(i);
+            AudioFileWriter writer = providers.get(i);
             try {
                 bytesWritten = writer.write( stream, fileType, out ); // throws IOException
                 flag = true;
@@ -1315,8 +1315,9 @@ public class AudioSystem {
     /**
      * Obtains the set of MixerProviders on the system.
      */
-    private static List getMixerProviders() {
-        return getProviders(MixerProvider.class);
+    @SuppressWarnings("unchecked")
+    private static List<MixerProvider> getMixerProviders() {
+        return (List<MixerProvider>) getProviders(MixerProvider.class);
     }
 
     /**
@@ -1328,8 +1329,9 @@ public class AudioSystem {
      *         format converters. If no format converters readers are available
      *         on the system, an array of length 0 is returned.
      */
-    private static List getFormatConversionProviders() {
-        return getProviders(FormatConversionProvider.class);
+    @SuppressWarnings("unchecked")
+    private static List<FormatConversionProvider> getFormatConversionProviders() {
+        return (List<FormatConversionProvider>) getProviders(FormatConversionProvider.class);
     }
 
     /**
@@ -1341,8 +1343,9 @@ public class AudioSystem {
      *         readers. If no audio file readers are available on the system, an
      *         empty List is returned.
      */
-    private static List getAudioFileReaders() {
-        return getProviders(AudioFileReader.class);
+    @SuppressWarnings("unchecked")
+    private static List<AudioFileReader> getAudioFileReaders() {
+        return (List<AudioFileReader>)getProviders(AudioFileReader.class);
     }
 
     /**
@@ -1354,8 +1357,9 @@ public class AudioSystem {
      *         writers. If no audio file writers are available on the system, an
      *         empty List is returned.
      */
-    private static List getAudioFileWriters() {
-        return getProviders(AudioFileWriter.class);
+    @SuppressWarnings("unchecked")
+    private static List<AudioFileWriter> getAudioFileWriters() {
+        return (List<AudioFileWriter>)getProviders(AudioFileWriter.class);
     }
 
     /**
@@ -1368,8 +1372,8 @@ public class AudioSystem {
      * @return a Mixer that matches the requirements, or null if no default
      *         mixer found
      */
-    private static Mixer getDefaultMixer(List providers, Line.Info info) {
-        Class lineClass = info.getLineClass();
+    private static Mixer getDefaultMixer(List<MixerProvider> providers, Line.Info info) {
+        Class<?> lineClass = info.getLineClass();
         String providerClassName = JDK13Services.getDefaultProviderClassName(lineClass);
         String instanceName = JDK13Services.getDefaultInstanceName(lineClass);
         Mixer mixer;
@@ -1418,9 +1422,9 @@ public class AudioSystem {
      * @return A MixerProvider of the requested class, or null if none is found
      */
     private static MixerProvider getNamedProvider(String providerClassName,
-                                                  List providers) {
+                                                  List<MixerProvider> providers) {
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             if (provider.getClass().getName().equals(providerClassName)) {
                 return provider;
             }
@@ -1462,10 +1466,10 @@ public class AudioSystem {
      * @return A Mixer matching the requirements, or null if none is found
      */
     private static Mixer getNamedMixer(String mixerName,
-                                       List providers,
+                                       List<MixerProvider> providers,
                                        Line.Info info) {
         for(int i = 0; i < providers.size(); i++) {
-            MixerProvider provider = (MixerProvider) providers.get(i);
+            MixerProvider provider = providers.get(i);
             Mixer mixer = getNamedMixer(mixerName, provider, info);
             if (mixer != null) {
                 return mixer;
@@ -1511,7 +1515,7 @@ public class AudioSystem {
         if (! mixer.isLineSupported(lineInfo)) {
             return false;
         }
-        Class lineClass = lineInfo.getLineClass();
+        Class<?> lineClass = lineInfo.getLineClass();
         if (isMixingRequired
             && (SourceDataLine.class.isAssignableFrom(lineClass) ||
                 Clip.class.isAssignableFrom(lineClass))) {
@@ -1524,22 +1528,22 @@ public class AudioSystem {
     /**
      * Like getMixerInfo, but return List.
      */
-    private static List getMixerInfoList() {
-        List providers = getMixerProviders();
+    private static List<Mixer.Info> getMixerInfoList() {
+        List<MixerProvider> providers = getMixerProviders();
         return getMixerInfoList(providers);
     }
 
     /**
      * Like getMixerInfo, but return List.
      */
-    private static List getMixerInfoList(List providers) {
-        List infos = new ArrayList();
+    private static List<Mixer.Info> getMixerInfoList(List<MixerProvider> providers) {
+        List<Mixer.Info> infos = new ArrayList<>();
 
         Mixer.Info[] someInfos; // per-mixer
         Mixer.Info[] allInfos;  // for all mixers
 
         for(int i = 0; i < providers.size(); i++ ) {
-            someInfos = ((MixerProvider)providers.get(i)).getMixerInfo();
+            someInfos = providers.get(i).getMixerInfo();
 
             for (int j = 0; j < someInfos.length; j++) {
                 infos.add(someInfos[j]);
@@ -1556,7 +1560,7 @@ public class AudioSystem {
      * @return a List of instances of providers for the requested service. If no
      *         providers are available, a vector of length 0 will be returned.
      */
-    private static List getProviders(Class providerClass) {
+    private static List<?> getProviders(Class<?> providerClass) {
         return JDK13Services.getProviders(providerClass);
     }
 }
diff --git a/jdk/src/share/classes/javax/sound/sampled/Line.java b/jdk/src/share/classes/javax/sound/sampled/Line.java
index 0b9d96c0b89..feb69fde185 100644
--- a/jdk/src/share/classes/javax/sound/sampled/Line.java
+++ b/jdk/src/share/classes/javax/sound/sampled/Line.java
@@ -230,7 +230,7 @@ public interface Line extends AutoCloseable {
         /**
          * The class of the line described by the info object.
          */
-        private final Class lineClass;
+        private final Class<?> lineClass;
 
         /**
          * Constructs an info object that describes a line of the specified
-- 
GitLab


From 6733dcbb1cde2a502550311194806a78ba05a535 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Fri, 6 Jun 2014 13:52:49 +0400
Subject: [PATCH 051/192] 8044516: [macosx] ScreenPopupFactory uses native
 method that could be avoided

Reviewed-by: anthony, serb
---
 .../com/apple/laf/ScreenPopupFactory.java     | 21 ++-------
 .../native/com/apple/laf/ScreenPopupFactory.m | 44 -------------------
 .../classes/javax/swing/PopupFactory.java     | 11 +++++
 .../classes/sun/swing/SwingAccessor.java      | 35 +++++++++++++--
 4 files changed, 46 insertions(+), 65 deletions(-)
 delete mode 100644 jdk/src/macosx/native/com/apple/laf/ScreenPopupFactory.m

diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenPopupFactory.java b/jdk/src/macosx/classes/com/apple/laf/ScreenPopupFactory.java
index 1ab50a18679..bb2c0f1081b 100644
--- a/jdk/src/macosx/classes/com/apple/laf/ScreenPopupFactory.java
+++ b/jdk/src/macosx/classes/com/apple/laf/ScreenPopupFactory.java
@@ -29,18 +29,9 @@ import java.awt.*;
 import javax.swing.*;
 
 import sun.lwawt.macosx.CPlatformWindow;
+import sun.swing.SwingAccessor;
 
 class ScreenPopupFactory extends PopupFactory {
-    static {
-        java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<Void>() {
-                public Void run() {
-                    System.loadLibrary("osxui");
-                    return null;
-                }
-            });
-    }
-
     static final Float TRANSLUCENT = new Float(248f/255f);
     static final Float OPAQUE = new Float(1.0f);
 
@@ -59,19 +50,13 @@ class ScreenPopupFactory extends PopupFactory {
         return (Window)w;
     }
 
-    /*
-     * Since we can't change the signature of PopupFactory, we have to call the
-     * private method getPopup(Component, Component, int, int, int) through JNI
-     * (see AquaLookAndFeel.m)
-     */
-    native Popup _getHeavyWeightPopup(Component comp, Component invoker, int x, int y);
-
     public Popup getPopup(final Component comp, final Component invoker, final int x, final int y) {
         if (invoker == null) throw new IllegalArgumentException("Popup.getPopup must be passed non-null contents");
 
         final Popup popup;
         if (fIsActive) {
-            popup = _getHeavyWeightPopup(comp, invoker, x, y);
+            popup = SwingAccessor.getPopupFactoryAccessor()
+                    .getHeavyWeightPopup(this, comp, invoker, x, y);
         } else {
             popup = super.getPopup(comp, invoker, x, y);
         }
diff --git a/jdk/src/macosx/native/com/apple/laf/ScreenPopupFactory.m b/jdk/src/macosx/native/com/apple/laf/ScreenPopupFactory.m
deleted file mode 100644
index 516ce45d5a0..00000000000
--- a/jdk/src/macosx/native/com/apple/laf/ScreenPopupFactory.m
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#import "com_apple_laf_ScreenPopupFactory.h"
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-static JNF_CLASS_CACHE(sjc_PopupFactory, "javax/swing/PopupFactory");
-static JNF_MEMBER_CACHE(jm_getPopup, sjc_PopupFactory, "getPopup", "(Ljava/awt/Component;Ljava/awt/Component;III)Ljavax/swing/Popup;");
-
-/*
- * Class:     com_apple_laf_ScreenPopupFactory
- * Method:    _getHeavyWeightPopup
- * Signature: (Ljava/awt/Component;Ljava/awt/Component;II)Ljavax/swing/Popup;
- */
-JNIEXPORT jobject /* javax.swing.Popup */ JNICALL Java_com_apple_laf_ScreenPopupFactory__1getHeavyWeightPopup
-(JNIEnv *env, jobject screenPopupFactory, jobject comp, jobject invoker, jint x, jint y) {
-    jobject popup;
-JNF_COCOA_ENTER(env);
-    popup = JNFCallObjectMethod(env, screenPopupFactory, jm_getPopup, comp, invoker, x, y, 2);
-JNF_COCOA_EXIT(env);
-    return popup;
-}
diff --git a/jdk/src/share/classes/javax/swing/PopupFactory.java b/jdk/src/share/classes/javax/swing/PopupFactory.java
index 695ef2bb76b..840d7d14962 100644
--- a/jdk/src/share/classes/javax/swing/PopupFactory.java
+++ b/jdk/src/share/classes/javax/swing/PopupFactory.java
@@ -27,6 +27,7 @@ package javax.swing;
 
 import sun.awt.EmbeddedFrame;
 import sun.awt.OSInfo;
+import sun.swing.SwingAccessor;
 
 import java.applet.Applet;
 import java.awt.*;
@@ -60,6 +61,16 @@ import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP
  * @since 1.4
  */
 public class PopupFactory {
+
+    static {
+        SwingAccessor.setPopupFactoryAccessor(new SwingAccessor.PopupFactoryAccessor() {
+            @Override
+            public Popup getHeavyWeightPopup(PopupFactory factory, Component owner,
+                                             Component contents, int ownerX, int ownerY) {
+                return factory.getPopup(owner, contents, ownerX, ownerY, HEAVY_WEIGHT_POPUP);
+            }
+        });
+    }
     /**
      * The shared instanceof <code>PopupFactory</code> is per
      * <code>AppContext</code>. This is the key used in the
diff --git a/jdk/src/share/classes/sun/swing/SwingAccessor.java b/jdk/src/share/classes/sun/swing/SwingAccessor.java
index 797802abd8c..37aa744a69b 100644
--- a/jdk/src/share/classes/sun/swing/SwingAccessor.java
+++ b/jdk/src/share/classes/sun/swing/SwingAccessor.java
@@ -27,11 +27,10 @@ package sun.swing;
 
 import sun.misc.Unsafe;
 
-import java.awt.Point;
-import javax.swing.RepaintManager;
+import java.awt.*;
+import javax.swing.*;
 
 import javax.swing.text.JTextComponent;
-import javax.swing.TransferHandler;
 
 /**
  * The SwingAccessor utility class.
@@ -90,6 +89,14 @@ public final class SwingAccessor {
         void removeRepaintListener(RepaintManager rm, SwingUtilities2.RepaintListener l);
     }
 
+    /**
+     * An accessor for PopupFactory class.
+     */
+    public interface PopupFactoryAccessor {
+        Popup getHeavyWeightPopup(PopupFactory factory, Component owner, Component contents,
+                                  int ownerX, int ownerY);
+    }
+
     /**
      * The javax.swing.text.JTextComponent class accessor object.
      */
@@ -156,4 +163,26 @@ public final class SwingAccessor {
         }
         return repaintManagerAccessor;
     }
+
+    /**
+     * The PopupFactory class accessor object.
+     */
+    private static PopupFactoryAccessor popupFactoryAccessor;
+
+    /**
+     * Retrieve the accessor object for the PopupFactory class.
+     */
+    public static PopupFactoryAccessor getPopupFactoryAccessor() {
+        if (popupFactoryAccessor == null) {
+            unsafe.ensureClassInitialized(PopupFactory.class);
+        }
+        return popupFactoryAccessor;
+    }
+
+    /**
+     * Set an Accessor object for the PopupFactory class.
+     */
+    public static void setPopupFactoryAccessor(PopupFactoryAccessor popupFactoryAccessor) {
+        SwingAccessor.popupFactoryAccessor = popupFactoryAccessor;
+    }
 }
-- 
GitLab


From bfa90f6f301a1ecabe89ae5f17300d1f504a84c0 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Fri, 6 Jun 2014 14:52:07 +0400
Subject: [PATCH 052/192] 8041990: [macosx] Language specific keys does not
 work in applets when opened outside the browser

Reviewed-by: alexsch, serb
---
 .../share/classes/java/awt/EventQueue.java    |   5 +
 .../java/awt/event/InputMethodEvent.java      |  35 +++++-
 .../share/classes/sun/awt/AWTAccessor.java    |   7 +-
 jdk/test/java/awt/im/8041990/bug8041990.java  | 104 ++++++++++++++++++
 4 files changed, 145 insertions(+), 6 deletions(-)
 create mode 100644 jdk/test/java/awt/im/8041990/bug8041990.java

diff --git a/jdk/src/share/classes/java/awt/EventQueue.java b/jdk/src/share/classes/java/awt/EventQueue.java
index 4164641392e..87bbace3ac8 100644
--- a/jdk/src/share/classes/java/awt/EventQueue.java
+++ b/jdk/src/share/classes/java/awt/EventQueue.java
@@ -214,6 +214,11 @@ public class EventQueue {
                                             FwDispatcher dispatcher) {
                     eventQueue.setFwDispatcher(dispatcher);
                 }
+
+                @Override
+                public long getMostRecentEventTime(EventQueue eventQueue) {
+                    return eventQueue.getMostRecentEventTimeImpl();
+                }
             });
     }
 
diff --git a/jdk/src/share/classes/java/awt/event/InputMethodEvent.java b/jdk/src/share/classes/java/awt/event/InputMethodEvent.java
index 104f10b8fea..ca214ed6e45 100644
--- a/jdk/src/share/classes/java/awt/event/InputMethodEvent.java
+++ b/jdk/src/share/classes/java/awt/event/InputMethodEvent.java
@@ -25,6 +25,10 @@
 
 package java.awt.event;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AppContext;
+import sun.awt.SunToolkit;
+
 import java.awt.AWTEvent;
 import java.awt.Component;
 import java.awt.EventQueue;
@@ -217,8 +221,10 @@ public class InputMethodEvent extends AWTEvent {
     public InputMethodEvent(Component source, int id,
             AttributedCharacterIterator text, int committedCharacterCount,
             TextHitInfo caret, TextHitInfo visiblePosition) {
-        this(source, id, EventQueue.getMostRecentEventTime(), text,
-             committedCharacterCount, caret, visiblePosition);
+        this(source, id,
+                getMostRecentEventTimeForSource(source),
+                text, committedCharacterCount,
+                caret, visiblePosition);
     }
 
     /**
@@ -258,8 +264,9 @@ public class InputMethodEvent extends AWTEvent {
      */
     public InputMethodEvent(Component source, int id, TextHitInfo caret,
             TextHitInfo visiblePosition) {
-        this(source, id, EventQueue.getMostRecentEventTime(), null,
-             0, caret, visiblePosition);
+        this(source, id,
+                getMostRecentEventTimeForSource(source),
+                null, 0, caret, visiblePosition);
     }
 
     /**
@@ -411,7 +418,25 @@ public class InputMethodEvent extends AWTEvent {
     private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
         s.defaultReadObject();
         if (when == 0) {
-            when = EventQueue.getMostRecentEventTime();
+            when = getMostRecentEventTimeForSource(this.source);
+        }
+    }
+
+    /**
+     * Get the most recent event time in the {@code EventQueue} which the {@code source}
+     * belongs to.
+     *
+     * @param source the source of the event
+     * @exception  IllegalArgumentException  if source is null.
+     * @return most recent event time in the {@code EventQueue}
+     */
+    private static long getMostRecentEventTimeForSource(Object source) {
+        if (source == null) {
+            // throw the IllegalArgumentException to conform to EventObject spec
+            throw new IllegalArgumentException("null source");
         }
+        AppContext appContext = SunToolkit.targetToAppContext(source);
+        EventQueue eventQueue = SunToolkit.getSystemEventQueueImplPP(appContext);
+        return AWTAccessor.getEventQueueAccessor().getMostRecentEventTime(eventQueue);
     }
 }
diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java
index 1d60a1c332d..0bec70b332a 100644
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java
@@ -530,7 +530,12 @@ public final class AWTAccessor {
         /**
          * Sets the delegate for the EventQueue used by FX/AWT single threaded mode
          */
-        public void setFwDispatcher(EventQueue eventQueue, FwDispatcher dispatcher);
+        void setFwDispatcher(EventQueue eventQueue, FwDispatcher dispatcher);
+
+        /**
+         * Gets most recent event time in the EventQueue
+         */
+        long getMostRecentEventTime(EventQueue eventQueue);
     }
 
     /*
diff --git a/jdk/test/java/awt/im/8041990/bug8041990.java b/jdk/test/java/awt/im/8041990/bug8041990.java
new file mode 100644
index 00000000000..ee813e6715c
--- /dev/null
+++ b/jdk/test/java/awt/im/8041990/bug8041990.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+  @test
+  @bug 8041990
+  @summary Language specific keys does not work in applets when opened outside the browser
+  @author Petr Pchelko
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputMethodEvent;
+import java.awt.font.TextHitInfo;
+import java.text.AttributedString;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class bug8041990 {
+    private static JFrame frame;
+    private static JComponent component;
+
+    public static void main(String[] args) throws Exception {
+        ThreadGroup stubTG = new ThreadGroup(getRootThreadGroup(), "Stub Thread Group");
+        ThreadGroup swingTG = new ThreadGroup(getRootThreadGroup(), "SwingTG");
+        try {
+            Thread stubThread = new Thread(stubTG, SunToolkit::createNewAppContext);
+            stubThread.start();
+            stubThread.join();
+
+            CountDownLatch startSwingLatch = new CountDownLatch(1);
+            new Thread(swingTG, () -> {
+                SunToolkit.createNewAppContext();
+                SwingUtilities.invokeLater(() -> {
+                    frame = new JFrame();
+                    component = new JLabel("Test Text");
+                    frame.add(component);
+                    frame.setBounds(100, 100, 100, 100);
+                    frame.setVisible(true);
+                    startSwingLatch.countDown();
+                });
+            }).start();
+            startSwingLatch.await();
+
+            AtomicReference<Exception> caughtException = new AtomicReference<>();
+            Thread checkThread = new Thread(getRootThreadGroup(), () -> {
+                try {
+                    // If the bug is present this will throw exception
+                    new InputMethodEvent(component,
+                            InputMethodEvent.CARET_POSITION_CHANGED,
+                            TextHitInfo.leading(0),
+                            TextHitInfo.trailing(0));
+                } catch (Exception e) {
+                    caughtException.set(e);
+                }
+            });
+            checkThread.start();
+            checkThread.join();
+
+            if (caughtException.get() != null) {
+                throw new RuntimeException("Failed. Caught exception!", caughtException.get());
+            }
+        } finally {
+            new Thread(swingTG, () -> SwingUtilities.invokeLater(() -> {
+                if (frame != null) {
+                    frame.dispose();
+                }
+            })).start();
+        }
+    }
+
+    private static ThreadGroup getRootThreadGroup() {
+        ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
+        ThreadGroup parentTG = currentTG.getParent();
+        while (parentTG != null) {
+            currentTG = parentTG;
+            parentTG = currentTG.getParent();
+        }
+        return currentTG;
+    }
+}
-- 
GitLab


From 52233220f23932d768e8562ac4d7f890fc337b72 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Fri, 6 Jun 2014 14:58:41 +0400
Subject: [PATCH 053/192] 8041464: [TEST_BUG] CustomClassLoaderTransferTest
 does not support OS X

Reviewed-by: azvegint, serb
---
 .../AnotherInterface.java                     |  3 +
 .../CustomClassLoaderTransferTest.java        | 63 +++++++++++++++++++
 .../TransferableList.java                     | 30 +++++++++
 .../awt/regtesthelpers/CopyClassFile.java     | 34 ++++++++--
 4 files changed, 126 insertions(+), 4 deletions(-)
 create mode 100644 jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/AnotherInterface.java
 create mode 100644 jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/CustomClassLoaderTransferTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/TransferableList.java

diff --git a/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/AnotherInterface.java b/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/AnotherInterface.java
new file mode 100644
index 00000000000..17c905e581b
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/AnotherInterface.java
@@ -0,0 +1,3 @@
+import java.io.*;
+
+public interface AnotherInterface extends Serializable {}
diff --git a/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/CustomClassLoaderTransferTest.java b/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/CustomClassLoaderTransferTest.java
new file mode 100644
index 00000000000..4468eafd8b4
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/CustomClassLoaderTransferTest.java
@@ -0,0 +1,63 @@
+/*
+  @test
+  @bug 4932376
+  @summary verifies that data transfer within one JVM works correctly if
+           the transfer data was created with a custom class loader.
+  @author das@sparc.spb.su area=datatransfer
+  @library ../../regtesthelpers
+  @build TransferableList AnotherInterface CopyClassFile CustomClassLoaderTransferTest
+  @run main CopyClassFile -r ListInterface subdir/
+  @run main CopyClassFile -r TransferableList subdir/
+  @run main CustomClassLoaderTransferTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.io.*;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class CustomClassLoaderTransferTest {
+    public static class DFTransferable implements Transferable {
+        private final DataFlavor df;
+        private final Object obj;
+        public DFTransferable(DataFlavor df, Object obj) {
+            this.df = df;
+            this.obj = obj;
+        }
+
+        @Override
+        public Object getTransferData(DataFlavor flavor)
+          throws UnsupportedFlavorException, IOException {
+            if (df.equals(flavor)) {
+                return obj;
+            } else {
+                throw new UnsupportedFlavorException(flavor);
+            }
+        }
+
+        @Override
+        public DataFlavor[] getTransferDataFlavors(){
+            return new DataFlavor[] { df };
+        }
+
+        @Override
+        public boolean isDataFlavorSupported(DataFlavor flavor) {
+            return df.equals(flavor);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
+        URL url = new File("./subdir/").toURL();
+        ClassLoader classLoader = new URLClassLoader(new URL[] { url },
+                CustomClassLoaderTransferTest.class.getClassLoader());
+        Class clazz = Class.forName("TransferableList", true, classLoader);
+        DataFlavor df = new DataFlavor(clazz, "Transferable List");
+        Object obj = clazz.newInstance();
+        Transferable t = new DFTransferable(df, obj);
+        c.setContents(t, null);
+        Transferable ct = c.getContents(null);
+        ct.getTransferData(df);
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/TransferableList.java b/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/TransferableList.java
new file mode 100644
index 00000000000..8c28a160b8b
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/CustomClassLoaderTransferTest/TransferableList.java
@@ -0,0 +1,30 @@
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+
+public class TransferableList extends ArrayList {
+    private static class NullInvocationHandler implements InvocationHandler, Serializable {
+        public Object invoke(Object proxy, Method method, Object[] args)
+          throws Throwable {
+            throw new Error("UNIMPLEMENTED");
+        }
+    }
+
+    public TransferableList() {
+        try {
+            InvocationHandler handler = new NullInvocationHandler();
+            Class<?> proxyClass = Proxy.getProxyClass(
+                ListInterface.class.getClassLoader(),
+                new Class[] { ListInterface.class, AnotherInterface.class });
+            AnotherInterface obj = (AnotherInterface) proxyClass.
+                    getConstructor(new Class[]{InvocationHandler.class}).
+                    newInstance(handler);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
+
+interface ListInterface extends Serializable {}
diff --git a/jdk/test/java/awt/regtesthelpers/CopyClassFile.java b/jdk/test/java/awt/regtesthelpers/CopyClassFile.java
index 1ee6513638f..4db241d67eb 100644
--- a/jdk/test/java/awt/regtesthelpers/CopyClassFile.java
+++ b/jdk/test/java/awt/regtesthelpers/CopyClassFile.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -39,6 +39,8 @@ import java.util.Arrays;
  *
  * @build CopyClassFile
  * @run main CopyClassFile package.class dest_directory
+ *
+ * In case the source file should be removed add -r option
  */
 public class CopyClassFile {
 
@@ -48,13 +50,17 @@ public class CopyClassFile {
     private static String className;
     private static String classFile;
 
+    private static boolean removeSource = false;
+
     public static void main(String[] args) throws Exception {
-        if (args.length != 2) {
+        if (args.length < 2) {
             throw new IllegalArgumentException("Illegal usage: class name and destination directory should be specified");
         }
 
-        destinationDir = args[1];
-        className = args[0];
+        int classNameIndex = parseOptions(args);
+
+        className = args[classNameIndex];
+        destinationDir = args[classNameIndex + 1];
         classFile = className.replaceAll("\\.", File.separator) + ".class";
 
         URL url = cl.getResource(classFile);
@@ -69,6 +75,21 @@ public class CopyClassFile {
         Arrays.stream(files).forEach(CopyClassFile::copyFile);
     }
 
+    private static int parseOptions(String[] args) {
+        int optionsEnd = 0;
+        while (args[optionsEnd].startsWith("-")) {
+            switch (args[optionsEnd].substring(1)) {
+                case "r" :
+                    removeSource = true;
+                    break;
+                default:
+                    throw new RuntimeException("Unrecognized option passed to CopyClassFile: " + args[optionsEnd]);
+            }
+            optionsEnd++;
+        }
+        return optionsEnd;
+    }
+
     private static String cutPackageName(String className) {
         int dotIndex = className.lastIndexOf(".") + 1;
         if (dotIndex <= 0) {
@@ -87,6 +108,11 @@ public class CopyClassFile {
             try (InputStream is = new FileInputStream(f)) {
                 Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
             }
+
+            if (removeSource && !f.delete()) {
+                throw new RuntimeException("Failed to delete a file");
+            }
+
         } catch (IOException ex) {
             throw new RuntimeException("Could not copy file " + f, ex);
         }
-- 
GitLab


From 71b76d4073ca7f764b5bbc72dab0e678b392eac2 Mon Sep 17 00:00:00 2001
From: Christian Tornqvist <ctornqvi@openjdk.org>
Date: Fri, 6 Jun 2014 14:46:42 +0200
Subject: [PATCH 054/192] 8043492: ad_x86_64_misc.obj : error LNK2011:
 precompiled object not linked in; image may not run

Added _build_pch_file.obj to LD_FLAGS and cleaned up support for older Visual Studio versions

Reviewed-by: twisti, lfoltan, sla, kvn
---
 hotspot/make/windows/create.bat               |  27 +----
 hotspot/make/windows/makefiles/compile.make   | 114 +-----------------
 hotspot/make/windows/makefiles/rules.make     |  31 +----
 hotspot/make/windows/makefiles/sa.make        |  11 +-
 hotspot/make/windows/makefiles/sanity.make    |  10 +-
 hotspot/make/windows/makefiles/vm.make        |   4 +-
 .../make/windows/projectfiles/common/Makefile |   3 +-
 hotspot/src/share/vm/runtime/vm_version.cpp   |  14 +--
 8 files changed, 19 insertions(+), 195 deletions(-)

diff --git a/hotspot/make/windows/create.bat b/hotspot/make/windows/create.bat
index a9a8acea6d2..fb0d450187a 100644
--- a/hotspot/make/windows/create.bat
+++ b/hotspot/make/windows/create.bat
@@ -1,6 +1,6 @@
 @echo off
 REM
-REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+REM Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 REM
 REM This code is free software; you can redistribute it and/or modify it
@@ -81,33 +81,8 @@ REM figure out MSC version
 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i
 
 echo **************************************************************
-set ProjectFile=%HotSpotBuildSpace%\jvm.vcproj
 echo MSC_VER = "%MSC_VER%" 
-if "%MSC_VER%" == "1200" (
-set ProjectFile=%HotSpotBuildSpace%\jvm.dsp
-echo Will generate VC6 project {unsupported}
-) else (
-if "%MSC_VER%" == "1400" (
-echo Will generate VC8 {Visual Studio 2005}
-) else (
-if "%MSC_VER%" == "1500" (
-echo Will generate VC9 {Visual Studio 2008}
-) else (
-if "%MSC_VER%" == "1600" (
-echo Will generate VC10 {Visual Studio 2010}
 set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj
-) else (
-if "%MSC_VER%" == "1700" (
-echo Will generate VC10 {compatible with Visual Studio 2012}
-echo After opening in VS 2012, click "Update" when prompted.
-set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj
-) else (
-echo Will generate VC7 project {Visual Studio 2003 .NET}
-)
-)
-)
-)
-)
 echo %ProjectFile%
 echo **************************************************************
 
diff --git a/hotspot/make/windows/makefiles/compile.make b/hotspot/make/windows/makefiles/compile.make
index 9da2742335e..a4d1c0d4c3e 100644
--- a/hotspot/make/windows/makefiles/compile.make
+++ b/hotspot/make/windows/makefiles/compile.make
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, 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
@@ -63,28 +63,20 @@ CXX_FLAGS=$(CXX_FLAGS) /Zi
 # Based on BUILDARCH we add some flags and select the default compiler name
 !if "$(BUILDARCH)" == "ia64"
 MACHINE=IA64
-DEFAULT_COMPILER_NAME=VS2003
 CXX_FLAGS=$(CXX_FLAGS) /D "CC_INTERP" /D "_LP64" /D "IA64"
 !endif
 
 !if "$(BUILDARCH)" == "amd64"
 MACHINE=AMD64
-DEFAULT_COMPILER_NAME=VS2005
 CXX_FLAGS=$(CXX_FLAGS) /D "_LP64" /D "AMD64"
 LP64=1
 !endif
 
 !if "$(BUILDARCH)" == "i486"
 MACHINE=I386
-DEFAULT_COMPILER_NAME=VS2003
 CXX_FLAGS=$(CXX_FLAGS) /D "IA32"
 !endif
 
-# Sanity check, this is the default if not amd64, ia64, or i486
-!ifndef DEFAULT_COMPILER_NAME
-CXX=ARCH_ERROR
-!endif
-
 CXX_FLAGS=$(CXX_FLAGS) /D "WIN32" /D "_WINDOWS"
 # Must specify this for sharedRuntimeTrig.cpp
 CXX_FLAGS=$(CXX_FLAGS) /D "VM_LITTLE_ENDIAN"
@@ -112,6 +104,7 @@ CXX_FLAGS=$(CXX_FLAGS) /D TARGET_COMPILER_visCPP
 #      1500 is for VS2008
 #      1600 is for VS2010
 #      1700 is for VS2012
+#      1800 is for VS2013
 #    Do not confuse this MSC_VER with the predefined macro _MSC_VER that the
 #    compiler provides, when MSC_VER==1399, _MSC_VER will be 1400.
 #    Normally they are the same, but a pre-release of the VS2005 compilers
@@ -119,35 +112,6 @@ CXX_FLAGS=$(CXX_FLAGS) /D TARGET_COMPILER_visCPP
 #    closer to VS2003 in terms of option spellings, so we use 1399 for that
 #    1400 version that really isn't 1400.
 #    See the file get_msc_ver.sh for more info.
-!if "x$(MSC_VER)" == "x"
-COMPILER_NAME=$(DEFAULT_COMPILER_NAME)
-!else
-!if "$(MSC_VER)" == "1200"
-COMPILER_NAME=VC6
-!endif
-!if "$(MSC_VER)" == "1300"
-COMPILER_NAME=VS2003
-!endif
-!if "$(MSC_VER)" == "1310"
-COMPILER_NAME=VS2003
-!endif
-!if "$(MSC_VER)" == "1399"
-# Compiler might say 1400, but if it's 14.00.30701, it isn't really VS2005
-COMPILER_NAME=VS2003
-!endif
-!if "$(MSC_VER)" == "1400"
-COMPILER_NAME=VS2005
-!endif
-!if "$(MSC_VER)" == "1500"
-COMPILER_NAME=VS2008
-!endif
-!if "$(MSC_VER)" == "1600"
-COMPILER_NAME=VS2010
-!endif
-!if "$(MSC_VER)" == "1700"
-COMPILER_NAME=VS2012
-!endif
-!endif
 
 # By default, we do not want to use the debug version of the msvcrt.dll file
 #   but if MFC_DEBUG is defined in the environment it will be used.
@@ -165,60 +129,6 @@ MS_RUNTIME_OPTION = $(MS_RUNTIME_OPTION) $(STATIC_CPPLIB_OPTION)
 !endif
 CXX_FLAGS=$(CXX_FLAGS) $(MS_RUNTIME_OPTION)
 
-# How /GX option is spelled
-GX_OPTION = /GX
-
-# Optimization settings for various versions of the compilers and types of
-#    builds. Three basic sets of settings: product, fastdebug, and debug.
-#    These get added into CXX_FLAGS as needed by other makefiles.
-!if "$(COMPILER_NAME)" == "VC6"
-PRODUCT_OPT_OPTION   = /Ox /Os /Gy /GF
-FASTDEBUG_OPT_OPTION = /Ox /Os /Gy /GF
-DEBUG_OPT_OPTION     = /Od
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2003"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2005"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-GX_OPTION = /EHsc
-# This VS2005 compiler has /GS as a default and requires bufferoverflowU.lib 
-#    on the link command line, otherwise we get missing __security_check_cookie
-#    externals at link time. Even with /GS-, you need bufferoverflowU.lib.
-#    NOTE: Currently we decided to not use /GS-
-BUFFEROVERFLOWLIB = bufferoverflowU.lib
-LD_FLAGS = /manifest $(LD_FLAGS) $(BUFFEROVERFLOWLIB)
-# Manifest Tool - used in VS2005 and later to adjust manifests stored
-# as resources inside build artifacts.
-!if "x$(MT)" == "x"
-MT=mt.exe
-!endif
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2008"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-GX_OPTION = /EHsc
-LD_FLAGS = /manifest $(LD_FLAGS)
-MP_FLAG = /MP
-# Manifest Tool - used in VS2005 and later to adjust manifests stored
-# as resources inside build artifacts.
-!if "x$(MT)" == "x"
-MT=mt.exe
-!endif
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2010"
 PRODUCT_OPT_OPTION   = /O2 /Oy-
 FASTDEBUG_OPT_OPTION = /O2 /Oy-
 DEBUG_OPT_OPTION     = /Od
@@ -233,26 +143,6 @@ MT=mt.exe
 !if "$(BUILDARCH)" == "i486"
 LD_FLAGS = /SAFESEH $(LD_FLAGS)
 !endif
-!endif
-
-!if "$(COMPILER_NAME)" == "VS2012"
-PRODUCT_OPT_OPTION   = /O2 /Oy-
-FASTDEBUG_OPT_OPTION = /O2 /Oy-
-DEBUG_OPT_OPTION     = /Od
-GX_OPTION = /EHsc
-LD_FLAGS = /manifest $(LD_FLAGS)
-MP_FLAG = /MP
-# Manifest Tool - used in VS2005 and later to adjust manifests stored
-# as resources inside build artifacts.
-!if "x$(MT)" == "x"
-MT=mt.exe
-!endif
-SAFESEH_FLAG = /SAFESEH
-!endif
-
-!if "$(BUILDARCH)" == "i486"
-LD_FLAGS = $(SAFESEH_FLAG) $(LD_FLAGS)
-!endif
 
 CXX_FLAGS = $(CXX_FLAGS) $(MP_FLAG)
 
diff --git a/hotspot/make/windows/makefiles/rules.make b/hotspot/make/windows/makefiles/rules.make
index c5d565a2880..08a6a85e101 100644
--- a/hotspot/make/windows/makefiles/rules.make
+++ b/hotspot/make/windows/makefiles/rules.make
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, 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,35 +49,8 @@ BOOT_TARGET_CLASS_VERSION=6
 JAVAC_FLAGS=-g -encoding ascii
 BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
 
-ProjectFile=jvm.vcproj
-
-!if "$(MSC_VER)" == "1200"
-
-VcVersion=VC6
-ProjectFile=jvm.dsp
-
-!elseif "$(MSC_VER)" == "1400"
-
-VcVersion=VC8
-
-!elseif "$(MSC_VER)" == "1500"
-
-VcVersion=VC9
-
-!elseif "$(MSC_VER)" == "1600"
-
-VcVersion=VC10
-ProjectFile=jvm.vcxproj
-
-!elseif "$(MSC_VER)" == "1700"
-# This is VS2012, but it loads VS10 projects just fine (and will
+# VS2012 and VS2013 loads VS10 projects just fine (and will
 # upgrade them automatically to VS2012 format).
-
 VcVersion=VC10
 ProjectFile=jvm.vcxproj
 
-!else
-
-VcVersion=VC7
-
-!endif
diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make
index 2208da9e3d8..13bb8130ef4 100644
--- a/hotspot/make/windows/makefiles/sa.make
+++ b/hotspot/make/windows/makefiles/sa.make
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, 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
@@ -85,14 +85,9 @@ checkAndBuildSA:: $(SAWINDBG)
 # will be useful to have the assertion checks in place
 
 !if "$(BUILDARCH)" == "ia64"
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
+SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -c
 !elseif "$(BUILDARCH)" == "amd64"
-SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c
-!if "$(COMPILER_NAME)" == "VS2005"
-# On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line, 
-# otherwise we get missing __security_check_cookie externals at link time. 
-SA_LD_FLAGS = bufferoverflowU.lib
-!endif
+SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -c
 !else
 SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c 
 !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
diff --git a/hotspot/make/windows/makefiles/sanity.make b/hotspot/make/windows/makefiles/sanity.make
index b502cfaa65f..515b0bb1b50 100644
--- a/hotspot/make/windows/makefiles/sanity.make
+++ b/hotspot/make/windows/makefiles/sanity.make
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, 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,9 +27,9 @@
 all: checkCL checkLink
 
 checkCL:
-	@ if "$(MSC_VER)" NEQ "1310" if "$(MSC_VER)" NEQ "1399" if "$(MSC_VER)" NEQ "1400" if "$(MSC_VER)" NEQ "1500" if "$(MSC_VER)" NEQ "1600" if "$(MSC_VER)" NEQ "1700" \
-	echo *** WARNING *** unrecognized cl.exe version $(MSC_VER) ($(RAW_MSC_VER)).  Use FORCE_MSC_VER to override automatic detection.
+	@ if "$(MSC_VER)" NEQ "1600" if "$(MSC_VER)" NEQ "1700" if "$(MSC_VER)" NEQ "1800" \
+	echo *** WARNING *** Unsupported cl.exe version detected: $(MSC_VER) ($(RAW_MSC_VER)), only 1600/1700/1800 (Visual Studio 2010/2012/2013) are supported.
 
 checkLink:
-	@ if "$(LD_VER)" NEQ "710" if "$(LD_VER)" NEQ "800" if "$(LD_VER)" NEQ "900" if "$(LD_VER)" NEQ "1000" if "$(LD_VER)" NEQ "1100" \
-	echo *** WARNING *** unrecognized link.exe version $(LD_VER) ($(RAW_LD_VER)).  Use FORCE_LD_VER to override automatic detection.
+	@ if "$(LD_VER)" NEQ "1000" if "$(LD_VER)" NEQ "1100" if "$(LD_VER)" NEQ "1200" \
+	echo *** WARNING *** Unsupported link.exe version detected: $(LD_VER) ($(RAW_LD_VER)), only 1000/1100/1200 (Visual Studio 2010/2012/2013) are supported.
diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make
index e4caa13dea2..d8040f89ed8 100644
--- a/hotspot/make/windows/makefiles/vm.make
+++ b/hotspot/make/windows/makefiles/vm.make
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, 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
@@ -132,7 +132,7 @@ CXX_DONT_USE_PCH=/D DONT_USE_PRECOMPILED_HEADER
 
 !if "$(USE_PRECOMPILED_HEADER)" != "0"
 CXX_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp"
-!if "$(COMPILER_NAME)" == "VS2012"
+!if "$(MSC_VER)" > "1600"
 # VS2012 requires this object file to be listed:
 LD_FLAGS=$(LD_FLAGS) _build_pch_file.obj
 !endif
diff --git a/hotspot/make/windows/projectfiles/common/Makefile b/hotspot/make/windows/projectfiles/common/Makefile
index 51d4e6f1f11..1fc1350706e 100644
--- a/hotspot/make/windows/projectfiles/common/Makefile
+++ b/hotspot/make/windows/projectfiles/common/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2014, 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
@@ -120,7 +120,6 @@ ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -def
 ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
 
 $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
-	@if "$(MSC_VER)"=="1500" echo Make sure you have VS2008 SP1 or later, or you may see 'expanded command line too long'
 	@$(RUN_JAVA) -Djava.class.path="$(HOTSPOTBUILDSPACE)/classes" ProjectCreator WinGammaPlatform$(VcVersion) $(ProjectCreatorIDEOptions)
 
 clean:
diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp
index 5df7d221a2b..03fd43355bf 100644
--- a/hotspot/src/share/vm/runtime/vm_version.cpp
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp
@@ -222,20 +222,12 @@ const char* Abstract_VM_Version::internal_vm_info_string() {
 
   #ifndef HOTSPOT_BUILD_COMPILER
     #ifdef _MSC_VER
-      #if   _MSC_VER == 1100
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 5.0"
-      #elif _MSC_VER == 1200
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 6.0"
-      #elif _MSC_VER == 1310
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 7.1 (VS2003)"
-      #elif _MSC_VER == 1400
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 8.0 (VS2005)"
-      #elif _MSC_VER == 1500
-        #define HOTSPOT_BUILD_COMPILER "MS VC++ 9.0 (VS2008)"
-      #elif _MSC_VER == 1600
+      #if _MSC_VER == 1600
         #define HOTSPOT_BUILD_COMPILER "MS VC++ 10.0 (VS2010)"
       #elif _MSC_VER == 1700
         #define HOTSPOT_BUILD_COMPILER "MS VC++ 11.0 (VS2012)"
+      #elif _MSC_VER == 1800
+        #define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)"
       #else
         #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
       #endif
-- 
GitLab


From b3090f044ea742d7364668207bee89f27b936d4e Mon Sep 17 00:00:00 2001
From: Alexey Ivanov <aivanov@openjdk.org>
Date: Fri, 6 Jun 2014 17:51:32 +0400
Subject: [PATCH 055/192] 8039383: NPE when changing Windows theme

Reviewed-by: pchelko, anthony
---
 .../plaf/windows/AnimationController.java     | 15 +++---
 .../swing/plaf/windows/WindowsComboBoxUI.java | 20 +++++---
 .../plaf/windows/WindowsGraphicsUtils.java    |  5 +-
 .../plaf/windows/WindowsIconFactory.java      | 46 +++++++++++-------
 .../WindowsInternalFrameTitlePane.java        | 13 ++---
 .../plaf/windows/WindowsLookAndFeel.java      |  8 ++--
 .../swing/plaf/windows/WindowsMenuBarUI.java  |  4 +-
 .../swing/plaf/windows/WindowsMenuItemUI.java |  6 +--
 .../windows/WindowsPopupMenuSeparatorUI.java  |  7 +--
 .../plaf/windows/WindowsPopupMenuUI.java      |  6 +--
 .../plaf/windows/WindowsProgressBarUI.java    | 13 +++--
 .../swing/plaf/windows/WindowsSliderUI.java   |  3 +-
 .../swing/plaf/windows/WindowsSpinnerUI.java  |  5 +-
 .../plaf/windows/WindowsTableHeaderUI.java    |  5 +-
 .../sun/java/swing/plaf/windows/XPStyle.java  | 47 +++++++++++--------
 .../classes/sun/awt/windows/ThemeReader.java  |  6 +++
 .../classes/sun/awt/windows/WToolkit.java     | 29 +++++++++---
 17 files changed, 153 insertions(+), 85 deletions(-)

diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
index 8fec402dcea..70edf604df5 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, 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
@@ -130,11 +130,14 @@ class AnimationController implements ActionListener, PropertyChangeListener {
                     //one second seems plausible value
                     duration = 1000;
                 } else {
-                     duration = XPStyle.getXP().getThemeTransitionDuration(
-                           c, part,
-                           normalizeState(oldState),
-                           normalizeState(newState),
-                           Prop.TRANSITIONDURATIONS);
+                    XPStyle xp = XPStyle.getXP();
+                    duration = (xp != null)
+                               ? xp.getThemeTransitionDuration(
+                                       c, part,
+                                       normalizeState(oldState),
+                                       normalizeState(newState),
+                                       Prop.TRANSITIONDURATIONS)
+                               : 1000;
                 }
                 controller.startAnimation(c, part, oldState, newState, duration);
             }
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
index 348b28a1a7b..dc7ae1bc511 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -37,6 +37,7 @@ import java.awt.*;
 import static com.sun.java.swing.plaf.windows.TMSchema.Part;
 import static com.sun.java.swing.plaf.windows.TMSchema.State;
 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
+
 import sun.swing.DefaultLookup;
 import sun.swing.StringUIClientPropertyKey;
 
@@ -231,6 +232,9 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
 
     private void paintXPComboBoxBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         State state = getXPComboBoxState(c);
         Skin skin = null;
         if (! comboBox.isEditable()
@@ -400,8 +404,9 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
      * @return a button which represents the popup control
      */
     protected JButton createArrowButton() {
-        if (XPStyle.getXP() != null) {
-            return new XPComboBoxButton();
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null) {
+            return new XPComboBoxButton(xp);
         } else {
             return super.createArrowButton();
         }
@@ -409,9 +414,9 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     private class XPComboBoxButton extends XPStyle.GlyphButton {
-        public XPComboBoxButton() {
+        public XPComboBoxButton(XPStyle xp) {
             super(null,
-                  (! XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
+                  (! xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
                    ? Part.CP_DROPDOWNBUTTON
                    : (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
                      ? Part.CP_DROPDOWNBUTTONLEFT
@@ -424,10 +429,11 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
         protected State getState() {
             State rv;
             rv = super.getState();
+            XPStyle xp = XPStyle.getXP();
             if (rv != State.DISABLED
                 && comboBox != null && ! comboBox.isEditable()
-                && XPStyle.getXP().isSkinDefined(comboBox,
-                                                 Part.CP_DROPDOWNBUTTONRIGHT)) {
+                && xp != null && xp.isSkinDefined(comboBox,
+                                                  Part.CP_DROPDOWNBUTTONRIGHT)) {
                 /*
                  * for non editable ComboBoxes Vista seems to have the
                  * same glyph for all non DISABLED states
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
index 63eb27b9b2d..8e168066d11 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -125,6 +125,9 @@ public class WindowsGraphicsUtils {
     static void paintXPText(AbstractButton b, Part part, State state,
             Graphics g, int x, int y, String text, int mnemIndex) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Color textColor = b.getForeground();
 
         if (textColor instanceof UIResource) {
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
index 0a4cfce44bf..d2018ea4e89 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
@@ -623,8 +623,8 @@ public class WindowsIconFactory implements Serializable
     @SuppressWarnings("serial") // Same-version serialization only
     private static class MenuArrowIcon implements Icon, UIResource, Serializable {
         public void paintIcon(Component c, Graphics g, int x, int y) {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                XPStyle xp = XPStyle.getXP();
+            XPStyle xp = XPStyle.getXP();
+            if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
                 State state = State.NORMAL;
                 if (c instanceof JMenuItem) {
                     state = ((JMenuItem) c).getModel().isEnabled()
@@ -657,16 +657,18 @@ public class WindowsIconFactory implements Serializable
             }
         }
         public int getIconWidth() {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+            XPStyle xp = XPStyle.getXP();
+            if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getWidth();
             } else {
                 return 4;
             }
         }
         public int getIconHeight() {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+            XPStyle xp = XPStyle.getXP();
+            if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getHeight();
             } else {
                 return 8;
@@ -692,7 +694,8 @@ public class WindowsIconFactory implements Serializable
         }
 
         static int getIconWidth() {
-            return XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK).getWidth()
+            XPStyle xp = XPStyle.getXP();
+            return ((xp != null) ? xp.getSkin(null, Part.MP_POPUPCHECK).getWidth() : 16)
                 + 2 * OFFSET;
         }
 
@@ -756,12 +759,17 @@ public class WindowsIconFactory implements Serializable
                 Icon icon = getIcon();
                 int height = 0;
                 if (icon != null) {
-                    height = icon.getIconHeight() + 2 * OFFSET;
+                    height = icon.getIconHeight();
                 } else {
-                    Skin skin =
-                        XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
-                    height = skin.getHeight() + 2 * OFFSET;
+                    XPStyle xp = XPStyle.getXP();
+                    if (xp != null) {
+                        Skin skin = xp.getSkin(null, Part.MP_POPUPCHECK);
+                        height = skin.getHeight();
+                    } else {
+                        height = 16;
+                    }
                 }
+                height +=  2 * OFFSET;
                 return height;
             }
 
@@ -809,14 +817,16 @@ public class WindowsIconFactory implements Serializable
                                   ? State.BULLETDISABLED
                                   : State.CHECKMARKDISABLED;
                         }
-                        Skin skin;
                         XPStyle xp = XPStyle.getXP();
-                        skin =  xp.getSkin(c, backgroundPart);
-                        skin.paintSkin(g, x, y,
-                            getIconWidth(), getIconHeight(), backgroundState);
-                        if (icon == null) {
-                            skin = xp.getSkin(c, part);
-                            skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                        if (xp != null) {
+                            Skin skin;
+                            skin =  xp.getSkin(c, backgroundPart);
+                            skin.paintSkin(g, x, y,
+                                getIconWidth(), getIconHeight(), backgroundState);
+                            if (icon == null) {
+                                skin = xp.getSkin(c, part);
+                                skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                            }
                         }
                     }
                 }
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
index c654c5a7046..6210a93b738 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -86,14 +86,15 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
             }
         } else {
             buttonWidth += 2;
-            selectedTitleGradientColor =
-                    UIManager.getColor("InternalFrame.activeTitleGradient");
-            notSelectedTitleGradientColor =
-                    UIManager.getColor("InternalFrame.inactiveTitleGradient");
             Color activeBorderColor =
                     UIManager.getColor("InternalFrame.activeBorderColor");
             setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
         }
+        // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
+        selectedTitleGradientColor =
+                UIManager.getColor("InternalFrame.activeTitleGradient");
+        notSelectedTitleGradientColor =
+                UIManager.getColor("InternalFrame.inactiveTitleGradient");
     }
 
     protected void uninstallListeners() {
@@ -388,7 +389,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
     public class WindowsTitlePaneLayout extends BasicInternalFrameTitlePane.TitlePaneLayout {
         private Insets captionMargin = null;
         private Insets contentMargin = null;
-        private XPStyle xp = XPStyle.getXP();
+        private final XPStyle xp = XPStyle.getXP();
 
         WindowsTitlePaneLayout() {
             if (xp != null) {
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
index a6c1c895757..f4f326aa2f6 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
@@ -2327,8 +2327,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
         }
 
         public Object getXPValue(UIDefaults table) {
-            Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
-            if (extraMargin != null) {
+            XPStyle xp = XPStyle.getXP();
+            Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null;
+            if (xpBorder != null && extraMargin != null) {
                 return new BorderUIResource.
                         CompoundBorderUIResource(xpBorder, extraMargin);
             } else {
@@ -2344,7 +2345,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
 
         public Object getXPValue(UIDefaults table) {
             XPColorValueKey key = (XPColorValueKey)xpValue;
-            return XPStyle.getXP().getColor(key.skin, key.prop, null);
+            XPStyle xp = XPStyle.getXP();
+            return xp != null ? xp.getColor(key.skin, key.prop, null) : null;
         }
 
         private static class XPColorValueKey {
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
index 73dcf802e33..68015c0752e 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
@@ -156,8 +156,8 @@ public class WindowsMenuBarUI extends BasicMenuBarUI
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        if (WindowsMenuItemUI.isVistaPainting()) {
-            XPStyle xp = XPStyle.getXP();
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
             Skin skin;
             skin = xp.getSkin(c, Part.MP_BARBACKGROUND);
             int width = c.getWidth();
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
index cac7af54aa7..8cc4fc420a0 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -109,7 +109,8 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
     static void paintBackground(WindowsMenuItemUIAccessor menuItemUI,
             Graphics g, JMenuItem menuItem, Color bgColor) {
         assert isVistaPainting();
-        if (isVistaPainting()) {
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null && isVistaPainting()) {
             int menuWidth = menuItem.getWidth();
             int menuHeight = menuItem.getHeight();
             if (menuItem.isOpaque()) {
@@ -118,7 +119,6 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
                 g.fillRect(0,0, menuWidth, menuHeight);
                 g.setColor(oldColor);
             }
-            XPStyle xp = XPStyle.getXP();
             Part part = menuItemUI.getPart(menuItem);
             Skin skin = xp.getSkin(menuItem, part);
             skin.paintSkin(g, 0 , 0,
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
index 797aa5a7b6a..fc20e988459 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, 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
@@ -50,7 +50,8 @@ public class WindowsPopupMenuSeparatorUI extends BasicPopupMenuSeparatorUI {
 
     public void paint(Graphics g, JComponent c) {
         Dimension s = c.getSize();
-        if (WindowsMenuItemUI.isVistaPainting()) {
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
             int x = 1;
             Component parent = c.getParent();
             if (parent instanceof JComponent) {
@@ -67,7 +68,7 @@ public class WindowsPopupMenuSeparatorUI extends BasicPopupMenuSeparatorUI {
                     x += WindowsPopupMenuUI.getGutterWidth();
                 }
             }
-            Skin skin = XPStyle.getXP().getSkin(c, Part.MP_POPUPSEPARATOR);
+            Skin skin = xp.getSkin(c, Part.MP_POPUPSEPARATOR);
             int skinHeight = skin.getHeight();
             int y = (s.height - skinHeight) / 2;
             skin.paintSkin(g, x, y, s.width - x - 1, skinHeight, State.NORMAL);
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
index 584641bcaf7..e3d9d96efc4 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -194,8 +194,8 @@ public class WindowsPopupMenuUI extends BasicPopupMenuUI {
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        if (WindowsMenuItemUI.isVistaPainting()) {
-            XPStyle xp = XPStyle.getXP();
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
             Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
             skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
             int textOffset = getTextOffset(c);
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
index ef5d176fa7b..45947fc2b7e 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -322,8 +322,9 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
     private Rectangle getFullChunkBounds(Rectangle box) {
         boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL);
         XPStyle xp = XPStyle.getXP();
-        int gap = xp.getInt(progressBar, Part.PP_PROGRESS, null,
-                            Prop.PROGRESSSPACESIZE, 0);
+        int gap = (xp != null) ? xp.getInt(progressBar, Part.PP_PROGRESS,
+                                           null, Prop.PROGRESSSPACESIZE, 0)
+                               : 0;
 
         if (!vertical) {
             int chunksize = box.width+gap;
@@ -338,6 +339,9 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
                                           boolean vertical,
                                           int bgwidth, int bgheight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
 
         // create a new graphics to keep drawing surface state
         Graphics2D gfx = (Graphics2D)g.create();
@@ -396,6 +400,9 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
     private void paintXPBackground(Graphics g, boolean vertical,
                                    int barRectWidth, int barRectHeight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;
         Skin skin = xp.getSkin(progressBar, part);
 
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
index dbfb7b81251..1bae3f8f441 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -215,7 +215,6 @@ public class WindowsSliderUI extends BasicSliderUI
     }
 
     private Part getXPThumbPart() {
-        XPStyle xp = XPStyle.getXP();
         Part part;
         boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
         boolean leftToRight = slider.getComponentOrientation().isLeftToRight();
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
index ccc6d039b53..c17328e50cc 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -63,6 +63,9 @@ public class WindowsSpinnerUI extends BasicSpinnerUI {
 
     private void paintXPBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Skin skin = xp.getSkin(c, Part.EP_EDIT);
         State state = getXPState(c);
         skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
index 117e9d7b7b1..9cf37994589 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
@@ -91,9 +91,10 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
             this.column = column;
             this.hasRollover = (column == getRolloverColumn());
             if (skin == null) {
-                skin = XPStyle.getXP().getSkin(header, Part.HP_HEADERITEM);
+                XPStyle xp = XPStyle.getXP();
+                skin = (xp != null) ? xp.getSkin(header, Part.HP_HEADERITEM) : null;
             }
-            Insets margins = skin.getContentMargin();
+            Insets margins = (skin != null) ? skin.getContentMargin() : null;
             Border border = null;
             int contentTop = 0;
             int contentLeft = 0;
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
index bc1404e9227..7765145eff1 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
@@ -52,6 +52,7 @@ import javax.swing.text.JTextComponent;
 
 import sun.awt.image.SunWritableRaster;
 import sun.awt.windows.ThemeReader;
+import sun.awt.windows.WToolkit;
 import sun.security.action.GetPropertyAction;
 import sun.swing.CachedPainter;
 
@@ -99,7 +100,7 @@ class XPStyle {
         if (themeActive == null) {
             Toolkit toolkit = Toolkit.getDefaultToolkit();
             themeActive =
-                (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
+                (Boolean)toolkit.getDesktopProperty(WToolkit.XPSTYLE_THEME_ACTIVE);
             if (themeActive == null) {
                 themeActive = Boolean.FALSE;
             }
@@ -115,7 +116,7 @@ class XPStyle {
                 }
             }
         }
-        return xp;
+        return ThemeReader.isXPStyleEnabled() ? xp : null;
     }
 
     static boolean isVista() {
@@ -180,9 +181,10 @@ class XPStyle {
      * should probably be cached there instead of here.
      */
     Dimension getDimension(Component c, Part part, State state, Prop prop) {
-        return ThemeReader.getPosition(part.getControlName(c), part.getValue(),
-                                       State.getValue(part, state),
-                                       prop.getValue());
+        Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
+                                              State.getValue(part, state),
+                                              prop.getValue());
+        return (d != null) ? d : new Dimension();
     }
 
     /** Get a named <code>Point</code> (e.g. a location or an offset) value
@@ -199,11 +201,7 @@ class XPStyle {
         Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
                                               State.getValue(part, state),
                                               prop.getValue());
-        if (d != null) {
-            return new Point(d.width, d.height);
-        } else {
-            return null;
-        }
+        return (d != null) ? new Point(d.width, d.height) : new Point();
     }
 
     /** Get a named <code>Insets</code> value from the current style
@@ -217,9 +215,10 @@ class XPStyle {
      * The return value is already cached in those places.
      */
     Insets getMargin(Component c, Part part, State state, Prop prop) {
-        return ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
-                                           State.getValue(part, state),
-                                           prop.getValue());
+        Insets insets = ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
+                                                    State.getValue(part, state),
+                                                    prop.getValue());
+        return (insets != null) ? insets : new Insets(0, 0, 0, 0);
     }
 
 
@@ -509,16 +508,17 @@ class XPStyle {
             int boundingWidth = 100;
             int boundingHeight = 100;
 
-            return ThemeReader.getThemeBackgroundContentMargins(
+            Insets insets = ThemeReader.getThemeBackgroundContentMargins(
                 part.getControlName(null), part.getValue(),
                 0, boundingWidth, boundingHeight);
+            return (insets != null) ? insets : new Insets(0, 0, 0, 0);
         }
 
         private int getWidth(State state) {
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return size.width;
+            return (size != null) ? size.width : 0;
         }
 
         int getWidth() {
@@ -529,7 +529,7 @@ class XPStyle {
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return size.height;
+            return (size != null) ? size.height : 0;
         }
 
         int getHeight() {
@@ -586,6 +586,9 @@ class XPStyle {
          * @param state which state to paint
          */
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             if (ThemeReader.isGetThemeTransitionDurationDefined()
                   && component instanceof JComponent
                   && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
@@ -611,6 +614,9 @@ class XPStyle {
          * @param state which state to paint
          */
         void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, State state) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
         }
 
@@ -630,7 +636,7 @@ class XPStyle {
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state,
                 boolean borderFill) {
             if(borderFill && "borderfill".equals(getTypeEnumName(component, part,
-                    state, Prop.BGTYPE))) {
+                    state, Prop.BGTYPE)) && XPStyle.getXP() == null) {
                 return;
             }
             skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
@@ -684,7 +690,7 @@ class XPStyle {
 
         public GlyphButton(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp.getSkin(parent, part);
+            skin = xp != null ? xp.getSkin(parent, part) : null;
             setBorder(null);
             setContentAreaFilled(false);
             setMinimumSize(new Dimension(5, 5));
@@ -709,13 +715,16 @@ class XPStyle {
         }
 
         public void paintComponent(Graphics g) {
+            if (XPStyle.getXP() == null || skin == null) {
+                return;
+            }
             Dimension d = getSize();
             skin.paintSkin(g, 0, 0, d.width, d.height, getState());
         }
 
         public void setPart(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp.getSkin(parent, part);
+            skin = xp != null ? xp.getSkin(parent, part) : null;
             revalidate();
             repaint();
         }
diff --git a/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java b/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java
index 632489964e7..321e72ca182 100644
--- a/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java
+++ b/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java
@@ -61,6 +61,8 @@ public final class ThemeReader {
     private static final Lock readLock = readWriteLock.readLock();
     private static final Lock writeLock = readWriteLock.writeLock();
 
+    static volatile boolean xpStyleEnabled;
+
     static void flush() {
         writeLock.lock();
         try {
@@ -76,6 +78,10 @@ public final class ThemeReader {
 
     public static native boolean isThemed();
 
+    public static boolean isXPStyleEnabled() {
+        return xpStyleEnabled;
+    }
+
     // this should be called only with writeLock held
     private static Long getThemeImpl(String widget) {
         Long theme = widgetToTheme.get(widget);
diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
index 2a27c2df9cc..630d29e7b75 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -72,6 +72,9 @@ public final class WToolkit extends SunToolkit implements Runnable {
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
 
+    // Desktop property which specifies whether XP visual styles are in effect
+    public static final String XPSTYLE_THEME_ACTIVE = "win.xpstyle.themeActive";
+
     static GraphicsConfiguration config;
 
     // System clipboard.
@@ -894,7 +897,7 @@ public final class WToolkit extends SunToolkit implements Runnable {
     private synchronized void lazilyInitWProps() {
         if (wprops == null) {
             wprops = new WDesktopProperties(this);
-            updateProperties();
+            updateProperties(wprops.getProperties());
         }
     }
 
@@ -929,21 +932,27 @@ public final class WToolkit extends SunToolkit implements Runnable {
      * Windows doesn't always send WM_SETTINGCHANGE when it should.
      */
     private void windowsSettingChange() {
+        // JDK-8039383: Have to update the value of XPSTYLE_THEME_ACTIVE property
+        // as soon as possible to prevent NPE and other errors because theme data
+        // has become unavailable.
+        final Map<String, Object> props = getWProps();
+        updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
+
         EventQueue.invokeLater(new Runnable() {
             @Override
             public void run() {
-                updateProperties();
+                updateProperties(props);
             }
         });
     }
 
-    private synchronized void updateProperties() {
-        if (null == wprops) {
-            // wprops has not been initialized, so we have nothing to update
+    private synchronized void updateProperties(final Map<String, Object> props) {
+        if (null == props) {
             return;
         }
 
-        Map<String, Object> props = wprops.getProperties();
+        updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
+
         for (String propName : props.keySet()) {
             Object val = props.get(propName);
             if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -953,6 +962,14 @@ public final class WToolkit extends SunToolkit implements Runnable {
         }
     }
 
+    private synchronized Map<String, Object> getWProps() {
+        return (wprops != null) ? wprops.getProperties() : null;
+    }
+
+    private void updateXPStyleEnabled(final Object dskProp) {
+        ThemeReader.xpStyleEnabled = Boolean.TRUE.equals(dskProp);
+    }
+
     @Override
     public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
         if (name == null) {
-- 
GitLab


From b7b41fb0895d2b15df28fb8c3c2083de6a758c0b Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Mon, 9 Jun 2014 13:03:03 +0400
Subject: [PATCH 056/192] 8046245: JDK 9 client build failure on Solaris

Reviewed-by: prr
---
 jdk/make/mapfiles/libawt/mapfile-vers | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jdk/make/mapfiles/libawt/mapfile-vers b/jdk/make/mapfiles/libawt/mapfile-vers
index b1c6a39ec1e..636c255c6c6 100644
--- a/jdk/make/mapfiles/libawt/mapfile-vers
+++ b/jdk/make/mapfiles/libawt/mapfile-vers
@@ -155,6 +155,7 @@ SUNWprivate_1.1 {
 		g_CMpDataID;
 		colorValueID;
                 mul8table;
+                div8table;
                 jvm;
 
                 # ProcessPath entry points and data
-- 
GitLab


From 1510b7c75e2c6e3ab862653614f1e10c324265fb Mon Sep 17 00:00:00 2001
From: Staffan Larsen <sla@openjdk.org>
Date: Mon, 9 Jun 2014 11:03:09 +0200
Subject: [PATCH 057/192] 8044797: Building with clang gives: fatal error: file
 '...' has been modified since the precompiled header was built

Reviewed-by: dholmes, dcubed
---
 hotspot/make/bsd/makefiles/vm.make   | 1 +
 hotspot/make/linux/makefiles/vm.make | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hotspot/make/bsd/makefiles/vm.make b/hotspot/make/bsd/makefiles/vm.make
index 77dde8bc930..56beb6c6ba5 100644
--- a/hotspot/make/bsd/makefiles/vm.make
+++ b/hotspot/make/bsd/makefiles/vm.make
@@ -295,6 +295,7 @@ endif
 $(PRECOMPILED_HEADER):
 	$(QUIETLY) echo Generating precompiled header $@
 	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
+	$(QUIETLY) rm -f $@
 	$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
 
 # making the library:
diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make
index bcf87c043ec..c91463aae13 100644
--- a/hotspot/make/linux/makefiles/vm.make
+++ b/hotspot/make/linux/makefiles/vm.make
@@ -290,6 +290,7 @@ LINK_VM = $(LINK_LIB.CC)
 $(PRECOMPILED_HEADER):
 	$(QUIETLY) echo Generating precompiled header $@
 	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
+	$(QUIETLY) rm -f $@
 	$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
 
 # making the library:
-- 
GitLab


From 5ecd91e84a5fd705d7a260400a75e5e5c53ac1cd Mon Sep 17 00:00:00 2001
From: Dmitriy Ermashov <dmitriy.ermashov@oracle.com>
Date: Mon, 9 Jun 2014 14:59:45 +0400
Subject: [PATCH 058/192] 8044765: Move functional tests
 AWT_SystemTray/Automated to openjdk repository

Reviewed-by: pchelko
---
 .../TrayIcon/ActionCommand/ActionCommand.java | 162 ++++++++++
 .../ActionEventMask/ActionEventMask.java      | 252 +++++++++++++++
 .../GetTrayIconsTest/GetTrayIcons.java        |  86 +++++
 .../awt/TrayIcon/InterJVMTest/InterJVM.java   |  86 +++++
 .../TrayIcon/ModalityTest/ModalityTest.java   | 302 ++++++++++++++++++
 .../MouseEventMask/MouseEventMaskTest.java    | 195 +++++++++++
 .../MouseMovedTest/MouseMovedTest.java        |  64 ++++
 .../TrayIcon/PropertyChangeListenerTest.java  | 201 ++++++++++++
 .../FunctionalityCheck.java                   | 263 +++++++++++++++
 .../FunctionalityCheck/tray.policy            |  21 ++
 .../NoPermissionTest/NoPermissionTest.java    |  64 ++++
 .../PermissionTest/PermissionTest.java        |  50 +++
 .../SecurityCheck/PermissionTest/tray.policy  |   3 +
 .../awt/TrayIcon/SystemTrayIconHelper.java    | 172 ++++++++++
 .../SystemTrayInstanceTest.java               |  71 ++++
 .../TrayIconAddTest/TrayIconAddTest.java      |  66 ++++
 .../TrayIconEventModifiersTest.java           | 275 ++++++++++++++++
 .../TrayIconEvents/TrayIconEventsTest.java    | 269 ++++++++++++++++
 .../TrayIconMethodsTest.java                  | 159 +++++++++
 .../TrayIconMouseTest/TrayIconMouseTest.java  | 176 ++++++++++
 .../TrayIconPopup/TrayIconPopupTest.java      | 151 +++++++++
 .../TrayIconRemoveTest.java                   |  72 +++++
 .../TrayIconSizeTest/TrayIconSizeTest.java    |  69 ++++
 23 files changed, 3229 insertions(+)
 create mode 100644 jdk/test/java/awt/TrayIcon/ActionCommand/ActionCommand.java
 create mode 100644 jdk/test/java/awt/TrayIcon/ActionEventMask/ActionEventMask.java
 create mode 100644 jdk/test/java/awt/TrayIcon/GetTrayIconsTest/GetTrayIcons.java
 create mode 100644 jdk/test/java/awt/TrayIcon/InterJVMTest/InterJVM.java
 create mode 100644 jdk/test/java/awt/TrayIcon/ModalityTest/ModalityTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/MouseEventMask/MouseEventMaskTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/MouseMovedTest/MouseMovedTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/PropertyChangeListenerTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/FunctionalityCheck.java
 create mode 100644 jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/tray.policy
 create mode 100644 jdk/test/java/awt/TrayIcon/SecurityCheck/NoPermissionTest/NoPermissionTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/PermissionTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/tray.policy
 create mode 100644 jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java
 create mode 100644 jdk/test/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconAddTest/TrayIconAddTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconEventModifiers/TrayIconEventModifiersTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconEvents/TrayIconEventsTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconMethodsTest/TrayIconMethodsTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconRemoveTest/TrayIconRemoveTest.java
 create mode 100644 jdk/test/java/awt/TrayIcon/TrayIconSizeTest/TrayIconSizeTest.java

diff --git a/jdk/test/java/awt/TrayIcon/ActionCommand/ActionCommand.java b/jdk/test/java/awt/TrayIcon/ActionCommand/ActionCommand.java
new file mode 100644
index 00000000000..5c5a17e0dbc
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/ActionCommand/ActionCommand.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check the return value of the getActionCommand method
+ *          of the ActionEvent triggered when TrayIcon is double clicked
+ *          (single clicked, on Mac)
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main ActionCommand
+ */
+
+public class ActionCommand {
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+
+    boolean actionPerformed = false;
+    Object actionLock = new Object();
+    String actionCommand = null;
+    static boolean isMacOS = false;
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
+                System.err.println("Test can fail if the icon hides to a tray icons pool " +
+                        "in Windows 7, which is behavior by default.\n" +
+                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
+                        "\"Always show all icons and notifications on the taskbar\" true to " +
+                        "avoid this problem. Or change behavior only for Java SE tray icon " +
+                        "and rerun test.");
+            } else  if (System.getProperty("os.name").toLowerCase().startsWith("mac")){
+                isMacOS = true;
+            }
+
+            new ActionCommand().doTest();
+        }
+    }
+
+    void doTest() throws Exception {
+        robot = new ExtendedRobot();
+
+        EventQueue.invokeAndWait(() -> {
+            SystemTray tray = SystemTray.getSystemTray();
+            icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon");
+            icon.addActionListener((event) -> {
+                actionPerformed = true;
+                actionCommand = event.getActionCommand();
+                synchronized (actionLock) {
+                    try {
+                        actionLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            });
+
+            if (icon.getActionCommand() != null)
+                throw new RuntimeException("FAIL: getActionCommand did not return null " +
+                        "when no action command set " + icon.getActionCommand());
+
+            icon.setActionCommand("Sample Command");
+
+            if (! "Sample Command".equals(icon.getActionCommand()))
+                throw new RuntimeException("FAIL: getActionCommand did not return the correct value. " +
+                        icon.getActionCommand() + " Expected: Sample Command");
+
+            try {
+                tray.add(icon);
+            } catch (AWTException e) {
+                throw new RuntimeException(e);
+            }
+        });
+
+        robot.waitForIdle();
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle(2000);
+        actionPerformed = false;
+        SystemTrayIconHelper.doubleClick(robot);
+
+        if (! actionPerformed) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! actionPerformed) {
+            throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is "+(isMacOS? "" : "double ")+"clicked");
+        } else if (! "Sample Command".equals(actionCommand)) {
+            throw new RuntimeException("FAIL: ActionEvent.getActionCommand did not return the correct " +
+                    "value. Returned: " + actionCommand + " ; Expected: Sample Command");
+        }
+
+        EventQueue.invokeAndWait(() -> {
+            icon.setActionCommand(null);
+            if (icon.getActionCommand() != null) {
+                throw new RuntimeException("FAIL: ActionCommand set to null. getActionCommand did " +
+                        "not return null " + icon.getActionCommand());
+            }
+        });
+
+        robot.mouseMove(0, 0);
+        robot.waitForIdle();
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+
+        actionPerformed = false;
+        actionCommand = null;
+        SystemTrayIconHelper.doubleClick(robot);
+
+        if (! actionPerformed) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! actionPerformed) {
+            throw new RuntimeException("FAIL: ActionEvent not triggered when ActionCommand set to " +
+                    "null and then TrayIcon is "+(isMacOS? "" : "double ")+ "clicked");
+        } else if (actionCommand != null) {
+            throw new RuntimeException("FAIL: ActionEvent.getActionCommand did not return null " +
+                    "when ActionCommand is set to null " + actionCommand);
+        }
+
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/ActionEventMask/ActionEventMask.java b/jdk/test/java/awt/TrayIcon/ActionEventMask/ActionEventMask.java
new file mode 100644
index 00000000000..fb95874eadc
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/ActionEventMask/ActionEventMask.java
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check if ActionEvent triggered when a TrayIcon is double
+ *          (single, on Mac) clicked is visible by an AWTEventListener
+ *          added to the Toolkit. It also checks if all listeners are
+ *          triggered when multiple AWTEventListeners and ActionListeners
+ *          are added.
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main ActionEventMask
+ */
+
+public class ActionEventMask {
+
+    private Image image;
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+
+    boolean actionPerformed = false;
+    boolean listenersInvoked = false;
+    Object actionLock = new Object();
+    Object listenersLock = new Object();
+    static boolean isMacOS = false;
+    static final int clickDelay = 50;
+
+    ActionListener[] listeners;
+    boolean[] listenerStatus;
+
+    Object lLock = new Object();
+    boolean doTest, listenerAdded;
+    Button b1;
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                               "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("mac")) {
+                isMacOS = true;
+            }
+            new ActionEventMask().doTest();
+        }
+    }
+
+    public ActionEventMask() throws Exception {
+        EventQueue.invokeAndWait(this::initializeGUI);
+    }
+
+    void initializeGUI() {
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon");
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(event -> {
+            if (doTest) {
+                System.out.println("ActionListener AWTEventListener");
+                if (! icon.equals(event.getSource())) {
+                    throw new RuntimeException("FAIL: ActionEvent not triggered for icon");
+                }
+                actionPerformed = true;
+                synchronized (actionLock) {
+                    try {
+                        actionLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        }, AWTEvent.ACTION_EVENT_MASK);
+
+        try {
+            tray.add(icon);
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+
+        listeners = new ActionListener[3];
+        listenerStatus = new boolean[3];
+        for (int i = 0; i < listeners.length; i++) {
+            final int index = i;
+            listeners[i] = event -> {
+                listenerStatus[index] = true;
+                System.out.println("ActionListener listeners[" + index + "]");
+                for (int j = 0; j < listenerStatus.length; j++) {
+                    if (! listenerStatus[j]) {
+                        break;
+                    }
+                    listenersInvoked = true;
+                    synchronized (listenersLock) {
+                        try {
+                            listenersLock.notifyAll();
+                        } catch (Exception e) {
+                        }
+                    }
+                }
+            };
+        }
+
+        Frame frame = new Frame("Test frame");
+        b1 = new Button("Add ActionListener");
+        b1.addActionListener(event -> {
+            for (int i = 0; i < listeners.length; i++) {
+                icon.addActionListener(listeners[i]);
+            }
+            listenerAdded = true;
+            synchronized (lLock) {
+                try {
+                    lLock.notifyAll();
+                } catch (Exception e) {
+                }
+            }
+        });
+        frame.setLayout(new FlowLayout());
+        frame.add(b1);
+        frame.setSize(200, 200);
+        frame.addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent event) {
+                System.err.println("User closed the window");
+                System.exit(1);
+            }
+        });
+        frame.setVisible(true);
+    }
+
+    private void doTest() throws Exception {
+
+        robot = new ExtendedRobot();
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+
+        actionPerformed = false;
+        doTest = true;
+
+        if(isMacOS) {
+            robot.click(InputEvent.BUTTON3_MASK);
+        }else{
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(clickDelay);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.delay(clickDelay);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(clickDelay);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        }
+
+        if (! actionPerformed) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! actionPerformed)
+            throw new RuntimeException("FAIL: AWTEventListener not notified when TrayIcon " +
+                               "is "+(isMacOS ? "" :"double ")+ "clicked");
+
+        doTest = false;
+        listenerAdded = false;
+        robot.mouseMove(b1.getLocationOnScreen().x + b1.getSize().width / 2,
+                        b1.getLocationOnScreen().y + b1.getSize().height / 2);
+        robot.waitForIdle();
+        robot.click();
+
+        if (! listenerAdded) {
+            synchronized (lLock) {
+                try {
+                    lLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! listenerAdded)
+            throw new RuntimeException("FAIL: ActionListener could not be added at runtime. " +
+                               "b1 did not trigger ActionEvent");
+
+        doTest = true;
+        actionPerformed = false;
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+
+        if(isMacOS) {
+            robot.click(InputEvent.BUTTON3_MASK);
+        }else{
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(clickDelay);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.delay(clickDelay);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(clickDelay);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        }
+
+        if (! listenersInvoked) {
+            synchronized (listenersLock) {
+                try {
+                    listenersLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! listenersInvoked) {
+            System.err.println("FAIL: All the listeners not invoked!");
+            for (int i = 0; i < listenerStatus.length; i++)
+                throw new RuntimeException("Listener[" + i + "] invoked: " + listenerStatus[i]);
+        }
+        if (! actionPerformed) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! actionPerformed)
+            throw new RuntimeException("FAIL: AWTEventListener not notified when TrayIcon " +
+                    "is "+(isMacOS? "" : "double ")+ "clicked. A set of listeners were added after it");
+
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/GetTrayIconsTest/GetTrayIcons.java b/jdk/test/java/awt/TrayIcon/GetTrayIconsTest/GetTrayIcons.java
new file mode 100644
index 00000000000..df6f01dd15c
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/GetTrayIconsTest/GetTrayIcons.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check the getTrayIcons method of the SystemTray
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main GetTrayIcons
+ */
+
+public class GetTrayIcons {
+
+    Image image;
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported())
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        else
+            new GetTrayIcons().doTest();
+    }
+
+    GetTrayIcons() {
+        image = new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB);
+    }
+
+    void doTest() throws Exception {
+        SystemTray tray = SystemTray.getSystemTray();
+        TrayIcon[] icons = tray.getTrayIcons();
+        if (icons == null || icons.length > 0)
+            throw new RuntimeException("FAIL: getTrayIcons() returned incorrect " +
+                    "value when no icons are added " + icons);
+
+        TrayIcon icon = new TrayIcon(image);
+        tray.add(icon);
+
+        icons = tray.getTrayIcons();
+        if (icons == null || icons.length != 1)
+            throw new RuntimeException("FAIL: getTrayIcons() returned incorrect value " +
+                    "when one icon present " + icons);
+
+        icon = new TrayIcon(image);
+        tray.add(icon);
+
+        icons = tray.getTrayIcons();
+        if (icons == null || icons.length != 2)
+            throw new RuntimeException("FAIL: getTrayIcons() returned incorrect value " +
+                    "when two icons present " + icons);
+
+        icons = tray.getTrayIcons();
+        if (icons != null) {
+            for (int i = 0; i < icons.length; i++) {
+                tray.remove(icons[i]);
+            }
+
+            TrayIcon[] newList = tray.getTrayIcons();
+
+            if (newList == null || newList.length != 0)
+                throw new RuntimeException("FAIL: Incorrect value returned by getTrayIcons " +
+                        "after icons are added and then removed " + newList);
+        }
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/InterJVMTest/InterJVM.java b/jdk/test/java/awt/TrayIcon/InterJVMTest/InterJVM.java
new file mode 100644
index 00000000000..41b5d9a2028
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/InterJVMTest/InterJVM.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Check if TrayIcon added by a JVM is not visible
+ *          in another JVM
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../regtesthelpers/process/
+ * @build ProcessResults ProcessCommunicator
+ * @run main InterJVM
+ */
+
+import test.java.awt.regtesthelpers.process.ProcessCommunicator;
+import test.java.awt.regtesthelpers.process.ProcessResults;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class InterJVM {
+
+    static String NEW_JVM = "-doTest";
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            if (args == null || args.length == 0) {
+                new InterJVM().addTrayIcon();
+            } else {
+                if (args.length == 1 && NEW_JVM.equals(args[0]))
+                    new InterJVM().doTest();
+            }
+        }
+    }
+
+    void doTest() throws Exception {
+        SystemTray tray = SystemTray.getSystemTray();
+        try {
+            TrayIcon[] icons = tray.getTrayIcons();
+            System.out.println(icons.length);
+            if (icons == null || icons.length != 0)
+                throw new RuntimeException("FAIL: getTrayIcons() returned incorrect " +
+                        "value when two icons are added by a " +
+                        "separate JVM: " + icons.length);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    void addTrayIcon() throws Exception {
+
+        SystemTray tray = SystemTray.getSystemTray();
+        TrayIcon icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB));
+        tray.add(icon);
+
+        new Robot().delay(2000);
+
+        ProcessResults processResults =
+                ProcessCommunicator.executeChildProcess(this.getClass(), new String[]{NEW_JVM});
+
+        if (processResults.getExitValue() != 0)
+            throw new RuntimeException("\n"+processResults.getStdErr());
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/ModalityTest/ModalityTest.java b/jdk/test/java/awt/TrayIcon/ModalityTest/ModalityTest.java
new file mode 100644
index 00000000000..2118457ee79
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/ModalityTest/ModalityTest.java
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check for MouseEvents with all mouse buttons
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main ModalityTest
+ */
+public class ModalityTest {
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+    Dialog d;
+
+    boolean actionPerformed = false;
+
+    private boolean dialogVisible = false;
+    private Object dialogLock = new Object();
+
+    Object actionLock = new Object();
+    Object pressLock = new Object();
+    Object releaseLock = new Object();
+    Object clickLock = new Object();
+    Object moveLock = new Object();
+    static final int clickDelay = 50;
+
+    boolean mousePressed = false;
+    boolean mouseReleased = false;
+    boolean mouseClicked = false;
+    boolean mouseMoved = false;
+
+    int[] buttonTypes = {
+        InputEvent.BUTTON1_MASK,
+        InputEvent.BUTTON2_MASK,
+        InputEvent.BUTTON3_MASK
+    };
+
+    String[] buttonNames = {
+        "BUTTON1",
+        "BUTTON2",
+        "BUTTON3"
+    };
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                               "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("win"))
+                System.err.println("Test can fail if the icon hides to a tray icons pool " +
+                        "in Windows 7, which is behavior by default.\n" +
+                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
+                        "\"Always show all icons and notifications on the taskbar\" true " +
+                        "to avoid this problem. Or change behavior only for Java SE tray " +
+                        "icon and rerun test.");
+
+            new ModalityTest().doTest();
+        }
+    }
+
+    public ModalityTest() throws Exception {
+        robot = new ExtendedRobot();
+        EventQueue.invokeLater(this::initializeGUI);
+    }
+
+    void initializeGUI() {
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon");
+        icon.addActionListener(event -> {
+            actionPerformed = true;
+            synchronized (actionLock) {
+                try {
+                    actionLock.notifyAll();
+                } catch (Exception e) {
+                }
+            }
+        });
+        icon.addMouseListener(new MouseAdapter() {
+            public void mousePressed(MouseEvent event) {
+                mousePressed = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mousePressed");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mousePressed: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (pressLock) {
+                    try {
+                        pressLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseReleased(MouseEvent event) {
+                mouseReleased = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseReleased");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseReleased: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (releaseLock) {
+                    try {
+                        releaseLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseClicked(MouseEvent event) {
+                mouseClicked = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseClicked");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseClicked: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (clickLock) {
+                    try {
+                        clickLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+
+        icon.addMouseMotionListener(new MouseMotionAdapter() {
+            public void mouseMoved(MouseEvent event) {
+                mouseMoved = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseMoved");
+
+                if (!icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseMoved: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (moveLock) {
+                    try {
+                        moveLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+
+        try {
+            tray.add(icon);
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+
+        d = new Dialog((Frame) null, "Modal Dialog");
+        d.setLocation(200, 200);
+        d.setSize(100, 100);
+        d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
+
+        dialogVisible = true;
+        synchronized (dialogLock) {
+            try {
+                dialogLock.notifyAll();
+            } catch (Exception e) {
+            }
+        }
+
+        d.setVisible(true);
+    }
+
+    void doTest() throws Exception {
+
+        if (! dialogVisible) {
+            synchronized (dialogLock) {
+                try {
+                    dialogLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+
+        if (! dialogVisible)
+            throw new RuntimeException("ERROR: TIMEOUT: The thread in EDT not yet complete");
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        if (! d.isVisible())
+            throw new RuntimeException("FAIL: The modal dialog is not yet visible");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle(2000);
+
+        SystemTrayIconHelper.doubleClick(robot);
+
+        if (! actionPerformed) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! actionPerformed)
+            throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is double clicked");
+
+        for (int i = 0; i < buttonTypes.length; i++) {
+            mousePressed = false;
+            robot.mousePress(buttonTypes[i]);
+
+            if (! mousePressed) {
+                synchronized (pressLock) {
+                    try {
+                        pressLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mousePressed)
+                if (! SystemTrayIconHelper.skip(buttonTypes[i]) )
+                    throw new RuntimeException("FAIL: mousePressed not triggered when " +
+                            buttonNames[i] + " pressed");
+
+            mouseReleased = false;
+            mouseClicked = false;
+            robot.mouseRelease(buttonTypes[i]);
+
+            if (! mouseReleased) {
+                synchronized (releaseLock) {
+                    try {
+                        releaseLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mouseReleased)
+                throw new RuntimeException("FAIL: mouseReleased not triggered when " +
+                        buttonNames[i] + " released");
+
+            if (! mouseClicked) {
+                synchronized (clickLock) {
+                    try {
+                        clickLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mouseClicked)
+                throw new RuntimeException("FAIL: mouseClicked not triggered when " +
+                        buttonNames[i] + " pressed & released");
+        }
+
+        mouseMoved = false;
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.glide(iconPosition.x + 100, iconPosition.y);
+
+        if (! mouseMoved)
+            if (! SystemTrayIconHelper.skip(0) )
+                throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/MouseEventMask/MouseEventMaskTest.java b/jdk/test/java/awt/TrayIcon/MouseEventMask/MouseEventMaskTest.java
new file mode 100644
index 00000000000..e6c194ec69c
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/MouseEventMask/MouseEventMaskTest.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check if MouseEvents triggered by TrayIcon are visible
+ *          by an AWTEventListener added to the Toolkit. It also
+ *          checks if all listeners are triggered when AWTEventListeners
+ *          and MouseListeners are added.
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main MouseEventMaskTest
+ */
+
+public class MouseEventMaskTest {
+
+    TrayIcon icon;
+    Robot robot;
+    int[] buttonTypes = {
+        InputEvent.BUTTON1_MASK,
+        InputEvent.BUTTON2_MASK,
+        InputEvent.BUTTON3_MASK
+    };
+
+    String[] buttonNames = {
+        "BUTTON1",
+        "BUTTON2",
+        "BUTTON3"
+    };
+
+    boolean mouseEventTriggered = false;
+    boolean mouseMotionEventTriggered = false;
+    Object mouseEventLock = new Object();
+    Object mouseMotionEventLock = new Object();
+    boolean mouseMotionTest, mouseTest;
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
+                System.err.println("Test can fail if the icon hides to a tray icons pool " +
+                        "in Windows 7, which is behavior by default.\n" +
+                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
+                        "\"Always show all icons and notifications on the taskbar\" true " +
+                        "to avoid this problem. Or change behavior only for Java SE tray " +
+                        "icon and rerun test.");
+            }
+            new MouseEventMaskTest().doTest();
+        }
+    }
+
+    public MouseEventMaskTest() throws Exception{
+        EventQueue.invokeAndWait(this::initializeGUI);
+    }
+
+    void initializeGUI() {
+
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon");
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(event -> {
+            if (mouseTest) {
+                if (! event.getSource().getClass().getName().contains("Canvas")) {
+                    if (!icon.equals(event.getSource()))
+                        throw new RuntimeException("FAIL: MouseEvent not triggered for icon " + event);
+
+                    mouseEventTriggered = true;
+                    synchronized (mouseEventLock) {
+                        try {
+                            mouseEventLock.notifyAll();
+                        } catch (Exception e) {
+                        }
+                    }
+                }
+            }
+        }, AWTEvent.MOUSE_EVENT_MASK);
+        Toolkit.getDefaultToolkit().addAWTEventListener(event -> {
+            if (mouseMotionTest) {
+                if (! event.getSource().getClass().getName().contains("Canvas")) {
+                    if (!icon.equals(event.getSource()))
+                        throw new RuntimeException("FAIL: MouseMotionEvent not triggered for icon " + event);
+
+                    mouseMotionEventTriggered = true;
+                    synchronized (mouseMotionEventLock) {
+                        try {
+                            mouseMotionEventLock.notifyAll();
+                        } catch (Exception e) {
+                        }
+                    }
+                }
+            }
+        }, AWTEvent.MOUSE_MOTION_EVENT_MASK);
+
+        try {
+            tray.add(icon);
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    void doTest() throws Exception {
+
+        robot = new Robot();
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+
+        for (int i = 0; i < buttonTypes.length; i++) {
+            System.out.println("Verify button "+buttonTypes[i]);
+            mouseTest = true;
+            mouseEventTriggered = false;
+            robot.mousePress(buttonTypes[i]);
+
+            if (! mouseEventTriggered) {
+                synchronized (mouseEventLock) {
+                    try {
+                        mouseEventLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mouseEventTriggered)
+                if (! SystemTrayIconHelper.skip(buttonTypes[i]) )
+                    throw new RuntimeException("FAIL: AWTEventListener not notified when " +
+                        buttonNames[i] + " pressed on TrayIcon");
+
+            mouseEventTriggered = false;
+            robot.mouseRelease(buttonTypes[i]);
+            if (! mouseEventTriggered) {
+                synchronized (mouseEventLock) {
+                    try {
+                        mouseEventLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            if (! mouseEventTriggered)
+                throw new RuntimeException("FAIL: AWTEventListener not notified when " +
+                        buttonNames[i] + " released on TrayIcon");
+        }
+
+        mouseMotionTest = true;
+        mouseTest = false;
+        mouseMotionEventTriggered = false;
+
+        for (int i = 0; i < 20; i++) {
+            robot.mouseMove(iconPosition.x + i, iconPosition.y);
+            robot.delay(25);
+        }
+        if (! mouseMotionEventTriggered) {
+            synchronized (mouseMotionEventLock) {
+                try {
+                    mouseMotionEventLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! mouseMotionEventTriggered)
+            if (! SystemTrayIconHelper.skip(0) )
+                throw new RuntimeException("FAIL: AWTEventListener not notified when " +
+                        "mouse moved");
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/MouseMovedTest/MouseMovedTest.java b/jdk/test/java/awt/TrayIcon/MouseMovedTest/MouseMovedTest.java
new file mode 100644
index 00000000000..04d91f23859
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/MouseMovedTest/MouseMovedTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @bug 7153700
+ * @summary Check for mouseMoved event for java.awt.TrayIcon
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main MouseMovedTest
+ */
+
+public class MouseMovedTest {
+    static volatile boolean moved;
+
+    public static void main(String[] args) throws Exception {
+        moved = false;
+
+        TrayIcon icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Test icon");
+        icon.addMouseMotionListener(new MouseMotionAdapter() {
+            public void mouseMoved(MouseEvent event) {
+                moved = true;
+                System.out.println("Mouse moved");
+            }
+        });
+        SystemTray.getSystemTray().add(icon);
+
+        ExtendedRobot robot = new ExtendedRobot();
+        Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
+        if (System.getProperty("os.name").toLowerCase().startsWith("win"))
+            robot.glide(size.width / 2, size.height-15, size.width, size.height-15, 1, 3);
+        else
+            robot.glide(size.width / 2, 13, size.width, 13, 1, 3);
+        robot.mouseMove(size.width/2, size.height/2);
+
+        if (!moved)
+            throw new RuntimeException("Mouse moved action did not trigger");
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/PropertyChangeListenerTest.java b/jdk/test/java/awt/TrayIcon/PropertyChangeListenerTest.java
new file mode 100644
index 00000000000..90bc1225ea3
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/PropertyChangeListenerTest.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/*
+ * @test
+ * @summary Check if custom property change listener added
+ *          to system tray works correctly
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main PropertyChangeListenerTest
+ */
+
+public class PropertyChangeListenerTest implements PropertyChangeListener {
+
+    Object property;
+    Object lock = new Object();
+    boolean propertyChanged = false;
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            new PropertyChangeListenerTest().doTest();
+        }
+    }
+
+    public void propertyChange(PropertyChangeEvent event) {
+        if (! "trayIcons".equals(event.getPropertyName()))
+            throw new RuntimeException("ERROR: PropertyName not matching. Event " +
+                    "triggered for a different property\n"+
+                    "Property: " + event.getPropertyName());
+        property = event.getNewValue();
+        propertyChanged = true;
+        synchronized (lock) {
+            try {
+                lock.notifyAll();
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    void doTest() throws Exception {
+        propertyChanged = false;
+        SystemTray tray = SystemTray.getSystemTray();
+
+        tray.addPropertyChangeListener(null, null);
+        tray.addPropertyChangeListener("trayIcons", null);
+        tray.addPropertyChangeListener("trayIcons", this);
+
+        BufferedImage img = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
+        Graphics g = img.createGraphics();
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, 32, 32);
+        g.setColor(Color.RED);
+        g.fillRect(6, 6, 20, 20);
+        g.dispose();
+
+        TrayIcon icon = new TrayIcon(img);
+        if (propertyChanged)
+            throw new RuntimeException("FAIL: spurious property events triggered");
+
+        propertyChanged = false;
+        tray.add(icon);
+
+        if (! propertyChanged) {
+            synchronized (lock) {
+                try {
+                    lock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! propertyChanged) {
+            throw new RuntimeException("FAIL: property event did not get triggered when tray icon added");
+        } else {
+            if (! (property instanceof TrayIcon[])) {
+                throw new RuntimeException("FAIL: property is not TrayIcon[]. TrayIcon added.");
+            } else {
+                TrayIcon[] icons = (TrayIcon[]) property;
+                if (icons.length != 1 || ! icon.equals(icons[0])) {
+                    throw new RuntimeException("FAIL: TrayIcon[] returned by the " +
+                            "PropertyChangeEvent is incorrect. TrayIcon added.\n"+
+                            "icon[] length: " + icons.length);
+                }
+            }
+        }
+
+        propertyChanged = false;
+        tray.remove(icon);
+
+        if (! propertyChanged) {
+            synchronized (lock) {
+                try {
+                    lock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! propertyChanged) {
+            throw new RuntimeException("FAIL: property event did not get triggered when tray icon removed");
+        } else {
+            if (! (property instanceof TrayIcon[])) {
+                throw new RuntimeException("FAIL: property is not TrayIcon[]. TrayIcon removed.");
+            } else {
+                TrayIcon[] icons = (TrayIcon[]) property;
+                if (icons.length != 0) {
+                    throw new RuntimeException("FAIL: TrayIcon[] returned by the " +
+                            "PropertyChangeEvent is incorrect. TrayIcon removed.\n"+
+                            "icon[] length: " + icons.length);
+                }
+            }
+        }
+
+        tray.removePropertyChangeListener("trayIcons", null);
+        tray.removePropertyChangeListener("trayIcons", this);
+
+        propertyChanged = false;
+        tray.add(icon);
+
+        Thread.sleep(3000);
+        if (propertyChanged)
+            throw new RuntimeException("FAIL: property listener notified even after " +
+                    "removing the listener from SystemTray. TrayIcon added.");
+
+        propertyChanged = false;
+        tray.remove(icon);
+
+        Thread.sleep(3000);
+        if (propertyChanged)
+            throw new RuntimeException("FAIL: property listener notified even after " +
+                    "removing the listener from SystemTray. TrayIcon removed.");
+
+        tray.addPropertyChangeListener("someName", this);
+
+        propertyChanged = false;
+        tray.add(icon);
+
+        Thread.sleep(3000);
+        if (propertyChanged)
+            throw new RuntimeException("FAIL: property listener notified when " +
+                    "listener added for a different property. TrayIcon added.");
+
+        propertyChanged = false;
+        tray.remove(icon);
+
+        Thread.sleep(3000);
+        if (propertyChanged)
+            throw new RuntimeException("FAIL: property listener notified when " +
+                    "listener added for a different property. TrayIcon removed.");
+
+        tray.addPropertyChangeListener("trayIcons", this);
+        tray.addPropertyChangeListener("trayIcons", this);
+        PropertyChangeListener listener = event -> { };
+        tray.addPropertyChangeListener("trayIcons", listener);
+        tray.addPropertyChangeListener("sampleProp", event -> {});
+
+        if (tray.getPropertyChangeListeners("trayIcons").length != 3) {
+            throw new RuntimeException("FAIL: getPropertyChangeListeners did not return the " +
+                    "correct value for trayIcons property. Expected: 3, " +
+                    "Actual: " + tray.getPropertyChangeListeners("trayIcons").length);
+        } else if (! this.equals(tray.getPropertyChangeListeners("trayIcons")[0]) ||
+                   ! this.equals(tray.getPropertyChangeListeners("trayIcons")[1]) ||
+                   ! listener.equals(tray.getPropertyChangeListeners("trayIcons")[2])) {
+            throw new RuntimeException("FAIL: getPropertyChangeListeners did not return the " +
+                    "expected listeners\n" +
+                    "tray.getPropertyChangeListeners('trayIcons')[0] " + tray.getPropertyChangeListeners("trayIcons")[0]+"\n"+
+                    "tray.getPropertyChangeListeners('trayIcons')[1] " + tray.getPropertyChangeListeners("trayIcons")[1]+"\n"+
+                    "tray.getPropertyChangeListeners('trayIcons')[2] " + tray.getPropertyChangeListeners("trayIcons")[2]);
+        }
+
+        if (tray.getPropertyChangeListeners("sampleProp").length != 1)
+            throw new RuntimeException("FAIL: getPropertyChangeListeners did not return the " +
+                    "expected listener for 'sampleProp'");
+
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/FunctionalityCheck.java b/jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/FunctionalityCheck.java
new file mode 100644
index 00000000000..5918ac3dfc0
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/FunctionalityCheck.java
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check for MouseEvents with all mouse buttons
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../../lib/testlibrary ../../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main/othervm/policy=tray.policy -Djava.security.manager FunctionalityCheck
+ */
+
+public class FunctionalityCheck {
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+
+    boolean actionPerformed = false;
+    Object actionLock = new Object();
+    Object pressLock = new Object();
+    Object releaseLock = new Object();
+    Object clickLock = new Object();
+    Object moveLock = new Object();
+
+    String caption = "Sample Icon";
+    boolean mousePressed = false;
+    boolean mouseReleased = false;
+    boolean mouseClicked = false;
+    boolean mouseMoved = false;
+
+    static final int[] buttonTypes = {
+        InputEvent.BUTTON1_MASK,
+        InputEvent.BUTTON2_MASK,
+        InputEvent.BUTTON3_MASK
+    };
+
+    static final String[] buttonNames = {
+        "BUTTON1",
+        "BUTTON2",
+        "BUTTON3"
+    };
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                               "Marking the test passed");
+        } else {
+            new FunctionalityCheck().doTest();
+        }
+    }
+
+    FunctionalityCheck() throws Exception {
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait(this::initializeGUI);
+    }
+
+    void initializeGUI() {
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
+        icon.addActionListener(event -> {
+            actionPerformed = true;
+            synchronized (actionLock) {
+                try {
+                    actionLock.notifyAll();
+                } catch (Exception e) {
+                }
+            }
+        });
+        icon.addMouseListener(new MouseAdapter() {
+            public void mousePressed(MouseEvent event) {
+                mousePressed = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mousePressed");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mousePressed: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (pressLock) {
+                    try {
+                        pressLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseReleased(MouseEvent event) {
+                mouseReleased = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseReleased");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseReleased: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (releaseLock) {
+                    try {
+                        releaseLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseClicked(MouseEvent event) {
+                mouseClicked = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseClicked");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseClicked: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (clickLock) {
+                    try {
+                        clickLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+
+        icon.addMouseMotionListener(new MouseMotionAdapter() {
+            public void mouseMoved(MouseEvent event) {
+                mouseMoved = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseMoved");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseMoved: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (moveLock) {
+                    try {
+                        moveLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+
+        try {
+            tray.add(icon);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void doTest() throws Exception {
+
+
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle(2000);
+
+        SystemTrayIconHelper.doubleClick(robot);
+
+        if (! actionPerformed) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! actionPerformed)
+            throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is double clicked");
+
+        for (int i = 0; i < buttonTypes.length; i++) {
+            mousePressed = false;
+            robot.mousePress(buttonTypes[i]);
+
+            if (! mousePressed) {
+                synchronized (pressLock) {
+                    try {
+                        pressLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mousePressed)
+                if (! SystemTrayIconHelper.skip(buttonTypes[i]) )
+                    throw new RuntimeException("FAIL: mousePressed not triggered when " +
+                            buttonNames[i] + " pressed");
+
+            mouseReleased = false;
+            mouseClicked = false;
+            robot.mouseRelease(buttonTypes[i]);
+
+            if (! mouseReleased) {
+                synchronized (releaseLock) {
+                    try {
+                        releaseLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mouseReleased)
+                if (! SystemTrayIconHelper.skip(buttonTypes[i]) )
+                    throw new RuntimeException("FAIL: mouseReleased not triggered when " +
+                            buttonNames[i] + " released");
+
+            if (! mouseClicked) {
+                synchronized (clickLock) {
+                    try {
+                        clickLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mouseClicked)
+                throw new RuntimeException("FAIL: mouseClicked not triggered when " +
+                        buttonNames[i] + " pressed & released");
+        }
+
+        mouseMoved = false;
+        robot.mouseMove(iconPosition.x + 100, iconPosition.y);
+        robot.glide(iconPosition.x, iconPosition.y);
+
+        if (! mouseMoved)
+            if (! SystemTrayIconHelper.skip(0) )
+                throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/tray.policy b/jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/tray.policy
new file mode 100644
index 00000000000..845bfb8d80b
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/tray.policy
@@ -0,0 +1,21 @@
+grant {
+  permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
+  permission java.awt.AWTPermission "accessSystemTray";
+  permission java.awt.AWTPermission "createRobot";
+  permission java.util.PropertyPermission "resultsDir", "read";
+  permission java.util.PropertyPermission "user.home", "read";
+  permission java.util.PropertyPermission "os.name", "read";
+  permission java.awt.AWTPermission "accessEventQueue";
+  permission java.lang.RuntimePermission "setIO";
+  permission java.lang.RuntimePermission "accessDeclaredMembers";
+  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.lwawt.macosx";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.awt.X11";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.awt";
+  permission java.lang.RuntimePermission "loadLibrary.stl";
+  permission java.util.PropertyPermission "java.home", "read";
+  permission java.util.PropertyPermission "java.class.path", "read";
+  permission java.awt.AWTPermission "readDisplayPixels";
+  permission java.awt.AWTPermission "watchMousePointer";
+};
+
diff --git a/jdk/test/java/awt/TrayIcon/SecurityCheck/NoPermissionTest/NoPermissionTest.java b/jdk/test/java/awt/TrayIcon/SecurityCheck/NoPermissionTest/NoPermissionTest.java
new file mode 100644
index 00000000000..af172ae32ac
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/SecurityCheck/NoPermissionTest/NoPermissionTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check for SecurityException occurrence if no permissions for system tray granted
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main/othervm/policy=tray.policy -Djava.security.manager NoPermissionTest
+ */
+
+public class NoPermissionTest {
+
+    public static void main(String[] args) {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray is not supported on this platform. Marking the test passed");
+        } else {
+
+            BufferedImage im = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
+            Graphics gr = im.createGraphics();
+            gr.setColor(Color.white);
+            gr.fillRect(0, 0, 16, 16);
+
+            try {
+                SystemTray.getSystemTray();
+                throw new RuntimeException("FAIL: SecurityException not thrown by getSystemTray method");
+            } catch (SecurityException ex) {
+                if (!ex.getMessage().matches(".+java.awt.AWTPermission.+accessSystemTray.*"))
+                    throw new RuntimeException("FAIL: Security exception thrown due to unexpected reason");
+            }
+
+            try {
+                TrayIcon icon = new TrayIcon(im, "Caption");
+                throw new RuntimeException("FAIL: SecurityException not thrown by TrayIcon constructor");
+            } catch (SecurityException ex) {
+                if (!ex.getMessage().matches(".+java.awt.AWTPermission.+accessSystemTray.*"))
+                    throw new RuntimeException("FAIL: Security exception thrown due to unexpected reason");
+            }
+        }
+    }
+
+}
diff --git a/jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/PermissionTest.java b/jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/PermissionTest.java
new file mode 100644
index 00000000000..8de6187cd6b
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/PermissionTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check for no Exception occurrence if permissions for system tray granted
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main/othervm/policy=tray.policy -Djava.security.manager PermissionTest
+ */
+
+public class PermissionTest {
+
+    public static void main(String[] args) {
+
+        if (!SystemTray.isSupported()) {
+            System.out.println("SystemTray is not supported on this platform. Marking the test passed");
+        } else {
+            BufferedImage im = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
+            Graphics gr = im.createGraphics();
+            gr.setColor(Color.white);
+            gr.fillRect(0, 0, 16, 16);
+
+            SystemTray.getSystemTray();
+            TrayIcon icon = new TrayIcon(im, "Caption");
+        }
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/tray.policy b/jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/tray.policy
new file mode 100644
index 00000000000..be273f8fdf4
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/SecurityCheck/PermissionTest/tray.policy
@@ -0,0 +1,3 @@
+grant {
+  permission java.awt.AWTPermission "accessSystemTray";
+};
diff --git a/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java b/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java
new file mode 100644
index 00000000000..a8f6e2f7cf5
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java
@@ -0,0 +1,172 @@
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/*
+ * @summary This is a helper class to find the location of a system tray icon,
+ *          and skip some OS specific cases in tests.
+ * @library ../../../../../lib/testlibrary
+ * @build ExtendedRobot SystemTrayIconHelper
+ */
+public class SystemTrayIconHelper {
+
+    static Frame frame;
+
+    /**
+     * Call this method if the tray icon need to be followed in an automated manner
+     * This method will be called by automated testcases
+     */
+    static Point getTrayIconLocation(TrayIcon icon) throws Exception {
+        if (icon == null) {
+            return null;
+        }
+
+        //This is added just in case the tray's native menu is visible.
+        //It has to be hidden if visible. For that, we are showing a Frame
+        //and clicking on it - the assumption is, the menu will
+        //be closed if another window is clicked
+        ExtendedRobot robot = new ExtendedRobot();
+        try {
+           EventQueue.invokeAndWait(() -> {
+               frame = new Frame();
+               frame.setSize(100, 100);
+               frame.setVisible(true);
+           });
+            robot.mouseMove(frame.getLocationOnScreen().x + frame.getWidth() / 2,
+                    frame.getLocationOnScreen().y + frame.getHeight() / 2);
+            robot.waitForIdle();
+            robot.click();
+            EventQueue.invokeAndWait(frame::dispose);
+        } catch (Exception e) {
+            return null;
+        }
+
+        if (System.getProperty("os.name").startsWith("Win")) {
+            try {
+                // sun.awt.windows.WTrayIconPeer
+                Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+                Dimension iconSize = icon.getSize();
+
+                int width = (int) iconSize.getWidth();
+                int height = (int) iconSize.getHeight();
+
+                // Some previously created icons may not be removed
+                // from tray until mouse move on it. So we glide
+                // through the whole tray bar.
+                robot.glide((int) screenSize.getWidth(), (int) (screenSize.getHeight()-15), 0, (int) (screenSize.getHeight() - 15), 1, 2);
+
+                BufferedImage screen = robot.createScreenCapture(new Rectangle(screenSize));
+
+                for (int x = (int) (screenSize.getWidth()-width); x > 0; x--) {
+                    for (int y = (int) (screenSize.getHeight()-height); y > (screenSize.getHeight()-50); y--) {
+                        if (imagesEquals(((BufferedImage)icon.getImage()).getSubimage(0, 0, width, height), screen.getSubimage(x, y, width, height))) {
+                            return new Point(x+5, y+5);
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        } else if (System.getProperty("os.name").startsWith("Mac")) {
+            Point2D point2d;
+            try {
+                // sun.lwawt.macosx.CTrayIcon
+                Field f_peer = getField( java.awt.TrayIcon.class, "peer");
+
+                Object peer = f_peer.get(icon);
+                Method m_getModel = peer.getClass().getDeclaredMethod(
+                        "getModel");
+                m_getModel.setAccessible(true);
+                long model = (Long) (m_getModel.invoke(peer, new Object[]{}));
+                Method m_getLocation = peer.getClass().getDeclaredMethod(
+                        "nativeGetIconLocation", new Class[]{Long.TYPE});
+                m_getLocation.setAccessible(true);
+                point2d = (Point2D)m_getLocation.invoke(peer, new Object[]{model});
+                Point po = new Point((int)(point2d.getX()), (int)(point2d.getY()));
+                po.translate(10, -5);
+                return po;
+            }catch(Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        } else {
+            try {
+                // sun.awt.X11.XTrayIconPeer
+                Field f_peer = getField(java.awt.TrayIcon.class, "peer");
+
+                Object peer = f_peer.get(icon);
+                Method m_getLOS = peer.getClass().getDeclaredMethod(
+                        "getLocationOnScreen", new Class[]{});
+                m_getLOS.setAccessible(true);
+                Point point = (Point)m_getLOS.invoke(peer, new Object[]{});
+                point.translate(5, 5);
+                return point;
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        }
+        return null;
+    }
+
+    static Field getField(final Class clz, final String fieldName) {
+        Field res = null;
+        try {
+            res = (Field)AccessController.doPrivileged((PrivilegedExceptionAction) () -> {
+                Field f = clz.getDeclaredField(fieldName);
+                f.setAccessible(true);
+                return f;
+            });
+        } catch (PrivilegedActionException ex) {
+            ex.printStackTrace();
+        }
+        return res;
+    }
+
+    static boolean imagesEquals(BufferedImage img1, BufferedImage img2) {
+        for (int x = 0; x < img1.getWidth(); x++) {
+            for (int y = 0; y < img1.getHeight(); y++) {
+                if (img1.getRGB(x, y) != img2.getRGB(x, y))
+                    return false;
+            }
+        }
+        return true;
+    }
+
+    static void doubleClick(Robot robot) {
+        if (System.getProperty("os.name").startsWith("Mac")) {
+            robot.mousePress(InputEvent.BUTTON3_MASK);
+            robot.delay(50);
+            robot.mouseRelease(InputEvent.BUTTON3_MASK);
+        } else {
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(50);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.delay(50);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(50);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        }
+    }
+
+    // Method for skipping some OS specific cases
+    static boolean skip(int button) {
+        if (System.getProperty("os.name").toLowerCase().startsWith("win")){
+            if (button == InputEvent.BUTTON1_MASK){
+                // See JDK-6827035
+                return true;
+            }
+        } else if (System.getProperty("os.name").toLowerCase().contains("os x")){
+            // See JDK-7153700
+            return true;
+        }
+        return false;
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java b/jdk/test/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java
new file mode 100644
index 00000000000..d00d02e7484
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check the getSystemTray method of the SystemTray. Checks if
+ *          a proper instance is returned in supported platforms and a proper
+ *          exception is thrown in unsupported platforms
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main/othervm -DSystemTraySupport=TRUE SystemTrayInstanceTest
+ */
+
+public class SystemTrayInstanceTest {
+
+    private static boolean supported = false;
+
+    public static void main(String[] args) throws Exception {
+        String sysTraySupport = System.getProperty("SystemTraySupport");
+        if (sysTraySupport == null)
+            throw new RuntimeException("SystemTray support status unknown!");
+
+        if ("TRUE".equals(sysTraySupport)) {
+            System.out.println("System tray is supported on the platform under test");
+            supported = true;
+        }
+
+        new SystemTrayInstanceTest().doTest();
+    }
+
+    private void doTest() throws Exception {
+        boolean flag = SystemTray.isSupported();
+        if (supported != flag)
+            throw new RuntimeException("FAIL: isSupported did not return the correct value"+
+                    (supported ?
+                            "SystemTray is supported on the platform under test" :
+                            "SystemTray is not supported on the platform under test") +
+                    "SystemTray.isSupported() method returned " + flag);
+
+        if (supported) {
+            SystemTray tray = SystemTray.getSystemTray();
+        } else {
+            try {
+                SystemTray tray = SystemTray.getSystemTray();
+            } catch (UnsupportedOperationException uoe) {
+                System.out.println("UnsupportedOperationException thrown correctly");
+            }
+        }
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconAddTest/TrayIconAddTest.java b/jdk/test/java/awt/TrayIcon/TrayIconAddTest/TrayIconAddTest.java
new file mode 100644
index 00000000000..1b12a27ca58
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconAddTest/TrayIconAddTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+
+/*
+ * @test
+ * @summary Tests the add method of the SystemTray. Checks if it
+ *          throws proper exceptions in case of invalid arguments and adds the
+ *          TrayIcon correctly in case of a proper argument
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main TrayIconAddTest
+ */
+
+public class TrayIconAddTest {
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            new TrayIconAddTest().doTest();
+        }
+    }
+
+    void doTest() throws Exception {
+        SystemTray tray = SystemTray.getSystemTray();
+        try {
+            tray.add(null);
+        } catch (NullPointerException npe) {
+            System.out.println("NullPointerException thrown correctly when add(null) called");
+        }
+
+        TrayIcon icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB));
+
+        tray.add(icon);
+
+        try {
+            tray.add(icon);
+        } catch (IllegalArgumentException iae) {
+            System.out.println("IllegalArgumentException rightly thrown when tray icon is added twice");
+        }
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconEventModifiers/TrayIconEventModifiersTest.java b/jdk/test/java/awt/TrayIcon/TrayIconEventModifiers/TrayIconEventModifiersTest.java
new file mode 100644
index 00000000000..9cdce634a92
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconEventModifiers/TrayIconEventModifiersTest.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
+
+
+/*
+ * @test
+ * @summary Check if MouseEvent has the proper modifiers when
+ *          TrayIcon is clicked pressing the modifier keys
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main TrayIconEventModifiersTest
+ */
+
+public class TrayIconEventModifiersTest {
+
+    Image image;
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+
+    Object mouseLock = new Object();
+
+    String caption = "Sample Icon";
+    boolean mousePressed = false;
+    boolean mouseReleased = false;
+    boolean mouseClicked = false;
+    int modifiers, releaseModifiers, clickModifiers;
+
+    int[] buttonTypes = {
+        InputEvent.BUTTON1_MASK,
+        InputEvent.BUTTON2_MASK,
+        InputEvent.BUTTON3_MASK
+    };
+
+    String[] buttonNames = {
+        "BUTTON1",
+        "BUTTON2",
+        "BUTTON3"
+    };
+
+    int[] buttonMasks = {
+        InputEvent.BUTTON1_DOWN_MASK,
+        InputEvent.BUTTON2_DOWN_MASK,
+        InputEvent.BUTTON3_DOWN_MASK
+    };
+
+    static int[] keyTypes = {
+        KeyEvent.VK_SHIFT,
+        KeyEvent.VK_CONTROL
+    };
+
+    static String[] keyNames = {
+        "SHIFT",
+        "CONTROL"
+    };
+
+    static int[] keyMasks = {
+        KeyEvent.SHIFT_DOWN_MASK,
+        KeyEvent.CTRL_DOWN_MASK
+    };
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("win"))
+                System.err.println("Test can fail if the icon hides to a tray icons pool" +
+                        "in Windows 7, which is behavior by default.\n" +
+                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
+                        "\"Always show all icons and notifications on the taskbar\" true " +
+                        "to avoid this problem. Or change behavior only for Java SE tray " +
+                        "icon and rerun test.");
+
+            System.out.println(System.getProperty("os.arch"));
+            if (System.getProperty("os.name").indexOf("Sun") != -1 &&
+                    System.getProperty("os.arch").indexOf("sparc") != -1) {
+                keyTypes = new int[]{
+                        KeyEvent.VK_SHIFT,
+                        KeyEvent.VK_CONTROL,
+                        KeyEvent.VK_META
+                };
+
+                keyNames = new String[]{
+                        "SHIFT",
+                        "CONTROL",
+                        "META"
+                };
+                keyMasks = new int[]{
+                        KeyEvent.SHIFT_DOWN_MASK,
+                        KeyEvent.CTRL_DOWN_MASK,
+                        KeyEvent.META_DOWN_MASK
+                };
+            }
+
+            new TrayIconEventModifiersTest().doTest();
+        }
+    }
+
+    public TrayIconEventModifiersTest() throws Exception {
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait(this::initializeGUI);
+    }
+
+    private void initializeGUI() {
+
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
+        icon.addMouseListener(new MouseAdapter() {
+            public void mousePressed(MouseEvent event) {
+                if (!icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mousePressed: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                mousePressed = true;
+                modifiers = event.getModifiersEx();
+                System.out.println("Icon mousePressed " + modifiers);
+                synchronized (mouseLock) {
+                    try {
+                        mouseLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseReleased(MouseEvent event) {
+                if (!icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseReleased: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                mouseReleased = true;
+                releaseModifiers = event.getModifiersEx();
+                System.out.println("Icon mouseReleased " + releaseModifiers);
+                synchronized (mouseLock) {
+                    try {
+                        mouseLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseClicked(MouseEvent event) {
+                if (!icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseClicked: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                mouseClicked = true;
+                clickModifiers = event.getModifiersEx();
+                System.out.println("Icon mouseClickedd " + clickModifiers);
+                synchronized (mouseLock) {
+                    try {
+                        mouseLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+
+        try {
+            tray.add(icon);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    void doTest() throws Exception {
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+
+        for (int i = 0; i < buttonTypes.length; i++) {
+            for (int j = 0; j < keyTypes.length; j++) {
+                mousePressed = false;
+
+                robot.keyPress(keyTypes[j]);
+                robot.mousePress(buttonTypes[i]);
+
+                if (! mousePressed) {
+                    synchronized (mouseLock) {
+                        try {
+                            mouseLock.wait(3000);
+                        } catch (Exception e) {
+                        }
+                    }
+                }
+                if (! mousePressed) {
+                    if (! SystemTrayIconHelper.skip(buttonTypes[i]))
+                        throw new RuntimeException("FAIL: mousePressed not triggered when " +
+                                keyNames[j] + " + " + buttonNames[i] + " pressed");
+                } else {
+                    int onMask = buttonMasks[i] | keyMasks[j];
+                    if ((modifiers & onMask) != onMask) {
+                        throw new RuntimeException("FAIL: getModifiersEx did not return " +
+                                "the correct value when " + keyNames[j] + " + " +
+                                buttonNames[i] + " pressed");
+                    }
+                }
+
+                mouseReleased = false;
+                mouseClicked = false;
+                robot.mouseRelease(buttonTypes[i]);
+
+                if (! mouseReleased) {
+                    synchronized (mouseLock) {
+                        try {
+                            mouseLock.wait(3000);
+                        } catch (Exception e) {
+                        }
+                    }
+                }
+
+                robot.waitForIdle(1000);
+                robot.keyRelease(keyTypes[j]);
+                robot.waitForIdle(1000);
+
+                if (! mouseReleased) {
+                    if (! SystemTrayIconHelper.skip(buttonTypes[i]))
+                        throw new RuntimeException("FAIL: mouseReleased not triggered when " +
+                                keyNames[j] + " + " + buttonNames[i] + " released");
+                } else {
+                    int onMask = keyMasks[j];
+                    if ((releaseModifiers & onMask) != onMask)
+                        throw new RuntimeException("FAIL: getModifiersEx did not return " +
+                                "the correct value when " + keyNames[j] + " + " +
+                                buttonNames[i] + " released");
+                }
+                if (! mouseClicked) {
+                    throw new RuntimeException("FAIL: mouseClicked not triggered when " +
+                            keyNames[j] + " + " + buttonNames[i] +
+                            " pressed & released");
+                } else {
+                    int onMask = keyMasks[j];
+                    if ((clickModifiers & onMask) != onMask)
+                        throw new RuntimeException("FAIL: getModifiersEx did not return " +
+                                "the correct value when " + keyNames[j] + " + " +
+                                buttonNames[i] + " pressed & released");
+                }
+                robot.type(KeyEvent.VK_ESCAPE);
+            }
+        }
+    }
+}
+
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconEvents/TrayIconEventsTest.java b/jdk/test/java/awt/TrayIcon/TrayIconEvents/TrayIconEventsTest.java
new file mode 100644
index 00000000000..c7c79ea6570
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconEvents/TrayIconEventsTest.java
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+
+/*
+ * @test
+ * @summary Check for MouseEvents with all mouse buttons
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main TrayIconEventsTest
+ */
+
+public class TrayIconEventsTest {
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+
+    boolean actionPerformed = false;
+    Object actionLock = new Object();
+    Object pressLock = new Object();
+    Object releaseLock = new Object();
+    Object clickLock = new Object();
+    Object moveLock = new Object();
+
+    String caption = "Sample Icon";
+    boolean mousePressed = false;
+    boolean mouseReleased = false;
+    boolean mouseClicked = false;
+    boolean mouseMoved = false;
+
+    int[] buttonTypes = {
+        InputEvent.BUTTON1_MASK,
+        InputEvent.BUTTON2_MASK,
+        InputEvent.BUTTON3_MASK
+    };
+
+    String[] buttonNames = {
+        "BUTTON1",
+        "BUTTON2",
+        "BUTTON3"
+    };
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                               "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("win"))
+                System.err.println("Test can fail if the icon hides to a tray icons pool " +
+                        "in Windows 7, which is behavior by default.\n" +
+                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
+                        "\"Always show all icons and notifications on the taskbar\" true " +
+                        "to avoid this problem. Or change behavior only for Java SE " +
+                        "tray icon.");
+            new TrayIconEventsTest().doTest();
+        }
+    }
+
+    public TrayIconEventsTest() throws Exception {
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait(this::initializeGUI);
+    }
+
+    private void initializeGUI(){
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
+        icon.addActionListener(event -> {
+            actionPerformed = true;
+            synchronized (actionLock) {
+                try {
+
+                    actionLock.notifyAll();
+                } catch (Exception e) {
+                }
+            }
+        });
+        icon.addMouseListener(new MouseAdapter() {
+            public void mousePressed(MouseEvent event) {
+                mousePressed = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mousePressed");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mousePressed: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (pressLock) {
+                    try {
+                        pressLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseReleased(MouseEvent event) {
+                mouseReleased = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseReleased");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseReleased: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (releaseLock) {
+                    try {
+                        releaseLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+
+            public void mouseClicked(MouseEvent event) {
+                mouseClicked = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseClicked");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseClicked: MouseEvent.getSource " +
+                                       "did not return TrayIcon object");
+
+                synchronized (clickLock) {
+                    try {
+                        clickLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+
+        icon.addMouseMotionListener(new MouseMotionAdapter() {
+            public void mouseMoved(MouseEvent event) {
+                mouseMoved = true;
+                Point p = event.getPoint();
+                if (p.x != event.getX() || p.y != event.getY())
+                    throw new RuntimeException("FAIL: MouseEvent.getPoint() did " +
+                            "not return the same value as getX/getY " +
+                            "for mouseMoved");
+
+                if (! icon.equals(event.getSource()))
+                    throw new RuntimeException("FAIL: mouseMoved: MouseEvent.getSource " +
+                            "did not return TrayIcon object");
+
+                synchronized (moveLock) {
+                    try {
+                        moveLock.notifyAll();
+                    } catch (Exception e) {
+                    }
+                }
+            }
+        });
+
+        try {
+            tray.add(icon);
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    void doTest() throws Exception {
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle(2000);
+
+        SystemTrayIconHelper.doubleClick(robot);
+
+        if (! actionPerformed) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(10000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (! actionPerformed)
+            throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is double clicked");
+
+        for (int i = 0; i < buttonTypes.length; i++) {
+            mousePressed = false;
+            robot.mousePress(buttonTypes[i]);
+
+            if (! mousePressed) {
+                synchronized (pressLock) {
+                    try {
+                        pressLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mousePressed)
+                if (! SystemTrayIconHelper.skip(buttonTypes[i]) )
+                    throw new RuntimeException("FAIL: mousePressed not triggered when " +
+                            buttonNames[i] + " pressed");
+
+            mouseReleased = false;
+            mouseClicked = false;
+            robot.mouseRelease(buttonTypes[i]);
+
+            if (! mouseReleased) {
+                synchronized (releaseLock) {
+                    try {
+                        releaseLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mouseReleased)
+                throw new RuntimeException("FAIL: mouseReleased not triggered when " +
+                        buttonNames[i] + " released");
+
+            if (! mouseClicked) {
+                synchronized (clickLock) {
+                    try {
+                        clickLock.wait(3000);
+                    } catch (Exception e) {
+                    }
+                }
+            }
+            if (! mouseClicked)
+                throw new RuntimeException("FAIL: mouseClicked not triggered when " +
+                        buttonNames[i] + " pressed & released");
+        }
+
+        mouseMoved = false;
+        robot.mouseMove(iconPosition.x + 100, iconPosition.y);
+        robot.glide(iconPosition.x, iconPosition.y);
+
+        if (! mouseMoved)
+            if (! SystemTrayIconHelper.skip(0) )
+                throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconMethodsTest/TrayIconMethodsTest.java b/jdk/test/java/awt/TrayIcon/TrayIconMethodsTest/TrayIconMethodsTest.java
new file mode 100644
index 00000000000..50c71310b7c
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconMethodsTest/TrayIconMethodsTest.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check various methods of the TrayIcon - whether the methods
+ *          return the proper values, throws the proper exceptions etc
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main TrayIconMethodsTest
+ */
+
+public class TrayIconMethodsTest {
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            new TrayIconMethodsTest().doTest();
+        }
+    }
+
+    void doTest() throws Exception {
+        SystemTray tray = SystemTray.getSystemTray();
+
+        String toolTip = "Sample Icon";
+        PopupMenu pm = new PopupMenu();
+        pm.add(new MenuItem("Sample"));
+
+        Image image = new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB);
+        TrayIcon icon = new TrayIcon(image, toolTip, pm);
+
+        ActionListener al1 = event -> {};
+        ActionListener al2 = event -> {};
+        MouseMotionListener mml1 = new MouseMotionAdapter() {};
+        MouseMotionListener mml2 = new MouseMotionAdapter() {};
+        MouseListener ml1 = new MouseAdapter() {};
+        MouseListener ml2 = new MouseAdapter() {};
+
+        icon.addActionListener(al1);
+        icon.addActionListener(al2);
+        icon.addMouseMotionListener(mml1);
+        icon.addMouseMotionListener(mml2);
+        icon.addMouseListener(ml1);
+        icon.addMouseListener(ml2);
+        tray.add(icon);
+
+        ActionListener[] actionListeners = icon.getActionListeners();
+        if (actionListeners == null || actionListeners.length != 2)
+            throw new RuntimeException("FAIL: getActionListeners did not return the correct value " +
+                    "when there were two listeners present " + actionListeners);
+
+        if (! isPresent(actionListeners, al1) || ! isPresent(actionListeners, al2))
+            throw new RuntimeException("FAIL: All the action listeners added are not returned " +
+                    "by the method");
+
+        MouseListener[] mouseListeners = icon.getMouseListeners();
+        if (mouseListeners == null || mouseListeners.length != 2)
+            throw new RuntimeException("FAIL: getMouseListeners did not return the correct value " +
+                    "when there were two listeners present " + mouseListeners);
+
+        if (! isPresent(mouseListeners, ml1) || ! isPresent(mouseListeners, ml2))
+            throw new RuntimeException("FAIL: All the mouse listeners added are not returned " +
+                    "by the method");
+
+        MouseMotionListener[] mouseMotionListeners = icon.getMouseMotionListeners();
+        if (mouseMotionListeners == null || mouseMotionListeners.length != 2)
+            throw new RuntimeException("FAIL: getMouseMotionListeners did not return the correct value " +
+                    "when there were two listeners present " + mouseMotionListeners);
+
+        if (! isPresent(mouseMotionListeners, mml1) || ! isPresent(mouseMotionListeners, mml2))
+            throw new RuntimeException("FAIL: All the mouse motion listeners added are not returned " +
+                    "by the method");
+
+        Image im = icon.getImage();
+        if (! image.equals(im))
+            throw new RuntimeException("FAIL: Images are not the same getImage()=" + im +
+                    " Image=" + image);
+
+        if (! pm.equals(icon.getPopupMenu()))
+            throw new RuntimeException("FAIL: PopupMenus are not the same getPopupMenu()=" +
+                    icon.getPopupMenu() + " PopupMenu=" + pm);
+
+        if (! toolTip.equals(icon.getToolTip()))
+            throw new RuntimeException("FAIL: ToolTips are not the same getToolTip()=" +
+                               icon.getToolTip() + " ToolTip=" + toolTip);
+
+        if (icon.isImageAutoSize())
+            throw new RuntimeException("FAIL: Auto size property is true by default");
+
+        icon.setImageAutoSize(true);
+        if (! icon.isImageAutoSize())
+            throw new RuntimeException("FAIL: Auto size property is not set to " +
+                    "true by call to setImageAutoSize(true)");
+
+        icon.removeActionListener(al1);
+        icon.removeActionListener(al2);
+        actionListeners = icon.getActionListeners();
+        if (actionListeners == null || actionListeners.length != 0)
+            throw new RuntimeException("FAIL: removeActionListener did not " +
+                    "remove the ActionListeners added " + actionListeners);
+
+        icon.removeMouseListener(ml1);
+        icon.removeMouseListener(ml2);
+        mouseListeners = icon.getMouseListeners();
+        if (mouseListeners == null || mouseListeners.length != 0)
+            throw new RuntimeException("FAIL: removeMouseListener did not " +
+                    "remove the MouseListeners added " + mouseListeners);
+
+        icon.removeMouseMotionListener(mml1);
+        icon.removeMouseMotionListener(mml2);
+        mouseMotionListeners = icon.getMouseMotionListeners();
+        if (mouseMotionListeners == null || mouseMotionListeners.length != 0)
+            throw new RuntimeException("FAIL: removeMouseMotionListener did not " +
+                    "remove the MouseMotionListeners added " + mouseMotionListeners);
+
+        try {
+            icon.setImage(null);
+            throw new RuntimeException("FAIL: setImage(null) did not throw NullPointerException");
+        } catch (NullPointerException npe) {
+        }
+    }
+
+    boolean isPresent(Object[] array, Object obj) {
+        if (array == null || array.length == 0 || obj == null) {
+            return false;
+        }
+        for (int i = 0; i < array.length; i++) {
+            if (obj.equals(array[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java b/jdk/test/java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java
new file mode 100644
index 00000000000..124ceba5399
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check if ActionEvent is triggered by a TrayIcon only when
+ *          it is double clicked using mouse button 1 (or single clicked
+ *          with button 3 (on Mac OS X))
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main TrayIconMouseTest
+ */
+
+public class TrayIconMouseTest {
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+
+    boolean actionPerformed = false;
+    Object actionLock = new Object();
+    static boolean isMacOS = false;
+
+    String caption = "Sample Icon";
+
+    int[] buttonTypes = {
+        InputEvent.BUTTON1_MASK,
+        InputEvent.BUTTON2_MASK,
+        InputEvent.BUTTON3_MASK
+    };
+
+    String[] buttonNames = {
+        "BUTTON1",
+        "BUTTON2",
+        "BUTTON3"
+    };
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("mac")) {
+                isMacOS = true;
+            }
+            new TrayIconMouseTest().doTest();
+        }
+    }
+
+    TrayIconMouseTest() throws Exception{
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait(this::initializeGUI);
+    }
+
+    void initializeGUI() {
+
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
+        icon.addActionListener(event -> {
+            actionPerformed = true;
+            synchronized (actionLock) {
+                try {
+                    actionLock.notifyAll();
+                } catch (Exception e) {
+                }
+            }
+        });
+        try {
+            tray.add(icon);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void doTest() throws Exception {
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+
+        for (int i = 0; i < buttonTypes.length; i++) {
+            actionPerformed = false;
+            robot.click(buttonTypes[i]);
+            robot.waitForIdle(2000);
+
+            if (isMacOS && actionPerformed && i == 2) {
+
+            }else if (isMacOS && i == 2) {
+                throw new RuntimeException("FAIL: ActionEvent NOT triggered when " +
+                        buttonNames[i] + " is single clicked on Mac OS");
+            }else if (actionPerformed) {
+                throw new RuntimeException("FAIL: ActionEvent triggered when " +
+                        buttonNames[i] + " is single clicked");
+            }
+        }
+
+        if(!isMacOS) {
+            for (int i = 0; i < buttonTypes.length; i++) {
+                for (int j = 0; j < buttonTypes.length; j++) {
+                    if (j != i) {
+                        actionPerformed = false;
+                        robot.mousePress(buttonTypes[i]);
+                        robot.mousePress(buttonTypes[j]);
+                        robot.mouseRelease(buttonTypes[j]);
+                        robot.mouseRelease(buttonTypes[i]);
+
+                        robot.waitForIdle();
+
+                        if (actionPerformed)
+                            throw new RuntimeException("FAIL: ActionEvent triggered when " +
+                                    buttonNames[i] + " and " + buttonNames[j] +
+                                    " is clicked and released");
+                    }
+                }
+            }
+
+            for (int i = 0; i < buttonTypes.length; i++) {
+                actionPerformed = false;
+                robot.mousePress(buttonTypes[i]);
+                robot.delay(50);
+                robot.mouseRelease(buttonTypes[i]);
+                robot.delay(50);
+                robot.mousePress(buttonTypes[i]);
+                robot.delay(50);
+                robot.mouseRelease(buttonTypes[i]);
+
+                if (i == 0) {
+                    if (! actionPerformed) {
+                        synchronized (actionLock) {
+                            try {
+                                actionLock.wait(3000);
+                            } catch (Exception e) {
+                            }
+                        }
+                    }
+                    if (! actionPerformed)
+                        throw new RuntimeException("FAIL: ActionEvent not triggered when " +
+                                buttonNames[i] + " is double clicked");
+                } else {
+                    robot.waitForIdle();
+
+                    if (actionPerformed)
+                        throw new RuntimeException("FAIL: ActionEvent triggered when " +
+                                buttonNames[i] + " is double clicked");
+                }
+            }
+        }
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java b/jdk/test/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java
new file mode 100644
index 00000000000..3aa48750d97
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check if a JPopupMenu can be displayed when TrayIcon is
+ *          right clicked. It uses a JWindow as the parent of the JPopupMenu
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary ../
+ * @build ExtendedRobot SystemTrayIconHelper
+ * @run main TrayIconPopupTest
+ */
+
+public class TrayIconPopupTest {
+
+    TrayIcon icon;
+    ExtendedRobot robot;
+
+    boolean actionPerformed = false;
+    Object actionLock = new Object();
+    static final int ATTEMPTS = 50;
+
+    PopupMenu popup;
+    Dialog window;
+
+    public static void main(String[] args) throws Exception {
+        if (!SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            if (System.getProperty("os.name").toLowerCase().startsWith("win"))
+                System.err.println("Test can fail if the icon hides to a tray icons pool " +
+                        "in Windows 7, which is behavior by default.\n" +
+                        "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
+                        "\"Always show all icons and notifications on the taskbar\" true " +
+                        "to avoid this problem. Or change behavior only for Java SE " +
+                        "tray icon.");
+            new TrayIconPopupTest().doTest();
+        }
+    }
+
+    TrayIconPopupTest() throws Exception {
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait(this::initializeGUI);
+        robot.waitForIdle(1000);
+        EventQueue.invokeAndWait( () ->  window.setLocation(100, 100));
+        robot.waitForIdle(1000);
+    }
+
+    private void initializeGUI() {
+        window = new Dialog((Frame) null);
+        window.setSize(5, 5);
+        window.setVisible(true);
+
+        popup = new PopupMenu("");
+
+        MenuItem item = new MenuItem("Sample");
+        item.addActionListener(event -> {
+            actionPerformed = true;
+
+            synchronized (actionLock) {
+                try {
+                    actionLock.notifyAll();
+                } catch (Exception e) {
+                }
+            }
+        });
+        popup.add(item);
+        popup.add(new MenuItem("Item2"));
+        popup.add(new MenuItem("Item3"));
+
+        window.add(popup);
+
+        SystemTray tray = SystemTray.getSystemTray();
+        icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon");
+        icon.addMouseListener(new MouseAdapter() {
+            public void mousePressed(MouseEvent event) {
+                if (event.isPopupTrigger()) {
+                    popup.show(window, 0, 0);
+                }
+            }
+
+            public void mouseReleased(MouseEvent event) {
+                if (event.isPopupTrigger()) {
+                    popup.show(window, 0, 0);
+                }
+            }
+        });
+        try {
+            tray.add(icon);
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    void doTest() throws Exception {
+
+        Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
+        if (iconPosition == null)
+            throw new RuntimeException("Unable to find the icon location!");
+
+        robot.mouseMove(iconPosition.x, iconPosition.y);
+        robot.waitForIdle();
+        robot.mousePress(InputEvent.BUTTON3_MASK);
+        robot.delay(50);
+        robot.mouseRelease(InputEvent.BUTTON3_MASK);
+        robot.delay(1000);
+
+        robot.mouseMove(window.getLocation().x + 10, window.getLocation().y + 10);
+        robot.mousePress(InputEvent.BUTTON3_MASK);
+        robot.delay(50);
+        robot.mouseRelease(InputEvent.BUTTON3_MASK);
+
+        int attempts = 0;
+        while (!actionPerformed && attempts++ < ATTEMPTS) {
+            synchronized (actionLock) {
+                try {
+                    actionLock.wait(3000);
+                } catch (Exception e) {
+                }
+            }
+        }
+        if (!actionPerformed)
+            throw new RuntimeException("FAIL: ActionEvent not triggered when " +
+                    "JPopupMenu shown and menu item selected using keyboard");
+
+    }
+}
\ No newline at end of file
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconRemoveTest/TrayIconRemoveTest.java b/jdk/test/java/awt/TrayIcon/TrayIconRemoveTest/TrayIconRemoveTest.java
new file mode 100644
index 00000000000..330cc4a9eec
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconRemoveTest/TrayIconRemoveTest.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Test the remove method of the TrayIcon
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main TrayIconRemoveTest
+ */
+
+public class TrayIconRemoveTest {
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                               "Marking the test passed");
+        } else {
+            new TrayIconRemoveTest().doTest();
+        }
+    }
+
+    private void doTest() throws Exception {
+        Image image = new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB);
+        SystemTray tray = SystemTray.getSystemTray();
+        tray.remove(null);
+
+        TrayIcon icon1 = new TrayIcon(image);
+        tray.add(icon1);
+
+        tray.remove(icon1);
+
+        TrayIcon[] icons = tray.getTrayIcons();
+        if (icons.length != 0)
+            throw new RuntimeException("FAIL: There are icons still present even after " +
+                    "removing the added icon" + "\n"+
+                    "No. of icons present: " + icons.length);
+
+        TrayIcon icon2 = new TrayIcon(image);
+        tray.remove(icon2);
+
+        TrayIcon icon3 = new TrayIcon(image);
+        tray.add(icon3);
+
+        TrayIcon newIcon = new TrayIcon(image);
+        tray.remove(newIcon);
+
+        tray.remove(null);
+    }
+}
diff --git a/jdk/test/java/awt/TrayIcon/TrayIconSizeTest/TrayIconSizeTest.java b/jdk/test/java/awt/TrayIcon/TrayIconSizeTest/TrayIconSizeTest.java
new file mode 100644
index 00000000000..eb769c459d8
--- /dev/null
+++ b/jdk/test/java/awt/TrayIcon/TrayIconSizeTest/TrayIconSizeTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+
+/*
+ * @test
+ * @summary Test the methods TrayIcon.getSize and SystemTray.getTrayIconSize.
+ *          There is no way to check whether the values returned are correct,
+ *          so its checked whether the value is greater than a minimum
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @run main TrayIconSizeTest
+ */
+
+public class TrayIconSizeTest {
+
+    public static void main(String[] args) throws Exception {
+        if (! SystemTray.isSupported()) {
+            System.out.println("SystemTray not supported on the platform under test. " +
+                    "Marking the test passed");
+        } else {
+            new TrayIconSizeTest().doTest();
+        }
+    }
+
+    void doTest() throws Exception {
+
+        SystemTray tray = SystemTray.getSystemTray();
+        Dimension dim = tray.getTrayIconSize();
+
+        if (dim.width <= 5 || dim.height <= 5)
+            throw new RuntimeException("FAIL: value returned by getTrayIconSize is not correct: " + dim);
+
+        TrayIcon icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB));
+
+        if (! icon.getSize().equals(dim))
+            throw new RuntimeException("FAIL: TrayIcon.getSize did not return the same value as " +
+                    "getTrayIconSize when TrayIcon not added" + "\n" +
+                    "SystemTray.getTrayIconSize(): " + dim + "\n" +
+                    "TrayIcon.getSize(): " + icon.getSize());
+
+        tray.add(icon);
+
+        if (icon.getSize().width <= 5 || icon.getSize().height <= 5)
+            throw new RuntimeException("FAIL: value returned by TrayIcon.getSize is not correct: " + icon.getSize());
+    }
+}
-- 
GitLab


From 48b2a7c0c73db372164e6a4f507bfdda7852ab21 Mon Sep 17 00:00:00 2001
From: Alexey Ivanov <aivanov@openjdk.org>
Date: Mon, 9 Jun 2014 18:10:49 +0400
Subject: [PATCH 059/192] 8046239: Build failure in 9-client on all non-Windows
 platforms

Reviewed-by: anthony, serb, alexp
---
 .../classes/com/sun/java/swing/plaf/windows/XPStyle.java      | 3 +--
 jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java      | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
index 7765145eff1..baeca8c29ca 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
@@ -52,7 +52,6 @@ import javax.swing.text.JTextComponent;
 
 import sun.awt.image.SunWritableRaster;
 import sun.awt.windows.ThemeReader;
-import sun.awt.windows.WToolkit;
 import sun.security.action.GetPropertyAction;
 import sun.swing.CachedPainter;
 
@@ -100,7 +99,7 @@ class XPStyle {
         if (themeActive == null) {
             Toolkit toolkit = Toolkit.getDefaultToolkit();
             themeActive =
-                (Boolean)toolkit.getDesktopProperty(WToolkit.XPSTYLE_THEME_ACTIVE);
+                (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
             if (themeActive == null) {
                 themeActive = Boolean.FALSE;
             }
diff --git a/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java b/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java
index 7445cc2f5ff..5bd2f7ec0b8 100644
--- a/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java
+++ b/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java
@@ -45,6 +45,10 @@ public final class ThemeReader {
         return false;
     }
 
+    public static boolean isXPStyleEnabled() {
+        return false;
+    }
+
     public static void paintBackground(int[] buffer, String widget,
            int part, int state, int x, int y, int w, int h, int stride) {
     }
-- 
GitLab


From e89442e619c71598c72fa1f6328d04710c001377 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Mon, 9 Jun 2014 20:23:26 +0400
Subject: [PATCH 060/192] 8039901:
 jdk/src/share/classes/com/sun/media/sound/services/<platform> appear not to
 be used

Reviewed-by: amenkov, azvegint
---
 .../linux-i586/javax.sound.sampled.spi.MixerProvider        | 6 ------
 .../windows-i586/javax.sound.sampled.spi.MixerProvider      | 6 ------
 .../windows-ia64/javax.sound.sampled.spi.MixerProvider      | 6 ------
 3 files changed, 18 deletions(-)
 delete mode 100644 jdk/src/share/classes/com/sun/media/sound/services/linux-i586/javax.sound.sampled.spi.MixerProvider
 delete mode 100644 jdk/src/share/classes/com/sun/media/sound/services/windows-i586/javax.sound.sampled.spi.MixerProvider
 delete mode 100644 jdk/src/share/classes/com/sun/media/sound/services/windows-ia64/javax.sound.sampled.spi.MixerProvider

diff --git a/jdk/src/share/classes/com/sun/media/sound/services/linux-i586/javax.sound.sampled.spi.MixerProvider b/jdk/src/share/classes/com/sun/media/sound/services/linux-i586/javax.sound.sampled.spi.MixerProvider
deleted file mode 100644
index 56b8f12b0fb..00000000000
--- a/jdk/src/share/classes/com/sun/media/sound/services/linux-i586/javax.sound.sampled.spi.MixerProvider
+++ /dev/null
@@ -1,6 +0,0 @@
-# service provider file for Linux: with DirectAudioDeviceProvider
-# last mixer is default mixer
-com.sun.media.sound.PortMixerProvider
-com.sun.media.sound.SimpleInputDeviceProvider
-com.sun.media.sound.DirectAudioDeviceProvider
-com.sun.media.sound.HeadspaceMixerProvider
diff --git a/jdk/src/share/classes/com/sun/media/sound/services/windows-i586/javax.sound.sampled.spi.MixerProvider b/jdk/src/share/classes/com/sun/media/sound/services/windows-i586/javax.sound.sampled.spi.MixerProvider
deleted file mode 100644
index 7e39afe741a..00000000000
--- a/jdk/src/share/classes/com/sun/media/sound/services/windows-i586/javax.sound.sampled.spi.MixerProvider
+++ /dev/null
@@ -1,6 +0,0 @@
-# service provider file for Windows: with DirectAudioDeviceProvider
-# last mixer is default mixer
-com.sun.media.sound.PortMixerProvider
-com.sun.media.sound.SimpleInputDeviceProvider
-com.sun.media.sound.DirectAudioDeviceProvider
-com.sun.media.sound.HeadspaceMixerProvider
diff --git a/jdk/src/share/classes/com/sun/media/sound/services/windows-ia64/javax.sound.sampled.spi.MixerProvider b/jdk/src/share/classes/com/sun/media/sound/services/windows-ia64/javax.sound.sampled.spi.MixerProvider
deleted file mode 100644
index cf3bc8acaa6..00000000000
--- a/jdk/src/share/classes/com/sun/media/sound/services/windows-ia64/javax.sound.sampled.spi.MixerProvider
+++ /dev/null
@@ -1,6 +0,0 @@
-# service provider file for Windows IA64: with DirectAudioDeviceProvider
-# last mixer is default mixer
-com.sun.media.sound.PortMixerProvider
-com.sun.media.sound.SimpleInputDeviceProvider
-com.sun.media.sound.DirectAudioDeviceProvider
-com.sun.media.sound.HeadspaceMixerProvider
-- 
GitLab


From c6065994826726461eeca3a66c9c404f236d6b1c Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Mon, 9 Jun 2014 11:47:18 -0700
Subject: [PATCH 061/192] 8042870: Fix raw and unchecked warnings in sun.print

Reviewed-by: prr
---
 .../sun/print/CustomMediaSizeName.java        |  8 +-
 .../classes/sun/print/CustomMediaTray.java    | 10 +--
 .../share/classes/sun/print/DialogOwner.java  |  3 +-
 .../share/classes/sun/print/PSPrinterJob.java | 34 ++++----
 .../classes/sun/print/PSStreamPrintJob.java   | 16 ++--
 .../sun/print/PSStreamPrintService.java       | 12 +--
 .../share/classes/sun/print/PrintJob2D.java   |  4 +-
 .../sun/print/PrintJobAttributeException.java |  8 +-
 .../classes/sun/print/PrinterJobWrapper.java  |  3 +-
 .../classes/sun/print/RasterPrinterJob.java   | 34 ++++----
 .../classes/sun/print/ServiceDialog.java      | 85 +++++++++----------
 .../classes/sun/print/ServiceNotifier.java    |  9 +-
 .../classes/sun/print/SunAlternateMedia.java  |  3 +-
 .../classes/sun/print/SunMinMaxPage.java      |  3 +-
 .../classes/sun/print/SunPageSelection.java   |  3 +-
 .../sun/print/SunPrinterJobService.java       |  2 +-
 .../classes/sun/print/CUPSPrinter.java        | 30 +++----
 .../classes/sun/print/IPPPrintService.java    | 84 +++++++++---------
 .../classes/sun/print/UnixPrintJob.java       | 22 ++---
 .../classes/sun/print/UnixPrintService.java   | 17 ++--
 .../sun/print/UnixPrintServiceLookup.java     | 44 +++++-----
 .../classes/sun/print/Win32MediaTray.java     | 12 +--
 .../classes/sun/print/Win32PrintJob.java      | 16 ++--
 .../classes/sun/print/Win32PrintService.java  | 65 +++++++-------
 .../sun/print/Win32PrintServiceLookup.java    |  5 +-
 25 files changed, 264 insertions(+), 268 deletions(-)

diff --git a/jdk/src/share/classes/sun/print/CustomMediaSizeName.java b/jdk/src/share/classes/sun/print/CustomMediaSizeName.java
index e1df990730c..2390495a703 100644
--- a/jdk/src/share/classes/sun/print/CustomMediaSizeName.java
+++ b/jdk/src/share/classes/sun/print/CustomMediaSizeName.java
@@ -33,8 +33,8 @@ import javax.print.attribute.standard.MediaSizeName;
 import java.util.ArrayList;
 
 class CustomMediaSizeName extends MediaSizeName {
-    private static ArrayList customStringTable = new ArrayList();
-    private static ArrayList customEnumTable = new ArrayList();
+    private static ArrayList<String> customStringTable = new ArrayList<>();
+    private static ArrayList<MediaSizeName> customEnumTable = new ArrayList<>();
     private String choiceName;
     private MediaSizeName mediaName;
 
@@ -162,7 +162,7 @@ class CustomMediaSizeName extends MediaSizeName {
      */
     protected String[] getStringTable() {
       String[] nameTable = new String[customStringTable.size()];
-      return (String[])customStringTable.toArray(nameTable);
+      return customStringTable.toArray(nameTable);
     }
 
     /**
@@ -170,7 +170,7 @@ class CustomMediaSizeName extends MediaSizeName {
      */
     protected EnumSyntax[] getEnumValueTable() {
       MediaSizeName[] enumTable = new MediaSizeName[customEnumTable.size()];
-      return (MediaSizeName[])customEnumTable.toArray(enumTable);
+      return customEnumTable.toArray(enumTable);
     }
 
 }
diff --git a/jdk/src/share/classes/sun/print/CustomMediaTray.java b/jdk/src/share/classes/sun/print/CustomMediaTray.java
index d74c806676f..7607cd8d118 100644
--- a/jdk/src/share/classes/sun/print/CustomMediaTray.java
+++ b/jdk/src/share/classes/sun/print/CustomMediaTray.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -31,8 +31,8 @@ import javax.print.attribute.standard.Media;
 import java.util.ArrayList;
 
 class CustomMediaTray extends MediaTray {
-    private static ArrayList customStringTable = new ArrayList();
-    private static ArrayList customEnumTable = new ArrayList();
+    private static ArrayList<String> customStringTable = new ArrayList<>();
+    private static ArrayList<MediaTray> customEnumTable = new ArrayList<>();
     private String choiceName;
 
     private CustomMediaTray(int x) {
@@ -79,7 +79,7 @@ class CustomMediaTray extends MediaTray {
      */
     protected String[] getStringTable() {
       String[] nameTable = new String[customStringTable.size()];
-      return (String[])customStringTable.toArray(nameTable);
+      return customStringTable.toArray(nameTable);
     }
 
     /**
@@ -87,7 +87,7 @@ class CustomMediaTray extends MediaTray {
      */
     protected EnumSyntax[] getEnumValueTable() {
       MediaTray[] enumTable = new MediaTray[customEnumTable.size()];
-      return (MediaTray[])customEnumTable.toArray(enumTable);
+      return customEnumTable.toArray(enumTable);
     }
 
 }
diff --git a/jdk/src/share/classes/sun/print/DialogOwner.java b/jdk/src/share/classes/sun/print/DialogOwner.java
index 2551ed694a3..4704e0772c3 100644
--- a/jdk/src/share/classes/sun/print/DialogOwner.java
+++ b/jdk/src/share/classes/sun/print/DialogOwner.java
@@ -25,6 +25,7 @@
 
 package sun.print;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintRequestAttribute;
 import java.awt.Frame;
 
@@ -72,7 +73,7 @@ public final class DialogOwner
      * @return  Printing attribute class (category), an instance of class
      *          {@link java.lang.Class java.lang.Class}.
      */
-    public final Class getCategory() {
+    public final Class<? extends Attribute> getCategory() {
         return DialogOwner.class;
     }
 
diff --git a/jdk/src/share/classes/sun/print/PSPrinterJob.java b/jdk/src/share/classes/sun/print/PSPrinterJob.java
index 325bfd8e718..09ae122d014 100644
--- a/jdk/src/share/classes/sun/print/PSPrinterJob.java
+++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java
@@ -310,7 +310,7 @@ public class PSPrinterJob extends RasterPrinterJob {
    /**
     * A stack that represents the PostScript gstate stack.
     */
-   ArrayList mGStateStack = new ArrayList();
+   ArrayList<GState> mGStateStack = new ArrayList<>();
 
    /**
     * The x coordinate of the current pen position.
@@ -346,7 +346,7 @@ public class PSPrinterJob extends RasterPrinterJob {
        //enable priviledges so initProps can access system properties,
         // open the property file, etc.
         java.security.AccessController.doPrivileged(
-                            new java.security.PrivilegedAction() {
+                            new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 mFontProps = initProps();
                 String osName = System.getProperty("os.name");
@@ -622,11 +622,11 @@ public class PSPrinterJob extends RasterPrinterJob {
                                            paperWidth + " "+ paperHeight+"]");
 
             final PrintService pservice = getPrintService();
-            Boolean isPS = (Boolean)java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
+            Boolean isPS = java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedAction<Boolean>() {
+                    public Boolean run() {
                        try {
-                           Class psClass = Class.forName("sun.print.IPPPrintService");
+                           Class<?> psClass = Class.forName("sun.print.IPPPrintService");
                            if (psClass.isInstance(pservice)) {
                                Method isPSMethod = psClass.getMethod("isPostscript",
                                                                      (Class[])null);
@@ -660,11 +660,11 @@ public class PSPrinterJob extends RasterPrinterJob {
 
     // Inner class to run "privileged" to open the printer output stream.
 
-    private class PrinterOpener implements java.security.PrivilegedAction {
+    private class PrinterOpener implements java.security.PrivilegedAction<OutputStream> {
         PrinterException pex;
         OutputStream result;
 
-        public Object run() {
+        public OutputStream run() {
             try {
 
                     /* Write to a temporary file which will be spooled to
@@ -687,7 +687,7 @@ public class PSPrinterJob extends RasterPrinterJob {
 
     // Inner class to run "privileged" to invoke the system print command
 
-    private class PrinterSpooler implements java.security.PrivilegedAction {
+    private class PrinterSpooler implements java.security.PrivilegedAction<Object> {
         PrinterException pex;
 
         private void handleProcessFailure(final Process failedProcess,
@@ -753,7 +753,7 @@ public class PSPrinterJob extends RasterPrinterJob {
             mPSStream.close();
         }
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
 
             public Object run() {
                if (spoolFile != null && spoolFile.exists()) {
@@ -812,7 +812,7 @@ public class PSPrinterJob extends RasterPrinterJob {
          * It will have the default PostScript gstate
          * attributes.
          */
-        mGStateStack = new ArrayList();
+        mGStateStack = new ArrayList<>();
         mGStateStack.add(new GState());
 
         mPSStream.println(PAGE_COMMENT + pageNumber + " " + pageNumber);
@@ -825,13 +825,11 @@ public class PSPrinterJob extends RasterPrinterJob {
                             paperWidth + " " + paperHeight + "]");
 
             final PrintService pservice = getPrintService();
-            Boolean isPS =
-                (Boolean)java.security.AccessController.doPrivileged(
-
-                new java.security.PrivilegedAction() {
-                    public Object run() {
+            Boolean isPS = java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedAction<Boolean>() {
+                    public Boolean run() {
                         try {
-                            Class psClass =
+                            Class<?> psClass =
                                 Class.forName("sun.print.IPPPrintService");
                             if (psClass.isInstance(pservice)) {
                                 Method isPSMethod =
@@ -1720,7 +1718,7 @@ public class PSPrinterJob extends RasterPrinterJob {
      */
     private GState getGState() {
         int count = mGStateStack.size();
-        return (GState) mGStateStack.get(count - 1);
+        return mGStateStack.get(count - 1);
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/print/PSStreamPrintJob.java b/jdk/src/share/classes/sun/print/PSStreamPrintJob.java
index 7d1712d6f90..63118aa4841 100644
--- a/jdk/src/share/classes/sun/print/PSStreamPrintJob.java
+++ b/jdk/src/share/classes/sun/print/PSStreamPrintJob.java
@@ -66,9 +66,9 @@ import java.awt.print.*;
 
 public class PSStreamPrintJob implements CancelablePrintJob {
 
-    transient private Vector jobListeners;
-    transient private Vector attrListeners;
-    transient private Vector listenedAttributeSets;
+    transient private Vector<PrintJobListener> jobListeners;
+    transient private Vector<PrintJobAttributeListener> attrListeners;
+    transient private Vector<PrintJobAttributeSet> listenedAttributeSets;
 
     private PSStreamPrintService service;
     private boolean fidelity;
@@ -117,7 +117,7 @@ public class PSStreamPrintJob implements CancelablePrintJob {
                 return;
             }
             if (jobListeners == null) {
-                jobListeners = new Vector();
+                jobListeners = new Vector<>();
             }
             jobListeners.add(listener);
         }
@@ -191,7 +191,7 @@ public class PSStreamPrintJob implements CancelablePrintJob {
                 PrintJobListener listener;
                 PrintJobEvent event = new PrintJobEvent(this, reason);
                 for (int i = 0; i < jobListeners.size(); i++) {
-                    listener = (PrintJobListener)(jobListeners.elementAt(i));
+                    listener = jobListeners.elementAt(i);
                     switch (reason) {
 
                         case PrintJobEvent.JOB_CANCELED :
@@ -230,8 +230,8 @@ public class PSStreamPrintJob implements CancelablePrintJob {
                 return;
             }
             if (attrListeners == null) {
-                attrListeners = new Vector();
-                listenedAttributeSets = new Vector();
+                attrListeners = new Vector<>();
+                listenedAttributeSets = new Vector<>();
             }
             attrListeners.add(listener);
             if (attributes == null) {
@@ -494,7 +494,7 @@ public class PSStreamPrintJob implements CancelablePrintJob {
     private void getAttributeValues(DocFlavor flavor) throws PrintException {
 
         Attribute attr;
-        Class category;
+        Class<? extends Attribute> category;
 
         if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
             fidelity = true;
diff --git a/jdk/src/share/classes/sun/print/PSStreamPrintService.java b/jdk/src/share/classes/sun/print/PSStreamPrintService.java
index 92d27a026c1..3bfb7577e8e 100644
--- a/jdk/src/share/classes/sun/print/PSStreamPrintService.java
+++ b/jdk/src/share/classes/sun/print/PSStreamPrintService.java
@@ -62,7 +62,7 @@ import javax.print.attribute.standard.Sides;
 public class PSStreamPrintService extends StreamPrintService
     implements SunPrinterJobService {
 
-    private static final Class[] suppAttrCats = {
+    private static final Class<?>[] suppAttrCats = {
         Chromaticity.class,
         Copies.class,
         Fidelity.class,
@@ -108,7 +108,7 @@ public class PSStreamPrintService extends StreamPrintService
         return new PSStreamPrintJob(this);
     }
 
-    public boolean usesClass(Class c) {
+    public boolean usesClass(Class<?> c) {
         return (c == sun.print.PSPrinterJob.class);
     }
 
@@ -137,7 +137,9 @@ public class PSStreamPrintService extends StreamPrintService
             throw new IllegalArgumentException("Not a PrintServiceAttribute");
         }
         if (category == ColorSupported.class) {
-            return (T)ColorSupported.SUPPORTED;
+            @SuppressWarnings("unchecked")
+            T tmp = (T)ColorSupported.SUPPORTED;
+            return tmp;
         } else {
             return null;
         }
@@ -161,7 +163,7 @@ public class PSStreamPrintService extends StreamPrintService
 
 
     public Class<?>[] getSupportedAttributeCategories() {
-        Class []cats = new Class[suppAttrCats.length];
+        Class<?>[] cats = new Class<?>[suppAttrCats.length];
         System.arraycopy(suppAttrCats, 0, cats, 0, cats.length);
         return cats;
     }
@@ -401,7 +403,7 @@ public class PSStreamPrintService extends StreamPrintService
             throw new IllegalArgumentException(flavor +
                                                " is an unsupported flavor");
         }
-        Class category = attr.getCategory();
+        Class<? extends Attribute> category = attr.getCategory();
         if (!isAttributeCategorySupported(category)) {
             return false;
         }
diff --git a/jdk/src/share/classes/sun/print/PrintJob2D.java b/jdk/src/share/classes/sun/print/PrintJob2D.java
index ef5446dcd54..22f21fc34cd 100644
--- a/jdk/src/share/classes/sun/print/PrintJob2D.java
+++ b/jdk/src/share/classes/sun/print/PrintJob2D.java
@@ -1011,7 +1011,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable {
 
         private String qid="noname";
 
-        private ArrayList queue = new ArrayList();
+        private ArrayList<Graphics2D> queue = new ArrayList<>();
 
         MessageQ(String id) {
           qid = id;
@@ -1055,7 +1055,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable {
             while (g == null && queue != null) {
 
                 if (queue.size() > 0) {
-                    g = (Graphics2D) queue.remove(0);
+                    g = queue.remove(0);
                     notify();
 
                 } else {
diff --git a/jdk/src/share/classes/sun/print/PrintJobAttributeException.java b/jdk/src/share/classes/sun/print/PrintJobAttributeException.java
index 8919a1af1b8..d97be663517 100644
--- a/jdk/src/share/classes/sun/print/PrintJobAttributeException.java
+++ b/jdk/src/share/classes/sun/print/PrintJobAttributeException.java
@@ -34,19 +34,19 @@ class PrintJobAttributeException extends PrintException
     implements AttributeException {
 
     private Attribute attr;
-    private Class category;
+    private Class<?> category;
 
-    PrintJobAttributeException(String s, Class cat, Attribute attrval) {
+    PrintJobAttributeException(String s, Class<?> cat, Attribute attrval) {
         super(s);
         attr = attrval;
         category = cat;
     }
 
-    public Class[] getUnsupportedAttributes() {
+    public Class<?>[] getUnsupportedAttributes() {
         if (category == null) {
             return null;
         } else {
-            Class [] cats = { category};
+            Class<?>[] cats = { category};
             return cats;
         }
     }
diff --git a/jdk/src/share/classes/sun/print/PrinterJobWrapper.java b/jdk/src/share/classes/sun/print/PrinterJobWrapper.java
index 343da0baa77..69207bf2a23 100644
--- a/jdk/src/share/classes/sun/print/PrinterJobWrapper.java
+++ b/jdk/src/share/classes/sun/print/PrinterJobWrapper.java
@@ -26,6 +26,7 @@
 package sun.print;
 
 import java.awt.print.PrinterJob;
+import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintRequestAttribute;
 
 public class PrinterJobWrapper implements PrintRequestAttribute {
@@ -42,7 +43,7 @@ public class PrinterJobWrapper implements PrintRequestAttribute {
         return job;
     }
 
-    public final Class getCategory() {
+    public final Class<? extends Attribute> getCategory() {
         return PrinterJobWrapper.class;
     }
 
diff --git a/jdk/src/share/classes/sun/print/RasterPrinterJob.java b/jdk/src/share/classes/sun/print/RasterPrinterJob.java
index dae42e789d9..f80970af362 100644
--- a/jdk/src/share/classes/sun/print/RasterPrinterJob.java
+++ b/jdk/src/share/classes/sun/print/RasterPrinterJob.java
@@ -273,7 +273,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
     /**
      * List of areas & the graphics state for redrawing
      */
-    private ArrayList redrawList = new ArrayList();
+    private ArrayList<GraphicsState> redrawList = new ArrayList<>();
 
 
     /* variables representing values extracted from an attribute set.
@@ -712,10 +712,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
           GraphicsEnvironment.getLocalGraphicsEnvironment().
           getDefaultScreenDevice().getDefaultConfiguration();
 
-        PrintService service =
-            (PrintService)java.security.AccessController.doPrivileged(
-                                        new java.security.PrivilegedAction() {
-                public Object run() {
+        PrintService service = java.security.AccessController.doPrivileged(
+                               new java.security.PrivilegedAction<PrintService>() {
+                public PrintService run() {
                     PrintService service = getPrintService();
                     if (service == null) {
                         ServiceDialog.showNoPrintService(gc);
@@ -768,10 +767,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
         int x = bounds.x+bounds.width/3;
         int y = bounds.y+bounds.height/3;
 
-        PrintService service =
-            (PrintService)java.security.AccessController.doPrivileged(
-                                        new java.security.PrivilegedAction() {
-                public Object run() {
+        PrintService service = java.security.AccessController.doPrivileged(
+                               new java.security.PrivilegedAction<PrintService>() {
+                public PrintService run() {
                     PrintService service = getPrintService();
                     if (service == null) {
                         ServiceDialog.showNoPrintService(gc);
@@ -793,7 +791,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
         if (pageDialog.getStatus() == ServiceDialog.APPROVE) {
             PrintRequestAttributeSet newas =
                 pageDialog.getAttributes();
-            Class amCategory = SunAlternateMedia.class;
+            Class<?> amCategory = SunAlternateMedia.class;
 
             if (attributes.containsKey(amCategory) &&
                 !newas.containsKey(amCategory)) {
@@ -868,10 +866,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
             GraphicsEnvironment.getLocalGraphicsEnvironment().
             getDefaultScreenDevice().getDefaultConfiguration();
 
-        PrintService service =
-            (PrintService)java.security.AccessController.doPrivileged(
-                       new java.security.PrivilegedAction() {
-                public Object run() {
+        PrintService service = java.security.AccessController.doPrivileged(
+                               new java.security.PrivilegedAction<PrintService>() {
+                public PrintService run() {
                     PrintService service = getPrintService();
                     if (service == null) {
                         ServiceDialog.showNoPrintService(gc);
@@ -894,10 +891,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
                 services[i] = spsFactories[i].getPrintService(null);
             }
         } else {
-            services =
-            (PrintService[])java.security.AccessController.doPrivileged(
-                       new java.security.PrivilegedAction() {
-                public Object run() {
+            services = java.security.AccessController.doPrivileged(
+                       new java.security.PrivilegedAction<PrintService[]>() {
+                public PrintService[] run() {
                     PrintService[] services = PrinterJob.lookupPrintServices();
                     return services;
                 }
@@ -2131,7 +2127,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
                 painter.print(pathGraphics, origPage, pageIndex);
 
                 for (int i=0;i<redrawList.size();i++) {
-                   GraphicsState gstate = (GraphicsState)redrawList.get(i);
+                   GraphicsState gstate = redrawList.get(i);
                    pathGraphics.setTransform(initialTx);
                    ((PathGraphics)pathGraphics).redrawRegion(
                                                          gstate.region,
diff --git a/jdk/src/share/classes/sun/print/ServiceDialog.java b/jdk/src/share/classes/sun/print/ServiceDialog.java
index 70d1f93e434..155d1430acb 100644
--- a/jdk/src/share/classes/sun/print/ServiceDialog.java
+++ b/jdk/src/share/classes/sun/print/ServiceDialog.java
@@ -395,7 +395,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
      * for "Print To File"
      */
     private boolean showFileChooser() {
-        Class dstCategory = Destination.class;
+        Class<Destination> dstCategory = Destination.class;
 
         Destination dst = (Destination)asCurrent.get(dstCategory);
         if (dst == null) {
@@ -463,7 +463,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
      */
     public static void initResource() {
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     try {
                         messageRB = ResourceBundle.getBundle(strBundle);
@@ -529,7 +529,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
     /**
      * Returns the mnemonic as a KeyEvent.VK constant from the resource.
      */
-    static Class _keyEventClazz = null;
+    static Class<?> _keyEventClazz = null;
     private static int getVKMnemonic(String key) {
         String s = String.valueOf(getMnemonic(key));
         if ( s == null || s.length() != 1) {
@@ -554,9 +554,9 @@ public class ServiceDialog extends JDialog implements ActionListener {
      * Returns URL for image resource
      */
     private static URL getImageResource(final String key) {
-        URL url = (URL)java.security.AccessController.doPrivileged(
-                       new java.security.PrivilegedAction() {
-                public Object run() {
+        URL url = java.security.AccessController.doPrivileged(
+                       new java.security.PrivilegedAction<URL>() {
+                public URL run() {
                     URL url = ServiceDialog.class.getResource(
                                                   "resources/" + key);
                     return url;
@@ -710,7 +710,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         private FilePermission printToFilePermission;
         private JButton btnProperties;
         private JCheckBox cbPrintToFile;
-        private JComboBox cbName;
+        private JComboBox<String> cbName;
         private JLabel lblType, lblStatus, lblInfo;
         private ServiceUIFactory uiFactory;
         private boolean changedService = false;
@@ -731,7 +731,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
             for (int i = 0; i < psnames.length; i++) {
                 psnames[i] = services[i].getName();
             }
-            cbName = new JComboBox(psnames);
+            cbName = new JComboBox<>(psnames);
             cbName.setSelectedIndex(defaultServiceIndex);
             cbName.addItemListener(this);
             cbName.addPopupMenuListener(this);
@@ -924,7 +924,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         }
 
         public void updateInfo() {
-            Class dstCategory = Destination.class;
+            Class<Destination> dstCategory = Destination.class;
             boolean dstSupported = false;
             boolean dstSelected = false;
             boolean dstAllowed = filePermission ?
@@ -1123,7 +1123,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         }
 
         public void updateInfo() {
-            Class prCategory = PageRanges.class;
+            Class<PageRanges> prCategory = PageRanges.class;
             prSupported = false;
 
             if (psCurrent.isAttributeCategorySupported(prCategory) ||
@@ -1240,9 +1240,8 @@ public class ServiceDialog extends JDialog implements ActionListener {
         }
 
         public void updateInfo() {
-            Class cpCategory = Copies.class;
-            Class csCategory = CopiesSupported.class;
-            Class scCategory = SheetCollate.class;
+            Class<Copies> cpCategory = Copies.class;
+            Class<SheetCollate> scCategory = SheetCollate.class;
             boolean cpSupported = false;
             scSupported = false;
 
@@ -1525,7 +1524,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
             float bm = bmTmpObj.floatValue();
 
             /* adjust for orientation */
-            Class orCategory = OrientationRequested.class;
+            Class<OrientationRequested> orCategory = OrientationRequested.class;
             OrientationRequested or =
                 (OrientationRequested)asCurrent.get(orCategory);
 
@@ -1589,7 +1588,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         private MediaPrintableArea validateMargins(float lm, float rm,
                                                    float tm, float bm) {
 
-            Class mpaCategory = MediaPrintableArea.class;
+            Class<MediaPrintableArea> mpaCategory = MediaPrintableArea.class;
             MediaPrintableArea mpa;
             MediaPrintableArea mpaMax = null;
             MediaSize mediaSize = null;
@@ -1671,7 +1670,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
                 return;
             }
 
-            Class mpaCategory = MediaPrintableArea.class;
+            Class<MediaPrintableArea> mpaCategory = MediaPrintableArea.class;
             MediaPrintableArea mpa =
                  (MediaPrintableArea)asCurrent.get(mpaCategory);
             MediaPrintableArea mpaMax = null;
@@ -1845,7 +1844,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
              * to the fields appropriate for the orientation.
              * Note: if orientation changes this method must be called.
              */
-            Class orCategory = OrientationRequested.class;
+            Class<OrientationRequested> orCategory = OrientationRequested.class;
             OrientationRequested or =
                 (OrientationRequested)asCurrent.get(orCategory);
 
@@ -1885,9 +1884,9 @@ public class ServiceDialog extends JDialog implements ActionListener {
 
         private final String strTitle = getMsg("border.media");
         private JLabel lblSize, lblSource;
-        private JComboBox cbSize, cbSource;
-        private Vector sizes = new Vector();
-        private Vector sources = new Vector();
+        private JComboBox<Object> cbSize, cbSource;
+        private Vector<MediaSizeName> sizes = new Vector<>();
+        private Vector<MediaTray> sources = new Vector<>();
         private MarginsPanel pnlMargins = null;
 
         public MediaPanel() {
@@ -1899,8 +1898,8 @@ public class ServiceDialog extends JDialog implements ActionListener {
             setLayout(gridbag);
             setBorder(BorderFactory.createTitledBorder(strTitle));
 
-            cbSize = new JComboBox();
-            cbSource = new JComboBox();
+            cbSize = new JComboBox<>();
+            cbSource = new JComboBox<>();
 
             c.fill = GridBagConstraints.BOTH;
             c.insets = compInsets;
@@ -1950,17 +1949,17 @@ public class ServiceDialog extends JDialog implements ActionListener {
                             (cbSource.getSelectedIndex() >= 1))
                         {
                             int src = cbSource.getSelectedIndex() - 1;
-                            MediaTray mt = (MediaTray)sources.get(src);
+                            MediaTray mt = sources.get(src);
                             asCurrent.add(new SunAlternateMedia(mt));
                         }
-                        asCurrent.add((MediaSizeName)sizes.get(index));
+                        asCurrent.add(sizes.get(index));
                     }
                 } else if (source == cbSource) {
                     int index = cbSource.getSelectedIndex();
 
                     if ((index >= 1) && (index < (sources.size() + 1))) {
                        asCurrent.remove(SunAlternateMedia.class);
-                       MediaTray newTray = (MediaTray)sources.get(index - 1);
+                       MediaTray newTray = sources.get(index - 1);
                        Media m = (Media)asCurrent.get(Media.class);
                        if (m == null || m instanceof MediaTray) {
                            asCurrent.add(newTray);
@@ -1980,7 +1979,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
                         asCurrent.remove(SunAlternateMedia.class);
                         if (cbSize.getItemCount() > 0) {
                             int size = cbSize.getSelectedIndex();
-                            asCurrent.add((MediaSizeName)sizes.get(size));
+                            asCurrent.add(sizes.get(size));
                         }
                     }
                 }
@@ -1997,8 +1996,8 @@ public class ServiceDialog extends JDialog implements ActionListener {
             pnlMargins = pnl;
         }
         public void updateInfo() {
-            Class mdCategory = Media.class;
-            Class amCategory = SunAlternateMedia.class;
+            Class<Media> mdCategory = Media.class;
+            Class<SunAlternateMedia> amCategory = SunAlternateMedia.class;
             boolean mediaSupported = false;
 
             cbSize.removeItemListener(this);
@@ -2025,10 +2024,10 @@ public class ServiceDialog extends JDialog implements ActionListener {
                         Media medium = media[i];
 
                         if (medium instanceof MediaSizeName) {
-                            sizes.add(medium);
+                            sizes.add((MediaSizeName)medium);
                             cbSize.addItem(getMediaName(medium.toString()));
                         } else if (medium instanceof MediaTray) {
-                            sources.add(medium);
+                            sources.add((MediaTray)medium);
                             cbSource.addItem(getMediaName(medium.toString()));
                         }
                     }
@@ -2095,12 +2094,12 @@ public class ServiceDialog extends JDialog implements ActionListener {
 
                 int selIndex = cbSize.getSelectedIndex();
                 if ((selIndex >= 0) && (selIndex < sizes.size())) {
-                  asCurrent.add((MediaSizeName)sizes.get(selIndex));
+                  asCurrent.add(sizes.get(selIndex));
                 }
 
                 selIndex = cbSource.getSelectedIndex();
                 if ((selIndex >= 1) && (selIndex < (sources.size()+1))) {
-                    MediaTray mt = (MediaTray)sources.get(selIndex-1);
+                    MediaTray mt = sources.get(selIndex-1);
                     if (medium instanceof MediaTray) {
                         asCurrent.add(mt);
                     } else {
@@ -2185,7 +2184,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         }
 
         public void updateInfo() {
-            Class orCategory = OrientationRequested.class;
+            Class<OrientationRequested> orCategory = OrientationRequested.class;
             boolean pSupported = false;
             boolean lSupported = false;
             boolean rpSupported = false;
@@ -2363,7 +2362,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         }
 
         public void updateInfo() {
-            Class chCategory = Chromaticity.class;
+            Class<Chromaticity> chCategory = Chromaticity.class;
             boolean monoSupported = false;
             boolean colorSupported = false;
 
@@ -2458,7 +2457,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         }
 
         public void updateInfo() {
-            Class pqCategory = PrintQuality.class;
+            Class<PrintQuality> pqCategory = PrintQuality.class;
             boolean draftSupported = false;
             boolean normalSupported = false;
             boolean highSupported = false;
@@ -2568,7 +2567,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
         }
 
         public void updateInfo() {
-            Class sdCategory = Sides.class;
+            Class<Sides> sdCategory = Sides.class;
             boolean osSupported = false;
             boolean tSupported = false;
             boolean dSupported = false;
@@ -2725,10 +2724,10 @@ public class ServiceDialog extends JDialog implements ActionListener {
         public void focusGained(FocusEvent e) {}
 
         public void updateInfo() {
-            Class jsCategory = JobSheets.class;
-            Class jpCategory = JobPriority.class;
-            Class jnCategory = JobName.class;
-            Class unCategory = RequestingUserName.class;
+            Class<JobSheets>          jsCategory = JobSheets.class;
+            Class<JobPriority>        jpCategory = JobPriority.class;
+            Class<JobName>            jnCategory = JobName.class;
+            Class<RequestingUserName> unCategory = RequestingUserName.class;
             boolean jsSupported = false;
             boolean jpSupported = false;
             boolean jnSupported = false;
@@ -2817,9 +2816,9 @@ public class ServiceDialog extends JDialog implements ActionListener {
         {
             super(new FlowLayout(FlowLayout.LEADING));
             final URL imgURL = getImageResource(img);
-            Icon icon = (Icon)java.security.AccessController.doPrivileged(
-                                 new java.security.PrivilegedAction() {
-                public Object run() {
+            Icon icon = java.security.AccessController.doPrivileged(
+                                 new java.security.PrivilegedAction<Icon>() {
+                public Icon run() {
                     Icon icon = new ImageIcon(imgURL);
                     return icon;
                 }
diff --git a/jdk/src/share/classes/sun/print/ServiceNotifier.java b/jdk/src/share/classes/sun/print/ServiceNotifier.java
index 4fec7ee09e0..a6a6dbb6cdc 100644
--- a/jdk/src/share/classes/sun/print/ServiceNotifier.java
+++ b/jdk/src/share/classes/sun/print/ServiceNotifier.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -43,14 +43,14 @@ import javax.print.event.PrintServiceAttributeListener;
 class ServiceNotifier extends Thread {
 
     private PrintService service;
-    private Vector listeners;
+    private Vector<PrintServiceAttributeListener> listeners;
     private boolean stop = false;
     private PrintServiceAttributeSet lastSet;
 
     ServiceNotifier(PrintService service) {
         super(service.getName() + " notifier");
         this.service = service;
-        listeners = new Vector();
+        listeners = new Vector<>();
         try {
               setPriority(Thread.NORM_PRIORITY-1);
               setDaemon(true);
@@ -128,8 +128,7 @@ class ServiceNotifier extends Thread {
                     }
                     if (psa != null && !psa.isEmpty()) {
                         for (int i = 0; i < listeners.size() ; i++) {
-                            listener = (PrintServiceAttributeListener)
-                                listeners.elementAt(i);
+                            listener = listeners.elementAt(i);
                             attrs =
                                 new HashPrintServiceAttributeSet(psa);
                             attrEvent =
diff --git a/jdk/src/share/classes/sun/print/SunAlternateMedia.java b/jdk/src/share/classes/sun/print/SunAlternateMedia.java
index 868af737969..a71104e33aa 100644
--- a/jdk/src/share/classes/sun/print/SunAlternateMedia.java
+++ b/jdk/src/share/classes/sun/print/SunAlternateMedia.java
@@ -25,6 +25,7 @@
 
 package sun.print;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintRequestAttribute;
 import javax.print.attribute.standard.Media;
 
@@ -47,7 +48,7 @@ public class SunAlternateMedia implements PrintRequestAttribute {
         return media;
     }
 
-    public final Class getCategory() {
+    public final Class<? extends Attribute> getCategory() {
         return SunAlternateMedia.class;
     }
 
diff --git a/jdk/src/share/classes/sun/print/SunMinMaxPage.java b/jdk/src/share/classes/sun/print/SunMinMaxPage.java
index 9381d29128e..24feefd76b2 100644
--- a/jdk/src/share/classes/sun/print/SunMinMaxPage.java
+++ b/jdk/src/share/classes/sun/print/SunMinMaxPage.java
@@ -25,6 +25,7 @@
 
 package sun.print;
 
+import javax.print.attribute.PrintRequestAttribute;
 import javax.print.attribute.PrintRequestAttribute;
 
 /*
@@ -40,7 +41,7 @@ public final class SunMinMaxPage implements PrintRequestAttribute {
     }
 
 
-    public final Class getCategory() {
+    public final Class<? extends PrintRequestAttribute> getCategory() {
         return SunMinMaxPage.class;
     }
 
diff --git a/jdk/src/share/classes/sun/print/SunPageSelection.java b/jdk/src/share/classes/sun/print/SunPageSelection.java
index b54d7ba55d2..7cfd54d9535 100644
--- a/jdk/src/share/classes/sun/print/SunPageSelection.java
+++ b/jdk/src/share/classes/sun/print/SunPageSelection.java
@@ -25,6 +25,7 @@
 
 package sun.print;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintRequestAttribute;
 
 /*
@@ -43,7 +44,7 @@ public final class SunPageSelection implements PrintRequestAttribute {
         pages = value;
     }
 
-    public final Class getCategory() {
+    public final Class<? extends Attribute> getCategory() {
         return SunPageSelection.class;
     }
 
diff --git a/jdk/src/share/classes/sun/print/SunPrinterJobService.java b/jdk/src/share/classes/sun/print/SunPrinterJobService.java
index af3d5027d23..6f7927ddef5 100644
--- a/jdk/src/share/classes/sun/print/SunPrinterJobService.java
+++ b/jdk/src/share/classes/sun/print/SunPrinterJobService.java
@@ -37,6 +37,6 @@ public interface SunPrinterJobService {
      * platform's built-in subclass of PrinterJob.
      * ie the same class as the caller.
      */
-    public boolean usesClass(Class c);
+    public boolean usesClass(Class<?> c);
 
 }
diff --git a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java
index b70b398d5ee..a371f1aadd0 100644
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java
@@ -246,9 +246,9 @@ public class CUPSPrinter  {
                 IPPPrintService.getIPPConnection(url);
 
             if (urlConnection != null) {
-                OutputStream os = (OutputStream)java.security.AccessController.
-                    doPrivileged(new java.security.PrivilegedAction() {
-                        public Object run() {
+                OutputStream os = java.security.AccessController.
+                    doPrivileged(new java.security.PrivilegedAction<OutputStream>() {
+                        public OutputStream run() {
                             try {
                                 return urlConnection.getOutputStream();
                             } catch (Exception e) {
@@ -274,10 +274,10 @@ public class CUPSPrinter  {
                                         IPPPrintService.OP_CUPS_GET_DEFAULT,
                                         attCl)) {
 
-                    HashMap defaultMap = null;
+                    HashMap<String, AttributeClass> defaultMap = null;
                     String[] printerInfo = new String[2];
                     InputStream is = urlConnection.getInputStream();
-                    HashMap[] responseMap = IPPPrintService.readIPPResponse(
+                    HashMap<String, AttributeClass>[] responseMap = IPPPrintService.readIPPResponse(
                                          is);
                     is.close();
 
@@ -309,13 +309,11 @@ public class CUPSPrinter  {
                     }
 
 
-                    AttributeClass attribClass = (AttributeClass)
-                        defaultMap.get("printer-name");
+                    AttributeClass attribClass = defaultMap.get("printer-name");
 
                     if (attribClass != null) {
                         printerInfo[0] = attribClass.getStringValue();
-                        attribClass = (AttributeClass)
-                            defaultMap.get("printer-uri-supported");
+                        attribClass = defaultMap.get("printer-uri-supported");
                         IPPPrintService.debug_println(debugPrefix+
                           "printer-uri-supported="+attribClass);
                         if (attribClass != null) {
@@ -348,9 +346,9 @@ public class CUPSPrinter  {
                 IPPPrintService.getIPPConnection(url);
 
             if (urlConnection != null) {
-                OutputStream os = (OutputStream)java.security.AccessController.
-                    doPrivileged(new java.security.PrivilegedAction() {
-                        public Object run() {
+                OutputStream os = java.security.AccessController.
+                    doPrivileged(new java.security.PrivilegedAction<OutputStream>() {
+                        public OutputStream run() {
                             try {
                                 return urlConnection.getOutputStream();
                             } catch (Exception e) {
@@ -375,7 +373,7 @@ public class CUPSPrinter  {
                                 IPPPrintService.OP_CUPS_GET_PRINTERS, attCl)) {
 
                     InputStream is = urlConnection.getInputStream();
-                    HashMap[] responseMap =
+                    HashMap<String, AttributeClass>[] responseMap =
                         IPPPrintService.readIPPResponse(is);
 
                     is.close();
@@ -386,9 +384,9 @@ public class CUPSPrinter  {
                         return null;
                     }
 
-                    ArrayList printerNames = new ArrayList();
+                    ArrayList<String> printerNames = new ArrayList<>();
                     for (int i=0; i< responseMap.length; i++) {
-                        AttributeClass attribClass = (AttributeClass)
+                        AttributeClass attribClass =
                             responseMap[i].get("printer-uri-supported");
 
                         if (attribClass != null) {
@@ -396,7 +394,7 @@ public class CUPSPrinter  {
                             printerNames.add(nameStr);
                         }
                     }
-                    return (String[])printerNames.toArray(new String[] {});
+                    return printerNames.toArray(new String[] {});
                 } else {
                     os.close();
                     urlConnection.disconnect();
diff --git a/jdk/src/solaris/classes/sun/print/IPPPrintService.java b/jdk/src/solaris/classes/sun/print/IPPPrintService.java
index 2134c71321e..47398220ccc 100644
--- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java
+++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java
@@ -91,7 +91,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
     private CUPSPrinter cps;
     private HttpURLConnection urlConnection = null;
     private DocFlavor[] supportedDocFlavors;
-    private Class[] supportedCats;
+    private Class<?>[] supportedCats;
     private MediaTray[] mediaTrays;
     private MediaSizeName[] mediaSizeNames;
     private CustomMediaSizeName[] customMediaSizeNames;
@@ -99,7 +99,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
     private boolean isCupsPrinter;
     private boolean init;
     private Boolean isPS;
-    private HashMap getAttMap;
+    private HashMap<String, AttributeClass> getAttMap;
     private boolean pngImagesAdded = false;
     private boolean gifImagesAdded = false;
     private boolean jpgImagesAdded = false;
@@ -424,8 +424,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
 
             // use IPP to get all media,
             Media[] allMedia = getSupportedMedia();
-            ArrayList sizeList = new ArrayList();
-            ArrayList trayList = new ArrayList();
+            ArrayList<Media> sizeList = new ArrayList<>();
+            ArrayList<Media> trayList = new ArrayList<>();
             for (int i=0; i<allMedia.length; i++) {
                 if (allMedia[i] instanceof MediaSizeName) {
                     sizeList.add(allMedia[i]);
@@ -436,13 +436,11 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
 
             if (sizeList != null) {
                 mediaSizeNames = new MediaSizeName[sizeList.size()];
-                mediaSizeNames = (MediaSizeName[])sizeList.toArray(
-                                                       mediaSizeNames);
+                mediaSizeNames = sizeList.toArray(mediaSizeNames);
             }
             if (trayList != null) {
                 mediaTrays = new MediaTray[trayList.size()];
-                mediaTrays = (MediaTray[])trayList.toArray(
-                                                           mediaTrays);
+                mediaTrays = trayList.toArray(mediaTrays);
             }
             urlConnection.disconnect();
 
@@ -503,7 +501,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
                   flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) {
                 CopiesSupported cs = new CopiesSupported(1, MAXCOPIES);
                 AttributeClass attribClass = (getAttMap != null) ?
-                    (AttributeClass)getAttMap.get(cs.getName()) : null;
+                    getAttMap.get(cs.getName()) : null;
                 if (attribClass != null) {
                     int[] range = attribClass.getIntRangeValue();
                     cs = new CopiesSupported(range[0], range[1]);
@@ -545,7 +543,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
             return arr;
         } else if (category == Finishings.class) {
             AttributeClass attribClass = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get("finishings-supported")
+                getAttMap.get("finishings-supported")
                 : null;
             if (attribClass != null) {
                 int[] finArray = attribClass.getArrayOfIntValues();
@@ -648,7 +646,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
             }
         } else if (category == NumberUp.class) {
             AttributeClass attribClass = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get("number-up-supported") : null;
+                getAttMap.get("number-up-supported") : null;
             if (attribClass != null) {
                 int[] values = attribClass.getArrayOfIntValues();
                 if (values != null) {
@@ -673,7 +671,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
             OrientationRequested[] orientSup = null;
 
             AttributeClass attribClass = (getAttMap != null) ?
-              (AttributeClass)getAttMap.get("orientation-requested-supported")
+              getAttMap.get("orientation-requested-supported")
                 : null;
             if (attribClass != null) {
                 int[] orientArray = attribClass.getArrayOfIntValues();
@@ -748,7 +746,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
             // or printable so if the document is in Landscape, this may
             // result in double rotation.
             AttributeClass attribClass = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get("sides-supported")
+                getAttMap.get("sides-supported")
                 : null;
             if (attribClass != null) {
                 String[] sidesArray = attribClass.getArrayOfStringValues();
@@ -833,13 +831,13 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
             getAttMap.containsKey("document-format-supported")) {
 
             AttributeClass attribClass =
-                (AttributeClass)getAttMap.get("document-format-supported");
+                getAttMap.get("document-format-supported");
             if (attribClass != null) {
                 String mimeType;
                 boolean psSupported = false;
                 String[] docFlavors = attribClass.getArrayOfStringValues();
                 DocFlavor[] flavors;
-                HashSet docList = new HashSet();
+                HashSet<Object> docList = new HashSet<>();
                 int j;
                 String hostEnc = DocFlavor.hostEncoding.
                     toLowerCase(Locale.ENGLISH);
@@ -970,8 +968,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         if ((getAttMap != null) &&
             getAttMap.containsKey("media-supported")) {
 
-            AttributeClass attribClass =
-                (AttributeClass)getAttMap.get("media-supported");
+            AttributeClass attribClass = getAttMap.get("media-supported");
 
             if (attribClass != null) {
                 String[] mediaVals = attribClass.getArrayOfStringValues();
@@ -990,23 +987,21 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
     }
 
 
-    public synchronized Class[] getSupportedAttributeCategories() {
+    public synchronized Class<?>[] getSupportedAttributeCategories() {
         if (supportedCats != null) {
             return supportedCats;
         }
 
         initAttributes();
 
-        ArrayList catList = new ArrayList();
-        Class cl;
+        ArrayList<Class<?>> catList = new ArrayList<>();
 
         for (int i=0; i < printReqAttribDefault.length; i++) {
             PrintRequestAttribute pra =
                 (PrintRequestAttribute)printReqAttribDefault[i];
             if (getAttMap != null &&
                 getAttMap.containsKey(pra.getName()+"-supported")) {
-                cl = pra.getCategory();
-                catList.add(cl);
+                catList.add(pra.getCategory());
             }
         }
 
@@ -1047,7 +1042,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         if (getAttMap != null && getAttMap.containsKey("color-supported")) {
             catList.add(Chromaticity.class);
         }
-        supportedCats = new Class[catList.size()];
+        supportedCats = new Class<?>[catList.size()];
         catList.toArray(supportedCats);
         return supportedCats;
     }
@@ -1085,7 +1080,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         return false;
     }
 
-
+    @SuppressWarnings("unchecked")
     public synchronized <T extends PrintServiceAttribute>
         T getAttribute(Class<T> category)
     {
@@ -1103,7 +1098,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         } else if (category == PrinterInfo.class) {
             PrinterInfo pInfo = new PrinterInfo(printer, null);
             AttributeClass ac = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get(pInfo.getName())
+                getAttMap.get(pInfo.getName())
                 : null;
             if (ac != null) {
                 return (T)(new PrinterInfo(ac.getStringValue(), null));
@@ -1112,7 +1107,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         } else if (category == QueuedJobCount.class) {
             QueuedJobCount qjc = new QueuedJobCount(0);
             AttributeClass ac = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get(qjc.getName())
+                getAttMap.get(qjc.getName())
                 : null;
             if (ac != null) {
                 qjc = new QueuedJobCount(ac.getIntValue());
@@ -1122,7 +1117,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
             PrinterIsAcceptingJobs accJob =
                 PrinterIsAcceptingJobs.ACCEPTING_JOBS;
             AttributeClass ac = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get(accJob.getName())
+                getAttMap.get(accJob.getName())
                 : null;
             if ((ac != null) && (ac.getByteValue() == 0)) {
                 accJob = PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS;
@@ -1131,7 +1126,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         } else if (category == ColorSupported.class) {
             ColorSupported cs = ColorSupported.SUPPORTED;
             AttributeClass ac = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get(cs.getName())
+                getAttMap.get(cs.getName())
                 : null;
             if ((ac != null) && (ac.getByteValue() == 0)) {
                 cs = ColorSupported.NOT_SUPPORTED;
@@ -1165,7 +1160,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         for (int i=0; i < serviceAttributes.length; i++) {
             String name = (String)serviceAttributes[i][1];
             if (getAttMap != null && getAttMap.containsKey(name)) {
-                Class c = (Class)serviceAttributes[i][0];
+                @SuppressWarnings("unchecked")
+                Class<PrintServiceAttribute> c = (Class<PrintServiceAttribute>)serviceAttributes[i][0];
                 PrintServiceAttribute psa = getAttribute(c);
                 if (psa != null) {
                     attrs.add(psa);
@@ -1279,7 +1275,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
                 return false;
             }
         }
-        Class category = attr.getCategory();
+        Class<? extends Attribute> category = attr.getCategory();
         if (!isAttributeCategorySupported(category)) {
             return false;
         }
@@ -1397,7 +1393,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
         }
         String attribName = catName+"-default";
         AttributeClass attribClass = (getAttMap != null) ?
-                (AttributeClass)getAttMap.get(attribName) : null;
+                getAttMap.get(attribName) : null;
 
         if (category == Copies.class) {
             if (attribClass != null) {
@@ -1600,7 +1596,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
     }
 
 
-    public boolean usesClass(Class c) {
+    public boolean usesClass(Class<?> c) {
         return (c == sun.print.PSPrinterJob.class);
     }
 
@@ -1675,9 +1671,9 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
                                    AttributeClass.TAG_URI,
                                    ""+myURI)};
 
-            OutputStream os = (OutputStream)java.security.AccessController.
-                doPrivileged(new java.security.PrivilegedAction() {
-                    public Object run() {
+            OutputStream os = java.security.AccessController.
+                doPrivileged(new java.security.PrivilegedAction<OutputStream>() {
+                    public OutputStream run() {
                         try {
                             return urlConnection.getOutputStream();
                         } catch (Exception e) {
@@ -1696,7 +1692,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
             if (success) {
                 InputStream is = null;
                 if ((is = urlConnection.getInputStream())!=null) {
-                    HashMap[] responseMap = readIPPResponse(is);
+                    HashMap<String, AttributeClass>[] responseMap = readIPPResponse(is);
 
                     if (responseMap != null && responseMap.length > 0) {
                         getAttMap = responseMap[0];
@@ -1771,7 +1767,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
     }
 
 
-    public static HashMap[] readIPPResponse(InputStream inputStream) {
+    public static HashMap<String, AttributeClass>[] readIPPResponse(InputStream inputStream) {
 
         if (inputStream == null) {
             return null;
@@ -1792,8 +1788,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
                 String attribStr = null;
                 // assign default value
                 byte valTagByte = AttributeClass.TAG_KEYWORD;
-                ArrayList respList = new ArrayList();
-                HashMap responseMap = new HashMap();
+                ArrayList<HashMap<String, AttributeClass>> respList = new ArrayList<>();
+                HashMap<String, AttributeClass> responseMap = new HashMap<>();
 
                 response[0] = ois.readByte();
 
@@ -1829,7 +1825,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
                             // if key exists, new HashMap
                             if (responseMap.containsKey(attribStr)) {
                                 respList.add(responseMap);
-                                responseMap = new HashMap();
+                                responseMap = new HashMap<>();
                             }
 
                             // exclude those that are unknown
@@ -1885,7 +1881,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
                         if ((counter != 0) &&
                             responseMap.containsKey(attribStr)) {
                             respList.add(responseMap);
-                            responseMap = new HashMap();
+                            responseMap = new HashMap<>();
                         }
 
                         byte outArray[] = outObj.toByteArray();
@@ -1901,8 +1897,10 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
                 if ((responseMap != null) && (responseMap.size() > 0)) {
                     respList.add(responseMap);
                 }
-                return (HashMap[])respList.toArray(
-                                  new HashMap[respList.size()]);
+                @SuppressWarnings({"unchecked", "rawtypes"})
+                HashMap<String, AttributeClass>[] tmp  =
+                    respList.toArray((HashMap<String, AttributeClass>[])new HashMap[respList.size()]);
+                return tmp;
             } else {
                 debug_println(debugPrefix+
                           "readIPPResponse client error, IPP status code: 0x"+
diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
index 366a62f0e49..496dfb7abeb 100644
--- a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
@@ -90,9 +90,9 @@ import java.awt.print.*;
 public class UnixPrintJob implements CancelablePrintJob {
     private static String debugPrefix = "UnixPrintJob>> ";
 
-    transient private Vector jobListeners;
-    transient private Vector attrListeners;
-    transient private Vector listenedAttributeSets;
+    transient private Vector<PrintJobListener> jobListeners;
+    transient private Vector<PrintJobAttributeListener> attrListeners;
+    transient private Vector<PrintJobAttributeSet> listenedAttributeSets;
 
     private PrintService service;
     private boolean fidelity;
@@ -150,7 +150,7 @@ public class UnixPrintJob implements CancelablePrintJob {
                 return;
             }
             if (jobListeners == null) {
-                jobListeners = new Vector();
+                jobListeners = new Vector<>();
             }
             jobListeners.add(listener);
         }
@@ -238,7 +238,7 @@ public class UnixPrintJob implements CancelablePrintJob {
                 PrintJobListener listener;
                 PrintJobEvent event = new PrintJobEvent(this, reason);
                 for (int i = 0; i < jobListeners.size(); i++) {
-                    listener = (PrintJobListener)(jobListeners.elementAt(i));
+                    listener = jobListeners.elementAt(i);
                     switch (reason) {
 
                         case PrintJobEvent.JOB_CANCELED :
@@ -273,8 +273,8 @@ public class UnixPrintJob implements CancelablePrintJob {
                 return;
             }
             if (attrListeners == null) {
-                attrListeners = new Vector();
-                listenedAttributeSets = new Vector();
+                attrListeners = new Vector<>();
+                listenedAttributeSets = new Vector<>();
             }
             attrListeners.add(listener);
             if (attributes == null) {
@@ -770,7 +770,7 @@ public class UnixPrintJob implements CancelablePrintJob {
 
     private void getAttributeValues(DocFlavor flavor) throws PrintException {
         Attribute attr;
-        Class category;
+        Class<? extends Attribute> category;
 
         if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
             fidelity = true;
@@ -941,11 +941,11 @@ public class UnixPrintJob implements CancelablePrintJob {
 
     // Inner class to run "privileged" to open the printer output stream.
 
-    private class PrinterOpener implements java.security.PrivilegedAction {
+    private class PrinterOpener implements java.security.PrivilegedAction<OutputStream> {
         PrintException pex;
         OutputStream result;
 
-        public Object run() {
+        public OutputStream run() {
             try {
                 if (mDestType == UnixPrintJob.DESTFILE) {
                     spoolFile = new File(mDestination);
@@ -971,7 +971,7 @@ public class UnixPrintJob implements CancelablePrintJob {
 
     // Inner class to run "privileged" to invoke the system print command
 
-    private class PrinterSpooler implements java.security.PrivilegedAction {
+    private class PrinterSpooler implements java.security.PrivilegedAction<Object> {
         PrintException pex;
 
         private void handleProcessFailure(final Process failedProcess,
diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintService.java b/jdk/src/solaris/classes/sun/print/UnixPrintService.java
index bb9a6dfce58..ac60fa7ec38 100644
--- a/jdk/src/solaris/classes/sun/print/UnixPrintService.java
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintService.java
@@ -148,7 +148,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
     }
 
     /* let's try to support a few of these */
-    private static final Class[] serviceAttrCats = {
+    private static final Class<?>[] serviceAttrCats = {
         PrinterName.class,
         PrinterIsAcceptingJobs.class,
         QueuedJobCount.class,
@@ -157,7 +157,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
     /*  it turns out to be inconvenient to store the other categories
      *  separately because many attributes are in multiple categories.
      */
-    private static final Class[] otherAttrCats = {
+    private static final Class<?>[] otherAttrCats = {
         Chromaticity.class,
         Copies.class,
         Destination.class,
@@ -278,7 +278,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
     // and extra lines which have been added for remote printers.
     // 'protected' because this method is also used from UnixPrintServiceLookup.
     protected static String[] filterPrinterNamesAIX(String[] posPrinters) {
-        ArrayList printers = new ArrayList();
+        ArrayList<String> printers = new ArrayList<>();
         String [] splitPart;
 
         for(int i = 0; i < posPrinters.length; i++) {
@@ -295,7 +295,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
             }
         }
 
-        return (String[])printers.toArray(new String[printers.size()]);
+        return printers.toArray(new String[printers.size()]);
     }
 
     private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsAIX() {
@@ -533,6 +533,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
         }
     }
 
+    @SuppressWarnings("unchecked")
     public <T extends PrintServiceAttribute>
         T getAttribute(Class<T> category)
     {
@@ -617,9 +618,9 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
         return false;
     }
 
-    public Class[] getSupportedAttributeCategories() {
+    public Class<?>[] getSupportedAttributeCategories() {
         int totalCats = otherAttrCats.length;
-        Class [] cats = new Class[totalCats];
+        Class<?>[] cats = new Class<?>[totalCats];
         System.arraycopy(otherAttrCats, 0, cats, 0, otherAttrCats.length);
         return cats;
     }
@@ -967,7 +968,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
                 return false;
             }
         }
-        Class category = attr.getCategory();
+        Class<? extends Attribute> category = attr.getCategory();
         if (!isAttributeCategorySupported(category)) {
             return false;
         }
@@ -1078,7 +1079,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
         return this.getClass().hashCode()+getName().hashCode();
     }
 
-    public boolean usesClass(Class c) {
+    public boolean usesClass(Class<?> c) {
         return (c == sun.print.PSPrinterJob.class);
     }
 
diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
index 7abed34489d..25b9da12842 100644
--- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
@@ -69,7 +69,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
     private String defaultPrinter;
     private PrintService defaultPrintService;
     private PrintService[] printServices; /* includes the default printer */
-    private Vector lookupListeners = null;
+    private Vector<BackgroundLookupListener> lookupListeners = null;
     private static String debugPrefix = "UnixPrintServiceLookup>> ";
     private static boolean pollServices = true;
     private static final int DEFAULT_MINREFRESH = 120;  // 2 minutes
@@ -239,7 +239,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
         }
     }
 
-    private int addPrintServiceToList(ArrayList printerList, PrintService ps) {
+    private int addPrintServiceToList(ArrayList<PrintService> printerList, PrintService ps) {
         int index = printerList.indexOf(ps);
         // Check if PrintService with same name is already in the list.
         if (CUPSPrinter.isCupsRunning() && index != -1) {
@@ -253,7 +253,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
                 IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps);
                 return index;  // Do not add this.
             }
-            PrintService oldPS = (PrintService)(printerList.get(index));
+            PrintService oldPS = printerList.get(index);
             uri = oldPS.getAttribute(PrinterURI.class);
             if (uri.getURI().getHost().equals("localhost")) {
                 IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS);
@@ -319,7 +319,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
             return;
         }
 
-        ArrayList printerList = new ArrayList();
+        ArrayList<PrintService> printerList = new ArrayList<>();
         int defaultIndex = -1;
         for (int p=0; p<printers.length; p++) {
             if (printers[p] == null) {
@@ -396,8 +396,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
             defaultIndex = addPrintServiceToList(printerList, defaultPrintService);
         }
 
-        printServices = (PrintService[])printerList.toArray(
-                                      new PrintService[] {});
+        printServices = printerList.toArray(new PrintService[] {});
 
         // swap default with the first in the list
         if (defaultIndex > 0) {
@@ -411,9 +410,9 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
                                       PrintServiceAttributeSet attributes) {
 
         Attribute [] attrs =  attributes.toArray();
-        Attribute serviceAttr;
         for (int i=0; i<attrs.length; i++) {
-            serviceAttr
+            @SuppressWarnings("unchecked")
+            Attribute serviceAttr
                 = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory());
             if (serviceAttr == null || !serviceAttr.equals(attrs[i])) {
                 return false;
@@ -542,7 +541,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
             }
         } else {
             /* specified service attributes don't include a name.*/
-            Vector matchedServices = new Vector();
+            Vector<PrintService> matchedServices = new Vector<>();
             services = getPrintServices();
             for (int i = 0; i< services.length; i++) {
                 if (matchesAttributes(services[i], serviceSet)) {
@@ -551,7 +550,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
             }
             services = new PrintService[matchedServices.size()];
             for (int i = 0; i< services.length; i++) {
-                services[i] = (PrintService)matchedServices.elementAt(i);
+                services[i] = matchedServices.elementAt(i);
             }
             return services;
         }
@@ -591,7 +590,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
         }
 
         if (CUPSPrinter.isCupsRunning()) {
-            ArrayList matchingServices = new ArrayList();
+            ArrayList<PrintService> matchingServices = new ArrayList<>();
             for (int i=0; i<services.length; i++) {
                 try {
                     if (services[i].
@@ -602,7 +601,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
                 }
             }
             services = new PrintService[matchingServices.size()];
-            return (PrintService[])matchingServices.toArray(services);
+            return matchingServices.toArray(services);
 
         } else {
             // We only need to compare 1 PrintService because all
@@ -704,7 +703,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
             listener.notifyServices(printServices);
         } else {
             if (lookupListeners == null) {
-                lookupListeners = new Vector();
+                lookupListeners = new Vector<>();
                 lookupListeners.add(listener);
                 Thread lookupThread = new Thread(this);
                 lookupThread.start();
@@ -733,8 +732,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
         synchronized (this) {
             BackgroundLookupListener listener;
             for (int i=0; i<lookupListeners.size(); i++) {
-                listener =
-                    (BackgroundLookupListener)lookupListeners.elementAt(i);
+                listener = lookupListeners.elementAt(i);
                 listener.notifyServices(copyOf(services));
             }
             lookupListeners = null;
@@ -820,7 +818,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
         String command = "/usr/bin/lpstat -v|/usr/bin/expand|/usr/bin/cut -f3 -d' ' |/usr/bin/cut -f1 -d':' | /usr/bin/sort";
 
         String [] names = execCmd(command);
-        ArrayList printerNames = new ArrayList();
+        ArrayList<String> printerNames = new ArrayList<>();
         for (int i=0; i < names.length; i++) {
             if (!names[i].equals("_default") &&
                 !names[i].equals(defaultPrinter) &&
@@ -828,7 +826,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
                 printerNames.add(names[i]);
             }
         }
-        return (String[])printerNames.toArray(new String[printerNames.size()]);
+        return printerNames.toArray(new String[printerNames.size()]);
     }
 
     private String getDefaultPrinterNameAIX() {
@@ -870,7 +868,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
     }
 
     static String[] execCmd(final String command) {
-        ArrayList results = null;
+        ArrayList<String> results = null;
         try {
             final String[] cmd = new String[3];
             if (isSysV() || isAIX()) {
@@ -883,9 +881,9 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
                 cmd[2] = "LC_ALL=C " + command;
             }
 
-            results = (ArrayList)AccessController.doPrivileged(
-                new PrivilegedExceptionAction() {
-                    public Object run() throws IOException {
+            results = AccessController.doPrivileged(
+                new PrivilegedExceptionAction<ArrayList<String>>() {
+                    public ArrayList<String> run() throws IOException {
 
                         Process proc;
                         BufferedReader bufferedReader = null;
@@ -907,7 +905,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
                                 FileReader reader = new FileReader(f);
                                 bufferedReader = new BufferedReader(reader);
                                 String line;
-                                ArrayList results = new ArrayList();
+                                ArrayList<String> results = new ArrayList<>();
                                 while ((line = bufferedReader.readLine())
                                        != null) {
                                     results.add(line);
@@ -932,7 +930,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
         if (results == null) {
             return new String[0];
         } else {
-            return (String[])results.toArray(new String[results.size()]);
+            return results.toArray(new String[results.size()]);
         }
     }
 
diff --git a/jdk/src/windows/classes/sun/print/Win32MediaTray.java b/jdk/src/windows/classes/sun/print/Win32MediaTray.java
index eed18007353..79198ec4655 100644
--- a/jdk/src/windows/classes/sun/print/Win32MediaTray.java
+++ b/jdk/src/windows/classes/sun/print/Win32MediaTray.java
@@ -50,8 +50,8 @@ public class Win32MediaTray extends MediaTray {
     static final Win32MediaTray FORMSOURCE = new Win32MediaTray(5,
                                                       15); //DMBIN_FORMSOURCE
 
-    private static ArrayList winStringTable = new ArrayList();
-    private static ArrayList winEnumTable = new ArrayList();
+    private static ArrayList<String> winStringTable = new ArrayList<>();
+    private static ArrayList<Win32MediaTray> winEnumTable = new ArrayList<>();
     public int winID;
 
     private Win32MediaTray(int value, int id) {
@@ -97,22 +97,22 @@ public class Win32MediaTray extends MediaTray {
     }
 
     protected String[] getStringTable() {
-      ArrayList completeList = new ArrayList();
+      ArrayList<String> completeList = new ArrayList<>();
       for (int i=0; i < myStringTable.length; i++) {
         completeList.add(myStringTable[i]);
       }
       completeList.addAll(winStringTable);
       String[] nameTable = new String[completeList.size()];
-      return (String[])completeList.toArray(nameTable);
+      return completeList.toArray(nameTable);
     }
 
     protected EnumSyntax[] getEnumValueTable() {
-      ArrayList completeList = new ArrayList();
+      ArrayList<MediaTray> completeList = new ArrayList<>();
       for (int i=0; i < myEnumValueTable.length; i++) {
         completeList.add(myEnumValueTable[i]);
       }
       completeList.addAll(winEnumTable);
       MediaTray[] enumTable = new MediaTray[completeList.size()];
-      return (MediaTray[])completeList.toArray(enumTable);
+      return completeList.toArray(enumTable);
     }
 }
diff --git a/jdk/src/windows/classes/sun/print/Win32PrintJob.java b/jdk/src/windows/classes/sun/print/Win32PrintJob.java
index 570d23a91d2..df8b9923a5e 100644
--- a/jdk/src/windows/classes/sun/print/Win32PrintJob.java
+++ b/jdk/src/windows/classes/sun/print/Win32PrintJob.java
@@ -79,9 +79,9 @@ import java.awt.print.*;
 
 public class Win32PrintJob implements CancelablePrintJob {
 
-    transient private Vector jobListeners;
-    transient private Vector attrListeners;
-    transient private Vector listenedAttributeSets;
+    transient private Vector<PrintJobListener> jobListeners;
+    transient private Vector<PrintJobAttributeListener> attrListeners;
+    transient private Vector<PrintJobAttributeSet> listenedAttributeSets;
 
     private Win32PrintService service;
     private boolean fidelity;
@@ -139,7 +139,7 @@ public class Win32PrintJob implements CancelablePrintJob {
                 return;
             }
             if (jobListeners == null) {
-                jobListeners = new Vector();
+                jobListeners = new Vector<>();
             }
             jobListeners.add(listener);
         }
@@ -227,7 +227,7 @@ public class Win32PrintJob implements CancelablePrintJob {
                 PrintJobListener listener;
                 PrintJobEvent event = new PrintJobEvent(this, reason);
                 for (int i = 0; i < jobListeners.size(); i++) {
-                    listener = (PrintJobListener)(jobListeners.elementAt(i));
+                    listener = jobListeners.elementAt(i);
                     switch (reason) {
 
                         case PrintJobEvent.JOB_COMPLETE :
@@ -266,8 +266,8 @@ public class Win32PrintJob implements CancelablePrintJob {
                 return;
             }
             if (attrListeners == null) {
-                attrListeners = new Vector();
-                listenedAttributeSets = new Vector();
+                attrListeners = new Vector<>();
+                listenedAttributeSets = new Vector<>();
             }
             attrListeners.add(listener);
             if (attributes == null) {
@@ -670,7 +670,7 @@ public class Win32PrintJob implements CancelablePrintJob {
             fidelity = false;
         }
 
-        Class category;
+        Class<? extends Attribute> category;
         Attribute [] attrs = reqAttrSet.toArray();
         for (int i=0; i<attrs.length; i++) {
             Attribute attr = attrs[i];
diff --git a/jdk/src/windows/classes/sun/print/Win32PrintService.java b/jdk/src/windows/classes/sun/print/Win32PrintService.java
index 6ddbdba969f..d99fee887db 100644
--- a/jdk/src/windows/classes/sun/print/Win32PrintService.java
+++ b/jdk/src/windows/classes/sun/print/Win32PrintService.java
@@ -97,7 +97,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
     };
 
     /* let's try to support a few of these */
-    private static final Class[] serviceAttrCats = {
+    private static final Class<?>[] serviceAttrCats = {
         PrinterName.class,
         PrinterIsAcceptingJobs.class,
         QueuedJobCount.class,
@@ -107,7 +107,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
     /*  it turns out to be inconvenient to store the other categories
      *  separately because many attributes are in multiple categories.
      */
-    private static Class[] otherAttrCats = {
+    private static Class<?>[] otherAttrCats = {
         JobName.class,
         RequestingUserName.class,
         Copies.class,
@@ -202,7 +202,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
     private MediaPrintableArea[] mediaPrintables;
     private MediaTray[] mediaTrays;
     private PrinterResolution[] printRes;
-    private HashMap mpaMap;
+    private HashMap<MediaSizeName, MediaPrintableArea> mpaMap;
     private int nCopies;
     private int prnCaps;
     private int[] defaultSettings;
@@ -212,7 +212,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
     private boolean mediaInitialized;
     private boolean mpaListInitialized;
 
-    private ArrayList idList;
+    private ArrayList<Integer> idList;
     private MediaSize[] mediaSizes;
 
     private boolean isInvalid;
@@ -279,7 +279,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
             (idList.size() == mediaSizes.length)) {
             for (int i=0; i< idList.size(); i++) {
                 if (mediaSizes[i].getMediaSizeName() == msn) {
-                    return ((Integer)idList.get(i)).intValue();
+                    return idList.get(i).intValue();
                 }
             }
         }
@@ -338,10 +338,11 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         }
     }
 
-    private boolean addToUniqueList(ArrayList msnList, MediaSizeName mediaName) {
+    private boolean addToUniqueList(ArrayList<MediaSizeName> msnList,
+                                    MediaSizeName mediaName) {
         MediaSizeName msn;
         for (int i=0; i< msnList.size(); i++) {
-            msn = (MediaSizeName)msnList.get(i);
+            msn = msnList.get(i);
             if (msn == mediaName) {
                 return false;
             }
@@ -360,9 +361,8 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
             return;
         }
 
-        ArrayList msnList = new ArrayList();
+        ArrayList<MediaSizeName> msnList = new ArrayList<>();
         ArrayList<Win32MediaSize> trailingWmsList = new ArrayList<Win32MediaSize>();
-        ArrayList printableList = new ArrayList();
         MediaSizeName mediaName;
         boolean added;
         boolean queryFailure = false;
@@ -375,7 +375,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         // We remove from ID list any invalid mediaSize.  Though this is rare,
         // it happens in HP 4050 German driver.
 
-        idList = new ArrayList();
+        idList = new ArrayList<>();
         for (int i=0; i < media.length; i++) {
             idList.add(Integer.valueOf(media[i]));
         }
@@ -385,7 +385,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         for (int i = 0; i < idList.size(); i++) {
 
             // match Win ID with our predefined ID using table
-            mediaName = findWin32Media(((Integer)idList.get(i)).intValue());
+            mediaName = findWin32Media(idList.get(i).intValue());
             // Verify that this standard size is the same size as that
             // reported by the driver. This should be the case except when
             // the driver is mis-using a standard windows paper ID.
@@ -420,7 +420,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
                  */
                 Win32MediaSize wms = Win32MediaSize.findMediaName(dmPaperNameList.get(i));
                 if ((wms == null) && (idList.size() == mediaSizes.length)) {
-                    wms = new Win32MediaSize(dmPaperNameList.get(i), (Integer)idList.get(i));
+                    wms = new Win32MediaSize(dmPaperNameList.get(i), idList.get(i));
                     mediaSizes[i] = new MediaSize(mediaSizes[i].getX(MediaSize.MM),
                         mediaSizes[i].getY(MediaSize.MM), MediaSize.MM, wms);
                 }
@@ -458,7 +458,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
             // get from cached mapping of MPAs
             if (mpaMap != null && (mpaMap.get(msn) != null)) {
                 MediaPrintableArea[] mpaArr = new MediaPrintableArea[1];
-                mpaArr[0] = (MediaPrintableArea)mpaMap.get(msn);
+                mpaArr[0] = mpaMap.get(msn);
                 return mpaArr;
             }
         }
@@ -478,7 +478,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         }
 
         if (mpaMap == null) {
-            mpaMap = new HashMap();
+            mpaMap = new HashMap<>();
         }
 
         for (int i=0; i < loopNames.length; i++) {
@@ -532,10 +532,10 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
            }
            MediaPrintableArea[] mpaArr = new MediaPrintableArea[1];
            // by this time, we've already gotten the desired MPA
-           mpaArr[0] = (MediaPrintableArea)mpaMap.get(msn);
+           mpaArr[0] = mpaMap.get(msn);
            return mpaArr;
        } else {
-           mediaPrintables = (MediaPrintableArea[])mpaMap.values().toArray(new MediaPrintableArea[0]);
+           mediaPrintables = mpaMap.values().toArray(new MediaPrintableArea[0]);
            mpaListInitialized = true;
            return mediaPrintables;
        }
@@ -624,7 +624,8 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
     }
 
 
-    private MediaSize[] getMediaSizes(ArrayList idList, int[] media, ArrayList<String> dmPaperNameList) {
+    private MediaSize[] getMediaSizes(ArrayList<Integer> idList, int[] media,
+                                      ArrayList<String> dmPaperNameList) {
         if (dmPaperNameList == null) {
             dmPaperNameList = new ArrayList<String>();
         }
@@ -641,7 +642,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         }
 
         int nMedia = mediaSz.length/2;
-        ArrayList msList = new ArrayList();
+        ArrayList<MediaSize> msList = new ArrayList<>();
 
         for (int i = 0; i < nMedia; i++, ms=null) {
             wid = mediaSz[i*2]/10f;
@@ -814,7 +815,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
             } else {
                 int nRes = prnRes.length/2;
 
-                ArrayList arrList = new ArrayList();
+                ArrayList<PrinterResolution> arrList = new ArrayList<>();
                 PrinterResolution pr;
 
                 for (int i=0; i<nRes; i++) {
@@ -826,8 +827,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
                     }
                 }
 
-                printRes = (PrinterResolution[])arrList.toArray(
-                                        new PrinterResolution[arrList.size()]);
+                printRes = arrList.toArray(new PrinterResolution[arrList.size()]);
             }
         }
         return printRes;
@@ -915,6 +915,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         }
     }
 
+    @SuppressWarnings("unchecked")
     public <T extends PrintServiceAttribute> T
         getAttribute(Class<T> category)
     {
@@ -1009,7 +1010,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
     }
 
     public Class<?>[] getSupportedAttributeCategories() {
-        ArrayList categList = new ArrayList(otherAttrCats.length+3);
+        ArrayList<Class<?>> categList = new ArrayList<>(otherAttrCats.length+3);
         for (int i=0; i < otherAttrCats.length; i++) {
             categList.add(otherAttrCats[i]);
         }
@@ -1033,7 +1034,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
             categList.add(PrinterResolution.class);
         }
 
-        return (Class[])categList.toArray(new Class[categList.size()]);
+        return categList.toArray(new Class<?>[categList.size()]);
     }
 
     public boolean
@@ -1049,7 +1050,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
                                                " is not an Attribute");
         }
 
-        Class[] classList = getSupportedAttributeCategories();
+        Class<?>[] classList = getSupportedAttributeCategories();
         for (int i = 0; i < classList.length; i++) {
             if (category.equals(classList[i])) {
                 return true;
@@ -1234,7 +1235,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         }
     }
 
-    private boolean isPSDocAttr(Class category) {
+    private boolean isPSDocAttr(Class<?> category) {
         if (category == OrientationRequested.class || category == Copies.class) {
                 return true;
         }
@@ -1475,7 +1476,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         if (attr == null) {
             throw new NullPointerException("null attribute");
         }
-        Class category = attr.getCategory();
+        Class<? extends Attribute> category = attr.getCategory();
         if (flavor != null) {
             if (!isDocFlavorSupported(flavor)) {
                 throw new IllegalArgumentException(flavor +
@@ -1700,7 +1701,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
         return this.getClass().hashCode()+getName().hashCode();
     }
 
-    public boolean usesClass(Class c) {
+    public boolean usesClass(Class<?> c) {
         return (c == sun.awt.windows.WPrinterJob.class);
     }
 
@@ -1722,8 +1723,8 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
 
 @SuppressWarnings("serial") // JDK implementation class
 class Win32MediaSize extends MediaSizeName {
-    private static ArrayList winStringTable = new ArrayList();
-    private static ArrayList winEnumTable = new ArrayList();
+    private static ArrayList<String> winStringTable = new ArrayList<>();
+    private static ArrayList<Win32MediaSize> winEnumTable = new ArrayList<>();
     private static MediaSize[] predefMedia;
 
     private int dmPaperID; // driver ID for this paper.
@@ -1741,7 +1742,7 @@ class Win32MediaSize extends MediaSizeName {
     public static synchronized Win32MediaSize findMediaName(String name) {
         int nameIndex = winStringTable.indexOf(name);
         if (nameIndex != -1) {
-            return (Win32MediaSize)winEnumTable.get(nameIndex);
+            return winEnumTable.get(nameIndex);
         }
         return null;
     }
@@ -1783,12 +1784,12 @@ class Win32MediaSize extends MediaSizeName {
 
     protected String[] getStringTable() {
       String[] nameTable = new String[winStringTable.size()];
-      return (String[])winStringTable.toArray(nameTable);
+      return winStringTable.toArray(nameTable);
     }
 
     protected EnumSyntax[] getEnumValueTable() {
       MediaSizeName[] enumTable = new MediaSizeName[winEnumTable.size()];
-      return (MediaSizeName[])winEnumTable.toArray(enumTable);
+      return winEnumTable.toArray(enumTable);
     }
 
 }
diff --git a/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java b/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java
index 06d4b0840dd..5a386d7f2ef 100644
--- a/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java
+++ b/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java
@@ -183,6 +183,7 @@ public class Win32PrintServiceLookup extends PrintServiceLookup {
         }
     }
 
+    @SuppressWarnings("unchecked") // Cast to Class<PrintServiceAttribute>
     boolean matchingService(PrintService service,
                             PrintServiceAttributeSet serviceSet) {
         if (serviceSet != null) {
@@ -246,7 +247,7 @@ public class Win32PrintServiceLookup extends PrintServiceLookup {
         if (services.length == 0) {
             return services;
         } else {
-            ArrayList matchingServices = new ArrayList();
+            ArrayList<PrintService> matchingServices = new ArrayList<>();
             for (int i=0; i<services.length; i++) {
                 try {
                     if (services[i].
@@ -257,7 +258,7 @@ public class Win32PrintServiceLookup extends PrintServiceLookup {
                 }
             }
             services = new PrintService[matchingServices.size()];
-            return (PrintService[])matchingServices.toArray(services);
+            return matchingServices.toArray(services);
         }
     }
 
-- 
GitLab


From f06c5555b024ccf34c80f5d19851e2ec361ea7da Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Mon, 9 Jun 2014 16:24:47 -0700
Subject: [PATCH 062/192] 8046271: Fix overrides lint warnings in Apple laf
 code

Reviewed-by: alanb, prr
---
 .../macosx/classes/com/apple/laf/AquaFileSystemModel.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaFileSystemModel.java b/jdk/src/macosx/classes/com/apple/laf/AquaFileSystemModel.java
index 37e627e8338..b0713215077 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaFileSystemModel.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileSystemModel.java
@@ -366,6 +366,11 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
             final SortableFile otherFile = (SortableFile)other;
             return otherFile.fFile.equals(fFile);
         }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(fFile);
+        }
     }
 
     class LoadFilesThread extends Thread {
-- 
GitLab


From 70c76ec8c45b4e0d9bad4168a558a95a25b901eb Mon Sep 17 00:00:00 2001
From: Harold Seigel <hseigel@openjdk.org>
Date: Tue, 10 Jun 2014 14:04:37 -0400
Subject: [PATCH 063/192] 8044738: Check attribute_length of EnclosingMethod
 attribute

Add check that attribute_length == 4.

Reviewed-by: fparain, coleenp, lfoltan
---
 .../share/vm/classfile/classFileParser.cpp    |   5 +-
 .../EnclosingMethodAttr/EnclMethTest.jcod     | 115 ++++++++++++++++++
 .../EnclosingMethodAttr/EnclMethodAttr.java   |  47 +++++++
 .../EnclosingMethodAttr/enclMethodAttr.jar    | Bin 0 -> 738 bytes
 4 files changed, 166 insertions(+), 1 deletion(-)
 create mode 100644 hotspot/test/runtime/EnclosingMethodAttr/EnclMethTest.jcod
 create mode 100644 hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java
 create mode 100644 hotspot/test/runtime/EnclosingMethodAttr/enclMethodAttr.jar

diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index 608b43ae150..c7fe1c7d5a2 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -2984,9 +2984,12 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio
       } else if (tag == vmSymbols::tag_enclosing_method()) {
         if (parsed_enclosingmethod_attribute) {
           classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK);
-        }   else {
+        } else {
           parsed_enclosingmethod_attribute = true;
         }
+        guarantee_property(attribute_length == 4,
+          "Wrong EnclosingMethod attribute length %u in class file %s",
+          attribute_length, CHECK);
         cfs->guarantee_more(4, CHECK);  // class_index, method_index
         enclosing_method_class_index  = cfs->get_u2_fast();
         enclosing_method_method_index = cfs->get_u2_fast();
diff --git a/hotspot/test/runtime/EnclosingMethodAttr/EnclMethTest.jcod b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethTest.jcod
new file mode 100644
index 00000000000..956b643b055
--- /dev/null
+++ b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethTest.jcod
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This test has a EnclosingMethod attribute with an illegal
+ * attribute_length field value of 6.  This should cause a
+ * java.lang.ClassFormatError exception to be thrown.
+ */
+
+class EnclMethTest {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [22] { // Constant Pool
+    ; // first element is empty
+    Field #3 #14; // #1     at 0x0A
+    Method #4 #15; // #2     at 0x0F
+    class #16; // #3     at 0x14
+    class #19; // #4     at 0x17
+    Utf8 "this$0"; // #5     at 0x1A
+    Utf8 "La;"; // #6     at 0x23
+    Utf8 "Synthetic"; // #7     at 0x29
+    Utf8 "<init>"; // #8     at 0x35
+    Utf8 "(Ljava/lang/Object;)V"; // #9     at 0x3E
+    Utf8 "Code"; // #10     at 0x56
+    Utf8 "LineNumberTable"; // #11     at 0x5D
+    Utf8 "SourceFile"; // #12     at 0x6F
+    Utf8 "a.java"; // #13     at 0x7C
+    NameAndType #5 #6; // #14     at 0x85
+    NameAndType #8 #20; // #15     at 0x8A
+    Utf8 "EnclMethTest"; // #16     at 0x8F
+    Utf8 "Loc"; // #17     at 0x9E
+    Utf8 "InnerClasses"; // #18     at 0xA4
+    Utf8 "java/lang/Object"; // #19     at 0xB3
+    Utf8 "()V"; // #20     at 0xC6
+    Utf8 "EnclosingMethod"; // #21     at 0xCC
+  } // Constant Pool
+
+  0x0000; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [0] { // Interfaces
+  } // Interfaces
+
+  [1] { // fields
+    { // Member at 0xE8
+      0x0000; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [1] { // Attributes
+        Attr(#7, 0) { // Synthetic at 0xF0
+        } // end Synthetic
+      } // Attributes
+    } // Member
+  } // fields
+
+  [1] { // methods
+    { // Member at 0xF8
+      0x0001; // access
+      #8; // name_cpx
+      #20; // sig_cpx
+      [1] { // Attributes
+        Attr(#10, 17) { // Code at 0x0100
+          2; // max_stack
+          2; // max_locals
+          Bytes[5]{
+            0x2AB70002B1;
+          };
+          [0] { // Traps
+          } // end Traps
+          [0] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [3] { // Attributes
+    Attr(#12, 2) { // SourceFile at 0x0119
+      #13;
+    } // end SourceFile
+    ;
+    Attr(#18, 10) { // InnerClasses at 0x0121
+      [1] { // InnerClasses
+        #3 #0 #17 0; //  at 0x0131
+      }
+    } // end InnerClasses
+    ;
+    Attr(#21, 6) { // EnclosingMethod at 0x0131
+      // invalid length of EnclosingMethod attr: 6 (should be 4) !!
+      0x0004000F;
+    } // end EnclosingMethod
+  } // Attributes
+} // end class EnclMethTest
diff --git a/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java
new file mode 100644
index 00000000000..82b5424813f
--- /dev/null
+++ b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8044738
+ * @library /testlibrary
+ * @summary Check attribute_length of EnclosingMethod attribute
+ * @run main EnclMethodAttr
+ */
+
+import java.io.File;
+import com.oracle.java.testlibrary.*;
+
+public class EnclMethodAttr {
+
+    static final String testsrc = System.getProperty("test.src");
+
+    public static void main(String args[]) throws Throwable {
+        System.out.println("Regression test for bug 8044738");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-jar", testsrc + File.separator + "enclMethodAttr.jar");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("java.lang.ClassFormatError: Wrong EnclosingMethod");
+    }
+}
+
diff --git a/hotspot/test/runtime/EnclosingMethodAttr/enclMethodAttr.jar b/hotspot/test/runtime/EnclosingMethodAttr/enclMethodAttr.jar
new file mode 100644
index 0000000000000000000000000000000000000000..590e7ae37b641964ac60d566a76f73450aa3f57a
GIT binary patch
literal 738
zcmWIWW@Zs#;Nak3cwKkYg#ih0GO#fCx`sIFdiuHP|2xINz|0Wf&CUT*!2}{07#MJC
z7GYpOX!dpV^K^3!4$<><`|Nw>w2!y0-bG$-U9EFx&TkGfxMKX^X_20nua2kh#nM$Q
zoDr`iUo2D8%J?C!s`h+|mc?^%(I?`n(-@{^e=7Q^miFwW)pHdw@o3E*&s3lPST-%C
zg~9j9(??I4z^+r6ocke$fq@|o#dRGms9qCdU|?{~OV064Ey)N;EiTbZ&PgmTj-9aI
z@34WuvHjiNPRh=w=6_=0X>Byxur+C=gA<p*mZb8a)rF!tnq?C!bktPX<Qm$Y<`^rz
ze)r|({k#6p=igtS&tPsL?exIlID>0jV4JX$l+@$%>p2&N7#}M5ndiK?dF9W{yfvKL
zTRtwiv&!5wcj{fA`K#BiJN)KRt3kw$t!g4mH~z}}9`!PB>8fe@pO)S(-MY^_aLFsJ
zGVeEvQ*RvCbi8+SSM8OBk(u&Jw+#L4B3AEqUA^b}JcD2TDfd-^x^KMMvvIb?!L^mf
z2c;R09OPLic_F*Y;+*AbWtEy6g+Du=EH>xxILFCXaK<!!@r&LAGn9Mpe_;p3=&?sU
z{a+Xu7_1pVG0Mm!!ho6}V6hEK5YUK+QYgtIz#CO7a#Vnl15^(K1A{G&#DQ!AD9Vr>
e28uF-3AeFEV1PF(8%PZ^12e;31_lOxu*(4oo$8MO

literal 0
HcmV?d00001

-- 
GitLab


From ec7589bf7d20db5a951a5fb8ef056be86adb4d04 Mon Sep 17 00:00:00 2001
From: Alexey Ivanov <aivanov@openjdk.org>
Date: Wed, 11 Jun 2014 10:53:27 +0400
Subject: [PATCH 064/192] 8046391: Hang displaying JFileChooser with Windows
 L&F

Reviewed-by: anthony, serb
---
 .../plaf/windows/AnimationController.java     | 15 +++---
 .../swing/plaf/windows/WindowsComboBoxUI.java | 20 +++-----
 .../plaf/windows/WindowsGraphicsUtils.java    |  5 +-
 .../plaf/windows/WindowsIconFactory.java      | 46 ++++++++-----------
 .../WindowsInternalFrameTitlePane.java        | 13 +++---
 .../plaf/windows/WindowsLookAndFeel.java      |  8 ++--
 .../swing/plaf/windows/WindowsMenuBarUI.java  |  4 +-
 .../swing/plaf/windows/WindowsMenuItemUI.java |  6 +--
 .../windows/WindowsPopupMenuSeparatorUI.java  |  7 ++-
 .../plaf/windows/WindowsPopupMenuUI.java      |  6 +--
 .../plaf/windows/WindowsProgressBarUI.java    | 13 ++----
 .../swing/plaf/windows/WindowsSliderUI.java   |  3 +-
 .../swing/plaf/windows/WindowsSpinnerUI.java  |  5 +-
 .../plaf/windows/WindowsTableHeaderUI.java    |  5 +-
 .../sun/java/swing/plaf/windows/XPStyle.java  | 44 ++++++++----------
 .../classes/sun/awt/windows/ThemeReader.java  |  4 --
 .../classes/sun/awt/windows/ThemeReader.java  |  6 ---
 .../classes/sun/awt/windows/WToolkit.java     | 29 +++---------
 18 files changed, 84 insertions(+), 155 deletions(-)

diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
index 70edf604df5..8fec402dcea 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -130,14 +130,11 @@ class AnimationController implements ActionListener, PropertyChangeListener {
                     //one second seems plausible value
                     duration = 1000;
                 } else {
-                    XPStyle xp = XPStyle.getXP();
-                    duration = (xp != null)
-                               ? xp.getThemeTransitionDuration(
-                                       c, part,
-                                       normalizeState(oldState),
-                                       normalizeState(newState),
-                                       Prop.TRANSITIONDURATIONS)
-                               : 1000;
+                     duration = XPStyle.getXP().getThemeTransitionDuration(
+                           c, part,
+                           normalizeState(oldState),
+                           normalizeState(newState),
+                           Prop.TRANSITIONDURATIONS);
                 }
                 controller.startAnimation(c, part, oldState, newState, duration);
             }
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
index dc7ae1bc511..348b28a1a7b 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -37,7 +37,6 @@ import java.awt.*;
 import static com.sun.java.swing.plaf.windows.TMSchema.Part;
 import static com.sun.java.swing.plaf.windows.TMSchema.State;
 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
-
 import sun.swing.DefaultLookup;
 import sun.swing.StringUIClientPropertyKey;
 
@@ -232,9 +231,6 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
 
     private void paintXPComboBoxBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
-        if (xp == null) {
-            return;
-        }
         State state = getXPComboBoxState(c);
         Skin skin = null;
         if (! comboBox.isEditable()
@@ -404,9 +400,8 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
      * @return a button which represents the popup control
      */
     protected JButton createArrowButton() {
-        XPStyle xp = XPStyle.getXP();
-        if (xp != null) {
-            return new XPComboBoxButton(xp);
+        if (XPStyle.getXP() != null) {
+            return new XPComboBoxButton();
         } else {
             return super.createArrowButton();
         }
@@ -414,9 +409,9 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     private class XPComboBoxButton extends XPStyle.GlyphButton {
-        public XPComboBoxButton(XPStyle xp) {
+        public XPComboBoxButton() {
             super(null,
-                  (! xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
+                  (! XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
                    ? Part.CP_DROPDOWNBUTTON
                    : (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
                      ? Part.CP_DROPDOWNBUTTONLEFT
@@ -429,11 +424,10 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
         protected State getState() {
             State rv;
             rv = super.getState();
-            XPStyle xp = XPStyle.getXP();
             if (rv != State.DISABLED
                 && comboBox != null && ! comboBox.isEditable()
-                && xp != null && xp.isSkinDefined(comboBox,
-                                                  Part.CP_DROPDOWNBUTTONRIGHT)) {
+                && XPStyle.getXP().isSkinDefined(comboBox,
+                                                 Part.CP_DROPDOWNBUTTONRIGHT)) {
                 /*
                  * for non editable ComboBoxes Vista seems to have the
                  * same glyph for all non DISABLED states
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
index 8e168066d11..63eb27b9b2d 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -125,9 +125,6 @@ public class WindowsGraphicsUtils {
     static void paintXPText(AbstractButton b, Part part, State state,
             Graphics g, int x, int y, String text, int mnemIndex) {
         XPStyle xp = XPStyle.getXP();
-        if (xp == null) {
-            return;
-        }
         Color textColor = b.getForeground();
 
         if (textColor instanceof UIResource) {
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
index d2018ea4e89..0a4cfce44bf 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
@@ -623,8 +623,8 @@ public class WindowsIconFactory implements Serializable
     @SuppressWarnings("serial") // Same-version serialization only
     private static class MenuArrowIcon implements Icon, UIResource, Serializable {
         public void paintIcon(Component c, Graphics g, int x, int y) {
-            XPStyle xp = XPStyle.getXP();
-            if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+            if (WindowsMenuItemUI.isVistaPainting()) {
+                XPStyle xp = XPStyle.getXP();
                 State state = State.NORMAL;
                 if (c instanceof JMenuItem) {
                     state = ((JMenuItem) c).getModel().isEnabled()
@@ -657,18 +657,16 @@ public class WindowsIconFactory implements Serializable
             }
         }
         public int getIconWidth() {
-            XPStyle xp = XPStyle.getXP();
-            if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
+            if (WindowsMenuItemUI.isVistaPainting()) {
+                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getWidth();
             } else {
                 return 4;
             }
         }
         public int getIconHeight() {
-            XPStyle xp = XPStyle.getXP();
-            if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
+            if (WindowsMenuItemUI.isVistaPainting()) {
+                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getHeight();
             } else {
                 return 8;
@@ -694,8 +692,7 @@ public class WindowsIconFactory implements Serializable
         }
 
         static int getIconWidth() {
-            XPStyle xp = XPStyle.getXP();
-            return ((xp != null) ? xp.getSkin(null, Part.MP_POPUPCHECK).getWidth() : 16)
+            return XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK).getWidth()
                 + 2 * OFFSET;
         }
 
@@ -759,17 +756,12 @@ public class WindowsIconFactory implements Serializable
                 Icon icon = getIcon();
                 int height = 0;
                 if (icon != null) {
-                    height = icon.getIconHeight();
+                    height = icon.getIconHeight() + 2 * OFFSET;
                 } else {
-                    XPStyle xp = XPStyle.getXP();
-                    if (xp != null) {
-                        Skin skin = xp.getSkin(null, Part.MP_POPUPCHECK);
-                        height = skin.getHeight();
-                    } else {
-                        height = 16;
-                    }
+                    Skin skin =
+                        XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
+                    height = skin.getHeight() + 2 * OFFSET;
                 }
-                height +=  2 * OFFSET;
                 return height;
             }
 
@@ -817,16 +809,14 @@ public class WindowsIconFactory implements Serializable
                                   ? State.BULLETDISABLED
                                   : State.CHECKMARKDISABLED;
                         }
+                        Skin skin;
                         XPStyle xp = XPStyle.getXP();
-                        if (xp != null) {
-                            Skin skin;
-                            skin =  xp.getSkin(c, backgroundPart);
-                            skin.paintSkin(g, x, y,
-                                getIconWidth(), getIconHeight(), backgroundState);
-                            if (icon == null) {
-                                skin = xp.getSkin(c, part);
-                                skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
-                            }
+                        skin =  xp.getSkin(c, backgroundPart);
+                        skin.paintSkin(g, x, y,
+                            getIconWidth(), getIconHeight(), backgroundState);
+                        if (icon == null) {
+                            skin = xp.getSkin(c, part);
+                            skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
                         }
                     }
                 }
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
index 6210a93b738..c654c5a7046 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -86,15 +86,14 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
             }
         } else {
             buttonWidth += 2;
+            selectedTitleGradientColor =
+                    UIManager.getColor("InternalFrame.activeTitleGradient");
+            notSelectedTitleGradientColor =
+                    UIManager.getColor("InternalFrame.inactiveTitleGradient");
             Color activeBorderColor =
                     UIManager.getColor("InternalFrame.activeBorderColor");
             setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
         }
-        // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
-        selectedTitleGradientColor =
-                UIManager.getColor("InternalFrame.activeTitleGradient");
-        notSelectedTitleGradientColor =
-                UIManager.getColor("InternalFrame.inactiveTitleGradient");
     }
 
     protected void uninstallListeners() {
@@ -389,7 +388,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
     public class WindowsTitlePaneLayout extends BasicInternalFrameTitlePane.TitlePaneLayout {
         private Insets captionMargin = null;
         private Insets contentMargin = null;
-        private final XPStyle xp = XPStyle.getXP();
+        private XPStyle xp = XPStyle.getXP();
 
         WindowsTitlePaneLayout() {
             if (xp != null) {
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
index f4f326aa2f6..a6c1c895757 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
@@ -2327,9 +2327,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
         }
 
         public Object getXPValue(UIDefaults table) {
-            XPStyle xp = XPStyle.getXP();
-            Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null;
-            if (xpBorder != null && extraMargin != null) {
+            Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
+            if (extraMargin != null) {
                 return new BorderUIResource.
                         CompoundBorderUIResource(xpBorder, extraMargin);
             } else {
@@ -2345,8 +2344,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
 
         public Object getXPValue(UIDefaults table) {
             XPColorValueKey key = (XPColorValueKey)xpValue;
-            XPStyle xp = XPStyle.getXP();
-            return xp != null ? xp.getColor(key.skin, key.prop, null) : null;
+            return XPStyle.getXP().getColor(key.skin, key.prop, null);
         }
 
         private static class XPColorValueKey {
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
index 68015c0752e..73dcf802e33 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
@@ -156,8 +156,8 @@ public class WindowsMenuBarUI extends BasicMenuBarUI
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        XPStyle xp = XPStyle.getXP();
-        if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+        if (WindowsMenuItemUI.isVistaPainting()) {
+            XPStyle xp = XPStyle.getXP();
             Skin skin;
             skin = xp.getSkin(c, Part.MP_BARBACKGROUND);
             int width = c.getWidth();
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
index 8cc4fc420a0..cac7af54aa7 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2006, 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
@@ -109,8 +109,7 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
     static void paintBackground(WindowsMenuItemUIAccessor menuItemUI,
             Graphics g, JMenuItem menuItem, Color bgColor) {
         assert isVistaPainting();
-        XPStyle xp = XPStyle.getXP();
-        if (xp != null && isVistaPainting()) {
+        if (isVistaPainting()) {
             int menuWidth = menuItem.getWidth();
             int menuHeight = menuItem.getHeight();
             if (menuItem.isOpaque()) {
@@ -119,6 +118,7 @@ public class WindowsMenuItemUI extends BasicMenuItemUI {
                 g.fillRect(0,0, menuWidth, menuHeight);
                 g.setColor(oldColor);
             }
+            XPStyle xp = XPStyle.getXP();
             Part part = menuItemUI.getPart(menuItem);
             Skin skin = xp.getSkin(menuItem, part);
             skin.paintSkin(g, 0 , 0,
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
index fc20e988459..797aa5a7b6a 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2006, 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
@@ -50,8 +50,7 @@ public class WindowsPopupMenuSeparatorUI extends BasicPopupMenuSeparatorUI {
 
     public void paint(Graphics g, JComponent c) {
         Dimension s = c.getSize();
-        XPStyle xp = XPStyle.getXP();
-        if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+        if (WindowsMenuItemUI.isVistaPainting()) {
             int x = 1;
             Component parent = c.getParent();
             if (parent instanceof JComponent) {
@@ -68,7 +67,7 @@ public class WindowsPopupMenuSeparatorUI extends BasicPopupMenuSeparatorUI {
                     x += WindowsPopupMenuUI.getGutterWidth();
                 }
             }
-            Skin skin = xp.getSkin(c, Part.MP_POPUPSEPARATOR);
+            Skin skin = XPStyle.getXP().getSkin(c, Part.MP_POPUPSEPARATOR);
             int skinHeight = skin.getHeight();
             int y = (s.height - skinHeight) / 2;
             skin.paintSkin(g, x, y, s.width - x - 1, skinHeight, State.NORMAL);
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
index e3d9d96efc4..584641bcaf7 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2006, 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
@@ -194,8 +194,8 @@ public class WindowsPopupMenuUI extends BasicPopupMenuUI {
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        XPStyle xp = XPStyle.getXP();
-        if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+        if (WindowsMenuItemUI.isVistaPainting()) {
+            XPStyle xp = XPStyle.getXP();
             Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
             skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
             int textOffset = getTextOffset(c);
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
index 45947fc2b7e..ef5d176fa7b 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -322,9 +322,8 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
     private Rectangle getFullChunkBounds(Rectangle box) {
         boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL);
         XPStyle xp = XPStyle.getXP();
-        int gap = (xp != null) ? xp.getInt(progressBar, Part.PP_PROGRESS,
-                                           null, Prop.PROGRESSSPACESIZE, 0)
-                               : 0;
+        int gap = xp.getInt(progressBar, Part.PP_PROGRESS, null,
+                            Prop.PROGRESSSPACESIZE, 0);
 
         if (!vertical) {
             int chunksize = box.width+gap;
@@ -339,9 +338,6 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
                                           boolean vertical,
                                           int bgwidth, int bgheight) {
         XPStyle xp = XPStyle.getXP();
-        if (xp == null) {
-            return;
-        }
 
         // create a new graphics to keep drawing surface state
         Graphics2D gfx = (Graphics2D)g.create();
@@ -400,9 +396,6 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
     private void paintXPBackground(Graphics g, boolean vertical,
                                    int barRectWidth, int barRectHeight) {
         XPStyle xp = XPStyle.getXP();
-        if (xp == null) {
-            return;
-        }
         Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;
         Skin skin = xp.getSkin(progressBar, part);
 
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
index 1bae3f8f441..dbfb7b81251 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2005, 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
@@ -215,6 +215,7 @@ public class WindowsSliderUI extends BasicSliderUI
     }
 
     private Part getXPThumbPart() {
+        XPStyle xp = XPStyle.getXP();
         Part part;
         boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
         boolean leftToRight = slider.getComponentOrientation().isLeftToRight();
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
index c17328e50cc..ccc6d039b53 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2006, 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
@@ -63,9 +63,6 @@ public class WindowsSpinnerUI extends BasicSpinnerUI {
 
     private void paintXPBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
-        if (xp == null) {
-            return;
-        }
         Skin skin = xp.getSkin(c, Part.EP_EDIT);
         State state = getXPState(c);
         skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
index 9cf37994589..117e9d7b7b1 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
@@ -91,10 +91,9 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
             this.column = column;
             this.hasRollover = (column == getRolloverColumn());
             if (skin == null) {
-                XPStyle xp = XPStyle.getXP();
-                skin = (xp != null) ? xp.getSkin(header, Part.HP_HEADERITEM) : null;
+                skin = XPStyle.getXP().getSkin(header, Part.HP_HEADERITEM);
             }
-            Insets margins = (skin != null) ? skin.getContentMargin() : null;
+            Insets margins = skin.getContentMargin();
             Border border = null;
             int contentTop = 0;
             int contentLeft = 0;
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
index baeca8c29ca..bc1404e9227 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
@@ -115,7 +115,7 @@ class XPStyle {
                 }
             }
         }
-        return ThemeReader.isXPStyleEnabled() ? xp : null;
+        return xp;
     }
 
     static boolean isVista() {
@@ -180,10 +180,9 @@ class XPStyle {
      * should probably be cached there instead of here.
      */
     Dimension getDimension(Component c, Part part, State state, Prop prop) {
-        Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
-                                              State.getValue(part, state),
-                                              prop.getValue());
-        return (d != null) ? d : new Dimension();
+        return ThemeReader.getPosition(part.getControlName(c), part.getValue(),
+                                       State.getValue(part, state),
+                                       prop.getValue());
     }
 
     /** Get a named <code>Point</code> (e.g. a location or an offset) value
@@ -200,7 +199,11 @@ class XPStyle {
         Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
                                               State.getValue(part, state),
                                               prop.getValue());
-        return (d != null) ? new Point(d.width, d.height) : new Point();
+        if (d != null) {
+            return new Point(d.width, d.height);
+        } else {
+            return null;
+        }
     }
 
     /** Get a named <code>Insets</code> value from the current style
@@ -214,10 +217,9 @@ class XPStyle {
      * The return value is already cached in those places.
      */
     Insets getMargin(Component c, Part part, State state, Prop prop) {
-        Insets insets = ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
-                                                    State.getValue(part, state),
-                                                    prop.getValue());
-        return (insets != null) ? insets : new Insets(0, 0, 0, 0);
+        return ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
+                                           State.getValue(part, state),
+                                           prop.getValue());
     }
 
 
@@ -507,17 +509,16 @@ class XPStyle {
             int boundingWidth = 100;
             int boundingHeight = 100;
 
-            Insets insets = ThemeReader.getThemeBackgroundContentMargins(
+            return ThemeReader.getThemeBackgroundContentMargins(
                 part.getControlName(null), part.getValue(),
                 0, boundingWidth, boundingHeight);
-            return (insets != null) ? insets : new Insets(0, 0, 0, 0);
         }
 
         private int getWidth(State state) {
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return (size != null) ? size.width : 0;
+            return size.width;
         }
 
         int getWidth() {
@@ -528,7 +529,7 @@ class XPStyle {
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return (size != null) ? size.height : 0;
+            return size.height;
         }
 
         int getHeight() {
@@ -585,9 +586,6 @@ class XPStyle {
          * @param state which state to paint
          */
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
-            if (XPStyle.getXP() == null) {
-                return;
-            }
             if (ThemeReader.isGetThemeTransitionDurationDefined()
                   && component instanceof JComponent
                   && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
@@ -613,9 +611,6 @@ class XPStyle {
          * @param state which state to paint
          */
         void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, State state) {
-            if (XPStyle.getXP() == null) {
-                return;
-            }
             skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
         }
 
@@ -635,7 +630,7 @@ class XPStyle {
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state,
                 boolean borderFill) {
             if(borderFill && "borderfill".equals(getTypeEnumName(component, part,
-                    state, Prop.BGTYPE)) && XPStyle.getXP() == null) {
+                    state, Prop.BGTYPE))) {
                 return;
             }
             skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
@@ -689,7 +684,7 @@ class XPStyle {
 
         public GlyphButton(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp != null ? xp.getSkin(parent, part) : null;
+            skin = xp.getSkin(parent, part);
             setBorder(null);
             setContentAreaFilled(false);
             setMinimumSize(new Dimension(5, 5));
@@ -714,16 +709,13 @@ class XPStyle {
         }
 
         public void paintComponent(Graphics g) {
-            if (XPStyle.getXP() == null || skin == null) {
-                return;
-            }
             Dimension d = getSize();
             skin.paintSkin(g, 0, 0, d.width, d.height, getState());
         }
 
         public void setPart(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp != null ? xp.getSkin(parent, part) : null;
+            skin = xp.getSkin(parent, part);
             revalidate();
             repaint();
         }
diff --git a/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java b/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java
index 5bd2f7ec0b8..7445cc2f5ff 100644
--- a/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java
+++ b/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java
@@ -45,10 +45,6 @@ public final class ThemeReader {
         return false;
     }
 
-    public static boolean isXPStyleEnabled() {
-        return false;
-    }
-
     public static void paintBackground(int[] buffer, String widget,
            int part, int state, int x, int y, int w, int h, int stride) {
     }
diff --git a/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java b/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java
index 321e72ca182..632489964e7 100644
--- a/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java
+++ b/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java
@@ -61,8 +61,6 @@ public final class ThemeReader {
     private static final Lock readLock = readWriteLock.readLock();
     private static final Lock writeLock = readWriteLock.writeLock();
 
-    static volatile boolean xpStyleEnabled;
-
     static void flush() {
         writeLock.lock();
         try {
@@ -78,10 +76,6 @@ public final class ThemeReader {
 
     public static native boolean isThemed();
 
-    public static boolean isXPStyleEnabled() {
-        return xpStyleEnabled;
-    }
-
     // this should be called only with writeLock held
     private static Long getThemeImpl(String widget) {
         Long theme = widgetToTheme.get(widget);
diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
index 630d29e7b75..2a27c2df9cc 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -72,9 +72,6 @@ public final class WToolkit extends SunToolkit implements Runnable {
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
 
-    // Desktop property which specifies whether XP visual styles are in effect
-    public static final String XPSTYLE_THEME_ACTIVE = "win.xpstyle.themeActive";
-
     static GraphicsConfiguration config;
 
     // System clipboard.
@@ -897,7 +894,7 @@ public final class WToolkit extends SunToolkit implements Runnable {
     private synchronized void lazilyInitWProps() {
         if (wprops == null) {
             wprops = new WDesktopProperties(this);
-            updateProperties(wprops.getProperties());
+            updateProperties();
         }
     }
 
@@ -932,27 +929,21 @@ public final class WToolkit extends SunToolkit implements Runnable {
      * Windows doesn't always send WM_SETTINGCHANGE when it should.
      */
     private void windowsSettingChange() {
-        // JDK-8039383: Have to update the value of XPSTYLE_THEME_ACTIVE property
-        // as soon as possible to prevent NPE and other errors because theme data
-        // has become unavailable.
-        final Map<String, Object> props = getWProps();
-        updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
-
         EventQueue.invokeLater(new Runnable() {
             @Override
             public void run() {
-                updateProperties(props);
+                updateProperties();
             }
         });
     }
 
-    private synchronized void updateProperties(final Map<String, Object> props) {
-        if (null == props) {
+    private synchronized void updateProperties() {
+        if (null == wprops) {
+            // wprops has not been initialized, so we have nothing to update
             return;
         }
 
-        updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
-
+        Map<String, Object> props = wprops.getProperties();
         for (String propName : props.keySet()) {
             Object val = props.get(propName);
             if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -962,14 +953,6 @@ public final class WToolkit extends SunToolkit implements Runnable {
         }
     }
 
-    private synchronized Map<String, Object> getWProps() {
-        return (wprops != null) ? wprops.getProperties() : null;
-    }
-
-    private void updateXPStyleEnabled(final Object dskProp) {
-        ThemeReader.xpStyleEnabled = Boolean.TRUE.equals(dskProp);
-    }
-
     @Override
     public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
         if (name == null) {
-- 
GitLab


From 6f97a45429b17cb9ccb178586e795c32fe3af795 Mon Sep 17 00:00:00 2001
From: David Simms <dsimms@openjdk.org>
Date: Wed, 11 Jun 2014 12:09:12 +0200
Subject: [PATCH 065/192] 6311046: -Xcheck:jni should support checking of
 GetPrimitiveArrayCritical

Wrapped memory with standard bounds checking "GuardedMemory".

Reviewed-by: zgu, fparain, dcubed
---
 hotspot/src/share/vm/memory/guardedMemory.cpp | 161 +++++++++
 hotspot/src/share/vm/memory/guardedMemory.hpp | 326 ++++++++++++++++++
 hotspot/src/share/vm/prims/jni.cpp            |   2 +
 hotspot/src/share/vm/prims/jniCheck.cpp       | 163 +++++++--
 hotspot/src/share/vm/runtime/os.cpp           | 212 +++---------
 5 files changed, 672 insertions(+), 192 deletions(-)
 create mode 100644 hotspot/src/share/vm/memory/guardedMemory.cpp
 create mode 100644 hotspot/src/share/vm/memory/guardedMemory.hpp

diff --git a/hotspot/src/share/vm/memory/guardedMemory.cpp b/hotspot/src/share/vm/memory/guardedMemory.cpp
new file mode 100644
index 00000000000..763548fd35d
--- /dev/null
+++ b/hotspot/src/share/vm/memory/guardedMemory.cpp
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "memory/allocation.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/guardedMemory.hpp"
+#include "runtime/os.hpp"
+
+void* GuardedMemory::wrap_copy(const void* ptr, const size_t len, const void* tag) {
+  size_t total_sz = GuardedMemory::get_total_size(len);
+  void* outerp = os::malloc(total_sz, mtInternal);
+  if (outerp != NULL) {
+    GuardedMemory guarded(outerp, len, tag);
+    void* innerp = guarded.get_user_ptr();
+    memcpy(innerp, ptr, len);
+    return innerp;
+  }
+  return NULL; // OOM
+}
+
+bool GuardedMemory::free_copy(void* p) {
+  if (p == NULL) {
+    return true;
+  }
+  GuardedMemory guarded((u_char*)p);
+  bool verify_ok = guarded.verify_guards();
+
+  /* always attempt to free, pass problem on to any nested memchecker */
+  os::free(guarded.release_for_freeing());
+
+  return verify_ok;
+}
+
+void GuardedMemory::print_on(outputStream* st) const {
+  if (_base_addr == NULL) {
+    st->print_cr("GuardedMemory(" PTR_FORMAT ") not associated to any memory", p2i(this));
+    return;
+  }
+  st->print_cr("GuardedMemory(" PTR_FORMAT ") base_addr=" PTR_FORMAT
+      " tag=" PTR_FORMAT " user_size=" SIZE_FORMAT " user_data=" PTR_FORMAT,
+      p2i(this), p2i(_base_addr), p2i(get_tag()), get_user_size(), p2i(get_user_ptr()));
+
+  Guard* guard = get_head_guard();
+  st->print_cr("  Header guard @" PTR_FORMAT " is %s", p2i(guard), (guard->verify() ? "OK" : "BROKEN"));
+  guard = get_tail_guard();
+  st->print_cr("  Trailer guard @" PTR_FORMAT " is %s", p2i(guard), (guard->verify() ? "OK" : "BROKEN"));
+
+  u_char udata = *get_user_ptr();
+  switch (udata) {
+  case uninitBlockPad:
+    st->print_cr("  User data appears unused");
+    break;
+  case freeBlockPad:
+    st->print_cr("  User data appears to have been freed");
+    break;
+  default:
+    st->print_cr("  User data appears to be in use");
+    break;
+  }
+}
+
+// test code...
+
+#ifndef PRODUCT
+
+static void guarded_memory_test_check(void* p, size_t sz, void* tag) {
+  assert(p != NULL, "NULL pointer given to check");
+  u_char* c = (u_char*) p;
+  GuardedMemory guarded(c);
+  assert(guarded.get_tag() == tag, "Tag is not the same as supplied");
+  assert(guarded.get_user_ptr() == c, "User pointer is not the same as supplied");
+  assert(guarded.get_user_size() == sz, "User size is not the same as supplied");
+  assert(guarded.verify_guards(), "Guard broken");
+}
+
+void GuardedMemory::test_guarded_memory() {
+  // Test the basic characteristics...
+  size_t total_sz = GuardedMemory::get_total_size(1);
+  assert(total_sz > 1 && total_sz >= (sizeof(GuardHeader) + 1 + sizeof(Guard)), "Unexpected size");
+  u_char* basep = (u_char*) os::malloc(total_sz, mtInternal);
+
+  GuardedMemory guarded(basep, 1, (void*)0xf000f000);
+
+  assert(*basep == badResourceValue, "Expected guard in the form of badResourceValue");
+  u_char* userp = guarded.get_user_ptr();
+  assert(*userp == uninitBlockPad, "Expected uninitialized data in the form of uninitBlockPad");
+  guarded_memory_test_check(userp, 1, (void*)0xf000f000);
+
+  void* freep = guarded.release_for_freeing();
+  assert((u_char*)freep == basep, "Expected the same pointer guard was ");
+  assert(*userp == freeBlockPad, "Expected user data to be free block padded");
+  assert(!guarded.verify_guards(), "Expected failed");
+  os::free(freep);
+
+  // Test a number of odd sizes...
+  size_t sz = 0;
+  do {
+    void* p = os::malloc(GuardedMemory::get_total_size(sz), mtInternal);
+    void* up = guarded.wrap_with_guards(p, sz, (void*)1);
+    memset(up, 0, sz);
+    guarded_memory_test_check(up, sz, (void*)1);
+    os::free(guarded.release_for_freeing());
+    sz = (sz << 4) + 1;
+  } while (sz < (256 * 1024));
+
+  // Test buffer overrun into head...
+  basep = (u_char*) os::malloc(GuardedMemory::get_total_size(1), mtInternal);
+  guarded.wrap_with_guards(basep, 1);
+  *basep = 0;
+  assert(!guarded.verify_guards(), "Expected failure");
+  os::free(basep);
+
+  // Test buffer overrun into tail with a number of odd sizes...
+  sz = 1;
+  do {
+    void* p = os::malloc(GuardedMemory::get_total_size(sz), mtInternal);
+    void* up = guarded.wrap_with_guards(p, sz, (void*)1);
+    memset(up, 0, sz + 1); // Buffer-overwrite (within guard)
+    assert(!guarded.verify_guards(), "Guard was not broken as expected");
+    os::free(guarded.release_for_freeing());
+    sz = (sz << 4) + 1;
+  } while (sz < (256 * 1024));
+
+  // Test wrap_copy/wrap_free...
+  assert(GuardedMemory::free_copy(NULL), "Expected free NULL to be OK");
+
+  const char* str = "Check my bounds out";
+  size_t str_sz = strlen(str) + 1;
+  char* str_copy = (char*) GuardedMemory::wrap_copy(str, str_sz);
+  guarded_memory_test_check(str_copy, str_sz, NULL);
+  assert(strcmp(str, str_copy) == 0, "Not identical copy");
+  assert(GuardedMemory::free_copy(str_copy), "Free copy failed to verify");
+
+  void* no_data = NULL;
+  void* no_data_copy = GuardedMemory::wrap_copy(no_data, 0);
+  assert(GuardedMemory::free_copy(no_data_copy), "Expected valid guards even for no data copy");
+}
+
+#endif // !PRODUCT
+
diff --git a/hotspot/src/share/vm/memory/guardedMemory.hpp b/hotspot/src/share/vm/memory/guardedMemory.hpp
new file mode 100644
index 00000000000..dada10d84bf
--- /dev/null
+++ b/hotspot/src/share/vm/memory/guardedMemory.hpp
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_MEMORY_GUARDED_MEMORY_HPP
+#define SHARE_VM_MEMORY_GUARDED_MEMORY_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+/**
+ * Guarded memory for detecting buffer overrun.
+ *
+ * Allows allocations to be wrapped with padded bytes of a known byte pattern,
+ * that is a "guard". Guard patterns may be verified to detect buffer overruns.
+ *
+ * Primarily used by "debug malloc" and "checked JNI".
+ *
+ * Memory layout:
+ *
+ * |Offset             | Content              | Description    |
+ * |------------------------------------------------------------
+ * |base_addr          | 0xABABABABABABABAB   | Head guard     |
+ * |+16                | <size_t:user_size>   | User data size |
+ * |+sizeof(uintptr_t) | <tag>                | Tag word       |
+ * |+sizeof(void*)     | 0xF1 <user_data> (   | User data      |
+ * |+user_size         | 0xABABABABABABABAB   | Tail guard     |
+ * -------------------------------------------------------------
+ *
+ * Where:
+ *  - guard padding uses "badResourceValue" (0xAB)
+ *  - tag word is general purpose
+ *  - user data
+ *    -- initially padded with "uninitBlockPad" (0xF1),
+ *    -- to "freeBlockPad" (0xBA), when freed
+ *
+ * Usage:
+ *
+ * * Allocations: one may wrap allocations with guard memory:
+ * <code>
+ *   Thing* alloc_thing() {
+ *     void* mem = user_alloc_fn(GuardedMemory::get_total_size(sizeof(thing)));
+ *     GuardedMemory guarded(mem, sizeof(thing));
+ *     return (Thing*) guarded.get_user_ptr();
+ *   }
+ * </code>
+ * * Verify: memory guards are still in tact
+ * <code>
+ *   bool verify_thing(Thing* thing) {
+ *     GuardedMemory guarded((void*)thing);
+ *     return guarded.verify_guards();
+ *   }
+ * </code>
+ * * Free: one may mark bytes as freed (further debugging support)
+ * <code>
+ *   void free_thing(Thing* thing) {
+ *    GuardedMemory guarded((void*)thing);
+ *    assert(guarded.verify_guards(), "Corrupt thing");
+ *    user_free_fn(guards.release_for_freeing();
+ *   }
+ * </code>
+ */
+class GuardedMemory : StackObj { // Wrapper on stack
+
+  // Private inner classes for memory layout...
+
+protected:
+
+  /**
+   * Guard class for header and trailer known pattern to test for overwrites.
+   */
+  class Guard { // Class for raw memory (no vtbl allowed)
+    friend class GuardedMemory;
+   protected:
+    enum {
+      GUARD_SIZE = 16
+    };
+
+    u_char _guard[GUARD_SIZE];
+
+   public:
+
+    void build() {
+      u_char* c = _guard; // Possibly unaligned if tail guard
+      u_char* end = c + GUARD_SIZE;
+      while (c < end) {
+        *c = badResourceValue;
+        c++;
+      }
+    }
+
+    bool verify() const {
+      u_char* c = (u_char*) _guard;
+      u_char* end = c + GUARD_SIZE;
+      while (c < end) {
+        if (*c != badResourceValue) {
+          return false;
+        }
+        c++;
+      }
+      return true;
+    }
+
+  }; // GuardedMemory::Guard
+
+  /**
+   * Header guard and size
+   */
+  class GuardHeader : Guard {
+    friend class GuardedMemory;
+   protected:
+    // Take care in modifying fields here, will effect alignment
+    // e.g. x86 ABI 16 byte stack alignment
+    union {
+      uintptr_t __unused_full_word1;
+      size_t _user_size;
+    };
+    void* _tag;
+   public:
+    void set_user_size(const size_t usz) { _user_size = usz; }
+    size_t get_user_size() const { return _user_size; }
+
+    void set_tag(const void* tag) { _tag = (void*) tag; }
+    void* get_tag() const { return _tag; }
+
+  }; // GuardedMemory::GuardHeader
+
+  // Guarded Memory...
+
+ protected:
+  u_char* _base_addr;
+
+ public:
+
+  /**
+   * Create new guarded memory.
+   *
+   * Wraps, starting at the given "base_ptr" with guards. Use "get_user_ptr()"
+   * to return a pointer suitable for user data.
+   *
+   * @param base_ptr  allocation wishing to be wrapped, must be at least "GuardedMemory::get_total_size()" bytes.
+   * @param user_size the size of the user data to be wrapped.
+   * @param tag       optional general purpose tag.
+   */
+  GuardedMemory(void* base_ptr, const size_t user_size, const void* tag = NULL) {
+    wrap_with_guards(base_ptr, user_size, tag);
+  }
+
+  /**
+   * Wrap existing guarded memory.
+   *
+   * To use this constructor, one must have created guarded memory with
+   * "GuardedMemory(void*, size_t, void*)" (or indirectly via helper, e.g. "wrap_copy()").
+   *
+   * @param user_p  existing wrapped memory.
+   */
+  GuardedMemory(void* userp) {
+    u_char* user_ptr = (u_char*) userp;
+    assert((uintptr_t)user_ptr > (sizeof(GuardHeader) + 0x1000), "Invalid pointer");
+    _base_addr = (user_ptr - sizeof(GuardHeader));
+  }
+
+  /**
+   * Create new guarded memory.
+   *
+   * Wraps, starting at the given "base_ptr" with guards. Allows reuse of stack allocated helper.
+   *
+   * @param base_ptr  allocation wishing to be wrapped, must be at least "GuardedMemory::get_total_size()" bytes.
+   * @param user_size the size of the user data to be wrapped.
+   * @param tag       optional general purpose tag.
+   *
+   * @return user data pointer (inner pointer to supplied "base_ptr").
+   */
+  void* wrap_with_guards(void* base_ptr, size_t user_size, const void* tag = NULL) {
+    assert(base_ptr != NULL, "Attempt to wrap NULL with memory guard");
+    _base_addr = (u_char*)base_ptr;
+    get_head_guard()->build();
+    get_head_guard()->set_user_size(user_size);
+    get_tail_guard()->build();
+    set_tag(tag);
+    set_user_bytes(uninitBlockPad);
+    assert(verify_guards(), "Expected valid memory guards");
+    return get_user_ptr();
+  }
+
+  /**
+   * Verify head and tail guards.
+   *
+   * @return true if guards are intact, false would indicate a buffer overrun.
+   */
+  bool verify_guards() const {
+    if (_base_addr != NULL) {
+      return (get_head_guard()->verify() && get_tail_guard()->verify());
+    }
+    return false;
+  }
+
+  /**
+   * Set the general purpose tag.
+   *
+   * @param tag general purpose tag.
+   */
+  void set_tag(const void* tag) { get_head_guard()->set_tag(tag); }
+
+  /**
+   * Return the general purpose tag.
+   *
+   * @return the general purpose tag, defaults to NULL.
+   */
+  void* get_tag() const { return get_head_guard()->get_tag(); }
+
+  /**
+   * Return the size of the user data.
+   *
+   * @return the size of the user data.
+   */
+  size_t get_user_size() const {
+    assert(_base_addr, "Not wrapping any memory");
+    return get_head_guard()->get_user_size();
+  }
+
+  /**
+   * Return the user data pointer.
+   *
+   * @return the user data pointer.
+   */
+  u_char* get_user_ptr() const {
+    assert(_base_addr, "Not wrapping any memory");
+    return _base_addr + sizeof(GuardHeader);
+  }
+
+  /**
+   * Release the wrapped pointer for resource freeing.
+   *
+   * Pads the user data with "freeBlockPad", and dis-associates the helper.
+   *
+   * @return the original base pointer used to wrap the data.
+   */
+  void* release_for_freeing() {
+    set_user_bytes(freeBlockPad);
+    return release();
+  }
+
+  /**
+   * Dis-associate the help from the original base address.
+   *
+   * @return the original base pointer used to wrap the data.
+   */
+  void* release() {
+    void* p = (void*) _base_addr;
+    _base_addr = NULL;
+    return p;
+  }
+
+  virtual void print_on(outputStream* st) const;
+
+ protected:
+  GuardHeader*  get_head_guard() const { return (GuardHeader*) _base_addr; }
+  Guard*        get_tail_guard() const { return (Guard*) (get_user_ptr() + get_user_size()); };
+  void set_user_bytes(u_char ch) {
+    memset(get_user_ptr(), ch, get_user_size());
+  }
+
+public:
+  /**
+   * Return the total size required for wrapping the given user size.
+   *
+   * @return the total size required for wrapping the given user size.
+   */
+  static size_t get_total_size(size_t user_size) {
+    size_t total_size = sizeof(GuardHeader) + user_size + sizeof(Guard);
+    assert(total_size > user_size, "Unexpected wrap-around");
+    return total_size;
+  }
+
+  // Helper functions...
+
+  /**
+   * Wrap a copy of size "len" of "ptr".
+   *
+   * @param ptr the memory to be copied
+   * @param len the length of the copy
+   * @param tag optional general purpose tag (see GuardedMemory::get_tag())
+   *
+   * @return guarded wrapped memory pointer to the user area, or NULL if OOM.
+   */
+  static void* wrap_copy(const void* p, const size_t len, const void* tag = NULL);
+
+  /**
+   * Free wrapped copy.
+   *
+   * Frees memory copied with "wrap_copy()".
+   *
+   * @param p memory returned by "wrap_copy()".
+   *
+   * @return true if guards were verified as intact. false indicates a buffer overrun.
+   */
+  static bool free_copy(void* p);
+
+  // Testing...
+#ifndef PRODUCT
+  static void test_guarded_memory(void);
+#endif
+}; // GuardedMemory
+
+#endif // SHARE_VM_MEMORY_GUARDED_MEMORY_HPP
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index 6bbe5feb691..cdb53afe1b7 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -3858,6 +3858,7 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) {
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #endif
+#include "memory/guardedMemory.hpp"
 #include "utilities/quickSort.hpp"
 #include "utilities/ostream.hpp"
 #if INCLUDE_VM_STRUCTS
@@ -3901,6 +3902,7 @@ void execute_internal_vm_tests() {
     run_unit_test(arrayOopDesc::test_max_array_length());
     run_unit_test(CollectedHeap::test_is_in());
     run_unit_test(QuickSort::test_quick_sort());
+    run_unit_test(GuardedMemory::test_guarded_memory());
     run_unit_test(AltHashing::test_alt_hash());
     run_unit_test(test_loggc_filename());
     run_unit_test(TestNewSize_test());
diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp
index 0d5ffab1cdc..446c23143ae 100644
--- a/hotspot/src/share/vm/prims/jniCheck.cpp
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "memory/guardedMemory.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
@@ -323,6 +324,74 @@ check_is_obj_array(JavaThread* thr, jarray jArray) {
   }
 }
 
+/*
+ * Copy and wrap array elements for bounds checking.
+ * Remember the original elements (GuardedMemory::get_tag())
+ */
+static void* check_jni_wrap_copy_array(JavaThread* thr, jarray array,
+    void* orig_elements) {
+  void* result;
+  IN_VM(
+    oop a = JNIHandles::resolve_non_null(array);
+    size_t len = arrayOop(a)->length() <<
+        TypeArrayKlass::cast(a->klass())->log2_element_size();
+    result = GuardedMemory::wrap_copy(orig_elements, len, orig_elements);
+  )
+  return result;
+}
+
+static void* check_wrapped_array(JavaThread* thr, const char* fn_name,
+    void* obj, void* carray, size_t* rsz) {
+  if (carray == NULL) {
+    tty->print_cr("%s: elements vector NULL" PTR_FORMAT, fn_name, p2i(obj));
+    NativeReportJNIFatalError(thr, "Elements vector NULL");
+  }
+  GuardedMemory guarded(carray);
+  void* orig_result = guarded.get_tag();
+  if (!guarded.verify_guards()) {
+    tty->print_cr("ReleasePrimitiveArrayCritical: release array failed bounds "
+        "check, incorrect pointer returned ? array: " PTR_FORMAT " carray: "
+        PTR_FORMAT, p2i(obj), p2i(carray));
+    guarded.print_on(tty);
+    NativeReportJNIFatalError(thr, "ReleasePrimitiveArrayCritical: "
+        "failed bounds check");
+  }
+  if (orig_result == NULL) {
+    tty->print_cr("ReleasePrimitiveArrayCritical: unrecognized elements. array: "
+        PTR_FORMAT " carray: " PTR_FORMAT, p2i(obj), p2i(carray));
+    guarded.print_on(tty);
+    NativeReportJNIFatalError(thr, "ReleasePrimitiveArrayCritical: "
+        "unrecognized elements");
+  }
+  if (rsz != NULL) {
+    *rsz = guarded.get_user_size();
+  }
+  return orig_result;
+}
+
+static void* check_wrapped_array_release(JavaThread* thr, const char* fn_name,
+    void* obj, void* carray, jint mode) {
+  size_t sz;
+  void* orig_result = check_wrapped_array(thr, fn_name, obj, carray, &sz);
+  switch (mode) {
+  case 0:
+    memcpy(orig_result, carray, sz);
+    GuardedMemory::free_copy(carray);
+    break;
+  case JNI_COMMIT:
+    memcpy(orig_result, carray, sz);
+    break;
+  case JNI_ABORT:
+    GuardedMemory::free_copy(carray);
+    break;
+  default:
+    tty->print_cr("%s: Unrecognized mode %i releasing array "
+        PTR_FORMAT " elements " PTR_FORMAT, fn_name, mode, p2i(obj), p2i(carray));
+    NativeReportJNIFatalError(thr, "Unrecognized array release mode");
+  }
+  return orig_result;
+}
+
 oop jniCheck::validate_handle(JavaThread* thr, jobject obj) {
   if (JNIHandles::is_frame_handle(thr, obj) ||
       JNIHandles::is_local_handle(thr, obj) ||
@@ -1314,7 +1383,7 @@ JNI_ENTRY_CHECKED(jsize,
 JNI_END
 
 // Arbitrary (but well-known) tag
-const jint STRING_TAG = 0x47114711;
+const void* STRING_TAG = (void*)0x47114711;
 
 JNI_ENTRY_CHECKED(const jchar *,
   checked_jni_GetStringChars(JNIEnv *env,
@@ -1324,21 +1393,22 @@ JNI_ENTRY_CHECKED(const jchar *,
     IN_VM(
       checkString(thr, str);
     )
-    jchar* newResult = NULL;
+    jchar* new_result = NULL;
     const jchar *result = UNCHECKED()->GetStringChars(env,str,isCopy);
     assert (isCopy == NULL || *isCopy == JNI_TRUE, "GetStringChars didn't return a copy as expected");
     if (result != NULL) {
       size_t len = UNCHECKED()->GetStringLength(env,str) + 1; // + 1 for NULL termination
-      jint* tagLocation = (jint*) AllocateHeap(len * sizeof(jchar) + sizeof(jint), mtInternal);
-      *tagLocation = STRING_TAG;
-      newResult = (jchar*) (tagLocation + 1);
-      memcpy(newResult, result, len * sizeof(jchar));
+      len *= sizeof(jchar);
+      new_result = (jchar*) GuardedMemory::wrap_copy(result, len, STRING_TAG);
+      if (new_result == NULL) {
+        vm_exit_out_of_memory(len, OOM_MALLOC_ERROR, "checked_jni_GetStringChars");
+      }
       // Avoiding call to UNCHECKED()->ReleaseStringChars() since that will fire unexpected dtrace probes
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
       FreeHeap((char*)result);
     }
     functionExit(env);
-    return newResult;
+    return new_result;
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1354,11 +1424,23 @@ JNI_ENTRY_CHECKED(void,
        UNCHECKED()->ReleaseStringChars(env,str,chars);
     }
     else {
-       jint* tagLocation = ((jint*) chars) - 1;
-       if (*tagLocation != STRING_TAG) {
-          NativeReportJNIFatalError(thr, "ReleaseStringChars called on something not allocated by GetStringChars");
-       }
-       UNCHECKED()->ReleaseStringChars(env,str,(const jchar*)tagLocation);
+      GuardedMemory guarded((void*)chars);
+      if (guarded.verify_guards()) {
+        tty->print_cr("ReleaseStringChars: release chars failed bounds check. "
+            "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
+        guarded.print_on(tty);
+        NativeReportJNIFatalError(thr, "ReleaseStringChars: "
+            "release chars failed bounds check.");
+      }
+      if (guarded.get_tag() != STRING_TAG) {
+        tty->print_cr("ReleaseStringChars: called on something not allocated "
+            "by GetStringChars. string: " PTR_FORMAT " chars: " PTR_FORMAT,
+            p2i(str), p2i(chars));
+        NativeReportJNIFatalError(thr, "ReleaseStringChars called on something "
+            "not allocated by GetStringChars");
+      }
+       UNCHECKED()->ReleaseStringChars(env, str,
+           (const jchar*) guarded.release_for_freeing());
     }
     functionExit(env);
 JNI_END
@@ -1385,7 +1467,7 @@ JNI_ENTRY_CHECKED(jsize,
 JNI_END
 
 // Arbitrary (but well-known) tag - different than GetStringChars
-const jint STRING_UTF_TAG = 0x48124812;
+const void* STRING_UTF_TAG = (void*) 0x48124812;
 
 JNI_ENTRY_CHECKED(const char *,
   checked_jni_GetStringUTFChars(JNIEnv *env,
@@ -1395,21 +1477,21 @@ JNI_ENTRY_CHECKED(const char *,
     IN_VM(
       checkString(thr, str);
     )
-    char* newResult = NULL;
+    char* new_result = NULL;
     const char *result = UNCHECKED()->GetStringUTFChars(env,str,isCopy);
     assert (isCopy == NULL || *isCopy == JNI_TRUE, "GetStringUTFChars didn't return a copy as expected");
     if (result != NULL) {
       size_t len = strlen(result) + 1; // + 1 for NULL termination
-      jint* tagLocation = (jint*) AllocateHeap(len + sizeof(jint), mtInternal);
-      *tagLocation = STRING_UTF_TAG;
-      newResult = (char*) (tagLocation + 1);
-      strcpy(newResult, result);
+      new_result = (char*) GuardedMemory::wrap_copy(result, len, STRING_UTF_TAG);
+      if (new_result == NULL) {
+        vm_exit_out_of_memory(len, OOM_MALLOC_ERROR, "checked_jni_GetStringUTFChars");
+      }
       // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
       FreeHeap((char*)result, mtInternal);
     }
     functionExit(env);
-    return newResult;
+    return new_result;
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1425,11 +1507,23 @@ JNI_ENTRY_CHECKED(void,
        UNCHECKED()->ReleaseStringUTFChars(env,str,chars);
     }
     else {
-       jint* tagLocation = ((jint*) chars) - 1;
-       if (*tagLocation != STRING_UTF_TAG) {
-          NativeReportJNIFatalError(thr, "ReleaseStringUTFChars called on something not allocated by GetStringUTFChars");
-       }
-       UNCHECKED()->ReleaseStringUTFChars(env,str,(const char*)tagLocation);
+      GuardedMemory guarded((void*)chars);
+      if (guarded.verify_guards()) {
+        tty->print_cr("ReleaseStringUTFChars: release chars failed bounds check. "
+            "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
+        guarded.print_on(tty);
+        NativeReportJNIFatalError(thr, "ReleaseStringUTFChars: "
+            "release chars failed bounds check.");
+      }
+      if (guarded.get_tag() != STRING_UTF_TAG) {
+        tty->print_cr("ReleaseStringUTFChars: called on something not "
+            "allocated by GetStringUTFChars. string: " PTR_FORMAT " chars: "
+            PTR_FORMAT, p2i(str), p2i(chars));
+        NativeReportJNIFatalError(thr, "ReleaseStringUTFChars "
+            "called on something not allocated by GetStringUTFChars");
+      }
+      UNCHECKED()->ReleaseStringUTFChars(env, str,
+          (const char*) guarded.release_for_freeing());
     }
     functionExit(env);
 JNI_END
@@ -1514,6 +1608,9 @@ JNI_ENTRY_CHECKED(ElementType *,  \
     ElementType *result = UNCHECKED()->Get##Result##ArrayElements(env, \
                                                                   array, \
                                                                   isCopy); \
+    if (result != NULL) { \
+      result = (ElementType *) check_jni_wrap_copy_array(thr, array, result); \
+    } \
     functionExit(env); \
     return result; \
 JNI_END
@@ -1538,12 +1635,10 @@ JNI_ENTRY_CHECKED(void,  \
       check_primitive_array_type(thr, array, ElementTag); \
       ASSERT_OOPS_ALLOWED; \
       typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(array)); \
-      /* cannot check validity of copy, unless every request is logged by
-       * checking code.  Implementation of this check is deferred until a
-       * subsequent release.
-       */ \
     ) \
-    UNCHECKED()->Release##Result##ArrayElements(env,array,elems,mode); \
+    ElementType* orig_result = (ElementType *) check_wrapped_array_release( \
+        thr, "checked_jni_Release"#Result"ArrayElements", array, elems, mode); \
+    UNCHECKED()->Release##Result##ArrayElements(env, array, orig_result, mode); \
     functionExit(env); \
 JNI_END
 
@@ -1694,6 +1789,9 @@ JNI_ENTRY_CHECKED(void *,
       check_is_primitive_array(thr, array);
     )
     void *result = UNCHECKED()->GetPrimitiveArrayCritical(env, array, isCopy);
+    if (result != NULL) {
+      result = check_jni_wrap_copy_array(thr, array, result);
+    }
     functionExit(env);
     return result;
 JNI_END
@@ -1707,10 +1805,9 @@ JNI_ENTRY_CHECKED(void,
     IN_VM(
       check_is_primitive_array(thr, array);
     )
-    /* The Hotspot JNI code does not use the parameters, so just check the
-     * array parameter as a minor sanity check
-     */
-    UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, carray, mode);
+    // Check the element array...
+    void* orig_result = check_wrapped_array_release(thr, "ReleasePrimitiveArrayCritical", array, carray, mode);
+    UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, orig_result, mode);
     functionExit(env);
 JNI_END
 
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 04c008431c7..dc5d664989b 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -32,6 +32,9 @@
 #include "gc_implementation/shared/vmGCOperations.hpp"
 #include "interpreter/interpreter.hpp"
 #include "memory/allocation.inline.hpp"
+#ifdef ASSERT
+#include "memory/guardedMemory.hpp"
+#endif
 #include "oops/oop.inline.hpp"
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
@@ -523,121 +526,20 @@ char *os::strdup(const char *str, MEMFLAGS flags) {
 }
 
 
-
-#ifdef ASSERT
-#define space_before             (MallocCushion + sizeof(double))
-#define space_after              MallocCushion
-#define size_addr_from_base(p)   (size_t*)(p + space_before - sizeof(size_t))
-#define size_addr_from_obj(p)    ((size_t*)p - 1)
-// MallocCushion: size of extra cushion allocated around objects with +UseMallocOnly
-// NB: cannot be debug variable, because these aren't set from the command line until
-// *after* the first few allocs already happened
-#define MallocCushion            16
-#else
-#define space_before             0
-#define space_after              0
-#define size_addr_from_base(p)   should not use w/o ASSERT
-#define size_addr_from_obj(p)    should not use w/o ASSERT
-#define MallocCushion            0
-#endif
 #define paranoid                 0  /* only set to 1 if you suspect checking code has bug */
 
 #ifdef ASSERT
-inline size_t get_size(void* obj) {
-  size_t size = *size_addr_from_obj(obj);
-  if (size < 0) {
-    fatal(err_msg("free: size field of object #" PTR_FORMAT " was overwritten ("
-                  SIZE_FORMAT ")", obj, size));
-  }
-  return size;
-}
 
-u_char* find_cushion_backwards(u_char* start) {
-  u_char* p = start;
-  while (p[ 0] != badResourceValue || p[-1] != badResourceValue ||
-         p[-2] != badResourceValue || p[-3] != badResourceValue) p--;
-  // ok, we have four consecutive marker bytes; find start
-  u_char* q = p - 4;
-  while (*q == badResourceValue) q--;
-  return q + 1;
-}
-
-u_char* find_cushion_forwards(u_char* start) {
-  u_char* p = start;
-  while (p[0] != badResourceValue || p[1] != badResourceValue ||
-         p[2] != badResourceValue || p[3] != badResourceValue) p++;
-  // ok, we have four consecutive marker bytes; find end of cushion
-  u_char* q = p + 4;
-  while (*q == badResourceValue) q++;
-  return q - MallocCushion;
-}
-
-void print_neighbor_blocks(void* ptr) {
-  // find block allocated before ptr (not entirely crash-proof)
-  if (MallocCushion < 4) {
-    tty->print_cr("### cannot find previous block (MallocCushion < 4)");
-    return;
-  }
-  u_char* start_of_this_block = (u_char*)ptr - space_before;
-  u_char* end_of_prev_block_data = start_of_this_block - space_after -1;
-  // look for cushion in front of prev. block
-  u_char* start_of_prev_block = find_cushion_backwards(end_of_prev_block_data);
-  ptrdiff_t size = *size_addr_from_base(start_of_prev_block);
-  u_char* obj = start_of_prev_block + space_before;
-  if (size <= 0 ) {
-    // start is bad; may have been confused by OS data in between objects
-    // search one more backwards
-    start_of_prev_block = find_cushion_backwards(start_of_prev_block);
-    size = *size_addr_from_base(start_of_prev_block);
-    obj = start_of_prev_block + space_before;
-  }
-
-  if (start_of_prev_block + space_before + size + space_after == start_of_this_block) {
-    tty->print_cr("### previous object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
-  } else {
-    tty->print_cr("### previous object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
-  }
-
-  // now find successor block
-  u_char* start_of_next_block = (u_char*)ptr + *size_addr_from_obj(ptr) + space_after;
-  start_of_next_block = find_cushion_forwards(start_of_next_block);
-  u_char* next_obj = start_of_next_block + space_before;
-  ptrdiff_t next_size = *size_addr_from_base(start_of_next_block);
-  if (start_of_next_block[0] == badResourceValue &&
-      start_of_next_block[1] == badResourceValue &&
-      start_of_next_block[2] == badResourceValue &&
-      start_of_next_block[3] == badResourceValue) {
-    tty->print_cr("### next object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", next_obj, next_size);
-  } else {
-    tty->print_cr("### next object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", next_obj, next_size);
+static void verify_memory(void* ptr) {
+  GuardedMemory guarded(ptr);
+  if (!guarded.verify_guards()) {
+    tty->print_cr("## nof_mallocs = " UINT64_FORMAT ", nof_frees = " UINT64_FORMAT, os::num_mallocs, os::num_frees);
+    tty->print_cr("## memory stomp:");
+    guarded.print_on(tty);
+    fatal("memory stomping error");
   }
 }
 
-
-void report_heap_error(void* memblock, void* bad, const char* where) {
-  tty->print_cr("## nof_mallocs = " UINT64_FORMAT ", nof_frees = " UINT64_FORMAT, os::num_mallocs, os::num_frees);
-  tty->print_cr("## memory stomp: byte at " PTR_FORMAT " %s object " PTR_FORMAT, bad, where, memblock);
-  print_neighbor_blocks(memblock);
-  fatal("memory stomping error");
-}
-
-void verify_block(void* memblock) {
-  size_t size = get_size(memblock);
-  if (MallocCushion) {
-    u_char* ptr = (u_char*)memblock - space_before;
-    for (int i = 0; i < MallocCushion; i++) {
-      if (ptr[i] != badResourceValue) {
-        report_heap_error(memblock, ptr+i, "in front of");
-      }
-    }
-    u_char* end = (u_char*)memblock + size + space_after;
-    for (int j = -MallocCushion; j < 0; j++) {
-      if (end[j] != badResourceValue) {
-        report_heap_error(memblock, end+j, "after");
-      }
-    }
-  }
-}
 #endif
 
 //
@@ -686,16 +588,18 @@ void* os::malloc(size_t size, MEMFLAGS memflags, address caller) {
     size = 1;
   }
 
-  const size_t alloc_size = size + space_before + space_after;
-
+#ifndef ASSERT
+  const size_t alloc_size = size;
+#else
+  const size_t alloc_size = GuardedMemory::get_total_size(size);
   if (size > alloc_size) { // Check for rollover.
     return NULL;
   }
+#endif
 
   NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
 
   u_char* ptr;
-
   if (MallocMaxTestWords > 0) {
     ptr = testMalloc(alloc_size);
   } else {
@@ -703,28 +607,26 @@ void* os::malloc(size_t size, MEMFLAGS memflags, address caller) {
   }
 
 #ifdef ASSERT
-  if (ptr == NULL) return NULL;
-  if (MallocCushion) {
-    for (u_char* p = ptr; p < ptr + MallocCushion; p++) *p = (u_char)badResourceValue;
-    u_char* end = ptr + space_before + size;
-    for (u_char* pq = ptr+MallocCushion; pq < end; pq++) *pq = (u_char)uninitBlockPad;
-    for (u_char* q = end; q < end + MallocCushion; q++) *q = (u_char)badResourceValue;
-  }
-  // put size just before data
-  *size_addr_from_base(ptr) = size;
+  if (ptr == NULL) {
+    return NULL;
+  }
+  // Wrap memory with guard
+  GuardedMemory guarded(ptr, size);
+  ptr = guarded.get_user_ptr();
 #endif
-  u_char* memblock = ptr + space_before;
-  if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) {
-    tty->print_cr("os::malloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, memblock);
+  if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) {
+    tty->print_cr("os::malloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr);
     breakpoint();
   }
-  debug_only(if (paranoid) verify_block(memblock));
-  if (PrintMalloc && tty != NULL) tty->print_cr("os::malloc " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, memblock);
+  debug_only(if (paranoid) verify_memory(ptr));
+  if (PrintMalloc && tty != NULL) {
+    tty->print_cr("os::malloc " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr);
+  }
 
-  // we do not track MallocCushion memory
-    MemTracker::record_malloc((address)memblock, size, memflags, caller == 0 ? CALLER_PC : caller);
+  // we do not track guard memory
+  MemTracker::record_malloc((address)ptr, size, memflags, caller == 0 ? CALLER_PC : caller);
 
-  return memblock;
+  return ptr;
 }
 
 
@@ -743,27 +645,32 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, address caller
   return ptr;
 #else
   if (memblock == NULL) {
-    return malloc(size, memflags, (caller == 0 ? CALLER_PC : caller));
+    return os::malloc(size, memflags, (caller == 0 ? CALLER_PC : caller));
   }
   if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) {
     tty->print_cr("os::realloc caught " PTR_FORMAT, memblock);
     breakpoint();
   }
-  verify_block(memblock);
+  verify_memory(memblock);
   NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
-  if (size == 0) return NULL;
+  if (size == 0) {
+    return NULL;
+  }
   // always move the block
-  void* ptr = malloc(size, memflags, caller == 0 ? CALLER_PC : caller);
-  if (PrintMalloc) tty->print_cr("os::remalloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr);
+  void* ptr = os::malloc(size, memflags, caller == 0 ? CALLER_PC : caller);
+  if (PrintMalloc) {
+    tty->print_cr("os::remalloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr);
+  }
   // Copy to new memory if malloc didn't fail
   if ( ptr != NULL ) {
-    memcpy(ptr, memblock, MIN2(size, get_size(memblock)));
-    if (paranoid) verify_block(ptr);
+    GuardedMemory guarded(memblock);
+    memcpy(ptr, memblock, MIN2(size, guarded.get_user_size()));
+    if (paranoid) verify_memory(ptr);
     if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) {
       tty->print_cr("os::realloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr);
       breakpoint();
     }
-    free(memblock);
+    os::free(memblock);
   }
   return ptr;
 #endif
@@ -771,6 +678,7 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, address caller
 
 
 void  os::free(void *memblock, MEMFLAGS memflags) {
+  address trackp = (address) memblock;
   NOT_PRODUCT(inc_stat_counter(&num_frees, 1));
 #ifdef ASSERT
   if (memblock == NULL) return;
@@ -778,34 +686,20 @@ void  os::free(void *memblock, MEMFLAGS memflags) {
     if (tty != NULL) tty->print_cr("os::free caught " PTR_FORMAT, memblock);
     breakpoint();
   }
-  verify_block(memblock);
+  verify_memory(memblock);
   NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
-  // Added by detlefs.
-  if (MallocCushion) {
-    u_char* ptr = (u_char*)memblock - space_before;
-    for (u_char* p = ptr; p < ptr + MallocCushion; p++) {
-      guarantee(*p == badResourceValue,
-                "Thing freed should be malloc result.");
-      *p = (u_char)freeBlockPad;
-    }
-    size_t size = get_size(memblock);
-    inc_stat_counter(&free_bytes, size);
-    u_char* end = ptr + space_before + size;
-    for (u_char* q = end; q < end + MallocCushion; q++) {
-      guarantee(*q == badResourceValue,
-                "Thing freed should be malloc result.");
-      *q = (u_char)freeBlockPad;
-    }
-    if (PrintMalloc && tty != NULL)
+
+  GuardedMemory guarded(memblock);
+  size_t size = guarded.get_user_size();
+  inc_stat_counter(&free_bytes, size);
+  memblock = guarded.release_for_freeing();
+  if (PrintMalloc && tty != NULL) {
       fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, (uintptr_t)memblock);
-  } else if (PrintMalloc && tty != NULL) {
-    // tty->print_cr("os::free %p", memblock);
-    fprintf(stderr, "os::free " PTR_FORMAT "\n", (uintptr_t)memblock);
   }
 #endif
-  MemTracker::record_free((address)memblock, memflags);
+  MemTracker::record_free(trackp, memflags);
 
-  ::free((char*)memblock - space_before);
+  ::free(memblock);
 }
 
 void os::init_random(long initval) {
-- 
GitLab


From b6a2f946f6c80c2dc54a3d315ea3dae5d30b6829 Mon Sep 17 00:00:00 2001
From: Harold Seigel <hseigel@openjdk.org>
Date: Wed, 11 Jun 2014 09:58:23 -0400
Subject: [PATCH 066/192] 8031819: Remove legacy jdk checks and code

Delete old jdk specific code.

Reviewed-by: dholmes, coleenp, zgu, lfoltan
---
 .../share/vm/classfile/classFileParser.cpp    |  4 +-
 .../src/share/vm/classfile/classLoader.cpp    | 98 +++----------------
 .../src/share/vm/classfile/classLoader.hpp    |  6 +-
 .../src/share/vm/classfile/javaClasses.cpp    | 51 +++-------
 .../share/vm/classfile/systemDictionary.cpp   |  2 -
 .../share/vm/classfile/systemDictionary.hpp   | 23 +----
 hotspot/src/share/vm/classfile/vmSymbols.hpp  |  1 -
 .../src/share/vm/interpreter/linkResolver.cpp |  8 +-
 hotspot/src/share/vm/memory/universe.cpp      |  8 --
 hotspot/src/share/vm/oops/method.cpp          |  3 +-
 hotspot/src/share/vm/prims/jvm.cpp            | 44 ---------
 hotspot/src/share/vm/prims/unsafe.cpp         | 62 +-----------
 hotspot/src/share/vm/runtime/arguments.cpp    | 14 +--
 hotspot/src/share/vm/runtime/java.hpp         | 54 +---------
 hotspot/src/share/vm/runtime/reflection.cpp   | 81 ++-------------
 hotspot/src/share/vm/runtime/reflection.hpp   |  3 -
 .../src/share/vm/runtime/reflectionUtils.cpp  | 15 +--
 .../src/share/vm/runtime/serviceThread.cpp    |  5 +-
 hotspot/src/share/vm/runtime/thread.cpp       | 78 ++++-----------
 hotspot/src/share/vm/runtime/vframe.cpp       |  3 +-
 .../src/share/vm/runtime/vm_operations.cpp    | 10 +-
 hotspot/src/share/vm/runtime/vm_version.cpp   |  3 +-
 hotspot/src/share/vm/services/management.cpp  | 12 +--
 .../src/share/vm/services/threadService.cpp   | 14 ++-
 24 files changed, 95 insertions(+), 507 deletions(-)

diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index c7fe1c7d5a2..d72a50cbb52 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -4667,9 +4667,7 @@ bool ClassFileParser::has_illegal_visibility(jint flags) {
 }
 
 bool ClassFileParser::is_supported_version(u2 major, u2 minor) {
-  u2 max_version =
-    JDK_Version::is_gte_jdk17x_version() ? JAVA_MAX_SUPPORTED_VERSION :
-    (JDK_Version::is_gte_jdk16x_version() ? JAVA_6_VERSION : JAVA_1_5_VERSION);
+  u2 max_version = JAVA_MAX_SUPPORTED_VERSION;
   return (major >= JAVA_MIN_SUPPORTED_VERSION) &&
          (major <= max_version) &&
          ((major != max_version) ||
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 8366c8fc4ce..46d979ed1df 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -1126,7 +1126,7 @@ void ClassLoader::verify() {
 
 
 // JDK 1.3 version
-typedef struct real_jzentry13 {         /* Zip file entry */
+typedef struct real_jzentry {         /* Zip file entry */
     char *name;                 /* entry name */
     jint time;                  /* modification time */
     jint size;                  /* size of uncompressed data */
@@ -1135,9 +1135,9 @@ typedef struct real_jzentry13 {         /* Zip file entry */
     char *comment;              /* optional zip file comment */
     jbyte *extra;               /* optional extra data */
     jint pos;                   /* position of LOC header (if negative) or data */
-} real_jzentry13;
+} real_jzentry;
 
-typedef struct real_jzfile13 {  /* Zip file */
+typedef struct real_jzfile {  /* Zip file */
     char *name;                 /* zip file name */
     jint refs;                  /* number of active references */
     jint fd;                    /* open file descriptor */
@@ -1148,42 +1148,14 @@ typedef struct real_jzfile13 {  /* Zip file */
     jint total;                 /* total number of entries */
     unsigned short *table;      /* Hash chain heads: indexes into entries */
     jint tablelen;              /* number of hash eads */
-    real_jzfile13 *next;        /* next zip file in search list */
+    real_jzfile *next;        /* next zip file in search list */
     jzentry *cache;             /* we cache the most recently freed jzentry */
     /* Information on metadata names in META-INF directory */
     char **metanames;           /* array of meta names (may have null names) */
     jint metacount;             /* number of slots in metanames array */
     /* If there are any per-entry comments, they are in the comments array */
     char **comments;
-} real_jzfile13;
-
-// JDK 1.2 version
-typedef struct real_jzentry12 {  /* Zip file entry */
-    char *name;                  /* entry name */
-    jint time;                   /* modification time */
-    jint size;                   /* size of uncompressed data */
-    jint csize;                  /* size of compressed data (zero if uncompressed) */
-    jint crc;                    /* crc of uncompressed data */
-    char *comment;               /* optional zip file comment */
-    jbyte *extra;                /* optional extra data */
-    jint pos;                    /* position of LOC header (if negative) or data */
-    struct real_jzentry12 *next; /* next entry in hash table */
-} real_jzentry12;
-
-typedef struct real_jzfile12 {  /* Zip file */
-    char *name;                 /* zip file name */
-    jint refs;                  /* number of active references */
-    jint fd;                    /* open file descriptor */
-    void *lock;                 /* read lock */
-    char *comment;              /* zip file comment */
-    char *msg;                  /* zip error message */
-    real_jzentry12 *entries;    /* array of zip entries */
-    jint total;                 /* total number of entries */
-    real_jzentry12 **table;     /* hash table of entries */
-    jint tablelen;              /* number of buckets */
-    jzfile *next;               /* next zip file in search list */
-} real_jzfile12;
-
+} real_jzfile;
 
 void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
   // For now we only compile all methods in all classes in zip/jar files
@@ -1197,10 +1169,14 @@ bool ClassPathDirEntry::is_rt_jar() {
 }
 
 void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
-  if (JDK_Version::is_jdk12x_version()) {
-    compile_the_world12(loader, THREAD);
-  } else {
-    compile_the_world13(loader, THREAD);
+  real_jzfile* zip = (real_jzfile*) _zip;
+  tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name);
+  tty->cr();
+  // Iterate over all entries in zip file
+  for (int n = 0; ; n++) {
+    real_jzentry * ze = (real_jzentry *)((*GetNextEntry)(_zip, n));
+    if (ze == NULL) break;
+    ClassLoader::compile_the_world_in(ze->name, loader, CHECK);
   }
   if (HAS_PENDING_EXCEPTION) {
     if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
@@ -1213,54 +1189,8 @@ void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
   }
 }
 
-// Version that works for JDK 1.3.x
-void ClassPathZipEntry::compile_the_world13(Handle loader, TRAPS) {
-  real_jzfile13* zip = (real_jzfile13*) _zip;
-  tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name);
-  tty->cr();
-  // Iterate over all entries in zip file
-  for (int n = 0; ; n++) {
-    real_jzentry13 * ze = (real_jzentry13 *)((*GetNextEntry)(_zip, n));
-    if (ze == NULL) break;
-    ClassLoader::compile_the_world_in(ze->name, loader, CHECK);
-  }
-}
-
-
-// Version that works for JDK 1.2.x
-void ClassPathZipEntry::compile_the_world12(Handle loader, TRAPS) {
-  real_jzfile12* zip = (real_jzfile12*) _zip;
-  tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name);
-  tty->cr();
-  // Iterate over all entries in zip file
-  for (int n = 0; ; n++) {
-    real_jzentry12 * ze = (real_jzentry12 *)((*GetNextEntry)(_zip, n));
-    if (ze == NULL) break;
-    ClassLoader::compile_the_world_in(ze->name, loader, CHECK);
-  }
-}
-
 bool ClassPathZipEntry::is_rt_jar() {
-  if (JDK_Version::is_jdk12x_version()) {
-    return is_rt_jar12();
-  } else {
-    return is_rt_jar13();
-  }
-}
-
-// JDK 1.3 version
-bool ClassPathZipEntry::is_rt_jar13() {
-  real_jzfile13* zip = (real_jzfile13*) _zip;
-  int len = (int)strlen(zip->name);
-  // Check whether zip name ends in "rt.jar"
-  // This will match other archives named rt.jar as well, but this is
-  // only used for debugging.
-  return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
-}
-
-// JDK 1.2 version
-bool ClassPathZipEntry::is_rt_jar12() {
-  real_jzfile12* zip = (real_jzfile12*) _zip;
+  real_jzfile* zip = (real_jzfile*) _zip;
   int len = (int)strlen(zip->name);
   // Check whether zip name ends in "rt.jar"
   // This will match other archives named rt.jar as well, but this is
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index e03cfad1b57..2cfcde6387e 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -111,11 +111,7 @@ class ClassPathZipEntry: public ClassPathEntry {
   void contents_do(void f(const char* name, void* context), void* context);
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
-  NOT_PRODUCT(void compile_the_world12(Handle loader, TRAPS);) // JDK 1.2 version
-  NOT_PRODUCT(void compile_the_world13(Handle loader, TRAPS);) // JDK 1.3 version
   NOT_PRODUCT(bool is_rt_jar();)
-  NOT_PRODUCT(bool is_rt_jar12();)
-  NOT_PRODUCT(bool is_rt_jar13();)
 };
 
 
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index 628ddf910b7..0e61ff9f391 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -857,9 +857,7 @@ void java_lang_Class::compute_offsets() {
 }
 
 int java_lang_Class::classRedefinedCount(oop the_class_mirror) {
-  if (!JDK_Version::is_gte_jdk15x_version()
-      || classRedefinedCount_offset == -1) {
-    // The classRedefinedCount field is only present starting in 1.5.
+  if (classRedefinedCount_offset == -1) {
     // If we don't have an offset for it then just return -1 as a marker.
     return -1;
   }
@@ -868,9 +866,7 @@ int java_lang_Class::classRedefinedCount(oop the_class_mirror) {
 }
 
 void java_lang_Class::set_classRedefinedCount(oop the_class_mirror, int value) {
-  if (!JDK_Version::is_gte_jdk15x_version()
-      || classRedefinedCount_offset == -1) {
-    // The classRedefinedCount field is only present starting in 1.5.
+  if (classRedefinedCount_offset == -1) {
     // If we don't have an offset for it then nothing to set.
     return;
   }
@@ -1000,9 +996,7 @@ oop java_lang_Thread::inherited_access_control_context(oop java_thread) {
 
 
 jlong java_lang_Thread::stackSize(oop java_thread) {
-  // The stackSize field is only present starting in 1.4
   if (_stackSize_offset > 0) {
-    assert(JDK_Version::is_gte_jdk14x_version(), "sanity check");
     return java_thread->long_field(_stackSize_offset);
   } else {
     return 0;
@@ -1078,7 +1072,7 @@ bool java_lang_Thread::set_park_event(oop java_thread, jlong ptr) {
 
 
 const char* java_lang_Thread::thread_status_name(oop java_thread) {
-  assert(JDK_Version::is_gte_jdk15x_version() && _thread_status_offset != 0, "Must have thread status");
+  assert(_thread_status_offset != 0, "Must have thread status");
   ThreadStatus status = (java_lang_Thread::ThreadStatus)java_thread->int_field(_thread_status_offset);
   switch (status) {
     case NEW                      : return "NEW";
@@ -1217,7 +1211,6 @@ void java_lang_Throwable::set_stacktrace(oop throwable, oop st_element_array) {
 }
 
 void java_lang_Throwable::clear_stacktrace(oop throwable) {
-  assert(JDK_Version::is_gte_jdk14x_version(), "should only be called in >= 1.4");
   set_stacktrace(throwable, NULL);
 }
 
@@ -1548,12 +1541,9 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle met
   // Start out by clearing the backtrace for this object, in case the VM
   // runs out of memory while allocating the stack trace
   set_backtrace(throwable(), NULL);
-  if (JDK_Version::is_gte_jdk14x_version()) {
-    // New since 1.4, clear lazily constructed Java level stacktrace if
-    // refilling occurs
-    // This is unnecessary in 1.7+ but harmless
-    clear_stacktrace(throwable());
-  }
+  // Clear lazily constructed Java level stacktrace if refilling occurs
+  // This is unnecessary in 1.7+ but harmless
+  clear_stacktrace(throwable());
 
   int max_depth = MaxJavaStackTraceDepth;
   JavaThread* thread = (JavaThread*)THREAD;
@@ -1739,13 +1729,9 @@ void java_lang_Throwable::fill_in_stack_trace_of_preallocated_backtrace(Handle t
     if (chunk_count >= max_chunks) break;
   }
 
-  // For Java 7+ we support the Throwable immutability protocol defined for Java 7. This support
-  // was missing in 7u0 so in 7u0 there is a workaround in the Throwable class. That workaround
-  // can be removed in a JDK using this JVM version
-  if (JDK_Version::is_gte_jdk17x_version()) {
-      java_lang_Throwable::set_stacktrace(throwable(), java_lang_Throwable::unassigned_stacktrace());
-      assert(java_lang_Throwable::unassigned_stacktrace() != NULL, "not initialized");
-  }
+  // We support the Throwable immutability protocol defined for Java 7.
+  java_lang_Throwable::set_stacktrace(throwable(), java_lang_Throwable::unassigned_stacktrace());
+  assert(java_lang_Throwable::unassigned_stacktrace() != NULL, "not initialized");
 }
 
 
@@ -3022,8 +3008,7 @@ bool java_lang_ClassLoader::isAncestor(oop loader, oop cl) {
 // based on non-null field
 // Written to by java.lang.ClassLoader, vm only reads this field, doesn't set it
 bool java_lang_ClassLoader::parallelCapable(oop class_loader) {
-  if (!JDK_Version::is_gte_jdk17x_version()
-     || parallelCapable_offset == -1) {
+  if (parallelCapable_offset == -1) {
      // Default for backward compatibility is false
      return false;
   }
@@ -3219,7 +3204,6 @@ void java_nio_Buffer::compute_offsets() {
 void java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(TRAPS) {
   if (_owner_offset != 0) return;
 
-  assert(JDK_Version::is_gte_jdk16x_version(), "Must be JDK 1.6 or later");
   SystemDictionary::load_abstract_ownable_synchronizer_klass(CHECK);
   Klass* k = SystemDictionary::abstract_ownable_synchronizer_klass();
   compute_offset(_owner_offset, k,
@@ -3309,15 +3293,10 @@ void JavaClasses::compute_offsets() {
   java_lang_reflect_Method::compute_offsets();
   java_lang_reflect_Constructor::compute_offsets();
   java_lang_reflect_Field::compute_offsets();
-  if (JDK_Version::is_gte_jdk14x_version()) {
-    java_nio_Buffer::compute_offsets();
-  }
-  if (JDK_Version::is_gte_jdk15x_version()) {
-    sun_reflect_ConstantPool::compute_offsets();
-    sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
-  }
-  if (JDK_Version::is_gte_jdk18x_version())
-    java_lang_reflect_Parameter::compute_offsets();
+  java_nio_Buffer::compute_offsets();
+  sun_reflect_ConstantPool::compute_offsets();
+  sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
+  java_lang_reflect_Parameter::compute_offsets();
 
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
@@ -3502,7 +3481,7 @@ void JavaClasses::check_offsets() {
   // into merlin "for some time."  Without it, the vm will fail with early
   // merlin builds.
 
-  if (CheckAssertionStatusDirectives && JDK_Version::is_gte_jdk14x_version()) {
+  if (CheckAssertionStatusDirectives) {
     const char* nm = "java/lang/AssertionStatusDirectives";
     const char* sig = "[Ljava/lang/String;";
     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, classes, sig);
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index d09de41114d..9a6fa98908b 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -1754,8 +1754,6 @@ void SystemDictionary::methods_do(void f(Method*)) {
 // Lazily load klasses
 
 void SystemDictionary::load_abstract_ownable_synchronizer_klass(TRAPS) {
-  assert(JDK_Version::is_gte_jdk16x_version(), "Must be JDK 1.6 or later");
-
   // if multiple threads calling this function, only one thread will load
   // the class.  The other threads will find the loaded version once the
   // class is loaded.
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp
index 4e1b75dc241..f26a9d8c56e 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp
@@ -139,14 +139,13 @@ class Ticks;
   do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor,             Pre                 ) \
                                                                                                                          \
   /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                              \
-  /* Universe::is_gte_jdk14x_version() is not set up by this point. */                                                   \
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   do_klass(reflect_MagicAccessorImpl_klass,             sun_reflect_MagicAccessorImpl,             Opt                 ) \
-  do_klass(reflect_MethodAccessorImpl_klass,            sun_reflect_MethodAccessorImpl,            Opt_Only_JDK14NewRef) \
-  do_klass(reflect_ConstructorAccessorImpl_klass,       sun_reflect_ConstructorAccessorImpl,       Opt_Only_JDK14NewRef) \
+  do_klass(reflect_MethodAccessorImpl_klass,            sun_reflect_MethodAccessorImpl,            Pre                 ) \
+  do_klass(reflect_ConstructorAccessorImpl_klass,       sun_reflect_ConstructorAccessorImpl,       Pre                 ) \
   do_klass(reflect_DelegatingClassLoader_klass,         sun_reflect_DelegatingClassLoader,         Opt                 ) \
-  do_klass(reflect_ConstantPool_klass,                  sun_reflect_ConstantPool,                  Opt_Only_JDK15      ) \
-  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt_Only_JDK15      ) \
+  do_klass(reflect_ConstantPool_klass,                  sun_reflect_ConstantPool,                  Opt                 ) \
+  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt                 ) \
   do_klass(reflect_CallerSensitive_klass,               sun_reflect_CallerSensitive,               Opt                 ) \
                                                                                                                          \
   /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                            \
@@ -169,7 +168,6 @@ class Ticks;
                                                                                                                          \
   /* It's NULL in non-1.4 JDKs. */                                                                                       \
   do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
-  /* Universe::is_gte_jdk14x_version() is not set up by this point. */                                                   \
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
                                                                                                                          \
@@ -209,10 +207,8 @@ class SystemDictionary : AllStatic {
     // Options after this point will use resolve_or_null instead.
 
     Opt,                        // preload tried; NULL if not present
-    Opt_Only_JDK14NewRef,       // preload tried; use only with NewReflection
-    Opt_Only_JDK15,             // preload tried; use only with JDK1.5+
     OPTION_LIMIT,
-    CEIL_LG_OPTION_LIMIT = 4    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
+    CEIL_LG_OPTION_LIMIT = 2    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
   };
 
 
@@ -385,15 +381,6 @@ public:
 
   static Klass* check_klass_Pre(       Klass* k) { return check_klass(k); }
   static Klass* check_klass_Opt(       Klass* k) { return k; }
-  static Klass* check_klass_Opt_Only_JDK15(Klass* k) {
-    assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
-    return k;
-  }
-  static Klass* check_klass_Opt_Only_JDK14NewRef(Klass* k) {
-    assert(JDK_Version::is_gte_jdk14x_version(), "JDK 1.4 only");
-    // despite the optional loading, if you use this it must be present:
-    return check_klass(k);
-  }
 
   static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
   static void initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
index 4d3ee6f08dd..ec7f2a298f4 100644
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
@@ -320,7 +320,6 @@
   template(reference_discovered_name,                 "discovered")                               \
   template(run_finalization_name,                     "runFinalization")                          \
   template(run_finalizers_on_exit_name,               "runFinalizersOnExit")                      \
-  template(uncaughtException_name,                    "uncaughtException")                        \
   template(dispatchUncaughtException_name,            "dispatchUncaughtException")                \
   template(initializeSystemClass_name,                "initializeSystemClass")                    \
   template(loadClass_name,                            "loadClass")                                \
diff --git a/hotspot/src/share/vm/interpreter/linkResolver.cpp b/hotspot/src/share/vm/interpreter/linkResolver.cpp
index d732cb2eec5..6fbb3bfa6f1 100644
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp
@@ -945,12 +945,8 @@ void LinkResolver::linktime_resolve_special_method(methodHandle& resolved_method
     Klass *klass_to_check = !InstanceKlass::cast(current_klass())->is_anonymous() ?
                                   current_klass() :
                                   InstanceKlass::cast(current_klass())->host_klass();
-    // As of the fix for 4486457 we disable verification for all of the
-    // dynamically-generated bytecodes associated with the 1.4
-    // reflection implementation, not just those associated with
-    // sun/reflect/SerializationConstructorAccessor.
-    bool is_reflect = JDK_Version::is_gte_jdk14x_version() &&
-                      klass_to_check->is_subclass_of(
+    // Disable verification for the dynamically-generated reflection bytecodes.
+    bool is_reflect = klass_to_check->is_subclass_of(
                         SystemDictionary::reflect_MagicAccessorImpl_klass());
 
     if (!is_reflect &&
diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp
index 0250f1a1b8d..5053b46e8c8 100644
--- a/hotspot/src/share/vm/memory/universe.cpp
+++ b/hotspot/src/share/vm/memory/universe.cpp
@@ -1000,9 +1000,6 @@ void universe2_init() {
 }
 
 
-// This function is defined in JVM.cpp
-extern void initialize_converter_functions();
-
 bool universe_post_init() {
   assert(!is_init_completed(), "Error: initialization not yet completed!");
   Universe::_fully_initialized = true;
@@ -1144,11 +1141,6 @@ bool universe_post_init() {
       SystemDictionary::ProtectionDomain_klass(), m);;
   }
 
-  // The following is initializing converter functions for serialization in
-  // JVM.cpp. If we clean up the StrictMath code above we may want to find
-  // a better solution for this as well.
-  initialize_converter_functions();
-
   // This needs to be done before the first scavenge/gc, since
   // it's an input to soft ref clearing policy.
   {
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index 01ef61f2386..4549c68871f 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -1023,8 +1023,7 @@ bool Method::is_ignored_by_security_stack_walk() const {
     // This is Method.invoke() -- ignore it
     return true;
   }
-  if (JDK_Version::is_gte_jdk14x_version() &&
-      method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
+  if (method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
     // This is an auxilary frame -- ignore it
     return true;
   }
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index 5b96377b24a..69e45bd11f7 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -3923,50 +3923,6 @@ JNIEXPORT void JNICALL JVM_RawMonitorExit(void *mon) {
 }
 
 
-// Support for Serialization
-
-typedef jfloat  (JNICALL *IntBitsToFloatFn  )(JNIEnv* env, jclass cb, jint    value);
-typedef jdouble (JNICALL *LongBitsToDoubleFn)(JNIEnv* env, jclass cb, jlong   value);
-typedef jint    (JNICALL *FloatToIntBitsFn  )(JNIEnv* env, jclass cb, jfloat  value);
-typedef jlong   (JNICALL *DoubleToLongBitsFn)(JNIEnv* env, jclass cb, jdouble value);
-
-static IntBitsToFloatFn   int_bits_to_float_fn   = NULL;
-static LongBitsToDoubleFn long_bits_to_double_fn = NULL;
-static FloatToIntBitsFn   float_to_int_bits_fn   = NULL;
-static DoubleToLongBitsFn double_to_long_bits_fn = NULL;
-
-
-void initialize_converter_functions() {
-  if (JDK_Version::is_gte_jdk14x_version()) {
-    // These functions only exist for compatibility with 1.3.1 and earlier
-    return;
-  }
-
-  // called from universe_post_init()
-  assert(
-    int_bits_to_float_fn   == NULL &&
-    long_bits_to_double_fn == NULL &&
-    float_to_int_bits_fn   == NULL &&
-    double_to_long_bits_fn == NULL ,
-    "initialization done twice"
-  );
-  // initialize
-  int_bits_to_float_fn   = CAST_TO_FN_PTR(IntBitsToFloatFn  , NativeLookup::base_library_lookup("java/lang/Float" , "intBitsToFloat"  , "(I)F"));
-  long_bits_to_double_fn = CAST_TO_FN_PTR(LongBitsToDoubleFn, NativeLookup::base_library_lookup("java/lang/Double", "longBitsToDouble", "(J)D"));
-  float_to_int_bits_fn   = CAST_TO_FN_PTR(FloatToIntBitsFn  , NativeLookup::base_library_lookup("java/lang/Float" , "floatToIntBits"  , "(F)I"));
-  double_to_long_bits_fn = CAST_TO_FN_PTR(DoubleToLongBitsFn, NativeLookup::base_library_lookup("java/lang/Double", "doubleToLongBits", "(D)J"));
-  // verify
-  assert(
-    int_bits_to_float_fn   != NULL &&
-    long_bits_to_double_fn != NULL &&
-    float_to_int_bits_fn   != NULL &&
-    double_to_long_bits_fn != NULL ,
-    "initialization failed"
-  );
-}
-
-
-
 // Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
 
 jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) {
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index 4dd10cfca57..332f8fb74ab 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -185,64 +185,7 @@ jint Unsafe_invocation_key_to_method_slot(jint key) {
 
 // Get/SetObject must be special-cased, since it works with handles.
 
-// The xxx140 variants for backward compatibility do not allow a full-width offset.
-UNSAFE_ENTRY(jobject, Unsafe_GetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset))
-  UnsafeWrapper("Unsafe_GetObject");
-  if (obj == NULL)  THROW_0(vmSymbols::java_lang_NullPointerException());
-  GET_OOP_FIELD(obj, offset, v)
-  jobject ret = JNIHandles::make_local(env, v);
-#if INCLUDE_ALL_GCS
-  // We could be accessing the referent field in a reference
-  // object. If G1 is enabled then we need to register a non-null
-  // referent with the SATB barrier.
-  if (UseG1GC) {
-    bool needs_barrier = false;
-
-    if (ret != NULL) {
-      if (offset == java_lang_ref_Reference::referent_offset) {
-        oop o = JNIHandles::resolve_non_null(obj);
-        Klass* k = o->klass();
-        if (InstanceKlass::cast(k)->reference_type() != REF_NONE) {
-          assert(InstanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity");
-          needs_barrier = true;
-        }
-      }
-    }
-
-    if (needs_barrier) {
-      oop referent = JNIHandles::resolve(ret);
-      G1SATBCardTableModRefBS::enqueue(referent);
-    }
-  }
-#endif // INCLUDE_ALL_GCS
-  return ret;
-UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_SetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jobject x_h))
-  UnsafeWrapper("Unsafe_SetObject");
-  if (obj == NULL)  THROW(vmSymbols::java_lang_NullPointerException());
-  oop x = JNIHandles::resolve(x_h);
-  //SET_FIELD(obj, offset, oop, x);
-  oop p = JNIHandles::resolve(obj);
-  if (UseCompressedOops) {
-    if (x != NULL) {
-      // If there is a heap base pointer, we are obliged to emit a store barrier.
-      oop_store((narrowOop*)index_oop_from_field_offset_long(p, offset), x);
-    } else {
-      narrowOop n = oopDesc::encode_heap_oop_not_null(x);
-      *(narrowOop*)index_oop_from_field_offset_long(p, offset) = n;
-    }
-  } else {
-    if (x != NULL) {
-      // If there is a heap base pointer, we are obliged to emit a store barrier.
-      oop_store((oop*)index_oop_from_field_offset_long(p, offset), x);
-    } else {
-      *(oop*)index_oop_from_field_offset_long(p, offset) = x;
-    }
-  }
-UNSAFE_END
-
-// The normal variants allow a null base pointer with an arbitrary address.
+// These functions allow a null base pointer with an arbitrary address.
 // But if the base pointer is non-null, the offset should make some sense.
 // That is, it should be in the range [0, MAX_OBJECT_SIZE].
 UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
@@ -1350,9 +1293,6 @@ UNSAFE_END
 
 // These are the methods for 1.4.0
 static JNINativeMethod methods_140[] = {
-    {CC"getObject",        CC"("OBJ"I)"OBJ"",   FN_PTR(Unsafe_GetObject140)},
-    {CC"putObject",        CC"("OBJ"I"OBJ")V",  FN_PTR(Unsafe_SetObject140)},
-
     DECLARE_GETSETOOP_140(Boolean, Z),
     DECLARE_GETSETOOP_140(Byte, B),
     DECLARE_GETSETOOP_140(Short, S),
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 91e485e7aed..88f1bfb400f 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -222,10 +222,8 @@ void Arguments::init_version_specific_system_properties() {
   const char* spec_vendor = "Sun Microsystems Inc.";
   uint32_t spec_version = 0;
 
-  if (JDK_Version::is_gte_jdk17x_version()) {
-    spec_vendor = "Oracle Corporation";
-    spec_version = JDK_Version::current().major_version();
-  }
+  spec_vendor = "Oracle Corporation";
+  spec_version = JDK_Version::current().major_version();
   jio_snprintf(buffer, bufsz, "1." UINT32_FORMAT, spec_version);
 
   PropertyList_add(&_system_properties,
@@ -3695,14 +3693,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
     PrintGC = true;
   }
 
-  if (!JDK_Version::is_gte_jdk18x_version()) {
-    // To avoid changing the log format for 7 updates this flag is only
-    // true by default in JDK8 and above.
-    if (FLAG_IS_DEFAULT(PrintGCCause)) {
-      FLAG_SET_DEFAULT(PrintGCCause, false);
-    }
-  }
-
   // Set object alignment values.
   set_object_alignment();
 
diff --git a/hotspot/src/share/vm/runtime/java.hpp b/hotspot/src/share/vm/runtime/java.hpp
index e5bae38c171..02ac99ebb60 100644
--- a/hotspot/src/share/vm/runtime/java.hpp
+++ b/hotspot/src/share/vm/runtime/java.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -197,58 +197,6 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC {
     _runtime_version = version;
   }
 
-  // Convenience methods for queries on the current major/minor version
-  static bool is_jdk12x_version() {
-    return current().compare_major(2) == 0;
-  }
-
-  static bool is_jdk13x_version() {
-    return current().compare_major(3) == 0;
-  }
-
-  static bool is_jdk14x_version() {
-    return current().compare_major(4) == 0;
-  }
-
-  static bool is_jdk15x_version() {
-    return current().compare_major(5) == 0;
-  }
-
-  static bool is_jdk16x_version() {
-    return current().compare_major(6) == 0;
-  }
-
-  static bool is_jdk17x_version() {
-    return current().compare_major(7) == 0;
-  }
-
-  static bool is_jdk18x_version() {
-    return current().compare_major(8) == 0;
-  }
-
-  static bool is_gte_jdk13x_version() {
-    return current().compare_major(3) >= 0;
-  }
-
-  static bool is_gte_jdk14x_version() {
-    return current().compare_major(4) >= 0;
-  }
-
-  static bool is_gte_jdk15x_version() {
-    return current().compare_major(5) >= 0;
-  }
-
-  static bool is_gte_jdk16x_version() {
-    return current().compare_major(6) >= 0;
-  }
-
-  static bool is_gte_jdk17x_version() {
-    return current().compare_major(7) >= 0;
-  }
-
-  static bool is_gte_jdk18x_version() {
-    return current().compare_major(8) >= 0;
-  }
 };
 
 #endif // SHARE_VM_RUNTIME_JAVA_HPP
diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
index 872d73c72e8..cc35fea494b 100644
--- a/hotspot/src/share/vm/runtime/reflection.cpp
+++ b/hotspot/src/share/vm/runtime/reflection.cpp
@@ -410,49 +410,6 @@ oop Reflection::array_component_type(oop mirror, TRAPS) {
 }
 
 
-bool Reflection::reflect_check_access(Klass* field_class, AccessFlags acc, Klass* target_class, bool is_method_invoke, TRAPS) {
-  // field_class  : declaring class
-  // acc          : declared field access
-  // target_class : for protected
-
-  // Check if field or method is accessible to client.  Throw an
-  // IllegalAccessException and return false if not.
-
-  // The "client" is the class associated with the nearest real frame
-  // getCallerClass already skips Method.invoke frames, so pass 0 in
-  // that case (same as classic).
-  ResourceMark rm(THREAD);
-  assert(THREAD->is_Java_thread(), "sanity check");
-  Klass* client_class = ((JavaThread *)THREAD)->security_get_caller_class(is_method_invoke ? 0 : 1);
-
-  if (client_class != field_class) {
-    if (!verify_class_access(client_class, field_class, false)
-        || !verify_field_access(client_class,
-                                field_class,
-                                field_class,
-                                acc,
-                                false)) {
-      THROW_(vmSymbols::java_lang_IllegalAccessException(), false);
-    }
-  }
-
-  // Additional test for protected members: JLS 6.6.2
-
-  if (acc.is_protected()) {
-    if (target_class != client_class) {
-      if (!is_same_class_package(client_class, field_class)) {
-        if (!target_class->is_subclass_of(client_class)) {
-          THROW_(vmSymbols::java_lang_IllegalAccessException(), false);
-        }
-      }
-    }
-  }
-
-  // Passed all tests
-  return true;
-}
-
-
 bool Reflection::verify_class_access(Klass* current_class, Klass* new_class, bool classloader_only) {
   // Verify that current_class can access new_class.  If the classloader_only
   // flag is set, we automatically allow any accesses in which current_class
@@ -463,10 +420,9 @@ bool Reflection::verify_class_access(Klass* current_class, Klass* new_class, boo
       is_same_class_package(current_class, new_class)) {
     return true;
   }
-  // New (1.4) reflection implementation. Allow all accesses from
-  // sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
-  if (   JDK_Version::is_gte_jdk14x_version()
-      && current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
+  // Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
+  // succeed trivially.
+  if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return true;
   }
 
@@ -567,10 +523,9 @@ bool Reflection::verify_field_access(Klass* current_class,
     return true;
   }
 
-  // New (1.4) reflection implementation. Allow all accesses from
-  // sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
-  if (   JDK_Version::is_gte_jdk14x_version()
-      && current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
+  // Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
+  // succeed trivially.
+  if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return true;
   }
 
@@ -707,12 +662,10 @@ Handle Reflection::new_type(Symbol* signature, KlassHandle k, TRAPS) {
 
 
 oop Reflection::new_method(methodHandle method, bool for_constant_pool_access, TRAPS) {
-  // In jdk1.2.x, getMethods on an interface erroneously includes <clinit>, thus the complicated assert.
-  // Also allow sun.reflect.ConstantPool to refer to <clinit> methods as java.lang.reflect.Methods.
+  // Allow sun.reflect.ConstantPool to refer to <clinit> methods as java.lang.reflect.Methods.
   assert(!method()->is_initializer() ||
-         (for_constant_pool_access && method()->is_static()) ||
-         (method()->name() == vmSymbols::class_initializer_name()
-    && method()->method_holder()->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead");
+         (for_constant_pool_access && method()->is_static()),
+         "should call new_constructor instead");
   instanceKlassHandle holder (THREAD, method->method_holder());
   int slot = method->method_idnum();
 
@@ -978,22 +931,6 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
                                                         reflected_method->signature()));
   }
 
-  // In the JDK 1.4 reflection implementation, the security check is
-  // done at the Java level
-  if (!JDK_Version::is_gte_jdk14x_version()) {
-
-  // Access checking (unless overridden by Method)
-  if (!override) {
-    if (!(klass->is_public() && reflected_method->is_public())) {
-      bool access = Reflection::reflect_check_access(klass(), reflected_method->access_flags(), target_klass(), is_method_invoke, CHECK_NULL);
-      if (!access) {
-        return NULL; // exception
-      }
-    }
-  }
-
-  } // !Universe::is_gte_jdk14x_version()
-
   assert(ptypes->is_objArray(), "just checking");
   int args_len = args.is_null() ? 0 : args->length();
   // Check number of arguments
diff --git a/hotspot/src/share/vm/runtime/reflection.hpp b/hotspot/src/share/vm/runtime/reflection.hpp
index 5757cfc39f5..593ff7ecc49 100644
--- a/hotspot/src/share/vm/runtime/reflection.hpp
+++ b/hotspot/src/share/vm/runtime/reflection.hpp
@@ -44,9 +44,6 @@ class FieldStream;
 
 class Reflection: public AllStatic {
  private:
-  // Access checking
-  static bool reflect_check_access(Klass* field_class, AccessFlags acc, Klass* target_class, bool is_method_invoke, TRAPS);
-
   // Conversion
   static Klass* basic_type_mirror_to_arrayklass(oop basic_type_mirror, TRAPS);
   static oop      basic_type_arrayklass_to_mirror(Klass* basic_type_arrayklass, TRAPS);
diff --git a/hotspot/src/share/vm/runtime/reflectionUtils.cpp b/hotspot/src/share/vm/runtime/reflectionUtils.cpp
index 2ec82abc91a..331d5a750a0 100644
--- a/hotspot/src/share/vm/runtime/reflectionUtils.cpp
+++ b/hotspot/src/share/vm/runtime/reflectionUtils.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -76,15 +76,10 @@ void FilteredFieldsMap::initialize() {
   int offset;
   offset = java_lang_Throwable::get_backtrace_offset();
   _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset));
-  // The latest version of vm may be used with old jdk.
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    // The following class fields do not exist in
-    // previous version of jdk.
-    offset = sun_reflect_ConstantPool::oop_offset();
-    _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
-    offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
-    _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
-  }
+  offset = sun_reflect_ConstantPool::oop_offset();
+  _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
+  offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
+  _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
 }
 
 int FilteredFieldStream::field_count() {
diff --git a/hotspot/src/share/vm/runtime/serviceThread.cpp b/hotspot/src/share/vm/runtime/serviceThread.cpp
index 3c1224abb2c..eb7cb4a439c 100644
--- a/hotspot/src/share/vm/runtime/serviceThread.cpp
+++ b/hotspot/src/share/vm/runtime/serviceThread.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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,8 +41,7 @@ void ServiceThread::initialize() {
   instanceKlassHandle klass (THREAD,  SystemDictionary::Thread_klass());
   instanceHandle thread_oop = klass->allocate_instance_handle(CHECK);
 
-  const char* name = JDK_Version::is_gte_jdk17x_version() ?
-      "Service Thread" : "Low Memory Detector";
+  const char* name = "Service Thread";
 
   Handle string = java_lang_String::create_from_str(name, CHECK);
 
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index e9e9d22f197..061509ae144 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -1738,55 +1738,26 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
 
     CLEAR_PENDING_EXCEPTION;
   }
-  // FIXIT: The is_null check is only so it works better on JDK1.2 VM's. This
-  // has to be fixed by a runtime query method
-  if (!destroy_vm || JDK_Version::is_jdk12x_version()) {
-    // JSR-166: change call from from ThreadGroup.uncaughtException to
-    // java.lang.Thread.dispatchUncaughtException
+  if (!destroy_vm) {
     if (uncaught_exception.not_null()) {
-      Handle group(this, java_lang_Thread::threadGroup(threadObj()));
-      {
-        EXCEPTION_MARK;
-        // Check if the method Thread.dispatchUncaughtException() exists. If so
-        // call it.  Otherwise we have an older library without the JSR-166 changes,
-        // so call ThreadGroup.uncaughtException()
-        KlassHandle recvrKlass(THREAD, threadObj->klass());
-        CallInfo callinfo;
-        KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
-        LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass,
-                                           vmSymbols::dispatchUncaughtException_name(),
-                                           vmSymbols::throwable_void_signature(),
-                                           KlassHandle(), false, false, THREAD);
+      EXCEPTION_MARK;
+      // Call method Thread.dispatchUncaughtException().
+      KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
+      JavaValue result(T_VOID);
+      JavaCalls::call_virtual(&result,
+                              threadObj, thread_klass,
+                              vmSymbols::dispatchUncaughtException_name(),
+                              vmSymbols::throwable_void_signature(),
+                              uncaught_exception,
+                              THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        ResourceMark rm(this);
+        jio_fprintf(defaultStream::error_stream(),
+              "\nException: %s thrown from the UncaughtExceptionHandler"
+              " in thread \"%s\"\n",
+              pending_exception()->klass()->external_name(),
+              get_thread_name());
         CLEAR_PENDING_EXCEPTION;
-        methodHandle method = callinfo.selected_method();
-        if (method.not_null()) {
-          JavaValue result(T_VOID);
-          JavaCalls::call_virtual(&result,
-                                  threadObj, thread_klass,
-                                  vmSymbols::dispatchUncaughtException_name(),
-                                  vmSymbols::throwable_void_signature(),
-                                  uncaught_exception,
-                                  THREAD);
-        } else {
-          KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass());
-          JavaValue result(T_VOID);
-          JavaCalls::call_virtual(&result,
-                                  group, thread_group,
-                                  vmSymbols::uncaughtException_name(),
-                                  vmSymbols::thread_throwable_void_signature(),
-                                  threadObj,           // Arg 1
-                                  uncaught_exception,  // Arg 2
-                                  THREAD);
-        }
-        if (HAS_PENDING_EXCEPTION) {
-          ResourceMark rm(this);
-          jio_fprintf(defaultStream::error_stream(),
-                "\nException: %s thrown from the UncaughtExceptionHandler"
-                " in thread \"%s\"\n",
-                pending_exception()->klass()->external_name(),
-                get_thread_name());
-          CLEAR_PENDING_EXCEPTION;
-        }
       }
     }
 
@@ -2848,7 +2819,7 @@ void JavaThread::print_on(outputStream *st) const {
   Thread::print_on(st);
   // print guess for valid stack memory region (assume 4K pages); helps lock debugging
   st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12));
-  if (thread_oop != NULL && JDK_Version::is_gte_jdk15x_version()) {
+  if (thread_oop != NULL) {
     st->print_cr("   java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop));
   }
 #ifndef PRODUCT
@@ -3948,15 +3919,8 @@ bool Threads::destroy_vm() {
   }
   os::wait_for_keypress_at_exit();
 
-  if (JDK_Version::is_jdk12x_version()) {
-    // We are the last thread running, so check if finalizers should be run.
-    // For 1.3 or later this is done in thread->invoke_shutdown_hooks()
-    HandleMark rm(thread);
-    Universe::run_finalizers_on_exit();
-  } else {
-    // run Java level shutdown hooks
-    thread->invoke_shutdown_hooks();
-  }
+  // run Java level shutdown hooks
+  thread->invoke_shutdown_hooks();
 
   before_exit(thread);
 
diff --git a/hotspot/src/share/vm/runtime/vframe.cpp b/hotspot/src/share/vm/runtime/vframe.cpp
index 79da635c443..57900245436 100644
--- a/hotspot/src/share/vm/runtime/vframe.cpp
+++ b/hotspot/src/share/vm/runtime/vframe.cpp
@@ -480,9 +480,8 @@ void vframeStreamCommon::skip_prefixed_method_and_wrappers() {
 
 void vframeStreamCommon::skip_reflection_related_frames() {
   while (!at_end() &&
-         (JDK_Version::is_gte_jdk14x_version() &&
           (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
-           method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
+           method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass()))) {
     next();
   }
 }
diff --git a/hotspot/src/share/vm/runtime/vm_operations.cpp b/hotspot/src/share/vm/runtime/vm_operations.cpp
index d46e1f775ac..6f27fe3fecc 100644
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp
@@ -184,9 +184,7 @@ bool VM_PrintThreads::doit_prologue() {
   assert(Thread::current()->is_Java_thread(), "just checking");
 
   // Make sure AbstractOwnableSynchronizer is loaded
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
-  }
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
 
   // Get Heap_lock if concurrent locks will be dumped
   if (_print_concurrent_locks) {
@@ -225,7 +223,7 @@ bool VM_FindDeadlocks::doit_prologue() {
   assert(Thread::current()->is_Java_thread(), "just checking");
 
   // Load AbstractOwnableSynchronizer class
-  if (_concurrent_locks && JDK_Version::is_gte_jdk16x_version()) {
+  if (_concurrent_locks) {
     java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
   }
 
@@ -283,9 +281,7 @@ bool VM_ThreadDump::doit_prologue() {
   assert(Thread::current()->is_Java_thread(), "just checking");
 
   // Load AbstractOwnableSynchronizer class before taking thread snapshots
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
-  }
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(JavaThread::current());
 
   if (_with_locked_synchronizers) {
     // Acquire Heap_lock to dump concurrent locks
diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp
index 03fd43355bf..9fee996f687 100644
--- a/hotspot/src/share/vm/runtime/vm_version.cpp
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp
@@ -160,8 +160,7 @@ const char* Abstract_VM_Version::vm_vendor() {
 #ifdef VENDOR
   return XSTR(VENDOR);
 #else
-  return JDK_Version::is_gte_jdk17x_version() ?
-    "Oracle Corporation" : "Sun Microsystems Inc.";
+  return "Oracle Corporation";
 #endif
 }
 
diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp
index dc901876104..2d6f2ff1d23 100644
--- a/hotspot/src/share/vm/services/management.cpp
+++ b/hotspot/src/share/vm/services/management.cpp
@@ -1229,10 +1229,8 @@ JVM_ENTRY(jint, jmm_GetThreadInfo(JNIEnv *env, jlongArray ids, jint maxDepth, jo
                "The length of the given ThreadInfo array does not match the length of the given array of thread IDs", -1);
   }
 
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_0);
-  }
+  // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_0);
 
   // Must use ThreadDumpResult to store the ThreadSnapshot.
   // GC may occur after the thread snapshots are taken but before
@@ -1303,10 +1301,8 @@ JVM_END
 JVM_ENTRY(jobjectArray, jmm_DumpThreads(JNIEnv *env, jlongArray thread_ids, jboolean locked_monitors, jboolean locked_synchronizers))
   ResourceMark rm(THREAD);
 
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_NULL);
-  }
+  // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_NULL);
 
   typeArrayOop ta = typeArrayOop(JNIHandles::resolve(thread_ids));
   int num_threads = (ta != NULL ? ta->length() : 0);
diff --git a/hotspot/src/share/vm/services/threadService.cpp b/hotspot/src/share/vm/services/threadService.cpp
index 02156a2f3e2..21d87567eed 100644
--- a/hotspot/src/share/vm/services/threadService.cpp
+++ b/hotspot/src/share/vm/services/threadService.cpp
@@ -665,17 +665,15 @@ void ConcurrentLocksDump::dump_at_safepoint() {
   // dump all locked concurrent locks
   assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
 
-  if (JDK_Version::is_gte_jdk16x_version()) {
-    ResourceMark rm;
+  ResourceMark rm;
 
-    GrowableArray<oop>* aos_objects = new GrowableArray<oop>(INITIAL_ARRAY_SIZE);
+  GrowableArray<oop>* aos_objects = new GrowableArray<oop>(INITIAL_ARRAY_SIZE);
 
-    // Find all instances of AbstractOwnableSynchronizer
-    HeapInspection::find_instances_at_safepoint(SystemDictionary::abstract_ownable_synchronizer_klass(),
+  // Find all instances of AbstractOwnableSynchronizer
+  HeapInspection::find_instances_at_safepoint(SystemDictionary::abstract_ownable_synchronizer_klass(),
                                                 aos_objects);
-    // Build a map of thread to its owned AQS locks
-    build_map(aos_objects);
-  }
+  // Build a map of thread to its owned AQS locks
+  build_map(aos_objects);
 }
 
 
-- 
GitLab


From d9b63bdbdd02b9ad8e5cf90a811b2759e191104d Mon Sep 17 00:00:00 2001
From: David Simms <dsimms@openjdk.org>
Date: Wed, 11 Jun 2014 18:34:09 +0200
Subject: [PATCH 067/192] 8043224: -Xcheck:jni improvements to exception
 checking and excessive local refs

Warning when not checking exceptions from function that require so, also when local refs expand beyond capacity.

Reviewed-by: zgu, coleenp, hseigel
---
 hotspot/src/share/vm/memory/guardedMemory.hpp |   6 +-
 hotspot/src/share/vm/prims/jniCheck.cpp       | 269 +++++++++++-------
 hotspot/src/share/vm/runtime/jniHandles.cpp   |   7 +
 hotspot/src/share/vm/runtime/jniHandles.hpp   |  10 +-
 hotspot/src/share/vm/runtime/thread.cpp       |   1 +
 hotspot/src/share/vm/runtime/thread.hpp       |   9 +
 6 files changed, 201 insertions(+), 101 deletions(-)

diff --git a/hotspot/src/share/vm/memory/guardedMemory.hpp b/hotspot/src/share/vm/memory/guardedMemory.hpp
index dada10d84bf..0d37bb03361 100644
--- a/hotspot/src/share/vm/memory/guardedMemory.hpp
+++ b/hotspot/src/share/vm/memory/guardedMemory.hpp
@@ -235,7 +235,7 @@ protected:
    * @return the size of the user data.
    */
   size_t get_user_size() const {
-    assert(_base_addr, "Not wrapping any memory");
+    assert(_base_addr != NULL, "Not wrapping any memory");
     return get_head_guard()->get_user_size();
   }
 
@@ -245,7 +245,7 @@ protected:
    * @return the user data pointer.
    */
   u_char* get_user_ptr() const {
-    assert(_base_addr, "Not wrapping any memory");
+    assert(_base_addr != NULL, "Not wrapping any memory");
     return _base_addr + sizeof(GuardHeader);
   }
 
@@ -281,7 +281,7 @@ protected:
     memset(get_user_ptr(), ch, get_user_size());
   }
 
-public:
+ public:
   /**
    * Return the total size required for wrapping the given user size.
    *
diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp
index 446c23143ae..de9b4e56a86 100644
--- a/hotspot/src/share/vm/prims/jniCheck.cpp
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp
@@ -53,6 +53,8 @@
 # include "jniTypes_ppc.hpp"
 #endif
 
+// Complain every extra number of unplanned local refs
+#define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32
 
 // Heap objects are allowed to be directly referenced only in VM code,
 // not in native code.
@@ -168,12 +170,42 @@ static void NativeReportJNIWarning(JavaThread* thr, const char *msg) {
  * SUPPORT FUNCTIONS
  */
 
+/**
+ * Check whether or not a programmer has actually checked for exceptions. According
+ * to the JNI Specification ("jni/spec/design.html#java_exceptions"):
+ *
+ * There are two cases where the programmer needs to check for exceptions without
+ * being able to first check an error code:
+ *
+ * - The JNI functions that invoke a Java method return the result of the Java method.
+ * The programmer must call ExceptionOccurred() to check for possible exceptions
+ * that occurred during the execution of the Java method.
+ *
+ * - Some of the JNI array access functions do not return an error code, but may
+ * throw an ArrayIndexOutOfBoundsException or ArrayStoreException.
+ *
+ * In all other cases, a non-error return value guarantees that no exceptions have been thrown.
+ */
 static inline void
-functionEnterCritical(JavaThread* thr)
-{
+check_pending_exception(JavaThread* thr) {
   if (thr->has_pending_exception()) {
     NativeReportJNIWarning(thr, "JNI call made with exception pending");
   }
+  if (thr->is_pending_jni_exception_check()) {
+    IN_VM(
+      tty->print_cr("WARNING in native method: JNI call made without checking exceptions when required to from %s",
+        thr->get_pending_jni_exception_check());
+      thr->print_stack();
+    )
+    thr->clear_pending_jni_exception_check(); // Just complain once
+  }
+}
+
+
+static inline void
+functionEnterCritical(JavaThread* thr)
+{
+  check_pending_exception(thr);
 }
 
 static inline void
@@ -187,9 +219,7 @@ functionEnter(JavaThread* thr)
   if (thr->in_critical()) {
     tty->print_cr("%s", warn_other_function_in_critical);
   }
-  if (thr->has_pending_exception()) {
-    NativeReportJNIWarning(thr, "JNI call made with exception pending");
-  }
+  check_pending_exception(thr);
 }
 
 static inline void
@@ -201,9 +231,20 @@ functionEnterExceptionAllowed(JavaThread* thr)
 }
 
 static inline void
-functionExit(JNIEnv *env)
+functionExit(JavaThread* thr)
 {
-  /* nothing to do at this time */
+  JNIHandleBlock* handles = thr->active_handles();
+  size_t planned_capacity = handles->get_planned_capacity();
+  size_t live_handles = handles->get_number_of_live_handles();
+  if (live_handles > planned_capacity) {
+    IN_VM(
+      tty->print_cr("WARNING: JNI local refs: %zu, exceeds capacity: %zu",
+          live_handles, planned_capacity);
+      thr->print_stack();
+    )
+    // Complain just the once, reset to current + warn threshold
+    handles->set_planned_capacity(live_handles + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD);
+  }
 }
 
 static inline void
@@ -508,7 +549,7 @@ JNI_ENTRY_CHECKED(jclass,
       jniCheck::validate_object(thr, loader);
     )
     jclass result = UNCHECKED()->DefineClass(env, name, loader, buf, len);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -520,7 +561,7 @@ JNI_ENTRY_CHECKED(jclass,
       jniCheck::validate_class_descriptor(thr, name);
     )
     jclass result = UNCHECKED()->FindClass(env, name);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -532,7 +573,7 @@ JNI_ENTRY_CHECKED(jmethodID,
       jniCheck::validate_object(thr, method);
     )
     jmethodID result = UNCHECKED()->FromReflectedMethod(env, method);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -544,7 +585,7 @@ JNI_ENTRY_CHECKED(jfieldID,
       jniCheck::validate_object(thr, field);
     )
     jfieldID result = UNCHECKED()->FromReflectedField(env, field);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -560,7 +601,7 @@ JNI_ENTRY_CHECKED(jobject,
     )
     jobject result = UNCHECKED()->ToReflectedMethod(env, cls, methodID,
                                                     isStatic);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -572,7 +613,7 @@ JNI_ENTRY_CHECKED(jclass,
       jniCheck::validate_class(thr, sub, true);
     )
     jclass result = UNCHECKED()->GetSuperclass(env, sub);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -586,7 +627,7 @@ JNI_ENTRY_CHECKED(jboolean,
       jniCheck::validate_class(thr, sup, true);
     )
     jboolean result = UNCHECKED()->IsAssignableFrom(env, sub, sup);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -601,7 +642,7 @@ JNI_ENTRY_CHECKED(jobject,
     )
     jobject result = UNCHECKED()->ToReflectedField(env, cls, fieldID,
                                                    isStatic);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -619,7 +660,7 @@ JNI_ENTRY_CHECKED(jint,
       }
     )
     jint result = UNCHECKED()->Throw(env, obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -634,15 +675,16 @@ JNI_ENTRY_CHECKED(jint,
       jniCheck::validate_throwable_klass(thr, k);
     )
     jint result = UNCHECKED()->ThrowNew(env, clazz, msg);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
 JNI_ENTRY_CHECKED(jthrowable,
   checked_jni_ExceptionOccurred(JNIEnv *env))
+    thr->clear_pending_jni_exception_check();
     functionEnterExceptionAllowed(thr);
     jthrowable result = UNCHECKED()->ExceptionOccurred(env);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -650,22 +692,24 @@ JNI_ENTRY_CHECKED(void,
   checked_jni_ExceptionDescribe(JNIEnv *env))
     functionEnterExceptionAllowed(thr);
     UNCHECKED()->ExceptionDescribe(env);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
   checked_jni_ExceptionClear(JNIEnv *env))
+    thr->clear_pending_jni_exception_check();
     functionEnterExceptionAllowed(thr);
     UNCHECKED()->ExceptionClear(env);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
   checked_jni_FatalError(JNIEnv *env,
                          const char *msg))
+    thr->clear_pending_jni_exception_check();
     functionEnter(thr);
     UNCHECKED()->FatalError(env, msg);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jint,
@@ -675,7 +719,10 @@ JNI_ENTRY_CHECKED(jint,
     if (capacity < 0)
       NativeReportJNIFatalError(thr, "negative capacity");
     jint result = UNCHECKED()->PushLocalFrame(env, capacity);
-    functionExit(env);
+    if (result == JNI_OK) {
+      thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD);
+    }
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -684,7 +731,7 @@ JNI_ENTRY_CHECKED(jobject,
                             jobject result))
     functionEnterExceptionAllowed(thr);
     jobject res = UNCHECKED()->PopLocalFrame(env, result);
-    functionExit(env);
+    functionExit(thr);
     return res;
 JNI_END
 
@@ -698,7 +745,7 @@ JNI_ENTRY_CHECKED(jobject,
       }
     )
     jobject result = UNCHECKED()->NewGlobalRef(env,lobj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -714,7 +761,7 @@ JNI_ENTRY_CHECKED(void,
       }
     )
     UNCHECKED()->DeleteGlobalRef(env,gref);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -729,7 +776,7 @@ JNI_ENTRY_CHECKED(void,
             "Invalid local JNI handle passed to DeleteLocalRef");
     )
     UNCHECKED()->DeleteLocalRef(env, obj);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jboolean,
@@ -750,7 +797,7 @@ JNI_ENTRY_CHECKED(jboolean,
       }
     )
     jboolean result = UNCHECKED()->IsSameObject(env,obj1,obj2);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -764,7 +811,7 @@ JNI_ENTRY_CHECKED(jobject,
       }
     )
     jobject result = UNCHECKED()->NewLocalRef(env, ref);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -776,7 +823,10 @@ JNI_ENTRY_CHECKED(jint,
       NativeReportJNIFatalError(thr, "negative capacity");
     }
     jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity);
-    functionExit(env);
+    if (result == JNI_OK) {
+      thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD);
+    }
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -788,7 +838,7 @@ JNI_ENTRY_CHECKED(jobject,
       jniCheck::validate_class(thr, clazz, false);
     )
     jobject result = UNCHECKED()->AllocObject(env,clazz);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -806,7 +856,7 @@ JNI_ENTRY_CHECKED(jobject,
     va_start(args, methodID);
     jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
     va_end(args);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -821,7 +871,7 @@ JNI_ENTRY_CHECKED(jobject,
       jniCheck::validate_jmethod_id(thr, methodID);
     )
     jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -836,7 +886,7 @@ JNI_ENTRY_CHECKED(jobject,
       jniCheck::validate_jmethod_id(thr, methodID);
     )
     jobject result = UNCHECKED()->NewObjectA(env,clazz,methodID,args);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -848,7 +898,7 @@ JNI_ENTRY_CHECKED(jclass,
       jniCheck::validate_object(thr, obj);
     )
     jclass result = UNCHECKED()->GetObjectClass(env,obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -862,7 +912,7 @@ JNI_ENTRY_CHECKED(jboolean,
       jniCheck::validate_class(thr, clazz, true);
     )
     jboolean result = UNCHECKED()->IsInstanceOf(env,obj,clazz);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -876,7 +926,7 @@ JNI_ENTRY_CHECKED(jmethodID,
       jniCheck::validate_class(thr, clazz, false);
     )
     jmethodID result = UNCHECKED()->GetMethodID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -895,7 +945,8 @@ JNI_ENTRY_CHECKED(ResultType,  \
     ResultType result =UNCHECKED()->Call##Result##MethodV(env, obj, methodID, \
                                                           args); \
     va_end(args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Call"#Result"Method"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -910,7 +961,8 @@ JNI_ENTRY_CHECKED(ResultType,  \
     ) \
     ResultType result = UNCHECKED()->Call##Result##MethodV(env, obj, methodID,\
                                                            args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Call"#Result"MethodV"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -925,7 +977,8 @@ JNI_ENTRY_CHECKED(ResultType,  \
     ) \
     ResultType result = UNCHECKED()->Call##Result##MethodA(env, obj, methodID,\
                                                            args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Call"#Result"MethodA"); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -952,7 +1005,8 @@ JNI_ENTRY_CHECKED(void,
     va_start(args,methodID);
     UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
     va_end(args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallVoidMethod");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -965,7 +1019,8 @@ JNI_ENTRY_CHECKED(void,
       jniCheck::validate_call_object(thr, obj, methodID);
     )
     UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallVoidMethodV");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -978,7 +1033,8 @@ JNI_ENTRY_CHECKED(void,
       jniCheck::validate_call_object(thr, obj, methodID);
     )
     UNCHECKED()->CallVoidMethodA(env,obj,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallVoidMethodA");
+    functionExit(thr);
 JNI_END
 
 #define WRAPPER_CallNonvirtualMethod(ResultType, Result) \
@@ -1001,7 +1057,8 @@ JNI_ENTRY_CHECKED(ResultType,  \
                                                                      methodID,\
                                                                      args); \
     va_end(args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallNonvirtual"#Result"Method"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -1021,7 +1078,8 @@ JNI_ENTRY_CHECKED(ResultType,  \
                                                                      clazz, \
                                                                      methodID,\
                                                                      args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodV"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -1041,7 +1099,8 @@ JNI_ENTRY_CHECKED(ResultType,  \
                                                                      clazz, \
                                                                      methodID,\
                                                                      args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodA"); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1070,7 +1129,8 @@ JNI_ENTRY_CHECKED(void,
     va_start(args,methodID);
     UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
     va_end(args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallNonvirtualVoidMethod");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1085,7 +1145,8 @@ JNI_ENTRY_CHECKED(void,
       jniCheck::validate_call_class(thr, clazz, methodID);
     )
     UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodV");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1100,7 +1161,8 @@ JNI_ENTRY_CHECKED(void,
       jniCheck::validate_call_class(thr, clazz, methodID);
     )
     UNCHECKED()->CallNonvirtualVoidMethodA(env,obj,clazz,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodA");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jfieldID,
@@ -1113,7 +1175,7 @@ JNI_ENTRY_CHECKED(jfieldID,
       jniCheck::validate_class(thr, clazz, false);
     )
     jfieldID result = UNCHECKED()->GetFieldID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1127,7 +1189,7 @@ JNI_ENTRY_CHECKED(ReturnType,  \
       checkInstanceFieldID(thr, fieldID, obj, FieldType); \
     ) \
     ReturnType result = UNCHECKED()->Get##Result##Field(env,obj,fieldID); \
-    functionExit(env); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1152,7 +1214,7 @@ JNI_ENTRY_CHECKED(void,  \
       checkInstanceFieldID(thr, fieldID, obj, FieldType); \
     ) \
     UNCHECKED()->Set##Result##Field(env,obj,fieldID,val); \
-    functionExit(env); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_SetField(jobject,  Object,  T_OBJECT)
@@ -1176,7 +1238,7 @@ JNI_ENTRY_CHECKED(jmethodID,
       jniCheck::validate_class(thr, clazz, false);
     )
     jmethodID result = UNCHECKED()->GetStaticMethodID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1198,7 +1260,8 @@ JNI_ENTRY_CHECKED(ReturnType,  \
                                                                  methodID, \
                                                                  args); \
     va_end(args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallStatic"#Result"Method"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -1216,7 +1279,8 @@ JNI_ENTRY_CHECKED(ReturnType,  \
                                                                  clazz, \
                                                                  methodID, \
                                                                  args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallStatic"#Result"MethodV"); \
+    functionExit(thr); \
     return result; \
 JNI_END \
 \
@@ -1234,7 +1298,8 @@ JNI_ENTRY_CHECKED(ReturnType,  \
                                                                  clazz, \
                                                                  methodID, \
                                                                  args); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("CallStatic"#Result"MethodA"); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1262,7 +1327,8 @@ JNI_ENTRY_CHECKED(void,
     va_start(args,methodID);
     UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
     va_end(args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallStaticVoidMethod");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1276,7 +1342,8 @@ JNI_ENTRY_CHECKED(void,
       jniCheck::validate_class(thr, cls, false);
     )
     UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallStaticVoidMethodV");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1290,7 +1357,8 @@ JNI_ENTRY_CHECKED(void,
       jniCheck::validate_class(thr, cls, false);
     )
     UNCHECKED()->CallStaticVoidMethodA(env,cls,methodID,args);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("CallStaticVoidMethodA");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jfieldID,
@@ -1303,7 +1371,7 @@ JNI_ENTRY_CHECKED(jfieldID,
       jniCheck::validate_class(thr, clazz, false);
     )
     jfieldID result = UNCHECKED()->GetStaticFieldID(env,clazz,name,sig);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1320,7 +1388,7 @@ JNI_ENTRY_CHECKED(ReturnType,  \
     ReturnType result = UNCHECKED()->GetStatic##Result##Field(env, \
                                                               clazz, \
                                                               fieldID); \
-    functionExit(env); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1346,7 +1414,7 @@ JNI_ENTRY_CHECKED(void,  \
       checkStaticFieldID(thr, fieldID, clazz, FieldType); \
     ) \
     UNCHECKED()->SetStatic##Result##Field(env,clazz,fieldID,value); \
-    functionExit(env); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_SetStaticField(jobject,  Object,  T_OBJECT)
@@ -1366,7 +1434,7 @@ JNI_ENTRY_CHECKED(jstring,
                         jsize len))
     functionEnter(thr);
     jstring result = UNCHECKED()->NewString(env,unicode,len);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1378,7 +1446,7 @@ JNI_ENTRY_CHECKED(jsize,
       checkString(thr, str);
     )
     jsize result = UNCHECKED()->GetStringLength(env,str);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1407,7 +1475,7 @@ JNI_ENTRY_CHECKED(const jchar *,
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
       FreeHeap((char*)result);
     }
-    functionExit(env);
+    functionExit(thr);
     return new_result;
 JNI_END
 
@@ -1442,7 +1510,7 @@ JNI_ENTRY_CHECKED(void,
        UNCHECKED()->ReleaseStringChars(env, str,
            (const jchar*) guarded.release_for_freeing());
     }
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jstring,
@@ -1450,7 +1518,7 @@ JNI_ENTRY_CHECKED(jstring,
                            const char *utf))
     functionEnter(thr);
     jstring result = UNCHECKED()->NewStringUTF(env,utf);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1462,7 +1530,7 @@ JNI_ENTRY_CHECKED(jsize,
       checkString(thr, str);
     )
     jsize result = UNCHECKED()->GetStringUTFLength(env,str);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1490,7 +1558,7 @@ JNI_ENTRY_CHECKED(const char *,
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
       FreeHeap((char*)result, mtInternal);
     }
-    functionExit(env);
+    functionExit(thr);
     return new_result;
 JNI_END
 
@@ -1525,7 +1593,7 @@ JNI_ENTRY_CHECKED(void,
       UNCHECKED()->ReleaseStringUTFChars(env, str,
           (const char*) guarded.release_for_freeing());
     }
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jsize,
@@ -1536,7 +1604,7 @@ JNI_ENTRY_CHECKED(jsize,
       check_is_array(thr, array);
     )
     jsize result = UNCHECKED()->GetArrayLength(env,array);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1547,7 +1615,7 @@ JNI_ENTRY_CHECKED(jobjectArray,
                              jobject init))
     functionEnter(thr);
     jobjectArray result = UNCHECKED()->NewObjectArray(env,len,clazz,init);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1560,7 +1628,8 @@ JNI_ENTRY_CHECKED(jobject,
       check_is_obj_array(thr, array);
     )
     jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("GetObjectArrayElement");
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1574,7 +1643,8 @@ JNI_ENTRY_CHECKED(void,
       check_is_obj_array(thr, array);
     )
     UNCHECKED()->SetObjectArrayElement(env,array,index,val);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("SetObjectArrayElement");
+    functionExit(thr);
 JNI_END
 
 #define WRAPPER_NewScalarArray(Return, Result) \
@@ -1583,7 +1653,7 @@ JNI_ENTRY_CHECKED(Return, \
                                  jsize len)) \
     functionEnter(thr); \
     Return result = UNCHECKED()->New##Result##Array(env,len); \
-    functionExit(env); \
+    functionExit(thr); \
     return (Return) result; \
 JNI_END
 
@@ -1611,7 +1681,7 @@ JNI_ENTRY_CHECKED(ElementType *,  \
     if (result != NULL) { \
       result = (ElementType *) check_jni_wrap_copy_array(thr, array, result); \
     } \
-    functionExit(env); \
+    functionExit(thr); \
     return result; \
 JNI_END
 
@@ -1639,7 +1709,7 @@ JNI_ENTRY_CHECKED(void,  \
     ElementType* orig_result = (ElementType *) check_wrapped_array_release( \
         thr, "checked_jni_Release"#Result"ArrayElements", array, elems, mode); \
     UNCHECKED()->Release##Result##ArrayElements(env, array, orig_result, mode); \
-    functionExit(env); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_ReleaseScalarArrayElements(T_BOOLEAN,jboolean, Boolean, bool)
@@ -1663,7 +1733,8 @@ JNI_ENTRY_CHECKED(void,  \
       check_primitive_array_type(thr, array, ElementTag); \
     ) \
     UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Get"#Result"ArrayRegion"); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_GetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
@@ -1687,7 +1758,8 @@ JNI_ENTRY_CHECKED(void,  \
       check_primitive_array_type(thr, array, ElementTag); \
     ) \
     UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \
-    functionExit(env); \
+    thr->set_pending_jni_exception_check("Set"#Result"ArrayRegion"); \
+    functionExit(thr); \
 JNI_END
 
 WRAPPER_SetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
@@ -1706,7 +1778,7 @@ JNI_ENTRY_CHECKED(jint,
                               jint nMethods))
     functionEnter(thr);
     jint result = UNCHECKED()->RegisterNatives(env,clazz,methods,nMethods);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1715,7 +1787,7 @@ JNI_ENTRY_CHECKED(jint,
                                 jclass clazz))
     functionEnter(thr);
     jint result = UNCHECKED()->UnregisterNatives(env,clazz);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1727,7 +1799,7 @@ JNI_ENTRY_CHECKED(jint,
       jniCheck::validate_object(thr, obj);
     )
     jint result = UNCHECKED()->MonitorEnter(env,obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1739,7 +1811,7 @@ JNI_ENTRY_CHECKED(jint,
       jniCheck::validate_object(thr, obj);
     )
     jint result = UNCHECKED()->MonitorExit(env,obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1748,7 +1820,7 @@ JNI_ENTRY_CHECKED(jint,
                         JavaVM **vm))
     functionEnter(thr);
     jint result = UNCHECKED()->GetJavaVM(env,vm);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1763,7 +1835,8 @@ JNI_ENTRY_CHECKED(void,
       checkString(thr, str);
     )
     UNCHECKED()->GetStringRegion(env, str, start, len, buf);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("GetStringRegion");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void,
@@ -1777,7 +1850,8 @@ JNI_ENTRY_CHECKED(void,
       checkString(thr, str);
     )
     UNCHECKED()->GetStringUTFRegion(env, str, start, len, buf);
-    functionExit(env);
+    thr->set_pending_jni_exception_check("GetStringUTFRegion");
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(void *,
@@ -1792,7 +1866,7 @@ JNI_ENTRY_CHECKED(void *,
     if (result != NULL) {
       result = check_jni_wrap_copy_array(thr, array, result);
     }
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1808,7 +1882,7 @@ JNI_ENTRY_CHECKED(void,
     // Check the element array...
     void* orig_result = check_wrapped_array_release(thr, "ReleasePrimitiveArrayCritical", array, carray, mode);
     UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, orig_result, mode);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(const jchar*,
@@ -1820,7 +1894,7 @@ JNI_ENTRY_CHECKED(const jchar*,
       checkString(thr, string);
     )
     const jchar *result = UNCHECKED()->GetStringCritical(env, string, isCopy);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1836,7 +1910,7 @@ JNI_ENTRY_CHECKED(void,
      * string parameter as a minor sanity check
      */
     UNCHECKED()->ReleaseStringCritical(env, str, chars);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jweak,
@@ -1849,7 +1923,7 @@ JNI_ENTRY_CHECKED(jweak,
       }
     )
     jweak result = UNCHECKED()->NewWeakGlobalRef(env, obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1858,14 +1932,15 @@ JNI_ENTRY_CHECKED(void,
                                   jweak ref))
     functionEnterExceptionAllowed(thr);
     UNCHECKED()->DeleteWeakGlobalRef(env, ref);
-    functionExit(env);
+    functionExit(thr);
 JNI_END
 
 JNI_ENTRY_CHECKED(jboolean,
   checked_jni_ExceptionCheck(JNIEnv *env))
+    thr->clear_pending_jni_exception_check();
     functionEnterExceptionAllowed(thr);
     jboolean result = UNCHECKED()->ExceptionCheck(env);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1875,7 +1950,7 @@ JNI_ENTRY_CHECKED(jobject,
                                   jlong capacity))
     functionEnter(thr);
     jobject result = UNCHECKED()->NewDirectByteBuffer(env, address, capacity);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1884,7 +1959,7 @@ JNI_ENTRY_CHECKED(void *,
                                      jobject buf))
     functionEnter(thr);
     void* result = UNCHECKED()->GetDirectBufferAddress(env, buf);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1893,7 +1968,7 @@ JNI_ENTRY_CHECKED(jlong,
                                       jobject buf))
     functionEnter(thr);
     jlong result = UNCHECKED()->GetDirectBufferCapacity(env, buf);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1906,7 +1981,7 @@ JNI_ENTRY_CHECKED(jobjectRefType,
       jniCheck::validate_object(thr, obj);
     )
     jobjectRefType result = UNCHECKED()->GetObjectRefType(env, obj);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
@@ -1915,7 +1990,7 @@ JNI_ENTRY_CHECKED(jint,
   checked_jni_GetVersion(JNIEnv *env))
     functionEnter(thr);
     jint result = UNCHECKED()->GetVersion(env);
-    functionExit(env);
+    functionExit(thr);
     return result;
 JNI_END
 
diff --git a/hotspot/src/share/vm/runtime/jniHandles.cpp b/hotspot/src/share/vm/runtime/jniHandles.cpp
index 7ff38335029..9ce7ce8ae44 100644
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp
@@ -298,6 +298,7 @@ JNIHandleBlock* JNIHandleBlock::allocate_block(Thread* thread)  {
   block->_top  = 0;
   block->_next = NULL;
   block->_pop_frame_link = NULL;
+  block->_planned_capacity = block_size_in_oops;
   // _last, _free_list & _allocate_before_rebuild initialized in allocate_handle
   debug_only(block->_last = NULL);
   debug_only(block->_free_list = NULL);
@@ -531,6 +532,12 @@ int JNIHandleBlock::length() const {
   return result;
 }
 
+const size_t JNIHandleBlock::get_number_of_live_handles() {
+  CountHandleClosure counter;
+  oops_do(&counter);
+  return counter.count();
+}
+
 // This method is not thread-safe, i.e., must be called while holding a lock on the
 // structure.
 long JNIHandleBlock::memory_usage() const {
diff --git a/hotspot/src/share/vm/runtime/jniHandles.hpp b/hotspot/src/share/vm/runtime/jniHandles.hpp
index 1bd97c3cf09..069a1f35cfa 100644
--- a/hotspot/src/share/vm/runtime/jniHandles.hpp
+++ b/hotspot/src/share/vm/runtime/jniHandles.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -112,6 +112,9 @@ class JNIHandleBlock : public CHeapObj<mtInternal> {
   oop*            _free_list;                   // Handle free list
   int             _allocate_before_rebuild;     // Number of blocks to allocate before rebuilding free list
 
+  // Check JNI, "planned capacity" for current frame (or push/ensure)
+  size_t          _planned_capacity;
+
   #ifndef PRODUCT
   JNIHandleBlock* _block_list_link;             // Link for list below
   static JNIHandleBlock* _block_list;           // List of all allocated blocks (for debugging only)
@@ -152,6 +155,11 @@ class JNIHandleBlock : public CHeapObj<mtInternal> {
   // Traversal of weak handles. Unreachable oops are cleared.
   void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
 
+  // Checked JNI support
+  void set_planned_capacity(size_t planned_capacity) { _planned_capacity = planned_capacity; }
+  const size_t get_planned_capacity() { return _planned_capacity; }
+  const size_t get_number_of_live_handles();
+
   // Debugging
   bool chain_contains(jobject handle) const;    // Does this block or following blocks contain handle
   bool contains(jobject handle) const;          // Does this block contain handle
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 061509ae144..e3ab1725a1d 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -1448,6 +1448,7 @@ void JavaThread::initialize() {
   _thread_stat = new ThreadStatistics();
   _blocked_on_compilation = false;
   _jni_active_critical = 0;
+  _pending_jni_exception_check_fn = NULL;
   _do_not_unlock_if_synchronized = false;
   _cached_monitor_info = NULL;
   _parker = Parker::Allocate(this) ;
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index a5f0a92246d..64bed4610b0 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -915,6 +915,9 @@ class JavaThread: public Thread {
   // support for JNI critical regions
   jint    _jni_active_critical;                  // count of entries into JNI critical region
 
+  // Checked JNI: function name requires exception check
+  char* _pending_jni_exception_check_fn;
+
   // For deadlock detection.
   int _depth_first_number;
 
@@ -1400,6 +1403,12 @@ class JavaThread: public Thread {
                           assert(_jni_active_critical >= 0,
                                  "JNI critical nesting problem?"); }
 
+  // Checked JNI, is the programmer required to check for exceptions, specify which function name
+  bool is_pending_jni_exception_check() const { return _pending_jni_exception_check_fn != NULL; }
+  void clear_pending_jni_exception_check() { _pending_jni_exception_check_fn = NULL; }
+  const char* get_pending_jni_exception_check() const { return _pending_jni_exception_check_fn; }
+  void set_pending_jni_exception_check(const char* fn_name) { _pending_jni_exception_check_fn = (char*) fn_name; }
+
   // For deadlock detection
   int depth_first_number() { return _depth_first_number; }
   void set_depth_first_number(int dfn) { _depth_first_number = dfn; }
-- 
GitLab


From f829432469a75b7aa115a853a6a1ea021dd3f492 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Wed, 11 Jun 2014 13:25:15 -0700
Subject: [PATCH 068/192] 8043549: Fix raw and unchecked lint warnings in
 javax.swing.text.*

Reviewed-by: prr
---
 .../javax/swing/text/AbstractDocument.java    |  8 +++---
 .../javax/swing/text/AbstractWriter.java      |  2 +-
 .../javax/swing/text/DateFormatter.java       |  6 ++--
 .../javax/swing/text/DefaultFormatter.java    |  4 +--
 .../swing/text/DefaultStyledDocument.java     | 13 +++++----
 .../javax/swing/text/ElementIterator.java     |  2 +-
 .../classes/javax/swing/text/GapContent.java  | 16 ++++++-----
 .../classes/javax/swing/text/GlyphView.java   |  2 +-
 .../swing/text/InternationalFormatter.java    | 28 ++++++++++---------
 .../javax/swing/text/JTextComponent.java      |  1 +
 .../javax/swing/text/NumberFormatter.java     | 11 ++++----
 .../javax/swing/text/ParagraphView.java       |  2 +-
 .../javax/swing/text/SimpleAttributeSet.java  | 11 ++++----
 .../javax/swing/text/StringContent.java       | 12 ++++----
 .../javax/swing/text/StyleContext.java        | 14 +++++-----
 .../classes/javax/swing/text/TextAction.java  |  4 +--
 .../javax/swing/text/html/AccessibleHTML.java |  2 +-
 .../classes/javax/swing/text/html/CSS.java    |  6 ++--
 .../javax/swing/text/html/FormView.java       | 21 +++++++++-----
 .../javax/swing/text/html/HTMLDocument.java   | 22 ++++++++++-----
 .../javax/swing/text/html/HTMLEditorKit.java  |  4 +--
 .../javax/swing/text/html/HTMLWriter.java     | 18 ++++++------
 .../javax/swing/text/html/ImageView.java      |  7 +++--
 .../swing/text/html/MinimalHTMLWriter.java    |  4 +--
 .../swing/text/html/MuxingAttributeSet.java   |  8 +++---
 .../javax/swing/text/html/ObjectView.java     |  8 +++---
 .../swing/text/html/OptionListModel.java      |  5 ++--
 .../javax/swing/text/html/StyleSheet.java     | 21 +++++++++-----
 .../javax/swing/text/html/parser/DTD.java     |  1 +
 .../swing/text/rtf/MockAttributeSet.java      |  4 +--
 .../javax/swing/text/rtf/RTFGenerator.java    | 10 +++----
 .../javax/swing/text/rtf/RTFReader.java       | 26 ++++++++++-------
 32 files changed, 172 insertions(+), 131 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java
index a7a109f8c91..e42d549791a 100644
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java
@@ -1809,7 +1809,7 @@ public abstract class AbstractDocument implements Document, Serializable {
             if (getAttributeCount() > 0) {
                 out.println("");
                 // dump the attributes
-                Enumeration names = attributes.getAttributeNames();
+                Enumeration<?> names = attributes.getAttributeNames();
                 while (names.hasMoreElements()) {
                     Object name = names.nextElement();
                     indent(out, indentAmount + 1);
@@ -2193,7 +2193,7 @@ public abstract class AbstractDocument implements Document, Serializable {
          * <code>Enumeration</code>.
          * @return the children of the receiver as an <code>Enumeration</code>
          */
-        public abstract Enumeration children();
+        public abstract Enumeration<?> children();
 
 
         // --- serialization ---------------------------------------------
@@ -2456,7 +2456,7 @@ public abstract class AbstractDocument implements Document, Serializable {
          * <code>Enumeration</code>.
          * @return the children of the receiver
          */
-        public Enumeration children() {
+        public Enumeration<AbstractElement> children() {
             if(nchildren == 0)
                 return null;
 
@@ -2610,7 +2610,7 @@ public abstract class AbstractDocument implements Document, Serializable {
          * <code>Enumeration</code>.
          * @return the children of the receiver
          */
-        public Enumeration children() {
+        public Enumeration<?> children() {
             return null;
         }
 
diff --git a/jdk/src/share/classes/javax/swing/text/AbstractWriter.java b/jdk/src/share/classes/javax/swing/text/AbstractWriter.java
index f2f7f746ee4..cfe619b801f 100644
--- a/jdk/src/share/classes/javax/swing/text/AbstractWriter.java
+++ b/jdk/src/share/classes/javax/swing/text/AbstractWriter.java
@@ -668,7 +668,7 @@ public abstract class AbstractWriter {
      */
     protected void writeAttributes(AttributeSet attr) throws IOException {
 
-        Enumeration names = attr.getAttributeNames();
+        Enumeration<?> names = attr.getAttributeNames();
         while (names.hasMoreElements()) {
             Object name = names.nextElement();
             write(" " + name + "=" + attr.getAttribute(name));
diff --git a/jdk/src/share/classes/javax/swing/text/DateFormatter.java b/jdk/src/share/classes/javax/swing/text/DateFormatter.java
index e935053bfc8..b82788fb6a2 100644
--- a/jdk/src/share/classes/javax/swing/text/DateFormatter.java
+++ b/jdk/src/share/classes/javax/swing/text/DateFormatter.java
@@ -108,8 +108,8 @@ public class DateFormatter extends InternationalFormatter {
     /**
      * Returns the field that will be adjusted by adjustValue.
      */
-    Object getAdjustField(int start, Map attributes) {
-        Iterator attrs = attributes.keySet().iterator();
+    Object getAdjustField(int start, Map<?, ?> attributes) {
+        Iterator<?> attrs = attributes.keySet().iterator();
 
         while (attrs.hasNext()) {
             Object key = attrs.next();
@@ -127,7 +127,7 @@ public class DateFormatter extends InternationalFormatter {
      * Adjusts the Date if FieldPosition identifies a known calendar
      * field.
      */
-    Object adjustValue(Object value, Map attributes, Object key,
+    Object adjustValue(Object value, Map<?, ?> attributes, Object key,
                            int direction) throws
                       BadLocationException, ParseException {
         if (key != null) {
diff --git a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java
index 0a4df2c0a1d..ee9cda6e85f 100644
--- a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java
+++ b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java
@@ -246,12 +246,12 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
             }
         }
         if (vc != null) {
-            Constructor cons;
+            Constructor<?> cons;
 
             try {
                 ReflectUtil.checkPackageAccess(vc);
                 SwingUtilities2.checkAccess(vc.getModifiers());
-                cons = vc.getConstructor(new Class[]{String.class});
+                cons = vc.getConstructor(new Class<?>[]{String.class});
 
             } catch (NoSuchMethodException nsme) {
                 cons = null;
diff --git a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java
index a5ce0633f74..78788cbfad1 100644
--- a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java
+++ b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java
@@ -1048,8 +1048,9 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc
                 styleChangeListener = createStyleChangeListener();
             }
             if (styleChangeListener != null && styles != null) {
-                Enumeration styleNames = styles.getStyleNames();
-                Vector v = (Vector)listeningStyles.clone();
+                Enumeration<?> styleNames = styles.getStyleNames();
+                @SuppressWarnings("unchecked")
+                Vector<Style> v = (Vector<Style>)listeningStyles.clone();
                 listeningStyles.removeAllElements();
                 List<ChangeListener> staleListeners =
                     AbstractChangeHandler.getStaleListeners(styleChangeListener);
@@ -1069,7 +1070,7 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc
                     }
                 }
                 for (int counter = v.size() - 1; counter >= 0; counter--) {
-                    Style aStyle = (Style)v.elementAt(counter);
+                    Style aStyle = v.elementAt(counter);
                     aStyle.removeChangeListener(styleChangeListener);
                 }
                 if (listeningStyles.size() == 0) {
@@ -2630,14 +2631,14 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc
         }
 
         /** Class-specific reference queues.  */
-        private final static Map<Class, ReferenceQueue<DefaultStyledDocument>> queueMap
-                = new HashMap<Class, ReferenceQueue<DefaultStyledDocument>>();
+        private final static Map<Class<?>, ReferenceQueue<DefaultStyledDocument>> queueMap
+                = new HashMap<Class<?>, ReferenceQueue<DefaultStyledDocument>>();
 
         /** A weak reference to the document object.  */
         private DocReference doc;
 
         AbstractChangeHandler(DefaultStyledDocument d) {
-            Class c = getClass();
+            Class<?> c = getClass();
             ReferenceQueue<DefaultStyledDocument> q;
             synchronized (queueMap) {
                 q = queueMap.get(c);
diff --git a/jdk/src/share/classes/javax/swing/text/ElementIterator.java b/jdk/src/share/classes/javax/swing/text/ElementIterator.java
index 959a18b6945..ae6b99ab0d7 100644
--- a/jdk/src/share/classes/javax/swing/text/ElementIterator.java
+++ b/jdk/src/share/classes/javax/swing/text/ElementIterator.java
@@ -361,7 +361,7 @@ public class ElementIterator implements Cloneable {
                 System.out.println("elem: " + elem.getName());
                 AttributeSet attr = elem.getAttributes();
                 String s = "";
-                Enumeration names = attr.getAttributeNames();
+                Enumeration<?> names = attr.getAttributeNames();
                 while (names.hasMoreElements()) {
                     Object key = names.nextElement();
                     Object value = attr.getAttribute(key);
diff --git a/jdk/src/share/classes/javax/swing/text/GapContent.java b/jdk/src/share/classes/javax/swing/text/GapContent.java
index fff2292e211..24a503e9dea 100644
--- a/jdk/src/share/classes/javax/swing/text/GapContent.java
+++ b/jdk/src/share/classes/javax/swing/text/GapContent.java
@@ -710,7 +710,8 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S
      * @param length the length &gt;= 0
      * @return the set of instances
      */
-    protected Vector getPositionsInRange(Vector v, int offset, int length) {
+    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v,
+                                                     int offset, int length) {
         int endOffset = offset + length;
         int startIndex;
         int endIndex;
@@ -738,8 +739,9 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S
             endIndex = findMarkAdjustIndex(endOffset + (g1 - g0) + 1);
         }
 
-        Vector placeIn = (v == null) ? new Vector(Math.max(1, endIndex -
-                                                           startIndex)) : v;
+        Vector<UndoPosRef> placeIn = (v == null) ?
+            new Vector<>(Math.max(1, endIndex - startIndex)) :
+            v;
 
         for (int counter = startIndex; counter < endIndex; counter++) {
             placeIn.addElement(new UndoPosRef(marks.elementAt(counter)));
@@ -756,7 +758,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S
      *
      * @param positions the UndoPosRef instances to reset
      */
-    protected void updateUndoPositions(Vector positions, int offset,
+    protected void updateUndoPositions(Vector<UndoPosRef> positions, int offset,
                                        int length) {
         // Find the indexs of the end points.
         int endOffset = offset + length;
@@ -773,7 +775,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S
 
         // Reset the location of the refenences.
         for(int counter = positions.size() - 1; counter >= 0; counter--) {
-            UndoPosRef ref = (UndoPosRef)positions.elementAt(counter);
+            UndoPosRef ref = positions.elementAt(counter);
             ref.resetLocation(endOffset, g1);
         }
         // We have to resort the marks in the range startIndex to endIndex.
@@ -900,7 +902,7 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S
         protected String string;
         /** An array of instances of UndoPosRef for the Positions in the
          * range that was removed, valid after undo. */
-        protected Vector posRefs;
+        protected Vector<UndoPosRef> posRefs;
     } // GapContent.InsertUndo
 
 
@@ -952,6 +954,6 @@ public class GapContent extends GapVector implements AbstractDocument.Content, S
         protected String string;
         /** An array of instances of UndoPosRef for the Positions in the
          * range that was removed, valid before undo. */
-        protected Vector posRefs;
+        protected Vector<UndoPosRef> posRefs;
     } // GapContent.RemoveUndo
 }
diff --git a/jdk/src/share/classes/javax/swing/text/GlyphView.java b/jdk/src/share/classes/javax/swing/text/GlyphView.java
index e848f2af63c..829dc5bbd86 100644
--- a/jdk/src/share/classes/javax/swing/text/GlyphView.java
+++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java
@@ -253,7 +253,7 @@ public class GlyphView extends View implements TabableView, Cloneable {
                 // the classname should probably come from a property file.
                 String classname = "javax.swing.text.GlyphPainter1";
                 try {
-                    Class c;
+                    Class<?> c;
                     ClassLoader loader = getClass().getClassLoader();
                     if (loader != null) {
                         c = loader.loadClass(classname);
diff --git a/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java b/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java
index 8c91658167d..817902b65fc 100644
--- a/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java
+++ b/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java
@@ -106,11 +106,11 @@ public class InternationalFormatter extends DefaultFormatter {
     /**
      * Can be used to impose a maximum value.
      */
-    private Comparable max;
+    private Comparable<?> max;
     /**
      * Can be used to impose a minimum value.
      */
-    private Comparable min;
+    private Comparable<?> min;
 
     /**
      * <code>InternationalFormatter</code>'s behavior is dicatated by a
@@ -211,7 +211,7 @@ public class InternationalFormatter extends DefaultFormatter {
      * @param minimum Minimum legal value that can be input
      * @see #setValueClass
      */
-    public void setMinimum(Comparable minimum) {
+    public void setMinimum(Comparable<?> minimum) {
         if (getValueClass() == null && minimum != null) {
             setValueClass(minimum.getClass());
         }
@@ -223,7 +223,7 @@ public class InternationalFormatter extends DefaultFormatter {
      *
      * @return Minimum legal value that can be input
      */
-    public Comparable getMinimum() {
+    public Comparable<?> getMinimum() {
         return min;
     }
 
@@ -236,7 +236,7 @@ public class InternationalFormatter extends DefaultFormatter {
      * @param max Maximum legal value that can be input
      * @see #setValueClass
      */
-    public void setMaximum(Comparable max) {
+    public void setMaximum(Comparable<?> max) {
         if (getValueClass() == null && max != null) {
             setValueClass(max.getClass());
         }
@@ -248,7 +248,7 @@ public class InternationalFormatter extends DefaultFormatter {
      *
      * @return Maximum legal value that can be input
      */
-    public Comparable getMaximum() {
+    public Comparable<?> getMaximum() {
         return max;
     }
 
@@ -411,7 +411,8 @@ public class InternationalFormatter extends DefaultFormatter {
      *                 false is returned.
      */
     boolean isValidValue(Object value, boolean wantsCCE) {
-        Comparable min = getMinimum();
+        @SuppressWarnings("unchecked")
+        Comparable<Object> min = (Comparable<Object>)getMinimum();
 
         try {
             if (min != null && min.compareTo(value) > 0) {
@@ -424,7 +425,8 @@ public class InternationalFormatter extends DefaultFormatter {
             return false;
         }
 
-        Comparable max = getMaximum();
+        @SuppressWarnings("unchecked")
+        Comparable<Object> max = (Comparable<Object>)getMaximum();
         try {
             if (max != null && max.compareTo(value) < 0) {
                 return false;
@@ -770,7 +772,7 @@ public class InternationalFormatter extends DefaultFormatter {
     /**
      * Returns true if <code>attributes</code> is null or empty.
      */
-    boolean isLiteral(Map attributes) {
+    boolean isLiteral(Map<?, ?> attributes) {
         return ((attributes == null) || attributes.size() == 0);
     }
 
@@ -797,7 +799,7 @@ public class InternationalFormatter extends DefaultFormatter {
 
             iterator.first();
             while (iterator.current() != CharacterIterator.DONE) {
-                Map attributes = iterator.getAttributes();
+                Map<Attribute,Object> attributes = iterator.getAttributes();
                 boolean set = isLiteral(attributes);
                 int start = iterator.getIndex();
                 int end = iterator.getRunLimit();
@@ -858,7 +860,7 @@ public class InternationalFormatter extends DefaultFormatter {
     /**
      * Returns the field that will be adjusted by adjustValue.
      */
-    Object getAdjustField(int start, Map attributes) {
+    Object getAdjustField(int start, Map<?, ?> attributes) {
         return null;
     }
 
@@ -900,7 +902,7 @@ public class InternationalFormatter extends DefaultFormatter {
      * null depending upon <code>canIncrement</code>) and
      * <code>direction</code> is the amount to increment by.
      */
-    Object adjustValue(Object value, Map attributes, Object field,
+    Object adjustValue(Object value, Map<?, ?> attributes, Object field,
                            int direction) throws
                       BadLocationException, ParseException {
         return null;
@@ -1023,7 +1025,7 @@ public class InternationalFormatter extends DefaultFormatter {
 
                         iterator.setIndex(start);
 
-                        Map attributes = iterator.getAttributes();
+                        Map<Attribute,Object> attributes = iterator.getAttributes();
                         Object field = getAdjustField(start, attributes);
 
                         if (canIncrement(field, start)) {
diff --git a/jdk/src/share/classes/javax/swing/text/JTextComponent.java b/jdk/src/share/classes/javax/swing/text/JTextComponent.java
index ca3c9ebef1a..8d67e965f8f 100644
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java
@@ -1091,6 +1091,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
     private static HashMap<String,Keymap> getKeymapTable() {
         synchronized (KEYMAP_TABLE) {
             AppContext appContext = AppContext.getAppContext();
+            @SuppressWarnings("unchecked")
             HashMap<String,Keymap> keymapTable =
                 (HashMap<String,Keymap>)appContext.get(KEYMAP_TABLE);
             if (keymapTable == null) {
diff --git a/jdk/src/share/classes/javax/swing/text/NumberFormatter.java b/jdk/src/share/classes/javax/swing/text/NumberFormatter.java
index bcc518ce39e..5b5cb3920df 100644
--- a/jdk/src/share/classes/javax/swing/text/NumberFormatter.java
+++ b/jdk/src/share/classes/javax/swing/text/NumberFormatter.java
@@ -173,7 +173,8 @@ public class NumberFormatter extends InternationalFormatter {
      * <code>Byte</code> or <code>Short</code> and <code>value</code>
      * is an instanceof <code>Number</code>.
      */
-    private Object convertValueToValueClass(Object value, Class valueClass) {
+    private Object convertValueToValueClass(Object value,
+                                            Class<?> valueClass) {
         if (valueClass != null && (value instanceof Number)) {
             Number numberValue = (Number)value;
             if (valueClass == Integer.class) {
@@ -266,7 +267,7 @@ public class NumberFormatter extends InternationalFormatter {
      * Subclassed to treat the decimal separator, grouping separator,
      * exponent symbol, percent, permille, currency and sign as literals.
      */
-    boolean isLiteral(Map attrs) {
+    boolean isLiteral(Map<?, ?> attrs) {
         if (!super.isLiteral(attrs)) {
             if (attrs == null) {
                 return false;
@@ -327,7 +328,7 @@ public class NumberFormatter extends InternationalFormatter {
             while (index >= 0 && index < max) {
                 iterator.setIndex(index);
 
-                Map attrs = iterator.getAttributes();
+                Map<?,?> attrs = iterator.getAttributes();
 
                 if (attrs != null && attrs.size() > 0) {
                     for (Object key : attrs.keySet()) {
@@ -432,8 +433,8 @@ public class NumberFormatter extends InternationalFormatter {
                     try {
                         ReflectUtil.checkPackageAccess(valueClass);
                         SwingUtilities2.checkAccess(valueClass.getModifiers());
-                        Constructor cons = valueClass.getConstructor(
-                                              new Class[] { String.class });
+                        Constructor<?> cons = valueClass.getConstructor(
+                                              new Class<?>[] { String.class });
                         if (cons != null) {
                             SwingUtilities2.checkAccess(cons.getModifiers());
                             return cons.newInstance(new Object[]{string});
diff --git a/jdk/src/share/classes/javax/swing/text/ParagraphView.java b/jdk/src/share/classes/javax/swing/text/ParagraphView.java
index b045548c05e..01818e9a289 100644
--- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java
+++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java
@@ -806,7 +806,7 @@ public class ParagraphView extends FlowView implements TabExpander {
     /**
      * Used to create an i18n-based layout strategy
      */
-    static Class i18nStrategy;
+    static Class<?> i18nStrategy;
 
     /** Used for searching for a tab. */
     static char[] tabChars;
diff --git a/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java b/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java
index e7646368290..ca337008d73 100644
--- a/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java
+++ b/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java
@@ -172,7 +172,7 @@ public class SimpleAttributeSet implements MutableAttributeSet, Serializable, Cl
     public boolean containsAttributes(AttributeSet attributes) {
         boolean result = true;
 
-        Enumeration names = attributes.getAttributeNames();
+        Enumeration<?> names = attributes.getAttributeNames();
         while (result && names.hasMoreElements()) {
             Object name = names.nextElement();
             result = attributes.getAttribute(name).equals(getAttribute(name));
@@ -197,7 +197,7 @@ public class SimpleAttributeSet implements MutableAttributeSet, Serializable, Cl
      * @param attributes the set of attributes to add
      */
     public void addAttributes(AttributeSet attributes) {
-        Enumeration names = attributes.getAttributeNames();
+        Enumeration<?> names = attributes.getAttributeNames();
         while (names.hasMoreElements()) {
             Object name = names.nextElement();
             addAttribute(name, attributes.getAttribute(name));
@@ -233,7 +233,7 @@ public class SimpleAttributeSet implements MutableAttributeSet, Serializable, Cl
             table.clear();
         }
         else {
-            Enumeration names = attributes.getAttributeNames();
+            Enumeration<?> names = attributes.getAttributeNames();
             while (names.hasMoreElements()) {
                 Object name = names.nextElement();
                 Object value = attributes.getAttribute(name);
@@ -272,6 +272,7 @@ public class SimpleAttributeSet implements MutableAttributeSet, Serializable, Cl
      *
      * @return the new set of attributes
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     public Object clone() {
         SimpleAttributeSet attr;
         try {
@@ -317,7 +318,7 @@ public class SimpleAttributeSet implements MutableAttributeSet, Serializable, Cl
      */
     public String toString() {
         String s = "";
-        Enumeration names = getAttributeNames();
+        Enumeration<?> names = getAttributeNames();
         while (names.hasMoreElements()) {
             Object key = names.nextElement();
             Object value = getAttribute(key);
@@ -364,7 +365,7 @@ public class SimpleAttributeSet implements MutableAttributeSet, Serializable, Cl
         public Object getAttribute(Object key) {
             return null;
         }
-        public Enumeration getAttributeNames() {
+        public Enumeration<?> getAttributeNames() {
             return Collections.emptyEnumeration();
         }
         public boolean containsAttribute(Object name, Object value) {
diff --git a/jdk/src/share/classes/javax/swing/text/StringContent.java b/jdk/src/share/classes/javax/swing/text/StringContent.java
index 99b8d5d3eb8..3da8c41235b 100644
--- a/jdk/src/share/classes/javax/swing/text/StringContent.java
+++ b/jdk/src/share/classes/javax/swing/text/StringContent.java
@@ -271,11 +271,11 @@ public final class StringContent implements AbstractDocument.Content, Serializab
      * @param length the length &gt;= 0
      * @return the set of instances
      */
-    protected Vector getPositionsInRange(Vector v, int offset,
+    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v, int offset,
                                                       int length) {
         int n = marks.size();
         int end = offset + length;
-        Vector placeIn = (v == null) ? new Vector() : v;
+        Vector<UndoPosRef> placeIn = (v == null) ? new Vector<>() : v;
         for (int i = 0; i < n; i++) {
             PosRec mark = marks.elementAt(i);
             if (mark.unused) {
@@ -298,9 +298,9 @@ public final class StringContent implements AbstractDocument.Content, Serializab
      *
      * @param positions the positions of the instances
      */
-    protected void updateUndoPositions(Vector positions) {
+    protected void updateUndoPositions(Vector<UndoPosRef> positions) {
         for(int counter = positions.size() - 1; counter >= 0; counter--) {
-            UndoPosRef ref = (UndoPosRef)positions.elementAt(counter);
+            UndoPosRef ref = positions.elementAt(counter);
             // Check if the Position is still valid.
             if(ref.rec.unused) {
                 positions.removeElementAt(counter);
@@ -437,7 +437,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab
         protected String string;
         // An array of instances of UndoPosRef for the Positions in the
         // range that was removed, valid after undo.
-        protected Vector posRefs;
+        protected Vector<UndoPosRef> posRefs;
     }
 
 
@@ -494,6 +494,6 @@ public final class StringContent implements AbstractDocument.Content, Serializab
         protected String string;
         // An array of instances of UndoPosRef for the Positions in the
         // range that was removed, valid before undo.
-        protected Vector posRefs;
+        protected Vector<UndoPosRef> posRefs;
     }
 }
diff --git a/jdk/src/share/classes/javax/swing/text/StyleContext.java b/jdk/src/share/classes/javax/swing/text/StyleContext.java
index 8d7975b1395..2b02f4befca 100644
--- a/jdk/src/share/classes/javax/swing/text/StyleContext.java
+++ b/jdk/src/share/classes/javax/swing/text/StyleContext.java
@@ -589,7 +589,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon
                                          AttributeSet a) throws IOException {
         int n = a.getAttributeCount();
         out.writeInt(n);
-        Enumeration keys = a.getAttributeNames();
+        Enumeration<?> keys = a.getAttributeNames();
         while (keys.hasMoreElements()) {
             Object key = keys.nextElement();
             if (key instanceof Serializable) {
@@ -771,7 +771,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon
         public SmallAttributeSet(AttributeSet attrs) {
             int n = attrs.getAttributeCount();
             Object[] tbl = new Object[2 * n];
-            Enumeration names = attrs.getAttributeNames();
+            Enumeration<?> names = attrs.getAttributeNames();
             int i = 0;
             while (names.hasMoreElements()) {
                 tbl[i] = names.nextElement();
@@ -971,7 +971,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon
         public boolean containsAttributes(AttributeSet attrs) {
             boolean result = true;
 
-            Enumeration names = attrs.getAttributeNames();
+            Enumeration<?> names = attrs.getAttributeNames();
             while (result && names.hasMoreElements()) {
                 Object name = names.nextElement();
                 result = attrs.getAttribute(name).equals(getAttribute(name));
@@ -1051,7 +1051,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon
             } else {
                 keys.removeAllElements();
                 data.removeAllElements();
-                Enumeration names = a.getAttributeNames();
+                Enumeration<?> names = a.getAttributeNames();
                 while (names.hasMoreElements()) {
                     Object name = names.nextElement();
                     addAttribute(name, a.getAttribute(name));
@@ -1117,7 +1117,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon
                     addAttribute(tbl[i], tbl[i+1]);
                 }
             } else {
-                Enumeration names = attr.getAttributeNames();
+                Enumeration<?> names = attr.getAttributeNames();
                 while (names.hasMoreElements()) {
                     Object name = names.nextElement();
                     addAttribute(name, attr.getAttribute(name));
@@ -1142,7 +1142,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon
         /**
          * Removes the set of keys from the set.
          */
-        public void removeAttributes(Enumeration names) {
+        public void removeAttributes(Enumeration<?> names) {
             while (names.hasMoreElements()) {
                 Object name = names.nextElement();
                 removeAttribute(name);
@@ -1153,7 +1153,7 @@ public class StyleContext implements Serializable, AbstractDocument.AttributeCon
          * Removes the set of matching attributes from the set.
          */
         public void removeAttributes(AttributeSet attr) {
-            Enumeration names = attr.getAttributeNames();
+            Enumeration<?> names = attr.getAttributeNames();
             while (names.hasMoreElements()) {
                 Object name = names.nextElement();
                 Object value = attr.getAttribute(name);
diff --git a/jdk/src/share/classes/javax/swing/text/TextAction.java b/jdk/src/share/classes/javax/swing/text/TextAction.java
index 9e7d9f78369..df03bfc1661 100644
--- a/jdk/src/share/classes/javax/swing/text/TextAction.java
+++ b/jdk/src/share/classes/javax/swing/text/TextAction.java
@@ -115,8 +115,8 @@ public abstract class TextAction extends AbstractAction {
         }
         Action[] actions = new Action[h.size()];
         int index = 0;
-        for (Enumeration e = h.elements() ; e.hasMoreElements() ;) {
-            actions[index++] = (Action) e.nextElement();
+        for (Enumeration<Action> e = h.elements() ; e.hasMoreElements() ;) {
+            actions[index++] = e.nextElement();
         }
         return actions;
     }
diff --git a/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java b/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java
index bd878da0848..e434066d2bd 100644
--- a/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java
+++ b/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java
@@ -2740,7 +2740,7 @@ class AccessibleHTML implements Accessible {
          * <code>child</code> isn't a valid child.
          */
         public int indexOf(ElementInfo child) {
-            ArrayList children = this.children;
+            ArrayList<ElementInfo> children = this.children;
 
             if (children != null) {
                 return children.indexOf(child);
diff --git a/jdk/src/share/classes/javax/swing/text/html/CSS.java b/jdk/src/share/classes/javax/swing/text/html/CSS.java
index 16f67026796..f04e03d54f7 100644
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java
@@ -1370,7 +1370,7 @@ public class CSS implements Serializable {
 
     private void translateEmbeddedAttributes(AttributeSet htmlAttrSet,
                                              MutableAttributeSet cssAttrSet) {
-        Enumeration keys = htmlAttrSet.getAttributeNames();
+        Enumeration<?> keys = htmlAttrSet.getAttributeNames();
         if (htmlAttrSet.getAttribute(StyleConstants.NameAttribute) ==
             HTML.Tag.HR) {
             // HR needs special handling due to us treating it as a leaf.
@@ -1393,7 +1393,7 @@ public class CSS implements Serializable {
     private void translateAttributes(HTML.Tag tag,
                                             AttributeSet htmlAttrSet,
                                             MutableAttributeSet cssAttrSet) {
-        Enumeration names = htmlAttrSet.getAttributeNames();
+        Enumeration<?> names = htmlAttrSet.getAttributeNames();
         while (names.hasMoreElements()) {
             Object name = names.nextElement();
 
@@ -3342,7 +3342,7 @@ public class CSS implements Serializable {
         s.defaultWriteObject();
 
         // Determine what values in valueConvertor need to be written out.
-        Enumeration keys = valueConvertor.keys();
+        Enumeration<?> keys = valueConvertor.keys();
         s.writeInt(valueConvertor.size());
         if (keys != null) {
             while (keys.hasMoreElements()) {
diff --git a/jdk/src/share/classes/javax/swing/text/html/FormView.java b/jdk/src/share/classes/javax/swing/text/html/FormView.java
index 965ef9d6618..b6de2950d4b 100644
--- a/jdk/src/share/classes/javax/swing/text/html/FormView.java
+++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java
@@ -168,8 +168,8 @@ public class FormView extends ComponentView implements ActionListener {
         } else if (t == HTML.Tag.SELECT) {
 
             if (model instanceof OptionListModel) {
-
-                JList list = new JList((ListModel) model);
+                @SuppressWarnings("unchecked")
+                JList<?> list = new JList<>((ListModel) model);
                 int size = HTML.getIntegerAttributeValue(attr,
                                                          HTML.Attribute.SIZE,
                                                          1);
@@ -177,7 +177,9 @@ public class FormView extends ComponentView implements ActionListener {
                 list.setSelectionModel((ListSelectionModel)model);
                 c = new JScrollPane(list);
             } else {
-                c = new JComboBox((ComboBoxModel) model);
+                @SuppressWarnings("unchecked")
+                JComboBox<?> tmp = new JComboBox<>((ComboBoxModel) model);
+                c = tmp;
                 maxIsPreferred = 3;
             }
         } else if (t == HTML.Tag.TEXTAREA) {
@@ -342,7 +344,8 @@ public class FormView extends ComponentView implements ActionListener {
             // BasicListUI$Handler.
             // For JComboBox, there are 2 stale ListDataListeners, which are
             // BasicListUI$Handler and BasicComboBoxUI$Handler.
-            AbstractListModel listModel = (AbstractListModel) model;
+            @SuppressWarnings("unchecked")
+            AbstractListModel<?> listModel = (AbstractListModel) model;
             String listenerClass1 =
                     "javax.swing.plaf.basic.BasicListUI$Handler";
             String listenerClass2 =
@@ -788,6 +791,7 @@ public class FormView extends ComponentView implements ActionListener {
         }
         Object m = attr.getAttribute(StyleConstants.ModelAttribute);
         if (m instanceof OptionListModel) {
+            @SuppressWarnings("unchecked")
             OptionListModel<Option> model = (OptionListModel<Option>) m;
 
             for (int i = 0; i < model.getSize(); i++) {
@@ -797,7 +801,8 @@ public class FormView extends ComponentView implements ActionListener {
                 }
             }
         } else if (m instanceof ComboBoxModel) {
-            ComboBoxModel model = (ComboBoxModel)m;
+            @SuppressWarnings("unchecked")
+            ComboBoxModel<?> model = (ComboBoxModel)m;
             Option option = (Option)model.getSelectedItem();
             if (option != null) {
                 appendBuffer(buffer, name, option.getValue());
@@ -904,7 +909,8 @@ public class FormView extends ComponentView implements ActionListener {
                         } catch (BadLocationException e) {
                         }
                     } else if (m instanceof OptionListModel) {
-                        OptionListModel model = (OptionListModel) m;
+                        @SuppressWarnings("unchecked")
+                        OptionListModel<?> model = (OptionListModel) m;
                         int size = model.getSize();
                         for (int i = 0; i < size; i++) {
                             model.removeIndexInterval(i, i);
@@ -916,7 +922,8 @@ public class FormView extends ComponentView implements ActionListener {
                             }
                         }
                     } else if (m instanceof OptionComboBoxModel) {
-                        OptionComboBoxModel model = (OptionComboBoxModel) m;
+                        @SuppressWarnings("unchecked")
+                        OptionComboBoxModel<?> model = (OptionComboBoxModel) m;
                         Option option = model.getInitialSelection();
                         if (option != null) {
                             model.setSelectedItem(option);
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
index 5ced35d36dc..d61a88025a9 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
@@ -863,11 +863,13 @@ public class HTMLDocument extends DefaultStyledDocument {
             Object     maps = getProperty(MAP_PROPERTY);
 
             if (maps == null) {
-                maps = new Hashtable(11);
+                maps = new Hashtable<>(11);
                 putProperty(MAP_PROPERTY, maps);
             }
             if (maps instanceof Hashtable) {
-                ((Hashtable)maps).put("#" + name, map);
+                @SuppressWarnings("unchecked")
+                Hashtable<Object, Object> tmp = (Hashtable)maps;
+                tmp.put("#" + name, map);
             }
         }
     }
@@ -910,11 +912,13 @@ public class HTMLDocument extends DefaultStyledDocument {
      * @return the enumerated list of maps, or <code>null</code>
      *          if the maps are not an instance of <code>Hashtable</code>
      */
-    Enumeration getMaps() {
+    Enumeration<Object> getMaps() {
         Object     maps = getProperty(MAP_PROPERTY);
 
         if (maps instanceof Hashtable) {
-            return ((Hashtable)maps).elements();
+            @SuppressWarnings("unchecked")
+            Hashtable<Object, Object> tmp = (Hashtable) maps;
+            return tmp.elements();
         }
         return null;
     }
@@ -1493,7 +1497,7 @@ public class HTMLDocument extends DefaultStyledDocument {
         else if (searchLeafAttributes && attr != null) {
             // For some leaf elements we store the actual attributes inside
             // the AttributeSet of the Element (such as anchors).
-            Enumeration names = attr.getAttributeNames();
+            Enumeration<?> names = attr.getAttributeNames();
             if (names != null) {
                 while (names.hasMoreElements()) {
                     Object name = names.nextElement();
@@ -2694,10 +2698,12 @@ public class HTMLDocument extends DefaultStyledDocument {
                 return;
             }
             if (comments == null) {
-                comments = new Vector();
+                comments = new Vector<>();
                 putProperty(AdditionalComments, comments);
             }
-            ((Vector)comments).addElement(comment);
+            @SuppressWarnings("unchecked")
+            Vector<Object> v = (Vector<Object>)comments;
+            v.addElement(comment);
         }
 
         /**
@@ -3439,6 +3445,7 @@ public class HTMLDocument extends DefaultStyledDocument {
                     option = new Option(attr);
 
                     if (selectModel instanceof OptionListModel) {
+                        @SuppressWarnings("unchecked")
                         OptionListModel<Option> m = (OptionListModel<Option>) selectModel;
                         m.addElement(option);
                         if (option.isSelected()) {
@@ -3446,6 +3453,7 @@ public class HTMLDocument extends DefaultStyledDocument {
                             m.setInitialSelection(optionCount);
                         }
                     } else if (selectModel instanceof OptionComboBoxModel) {
+                        @SuppressWarnings("unchecked")
                         OptionComboBoxModel<Option> m = (OptionComboBoxModel<Option>) selectModel;
                         m.addElement(option);
                         if (option.isSelected()) {
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
index e89997f45a9..b6d622d0ef5 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
@@ -590,7 +590,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
     protected Parser getParser() {
         if (defaultParser == null) {
             try {
-                Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator");
+                Class<?> c = Class.forName("javax.swing.text.html.parser.ParserDelegator");
                 defaultParser = (Parser) c.newInstance();
             } catch (Throwable e) {
             }
@@ -1874,7 +1874,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * Returns the object in an AttributeSet matching a key
      */
     static private Object getAttrValue(AttributeSet attr, HTML.Attribute key) {
-        Enumeration names = attr.getAttributeNames();
+        Enumeration<?> names = attr.getAttributeNames();
         while (names.hasMoreElements()) {
             Object nextKey = names.nextElement();
             Object nextVal = attr.getAttribute(nextKey);
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java b/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java
index 0d154e2c3aa..62651c07dc9 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java
@@ -254,7 +254,7 @@ public class HTMLWriter extends AbstractWriter {
         convAttr.removeAttributes(convAttr);
         convertToHTML32(attr, convAttr);
 
-        Enumeration names = convAttr.getAttributeNames();
+        Enumeration<?> names = convAttr.getAttributeNames();
         while (names.hasMoreElements()) {
             Object name = names.nextElement();
             if (name instanceof HTML.Tag ||
@@ -527,6 +527,7 @@ public class HTMLWriter extends AbstractWriter {
         Object model = attr.getAttribute(StyleConstants.ModelAttribute);
         incrIndent();
         if (model instanceof OptionListModel) {
+            @SuppressWarnings("unchecked")
             OptionListModel<Option> listModel = (OptionListModel<Option>) model;
             int size = listModel.getSize();
             for (int i = 0; i < size; i++) {
@@ -534,6 +535,7 @@ public class HTMLWriter extends AbstractWriter {
                 writeOption(option);
             }
         } else if (model instanceof OptionComboBoxModel) {
+            @SuppressWarnings("unchecked")
             OptionComboBoxModel<Option> comboBoxModel = (OptionComboBoxModel<Option>) model;
             int size = comboBoxModel.getSize();
             for (int i = 0; i < size; i++) {
@@ -657,7 +659,7 @@ public class HTMLWriter extends AbstractWriter {
                                         (HTMLDocument.AdditionalComments);
 
         if (comments instanceof Vector) {
-            Vector v = (Vector)comments;
+            Vector<?> v = (Vector)comments;
             for (int counter = 0, maxCounter = v.size(); counter < maxCounter;
                  counter++) {
                 writeComment(v.elementAt(counter).toString());
@@ -707,7 +709,7 @@ public class HTMLWriter extends AbstractWriter {
         // translate css attributes to html
         attr = convertToHTML(attr, oConvAttr);
 
-        Enumeration names = attr.getAttributeNames();
+        Enumeration<?> names = attr.getAttributeNames();
         while (names.hasMoreElements()) {
             Object name = names.nextElement();
             if (name instanceof HTML.Tag) {
@@ -848,7 +850,7 @@ public class HTMLWriter extends AbstractWriter {
      * Outputs the maps as elements. Maps are not stored as elements in
      * the document, and as such this is used to output them.
      */
-    void writeMaps(Enumeration maps) throws IOException {
+    void writeMaps(Enumeration<?> maps) throws IOException {
         if (maps != null) {
             while(maps.hasMoreElements()) {
                 Map map = (Map)maps.nextElement();
@@ -896,7 +898,7 @@ public class HTMLWriter extends AbstractWriter {
      */
     void writeStyles(StyleSheet sheet) throws IOException {
         if (sheet != null) {
-            Enumeration styles = sheet.getStyleNames();
+            Enumeration<?> styles = sheet.getStyleNames();
             if (styles != null) {
                 boolean outputStyle = false;
                 while (styles.hasMoreElements()) {
@@ -922,7 +924,7 @@ public class HTMLWriter extends AbstractWriter {
     boolean writeStyle(String name, Style style, boolean outputStyle)
                  throws IOException{
         boolean didOutputStyle = false;
-        Enumeration attributes = style.getAttributeNames();
+        Enumeration<?> attributes = style.getAttributeNames();
         if (attributes != null) {
             while (attributes.hasMoreElements()) {
                 Object attribute = attributes.nextElement();
@@ -1032,7 +1034,7 @@ public class HTMLWriter extends AbstractWriter {
         if (from == null) {
             return;
         }
-        Enumeration keys = from.getAttributeNames();
+        Enumeration<?> keys = from.getAttributeNames();
         String value = "";
         while (keys.hasMoreElements()) {
             Object key = keys.nextElement();
@@ -1139,7 +1141,7 @@ public class HTMLWriter extends AbstractWriter {
      * attribute.
      */
     private static void convertToHTML40(AttributeSet from, MutableAttributeSet to) {
-        Enumeration keys = from.getAttributeNames();
+        Enumeration<?> keys = from.getAttributeNames();
         String value = "";
         while (keys.hasMoreElements()) {
             Object key = keys.nextElement();
diff --git a/jdk/src/share/classes/javax/swing/text/html/ImageView.java b/jdk/src/share/classes/javax/swing/text/html/ImageView.java
index bf01379f12c..8a461f1540d 100644
--- a/jdk/src/share/classes/javax/swing/text/html/ImageView.java
+++ b/jdk/src/share/classes/javax/swing/text/html/ImageView.java
@@ -691,10 +691,11 @@ public class ImageView extends View {
         URL src = getImageURL();
         Image newImage = null;
         if (src != null) {
-            Dictionary cache = (Dictionary)getDocument().
-                                    getProperty(IMAGE_CACHE_PROPERTY);
+            @SuppressWarnings("unchecked")
+            Dictionary<URL, Image> cache = (Dictionary)getDocument().
+                getProperty(IMAGE_CACHE_PROPERTY);
             if (cache != null) {
-                newImage = (Image)cache.get(src);
+                newImage = cache.get(src);
             }
             else {
                 newImage = Toolkit.getDefaultToolkit().createImage(src);
diff --git a/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java b/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java
index 8a69d172219..2037753f0db 100644
--- a/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java
+++ b/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java
@@ -155,7 +155,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * @exception IOException on any I/O error
      */
     protected void writeAttributes(AttributeSet attr) throws IOException {
-        Enumeration attributeNames = attr.getAttributeNames();
+        Enumeration<?> attributeNames = attr.getAttributeNames();
         while (attributeNames.hasMoreElements()) {
             Object name = attributeNames.nextElement();
             if ((name instanceof StyleConstants.ParagraphConstants) ||
@@ -255,7 +255,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
          *  stylenames.
          */
         DefaultStyledDocument styledDoc =  ((DefaultStyledDocument)getDocument());
-        Enumeration styleNames = styledDoc.getStyleNames();
+        Enumeration<?> styleNames = styledDoc.getStyleNames();
 
         while (styleNames.hasMoreElements()) {
             Style s = styledDoc.getStyle((String)styleNames.nextElement());
diff --git a/jdk/src/share/classes/javax/swing/text/html/MuxingAttributeSet.java b/jdk/src/share/classes/javax/swing/text/html/MuxingAttributeSet.java
index 185a20707f7..a03d13c6ac8 100644
--- a/jdk/src/share/classes/javax/swing/text/html/MuxingAttributeSet.java
+++ b/jdk/src/share/classes/javax/swing/text/html/MuxingAttributeSet.java
@@ -213,7 +213,7 @@ class MuxingAttributeSet implements AttributeSet, Serializable {
      * @return the attribute names
      * @see AttributeSet#getAttributeNames
      */
-    public Enumeration getAttributeNames() {
+    public Enumeration<?> getAttributeNames() {
         return new MuxingAttributeNameEnumeration();
     }
 
@@ -240,7 +240,7 @@ class MuxingAttributeSet implements AttributeSet, Serializable {
     public boolean containsAttributes(AttributeSet attrs) {
         boolean result = true;
 
-        Enumeration names = attrs.getAttributeNames();
+        Enumeration<?> names = attrs.getAttributeNames();
         while (result && names.hasMoreElements()) {
             Object name = names.nextElement();
             result = attrs.getAttribute(name).equals(getAttribute(name));
@@ -268,7 +268,7 @@ class MuxingAttributeSet implements AttributeSet, Serializable {
      * An Enumeration of the Attribute names in a MuxingAttributeSet.
      * This may return the same name more than once.
      */
-    private class MuxingAttributeNameEnumeration implements Enumeration {
+    private class MuxingAttributeNameEnumeration implements Enumeration<Object> {
 
         MuxingAttributeNameEnumeration() {
             updateEnum();
@@ -307,6 +307,6 @@ class MuxingAttributeSet implements AttributeSet, Serializable {
         /** Index into attrs the current Enumeration came from. */
         private int attrIndex;
         /** Enumeration from attrs. */
-        private Enumeration currentEnum;
+        private Enumeration<?> currentEnum;
     }
 }
diff --git a/jdk/src/share/classes/javax/swing/text/html/ObjectView.java b/jdk/src/share/classes/javax/swing/text/html/ObjectView.java
index e163d3e396a..205fda25a09 100644
--- a/jdk/src/share/classes/javax/swing/text/html/ObjectView.java
+++ b/jdk/src/share/classes/javax/swing/text/html/ObjectView.java
@@ -91,8 +91,8 @@ public class ObjectView extends ComponentView  {
         String classname = (String) attr.getAttribute(HTML.Attribute.CLASSID);
         try {
             ReflectUtil.checkPackageAccess(classname);
-            Class c = Class.forName(classname, true,Thread.currentThread().
-                                    getContextClassLoader());
+            Class<?> c = Class.forName(classname, true,Thread.currentThread().
+                                       getContextClassLoader());
             Object o = c.newInstance();
             if (o instanceof Component) {
                 Component comp = (Component) o;
@@ -125,7 +125,7 @@ public class ObjectView extends ComponentView  {
      * &lt;object&gt; element.
      */
     private void setParameters(Component comp, AttributeSet attr) {
-        Class k = comp.getClass();
+        Class<?> k = comp.getClass();
         BeanInfo bi;
         try {
             bi = Introspector.getBeanInfo(k);
@@ -145,7 +145,7 @@ public class ObjectView extends ComponentView  {
                     // read-only property. ignore
                     return;     // for now
                 }
-                Class[] params = writer.getParameterTypes();
+                Class<?>[] params = writer.getParameterTypes();
                 if (params.length != 1) {
                     // zero or more than one argument, ignore
                     return;     // for now
diff --git a/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java b/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java
index 74a4ee1adc6..70603d0cc63 100644
--- a/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java
+++ b/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java
@@ -40,7 +40,7 @@ import java.io.Serializable;
  * It also stores the initial state of the JList, to ensure an
  * accurate reset, if the user requests a reset of the form.
  *
-  @author Sunita Mani
+ * @author Sunita Mani
  */
 @SuppressWarnings("serial") // Superclass is not serializable across versions
 class OptionListModel<E> extends DefaultListModel<E> implements ListSelectionModel, Serializable {
@@ -469,7 +469,8 @@ class OptionListModel<E> extends DefaultListModel<E> implements ListSelectionMod
      *    and (b) define a <code>clone</code> method
      */
     public Object clone() throws CloneNotSupportedException {
-        OptionListModel clone = (OptionListModel)super.clone();
+        @SuppressWarnings("unchecked")
+        OptionListModel<E> clone = (OptionListModel)super.clone();
         clone.value = (BitSet)value.clone();
         clone.listenerList = new EventListenerList();
         return clone;
diff --git a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
index 4c5d8d95ce5..c59c751bc96 100644
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
@@ -192,6 +192,7 @@ public class StyleSheet extends StyleContext {
 
         try {
             // Build an array of all the parent elements.
+            @SuppressWarnings("unchecked")
             Vector<Element> searchContext = sb.getVector();
 
             for (Element p = e; p != null; p = p.getParentElement()) {
@@ -693,7 +694,7 @@ public class StyleSheet extends StyleContext {
     private AttributeSet removeHTMLTags(AttributeSet old, AttributeSet attr) {
         if (!(attr instanceof LargeConversionSet) &&
             !(attr instanceof SmallConversionSet)) {
-            Enumeration names = attr.getAttributeNames();
+            Enumeration<?> names = attr.getAttributeNames();
 
             while (names.hasMoreElements()) {
                 Object key = names.nextElement();
@@ -726,14 +727,14 @@ public class StyleSheet extends StyleContext {
         // in most cases, there are no StyleConstants attributes
         // so we iterate the collection of keys to avoid creating
         // a new set.
-        Enumeration names = a.getAttributeNames();
+        Enumeration<?> names = a.getAttributeNames();
         while (names.hasMoreElements()) {
             Object name = names.nextElement();
             if (name instanceof StyleConstants) {
                 // we really need to do a conversion, iterate again
                 // building a new set.
                 MutableAttributeSet converted = new LargeConversionSet();
-                Enumeration keys = a.getAttributeNames();
+                Enumeration<?> keys = a.getAttributeNames();
                 while (keys.hasMoreElements()) {
                     Object key = keys.nextElement();
                     Object cssValue = null;
@@ -1078,6 +1079,7 @@ public class StyleSheet extends StyleContext {
     String[] getSimpleSelectors(String selector) {
         selector = cleanSelectorString(selector);
         SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
+        @SuppressWarnings("unchecked")
         Vector<String> selectors = sb.getVector();
         int lastIndex = 0;
         int length = selector.length();
@@ -1256,7 +1258,7 @@ public class StyleSheet extends StyleContext {
      * create the resolved style, if necessary.
      */
     private synchronized Style getResolvedStyle(String selector,
-                                                Vector elements,
+                                                Vector<Element> elements,
                                                 HTML.Tag t) {
         Style retStyle = resolvedStyles.get(selector);
         if (retStyle == null) {
@@ -1368,7 +1370,9 @@ public class StyleSheet extends StyleContext {
                                       String[] tags,
                                       String[] ids, String[] classes) {
         SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
+        @SuppressWarnings("unchecked")
         Vector<SelectorMapping> tempVector = sb.getVector();
+        @SuppressWarnings("unchecked")
         Hashtable<SelectorMapping, SelectorMapping> tempHashtable = sb.getHashtable();
         // Determine all the Styles that are appropriate, placing them
         // in tempVector
@@ -1452,7 +1456,7 @@ public class StyleSheet extends StyleContext {
      * @param t         the Tag to use for
      *                  the first Element in <code>elements</code>
      */
-    private Style createResolvedStyle(String selector, Vector elements,
+    private Style createResolvedStyle(String selector, Vector<Element> elements,
                                       HTML.Tag t) {
         int numElements = elements.size();
         // Build three arrays, one for tags, one for class's, and one for
@@ -1461,7 +1465,7 @@ public class StyleSheet extends StyleContext {
         String ids[] = new String[numElements];
         String classes[] = new String[numElements];
         for (int counter = 0; counter < numElements; counter++) {
-            Element e = (Element)elements.elementAt(counter);
+            Element e = elements.elementAt(counter);
             AttributeSet attr = e.getAttributes();
             if (counter == 0 && e.isLeaf()) {
                 // For leafs, we use the second tier attributes.
@@ -1513,6 +1517,7 @@ public class StyleSheet extends StyleContext {
     private Style createResolvedStyle(String selector) {
         SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
         // Will contain the tags, ids, and classes, in that order.
+        @SuppressWarnings("unchecked")
         Vector<String> elements = sb.getVector();
         try {
             boolean done;
@@ -1678,6 +1683,7 @@ public class StyleSheet extends StyleContext {
      * releaseSearchBuffer to get a SearchBuffer, and release it when
      * done.
      */
+    @SuppressWarnings("rawtypes")
     private static class SearchBuffer {
         /** A stack containing instances of SearchBuffer. Used in getting
          * rules. */
@@ -2630,6 +2636,7 @@ public class StyleSheet extends StyleContext {
             // implementation.
             Document doc = v.getDocument();
             SearchBuffer sb = SearchBuffer.obtainSearchBuffer();
+            @SuppressWarnings("unchecked")
             Vector<AttributeSet> muxList = sb.getVector();
             try {
                 if (doc instanceof HTMLDocument) {
@@ -2642,7 +2649,7 @@ public class StyleSheet extends StyleContext {
                         muxList.addElement(htmlAttr);
                     }
                     if (elem.isLeaf()) {
-                        Enumeration keys = a.getAttributeNames();
+                        Enumeration<?> keys = a.getAttributeNames();
                         while (keys.hasMoreElements()) {
                             Object key = keys.nextElement();
                             if (key instanceof HTML.Tag) {
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java
index 2845ae49b4b..d8b6cdbc4e6 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java
@@ -370,6 +370,7 @@ class DTD implements DTDConstants {
     private static Hashtable<String, DTD> getDtdHash() {
         AppContext appContext = AppContext.getAppContext();
 
+        @SuppressWarnings("unchecked")
         Hashtable<String, DTD> result = (Hashtable<String, DTD>) appContext.get(DTD_HASH_KEY);
 
         if (result == null) {
diff --git a/jdk/src/share/classes/javax/swing/text/rtf/MockAttributeSet.java b/jdk/src/share/classes/javax/swing/text/rtf/MockAttributeSet.java
index 4adf55bd2de..dcd68f03da9 100644
--- a/jdk/src/share/classes/javax/swing/text/rtf/MockAttributeSet.java
+++ b/jdk/src/share/classes/javax/swing/text/rtf/MockAttributeSet.java
@@ -74,7 +74,7 @@ class MockAttributeSet
 
     public void addAttributes(AttributeSet attr)
     {
-        Enumeration as = attr.getAttributeNames();
+        Enumeration<?> as = attr.getAttributeNames();
         while(as.hasMoreElements()) {
             Object el = as.nextElement();
             backing.put(el, attr.getAttribute(el));
@@ -102,7 +102,7 @@ class MockAttributeSet
     }
 
 
-    public Enumeration getAttributeNames()
+    public Enumeration<?> getAttributeNames()
     {
          return backing.keys();
     }
diff --git a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java
index 7aba1408039..f5685665226 100644
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java
@@ -96,13 +96,13 @@ class RTFGenerator extends Object
     static {
         MagicToken = new Object();
 
-        Dictionary textKeywordDictionary = RTFReader.textKeywords;
-        Enumeration keys = textKeywordDictionary.keys();
+        Dictionary<String, String> textKeywordDictionary = RTFReader.textKeywords;
+        Enumeration<String> keys = textKeywordDictionary.keys();
         Vector<CharacterKeywordPair> tempPairs = new Vector<CharacterKeywordPair>();
         while(keys.hasMoreElements()) {
             CharacterKeywordPair pair = new CharacterKeywordPair();
-            pair.keyword = (String)keys.nextElement();
-            pair.character = ((String)textKeywordDictionary.get(pair.keyword)).charAt(0);
+            pair.keyword = keys.nextElement();
+            pair.character = textKeywordDictionary.get(pair.keyword).charAt(0);
             tempPairs.addElement(pair);
         }
         textKeywords = new CharacterKeywordPair[tempPairs.size()];
@@ -340,7 +340,7 @@ public void writeRTFHeader()
     /* write color table */
     if (colorCount > 1) {
         Color[] sortedColorTable = new Color[colorCount];
-        Enumeration colors = colorTable.keys();
+        Enumeration<Object> colors = colorTable.keys();
         Color color;
         while(colors.hasMoreElements()) {
             color = (Color)colors.nextElement();
diff --git a/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java b/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java
index 69afef06608..c5bd51d1c2d 100644
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java
@@ -220,6 +220,7 @@ public void begingroup()
     Object oldSaveState = parserState.get("_savedState");
     if (oldSaveState != null)
         parserState.remove("_savedState");
+    @SuppressWarnings("unchecked")
     Dictionary<String, Object> saveState = (Dictionary<String, Object>)((Hashtable)parserState).clone();
     if (oldSaveState != null)
         saveState.put("_savedState", oldSaveState);
@@ -242,13 +243,14 @@ public void endgroup()
         skippingCharacters = 0;
     }
 
+    @SuppressWarnings("unchecked")
     Dictionary<Object, Object> restoredState = (Dictionary<Object, Object>)parserState.get("_savedState");
     Destination restoredDestination = (Destination)restoredState.get("dst");
     if (restoredDestination != rtfDestination) {
         rtfDestination.close(); /* allow the destination to clean up */
         rtfDestination = restoredDestination;
     }
-    Dictionary oldParserState = parserState;
+    Dictionary<Object, Object> oldParserState = parserState;
     parserState = restoredState;
     if (rtfDestination != null)
         rtfDestination.endgroup(oldParserState);
@@ -258,7 +260,8 @@ protected void setRTFDestination(Destination newDestination)
 {
     /* Check that setting the destination won't close the
        current destination (should never happen) */
-    Dictionary previousState = (Dictionary)parserState.get("_savedState");
+    @SuppressWarnings("unchecked")
+    Dictionary<Object, Object> previousState = (Dictionary)parserState.get("_savedState");
     if (previousState != null) {
         if (rtfDestination != previousState.get("dst")) {
             warning("Warning, RTF destination overridden, invalid RTF.");
@@ -277,7 +280,7 @@ protected void setRTFDestination(Destination newDestination)
 public void close()
     throws IOException
 {
-    Enumeration docProps = documentAttributes.getAttributeNames();
+    Enumeration<?> docProps = documentAttributes.getAttributeNames();
     while(docProps.hasMoreElements()) {
         Object propName = docProps.nextElement();
         target.putProperty(propName,
@@ -628,7 +631,7 @@ interface Destination {
     boolean handleKeyword(String keyword, int parameter);
 
     void begingroup();
-    void endgroup(Dictionary oldState);
+    void endgroup(Dictionary<Object, Object> oldState);
 
     void close();
 }
@@ -666,7 +669,7 @@ class DiscardingDestination implements Destination
            current group level as necessary */
     }
 
-    public void endgroup(Dictionary oldState)
+    public void endgroup(Dictionary<Object, Object> oldState)
     {
         /* Ignore groups */
     }
@@ -736,7 +739,7 @@ class FonttblDestination implements Destination
 
     /* Groups are irrelevant. */
     public void begingroup() {}
-    public void endgroup(Dictionary oldState) {}
+    public void endgroup(Dictionary<Object, Object> oldState) {}
 
     /* currently, the only thing we do when the font table ends is
        dump its contents to the debugging log. */
@@ -806,7 +809,7 @@ class ColortblDestination implements Destination
 
     /* Groups are irrelevant. */
     public void begingroup() {}
-    public void endgroup(Dictionary oldState) {}
+    public void endgroup(Dictionary<Object, Object> oldState) {}
 
     /* Shouldn't see any binary blobs ... */
     public void handleBinaryBlob(byte[] data) {}
@@ -1098,7 +1101,7 @@ abstract class AttributeTrackingDestination implements Destination
         parserState.put("sec", sectionAttributes);
     }
 
-    public void endgroup(Dictionary oldState)
+    public void endgroup(Dictionary<Object, Object> oldState)
     {
         characterAttributes = (MutableAttributeSet)parserState.get("chr");
         paragraphAttributes = (MutableAttributeSet)parserState.get("pgf");
@@ -1262,7 +1265,9 @@ abstract class AttributeTrackingDestination implements Destination
             Dictionary<Object, Object> tabs;
             Integer stopCount;
 
-            tabs = (Dictionary<Object, Object>)parserState.get("_tabs");
+            @SuppressWarnings("unchecked")
+            Dictionary<Object, Object>tmp = (Dictionary)parserState.get("_tabs");
+            tabs = tmp;
             if (tabs == null) {
                 tabs = new Hashtable<Object, Object>();
                 parserState.put("_tabs", tabs);
@@ -1420,7 +1425,8 @@ abstract class AttributeTrackingDestination implements Destination
 
         tabs = (TabStop[])parserState.get("_tabs_immutable");
         if (tabs == null) {
-            Dictionary workingTabs = (Dictionary)parserState.get("_tabs");
+            @SuppressWarnings("unchecked")
+            Dictionary<Object, Object> workingTabs = (Dictionary)parserState.get("_tabs");
             if (workingTabs != null) {
                 int count = ((Integer)workingTabs.get("stop count")).intValue();
                 tabs = new TabStop[count];
-- 
GitLab


From 4a9ad9f15f0330377806f77e0d9228cd1700a7ff Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Thu, 12 Jun 2014 00:19:00 +0400
Subject: [PATCH 069/192] 8040271: Uninitialised memory in
 jdk/src/windows/native/sun/windows: awt_List.cpp, awt_InputMethod.cpp

Reviewed-by: pchelko, prr
---
 jdk/src/windows/native/sun/windows/awt_InputMethod.cpp | 2 +-
 jdk/src/windows/native/sun/windows/awt_List.cpp        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/jdk/src/windows/native/sun/windows/awt_InputMethod.cpp b/jdk/src/windows/native/sun/windows/awt_InputMethod.cpp
index 1b087aa1506..64475041002 100644
--- a/jdk/src/windows/native/sun/windows/awt_InputMethod.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_InputMethod.cpp
@@ -454,7 +454,7 @@ JNIEXPORT jobjectArray JNICALL Java_sun_awt_windows_WInputMethodDescriptor_getNa
     TRY;
 
     // get list of available HKLs
-    int layoutCount = ::GetKeyboardLayoutList(0, NULL);
+    const int layoutCount = ::GetKeyboardLayoutList(0, NULL);
     HKL FAR * hKLList = (HKL FAR *)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(HKL), layoutCount);
     CHECK_NULL_RETURN(hKLList, NULL);
     ::GetKeyboardLayoutList(layoutCount, hKLList);
diff --git a/jdk/src/windows/native/sun/windows/awt_List.cpp b/jdk/src/windows/native/sun/windows/awt_List.cpp
index c35c0f4207b..c6cec8fe08b 100644
--- a/jdk/src/windows/native/sun/windows/awt_List.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_List.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -219,7 +219,7 @@ void AwtList::SetMultiSelect(BOOL ms) {
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 
     /* Copy current box's contents to string array */
-    int nCount = GetCount();
+    const int nCount = GetCount();
     LPTSTR * strings = new LPTSTR[nCount];
     int i;
 
-- 
GitLab


From 652e8b5ffb2e9cb9576f6adff4300bd1452ed18f Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Thu, 12 Jun 2014 00:32:33 +0400
Subject: [PATCH 070/192] 8029455: [JLightweightFrame] support scaled painting

Reviewed-by: anthony, ant
---
 .../sun/lwawt/macosx/CPlatformLWWindow.java   |  31 +++-
 .../classes/sun/awt/LightweightFrame.java     |  45 ++++++
 .../classes/sun/java2d/SunGraphics2D.java     |  23 ++-
 .../classes/sun/swing/JLightweightFrame.java  | 132 ++++++++++++------
 .../classes/sun/swing/LightweightContent.java |  54 ++++---
 .../ScaledCopyArea/ScaledCopyArea.java        |  60 ++++++++
 .../HangNonVolatileBuffer.java                |  53 +++++++
 7 files changed, 331 insertions(+), 67 deletions(-)
 create mode 100644 jdk/test/java/awt/Graphics2D/ScaledCopyArea/ScaledCopyArea.java
 create mode 100644 jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java

diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java
index d7a91264328..9c2edf22742 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java
@@ -29,12 +29,18 @@ import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Graphics;
 import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
 import java.awt.Insets;
 import java.awt.MenuBar;
 import java.awt.Point;
+import java.awt.Rectangle;
 import java.awt.Window;
+import sun.awt.CGraphicsDevice;
+import sun.awt.CGraphicsEnvironment;
 import sun.awt.CausedFocusEvent;
+import sun.awt.LightweightFrame;
 import sun.java2d.SurfaceData;
+import sun.lwawt.LWLightweightFramePeer;
 import sun.lwawt.LWWindowPeer;
 import sun.lwawt.PlatformWindow;
 
@@ -72,11 +78,6 @@ public class CPlatformLWWindow extends CPlatformWindow {
         return null;
     }
 
-    @Override
-    public GraphicsDevice getGraphicsDevice() {
-        return null;
-    }
-
     @Override
     public SurfaceData getScreenSurface() {
         return null;
@@ -199,4 +200,24 @@ public class CPlatformLWWindow extends CPlatformWindow {
     public long getLayerPtr() {
         return 0;
     }
+
+    @Override
+    public GraphicsDevice getGraphicsDevice() {
+        CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
+                                  getLocalGraphicsEnvironment();
+
+        LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
+        int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();
+
+        Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
+        for (GraphicsDevice d : ge.getScreenDevices()) {
+            if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
+                ((CGraphicsDevice)d).getScaleFactor() == scale)
+            {
+                return d;
+            }
+        }
+        // We shouldn't be here...
+        return ge.getDefaultScreenDevice();
+    }
 }
diff --git a/jdk/src/share/classes/sun/awt/LightweightFrame.java b/jdk/src/share/classes/sun/awt/LightweightFrame.java
index 71e3dd30333..85d05924a0e 100644
--- a/jdk/src/share/classes/sun/awt/LightweightFrame.java
+++ b/jdk/src/share/classes/sun/awt/LightweightFrame.java
@@ -31,6 +31,7 @@ import java.awt.Graphics;
 import java.awt.Image;
 import java.awt.MenuBar;
 import java.awt.MenuComponent;
+import java.awt.Rectangle;
 import java.awt.Toolkit;
 import java.awt.peer.FramePeer;
 
@@ -124,4 +125,48 @@ public abstract class LightweightFrame extends Frame {
      * @see SunToolkit#ungrab(java.awt.Window)
      */
     public abstract void ungrabFocus();
+
+    /**
+     * Returns the scale factor of this frame. The default value is 1.
+     *
+     * @return the scale factor
+     * @see #notifyDisplayChanged(int)
+     */
+    public abstract int getScaleFactor();
+
+    /**
+     * Called when display of the hosted frame is changed.
+     *
+     * @param scaleFactor the scale factor
+     */
+    public abstract void notifyDisplayChanged(int scaleFactor);
+
+    /**
+     * Host window absolute bounds.
+     */
+    private int hostX, hostY, hostW, hostH;
+
+    /**
+     * Returns the absolute bounds of the host (embedding) window.
+     *
+     * @return the host window bounds
+     */
+    public Rectangle getHostBounds() {
+        if (hostX == 0 && hostY == 0 && hostW == 0 && hostH == 0) {
+            // The client app is probably unaware of the setHostBounds.
+            // A safe fall-back:
+            return getBounds();
+        }
+        return new Rectangle(hostX, hostY, hostW, hostH);
+    }
+
+    /**
+     * Sets the absolute bounds of the host (embedding) window.
+     */
+    public void setHostBounds(int x, int y, int w, int h) {
+        hostX = x;
+        hostY = y;
+        hostW = w;
+        hostH = h;
+    }
 }
diff --git a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
index 58f90c36b11..8826a74718d 100644
--- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
+++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
@@ -2108,7 +2108,7 @@ public final class SunGraphics2D
         if (theData.copyArea(this, x, y, w, h, dx, dy)) {
             return;
         }
-        if (transformState >= TRANSFORM_TRANSLATESCALE) {
+        if (transformState > TRANSFORM_TRANSLATESCALE) {
             throw new InternalError("transformed copyArea not implemented yet");
         }
         // REMIND: This method does not deal with missing data from the
@@ -2129,8 +2129,25 @@ public final class SunGraphics2D
             lastCAcomp = comp;
         }
 
-        x += transX;
-        y += transY;
+        double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
+        transform.transform(coords, 0, coords, 0, 3);
+
+        x = (int)Math.ceil(coords[0] - 0.5);
+        y = (int)Math.ceil(coords[1] - 0.5);
+        w = ((int)Math.ceil(coords[2] - 0.5)) - x;
+        h = ((int)Math.ceil(coords[3] - 0.5)) - y;
+        dx = ((int)Math.ceil(coords[4] - 0.5)) - x;
+        dy = ((int)Math.ceil(coords[5] - 0.5)) - y;
+
+        // In case of negative scale transform, reflect the rect coords.
+        if (w < 0) {
+            w *= -1;
+            x -= w;
+        }
+        if (h < 0) {
+            h *= -1;
+            y -= h;
+        }
 
         Blit ob = lastCAblit;
         if (dy == 0 && dx > 0 && dx < w) {
diff --git a/jdk/src/share/classes/sun/swing/JLightweightFrame.java b/jdk/src/share/classes/sun/swing/JLightweightFrame.java
index 236d9f6193c..a3aa2968bec 100644
--- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java
@@ -54,6 +54,7 @@ import javax.swing.RepaintManager;
 import javax.swing.RootPaneContainer;
 import javax.swing.SwingUtilities;
 
+import sun.awt.DisplayChangedListener;
 import sun.awt.LightweightFrame;
 import sun.security.action.GetPropertyAction;
 import sun.swing.SwingUtilities2.RepaintListener;
@@ -80,6 +81,8 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
 
     private BufferedImage bbImage;
 
+    private volatile int scaleFactor = 1;
+
     /**
      * {@code copyBufferEnabled}, true by default, defines the following strategy.
      * A duplicating (copy) buffer is created for the original pixel buffer.
@@ -90,7 +93,7 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
      * by the lock (managed with the {@link LightweightContent#paintLock()},
      * {@link LightweightContent#paintUnlock()} methods).
      */
-    private boolean copyBufferEnabled;
+    private static boolean copyBufferEnabled;
     private int[] copyBuffer;
 
     private PropertyChangeListener layoutSizeListener;
@@ -103,6 +106,8 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
                 frame.updateClientCursor();
             }
         });
+        copyBufferEnabled = "true".equals(AccessController.
+            doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
     }
 
     /**
@@ -144,7 +149,8 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
             }
             Point p = SwingUtilities.convertPoint(c, x, y, jlf);
             Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
-                    new Rectangle(0, 0, bbImage.getWidth(), bbImage.getHeight()));
+                    new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
+                                  bbImage.getHeight() / scaleFactor));
 
             if (!r.isEmpty()) {
                 notifyImageUpdated(r.x, r.y, r.width, r.height);
@@ -198,6 +204,7 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
         g.setBackground(getBackground());
         g.setColor(getForeground());
         g.setFont(getFont());
+        g.scale(scaleFactor, scaleFactor);
         return g;
     }
 
@@ -221,7 +228,39 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
         if (content != null) content.focusUngrabbed();
     }
 
-    private void syncCopyBuffer(boolean reset, int x, int y, int w, int h) {
+    @Override
+    public int getScaleFactor() {
+        return scaleFactor;
+    }
+
+    @Override
+    public void notifyDisplayChanged(final int scaleFactor) {
+        if (scaleFactor != this.scaleFactor) {
+            if (!copyBufferEnabled) content.paintLock();
+            try {
+                if (bbImage != null) {
+                    resizeBuffer(getWidth(), getHeight(), scaleFactor);
+                }
+            } finally {
+                if (!copyBufferEnabled) content.paintUnlock();
+            }
+            this.scaleFactor = scaleFactor;
+        }
+        if (getPeer() instanceof DisplayChangedListener) {
+            ((DisplayChangedListener)getPeer()).displayChanged();
+        }
+        repaint();
+    }
+
+    @Override
+    public void addNotify() {
+        super.addNotify();
+        if (getPeer() instanceof DisplayChangedListener) {
+            ((DisplayChangedListener)getPeer()).displayChanged();
+        }
+    }
+
+    private void syncCopyBuffer(boolean reset, int x, int y, int w, int h, int scale) {
         content.paintLock();
         try {
             int[] srcBuffer = ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
@@ -230,6 +269,11 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
             }
             int linestride = bbImage.getWidth();
 
+            x *= scale;
+            y *= scale;
+            w *= scale;
+            h *= scale;
+
             for (int i=0; i<h; i++) {
                 int from = (y + i) * linestride + x;
                 System.arraycopy(srcBuffer, from, copyBuffer, from, w);
@@ -241,7 +285,7 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
 
     private void notifyImageUpdated(int x, int y, int width, int height) {
         if (copyBufferEnabled) {
-            syncCopyBuffer(false, x, y, width, height);
+            syncCopyBuffer(false, x, y, width, height, scaleFactor);
         }
         content.imageUpdated(x, y, width, height);
     }
@@ -269,7 +313,8 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
                     EventQueue.invokeLater(new Runnable() {
                         @Override
                         public void run() {
-                            notifyImageUpdated(clip.x, clip.y, clip.width, clip.height);
+                            Rectangle c = contentPane.getBounds().intersection(clip);
+                            notifyImageUpdated(c.x, c.y, c.width, c.height);
                         }
                     });
                 } finally {
@@ -323,49 +368,38 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
             content.paintLock();
         }
         try {
-            if ((bbImage == null) || (width != bbImage.getWidth()) || (height != bbImage.getHeight())) {
-                boolean createBB = true;
-                int newW = width;
-                int newH = height;
-                if (bbImage != null) {
-                    int oldW = bbImage.getWidth();
-                    int oldH = bbImage.getHeight();
-                    if ((oldW >= newW) && (oldH >= newH)) {
-                        createBB = false;
-                    } else {
-                        if (oldW >= newW) {
-                            newW = oldW;
+            boolean createBB = (bbImage == null);
+            int newW = width;
+            int newH = height;
+            if (bbImage != null) {
+                int imgWidth = bbImage.getWidth() / scaleFactor;
+                int imgHeight = bbImage.getHeight() / scaleFactor;
+                if (width != imgWidth || height != imgHeight) {
+                    createBB = true;
+                    if (bbImage != null) {
+                        int oldW = imgWidth;
+                        int oldH = imgHeight;
+                        if ((oldW >= newW) && (oldH >= newH)) {
+                            createBB = false;
                         } else {
-                            newW = Math.max((int)(oldW * 1.2), width);
-                        }
-                        if (oldH >= newH) {
-                            newH = oldH;
-                        } else {
-                            newH = Math.max((int)(oldH * 1.2), height);
-                        }
-                    }
-                }
-                if (createBB) {
-                    BufferedImage oldBB = bbImage;
-                    bbImage = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_ARGB_PRE);
-                    if (oldBB != null) {
-                        Graphics g = bbImage.getGraphics();
-                        try {
-                            g.drawImage(oldBB, 0, 0, newW, newH, null);
-                        } finally {
-                            g.dispose();
-                            oldBB.flush();
+                            if (oldW >= newW) {
+                                newW = oldW;
+                            } else {
+                                newW = Math.max((int)(oldW * 1.2), width);
+                            }
+                            if (oldH >= newH) {
+                                newH = oldH;
+                            } else {
+                                newH = Math.max((int)(oldH * 1.2), height);
+                            }
                         }
                     }
-                    int[] pixels = ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
-                    if (copyBufferEnabled) {
-                        syncCopyBuffer(true, 0, 0, width, height);
-                        pixels = copyBuffer;
-                    }
-                    content.imageBufferReset(pixels, 0, 0, width, height, bbImage.getWidth());
-                    return;
                 }
             }
+            if (createBB) {
+                resizeBuffer(newW, newH, scaleFactor);
+                return;
+            }
             content.imageReshaped(0, 0, width, height);
 
         } finally {
@@ -375,6 +409,18 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
         }
     }
 
+    private void resizeBuffer(int width, int height, int newScaleFactor) {
+            bbImage = new BufferedImage(width*newScaleFactor,height*newScaleFactor,
+                                        BufferedImage.TYPE_INT_ARGB_PRE);
+        int[] pixels= ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
+        if (copyBufferEnabled) {
+            syncCopyBuffer(true, 0, 0, width, height, newScaleFactor);
+            pixels = copyBuffer;
+        }
+        content.imageBufferReset(pixels, 0, 0, width, height,
+                                 width * newScaleFactor, newScaleFactor);
+    }
+
     @Override
     public JRootPane getRootPane() {
         return rootPane;
diff --git a/jdk/src/share/classes/sun/swing/LightweightContent.java b/jdk/src/share/classes/sun/swing/LightweightContent.java
index dd3373aea1a..2296a173f57 100644
--- a/jdk/src/share/classes/sun/swing/LightweightContent.java
+++ b/jdk/src/share/classes/sun/swing/LightweightContent.java
@@ -85,31 +85,53 @@ public interface LightweightContent {
      * {@code JLightweightFrame} calls this method to notify the client
      * application that a new data buffer has been set as a content pixel
      * buffer. Typically this occurs when a buffer of a larger size is
-     * created in response to a content resize event. The method reports
-     * a reference to the pixel data buffer, the content image bounds
-     * within the buffer and the line stride of the buffer. These values
-     * have the following correlation.
+     * created in response to a content resize event.
      * <p>
-     * The {@code width} and {@code height} matches the size of the content
+     * The method reports a reference to the pixel data buffer, the content
+     * image bounds within the buffer and the line stride of the buffer.
+     * These values have the following correlation.
+     * The {@code width} and {@code height} matches the layout size of the content
      * (the component returned from the {@link #getComponent} method). The
      * {@code x} and {@code y} is the origin of the content, {@code (0, 0)}
-     * in the coordinate space of the content, appearing at
-     * {@code data[y * linestride + x]} in the buffer. All indices
-     * {@code data[(y + j) * linestride + (x + i)]} where
-     * {@code (0 <= i < width)} and {@code (0 <= j < height)} will represent
-     * valid pixel data, {@code (i, j)} in the coordinate space of the content.
+     * in the layout coordinate space of the content, appearing at
+     * {@code data[y * scale * linestride + x * scale]} in the buffer.
+     * A pixel with indices {@code (i, j)}, where {@code (0 <= i < width)} and
+     * {@code (0 <= j < height)}, in the layout coordinate space of the content
+     * is represented by a {@code scale^2} square of pixels in the physical
+     * coordinate space of the buffer. The top-left corner of the square has the
+     * following physical coordinate in the buffer:
+     * {@code data[(y + j) * scale * linestride + (x + i) * scale]}.
      *
      * @param data the content pixel data buffer of INT_ARGB_PRE type
-     * @param x the x coordinate of the image
-     * @param y the y coordinate of the image
-     * @param width the width of the image
-     * @param height the height of the image
+     * @param x the logical x coordinate of the image
+     * @param y the logical y coordinate of the image
+     * @param width the logical width of the image
+     * @param height the logical height of the image
      * @param linestride the line stride of the pixel buffer
+     * @param scale the scale factor of the pixel buffer
+     */
+    default public void imageBufferReset(int[] data,
+                                 int x, int y,
+                                 int width, int height,
+                                 int linestride,
+                                 int scale)
+    {
+        imageBufferReset(data, x, y, width, height, linestride);
+    }
+
+    /**
+     * The default implementation for #imageBufferReset uses a hard-coded value
+     * of 1 for the scale factor. Both the old and the new methods provide
+     * default implementations in order to allow a client application to run
+     * with any JDK version without breaking backward compatibility.
      */
-    public void imageBufferReset(int[] data,
+    default public void imageBufferReset(int[] data,
                                  int x, int y,
                                  int width, int height,
-                                 int linestride);
+                                 int linestride)
+    {
+        imageBufferReset(data, x, y, width, height, linestride, 1);
+    }
 
     /**
      * {@code JLightweightFrame} calls this method to notify the client
diff --git a/jdk/test/java/awt/Graphics2D/ScaledCopyArea/ScaledCopyArea.java b/jdk/test/java/awt/Graphics2D/ScaledCopyArea/ScaledCopyArea.java
new file mode 100644
index 00000000000..c425290589f
--- /dev/null
+++ b/jdk/test/java/awt/Graphics2D/ScaledCopyArea/ScaledCopyArea.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+/**
+ * @test
+ * @bug 8029455
+ * @summary Tests that copyarea on offscreen images works as expected when
+ *          scaled transform is set
+ * @run main ScaledCopyArea
+ */
+public final class ScaledCopyArea {
+
+    public static void main(final String[] args) {
+        final BufferedImage bi = new BufferedImage(100, 300,
+                                                   BufferedImage.TYPE_INT_RGB);
+        final Graphics2D g = bi.createGraphics();
+        g.scale(2, 2);
+        g.setColor(Color.RED);
+        g.fillRect(0, 0, 100, 300);
+        g.setColor(Color.GREEN);
+        g.fillRect(0, 100, 100, 100);
+        g.copyArea(0, 100, 100, 100, 0, -100);
+        g.dispose();
+        for (int x = 0; x < 100; ++x) {
+            for (int y = 0; y < 100; ++y) {
+                final int actual = bi.getRGB(x, y);
+                final int exp = Color.GREEN.getRGB();
+                if (actual != exp) {
+                    System.err.println("Expected:" + Integer.toHexString(exp));
+                    System.err.println("Actual:" + Integer.toHexString(actual));
+                    throw new RuntimeException("Test " + "failed");
+                }
+            }
+        }
+    }
+}
diff --git a/jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java b/jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java
new file mode 100644
index 00000000000..c61be1cb0fc
--- /dev/null
+++ b/jdk/test/javax/swing/JFrame/HangNonVolatileBuffer/HangNonVolatileBuffer.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8029455
+ * @summary Swing should not hang if non-volatile image is used as a backbuffer.
+ * @run main/othervm -Dswing.volatileImageBufferEnabled=false HangNonVolatileBuffer
+ */
+public final class HangNonVolatileBuffer {
+
+    private static JFrame f;
+
+    public static void main(final String[] args)
+            throws InvocationTargetException, InterruptedException {
+        SwingUtilities.invokeAndWait(() -> {
+            f = new JFrame("JFrame");
+            f.setSize(300, 300);
+            f.setLocationRelativeTo(null);
+            f.setVisible(true);
+        });
+        SwingUtilities.invokeAndWait(() -> {
+            // flush the EDT
+        });
+        Thread.sleep(1000);
+        SwingUtilities.invokeAndWait(f::dispose);
+    }
+}
-- 
GitLab


From c450cf57a372be718b472a8da03ed5e9ddc5c9f9 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Thu, 12 Jun 2014 00:43:14 +0400
Subject: [PATCH 071/192] 8033786: White flashing when opening Dialogs and
 Menus using Nimbus with dark background

Reviewed-by: alexsch, anthony
---
 .../classes/sun/lwawt/LWComponentPeer.java    |  2 +
 .../classes/sun/lwawt/LWWindowPeer.java       |  6 ++
 .../sun/lwawt/macosx/CPlatformWindow.java     | 22 ++++---
 .../classes/sun/lwawt/macosx/CWrapper.java    | 13 ++--
 jdk/src/macosx/native/sun/awt/CWrapper.m      | 32 +++-------
 .../share/classes/javax/swing/JDialog.java    |  1 +
 .../WrongBackgroundColor.java                 | 62 +++++++++++++++++++
 7 files changed, 98 insertions(+), 40 deletions(-)
 create mode 100644 jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java

diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
index 354f2538012..408862f7746 100644
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
@@ -317,6 +317,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
      * subclasses to initialize specific peers properties.
      */
     void initializeImpl() {
+        // note that these methods can be overridden by the user and
+        // can return some strange values like null.
         setBackground(target.getBackground());
         setForeground(target.getForeground());
         setFont(target.getFont());
diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
index 226d8c68699..b72ef77d876 100644
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
@@ -443,6 +443,12 @@ public class LWWindowPeer
         getPlatformWindow().updateIconImages();
     }
 
+    @Override
+    public void setBackground(final Color c) {
+        super.setBackground(c);
+        updateOpaque();
+    }
+
     @Override
     public void setOpacity(float opacity) {
         getPlatformWindow().setOpacity(opacity);
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index 190894934b9..534cf0dd744 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -746,20 +746,22 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
     @Override
     public void setOpaque(boolean isOpaque) {
         CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
-        boolean isTextured = (peer == null)? false : peer.isTextured();
-        if (!isOpaque && !isTextured) {
-            long clearColor = CWrapper.NSColor.clearColor();
-            CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
+        boolean isTextured = (peer == null) ? false : peer.isTextured();
+        if (!isTextured) {
+            if (!isOpaque) {
+                CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), 0);
+            } else if (peer != null) {
+                Color color = peer.getBackground();
+                if (color != null) {
+                    int rgb = color.getRGB();
+                    CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), rgb);
+                }
+            }
         }
 
         //This is a temporary workaround. Looks like after 7124236 will be fixed
         //the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
-        SwingUtilities.invokeLater(new Runnable() {
-            @Override
-            public void run() {
-                invalidateShadow();
-            }
-        });
+        SwingUtilities.invokeLater(this::invalidateShadow);
     }
 
     @Override
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java
index 8c2e9c01f2d..f0fec624d8d 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java
@@ -61,7 +61,14 @@ final class CWrapper {
 
         static native void setAlphaValue(long window, float alpha);
         static native void setOpaque(long window, boolean opaque);
-        static native void setBackgroundColor(long window, long color);
+
+        /**
+         * Sets background color of the NSWindow.
+         *
+         * @param window the pointer of the NSWindow
+         * @param color the color in argb format
+         */
+        static native void setBackgroundColor(long window, int color);
 
         static native void miniaturize(long window);
         static native void deminiaturize(long window);
@@ -82,8 +89,4 @@ final class CWrapper {
 
         static native void setToolTip(long view, String msg);
     }
-
-    static final class NSColor {
-        static native long clearColor();
-    }
 }
diff --git a/jdk/src/macosx/native/sun/awt/CWrapper.m b/jdk/src/macosx/native/sun/awt/CWrapper.m
index 247358f0df9..bf0d6b2fccd 100644
--- a/jdk/src/macosx/native/sun/awt/CWrapper.m
+++ b/jdk/src/macosx/native/sun/awt/CWrapper.m
@@ -337,12 +337,17 @@ JNF_COCOA_EXIT(env);
  */
 JNIEXPORT void JNICALL
 Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor
-(JNIEnv *env, jclass cls, jlong windowPtr, jlong colorPtr)
+(JNIEnv *env, jclass cls, jlong windowPtr, jint rgb)
 {
 JNF_COCOA_ENTER(env);
 
     NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
-    NSColor *color = (NSColor *)jlong_to_ptr(colorPtr);
+    CGFloat alpha = (((rgb >> 24) & 0xff) / 255.0);
+    CGFloat red   = (((rgb >> 16) & 0xff) / 255.0);
+    CGFloat green = (((rgb >>  8) & 0xff) / 255.0);
+    CGFloat blue  = (((rgb >>  0) & 0xff) / 255.0);
+    NSColor *color = [NSColor colorWithCalibratedRed:red green:green blue:blue
+                                               alpha:alpha];
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [window setBackgroundColor:color];
     }];
@@ -575,26 +580,3 @@ JNF_COCOA_ENTER(env);
 
 JNF_COCOA_EXIT(env);
 }
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSColor
- * Method:    clearColor
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSColor_clearColor
-(JNIEnv *env, jclass cls)
-{
-    __block jlong clearColorPtr = 0L;
-
-JNF_COCOA_ENTER(env);
-
-    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        clearColorPtr = ptr_to_jlong([NSColor clearColor]);
-    }];
-
-JNF_COCOA_EXIT(env);
-
-    return clearColorPtr;
-}
-
diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java
index 12b978dbf46..242f0ee4c47 100644
--- a/jdk/src/share/classes/javax/swing/JDialog.java
+++ b/jdk/src/share/classes/javax/swing/JDialog.java
@@ -647,6 +647,7 @@ public class JDialog extends Dialog implements WindowConstants,
         enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK);
         setLocale( JComponent.getDefaultLocale() );
         setRootPane(createRootPane());
+        setBackground(UIManager.getColor("control"));
         setRootPaneCheckingEnabled(true);
         if (JDialog.isDefaultLookAndFeelDecorated()) {
             boolean supportsWindowDecorations =
diff --git a/jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java b/jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
new file mode 100644
index 00000000000..63b6e71cbf5
--- /dev/null
+++ b/jdk/test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.plaf.ColorUIResource;
+
+/**
+ * @test
+ * @bug 8033786
+ * @summary JDialog should update background color of the native peer.
+ * @author Sergey Bylokhov
+ */
+public final class WrongBackgroundColor {
+
+    public static void main(final String[] args)
+            throws InvocationTargetException, InterruptedException {
+        SwingUtilities.invokeAndWait(() -> {
+            UIDefaults ui = UIManager.getDefaults();
+            ui.put("control", new ColorUIResource(54, 54, 54));
+            final JDialog dialog = new JDialog();
+            final JFrame frame = new JFrame();
+            frame.pack();
+            dialog.pack();
+            final Color dialogBackground = dialog.getBackground();
+            final Color frameBackground = frame.getBackground();
+            frame.dispose();
+            dialog.dispose();
+            if (!dialogBackground.equals(frameBackground)) {
+                System.err.println("Expected:" + frameBackground);
+                System.err.println("Actual:" + dialogBackground);
+                throw new RuntimeException("Wrong background color");
+            }
+        });
+    }
+}
-- 
GitLab


From ba00ce514e2726fdd1b9a179b7c31391897a45fa Mon Sep 17 00:00:00 2001
From: David Simms <dsimms@openjdk.org>
Date: Thu, 12 Jun 2014 11:34:35 +0200
Subject: [PATCH 072/192] 8046662: Check JNI ReleaseStringChars /
 ReleaseStringUTFChars verify_guards test inverted

Negative verify_guards when testing for corruption

Reviewed-by: sla, fparain
---
 hotspot/src/share/vm/prims/jniCheck.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp
index de9b4e56a86..cdce2643775 100644
--- a/hotspot/src/share/vm/prims/jniCheck.cpp
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp
@@ -1493,7 +1493,7 @@ JNI_ENTRY_CHECKED(void,
     }
     else {
       GuardedMemory guarded((void*)chars);
-      if (guarded.verify_guards()) {
+      if (!guarded.verify_guards()) {
         tty->print_cr("ReleaseStringChars: release chars failed bounds check. "
             "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
         guarded.print_on(tty);
@@ -1576,7 +1576,7 @@ JNI_ENTRY_CHECKED(void,
     }
     else {
       GuardedMemory guarded((void*)chars);
-      if (guarded.verify_guards()) {
+      if (!guarded.verify_guards()) {
         tty->print_cr("ReleaseStringUTFChars: release chars failed bounds check. "
             "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
         guarded.print_on(tty);
-- 
GitLab


From 466ed1ae11aef3f98eb61da13f0dad4f21ebb8ef Mon Sep 17 00:00:00 2001
From: Lois Foltan <lfoltan@openjdk.org>
Date: Thu, 12 Jun 2014 13:37:53 -0400
Subject: [PATCH 073/192] 6961433: Revisit need to disable Windows C++ compiler
 optimisation of sharedRuntimeTrig.cpp

Remove pragma optimize ("", off) to turn off optimization for WIN32.

Reviewed-by: coleenp, dcubed, kvn
---
 .../share/vm/runtime/sharedRuntimeTrig.cpp    | 39 ++-----------------
 1 file changed, 3 insertions(+), 36 deletions(-)

diff --git a/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp b/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp
index 1691bdf7690..84f35aa9317 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntimeTrig.cpp
@@ -26,6 +26,7 @@
 #include "prims/jni.h"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/sharedRuntime.hpp"
+#include "runtime/sharedRuntimeMath.hpp"
 
 // This file contains copies of the fdlibm routines used by
 // StrictMath. It turns out that it is almost always required to use
@@ -36,35 +37,6 @@
 // pointer out to libjava.so in SharedRuntime speeds these routines up
 // by roughly 15% on both Win32/x86 and Solaris/SPARC.
 
-// Enabling optimizations in this file causes incorrect code to be
-// generated; can not figure out how to turn down optimization for one
-// file in the IDE on Windows
-#ifdef WIN32
-# pragma optimize ( "", off )
-#endif
-
-/* The above workaround now causes more problems with the latest MS compiler.
- * Visual Studio 2010's /GS option tries to guard against buffer overruns.
- * /GS is on by default if you specify optimizations, which we do globally
- * via /W3 /O2. However the above selective turning off of optimizations means
- * that /GS issues a warning "4748". And since we treat warnings as errors (/WX)
- * then the compilation fails. There are several possible solutions
- * (1) Remove that pragma above as obsolete with VS2010 - requires testing.
- * (2) Stop treating warnings as errors - would be a backward step
- * (3) Disable /GS - may help performance but you lose the security checks
- * (4) Disable the warning with "#pragma warning( disable : 4748 )"
- * (5) Disable planting the code with  __declspec(safebuffers)
- * I've opted for (5) although we should investigate the local performance
- * benefits of (1) and global performance benefit of (3).
- */
-#if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1600))
-#define SAFEBUF __declspec(safebuffers)
-#else
-#define SAFEBUF
-#endif
-
-#include "runtime/sharedRuntimeMath.hpp"
-
 /*
  * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
  * double x[],y[]; int e0,nx,prec; int ipio2[];
@@ -201,7 +173,7 @@ one     = 1.0,
 two24B  = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
 twon24  = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
 
-static SAFEBUF int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) {
+static int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) {
   int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
   double z,fw,f[20],fq[20],q[20];
 
@@ -417,7 +389,7 @@ pio2_2t =  2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
 pio2_3  =  2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
 pio2_3t =  8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
 
-static SAFEBUF int __ieee754_rem_pio2(double x, double *y) {
+static int __ieee754_rem_pio2(double x, double *y) {
   double z,w,t,r,fn;
   double tx[3];
   int e0,i,j,nx,n,ix,hx,i0;
@@ -916,8 +888,3 @@ JRT_LEAF(jdouble, SharedRuntime::dtan(jdouble x))
                                                      -1 -- n odd */
   }
 JRT_END
-
-
-#ifdef WIN32
-# pragma optimize ( "", on )
-#endif
-- 
GitLab


From 17dd5faf6d26c78a30a83a80d5a971def6dd0181 Mon Sep 17 00:00:00 2001
From: Jesper Wilhelmsson <jwilhelm@openjdk.org>
Date: Thu, 12 Jun 2014 20:15:51 +0200
Subject: [PATCH 074/192] 8046715: Add a way to verify an extended set of
 command line options

Added arguments_ext.cpp to make place for initialization of extended features

Reviewed-by: sla, mgronlun
---
 hotspot/src/share/vm/runtime/arguments.cpp    |  2 ++
 hotspot/src/share/vm/runtime/arguments.hpp    |  1 +
 .../src/share/vm/runtime/arguments_ext.cpp    | 30 +++++++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 hotspot/src/share/vm/runtime/arguments_ext.cpp

diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 3c032fbf270..36189305801 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -2455,6 +2455,8 @@ bool Arguments::check_vm_args_consistency() {
     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
   }
 
+  status &= check_vm_args_consistency_ext();
+
   return status;
 }
 
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index 69551e3c96e..a6329dab66e 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -462,6 +462,7 @@ class Arguments : AllStatic {
   static void check_deprecated_gc_flags();
   // Check consistency or otherwise of VM argument settings
   static bool check_vm_args_consistency();
+  static bool check_vm_args_consistency_ext();
   // Check stack pages settings
   static bool check_stack_pages();
   // Used by os_solaris
diff --git a/hotspot/src/share/vm/runtime/arguments_ext.cpp b/hotspot/src/share/vm/runtime/arguments_ext.cpp
new file mode 100644
index 00000000000..5edd449b3da
--- /dev/null
+++ b/hotspot/src/share/vm/runtime/arguments_ext.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "runtime/arguments.hpp"
+
+bool Arguments::check_vm_args_consistency_ext() {
+  return true;
+}
-- 
GitLab


From 833620662c6be71cf09398477b00897f7977ee6a Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty" <dcubed@openjdk.org>
Date: Thu, 12 Jun 2014 15:57:16 -0700
Subject: [PATCH 075/192] 8046287: [TESTBUG]
 runtime/Thread/TestThreadDumpMonitorContention.java failed error_cnt=12

Added a new header waiting pattern to catch the case where the target thread waiting on a condition (like a VM op); several other test improvements

Reviewed-by: sspitsyn, dholmes
---
 .../TestThreadDumpMonitorContention.java      | 209 ++++++++++++++----
 1 file changed, 169 insertions(+), 40 deletions(-)

diff --git a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java
index 06b2274d823..979aefcd446 100644
--- a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java
+++ b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug     8036823
+ * @bug     8046287
  * @summary Creates two threads contending for the same lock and checks
  *      whether jstack reports "locked" by more than one thread.
  *
@@ -52,10 +53,13 @@ public class TestThreadDumpMonitorContention {
     // looking for header lines with these patterns:
     // "ContendingThread-1" #19 prio=5 os_prio=64 tid=0x000000000079c000 nid=0x23 runnable [0xffff80ffb8b87000]
     // "ContendingThread-2" #21 prio=5 os_prio=64 tid=0x0000000000780000 nid=0x2f waiting for monitor entry [0xfffffd7fc1111000]
+    // "ContendingThread-2" #24 prio=5 os_prio=64 tid=0x0000000000ec8800 nid=0x31 waiting on condition [0xfffffd7bbfffe000]
     final static Pattern HEADER_PREFIX_PATTERN = Pattern.compile(
         "^\"ContendingThread-.*");
-    final static Pattern HEADER_WAITING_PATTERN = Pattern.compile(
+    final static Pattern HEADER_WAITING_PATTERN1 = Pattern.compile(
         "^\"ContendingThread-.* waiting for monitor entry .*");
+    final static Pattern HEADER_WAITING_PATTERN2 = Pattern.compile(
+        "^\"ContendingThread-.* waiting on condition .*");
     final static Pattern HEADER_RUNNABLE_PATTERN = Pattern.compile(
         "^\"ContendingThread-.* runnable .*");
 
@@ -80,17 +84,34 @@ public class TestThreadDumpMonitorContention {
     final static Pattern WAITING_PATTERN = Pattern.compile(
         ".* waiting to lock \\<.*\\(a TestThreadDumpMonitorContention.*");
 
+    final static Object barrier = new Object();
     volatile static boolean done = false;
 
+    static int barrier_cnt = 0;
+    static int blank_line_match_cnt = 0;
     static int error_cnt = 0;
-    static String header_line = null;
     static boolean have_header_line = false;
     static boolean have_thread_state_line = false;
-    static int match_cnt = 0;
-    static String[] match_list = new String[2];
+    static String header_line = null;
+    static int header_prefix_match_cnt = 0;
+    static int locked_line_match_cnt = 0;
+    static String[] locked_match_list = new String[2];
     static int n_samples = 15;
+    static int sum_both_running_cnt = 0;
+    static int sum_both_waiting_cnt = 0;
+    static int sum_contended_cnt = 0;
+    static int sum_locked_hdr_runnable_cnt = 0;
+    static int sum_locked_hdr_waiting1_cnt = 0;
+    static int sum_locked_hdr_waiting2_cnt = 0;
+    static int sum_locked_thr_state_blocked_cnt = 0;
+    static int sum_locked_thr_state_runnable_cnt = 0;
+    static int sum_one_waiting_cnt = 0;
+    static int sum_uncontended_cnt = 0;
+    static int sum_waiting_hdr_waiting1_cnt = 0;
+    static int sum_waiting_thr_state_blocked_cnt = 0;
     static String thread_state_line = null;
     static boolean verbose = false;
+    static int waiting_line_match_cnt = 0;
 
     public static void main(String[] args) throws Exception {
         if (args.length != 0) {
@@ -110,6 +131,11 @@ public class TestThreadDumpMonitorContention {
 
         Runnable runnable = new Runnable() {
             public void run() {
+                synchronized (barrier) {
+                    // let the main thread know we're running
+                    barrier_cnt++;
+                    barrier.notify();
+                }
                 while (!done) {
                     synchronized (this) { }
                 }
@@ -118,8 +144,16 @@ public class TestThreadDumpMonitorContention {
         Thread[] thread_list = new Thread[2];
         thread_list[0] = new Thread(runnable, "ContendingThread-1");
         thread_list[1] = new Thread(runnable, "ContendingThread-2");
-        thread_list[0].start();
-        thread_list[1].start();
+        synchronized (barrier) {
+            thread_list[0].start();
+            thread_list[1].start();
+
+            // Wait until the contending threads are running so that
+            // we don't sample any thread init states.
+            while (barrier_cnt < 2) {
+                barrier.wait();
+            }
+        }
 
         doSamples();
 
@@ -143,11 +177,12 @@ public class TestThreadDumpMonitorContention {
     // Example:
     // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f runnable [0xfffffd7fc1111000]
     //    java.lang.Thread.State: RUNNABLE
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         at java.lang.Thread.run(Thread.java:745)
     //
     static boolean checkBlankLine(String line) {
         if (line.length() == 0) {
+            blank_line_match_cnt++;
             have_header_line = false;
             have_thread_state_line = false;
             return true;
@@ -161,49 +196,73 @@ public class TestThreadDumpMonitorContention {
     // Example 1:
     // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f runnable [0xfffffd7fc1111000]
     //    java.lang.Thread.State: RUNNABLE
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         - locked <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
     //         at java.lang.Thread.run(Thread.java:745)
     //
     // Example 2:
     // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f waiting for monitor entry [0xfffffd7fc1111000]
     //    java.lang.Thread.State: BLOCKED (on object monitor)
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         - locked <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
     //         at java.lang.Thread.run(Thread.java:745)
     //
+    // Example 3:
+    // "ContendingThread-2" #24 prio=5 os_prio=64 tid=0x0000000000ec8800 nid=0x31 waiting on condition [0xfffffd7bbfffe000]
+    //    java.lang.Thread.State: RUNNABLE
+    //    JavaThread state: _thread_blocked
+    // Thread: 0x0000000000ec8800  [0x31] State: _at_safepoint _has_called_back 0 _at_poll_safepoint 0
+    //    JavaThread state: _thread_blocked
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
+    //         - locked <0xfffffd7e6d03eb28> (a TestThreadDumpMonitorContention$1)
+    //         at java.lang.Thread.run(Thread.java:745)
+    //
     static boolean checkLockedLine(String line) {
         Matcher matcher = LOCK_PATTERN.matcher(line);
         if (matcher.matches()) {
             if (verbose) {
                 System.out.println("locked_line='" + line + "'");
             }
-            match_list[match_cnt] = new String(line);
-            match_cnt++;
+            locked_match_list[locked_line_match_cnt] = new String(line);
+            locked_line_match_cnt++;
 
             matcher = HEADER_RUNNABLE_PATTERN.matcher(header_line);
-            if (!matcher.matches()) {
+            if (matcher.matches()) {
+                sum_locked_hdr_runnable_cnt++;
+            } else {
                 // It's strange, but a locked line can also
-                // match the HEADER_WAITING_PATTERN.
-                matcher = HEADER_WAITING_PATTERN.matcher(header_line);
-                if (!matcher.matches()) {
-                    System.err.println();
-                    System.err.println("ERROR: header line does " +
-                        "not match runnable or waiting patterns.");
-                    System.err.println("ERROR: header_line='" +
-                        header_line + "'");
-                    System.err.println("ERROR: locked_line='" + line + "'");
-                    error_cnt++;
+                // match the HEADER_WAITING_PATTERN{1,2}.
+                matcher = HEADER_WAITING_PATTERN1.matcher(header_line);
+                if (matcher.matches()) {
+                    sum_locked_hdr_waiting1_cnt++;
+                } else {
+                    matcher = HEADER_WAITING_PATTERN2.matcher(header_line);
+                    if (matcher.matches()) {
+                        sum_locked_hdr_waiting2_cnt++;
+                    } else {
+                        System.err.println();
+                        System.err.println("ERROR: header line does " +
+                            "not match runnable or waiting patterns.");
+                        System.err.println("ERROR: header_line='" +
+                            header_line + "'");
+                        System.err.println("ERROR: locked_line='" + line +
+                            "'");
+                        error_cnt++;
+                    }
                 }
             }
 
             matcher = THREAD_STATE_RUNNABLE_PATTERN.matcher(thread_state_line);
-            if (!matcher.matches()) {
+            if (matcher.matches()) {
+                sum_locked_thr_state_runnable_cnt++;
+            } else {
                 // It's strange, but a locked line can also
                 // match the THREAD_STATE_BLOCKED_PATTERN.
                 matcher = THREAD_STATE_BLOCKED_PATTERN.matcher(
                               thread_state_line);
-                if (!matcher.matches()) {
+                if (matcher.matches()) {
+                    sum_locked_thr_state_blocked_cnt++;
+                } else {
                     System.err.println();
                     System.err.println("ERROR: thread state line does not " +
                         "match runnable or waiting patterns.");
@@ -229,19 +288,22 @@ public class TestThreadDumpMonitorContention {
     // Example:
     // "ContendingThread-2" #22 prio=5 os_prio=64 tid=0x00000000007b9800 nid=0x30 waiting for monitor entry [0xfffffd7fc1010000]
     //    java.lang.Thread.State: BLOCKED (on object monitor)
-    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:67)
+    //         at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
     //         - waiting to lock <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
     //         at java.lang.Thread.run(Thread.java:745)
     //
     static boolean checkWaitingLine(String line) {
         Matcher matcher = WAITING_PATTERN.matcher(line);
         if (matcher.matches()) {
+            waiting_line_match_cnt++;
             if (verbose) {
                 System.out.println("waiting_line='" + line + "'");
             }
 
-            matcher = HEADER_WAITING_PATTERN.matcher(header_line);
-            if (!matcher.matches()) {
+            matcher = HEADER_WAITING_PATTERN1.matcher(header_line);
+            if (matcher.matches()) {
+                sum_waiting_hdr_waiting1_cnt++;
+            } else {
                 System.err.println();
                 System.err.println("ERROR: header line does " +
                     "not match a waiting pattern.");
@@ -251,7 +313,9 @@ public class TestThreadDumpMonitorContention {
             }
 
             matcher = THREAD_STATE_BLOCKED_PATTERN.matcher(thread_state_line);
-            if (!matcher.matches()) {
+            if (matcher.matches()) {
+                sum_waiting_thr_state_blocked_cnt++;
+            } else {
                 System.err.println();
                 System.err.println("ERROR: thread state line " +
                     "does not match a waiting pattern.");
@@ -273,7 +337,10 @@ public class TestThreadDumpMonitorContention {
 
     static void doSamples() throws Exception {
         for (int count = 0; count < n_samples; count++) {
-            match_cnt = 0;
+            blank_line_match_cnt = 0;
+            header_prefix_match_cnt = 0;
+            locked_line_match_cnt = 0;
+            waiting_line_match_cnt = 0;
             // verbose mode or an error has a lot of output so add more space
             if (verbose || error_cnt > 0) System.out.println();
             System.out.println("Sample #" + count);
@@ -290,12 +357,12 @@ public class TestThreadDumpMonitorContention {
             //   a failure and we report it
             // - for a stack trace that matches LOCKED_PATTERN, we verify:
             //   - the header line matches HEADER_RUNNABLE_PATTERN
-            //     or HEADER_WAITING_PATTERN
+            //     or HEADER_WAITING_PATTERN{1,2}
             //   - the thread state line matches THREAD_STATE_BLOCKED_PATTERN
             //     or THREAD_STATE_RUNNABLE_PATTERN
             //   - we report any mismatches as failures
             // - for a stack trace that matches WAITING_PATTERN, we verify:
-            //   - the header line matches HEADER_WAITING_PATTERN
+            //   - the header line matches HEADER_WAITING_PATTERN1
             //   - the thread state line matches THREAD_STATE_BLOCKED_PATTERN
             //   - we report any mismatches as failures
             // - the stack traces that match HEADER_PREFIX_PATTERN may
@@ -324,6 +391,7 @@ public class TestThreadDumpMonitorContention {
                 if (!have_header_line) {
                     matcher = HEADER_PREFIX_PATTERN.matcher(line);
                     if (matcher.matches()) {
+                        header_prefix_match_cnt++;
                         if (verbose) {
                             System.out.println();
                             System.out.println("header='" + line + "'");
@@ -366,19 +434,80 @@ public class TestThreadDumpMonitorContention {
             }
             process.waitFor();
 
-           if (match_cnt == 2) {
-               if (match_list[0].equals(match_list[1])) {
-                   System.err.println();
-                   System.err.println("ERROR: matching lock lines:");
-                   System.err.println("ERROR: line[0]'" + match_list[0] + "'");
-                   System.err.println("ERROR: line[1]'" + match_list[1] + "'");
-                   error_cnt++;
-               }
-           }
+            if (header_prefix_match_cnt != 2) {
+                System.err.println();
+                System.err.println("ERROR: should match exactly two headers.");
+                System.err.println("ERROR: header_prefix_match_cnt=" +
+                    header_prefix_match_cnt);
+                error_cnt++;
+            }
+
+            if (locked_line_match_cnt == 2) {
+                if (locked_match_list[0].equals(locked_match_list[1])) {
+                    System.err.println();
+                    System.err.println("ERROR: matching lock lines:");
+                    System.err.println("ERROR: line[0]'" +
+                        locked_match_list[0] + "'");
+                    System.err.println("ERROR: line[1]'" +
+                        locked_match_list[1] + "'");
+                    error_cnt++;
+                }
+            }
+
+            if (locked_line_match_cnt == 1) {
+                // one thread has the lock
+                if (waiting_line_match_cnt == 1) {
+                    // and the other contended for it
+                    sum_contended_cnt++;
+                } else {
+                    // and the other is just running
+                    sum_uncontended_cnt++;
+                }
+            } else if (waiting_line_match_cnt == 1) {
+                // one thread is waiting
+                sum_one_waiting_cnt++;
+            } else if (waiting_line_match_cnt == 2) {
+                // both threads are waiting
+                sum_both_waiting_cnt++;
+            } else {
+                // both threads are running
+                sum_both_running_cnt++;
+            }
 
             // slight delay between jstack launches
             Thread.sleep(500);
         }
+
+        if (error_cnt != 0) {
+            // skip summary info since there were errors
+            return;
+        }
+
+        System.out.println("INFO: Summary for all samples:");
+        System.out.println("INFO: both_running_cnt=" + sum_both_running_cnt);
+        System.out.println("INFO: both_waiting_cnt=" + sum_both_waiting_cnt);
+        System.out.println("INFO: contended_cnt=" + sum_contended_cnt);
+        System.out.println("INFO: one_waiting_cnt=" + sum_one_waiting_cnt);
+        System.out.println("INFO: uncontended_cnt=" + sum_uncontended_cnt);
+        System.out.println("INFO: locked_hdr_runnable_cnt=" +
+            sum_locked_hdr_runnable_cnt);
+        System.out.println("INFO: locked_hdr_waiting1_cnt=" +
+            sum_locked_hdr_waiting1_cnt);
+        System.out.println("INFO: locked_hdr_waiting2_cnt=" +
+            sum_locked_hdr_waiting2_cnt);
+        System.out.println("INFO: locked_thr_state_blocked_cnt=" +
+            sum_locked_thr_state_blocked_cnt);
+        System.out.println("INFO: locked_thr_state_runnable_cnt=" +
+            sum_locked_thr_state_runnable_cnt);
+        System.out.println("INFO: waiting_hdr_waiting1_cnt=" +
+            sum_waiting_hdr_waiting1_cnt);
+        System.out.println("INFO: waiting_thr_state_blocked_cnt=" +
+            sum_waiting_thr_state_blocked_cnt);
+
+        if (sum_contended_cnt == 0) {
+            System.err.println("WARNING: the primary scenario for 8036823" +
+                " has not been exercised by this test run.");
+        }
     }
 
     // This helper relies on RuntimeMXBean.getName() returning a string
-- 
GitLab


From 5e1811cd0edd34d794f0652ab362fddd13a3e3f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Per=20Lid=C3=A9n?= <pliden@openjdk.org>
Date: Fri, 13 Jun 2014 13:46:06 +0200
Subject: [PATCH 076/192] 8044796: G1: Enable G1CollectedHeap::stop()

Reviewed-by: brutisso, sjohanss
---
 .../gc_implementation/g1/g1CollectedHeap.cpp  | 28 +++++--------------
 .../gc_implementation/g1/g1CollectedHeap.hpp  |  2 --
 hotspot/src/share/vm/runtime/java.cpp         |  9 ++----
 hotspot/src/share/vm/runtime/thread.cpp       | 10 ++-----
 4 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index a1dbb6f1b18..2f259ea1beb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -433,14 +433,6 @@ HeapRegion* G1CollectedHeap::pop_dirty_cards_region()
   return hr;
 }
 
-void G1CollectedHeap::stop_conc_gc_threads() {
-  _cg1r->stop();
-  _cmThread->stop();
-  if (G1StringDedup::is_enabled()) {
-    G1StringDedup::stop();
-  }
-}
-
 #ifdef ASSERT
 // A region is added to the collection set as it is retired
 // so an address p can point to a region which will be in the
@@ -2174,20 +2166,14 @@ jint G1CollectedHeap::initialize() {
 }
 
 void G1CollectedHeap::stop() {
-#if 0
-  // Stopping concurrent worker threads is currently disabled until
-  // some bugs in concurrent mark has been resolve. Without fixing
-  // those bugs first we risk haning during VM exit when trying to
-  // stop these threads.
-
-  // Abort any ongoing concurrent root region scanning and stop all
-  // concurrent threads. We do this to make sure these threads do
-  // not continue to execute and access resources (e.g. gclog_or_tty)
+  // Stop all concurrent threads. We do this to make sure these threads
+  // do not continue to execute and access resources (e.g. gclog_or_tty)
   // that are destroyed during shutdown.
-  _cm->root_regions()->abort();
-  _cm->root_regions()->wait_until_scan_finished();
-  stop_conc_gc_threads();
-#endif
+  _cg1r->stop();
+  _cmThread->stop();
+  if (G1StringDedup::is_enabled()) {
+    G1StringDedup::stop();
+  }
 }
 
 size_t G1CollectedHeap::conservative_max_heap_alignment() {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index 77918a64aae..f4d0baae983 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1684,8 +1684,6 @@ public:
   void print_all_rsets() PRODUCT_RETURN;
 
 public:
-  void stop_conc_gc_threads();
-
   size_t pending_card_num();
   size_t cards_scanned();
 
diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp
index e852b56ef54..3a075117afe 100644
--- a/hotspot/src/share/vm/runtime/java.cpp
+++ b/hotspot/src/share/vm/runtime/java.cpp
@@ -501,9 +501,6 @@ void before_exit(JavaThread * thread) {
     os::infinite_sleep();
   }
 
-  // Stop any ongoing concurrent GC work
-  Universe::heap()->stop();
-
   // Terminate watcher thread - must before disenrolling any periodic task
   if (PeriodicTask::num_tasks() > 0)
     WatcherThread::stop();
@@ -518,10 +515,8 @@ void before_exit(JavaThread * thread) {
   StatSampler::disengage();
   StatSampler::destroy();
 
-  // We do not need to explicitly stop concurrent GC threads because the
-  // JVM will be taken down at a safepoint when such threads are inactive --
-  // except for some concurrent G1 threads, see (comment in)
-  // Threads::destroy_vm().
+  // Stop concurrent GC threads
+  Universe::heap()->stop();
 
   // Print GC/heap related information.
   if (PrintGCDetails) {
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index e9e9d22f197..3296a5d1436 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -3968,14 +3968,8 @@ bool Threads::destroy_vm() {
     // GC vm_operations can get caught at the safepoint, and the
     // heap is unparseable if they are caught. Grab the Heap_lock
     // to prevent this. The GC vm_operations will not be able to
-    // queue until after the vm thread is dead.
-    // After this point, we'll never emerge out of the safepoint before
-    // the VM exits, so concurrent GC threads do not need to be explicitly
-    // stopped; they remain inactive until the process exits.
-    // Note: some concurrent G1 threads may be running during a safepoint,
-    // but these will not be accessing the heap, just some G1-specific side
-    // data structures that are not accessed by any other threads but them
-    // after this point in a terminal safepoint.
+    // queue until after the vm thread is dead. After this point,
+    // we'll never emerge out of the safepoint before the VM exits.
 
     MutexLocker ml(Heap_lock);
 
-- 
GitLab


From 92675f5272c5576ad932197947a4a955cd1c9721 Mon Sep 17 00:00:00 2001
From: Dmitry Samersoff <dsamersoff@openjdk.org>
Date: Fri, 13 Jun 2014 05:10:44 -0700
Subject: [PATCH 077/192] 8038392: Generating prelink cache breaks JAVA
 &#39;jinfo&#39; utility normal behaviour

Better parsing of /proc/pid/maps in sa

Reviewed-by: sspitsyn, sla
---
 hotspot/agent/src/os/linux/ps_proc.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/hotspot/agent/src/os/linux/ps_proc.c b/hotspot/agent/src/os/linux/ps_proc.c
index 61923a25529..a3c18c9e0de 100644
--- a/hotspot/agent/src/os/linux/ps_proc.c
+++ b/hotspot/agent/src/os/linux/ps_proc.c
@@ -263,7 +263,7 @@ static bool add_new_thread(struct ps_prochandle* ph, pthread_t pthread_id, lwpid
 
 static bool read_lib_info(struct ps_prochandle* ph) {
   char fname[32];
-  char buf[256];
+  char buf[PATH_MAX];
   FILE *fp = NULL;
 
   sprintf(fname, "/proc/%d/maps", ph->pid);
@@ -273,10 +273,41 @@ static bool read_lib_info(struct ps_prochandle* ph) {
     return false;
   }
 
-  while(fgets_no_cr(buf, 256, fp)){
-    char * word[6];
-    int nwords = split_n_str(buf, 6, word, ' ', '\0');
-    if (nwords > 5 && find_lib(ph, word[5]) == false) {
+  while(fgets_no_cr(buf, PATH_MAX, fp)){
+    char * word[7];
+    int nwords = split_n_str(buf, 7, word, ' ', '\0');
+
+    if (nwords < 6) {
+      // not a shared library entry. ignore.
+      continue;
+    }
+
+    // SA does not handle the lines with patterns:
+    //   "[stack]", "[heap]", "[vdso]", "[vsyscall]", etc.
+    if (word[5][0] == '[') {
+        // not a shared library entry. ignore.
+        continue;
+    }
+
+    if (nwords > 6) {
+      // prelink altered mapfile when the program is running.
+      // Entries like one below have to be skipped
+      //  /lib64/libc-2.15.so (deleted)
+      // SO name in entries like one below have to be stripped.
+      //  /lib64/libpthread-2.15.so.#prelink#.EECVts
+      char *s = strstr(word[5],".#prelink#");
+      if (s == NULL) {
+        // No prelink keyword. skip deleted library
+        print_debug("skip shared object %s deleted by prelink\n", word[5]);
+        continue;
+      }
+
+      // Fall through
+      print_debug("rectifying shared object name %s changed by prelink\n", word[5]);
+      *s = 0;
+    }
+
+    if (find_lib(ph, word[5]) == false) {
        intptr_t base;
        lib_info* lib;
 #ifdef _LP64
-- 
GitLab


From e5749d72fd777a2dd3191a55f9f642be40d59f0f Mon Sep 17 00:00:00 2001
From: Kim Barrett <kim.barrett@oracle.com>
Date: Fri, 13 Jun 2014 17:07:39 -0400
Subject: [PATCH 078/192] 8046408: Build failure from multiple ptrace.h

Prefer <sys/ptrace.h> over <linux/ptrace.h>

Reviewed-by: sla, mikael
---
 hotspot/agent/src/os/linux/libproc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/agent/src/os/linux/libproc.h b/hotspot/agent/src/os/linux/libproc.h
index c917a938c5a..b07c090bfec 100644
--- a/hotspot/agent/src/os/linux/libproc.h
+++ b/hotspot/agent/src/os/linux/libproc.h
@@ -34,7 +34,7 @@
 #include "libproc_md.h"
 #endif
 
-#include <linux/ptrace.h>
+#include <sys/ptrace.h>
 
 /************************************************************************************
 
-- 
GitLab


From 1e5168fceda7570697a37ad007b7a044d91823cf Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Mon, 16 Jun 2014 15:12:24 +0400
Subject: [PATCH 079/192] 8044742:
 testlibrary_tests/whitebox/vm_flags/BooleanTest.java NoClassDefFoundError:
 com/oracle/java/testlibrary/JDKToolFinder

Reviewed-by: kvn, roland
---
 .../test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java
index cf313c37962..a76fd4d9a22 100644
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java
@@ -25,7 +25,7 @@
  * @test BooleanTest
  * @bug 8028756
  * @library /testlibrary /testlibrary/whitebox
- * @build BooleanTest
+ * @build BooleanTest ClassFileInstaller sun.hotspot.WhiteBox com.oracle.java.testlibrary.*
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BooleanTest
  * @summary testing of WB::set/getBooleanVMFlag()
-- 
GitLab


From b0421303e626d0ebcf5723212662ccc39453aaea Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Mon, 16 Jun 2014 17:13:58 +0400
Subject: [PATCH 080/192] 8046221: [TEST_BUG] Cleanup datatransfer tests

Reviewed-by: anthony, alexsch
---
 .../DataFlavorCloneTest.java                  |  49 +++++
 .../DataFlavor/DataFlavorEqualsNullTest.java  |  62 +++++++
 .../DataFlavor/DataFlavorEqualsTest.java      |  58 ++++++
 .../DataFlavor/DataFlavorFileListTest.java    |  45 +++++
 .../DataFlavor/DataFlavorSerializedTest.java  |  46 +++++
 .../DataFlavor/DefaultMatchTest.java          |  64 +++++++
 .../DataFlavor/EqualHashCodeTest.java         |  83 +++++++++
 .../DataFlavor/ExternalizeTest.java           |  80 +++++++++
 ...eaderForTextIAEForStringSelectionTest.java |  70 ++++++++
 .../DataFlavor/GetReaderForTextNPETest.java   |  74 ++++++++
 .../DataFlavor/MimeTypeSerializationTest.java |  86 +++++++++
 .../DataFlavor/NoClassParameterTest.java      |  50 ++++++
 .../NormalizeMimeTypeParameter.java           |  60 +++++++
 .../DataFlavor/NullDataFlavorTest.java        | 108 +++++++++++
 .../DataFlavor/ReaderForUnicodeText.java      |  90 ++++++++++
 .../DataFlavor/SelectBestFlavorNPETest.java   |  50 ++++++
 .../SelectBestTextFlavorBadArrayTest.java     |  73 ++++++++
 .../DataFlavor/ToStringNullPointerTest.java   |  47 +++++
 .../AbsoluteComponentCenterCalculator.java    |   0
 .../DataFlavorSearcher.java                   |   0
 .../InterprocessMessages.java                 |   0
 .../MissedHtmlAndRtfBug.html                  |   0
 .../MissedHtmlAndRtfBug.java                  |   0
 .../MissedHtmlAndRtfBug/MyTransferable.java   |   0
 .../NextFramePositionCalculator.java          |   0
 .../MissedHtmlAndRtfBug/SourcePanel.java      |   0
 .../MissedHtmlAndRtfBug/TargetPanel.java      |   0
 .../SystemFlavorMap/DuplicateMappingTest.java |  94 ++++++++++
 .../DuplicatedNativesTest.java                |   0
 .../GetNativesForFlavorTest.java              | 169 ++++++++++++++++++
 .../MappingGenerationTest.java                |   0
 .../SetNativesForFlavorTest.java              |  67 +++++++
 32 files changed, 1525 insertions(+)
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorCloneTest/DataFlavorCloneTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsNullTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorFileListTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorSerializedTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/DefaultMatchTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/EqualHashCodeTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/ExternalizeTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextIAEForStringSelectionTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextNPETest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/MimeTypeSerializationTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/NoClassParameterTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/NormalizeMimeTypeParameter.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/ReaderForUnicodeText.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/SelectBestFlavorNPETest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/SelectBestTextFlavorBadArrayTest.java
 create mode 100644 jdk/test/java/awt/datatransfer/DataFlavor/ToStringNullPointerTest.java
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/DataFlavorSearcher.java (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/InterprocessMessages.java (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/MyTransferable.java (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/NextFramePositionCalculator.java (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/SourcePanel.java (100%)
 rename jdk/test/java/awt/{DataFlavor => datatransfer}/MissedHtmlAndRtfBug/TargetPanel.java (100%)
 create mode 100644 jdk/test/java/awt/datatransfer/SystemFlavorMap/DuplicateMappingTest.java
 rename jdk/test/java/awt/datatransfer/{DuplicatedNativesTest => SystemFlavorMap}/DuplicatedNativesTest.java (100%)
 create mode 100644 jdk/test/java/awt/datatransfer/SystemFlavorMap/GetNativesForFlavorTest.java
 rename jdk/test/java/awt/datatransfer/{MappingGenerationTest => SystemFlavorMap}/MappingGenerationTest.java (100%)
 create mode 100644 jdk/test/java/awt/datatransfer/SystemFlavorMap/SetNativesForFlavorTest.java

diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorCloneTest/DataFlavorCloneTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorCloneTest/DataFlavorCloneTest.java
new file mode 100644
index 00000000000..670c5cb20e7
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorCloneTest/DataFlavorCloneTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4181601
+  @summary tests that DataFlavor.clone method doesn't throw exception
+  @author xianfa: area=
+  @run main DataFlavorCloneTest
+*/
+
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorCloneTest {
+
+    public static void main(String[] args) throws Exception {
+        DataFlavor df1 = null;
+        Object df2 = null;
+        try {
+            df1 = new DataFlavor();
+            df2 = df1.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException("FAILED: Unexpected exception: " + e);
+        } catch (NullPointerException e) {
+            throw new RuntimeException("FAILED: Got Null pointer exception");
+        }
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsNullTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsNullTest.java
new file mode 100644
index 00000000000..b01fa915e10
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsNullTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4175731
+  @summary DataFlavor.equals(null) throws NullPointerException
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorEqualsNullTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorEqualsNullTest {
+    public static boolean finished = false;
+    static boolean noexc = true;
+    static boolean eq = false;
+    static DataFlavor df = null;
+
+    public static void main(String[] args) throws Exception {
+
+        try {
+            df = new DataFlavor("application/postscript;class=java.awt.datatransfer.DataFlavor");
+        } catch (ClassNotFoundException e) {
+            // This should never happen
+        }
+        try {
+            eq = df.equals((Object) null);
+            if (eq) noexc = false;
+            eq = df.equals((DataFlavor) null);
+            if (eq) noexc = false;
+            eq = df.equals((String) null);
+            if (eq) noexc = false;
+        } catch (NullPointerException e1) {
+            noexc = false;
+        }
+        finished = true;
+        if (!noexc)
+            throw new RuntimeException("Test FAILED");
+    }
+}
+
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsTest.java
new file mode 100644
index 00000000000..158fbd94981
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4175341
+  @summary DataFlavor.equals throws NullPointerException
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorEqualsTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorEqualsTest {
+     public static boolean finished = false;
+     static boolean noexc = true;
+     static boolean eq = false;
+     static DataFlavor df = null;
+
+     public static void main(String[] args) {
+         df = new DataFlavor();
+         try {
+             eq = df.equals((Object)new DataFlavor());
+             if (!eq) noexc = false;
+             eq = df.equals(new DataFlavor());
+             if (!eq) noexc = false;
+             eq = df.equals("application/postscript;class=java.awt.datatransfer.DataFlavor");
+             if (eq) noexc = false;
+         } catch (NullPointerException e1) {
+             noexc = false;
+         }
+         finished = true;
+         if (!noexc)
+             throw new RuntimeException("Test FAILED");
+
+     }
+
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorFileListTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorFileListTest.java
new file mode 100644
index 00000000000..e3300033bf9
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorFileListTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4172848
+  @summary DataFlavor.isFlavorJavaFileListType works wrong
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorFileListTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorFileListTest {
+     public static boolean finished = false;
+     static DataFlavor df = null;
+
+     public static void main(String[] args) throws Exception {
+         df = new DataFlavor("application/x-java-file-list;class=java.util.ArrayList");
+         boolean fl = df.isFlavorJavaFileListType();
+         finished = true;
+         if (!fl)
+             throw new RuntimeException("Test FAILED");
+     }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorSerializedTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorSerializedTest.java
new file mode 100644
index 00000000000..a62bf99f596
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/DataFlavorSerializedTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4174020
+  @summary DataFlavor.isMimeTypeSerializedObject works wrong
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorSerializedTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorSerializedTest {
+     public static boolean finished = false;
+     static DataFlavor df = null;
+
+     public static void main(String[] args) throws Exception {
+         df = new DataFlavor("application/x-java-serialized-object;class=java.io.Serializable");
+         boolean fl = df.isMimeTypeSerializedObject();
+         finished = true;
+         if (!fl)
+             throw new RuntimeException("Test FAILED");
+     }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/DefaultMatchTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/DefaultMatchTest.java
new file mode 100644
index 00000000000..885d564c14a
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/DefaultMatchTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4250750
+  @summary tests that DataFlavor.match() does not throw NPE.
+  @author prs@sparc.spb.su: area=
+  @run main DefaultMatchTest
+*/
+
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DefaultMatchTest {
+
+    static DataFlavor df1, df2, df3;
+
+    public static void main(String[] args) throws Exception {
+        boolean passed = true;
+        try {
+            df1 = new DataFlavor("application/postscript");
+            df2 = new DataFlavor();
+            df3 = new DataFlavor();
+        } catch (ClassNotFoundException e1) {
+            throw new RuntimeException("Could not create DataFlavors. This should never happen.");
+        } catch (IllegalArgumentException e2) {
+            passed = false;
+        }
+        try {
+            boolean b;
+            b = df1.match(df2);
+            b = df2.match(df1);
+            b = df2.match(df3);
+        } catch (NullPointerException e) {
+            throw new RuntimeException("The test FAILED: DataFlavor.match still throws NPE");
+        }
+        if (!passed) {
+            throw new RuntimeException("Test FAILED");
+        }
+        System.out.println("Test PASSED");
+    }
+}
+
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/EqualHashCodeTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/EqualHashCodeTest.java
new file mode 100644
index 00000000000..6c76cf65011
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/EqualHashCodeTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4157612
+  @summary tests that certain awt classes do not break basic hashCode() contract.
+  @author prs@sparc.spb.su: area=
+  @run main EqualHashCodeTest
+*/
+
+import java.awt.*;
+import java.awt.color.ColorSpace;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+
+public class EqualHashCodeTest {
+
+     static DataFlavor df1, df2;
+     static Insets insets1, insets2;
+     static Dimension dim1, dim2;
+     static ColorModel cm1, cm2;
+     static int[] ColorModelBits = { 8, 8, 8, 8 };
+
+     public static void main(String[] args) throws Exception {
+         boolean passed = true;
+         try {
+             df1 = new DataFlavor( "application/postscript" );
+             df2 = new DataFlavor( "application/*" );
+         } catch (ClassNotFoundException e1) {
+             throw new RuntimeException("Could not create DataFlavors. This should never happen.");
+         } catch (IllegalArgumentException e2) {
+             passed = false;
+         }
+         if (df1.hashCode() != df2.hashCode()) {
+             passed = false;
+         }
+         dim1 = new Dimension(3, 18);
+         dim2 = new Dimension(3, 18);
+         if (dim1.hashCode() != dim2.hashCode()) {
+             passed = false;
+         }
+         insets1 = new Insets(3, 4, 7, 11);
+         insets2 = new Insets(3, 4, 7, 11);
+         if (insets1.hashCode() != insets2.hashCode()) {
+             passed = false;
+         }
+         cm1 = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                                       ColorModelBits, true, true,
+                                       Transparency.OPAQUE, 0);
+         cm2 = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                                       ColorModelBits, true, true,
+                                       Transparency.OPAQUE, 0);
+         if (cm1.hashCode() != cm2.hashCode()) {
+             passed = false;
+         }
+         if (!passed)
+             throw new RuntimeException("Test FAILED");
+     }
+
+}
+
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/ExternalizeTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/ExternalizeTest.java
new file mode 100644
index 00000000000..a3a7d2d53cd
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/ExternalizeTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4274267
+  @summary Tests that externalized DataFlavor is restored properly
+  @author prs@sparc.spb.su: area=
+  @run main ExternalizeTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+public class ExternalizeTest {
+
+   public static void main(String[] args) {
+       DataFlavor df = new DataFlavor("text/enriched; charset=ascii", "Enrich Flavor");
+
+       storeDataFlavor(df);
+       DataFlavor df1 = retrieveDataFlavor();
+
+       if (!df.equals(df1)) {
+           throw new RuntimeException("FAILED: restored DataFlavor is not equal to externalized one");
+       }
+
+   }
+
+   public static void storeDataFlavor(DataFlavor dfs){
+       // To store the dataflavor into a file using writeExternal()
+       try {
+           FileOutputStream ostream = new FileOutputStream("t.tmp");
+           ObjectOutputStream p = new ObjectOutputStream(ostream);
+           dfs.writeExternal(p);
+           ostream.close();
+
+       } catch (Exception ex){
+           throw new RuntimeException("FAIL: problem occured while storing DataFlavor");
+       }
+   }
+
+
+   public static DataFlavor retrieveDataFlavor(){
+       DataFlavor df=DataFlavor.stringFlavor;
+       try {
+           FileInputStream istream = new FileInputStream("t.tmp");
+           ObjectInputStream p = new ObjectInputStream(istream);
+           df.readExternal(p);
+           istream.close();
+       } catch (Exception ex){
+           throw new RuntimeException("FAIL: problem occured while retrieving DataFlavor");
+       }
+
+       return df;
+   }
+}
+
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextIAEForStringSelectionTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextIAEForStringSelectionTest.java
new file mode 100644
index 00000000000..f52af36d098
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextIAEForStringSelectionTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4260874
+  @summary Tests that DataFlavor.getReaderForText do not throw NPE when transferObject is null
+  @author tdv@sparc.spb.su: area=
+  @run main GetReaderForTextIAEForStringSelectionTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.Reader;
+
+public class GetReaderForTextIAEForStringSelectionTest  {
+
+   public static void main(String[] args) throws Exception {
+      DataFlavor pt ;
+
+      try {
+          pt = DataFlavor.plainTextFlavor;
+          StringSelection ss = new StringSelection("ReaderExample");
+          Reader re = pt.getReaderForText(ss);
+          if(re == null) {
+              throw new RuntimeException("Test FAILED! reader==null");
+          }
+      } catch (Exception e) {
+          throw new RuntimeException("Test FAILED because of the exception: " + e);
+      }
+    }
+
+ }
+
+class FakeTransferable implements Transferable {
+    public DataFlavor[] getTransferDataFlavors() {
+        return null;
+    }
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        return false;
+    }
+    public Object getTransferData(DataFlavor flavor) throws
+        UnsupportedFlavorException, IOException {
+        return null;
+    }
+}
+
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextNPETest.java b/jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextNPETest.java
new file mode 100644
index 00000000000..7b503962b9f
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/GetReaderForTextNPETest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4260874
+  @summary Tests that DataFlavor.getReaderForText do not throw NPE when transferObject is null
+  @author tdv@sparc.spb.su: area=
+  @run main GetReaderForTextNPETest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.Reader;
+
+public class GetReaderForTextNPETest {
+
+    public static void main(String[] args) {
+        DataFlavor df = new DataFlavor();
+        FakeTransferable t = new FakeTransferable();
+        Reader reader;
+        try {
+            reader = df.getReaderForText(null);
+        } catch (Exception e) {
+            if (!(e instanceof NullPointerException)) {
+                throw new RuntimeException("TEST FAILED: not a NPE thrown on a null argument.");
+            }
+        }
+        try {
+            reader = df.getReaderForText(t);
+        } catch (Exception e) {
+            if (!(e instanceof IllegalArgumentException)) {
+                throw new RuntimeException("FAILED: not an IllegalArgumentException thrown on a transferable with null transfer data .");
+            }
+        }
+    }
+}
+
+class FakeTransferable implements Transferable {
+    public DataFlavor[] getTransferDataFlavors() {
+        return null;
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        return false;
+    }
+
+    public Object getTransferData(DataFlavor flavor) throws
+            UnsupportedFlavorException, IOException {
+        return null;
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/MimeTypeSerializationTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/MimeTypeSerializationTest.java
new file mode 100644
index 00000000000..50f1dde894a
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/MimeTypeSerializationTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4116781
+  @summary Tests that long (more than 64K) MimeType can be serialized
+           and deserialized.
+  @author gas@sparc.spb.su area=datatransfer
+  @run main MimeTypeSerializationTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+
+public class MimeTypeSerializationTest {
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+
+        try {
+            int len = 70000;
+            char[] longValue = new char[len];
+            Arrays.fill(longValue, 'v');
+            DataFlavor longdf = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
+                "; class=java.lang.String; longParameter=" + new String(longValue));
+
+            DataFlavor shortdf = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
+                "; class=java.lang.String");
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream(100000);
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(longdf);
+            oos.writeObject(shortdf);
+            oos.close();
+
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream ois = new ObjectInputStream(bais);
+            DataFlavor longdf2 = (DataFlavor) ois.readObject();
+            DataFlavor shortdf2 = (DataFlavor) ois.readObject();
+            ois.close();
+
+            failed = !( longdf.getMimeType().equals(longdf2.getMimeType()) &&
+                shortdf.getMimeType().equals(shortdf2.getMimeType()) );
+            if (failed) {
+                System.err.println("deserialized MIME type does not match original one");
+            }
+        } catch (IOException e) {
+            failed = true;
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        if (failed) {
+            throw new RuntimeException("test failed: serialization attempt failed");
+        } else {
+            System.err.println("test passed");
+        }
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/NoClassParameterTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/NoClassParameterTest.java
new file mode 100644
index 00000000000..40e899169af
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/NoClassParameterTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4212613
+  @summary tests that DataFlavor(String) doesn't through Exception if no "class=" specified.
+  @author prs@sparc.spb.su: area=
+  @run main NoClassParameterTest
+*/
+
+
+import java.awt.datatransfer.DataFlavor;
+
+public class NoClassParameterTest {
+     static DataFlavor df = null;
+
+     public static void main(String[] args) {
+         boolean passed = true;
+         try {
+             df = new DataFlavor("application/postscript");
+         } catch (ClassNotFoundException e1) {
+             throw new RuntimeException("This should never happen.");
+         } catch (IllegalArgumentException e2) {
+             passed = false;
+         }
+         if (!passed)
+             throw new RuntimeException("Test FAILED");
+     }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/NormalizeMimeTypeParameter.java b/jdk/test/java/awt/datatransfer/DataFlavor/NormalizeMimeTypeParameter.java
new file mode 100644
index 00000000000..6c794ca9383
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/NormalizeMimeTypeParameter.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+  @test
+  @bug 4260860
+  @summary tests that DataFlavor.normalizeMimeTypeParameter() returns parm value
+  @author ssi@sparc.spb.su area=
+  @run main NormalizeMimeTypeParameter
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class NormalizeMimeTypeParameter {
+
+  static class TestFlavor extends DataFlavor {
+    public String normalizeMimeType(String mimeType) {
+      return super.normalizeMimeType(mimeType);
+    }
+    public String normalizeMimeTypeParameter(String parameterName,
+                                             String parameterValue) {
+      return super.normalizeMimeTypeParameter(parameterName, parameterValue);
+    }
+  }
+
+  static TestFlavor testFlavor;
+
+  public static void main(String[] args) {
+    testFlavor = new TestFlavor();
+
+    String type = "TestType";
+    String parameter = "TestParameter";
+
+    String retValue = testFlavor.normalizeMimeTypeParameter(type, parameter);
+    if(!retValue.equals(parameter)) {
+      throw new RuntimeException("Test FAILED: " + retValue);
+    }
+  }
+
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java
new file mode 100644
index 00000000000..6880f3e2551
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4682039
+  @summary Tests that DataTransferer.getFormatsForFlavors() does not throw
+           NullPointerException if some of given as parameter data flavors
+           are null.
+  @author gas@sparc.spb.su area=datatransfer
+  @run main NullDataFlavorTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+
+public class NullDataFlavorTest {
+
+    private final static Clipboard clipboard =
+        Toolkit.getDefaultToolkit().getSystemClipboard();
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+
+        try {
+            clipboard.setContents(new NullSelection("DATA1",
+                new DataFlavor[] { null, null, null }), null);
+            clipboard.setContents(new NullSelection("DATA2",
+                new DataFlavor[] { null, DataFlavor.stringFlavor, null }), null);
+            clipboard.setContents(new NullSelection("DATA3", null), null);
+        } catch (NullPointerException e) {
+            failed = true;
+            e.printStackTrace();
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+
+        if (failed) {
+            throw new RuntimeException("test failed: NullPointerException " +
+            "has been thrown");
+        } else {
+            System.err.println("test passed");
+        }
+    }
+}
+
+class NullSelection implements Transferable {
+
+    private final DataFlavor[] flavors;
+
+    private final String data;
+
+    public NullSelection(String data, DataFlavor[] flavors) {
+        this.data = data;
+        this.flavors = flavors;
+    }
+
+    @Override
+    public DataFlavor[] getTransferDataFlavors() {
+        return flavors;
+    }
+
+    @Override
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        for (DataFlavor fl : flavors) {
+            if (flavor.equals(fl)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public Object getTransferData(DataFlavor flavor)
+        throws UnsupportedFlavorException, java.io.IOException
+    {
+        for (DataFlavor fl : flavors) {
+            if (flavor.equals(fl)) {
+                return data;
+            }
+        }
+        throw new UnsupportedFlavorException(flavor);
+    }
+
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/ReaderForUnicodeText.java b/jdk/test/java/awt/datatransfer/DataFlavor/ReaderForUnicodeText.java
new file mode 100644
index 00000000000..2dbe746f2e1
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/ReaderForUnicodeText.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4274234
+  @summary Tests that DataFlavor.getReaderForText() doesn't throw UnsupportedEncodingException for unicode text
+  @author prs@sparc.spb.su: area=
+  @run main ReaderForUnicodeText
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+
+public class ReaderForUnicodeText {
+
+   public static void main(String[] args) throws Exception {
+      DataFlavor df = DataFlavor.plainTextFlavor;
+      TextTransferable t = new TextTransferable();
+      Reader reader;
+      try {
+          reader = df.getReaderForText(t);
+      } catch (UnsupportedEncodingException e) {
+           throw new RuntimeException("FAILED: Exception thrown in getReaderForText()");
+      }
+    }
+}
+
+class TextTransferable implements Transferable {
+
+    String text = "Try to test me...";
+
+    @Override
+    public DataFlavor[] getTransferDataFlavors() {
+        DataFlavor flavors[] = {DataFlavor.plainTextFlavor};
+        return flavors;
+    }
+
+    @Override
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        if (flavor.match(DataFlavor.plainTextFlavor)) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public Object getTransferData(DataFlavor flavor) throws
+        UnsupportedFlavorException, IOException {
+
+        byte[] textBytes = null;
+
+        if (!isDataFlavorSupported(flavor)) {
+            throw new UnsupportedFlavorException(flavor);
+        }
+        String encoding = flavor.getParameter("charset");
+        if (encoding == null) {
+            textBytes = text.getBytes();
+        } else {
+            textBytes = text.getBytes(encoding);
+        }
+        return new ByteArrayInputStream(textBytes);
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/SelectBestFlavorNPETest.java b/jdk/test/java/awt/datatransfer/DataFlavor/SelectBestFlavorNPETest.java
new file mode 100644
index 00000000000..21cde56738d
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/SelectBestFlavorNPETest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4370469
+  @summary tests that selectBestTextFlavor doesn't throw NPE
+  @author prs@sparc.spb.su: area=
+  @run main SelectBestFlavorNPETest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class SelectBestFlavorNPETest {
+
+    public static void main(String[] args) {
+
+        DataFlavor flavor1 = new DataFlavor("text/plain; charset=unicode; class=java.io.InputStream",
+                "Flavor 1");
+        DataFlavor flavor2 = new DataFlavor("text/plain; class=java.io.InputStream", "Flavor 2");
+        DataFlavor[] flavors = new DataFlavor[]{flavor1, flavor2};
+        try {
+            DataFlavor best = DataFlavor.selectBestTextFlavor(flavors);
+            System.out.println("best=" + best);
+        } catch (NullPointerException e1) {
+            throw new RuntimeException("Test FAILED because of NPE in selectBestTextFlavor");
+        }
+    }
+
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/SelectBestTextFlavorBadArrayTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/SelectBestTextFlavorBadArrayTest.java
new file mode 100644
index 00000000000..7b7d5dd3c98
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/SelectBestTextFlavorBadArrayTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4386360
+  @summary tests that DataFlavor.selectBestTextFlavor() returns null when passed
+           is a null array or an empty array or an array which doesn't contain
+           a text flavor in a supported encoding.
+  @author das@sparc.spb.su area=datatransfer
+  @run main SelectBestTextFlavorBadArrayTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.util.Stack;
+import java.util.stream.Collectors;
+
+public class SelectBestTextFlavorBadArrayTest {
+
+    public static void main(String[] args) {
+        final String[] failureMessages = {
+            "DataFlavor.selectBestTextFlavor(null) doesn't return null.",
+            "DataFlavor.selectBestTextFlavor() doesn't return null for an empty array.",
+            "DataFlavor.selectBestTextFlavor() shouldn't return flavor in an unsupported encoding."
+        };
+        Stack<String> failures = new Stack<>();
+
+        DataFlavor flavor = DataFlavor.selectBestTextFlavor(null);
+        if (flavor != null) {
+            failures.push(failureMessages[0]);
+        }
+        flavor = DataFlavor.selectBestTextFlavor(new DataFlavor[0]);
+        if (flavor != null) {
+            failures.push(failureMessages[1]);
+        }
+
+        try {
+            flavor = DataFlavor.selectBestTextFlavor(new DataFlavor[]
+                { new DataFlavor("text/plain; charset=unsupported; class=java.io.InputStream") });
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+            failures.push("Exception thrown: " + e.toString());
+        }
+        if (flavor != null) {
+            failures.push(failureMessages[2]);
+        }
+
+        if (failures.size() > 0) {
+            String failureReport = failures.stream().collect(Collectors.joining("\n"));
+            throw new RuntimeException("TEST FAILED: \n" + failureReport);
+        }
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/DataFlavor/ToStringNullPointerTest.java b/jdk/test/java/awt/datatransfer/DataFlavor/ToStringNullPointerTest.java
new file mode 100644
index 00000000000..91b6c6769ff
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/DataFlavor/ToStringNullPointerTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+  @test
+  @bug 4250768
+  @summary tests that DataFlavor.toString() does not throw NPE
+  @author prs@sparc.spb.su: area=
+  @run main ToStringNullPointerTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class ToStringNullPointerTest {
+
+     static DataFlavor df1;
+
+     public static void main(String[] args) {
+         df1 = new DataFlavor();
+         try {
+             String thisDF = df1.toString();
+         } catch (NullPointerException e) {
+             throw new RuntimeException("Test FAILED: it still throws NPE!");
+         }
+     }
+}
+
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/DataFlavorSearcher.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/DataFlavorSearcher.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/DataFlavorSearcher.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/DataFlavorSearcher.java
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/InterprocessMessages.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/InterprocessMessages.java
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MyTransferable.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MyTransferable.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MyTransferable.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MyTransferable.java
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/NextFramePositionCalculator.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/NextFramePositionCalculator.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/NextFramePositionCalculator.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/NextFramePositionCalculator.java
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/SourcePanel.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/SourcePanel.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/SourcePanel.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/SourcePanel.java
diff --git a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/TargetPanel.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/TargetPanel.java
similarity index 100%
rename from jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/TargetPanel.java
rename to jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/TargetPanel.java
diff --git a/jdk/test/java/awt/datatransfer/SystemFlavorMap/DuplicateMappingTest.java b/jdk/test/java/awt/datatransfer/SystemFlavorMap/DuplicateMappingTest.java
new file mode 100644
index 00000000000..b3dbe4465e9
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/DuplicateMappingTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4493189
+  @summary tests that addUnencodedNativeForFlavor()/addFlavorForUnencodedNative()
+           do not allow to duplicate mappings
+  @author das@sparc.spb.su area=datatransfer
+  @run main DuplicateMappingTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Iterator;
+
+public class DuplicateMappingTest {
+
+    public static void main(String[] args) throws Exception {
+
+        final String nativeString = "NATIVE";
+        final DataFlavor dataFlavor = new DataFlavor();
+
+        final SystemFlavorMap fm =
+                (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
+
+        fm.addUnencodedNativeForFlavor(dataFlavor, nativeString);
+        fm.addUnencodedNativeForFlavor(dataFlavor, nativeString);
+
+        final java.util.List natives =
+                fm.getNativesForFlavor(dataFlavor);
+        boolean found = false;
+
+        for (final Iterator i = natives.iterator(); i.hasNext(); ) {
+            if (nativeString.equals(i.next())) {
+                if (found) {
+                    throw new RuntimeException("getNativesForFlavor() returns:" +
+                            natives);
+                } else {
+                    found = true;
+                }
+            }
+        }
+
+        if (!found) {
+            throw new RuntimeException("getNativesForFlavor() returns:" +
+                    natives);
+        }
+
+        fm.addFlavorForUnencodedNative(nativeString, dataFlavor);
+        fm.addFlavorForUnencodedNative(nativeString, dataFlavor);
+
+        final java.util.List flavors =
+                fm.getFlavorsForNative(nativeString);
+        found = false;
+
+        for (final Iterator i = flavors.iterator(); i.hasNext(); ) {
+            if (dataFlavor.equals(i.next())) {
+                if (found) {
+                    throw new RuntimeException("getFlavorsForNative() returns:" +
+                            flavors);
+                } else {
+                    found = true;
+                }
+            }
+        }
+
+        if (!found) {
+            throw new RuntimeException("getFlavorsForNative() returns:" +
+                    natives);
+        }
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/DuplicatedNativesTest/DuplicatedNativesTest.java b/jdk/test/java/awt/datatransfer/SystemFlavorMap/DuplicatedNativesTest.java
similarity index 100%
rename from jdk/test/java/awt/datatransfer/DuplicatedNativesTest/DuplicatedNativesTest.java
rename to jdk/test/java/awt/datatransfer/SystemFlavorMap/DuplicatedNativesTest.java
diff --git a/jdk/test/java/awt/datatransfer/SystemFlavorMap/GetNativesForFlavorTest.java b/jdk/test/java/awt/datatransfer/SystemFlavorMap/GetNativesForFlavorTest.java
new file mode 100644
index 00000000000..837683026f1
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/GetNativesForFlavorTest.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4493178
+  @summary tests that getNativesForFlavor() synthesizes an encoded String native
+           only if there are no mappings for the DataFlavor and the mappings
+           were not explicitly removed
+  @author das@sparc.spb.su area=datatransfer
+  @run main GetNativesForFlavorTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Iterator;
+
+public class GetNativesForFlavorTest {
+
+    final static SystemFlavorMap fm =
+            (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
+
+    public static void main(String[] args) throws Exception {
+        // 1.Check that the encoded native is not added if there are other
+        // natives for this DataFlavor.
+        test1();
+
+        // 2.Check that the encoded native is not added if all mappings were
+        // explicitly removed for this DataFlavor.
+        test2();
+
+        // 3.Check that only the encoded native is added for text DataFlavors
+        // that has no mappings and that DataFlavor is properly encoded.
+        test3();
+
+        // 4.Verifies that the encoded native is added only for DataFlavors
+        // that has no mappings and that DataFlavor is properly encoded.
+        test4();
+    }
+
+    /**
+     * Verifies that the encoded native is not added if there are other
+     * natives mapped to this DataFlavor.
+     */
+    public static void test1() throws ClassNotFoundException {
+        final DataFlavor flavor =
+                new DataFlavor("text/plain-TEST; charset=Unicode");
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+
+        if (natives.size() > 1) {
+            for (final Iterator i = natives.iterator(); i.hasNext(); ) {
+                String element = (String) i.next();
+                if (SystemFlavorMap.isJavaMIMEType(element)) {
+                    throw new RuntimeException("getFlavorsForNative() returns: "
+                            + natives);
+                }
+            }
+        }
+    }
+
+    /**
+     * Verifies that the encoded native is not added if all mappings were
+     * explicitly removed for this DataFlavor.
+     */
+    public static void test2() throws ClassNotFoundException {
+        final DataFlavor flavor =
+                new DataFlavor("text/plain-TEST; charset=Unicode");
+
+        fm.setNativesForFlavor(flavor, new String[0]);
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+
+        if (!natives.isEmpty()) {
+            throw new RuntimeException("getFlavorsForNative() returns:" +
+                    natives);
+        }
+    }
+
+    /**
+     * Verifies that only the encoded native is added for text DataFlavors
+     * that has no mappings and that DataFlavor is properly encoded.
+     */
+    public static void test3() throws ClassNotFoundException {
+        //
+        final DataFlavor flavor =
+                new DataFlavor("text/plain-TEST-nocharset; class=java.nio.ByteBuffer");
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+        boolean encodedNativeFound = false;
+
+        if (natives.size() == 0) {
+            throw new RuntimeException("getFlavorsForNative() returns:" +
+                    natives);
+        }
+
+        if (natives.size() == 1) {
+            String element = (String) natives.get(0);
+            if (SystemFlavorMap.isJavaMIMEType(element)) {
+                final DataFlavor decodedFlavor =
+                        SystemFlavorMap.decodeDataFlavor(element);
+                if (!flavor.equals(decodedFlavor)) {
+                    System.err.println("DataFlavor is not properly incoded:");
+                    System.err.println("    encoded flavor: " + flavor);
+                    System.err.println("    decoded flavor: " + decodedFlavor);
+                    throw new RuntimeException("getFlavorsForNative() returns:"
+                            + natives);
+                }
+            }
+        } else {
+            for (final Iterator i = natives.iterator(); i.hasNext(); ) {
+                String element = (String) i.next();
+                if (SystemFlavorMap.isJavaMIMEType(element)) {
+                    throw new RuntimeException("getFlavorsForNative() returns:"
+                            + natives);
+                }
+            }
+        }
+    }
+
+    /**
+     * Verifies that the encoded native is added only for DataFlavors
+     * that has no mappings and that DataFlavor is properly encoded.
+     */
+    public static void test4() throws ClassNotFoundException {
+        final DataFlavor flavor =
+                new DataFlavor("unknown/unknown");
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+
+        if (natives.size() == 1) {
+            String element = (String) natives.get(0);
+            if (SystemFlavorMap.isJavaMIMEType(element)) {
+                final DataFlavor decodedFlavor =
+                        SystemFlavorMap.decodeDataFlavor(element);
+                if (!flavor.equals(decodedFlavor)) {
+                    System.err.println("DataFlavor is not properly incoded:");
+                    System.err.println("    encoded flavor: " + flavor);
+                    System.err.println("    decoded flavor: " + decodedFlavor);
+                    throw new RuntimeException("getFlavorsForNative() returns:"
+                            + natives);
+                }
+            }
+        } else {
+            throw new RuntimeException("getFlavorsForNative() returns:"
+                    + natives);
+        }
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java b/jdk/test/java/awt/datatransfer/SystemFlavorMap/MappingGenerationTest.java
similarity index 100%
rename from jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java
rename to jdk/test/java/awt/datatransfer/SystemFlavorMap/MappingGenerationTest.java
diff --git a/jdk/test/java/awt/datatransfer/SystemFlavorMap/SetNativesForFlavorTest.java b/jdk/test/java/awt/datatransfer/SystemFlavorMap/SetNativesForFlavorTest.java
new file mode 100644
index 00000000000..34fc792aeca
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/SetNativesForFlavorTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4478912
+  @summary tests that getNativesForFlavor()/getFlavorsForNative() return the
+           same list as was set with setNativesForFlavor()/setFlavorsForNative()
+  @author das@sparc.spb.su area=datatransfer
+  @run main SetNativesForFlavorTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+
+public class SetNativesForFlavorTest  {
+
+    public static void main(String[] args) throws Exception {
+            final String nativeString = "NATIVE";
+
+            final SystemFlavorMap fm =
+                (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+            fm.setNativesForFlavor(DataFlavor.plainTextFlavor,
+                                   new String[] { nativeString });
+
+            final java.util.List natives =
+                fm.getNativesForFlavor(DataFlavor.plainTextFlavor);
+
+            if (natives.size() != 1 || !natives.contains(nativeString)) {
+                throw new RuntimeException("getNativesForFlavor() returns:" +
+                                           natives);
+            }
+
+            final DataFlavor dataFlavor =
+                new DataFlavor("text/unknown; class=java.lang.String");
+
+            fm.setFlavorsForNative(nativeString, new DataFlavor[] { dataFlavor });
+
+            final java.util.List flavors = fm.getFlavorsForNative(nativeString);
+
+            if (flavors.size() != 1 || !flavors.contains(dataFlavor)) {
+                throw new RuntimeException("getFlavorsForNative() returns:" +
+                                           flavors);
+            }
+    }
+}
-- 
GitLab


From a12feb33eb99ba1f83c11814c5c6fa4af02feb57 Mon Sep 17 00:00:00 2001
From: Rocky Sloan <rocky.sloan@oracle.com>
Date: Tue, 24 Jun 2014 10:47:30 +0400
Subject: [PATCH 081/192] 8044256: Fix doclint warnings (missing javadoc tags)
 in javax.swing.plaf.nimbus

Reviewed-by: alexsch
---
 .../javax/swing/plaf/nimbus/AbstractRegionPainter.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
index 15a10fbf5f9..c41d9247138 100644
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -421,6 +421,13 @@ public abstract class AbstractRegionPainter implements Painter<JComponent> {
      * @param property The name of a bean style property or client property
      * @param defaultColor The color to return if no color was obtained from
      *        the component.
+     * @param saturationOffset additively modifies the HSB saturation component
+     * of the color returned (ignored if default color is returned).
+     * @param brightnessOffset additively modifies the HSB brightness component
+     * of the color returned (ignored if default color is returned).
+     * @param alphaOffset additively modifies the ARGB alpha component of the
+     * color returned (ignored if default color is returned).
+     *
      * @return The color that was obtained from the component or defaultColor
      */
     protected final Color getComponentColor(JComponent c, String property,
-- 
GitLab


From 0a5b921c130faff305b9bd1674a82b797f91ed79 Mon Sep 17 00:00:00 2001
From: Shanliang Jiang <sjiang@openjdk.org>
Date: Tue, 24 Jun 2014 11:09:57 +0200
Subject: [PATCH 082/192] 8038321: RMIConnector_NPETest.java can't start rmid
 if running on fastdebug or Solaris-sparc

Reviewed-by: sla, jbachorik
---
 .../remote/mandatory/connection/RMIConnector_NPETest.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
index ae94557e44d..1e246514dcd 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
@@ -38,7 +38,7 @@ import javax.management.remote.rmi.*;
 public class RMIConnector_NPETest {
     public static void main(String argv[]) throws Exception {
         RMID rmid = RMID.createRMID();
-        rmid.start();
+        rmid.start(Long.MAX_VALUE);
         int rmidPort = rmid.getPort();
         Exception failureCause = null;
         RMIConnector agent = null;
-- 
GitLab


From 18728f8cb91a212a357f60df5512baa1887d7d8a Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Tue, 24 Jun 2014 10:25:56 +0100
Subject: [PATCH 083/192] 8047674: java/net/URLPermission/nstest/lookup.sh
 NoClassDefFoundError when run in concurrent mode

Reviewed-by: alanb
---
 jdk/test/java/net/URLPermission/nstest/lookup.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/jdk/test/java/net/URLPermission/nstest/lookup.sh b/jdk/test/java/net/URLPermission/nstest/lookup.sh
index 33afed78ba6..eefd73cae12 100644
--- a/jdk/test/java/net/URLPermission/nstest/lookup.sh
+++ b/jdk/test/java/net/URLPermission/nstest/lookup.sh
@@ -24,9 +24,9 @@
 
 # @test
 # @library /lib/testlibrary
+# @build jdk.testlibrary.*
 # @compile -XDignore.symbol.file=true SimpleNameService.java
 #            LookupTest.java SimpleNameServiceDescriptor.java
-# @build jdk.testlibrary.*
 # @run shell/timeout=50 lookup.sh
 #
 
@@ -42,8 +42,7 @@ Windows_* | CYGWIN*)
     ;;
 esac
 
-
-port=`${TESTJAVA}/bin/java -cp ${TESTCLASSES} LookupTest -getport`
+port=`${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} LookupTest -getport`
 
 cat << POLICY > policy
 grant {
@@ -60,4 +59,4 @@ POLICY
 ${TESTJAVA}/bin/java ${TESTVMOPTS} \
     -Djava.security.policy=file:./policy \
     -Dsun.net.spi.nameservice.provider.1=simple,sun \
-    -cp ${TESTCLASSES}${PS}${TESTSRC} LookupTest -runtest ${port}
+    -cp ${TESTCLASSPATH}${PS}${TESTSRC} LookupTest -runtest ${port}
-- 
GitLab


From 825d9ee98530a01cee857ce965a8109ee9acefe6 Mon Sep 17 00:00:00 2001
From: Alexander Stepanov <alexander.v.stepanov@oracle.com>
Date: Tue, 24 Jun 2014 16:57:02 +0400
Subject: [PATCH 084/192] 8043967: Fix doclint warnings for java.awt

Reviewed-by: pchelko
---
 jdk/src/share/classes/java/awt/AWTEvent.java  |   7 +-
 .../classes/java/awt/AWTEventMulticaster.java |  81 ++++++++-
 .../share/classes/java/awt/AWTKeyStroke.java  |   1 +
 .../classes/java/awt/AlphaComposite.java      |   6 +-
 .../share/classes/java/awt/BorderLayout.java  |   8 +-
 jdk/src/share/classes/java/awt/Button.java    |   4 +-
 jdk/src/share/classes/java/awt/Checkbox.java  |   5 +-
 .../share/classes/java/awt/CheckboxGroup.java |  11 +-
 jdk/src/share/classes/java/awt/Choice.java    |  15 +-
 jdk/src/share/classes/java/awt/Component.java | 157 +++++++++++++++++-
 .../java/awt/ComponentOrientation.java        |  10 +-
 jdk/src/share/classes/java/awt/Container.java |  17 +-
 jdk/src/share/classes/java/awt/Cursor.java    |   7 +-
 .../share/classes/java/awt/DisplayMode.java   |   4 +-
 .../share/classes/java/awt/EventQueue.java    |   3 +
 jdk/src/share/classes/java/awt/Frame.java     |   8 +-
 .../classes/java/awt/GraphicsEnvironment.java |   2 +
 .../share/classes/java/awt/GridBagLayout.java |  39 +++--
 .../classes/java/awt/HeadlessException.java   |  16 +-
 .../classes/java/awt/ItemSelectable.java      |   4 +-
 .../java/awt/KeyboardFocusManager.java        |   2 +
 jdk/src/share/classes/java/awt/Label.java     |   6 +-
 .../share/classes/java/awt/LayoutManager.java |  11 +-
 .../classes/java/awt/LayoutManager2.java      |  12 +-
 jdk/src/share/classes/java/awt/List.java      |  60 ++++++-
 .../share/classes/java/awt/MediaTracker.java  |  10 +-
 jdk/src/share/classes/java/awt/Menu.java      |   7 +-
 jdk/src/share/classes/java/awt/MenuBar.java   |  14 +-
 .../share/classes/java/awt/MenuComponent.java |   3 +-
 .../share/classes/java/awt/MenuContainer.java |  17 +-
 jdk/src/share/classes/java/awt/MenuItem.java  |  15 +-
 .../share/classes/java/awt/PrintGraphics.java |   4 +-
 jdk/src/share/classes/java/awt/PrintJob.java  |  10 +-
 jdk/src/share/classes/java/awt/Robot.java     |  15 +-
 .../share/classes/java/awt/ScrollPane.java    |   9 +-
 jdk/src/share/classes/java/awt/Scrollbar.java |  19 ++-
 jdk/src/share/classes/java/awt/TextArea.java  |  31 +++-
 .../share/classes/java/awt/TextComponent.java |   5 +-
 jdk/src/share/classes/java/awt/TextField.java |  22 ++-
 jdk/src/share/classes/java/awt/Toolkit.java   |  26 ++-
 jdk/src/share/classes/java/awt/Window.java    |  11 +-
 41 files changed, 634 insertions(+), 80 deletions(-)

diff --git a/jdk/src/share/classes/java/awt/AWTEvent.java b/jdk/src/share/classes/java/awt/AWTEvent.java
index db51f2c1088..4a935f39848 100644
--- a/jdk/src/share/classes/java/awt/AWTEvent.java
+++ b/jdk/src/share/classes/java/awt/AWTEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -388,6 +388,8 @@ public abstract class AWTEvent extends EventObject {
 
     /**
      * Returns the event type.
+     *
+     * @return the event's type id
      */
     public int getID() {
         return id;
@@ -446,6 +448,9 @@ public abstract class AWTEvent extends EventObject {
 
     /**
      * Returns whether this event has been consumed.
+     *
+     * @return {@code true} if this event has been consumed;
+     *          otherwise {@code false}
      */
     protected boolean isConsumed() {
         return consumed;
diff --git a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java
index de51ab1c0b4..112dbb62ace 100644
--- a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java
+++ b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java
@@ -110,7 +110,15 @@ public class AWTEventMulticaster implements
     TextListener, InputMethodListener, HierarchyListener,
     HierarchyBoundsListener, MouseWheelListener {
 
-    protected final EventListener a, b;
+    /**
+     * A variable in the event chain (listener-a)
+     */
+    protected final EventListener a;
+
+    /**
+     * A variable in the event chain (listener-b)
+     */
+    protected final EventListener b;
 
     /**
      * Creates an event multicaster instance which chains listener-a
@@ -537,6 +545,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a component-listener-a
      * @param b component-listener-b
+     * @return the resulting listener
      */
     public static ComponentListener add(ComponentListener a, ComponentListener b) {
         return (ComponentListener)addInternal(a, b);
@@ -547,6 +556,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a container-listener-a
      * @param b container-listener-b
+     * @return the resulting listener
      */
     public static ContainerListener add(ContainerListener a, ContainerListener b) {
         return (ContainerListener)addInternal(a, b);
@@ -557,6 +567,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a focus-listener-a
      * @param b focus-listener-b
+     * @return the resulting listener
      */
     public static FocusListener add(FocusListener a, FocusListener b) {
         return (FocusListener)addInternal(a, b);
@@ -567,6 +578,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a key-listener-a
      * @param b key-listener-b
+     * @return the resulting listener
      */
     public static KeyListener add(KeyListener a, KeyListener b) {
         return (KeyListener)addInternal(a, b);
@@ -577,6 +589,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a mouse-listener-a
      * @param b mouse-listener-b
+     * @return the resulting listener
      */
     public static MouseListener add(MouseListener a, MouseListener b) {
         return (MouseListener)addInternal(a, b);
@@ -587,6 +600,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a mouse-motion-listener-a
      * @param b mouse-motion-listener-b
+     * @return the resulting listener
      */
     public static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b) {
         return (MouseMotionListener)addInternal(a, b);
@@ -597,6 +611,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a window-listener-a
      * @param b window-listener-b
+     * @return the resulting listener
      */
     public static WindowListener add(WindowListener a, WindowListener b) {
         return (WindowListener)addInternal(a, b);
@@ -607,6 +622,7 @@ public class AWTEventMulticaster implements
      * and returns the resulting multicast listener.
      * @param a window-state-listener-a
      * @param b window-state-listener-b
+     * @return the resulting listener
      * @since 1.4
      */
     @SuppressWarnings("overloads")
@@ -620,6 +636,7 @@ public class AWTEventMulticaster implements
      * and returns the resulting multicast listener.
      * @param a window-focus-listener-a
      * @param b window-focus-listener-b
+     * @return the resulting listener
      * @since 1.4
      */
     public static WindowFocusListener add(WindowFocusListener a,
@@ -632,6 +649,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a action-listener-a
      * @param b action-listener-b
+     * @return the resulting listener
      */
     @SuppressWarnings("overloads")
     public static ActionListener add(ActionListener a, ActionListener b) {
@@ -643,6 +661,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a item-listener-a
      * @param b item-listener-b
+     * @return the resulting listener
      */
     @SuppressWarnings("overloads")
     public static ItemListener add(ItemListener a, ItemListener b) {
@@ -654,11 +673,21 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a adjustment-listener-a
      * @param b adjustment-listener-b
+     * @return the resulting listener
      */
     @SuppressWarnings("overloads")
     public static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b) {
         return (AdjustmentListener)addInternal(a, b);
     }
+
+    /**
+     * Adds text-listener-a with text-listener-b and
+     * returns the resulting multicast listener.
+     *
+     * @param  a text-listener-a
+     * @param  b text-listener-b
+     * @return the resulting listener
+     */
     @SuppressWarnings("overloads")
     public static TextListener add(TextListener a, TextListener b) {
         return (TextListener)addInternal(a, b);
@@ -669,6 +698,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a input-method-listener-a
      * @param b input-method-listener-b
+     * @return the resulting listener
      */
      public static InputMethodListener add(InputMethodListener a, InputMethodListener b) {
         return (InputMethodListener)addInternal(a, b);
@@ -679,6 +709,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a hierarchy-listener-a
      * @param b hierarchy-listener-b
+     * @return the resulting listener
      * @since 1.3
      */
     @SuppressWarnings("overloads")
@@ -691,6 +722,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a hierarchy-bounds-listener-a
      * @param b hierarchy-bounds-listener-b
+     * @return the resulting listener
      * @since 1.3
      */
      public static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b) {
@@ -702,6 +734,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param a mouse-wheel-listener-a
      * @param b mouse-wheel-listener-b
+     * @return the resulting listener
      * @since 1.4
      */
     @SuppressWarnings("overloads")
@@ -715,6 +748,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l component-listener-l
      * @param oldl the component-listener being removed
+     * @return the resulting listener
      */
     public static ComponentListener remove(ComponentListener l, ComponentListener oldl) {
         return (ComponentListener) removeInternal(l, oldl);
@@ -725,6 +759,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l container-listener-l
      * @param oldl the container-listener being removed
+     * @return the resulting listener
      */
     public static ContainerListener remove(ContainerListener l, ContainerListener oldl) {
         return (ContainerListener) removeInternal(l, oldl);
@@ -735,6 +770,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l focus-listener-l
      * @param oldl the focus-listener being removed
+     * @return the resulting listener
      */
     public static FocusListener remove(FocusListener l, FocusListener oldl) {
         return (FocusListener) removeInternal(l, oldl);
@@ -745,6 +781,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l key-listener-l
      * @param oldl the key-listener being removed
+     * @return the resulting listener
      */
     public static KeyListener remove(KeyListener l, KeyListener oldl) {
         return (KeyListener) removeInternal(l, oldl);
@@ -755,6 +792,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l mouse-listener-l
      * @param oldl the mouse-listener being removed
+     * @return the resulting listener
      */
     public static MouseListener remove(MouseListener l, MouseListener oldl) {
         return (MouseListener) removeInternal(l, oldl);
@@ -765,6 +803,7 @@ public class AWTEventMulticaster implements
      * and returns the resulting multicast listener.
      * @param l mouse-motion-listener-l
      * @param oldl the mouse-motion-listener being removed
+     * @return the resulting listener
      */
     public static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl) {
         return (MouseMotionListener) removeInternal(l, oldl);
@@ -775,6 +814,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l window-listener-l
      * @param oldl the window-listener being removed
+     * @return the resulting listener
      */
     public static WindowListener remove(WindowListener l, WindowListener oldl) {
         return (WindowListener) removeInternal(l, oldl);
@@ -785,6 +825,7 @@ public class AWTEventMulticaster implements
      * and returns the resulting multicast listener.
      * @param l window-state-listener-l
      * @param oldl the window-state-listener being removed
+     * @return the resulting listener
      * @since 1.4
      */
     @SuppressWarnings("overloads")
@@ -798,6 +839,7 @@ public class AWTEventMulticaster implements
      * and returns the resulting multicast listener.
      * @param l window-focus-listener-l
      * @param oldl the window-focus-listener being removed
+     * @return the resulting listener
      * @since 1.4
      */
     public static WindowFocusListener remove(WindowFocusListener l,
@@ -810,6 +852,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l action-listener-l
      * @param oldl the action-listener being removed
+     * @return the resulting listener
      */
     @SuppressWarnings("overloads")
     public static ActionListener remove(ActionListener l, ActionListener oldl) {
@@ -821,6 +864,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l item-listener-l
      * @param oldl the item-listener being removed
+     * @return the resulting listener
      */
     @SuppressWarnings("overloads")
     public static ItemListener remove(ItemListener l, ItemListener oldl) {
@@ -832,11 +876,21 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l adjustment-listener-l
      * @param oldl the adjustment-listener being removed
+     * @return the resulting listener
      */
     @SuppressWarnings("overloads")
     public static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl) {
         return (AdjustmentListener) removeInternal(l, oldl);
     }
+
+    /**
+     * Removes the old text-listener from text-listener-l and
+     * returns the resulting multicast listener.
+     *
+     * @param  l text-listener-l
+     * @param  oldl the text-listener being removed
+     * @return the resulting listener
+     */
     @SuppressWarnings("overloads")
     public static TextListener remove(TextListener l, TextListener oldl) {
         return (TextListener) removeInternal(l, oldl);
@@ -847,6 +901,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l input-method-listener-l
      * @param oldl the input-method-listener being removed
+     * @return the resulting listener
      */
     public static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl) {
         return (InputMethodListener) removeInternal(l, oldl);
@@ -857,6 +912,7 @@ public class AWTEventMulticaster implements
      * returns the resulting multicast listener.
      * @param l hierarchy-listener-l
      * @param oldl the hierarchy-listener being removed
+     * @return the resulting listener
      * @since 1.3
      */
     @SuppressWarnings("overloads")
@@ -870,6 +926,7 @@ public class AWTEventMulticaster implements
      * listener.
      * @param l hierarchy-bounds-listener-l
      * @param oldl the hierarchy-bounds-listener being removed
+     * @return the resulting listener
      * @since 1.3
      */
     public static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl) {
@@ -881,6 +938,7 @@ public class AWTEventMulticaster implements
      * and returns the resulting multicast listener.
      * @param l mouse-wheel-listener-l
      * @param oldl the mouse-wheel-listener being removed
+     * @return the resulting listener
      * @since 1.4
      */
     @SuppressWarnings("overloads")
@@ -898,6 +956,7 @@ public class AWTEventMulticaster implements
      * a new AWTEventMulticaster instance which chains a with b.
      * @param a event listener-a
      * @param b event listener-b
+     * @return the resulting listener
      */
     protected static EventListener addInternal(EventListener a, EventListener b) {
         if (a == null)  return b;
@@ -915,6 +974,7 @@ public class AWTEventMulticaster implements
      * Else, returns listener l.
      * @param l the listener being removed from
      * @param oldl the listener being removed
+     * @return the resulting listener
      */
     protected static EventListener removeInternal(EventListener l, EventListener oldl) {
         if (l == oldl || l == null) {
@@ -927,9 +987,14 @@ public class AWTEventMulticaster implements
     }
 
 
-    /* Serialization support.
-     */
-
+   /**
+    * Serialization support. Saves all Serializable listeners
+    * to a serialization stream.
+    *
+    * @param  s the stream to save to
+    * @param  k a prefix stream to put before each serializable listener
+    * @throws IOException if serialization fails
+    */
     protected void saveInternal(ObjectOutputStream s, String k) throws IOException {
         if (a instanceof AWTEventMulticaster) {
             ((AWTEventMulticaster)a).saveInternal(s, k);
@@ -948,6 +1013,14 @@ public class AWTEventMulticaster implements
         }
     }
 
+   /**
+    * Saves a Serializable listener chain to a serialization stream.
+    *
+    * @param  s the stream to save to
+    * @param  k a prefix stream to put before each serializable listener
+    * @param  l the listener chain to save
+    * @throws IOException if serialization fails
+    */
     protected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException {
       if (l == null) {
           return;
diff --git a/jdk/src/share/classes/java/awt/AWTKeyStroke.java b/jdk/src/share/classes/java/awt/AWTKeyStroke.java
index 4be729b8c89..681113a07db 100644
--- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java
+++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java
@@ -802,6 +802,7 @@ public class AWTKeyStroke implements Serializable {
      * <code>AWTKeyStroke</code>) which is equal to this instance.
      *
      * @return a cached instance which is equal to this instance
+     * @throws java.io.ObjectStreamException if a serialization problem occurs
      */
     protected Object readResolve() throws java.io.ObjectStreamException {
         synchronized (AWTKeyStroke.class) {
diff --git a/jdk/src/share/classes/java/awt/AlphaComposite.java b/jdk/src/share/classes/java/awt/AlphaComposite.java
index f08ea2b47bf..542d2884a01 100644
--- a/jdk/src/share/classes/java/awt/AlphaComposite.java
+++ b/jdk/src/share/classes/java/awt/AlphaComposite.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -621,7 +621,9 @@ public final class AlphaComposite implements Composite {
 
     /**
      * Creates an <code>AlphaComposite</code> object with the specified rule.
+     *
      * @param rule the compositing rule
+     * @return the {@code AlphaComposite} object created
      * @throws IllegalArgumentException if <code>rule</code> is not one of
      *         the following:  {@link #CLEAR}, {@link #SRC}, {@link #DST},
      *         {@link #SRC_OVER}, {@link #DST_OVER}, {@link #SRC_IN},
@@ -664,10 +666,12 @@ public final class AlphaComposite implements Composite {
      * the constant alpha to multiply with the alpha of the source.
      * The source is multiplied with the specified alpha before being composited
      * with the destination.
+     *
      * @param rule the compositing rule
      * @param alpha the constant alpha to be multiplied with the alpha of
      * the source. <code>alpha</code> must be a floating point number in the
      * inclusive range [0.0,&nbsp;1.0].
+     * @return the {@code AlphaComposite} object created
      * @throws IllegalArgumentException if
      *         <code>alpha</code> is less than 0.0 or greater than 1.0, or if
      *         <code>rule</code> is not one of
diff --git a/jdk/src/share/classes/java/awt/BorderLayout.java b/jdk/src/share/classes/java/awt/BorderLayout.java
index b2f7e25fe19..fd891bc371b 100644
--- a/jdk/src/share/classes/java/awt/BorderLayout.java
+++ b/jdk/src/share/classes/java/awt/BorderLayout.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -367,6 +367,8 @@ public class BorderLayout implements LayoutManager2,
 
     /**
      * Returns the horizontal gap between components.
+     *
+     * @return the horizontal gap between components
      * @since   1.1
      */
     public int getHgap() {
@@ -375,6 +377,7 @@ public class BorderLayout implements LayoutManager2,
 
     /**
      * Sets the horizontal gap between components.
+     *
      * @param hgap the horizontal gap between components
      * @since   1.1
      */
@@ -384,6 +387,8 @@ public class BorderLayout implements LayoutManager2,
 
     /**
      * Returns the vertical gap between components.
+     *
+     * @return the vertical gap between components
      * @since   1.1
      */
     public int getVgap() {
@@ -392,6 +397,7 @@ public class BorderLayout implements LayoutManager2,
 
     /**
      * Sets the vertical gap between components.
+     *
      * @param vgap the vertical gap between components
      * @since   1.1
      */
diff --git a/jdk/src/share/classes/java/awt/Button.java b/jdk/src/share/classes/java/awt/Button.java
index 08e569d446a..cc01947a9f1 100644
--- a/jdk/src/share/classes/java/awt/Button.java
+++ b/jdk/src/share/classes/java/awt/Button.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -238,6 +238,8 @@ public class Button extends Component implements Accessible {
      * Returns the command name of the action event fired by this button.
      * If the command name is <code>null</code> (default) then this method
      * returns the label of the button.
+     *
+     * @return the action command name (or label) for this button
      */
     public String getActionCommand() {
         return (actionCommand == null? label : actionCommand);
diff --git a/jdk/src/share/classes/java/awt/Checkbox.java b/jdk/src/share/classes/java/awt/Checkbox.java
index 8e8b5dd226a..021b2fcebaa 100644
--- a/jdk/src/share/classes/java/awt/Checkbox.java
+++ b/jdk/src/share/classes/java/awt/Checkbox.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -713,6 +713,9 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
          */
         private static final long serialVersionUID = 7881579233144754107L;
 
+        /**
+         * Constructor for {@code AccessibleAWTCheckbox}
+         */
         public AccessibleAWTCheckbox() {
             super();
             Checkbox.this.addItemListener(this);
diff --git a/jdk/src/share/classes/java/awt/CheckboxGroup.java b/jdk/src/share/classes/java/awt/CheckboxGroup.java
index a34c337b712..15e91c4d2a0 100644
--- a/jdk/src/share/classes/java/awt/CheckboxGroup.java
+++ b/jdk/src/share/classes/java/awt/CheckboxGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -91,6 +91,10 @@ public class CheckboxGroup implements java.io.Serializable {
     }
 
     /**
+     * Returns the current choice from this check box group
+     * or {@code null} if none of checkboxes are selected.
+     *
+     * @return the selected checkbox
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getSelectedCheckbox()</code>.
      */
@@ -120,6 +124,11 @@ public class CheckboxGroup implements java.io.Serializable {
     }
 
     /**
+     * Sets the currently selected check box in this group
+     * to be the specified check box and unsets all others.
+     *
+     * @param  box the {@code Checkbox} to set as the
+     *         current selection.
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setSelectedCheckbox(Checkbox)</code>.
      */
diff --git a/jdk/src/share/classes/java/awt/Choice.java b/jdk/src/share/classes/java/awt/Choice.java
index 1d79dc71831..a6f20718321 100644
--- a/jdk/src/share/classes/java/awt/Choice.java
+++ b/jdk/src/share/classes/java/awt/Choice.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -156,6 +156,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
 
     /**
      * Returns the number of items in this <code>Choice</code> menu.
+     *
      * @return the number of items in this <code>Choice</code> menu
      * @see     #getItem
      * @since   1.1
@@ -165,6 +166,9 @@ public class Choice extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Returns the number of items in this {@code Choice} menu.
+     *
+     * @return the number of items in this {@code Choice} menu
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getItemCount()</code>.
      */
@@ -176,8 +180,10 @@ public class Choice extends Component implements ItemSelectable, Accessible {
     /**
      * Gets the string at the specified index in this
      * <code>Choice</code> menu.
-     * @param      index the index at which to begin
-     * @see        #getItemCount
+     *
+     * @param  index the index at which to begin
+     * @return the item at the specified index
+     * @see    #getItemCount
      */
     public String getItem(int index) {
         return getItemImpl(index);
@@ -759,6 +765,9 @@ public class Choice extends Component implements ItemSelectable, Accessible {
          */
         private static final long serialVersionUID = 7175603582428509322L;
 
+        /**
+         * Constructor for {@code AccessibleAWTChoice}
+         */
         public AccessibleAWTChoice() {
             super();
         }
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index 8e328a5e586..b062cc718b7 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -1075,6 +1075,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * @deprecated As of JDK version 1.1,
      * programs should not directly manipulate peers;
      * replaced by <code>boolean isDisplayable()</code>.
+     * @return the peer for this component
      */
     @Deprecated
     public ComponentPeer getPeer() {
@@ -1132,6 +1133,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
     /**
      * Gets the <code>DropTarget</code> associated with this
      * <code>Component</code>.
+     *
+     * @return the drop target
      */
 
     public synchronized DropTarget getDropTarget() { return dropTarget; }
@@ -1498,6 +1501,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Enables or disables this component.
+     *
+     * @param  b {@code true} to enable this component;
+     *         otherwise {@code false}
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setEnabled(boolean)</code>.
      */
@@ -1656,6 +1664,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Makes this component visible or invisible.
+     *
+     * @param  b {@code true} to make this component visible;
+     *         otherwise {@code false}
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setVisible(boolean)</code>.
      */
@@ -2068,6 +2081,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
 
 
     /**
+     * Returns the location of this component's top left corner.
+     *
+     * @return the location of this component's top left corner
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getLocation()</code>.
      */
@@ -2102,6 +2118,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Moves this component to a new location.
+     *
+     * @param  x the <i>x</i>-coordinate of the new location's
+     *           top-left corner in the parent's coordinate space
+     * @param  y the <i>y</i>-coordinate of the new location's
+     *           top-left corner in the parent's coordinate space
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setLocation(int, int)</code>.
      */
@@ -2150,6 +2173,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Returns the size of this component in the form of a
+     * {@code Dimension} object.
+     *
+     * @return the {@code Dimension} object that indicates the
+     *         size of this component
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getSize()</code>.
      */
@@ -2177,6 +2205,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Resizes this component.
+     *
+     * @param  width the new width of the component
+     * @param  height the new height of the component
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setSize(int, int)</code>.
      */
@@ -2208,6 +2240,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Resizes this component so that it has width {@code d.width}
+     * and height {@code d.height}.
+     *
+     * @param  d the new size of this component
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setSize(Dimension)</code>.
      */
@@ -2231,6 +2267,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Returns the bounding rectangle of this component.
+     *
+     * @return the bounding rectangle for this component
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getBounds()</code>.
      */
@@ -2265,6 +2304,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Reshapes the bounding rectangle for this component.
+     *
+     * @param  x the <i>x</i> coordinate of the upper left corner of the rectangle
+     * @param  y the <i>y</i> coordinate of the upper left corner of the rectangle
+     * @param  width the width of the rectangle
+     * @param  height the height of the rectangle
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setBounds(int, int, int, int)</code>.
      */
@@ -2631,6 +2677,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
 
 
     /**
+     * Returns the component's preferred size.
+     *
+     * @return the component's preferred size
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getPreferredSize()</code>.
      */
@@ -2701,6 +2750,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Returns the minimum size of this component.
+     *
+     * @return the minimum size of this component
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getMinimumSize()</code>.
      */
@@ -2781,6 +2833,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * components.  The value should be a number between 0 and 1
      * where 0 represents alignment along the origin, 1 is aligned
      * the furthest away from the origin, 0.5 is centered, etc.
+     *
+     * @return the horizontal alignment of this component
      */
     public float getAlignmentX() {
         return CENTER_ALIGNMENT;
@@ -2792,6 +2846,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * components.  The value should be a number between 0 and 1
      * where 0 represents alignment along the origin, 1 is aligned
      * the furthest away from the origin, 0.5 is centered, etc.
+     *
+     * @return the vertical alignment of this component
      */
     public float getAlignmentY() {
         return CENTER_ALIGNMENT;
@@ -3157,8 +3213,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * not have a cursor set, the cursor of its parent is returned.
      * If no cursor is set in the entire hierarchy,
      * <code>Cursor.DEFAULT_CURSOR</code> is returned.
+     *
+     * @return the cursor for this component
      * @see #setCursor
-     * @since      1.1
+     * @since 1.1
      */
     public Cursor getCursor() {
         return getCursor_NoClientCode();
@@ -3942,6 +4000,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
          * a lost state.
          */
         protected boolean validatedContents; // = false
+
         /**
          * Size of the back buffers.  (Note: these fields were added in 6.0
          * but kept package-private to avoid exposing them in the spec.
@@ -3949,7 +4008,15 @@ public abstract class Component implements ImageObserver, MenuContainer,
          * protected when they were introduced in 1.4, but now we just have
          * to live with that decision.)
          */
+
+         /**
+          * The width of the back buffers
+          */
         int width;
+
+        /**
+         * The height of the back buffers
+         */
         int height;
 
         /**
@@ -4304,6 +4371,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
 
         /**
          * Creates the back buffers
+         *
+         * @param numBuffers the number of buffers to create
          */
         protected void createBackBuffers(int numBuffers) {
             if (numBuffers == 0) {
@@ -4593,6 +4662,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * better performance is desired, or if page-flipping is used as the
      * buffer strategy.
      *
+     * @param ignoreRepaint {@code true} if the paint messages from the OS
+     *                      should be ignored; otherwise {@code false}
+     *
      * @since 1.4
      * @see #getIgnoreRepaint
      * @see Canvas#createBufferStrategy
@@ -4619,8 +4691,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * Checks whether this component "contains" the specified point,
      * where <code>x</code> and <code>y</code> are defined to be
      * relative to the coordinate system of this component.
+     *
      * @param     x   the <i>x</i> coordinate of the point
      * @param     y   the <i>y</i> coordinate of the point
+     * @return {@code true} if the point is within the component;
+     *         otherwise {@code false}
      * @see       #getComponentAt(int, int)
      * @since     1.1
      */
@@ -4629,6 +4704,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Checks whether the point is inside of this component.
+     *
+     * @param  x the <i>x</i> coordinate of the point
+     * @param  y the <i>y</i> coordinate of the point
+     * @return {@code true} if the point is within the component;
+     *         otherwise {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by contains(int, int).
      */
@@ -4641,7 +4722,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * Checks whether this component "contains" the specified point,
      * where the point's <i>x</i> and <i>y</i> coordinates are defined
      * to be relative to the coordinate system of this component.
+     *
      * @param     p     the point
+     * @return {@code true} if the point is within the component;
+     *         otherwise {@code false}
      * @throws    NullPointerException if {@code p} is {@code null}
      * @see       #getComponentAt(Point)
      * @since     1.1
@@ -4676,6 +4760,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * Returns the component occupying the position specified (this component,
+     * or immediate child component, or null if neither
+     * of the first two occupies the location).
+     *
+     * @param  x the <i>x</i> coordinate to search for components at
+     * @param  y the <i>y</i> coordinate to search for components at
+     * @return the component at the specified location or {@code null}
      * @deprecated As of JDK version 1.1,
      * replaced by getComponentAt(int, int).
      */
@@ -4687,15 +4778,17 @@ public abstract class Component implements ImageObserver, MenuContainer,
     /**
      * Returns the component or subcomponent that contains the
      * specified point.
-     * @param     p   the point
-     * @see       java.awt.Component#contains
-     * @since     1.1
+     * @param  p the point
+     * @return the component at the specified location or {@code null}
+     * @see java.awt.Component#contains
+     * @since 1.1
      */
     public Component getComponentAt(Point p) {
         return getComponentAt(p.x, p.y);
     }
 
     /**
+     * @param  e the event to deliver
      * @deprecated As of JDK version 1.1,
      * replaced by <code>dispatchEvent(AWTEvent e)</code>.
      */
@@ -6746,6 +6839,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @return {@code true} if the event was handled, {@code false} otherwise
      * @deprecated As of JDK version 1.1
      * replaced by processEvent(AWTEvent).
      */
@@ -6789,6 +6884,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  x the x coordinate
+     * @param  y the y coordinate
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processMouseEvent(MouseEvent).
      */
@@ -6798,6 +6897,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  x the x coordinate
+     * @param  y the y coordinate
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processMouseMotionEvent(MouseEvent).
      */
@@ -6807,6 +6910,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  x the x coordinate
+     * @param  y the y coordinate
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processMouseEvent(MouseEvent).
      */
@@ -6816,6 +6923,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  x the x coordinate
+     * @param  y the y coordinate
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processMouseMotionEvent(MouseEvent).
      */
@@ -6825,6 +6936,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  x the x coordinate
+     * @param  y the y coordinate
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processMouseEvent(MouseEvent).
      */
@@ -6834,6 +6949,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  x the x coordinate
+     * @param  y the y coordinate
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processMouseEvent(MouseEvent).
      */
@@ -6843,6 +6962,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  key the key pressed
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processKeyEvent(KeyEvent).
      */
@@ -6852,6 +6974,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  key the key pressed
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processKeyEvent(KeyEvent).
      */
@@ -6861,6 +6986,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  what the object acted on
+     * @return {@code false}
      * @deprecated As of JDK version 1.1,
      * should register this component as ActionListener on component
      * which fires action events.
@@ -7070,6 +7198,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param  evt the event to handle
+     * @param  what the object focused
+     * @return  {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processFocusEvent(FocusEvent).
      */
@@ -7079,6 +7210,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
     }
 
     /**
+     * @param evt  the event to handle
+     * @param what the object focused
+     * @return  {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by processFocusEvent(FocusEvent).
      */
@@ -8390,6 +8524,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * Returns an array of all the listeners which have been associated
      * with the named property.
      *
+     * @param  propertyName the property name
      * @return all of the <code>PropertyChangeListener</code>s associated with
      *         the named property; if no such listeners have been added or
      *         if <code>propertyName</code> is <code>null</code>, an empty
@@ -8400,8 +8535,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * @see #getPropertyChangeListeners
      * @since 1.4
      */
-    public PropertyChangeListener[] getPropertyChangeListeners(
-                                                                            String propertyName) {
+    public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
         synchronized (getObjectLock()) {
             if (changeSupport == null) {
                 return new PropertyChangeListener[0];
@@ -8879,6 +9013,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * This method changes layout-related information, and therefore,
      * invalidates the component hierarchy.
      *
+     * @param  o the orientation to be set
      *
      * @see ComponentOrientation
      * @see #invalidate
@@ -8906,6 +9041,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
      * subclasses that wish to respect orientation should call this method to
      * get the component's orientation before performing layout or drawing.
      *
+     * @return the orientation to order the elements or text
      * @see ComponentOrientation
      *
      * @author Laura Werner, IBM
@@ -9063,7 +9199,16 @@ public abstract class Component implements ImageObserver, MenuContainer,
          */
         private volatile transient int propertyListenersCount = 0;
 
+        /**
+         * A component listener to track show/hide/resize events
+         * and convert them to PropertyChange events.
+         */
         protected ComponentListener accessibleAWTComponentHandler = null;
+
+        /**
+         * A listener to track focus events
+         * and convert them to PropertyChange events.
+         */
         protected FocusListener accessibleAWTFocusHandler = null;
 
         /**
diff --git a/jdk/src/share/classes/java/awt/ComponentOrientation.java b/jdk/src/share/classes/java/awt/ComponentOrientation.java
index 8655aafa322..226b004a273 100644
--- a/jdk/src/share/classes/java/awt/ComponentOrientation.java
+++ b/jdk/src/share/classes/java/awt/ComponentOrientation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -126,6 +126,8 @@ public final class ComponentOrientation implements java.io.Serializable
      * Are lines horizontal?
      * This will return true for horizontal, left-to-right writing
      * systems such as Roman.
+     *
+     * @return {@code true} if this orientation has horizontal lines
      */
     public boolean isHorizontal() {
         return (orientation & HORIZ_BIT) != 0;
@@ -136,6 +138,8 @@ public final class ComponentOrientation implements java.io.Serializable
      * Vertical Lines:  Do lines run left-to-right?<br>
      * This will return true for horizontal, left-to-right writing
      * systems such as Roman.
+     *
+     * @return {@code true} if this orientation is left-to-right
      */
     public boolean isLeftToRight() {
         return (orientation & LTR_BIT) != 0;
@@ -143,7 +147,9 @@ public final class ComponentOrientation implements java.io.Serializable
 
     /**
      * Returns the orientation that is appropriate for the given locale.
+     *
      * @param locale the specified locale
+     * @return the orientation for the locale
      */
     public static ComponentOrientation getOrientation(Locale locale) {
         // A more flexible implementation would consult a ResourceBundle
@@ -171,6 +177,8 @@ public final class ComponentOrientation implements java.io.Serializable
      * <li>Return the default locale's orientation.
      * </ol>
      *
+     * @param  bdl the bundle to use
+     * @return the orientation
      * @deprecated As of J2SE 1.4, use {@link #getOrientation(java.util.Locale)}.
      */
     @Deprecated
diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java
index a352bab43ef..95997f4f900 100644
--- a/jdk/src/share/classes/java/awt/Container.java
+++ b/jdk/src/share/classes/java/awt/Container.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -310,6 +310,9 @@ public class Container extends Component {
     }
 
     /**
+     * Returns the number of components in this container.
+     *
+     * @return the number of components in this container
      * @deprecated As of JDK version 1.1,
      * replaced by getComponentCount().
      */
@@ -391,8 +394,11 @@ public class Container extends Component {
     }
 
     /**
+     * Returns the insets for this container.
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getInsets()</code>.
+     * @return the insets for this container
      */
     @Deprecated
     public Insets insets() {
@@ -438,6 +444,9 @@ public class Container extends Component {
      * displayed, the hierarchy must be validated thereafter in order to
      * display the added component.
      *
+     * @param  name the name of the component to be added
+     * @param  comp the component to be added
+     * @return the component added
      * @exception NullPointerException if {@code comp} is {@code null}
      * @see #add(Component, Object)
      * @see #invalidate
@@ -1471,8 +1480,10 @@ public class Container extends Component {
 
     /**
      * Gets the layout manager for this container.
+     *
      * @see #doLayout
      * @see #setLayout
+     * @return the current layout manager for this container
      */
     public LayoutManager getLayout() {
         return layoutMgr;
@@ -3854,6 +3865,10 @@ public class Container extends Component {
          */
         private volatile transient int propertyListenersCount = 0;
 
+        /**
+         * The handler to fire {@code PropertyChange}
+         * when children are added or removed
+         */
         protected ContainerListener accessibleContainerHandler = null;
 
         /**
diff --git a/jdk/src/share/classes/java/awt/Cursor.java b/jdk/src/share/classes/java/awt/Cursor.java
index 794c7c9b242..1468e162134 100644
--- a/jdk/src/share/classes/java/awt/Cursor.java
+++ b/jdk/src/share/classes/java/awt/Cursor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -294,6 +294,7 @@ public class Cursor implements java.io.Serializable {
      * @return the system specific custom cursor named
      * @exception HeadlessException if
      * <code>GraphicsEnvironment.isHeadless</code> returns true
+     * @exception AWTException in case of erroneous retrieving of the cursor
      */
     static public Cursor getSystemCustomCursor(final String name)
         throws AWTException, HeadlessException {
@@ -378,6 +379,8 @@ public class Cursor implements java.io.Serializable {
 
     /**
      * Return the system default cursor.
+     *
+     * @return the default cursor
      */
     static public Cursor getDefaultCursor() {
         return getPredefinedCursor(Cursor.DEFAULT_CURSOR);
@@ -416,6 +419,8 @@ public class Cursor implements java.io.Serializable {
 
     /**
      * Returns the type for this cursor.
+     *
+     * @return the cursor type
      */
     public int getType() {
         return type;
diff --git a/jdk/src/share/classes/java/awt/DisplayMode.java b/jdk/src/share/classes/java/awt/DisplayMode.java
index 71a5d7e8122..41564300615 100644
--- a/jdk/src/share/classes/java/awt/DisplayMode.java
+++ b/jdk/src/share/classes/java/awt/DisplayMode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -125,6 +125,8 @@ public final class DisplayMode {
 
     /**
      * Returns whether the two display modes are equal.
+     *
+     * @param  dm the display mode to compare to
      * @return whether the two display modes are equal
      */
     public boolean equals(DisplayMode dm) {
diff --git a/jdk/src/share/classes/java/awt/EventQueue.java b/jdk/src/share/classes/java/awt/EventQueue.java
index 87bbace3ac8..a89311352ab 100644
--- a/jdk/src/share/classes/java/awt/EventQueue.java
+++ b/jdk/src/share/classes/java/awt/EventQueue.java
@@ -222,6 +222,9 @@ public class EventQueue {
             });
     }
 
+    /**
+     * Initializes a new instance of {@code EventQueue}.
+     */
     public EventQueue() {
         for (int i = 0; i < NUM_PRIORITIES; i++) {
             queues[i] = new Queue();
diff --git a/jdk/src/share/classes/java/awt/Frame.java b/jdk/src/share/classes/java/awt/Frame.java
index df3fcda4773..c6ce4814078 100644
--- a/jdk/src/share/classes/java/awt/Frame.java
+++ b/jdk/src/share/classes/java/awt/Frame.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -1089,6 +1089,9 @@ public class Frame extends Window implements MenuContainer {
     }
 
     /**
+     * Sets the cursor for this frame to the specified type.
+     *
+     * @param  cursorType the cursor type
      * @deprecated As of JDK version 1.1,
      * replaced by <code>Component.setCursor(Cursor)</code>.
      */
@@ -1103,6 +1106,7 @@ public class Frame extends Window implements MenuContainer {
     /**
      * @deprecated As of JDK version 1.1,
      * replaced by <code>Component.getCursor()</code>.
+     * @return the cursor type for this frame
      */
     @Deprecated
     public int getCursorType() {
@@ -1124,6 +1128,8 @@ public class Frame extends Window implements MenuContainer {
      * ownerless {@code Dialog}s (introduced in release 1.6), use {@link
      * Window#getOwnerlessWindows Window.getOwnerlessWindows}.
      *
+     * @return the array of all {@code Frame}s created by this application
+     *
      * @see Window#getWindows()
      * @see Window#getOwnerlessWindows
      *
diff --git a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java
index e9e9080dba6..2d6436cc00d 100644
--- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java
+++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java
@@ -357,6 +357,8 @@ public abstract class GraphicsEnvironment {
      * <p>Notice that an application can supersede the registration
      * of an earlier created font with a new one.
      * </ul>
+     *
+     * @param  font the font to be registered
      * @return true if the <code>font</code> is successfully
      * registered in this <code>GraphicsEnvironment</code>.
      * @throws NullPointerException if <code>font</code> is null
diff --git a/jdk/src/share/classes/java/awt/GridBagLayout.java b/jdk/src/share/classes/java/awt/GridBagLayout.java
index 0b2c32ba2b5..981c993751a 100644
--- a/jdk/src/share/classes/java/awt/GridBagLayout.java
+++ b/jdk/src/share/classes/java/awt/GridBagLayout.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -981,9 +981,15 @@ java.io.Serializable {
      * This method is obsolete and supplied for backwards
      * compatibility only; new code should call {@link
      * #getLayoutInfo(java.awt.Container, int) getLayoutInfo} instead.
-     * This method is the same as <code>getLayoutInfo</code>;
-     * refer to <code>getLayoutInfo</code> for details on parameters
-     * and return value.
+     *
+     * Fills in an instance of {@code GridBagLayoutInfo} for the
+     * current set of managed children. This method is the same
+     * as {@code getLayoutInfo}; refer to {@code getLayoutInfo}
+     * description for details.
+     *
+     * @param  parent the layout container
+     * @param  sizeflag either {@code PREFERREDSIZE} or {@code MINSIZE}
+     * @return the {@code GridBagLayoutInfo} for the set of children
      */
     protected GridBagLayoutInfo GetLayoutInfo(Container parent, int sizeflag) {
         synchronized (parent.getTreeLock()) {
@@ -1611,13 +1617,17 @@ java.io.Serializable {
     }
 
     /**
+     * Adjusts the x, y, width, and height fields to the correct
+     * values depending on the constraint geometry and pads.
+     * <p>
      * This method is obsolete and supplied for backwards
      * compatibility only; new code should call {@link
      * #adjustForGravity(java.awt.GridBagConstraints, java.awt.Rectangle)
      * adjustForGravity} instead.
-     * This method is the same as <code>adjustForGravity</code>;
-     * refer to <code>adjustForGravity</code> for details
-     * on parameters.
+     * This method is the same as <code>adjustForGravity</code>
+     *
+     * @param  constraints the constraints to be applied
+     * @param  r the {@code Rectangle} to be adjusted
      */
     protected void AdjustForGravity(GridBagConstraints constraints,
                                     Rectangle r) {
@@ -1995,9 +2005,12 @@ java.io.Serializable {
      * This method is obsolete and supplied for backwards
      * compatibility only; new code should call {@link
      * #getMinSize(java.awt.Container, GridBagLayoutInfo) getMinSize} instead.
-     * This method is the same as <code>getMinSize</code>;
-     * refer to <code>getMinSize</code> for details on parameters
-     * and return value.
+     * This method is the same as <code>getMinSize</code>
+     *
+     * @param  parent the layout container
+     * @param  info the layout info for this parent
+     * @return a <code>Dimension</code> object containing the
+     *         minimum size
      */
     protected Dimension GetMinSize(Container parent, GridBagLayoutInfo info) {
         Dimension d = new Dimension();
@@ -2035,9 +2048,9 @@ java.io.Serializable {
      * This method is obsolete and supplied for backwards
      * compatibility only; new code should call {@link
      * #arrangeGrid(Container) arrangeGrid} instead.
-     * This method is the same as <code>arrangeGrid</code>;
-     * refer to <code>arrangeGrid</code> for details on the
-     * parameter.
+     * This method is the same as <code>arrangeGrid</code>
+     *
+     * @param  parent the layout container
      */
     protected void ArrangeGrid(Container parent) {
         Component comp;
diff --git a/jdk/src/share/classes/java/awt/HeadlessException.java b/jdk/src/share/classes/java/awt/HeadlessException.java
index db53a351c6d..5809ffd9faf 100644
--- a/jdk/src/share/classes/java/awt/HeadlessException.java
+++ b/jdk/src/share/classes/java/awt/HeadlessException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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,10 +38,24 @@ public class HeadlessException extends UnsupportedOperationException {
      * JDK 1.4 serialVersionUID
      */
     private static final long serialVersionUID = 167183644944358563L;
+
+    /**
+     * Constructs new {@code HeadlessException}
+     */
     public HeadlessException() {}
+
+    /**
+     * Create a new instance with the specified detailed error message.
+     *
+     * @param  msg the error message
+     */
     public HeadlessException(String msg) {
         super(msg);
     }
+
+    /**
+     * {@inheritDoc}
+     */
     public String getMessage() {
         String superMessage = super.getMessage();
         String headlessMessage = GraphicsEnvironment.getHeadlessMessage();
diff --git a/jdk/src/share/classes/java/awt/ItemSelectable.java b/jdk/src/share/classes/java/awt/ItemSelectable.java
index d19afb3ab0d..e11b70ef48f 100644
--- a/jdk/src/share/classes/java/awt/ItemSelectable.java
+++ b/jdk/src/share/classes/java/awt/ItemSelectable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -39,6 +39,8 @@ public interface ItemSelectable {
     /**
      * Returns the selected items or <code>null</code> if no
      * items are selected.
+     *
+     * @return the list of selected objects, or {@code null}
      */
     public Object[] getSelectedObjects();
 
diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
index 8758a2b50e3..57a8f733ce7 100644
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
@@ -1459,6 +1459,7 @@ public abstract class KeyboardFocusManager
      * Returns an array of all the <code>PropertyChangeListener</code>s
      * associated with the named property.
      *
+     * @param  propertyName the property name
      * @return all of the <code>PropertyChangeListener</code>s associated with
      *         the named property or an empty array if no such listeners have
      *         been added.
@@ -1628,6 +1629,7 @@ public abstract class KeyboardFocusManager
      * Returns an array of all the <code>VetoableChangeListener</code>s
      * associated with the named property.
      *
+     * @param  propertyName the property name
      * @return all of the <code>VetoableChangeListener</code>s associated with
      *         the named property or an empty array if no such listeners have
      *         been added.
diff --git a/jdk/src/share/classes/java/awt/Label.java b/jdk/src/share/classes/java/awt/Label.java
index 20ccdcd4c86..c8aab9569ff 100644
--- a/jdk/src/share/classes/java/awt/Label.java
+++ b/jdk/src/share/classes/java/awt/Label.java
@@ -193,7 +193,8 @@ public class Label extends Component implements Accessible {
      * Gets the current alignment of this label. Possible values are
      * <code>Label.LEFT</code>, <code>Label.RIGHT</code>, and
      * <code>Label.CENTER</code>.
-     * @see        java.awt.Label#setAlignment
+     * @return the alignment of this label
+     * @see java.awt.Label#setAlignment
      */
     public int getAlignment() {
         return alignment;
@@ -321,6 +322,9 @@ public class Label extends Component implements Accessible {
          */
         private static final long serialVersionUID = -3568967560160480438L;
 
+        /**
+         * Constructor for the accessible label.
+         */
         public AccessibleAWTLabel() {
             super();
         }
diff --git a/jdk/src/share/classes/java/awt/LayoutManager.java b/jdk/src/share/classes/java/awt/LayoutManager.java
index 5a00db263e6..d7abfbb1c29 100644
--- a/jdk/src/share/classes/java/awt/LayoutManager.java
+++ b/jdk/src/share/classes/java/awt/LayoutManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -61,7 +61,9 @@ public interface LayoutManager {
     /**
      * Calculates the preferred size dimensions for the specified
      * container, given the components it contains.
-     * @param parent the container to be laid out
+     *
+     * @param  parent the container to be laid out
+     * @return the preferred dimension for the container
      *
      * @see #minimumLayoutSize
      */
@@ -70,7 +72,10 @@ public interface LayoutManager {
     /**
      * Calculates the minimum size dimensions for the specified
      * container, given the components it contains.
-     * @param parent the component to be laid out
+     *
+     * @param  parent the component to be laid out
+     * @return the minimum dimension for the container
+     *
      * @see #preferredLayoutSize
      */
     Dimension minimumLayoutSize(Container parent);
diff --git a/jdk/src/share/classes/java/awt/LayoutManager2.java b/jdk/src/share/classes/java/awt/LayoutManager2.java
index ae6516e17b8..347295052e4 100644
--- a/jdk/src/share/classes/java/awt/LayoutManager2.java
+++ b/jdk/src/share/classes/java/awt/LayoutManager2.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -55,8 +55,11 @@ public interface LayoutManager2 extends LayoutManager {
     /**
      * Calculates the maximum size dimensions for the specified container,
      * given the components it contains.
+     *
      * @see java.awt.Component#getMaximumSize
      * @see LayoutManager
+     * @param  target the target container
+     * @return the maximum size of the container
      */
     public Dimension maximumLayoutSize(Container target);
 
@@ -66,6 +69,9 @@ public interface LayoutManager2 extends LayoutManager {
      * components.  The value should be a number between 0 and 1
      * where 0 represents alignment along the origin, 1 is aligned
      * the furthest away from the origin, 0.5 is centered, etc.
+     *
+     * @param  target the target container
+     * @return the x-axis alignment preference
      */
     public float getLayoutAlignmentX(Container target);
 
@@ -75,12 +81,16 @@ public interface LayoutManager2 extends LayoutManager {
      * components.  The value should be a number between 0 and 1
      * where 0 represents alignment along the origin, 1 is aligned
      * the furthest away from the origin, 0.5 is centered, etc.
+     *
+     * @param  target the target container
+     * @return the y-axis alignment preference
      */
     public float getLayoutAlignmentY(Container target);
 
     /**
      * Invalidates the layout, indicating that if the layout manager
      * has cached information it should be discarded.
+     * @param  target the target container
      */
     public void invalidateLayout(Container target);
 
diff --git a/jdk/src/share/classes/java/awt/List.java b/jdk/src/share/classes/java/awt/List.java
index df638c26724..ede6f643157 100644
--- a/jdk/src/share/classes/java/awt/List.java
+++ b/jdk/src/share/classes/java/awt/List.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -282,6 +282,9 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Returns the number of items in the list.
+     *
+     * @return the number of items in the list
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getItemCount()</code>.
      */
@@ -333,7 +336,10 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
-     * @deprecated      replaced by <code>add(String)</code>.
+     * Adds the specified item to the end of the list.
+     *
+     * @param  item the item to be added
+     * @deprecated replaced by <code>add(String)</code>.
      */
     @Deprecated
     public void addItem(String item) {
@@ -358,7 +364,12 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
-     * @deprecated      replaced by <code>add(String, int)</code>.
+     * Adds the specified item to the the list
+     * at the position indicated by the index.
+     *
+     * @param  item the item to be added
+     * @param  index the position at which to add the item
+     * @deprecated replaced by <code>add(String, int)</code>.
      */
     @Deprecated
     public synchronized void addItem(String item, int index) {
@@ -455,8 +466,11 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
-     * @deprecated     replaced by <code>remove(String)</code>
-     *                         and <code>remove(int)</code>.
+     * Removes the item at the specified position.
+     *
+     * @param  position the index of the item to delete
+     * @deprecated replaced by <code>remove(String)</code>
+     *             and <code>remove(int)</code>.
      */
     @Deprecated
     public void delItem(int position) {
@@ -646,6 +660,10 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Determines if the specified item in the list is selected.
+     *
+     * @param  index specifies the item to be checked
+     * @return {@code true} if the item is selected; otherwise {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by <code>isIndexSelected(int)</code>.
      */
@@ -672,6 +690,7 @@ public class List extends Component implements ItemSelectable, Accessible {
 
     /**
      * Determines whether this list allows multiple selections.
+     *
      * @return     <code>true</code> if this list allows multiple
      *                 selections; otherwise, <code>false</code>
      * @see        #setMultipleMode
@@ -682,6 +701,10 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Determines whether this list allows multiple selections.
+     *
+     * @return {@code true} if this list allows multiple
+     *         selections; otherwise {@code false}
      * @deprecated As of JDK version 1.1,
      * replaced by <code>isMultipleMode()</code>.
      */
@@ -709,6 +732,9 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Enables or disables multiple selection mode for this list.
+     *
+     * @param  b {@code true} to enable multiple mode, {@code false} otherwise
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setMultipleMode(boolean)</code>.
      */
@@ -760,6 +786,11 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Returns the preferred size of this component
+     * assuming it has the specified number of rows.
+     *
+     * @param  rows the number of rows
+     * @return the preferred dimensions for displaying this list
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getPreferredSize(int)</code>.
      */
@@ -810,6 +841,11 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Returns the minimum dimensions for the list
+     * with the specified number of rows.
+     *
+     * @param  rows the number of rows in the list
+     * @return the minimum dimensions for displaying this list
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getMinimumSize(int)</code>.
      */
@@ -1146,6 +1182,10 @@ public class List extends Component implements ItemSelectable, Accessible {
     }
 
     /**
+     * Deletes the list items in the specified index range.
+     *
+     * @param  start the beginning index of the range to delete
+     * @param  end the ending index of the range to delete
      * @deprecated As of JDK version 1.1,
      * Not for public use in the future.
      * This method is expected to be retained only as a package
@@ -1290,6 +1330,9 @@ public class List extends Component implements ItemSelectable, Accessible {
          */
         private static final long serialVersionUID = 7924617370136012829L;
 
+        /**
+         * Constructs new {@code AccessibleAWTList}
+         */
         public AccessibleAWTList() {
             super();
             List.this.addActionListener(this);
@@ -1491,6 +1534,13 @@ public class List extends Component implements ItemSelectable, Accessible {
             private List parent;
             private int  indexInParent;
 
+            /**
+             * Constructs new {@code AccessibleAWTListChild} with the given
+             * parent {@code List} and 0-based index of this object in the parent.
+             *
+             * @param  parent the parent {@code List}
+             * @param  indexInParent the index in the parent
+             */
             public AccessibleAWTListChild(List parent, int indexInParent)  {
                 this.parent = parent;
                 this.setAccessibleParent(parent);
diff --git a/jdk/src/share/classes/java/awt/MediaTracker.java b/jdk/src/share/classes/java/awt/MediaTracker.java
index b8df6320cfa..dd8f9e0825f 100644
--- a/jdk/src/share/classes/java/awt/MediaTracker.java
+++ b/jdk/src/share/classes/java/awt/MediaTracker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -643,9 +643,11 @@ public class MediaTracker implements java.io.Serializable {
      * image is considered to have finished loading. Use the
      * <code>statusID</code>, <code>isErrorID</code>, and
      * <code>isErrorAny</code> methods to check for errors.
-     * @param         id   the identifier of the images to check
-     * @param         ms   the length of time, in milliseconds, to wait
-     *                           for the loading to complete
+     * @param  id the identifier of the images to check
+     * @param  ms the length of time, in milliseconds, to wait
+     *         for the loading to complete
+     * @return {@code true} if the loading completed in time;
+     *         otherwise {@code false}
      * @see           java.awt.MediaTracker#waitForAll
      * @see           java.awt.MediaTracker#waitForID(int)
      * @see           java.awt.MediaTracker#statusID
diff --git a/jdk/src/share/classes/java/awt/Menu.java b/jdk/src/share/classes/java/awt/Menu.java
index 177f208be05..3c8154338ac 100644
--- a/jdk/src/share/classes/java/awt/Menu.java
+++ b/jdk/src/share/classes/java/awt/Menu.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -213,7 +213,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
 
     /**
       * Get the number of items in this menu.
-      * @return     the number of items in this menu.
+      * @return the number of items in this menu
       * @since      1.1
       */
     public int getItemCount() {
@@ -221,6 +221,9 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
     }
 
     /**
+     * Returns the number of items in this menu.
+     *
+     * @return the number of items in this menu
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getItemCount()</code>.
      */
diff --git a/jdk/src/share/classes/java/awt/MenuBar.java b/jdk/src/share/classes/java/awt/MenuBar.java
index 4e48c7c38ce..4fa4723c417 100644
--- a/jdk/src/share/classes/java/awt/MenuBar.java
+++ b/jdk/src/share/classes/java/awt/MenuBar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -279,6 +279,9 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
     }
 
     /**
+     * Gets the number of menus on the menu bar.
+     *
+     * @return the number of menus on the menu bar.
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getMenuCount()</code>.
      */
@@ -338,10 +341,11 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
      * or <code>null</code> if none of the menu items being managed
      * by this menu bar is associated with the specified menu
      * shortcut.
-     * @param        s the specified menu shortcut.
-     * @see          java.awt.MenuItem
-     * @see          java.awt.MenuShortcut
-     * @since        1.1
+     * @param  s the specified menu shortcut.
+     * @return the menu item for the specified shortcut.
+     * @see java.awt.MenuItem
+     * @see java.awt.MenuShortcut
+     * @since 1.1
      */
      public MenuItem getShortcutMenuItem(MenuShortcut s) {
         int nmenus = getMenuCount();
diff --git a/jdk/src/share/classes/java/awt/MenuComponent.java b/jdk/src/share/classes/java/awt/MenuComponent.java
index 28fb9ab209e..4ea95bf5969 100644
--- a/jdk/src/share/classes/java/awt/MenuComponent.java
+++ b/jdk/src/share/classes/java/awt/MenuComponent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -220,6 +220,7 @@ public abstract class MenuComponent implements java.io.Serializable {
     /**
      * @deprecated As of JDK version 1.1,
      * programs should not directly manipulate peers.
+     * @return the peer for this component
      */
     @Deprecated
     public MenuComponentPeer getPeer() {
diff --git a/jdk/src/share/classes/java/awt/MenuContainer.java b/jdk/src/share/classes/java/awt/MenuContainer.java
index 8b43f992f4f..8ba5e70245b 100644
--- a/jdk/src/share/classes/java/awt/MenuContainer.java
+++ b/jdk/src/share/classes/java/awt/MenuContainer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -31,10 +31,25 @@ package java.awt;
  */
 
 public interface MenuContainer {
+
+    /**
+     * Returns the font in use by this container.
+     *
+     * @return the menu font
+     */
     Font getFont();
+
+    /**
+     * Removes the specified menu component from the menu.
+     *
+     * @param  comp the menu component to remove
+     */
     void remove(MenuComponent comp);
 
     /**
+     * Posts an event to the listeners.
+     *
+     * @param  evt the event to dispatch
      * @deprecated As of JDK version 1.1
      * replaced by dispatchEvent(AWTEvent).
      */
diff --git a/jdk/src/share/classes/java/awt/MenuItem.java b/jdk/src/share/classes/java/awt/MenuItem.java
index a81c1314700..ab797f4dd1a 100644
--- a/jdk/src/share/classes/java/awt/MenuItem.java
+++ b/jdk/src/share/classes/java/awt/MenuItem.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -264,6 +264,9 @@ public class MenuItem extends MenuComponent implements Accessible {
 
     /**
      * Checks whether this menu item is enabled.
+     *
+     * @return {@code true} if the item is enabled;
+     *         otherwise {@code false}
      * @see        java.awt.MenuItem#setEnabled
      * @since      1.0
      */
@@ -296,6 +299,10 @@ public class MenuItem extends MenuComponent implements Accessible {
     }
 
     /**
+     * Sets whether or not this menu item can be chosen.
+     *
+     * @param  b if {@code true}, enables this menu item;
+     *           otherwise disables
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setEnabled(boolean)</code>.
      */
@@ -494,8 +501,10 @@ public class MenuItem extends MenuComponent implements Accessible {
     /**
      * Gets the command name of the action event that is fired
      * by this menu item.
-     * @see         java.awt.MenuItem#setActionCommand
-     * @since       1.1
+     *
+     * @return the action command name
+     * @see java.awt.MenuItem#setActionCommand
+     * @since 1.1
      */
     public String getActionCommand() {
         return getActionCommandImpl();
diff --git a/jdk/src/share/classes/java/awt/PrintGraphics.java b/jdk/src/share/classes/java/awt/PrintGraphics.java
index 91e5173f81f..74c2f84a31e 100644
--- a/jdk/src/share/classes/java/awt/PrintGraphics.java
+++ b/jdk/src/share/classes/java/awt/PrintGraphics.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -35,6 +35,8 @@ public interface PrintGraphics {
     /**
      * Returns the PrintJob object from which this PrintGraphics
      * object originated.
+     *
+     * @return the print job for this object
      */
     public PrintJob getPrintJob();
 
diff --git a/jdk/src/share/classes/java/awt/PrintJob.java b/jdk/src/share/classes/java/awt/PrintJob.java
index 996d7653526..fcc6afebf2a 100644
--- a/jdk/src/share/classes/java/awt/PrintJob.java
+++ b/jdk/src/share/classes/java/awt/PrintJob.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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,6 +42,7 @@ public abstract class PrintJob {
      * object is disposed.  This graphics object will also implement
      * the PrintGraphics interface.
      * @see PrintGraphics
+     * @return the graphics context for printing the next page
      */
     public abstract Graphics getGraphics();
 
@@ -49,6 +50,8 @@ public abstract class PrintJob {
      * Returns the dimensions of the page in pixels.
      * The resolution of the page is chosen so that it
      * is similar to the screen resolution.
+     *
+     * @return the page dimension
      */
     public abstract Dimension getPageDimension();
 
@@ -56,11 +59,16 @@ public abstract class PrintJob {
      * Returns the resolution of the page in pixels per inch.
      * Note that this doesn't have to correspond to the physical
      * resolution of the printer.
+     *
+     * @return the page resolution
      */
     public abstract int getPageResolution();
 
     /**
      * Returns true if the last page will be printed first.
+     *
+     * @return {@code true} if the last page will be printed first;
+     *         otherwise {@code false}
      */
     public abstract boolean lastPageFirst();
 
diff --git a/jdk/src/share/classes/java/awt/Robot.java b/jdk/src/share/classes/java/awt/Robot.java
index cc734dd45a2..8de89ee8ed9 100644
--- a/jdk/src/share/classes/java/awt/Robot.java
+++ b/jdk/src/share/classes/java/awt/Robot.java
@@ -498,6 +498,8 @@ public class Robot {
 
     /**
      * Returns the number of milliseconds this Robot sleeps after generating an event.
+     *
+     * @return the delay duration in milliseconds
      */
     public synchronized int getAutoDelay() {
         return autoDelay;
@@ -505,7 +507,10 @@ public class Robot {
 
     /**
      * Sets the number of milliseconds this Robot sleeps after generating an event.
-     * @throws  IllegalArgumentException If <code>ms</code> is not between 0 and 60,000 milliseconds inclusive
+     *
+     * @param  ms the delay duration in milliseconds
+     * @throws IllegalArgumentException If {@code ms}
+     *         is not between 0 and 60,000 milliseconds inclusive
      */
     public synchronized void setAutoDelay(int ms) {
         checkDelayArgument(ms);
@@ -523,9 +528,11 @@ public class Robot {
      * Sleeps for the specified time.
      * To catch any <code>InterruptedException</code>s that occur,
      * <code>Thread.sleep()</code> may be used instead.
-     * @param   ms      time to sleep in milliseconds
-     * @throws  IllegalArgumentException if <code>ms</code> is not between 0 and 60,000 milliseconds inclusive
-     * @see     java.lang.Thread#sleep
+     *
+     * @param  ms time to sleep in milliseconds
+     * @throws IllegalArgumentException if {@code ms}
+     *         is not between 0 and 60,000 milliseconds inclusive
+     * @see java.lang.Thread#sleep
      */
     public synchronized void delay(int ms) {
         checkDelayArgument(ms);
diff --git a/jdk/src/share/classes/java/awt/ScrollPane.java b/jdk/src/share/classes/java/awt/ScrollPane.java
index 70ca48f4d74..fb5401d06f6 100644
--- a/jdk/src/share/classes/java/awt/ScrollPane.java
+++ b/jdk/src/share/classes/java/awt/ScrollPane.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -323,7 +323,9 @@ public class ScrollPane extends Container implements Accessible {
      * represents the state of the vertical scrollbar.
      * The declared return type of this method is
      * <code>Adjustable</code> to maintain backward compatibility.
+     *
      * @see java.awt.ScrollPaneAdjustable
+     * @return the vertical scrollbar state
      */
     public Adjustable getVAdjustable() {
         return vAdjustable;
@@ -334,7 +336,9 @@ public class ScrollPane extends Container implements Accessible {
      * represents the state of the horizontal scrollbar.
      * The declared return type of this method is
      * <code>Adjustable</code> to maintain backward compatibility.
+     *
      * @see java.awt.ScrollPaneAdjustable
+     * @return the horizontal scrollbar state
      */
     public Adjustable getHAdjustable() {
         return hAdjustable;
@@ -657,6 +661,9 @@ public class ScrollPane extends Container implements Accessible {
      * Indicates whether or not scrolling will take place in response to
      * the mouse wheel.  Wheel scrolling is enabled by default.
      *
+     * @return {@code true} if the wheel scrolling enabled;
+     *         otherwise {@code false}
+     *
      * @see #setWheelScrollingEnabled(boolean)
      * @since 1.4
      */
diff --git a/jdk/src/share/classes/java/awt/Scrollbar.java b/jdk/src/share/classes/java/awt/Scrollbar.java
index bf119ae2779..28c84efb923 100644
--- a/jdk/src/share/classes/java/awt/Scrollbar.java
+++ b/jdk/src/share/classes/java/awt/Scrollbar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -656,6 +656,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
     }
 
     /**
+     * Returns the visible amount of this scroll bar.
+     *
+     * @return the visible amount of this scroll bar
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getVisibleAmount()</code>.
      */
@@ -729,6 +732,10 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
     }
 
     /**
+     * Sets the unit increment for this scroll bar.
+     *
+     * @param  v the increment value
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setUnitIncrement(int)</code>.
      */
@@ -768,6 +775,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
     }
 
     /**
+     * Returns the unit increment for this scrollbar.
+     *
+     * @return the unit increment for this scrollbar
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getUnitIncrement()</code>.
      */
@@ -797,6 +807,9 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
     }
 
     /**
+     * Sets the block increment for this scroll bar.
+     *
+     * @param  v the block increment
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setBlockIncrement()</code>.
      */
@@ -833,6 +846,10 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
     }
 
     /**
+     * Returns the block increment of this scroll bar.
+     *
+     * @return the block increment of this scroll bar
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getBlockIncrement()</code>.
      */
diff --git a/jdk/src/share/classes/java/awt/TextArea.java b/jdk/src/share/classes/java/awt/TextArea.java
index dd90aa7414e..f29da08b537 100644
--- a/jdk/src/share/classes/java/awt/TextArea.java
+++ b/jdk/src/share/classes/java/awt/TextArea.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -314,6 +314,11 @@ public class TextArea extends TextComponent {
     }
 
     /**
+     * Inserts the specified text at the specified position
+     * in this text area.
+     *
+     * @param  str the non-{@code null} text to insert
+     * @param  pos the position at which to insert
      * @deprecated As of JDK version 1.1,
      * replaced by <code>insert(String, int)</code>.
      */
@@ -342,6 +347,9 @@ public class TextArea extends TextComponent {
     }
 
     /**
+     * Appends the given text to the text area's current text.
+     *
+     * @param  str the text to append
      * @deprecated As of JDK version 1.1,
      * replaced by <code>append(String)</code>.
      */
@@ -378,6 +386,15 @@ public class TextArea extends TextComponent {
     }
 
     /**
+     * Replaces a range of characters between
+     * the indicated start and end positions
+     * with the specified replacement text (the text at the end
+     * position will not be replaced).
+     *
+     * @param  str the non-{@code null} text to use as
+     *         the replacement
+     * @param  start the start position
+     * @param  end the end position
      * @deprecated As of JDK version 1.1,
      * replaced by <code>replaceRange(String, int, int)</code>.
      */
@@ -492,6 +509,12 @@ public class TextArea extends TextComponent {
     }
 
     /**
+     * Determines the preferred size of the text area with the specified
+     * number of rows and columns.
+     *
+     * @param  rows the number of rows
+     * @param  columns the number of columns
+     * @return the preferred dimensions needed for the text area
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getPreferredSize(int, int)</code>.
      */
@@ -544,6 +567,12 @@ public class TextArea extends TextComponent {
     }
 
     /**
+     * Determines the minimum size of the text area with the specified
+     * number of rows and columns.
+     *
+     * @param  rows the number of rows
+     * @param  columns the number of columns
+     * @return the minimum size for the text area
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getMinimumSize(int, int)</code>.
      */
diff --git a/jdk/src/share/classes/java/awt/TextComponent.java b/jdk/src/share/classes/java/awt/TextComponent.java
index 104fe02e53b..639438a2a1d 100644
--- a/jdk/src/share/classes/java/awt/TextComponent.java
+++ b/jdk/src/share/classes/java/awt/TextComponent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -107,6 +107,9 @@ public class TextComponent extends Component implements Accessible {
     // the background color of non-editable TextComponents.
     boolean backgroundSetByClientCode = false;
 
+    /**
+     * A list of listeners that will receive events from this object.
+     */
     transient protected TextListener textListener;
 
     /*
diff --git a/jdk/src/share/classes/java/awt/TextField.java b/jdk/src/share/classes/java/awt/TextField.java
index 3b4646896e1..ebebc828b96 100644
--- a/jdk/src/share/classes/java/awt/TextField.java
+++ b/jdk/src/share/classes/java/awt/TextField.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -272,6 +272,10 @@ public class TextField extends TextComponent {
     }
 
     /**
+     * Sets the character to be echoed when protected input is displayed.
+     *
+     *  @param  c the echo character for this text field
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setEchoChar(char)</code>.
      */
@@ -368,6 +372,12 @@ public class TextField extends TextComponent {
     }
 
     /**
+     * Returns the preferred size for this text field
+     * with the specified number of columns.
+     *
+     * @param  columns the number of columns
+     * @return the preferred size for the text field
+     *
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getPreferredSize(int)</code>.
      */
@@ -407,8 +417,9 @@ public class TextField extends TextComponent {
     /**
      * Gets the minimum dimensions for a text field with
      * the specified number of columns.
-     * @param    columns   the number of columns in
-     *                          this text field.
+     * @param  columns the number of columns in
+     *         this text field.
+     * @return the minimum size for this text field
      * @since    1.1
      */
     public Dimension getMinimumSize(int columns) {
@@ -416,6 +427,11 @@ public class TextField extends TextComponent {
     }
 
     /**
+     * Returns the minimum dimensions for a text field with
+     * the specified number of columns.
+     *
+     * @param  columns the number of columns
+     * @return the minimum size for this text field
      * @deprecated As of JDK version 1.1,
      * replaced by <code>getMinimumSize(int)</code>.
      */
diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java
index 7bc8c24f625..65b494ba52d 100644
--- a/jdk/src/share/classes/java/awt/Toolkit.java
+++ b/jdk/src/share/classes/java/awt/Toolkit.java
@@ -422,7 +422,8 @@ public abstract class Toolkit {
      * and allows the Component and Container classes to be extended directly
      * to create windowless components that are defined entirely in java.
      *
-     * @param target The Component to be created.
+     * @param  target The Component to be created.
+     * @return the peer for the specified component
      */
     protected LightweightPeer createComponent(Component target) {
         if (lightweightMarker == null) {
@@ -1370,6 +1371,9 @@ public abstract class Toolkit {
      * {@link java.awt.event.KeyEvent#VK_SCROLL_LOCK VK_SCROLL_LOCK}, and
      * {@link java.awt.event.KeyEvent#VK_KANA_LOCK VK_KANA_LOCK}.
      *
+     * @param  keyCode the key code
+     * @return {@code true} if the given key is currently in its "on" state;
+     *          otherwise {@code false}
      * @exception java.lang.IllegalArgumentException if <code>keyCode</code>
      * is not one of the valid key codes
      * @exception java.lang.UnsupportedOperationException if the host system doesn't
@@ -1404,6 +1408,8 @@ public abstract class Toolkit {
      * involve event processing and therefore may not be immediately
      * observable through getLockingKeyState.
      *
+     * @param  keyCode the key code
+     * @param  on the state of the key
      * @exception java.lang.IllegalArgumentException if <code>keyCode</code>
      * is not one of the valid key codes
      * @exception java.lang.UnsupportedOperationException if the host system doesn't
@@ -1429,6 +1435,9 @@ public abstract class Toolkit {
     /**
      * Give native peers the ability to query the native container
      * given a native component (eg the direct parent may be lightweight).
+     *
+     * @param  c the component to fetch the container for
+     * @return the native container object for the component
      */
     protected static Container getNativeContainer(Component c) {
         return c.getNativeContainer();
@@ -1449,6 +1458,7 @@ public abstract class Toolkit {
      * @param     name a localized description of the cursor, for Java Accessibility use
      * @exception IndexOutOfBoundsException if the hotSpot values are outside
      *   the bounds of the cursor
+     * @return the cursor created
      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
      * returns true
      * @see       java.awt.GraphicsEnvironment#isHeadless
@@ -1675,6 +1685,11 @@ public abstract class Toolkit {
     /**
      * Gets a property with the specified key and default.
      * This method returns defaultValue if the property is not found.
+     *
+     * @param  key the key
+     * @param  defaultValue the default value
+     * @return the value of the property or the default value
+     *         if the property was not found
      */
     public static String getProperty(String key, String defaultValue) {
         // first try platform specific bundle
@@ -1738,6 +1753,9 @@ public abstract class Toolkit {
      * Creates the peer for a DragSourceContext.
      * Always throws InvalidDndOperationException if
      * GraphicsEnvironment.isHeadless() returns true.
+     *
+     * @param  dge the {@code DragGestureEvent}
+     * @return the peer created
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
     public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException;
@@ -1775,6 +1793,9 @@ public abstract class Toolkit {
      * representation for an underlying platform dependent desktop setting.
      * For more information on desktop properties supported by the AWT see
      * <a href="doc-files/DesktopProperties.html">AWT Desktop Properties</a>.
+     *
+     * @param  propertyName the property name
+     * @return the value for the specified desktop property
      */
     public final synchronized Object getDesktopProperty(String propertyName) {
         // This is a workaround for headless toolkits.  It would be
@@ -1818,6 +1839,9 @@ public abstract class Toolkit {
     /**
      * Sets the named desktop property to the specified value and fires a
      * property change event to notify any listeners that the value has changed.
+     *
+     * @param  name the property name
+     * @param  newValue the new property value
      */
     protected final void setDesktopProperty(String name, Object newValue) {
         // This is a workaround for headless toolkits.  It would be
diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java
index 47bcdf301ca..629f1df75a4 100644
--- a/jdk/src/share/classes/java/awt/Window.java
+++ b/jdk/src/share/classes/java/awt/Window.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -1452,6 +1452,8 @@ public class Window extends Container implements Accessible {
 
     /**
      * Returns the owner of this window.
+     *
+     * @return the owner of this window
      * @since 1.2
      */
     public Window getOwner() {
@@ -1464,6 +1466,8 @@ public class Window extends Container implements Accessible {
     /**
      * Return an array containing all the windows this
      * window currently owns.
+     *
+     * @return the array of all the owned windows
      * @since 1.2
      */
     public Window[] getOwnedWindows() {
@@ -1586,6 +1590,7 @@ public class Window extends Container implements Accessible {
      * dialogs such as component positions, {@code LayoutManager}s
      * or serialization.
      *
+     * @return the array of all the {@code Window}s created by the application
      * @see Frame#getFrames
      * @see Window#getOwnerlessWindows
      *
@@ -1608,6 +1613,8 @@ public class Window extends Container implements Accessible {
      * dialogs such as component positions, {@code LayoutManager}s
      * or serialization.
      *
+     * @return the array of all the ownerless {@code Window}s
+     *         created by this application
      * @see Frame#getFrames
      * @see Window#getWindows()
      *
@@ -2849,6 +2856,7 @@ public class Window extends Container implements Accessible {
      *
      * This method can only be called while the window is not displayable.
      *
+     * @param  type the window type
      * @throws IllegalComponentStateException if the window
      *         is displayable.
      * @throws IllegalArgumentException if the type is {@code null}
@@ -2874,6 +2882,7 @@ public class Window extends Container implements Accessible {
     /**
      * Returns the type of the window.
      *
+     * @return the type of the window
      * @see   #setType
      * @since 1.7
      */
-- 
GitLab


From ea1f1d527dfe47a928360ec4aa715cf3194988b8 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Tue, 24 Jun 2014 10:46:08 -0700
Subject: [PATCH 085/192] 8048014: Update java.lang.SafeVararags for private
 methods

Reviewed-by: lancea, abuckley
---
 jdk/src/share/classes/java/lang/SafeVarargs.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jdk/src/share/classes/java/lang/SafeVarargs.java b/jdk/src/share/classes/java/lang/SafeVarargs.java
index 6fcd48e97d7..9f49bf7a73f 100644
--- a/jdk/src/share/classes/java/lang/SafeVarargs.java
+++ b/jdk/src/share/classes/java/lang/SafeVarargs.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -45,7 +45,7 @@ import java.lang.annotation.*;
  * <li>  the declaration is a fixed arity method or constructor
  *
  * <li> the declaration is a variable arity method that is neither
- * {@code static} nor {@code final}.
+ * {@code static} nor {@code final} nor {@code private}.
  *
  * </ul>
  *
-- 
GitLab


From 8bca223cbdf11d63a4f6566ce97c7c61fc8de6b1 Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik <jbachorik@openjdk.org>
Date: Tue, 24 Jun 2014 19:58:03 +0200
Subject: [PATCH 086/192] 8047073: Some javax/management/ fails with JFR

Reviewed-by: egahlin, dfuchs
---
 jdk/test/javax/management/MBeanServer/MBeanFallbackTest.java | 3 +--
 jdk/test/javax/management/ObjectName/SerialCompatTest.java   | 4 +---
 jdk/test/javax/management/mxbean/MXBeanFallbackTest.java     | 3 +--
 jdk/test/javax/management/proxy/JMXProxyFallbackTest.java    | 3 +--
 4 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/jdk/test/javax/management/MBeanServer/MBeanFallbackTest.java b/jdk/test/javax/management/MBeanServer/MBeanFallbackTest.java
index dcb5e1803a4..5fe115f7b04 100644
--- a/jdk/test/javax/management/MBeanServer/MBeanFallbackTest.java
+++ b/jdk/test/javax/management/MBeanServer/MBeanFallbackTest.java
@@ -35,7 +35,7 @@ import javax.management.ObjectName;
  * @author Jaroslav Bachorik
  * @run clean MBeanFallbackTest
  * @run build MBeanFallbackTest
- * @run main MBeanFallbackTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MBeanFallbackTest
  */
 public class MBeanFallbackTest {
     private static interface PrivateMBean {
@@ -51,7 +51,6 @@ public class MBeanFallbackTest {
     private static int failures = 0;
 
     public static void main(String[] args) throws Exception {
-        System.setProperty("jdk.jmx.mbeans.allowNonPublic", "true");
         testPrivate(PrivateMBean.class, new Private());
 
         if (failures == 0)
diff --git a/jdk/test/javax/management/ObjectName/SerialCompatTest.java b/jdk/test/javax/management/ObjectName/SerialCompatTest.java
index 50b65784aa4..0c183b204a0 100644
--- a/jdk/test/javax/management/ObjectName/SerialCompatTest.java
+++ b/jdk/test/javax/management/ObjectName/SerialCompatTest.java
@@ -28,7 +28,7 @@
  * @author Eamonn McManus, Daniel Fuchs
  * @run clean SerialCompatTest
  * @run build SerialCompatTest
- * @run main/othervm SerialCompatTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true -Djmx.serial.form=1.0 SerialCompatTest
  */
 
 import java.io.*;
@@ -223,8 +223,6 @@ public class SerialCompatTest {
     }
 
     public static void main(String[] args) throws Exception {
-        System.setProperty("jmx.serial.form", "1.0");
-
         /* Check that we really are in jmx.serial.form=1.0 mode.
         The property is frozen the first time the ObjectName class
         is referenced so checking that it is set to the correct
diff --git a/jdk/test/javax/management/mxbean/MXBeanFallbackTest.java b/jdk/test/javax/management/mxbean/MXBeanFallbackTest.java
index 388ffc9373d..cd10b6f6221 100644
--- a/jdk/test/javax/management/mxbean/MXBeanFallbackTest.java
+++ b/jdk/test/javax/management/mxbean/MXBeanFallbackTest.java
@@ -30,7 +30,7 @@
  * @author Jaroslav Bachorik
  * @run clean MXBeanFallbackTest
  * @run build MXBeanFallbackTest
- * @run main MXBeanFallbackTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true MXBeanFallbackTest
  */
 
 import javax.management.MBeanServer;
@@ -40,7 +40,6 @@ import javax.management.ObjectName;
 
 public class MXBeanFallbackTest {
     public static void main(String[] args) throws Exception {
-        System.setProperty("jdk.jmx.mbeans.allowNonPublic", "true");
         testPrivateMXBean("Private", new Private());
 
         if (failures == 0)
diff --git a/jdk/test/javax/management/proxy/JMXProxyFallbackTest.java b/jdk/test/javax/management/proxy/JMXProxyFallbackTest.java
index d1243593c11..2d96d062b30 100644
--- a/jdk/test/javax/management/proxy/JMXProxyFallbackTest.java
+++ b/jdk/test/javax/management/proxy/JMXProxyFallbackTest.java
@@ -36,7 +36,7 @@ import javax.management.ObjectName;
  * @author Jaroslav Bachorik
  * @run clean JMXProxyFallbackTest
  * @run build JMXProxyFallbackTest
- * @run main JMXProxyFallbackTest
+ * @run main/othervm -Djdk.jmx.mbeans.allowNonPublic=true JMXProxyFallbackTest
  */
 public class JMXProxyFallbackTest {
     private static interface PrivateMBean {
@@ -56,7 +56,6 @@ public class JMXProxyFallbackTest {
     private static int failures = 0;
 
     public static void main(String[] args) throws Exception {
-        System.setProperty("jdk.jmx.mbeans.allowNonPublic", "true");
         testPrivate(PrivateMBean.class);
         testPrivate(PrivateMXBean.class);
 
-- 
GitLab


From cc7e85e940804abf2706230710a6b9d3fe99fee4 Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik <jbachorik@openjdk.org>
Date: Tue, 24 Jun 2014 19:59:26 +0200
Subject: [PATCH 087/192] 8048005: Add test timing information to
 JMXStartStopTest

Reviewed-by: egahlin, dfuchs
---
 .../sun/management/jmxremote/startstop/JMXStartStopTest.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
index 09c1fa9d080..f485358eb33 100644
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
@@ -290,11 +290,14 @@ public class JMXStartStopTest {
     public static void main(String args[]) throws Exception {
         for (Method m : JMXStartStopTest.class.getDeclaredMethods()) {
             if (m.getName().startsWith("test_")) {
+                long t1 = System.currentTimeMillis();
                 try {
                     m.invoke(null);
-                    System.out.println("=== PASSED\n");
+                    System.out.println("=== PASSED");
                 } catch (Throwable e) {
                     failures.add(new Failure(e, m.getName() + " failed"));
+                } finally {
+                    System.out.println("(took " + (System.currentTimeMillis() - t1) + "ms)\n");
                 }
             }
         }
-- 
GitLab


From 0caae2d748b8a47eda9e135fcec16258de8ac514 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Tue, 24 Jun 2014 14:05:47 -0700
Subject: [PATCH 088/192] 8046273: Add overrides lint warning to build of jdk
 repository

Reviewed-by: tbell
---
 jdk/make/Setup.gmk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/make/Setup.gmk b/jdk/make/Setup.gmk
index c4119d787d8..13e513d3274 100644
--- a/jdk/make/Setup.gmk
+++ b/jdk/make/Setup.gmk
@@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-
 
 # To build with all warnings enabled, do the following:
 # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
-JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,fallthrough,finally,overloads,serial,static,try,varargs -Werror
+JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,fallthrough,finally,overloads,overrides,serial,static,try,varargs -Werror
 
 # Any java code executed during a JDK build to build other parts of the JDK must be 
 # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 
-- 
GitLab


From bfe7a7abd1fcf44ecc7e4acb6ededd55f6b21ed3 Mon Sep 17 00:00:00 2001
From: Mandy Chung <mchung@openjdk.org>
Date: Tue, 24 Jun 2014 16:22:57 -0700
Subject: [PATCH 089/192] 8047904: Runtime.loadLibrary throws SecurityException
 when security manager is installed

Reviewed-by: alanb, psandoz
---
 .../share/classes/java/lang/ClassLoader.java  | 23 +++++++------
 jdk/src/share/classes/sun/misc/Launcher.java  | 33 ++++++++++++-------
 2 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/jdk/src/share/classes/java/lang/ClassLoader.java b/jdk/src/share/classes/java/lang/ClassLoader.java
index 876b1855012..1652d6cc4eb 100644
--- a/jdk/src/share/classes/java/lang/ClassLoader.java
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java
@@ -1859,18 +1859,17 @@ public abstract class ClassLoader {
         String name = NativeLibrary.findBuiltinLib(file.getName());
         boolean isBuiltin = (name != null);
         if (!isBuiltin) {
-            boolean exists = AccessController.doPrivileged(
-                new PrivilegedAction<Object>() {
-                    public Object run() {
-                        return file.exists() ? Boolean.TRUE : null;
-                    }})
-                != null;
-            if (!exists) {
-                return false;
-            }
-            try {
-                name = file.getCanonicalPath();
-            } catch (IOException e) {
+            name = AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() {
+                        try {
+                            return file.exists() ? file.getCanonicalPath() : null;
+                        } catch (IOException e) {
+                            return null;
+                        }
+                    }
+                });
+            if (name == null) {
                 return false;
             }
         }
diff --git a/jdk/src/share/classes/sun/misc/Launcher.java b/jdk/src/share/classes/sun/misc/Launcher.java
index 89557f711b4..75310f5aa0e 100644
--- a/jdk/src/share/classes/sun/misc/Launcher.java
+++ b/jdk/src/share/classes/sun/misc/Launcher.java
@@ -207,7 +207,7 @@ public class Launcher {
          * look in the extension directory itself.
          */
         public String findLibrary(String name) {
-            name = System.mapLibraryName(name);
+            final String libname = System.mapLibraryName(name);
             URL[] urls = super.getURLs();
             File prevDir = null;
             for (int i = 0; i < urls.length; i++) {
@@ -216,17 +216,26 @@ public class Launcher {
                 if (dir != null && !dir.equals(prevDir)) {
                     // Look in architecture-specific subdirectory first
                     // Read from the saved system properties to avoid deadlock
-                    String arch = VM.getSavedProperty("os.arch");
-                    if (arch != null) {
-                        File file = new File(new File(dir, arch), name);
-                        if (file.exists()) {
-                            return file.getAbsolutePath();
-                        }
-                    }
-                    // Then check the extension directory
-                    File file = new File(dir, name);
-                    if (file.exists()) {
-                        return file.getAbsolutePath();
+                    final String arch = VM.getSavedProperty("os.arch");
+                    String pathname = AccessController.doPrivileged(
+                        new PrivilegedAction<String>() {
+                            public String run() {
+                                if (arch != null) {
+                                    File file = new File(new File(dir, arch), libname);
+                                    if (file.exists()) {
+                                        return file.getAbsolutePath();
+                                    }
+                                }
+                                // Then check the extension directory
+                                File file = new File(dir, libname);
+                                if (file.exists()) {
+                                    return file.getAbsolutePath();
+                                }
+                                return null;
+                            }
+                        });
+                    if (pathname != null) {
+                        return pathname;
                     }
                 }
                 prevDir = dir;
-- 
GitLab


From 99a469d169d23b5a6cc1520032072b1ed0e3f860 Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik <jbachorik@openjdk.org>
Date: Wed, 25 Jun 2014 09:43:47 +0200
Subject: [PATCH 090/192] 8038826:
 sun/management/jmxremote/startstop/JMXStartStopTest.java fails with "should
 report port in use"

Reviewed-by: sla
---
 .../jmxremote/startstop/JMXStartStopTest.java | 39 ++++++++++---------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
index f485358eb33..4a058cb1f76 100644
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
@@ -38,7 +38,9 @@ import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
+import java.util.function.IntUnaryOperator;
 
 import javax.management.*;
 import javax.management.remote.*;
@@ -588,11 +590,11 @@ public class JMXStartStopTest {
 
             testConnect(pa.getPort1(), pa.getPort2());
 
-            final boolean[] checks = new boolean[3];
+            final AtomicInteger checks = new AtomicInteger();
             jcmd(
                 line -> {
                     if (line.contains("java.lang.RuntimeException: Invalid agent state")) {
-                        checks[0] = true;
+                        checks.getAndUpdate((op) -> op | 1);
                     }
                 },
                 CMD_START,
@@ -603,7 +605,7 @@ public class JMXStartStopTest {
             jcmd(
                 line -> {
                     if (line.contains("java.lang.RuntimeException: Invalid agent state")) {
-                        checks[1] = true;
+                        checks.getAndUpdate((op) -> op | 2);
                     }
                 },
                 CMD_START,
@@ -614,12 +616,14 @@ public class JMXStartStopTest {
             jcmd(CMD_STOP);
             jcmd(CMD_STOP);
 
+            int busyPort;
             try (ServerSocket ss = new ServerSocket(0))
             {
+                busyPort = ss.getLocalPort();
                 jcmd(
                     line -> {
-                        if (line.contains("Port already in use: " + ss.getLocalPort())) {
-                            checks[2] = true;
+                        if (line.contains("Port already in use: " + busyPort)) {
+                            checks.getAndUpdate((op) -> op | 4);
                         }
                     },
                     CMD_START,
@@ -627,19 +631,18 @@ public class JMXStartStopTest {
                     "jmxremote.rmi.port=" + pa.getPort2(),
                     "jmxremote.authenticate=false",
                     "jmxremote.ssl=false");
-
-                if (!checks[0]) {
-                    throw new Exception("Starting agent on port " + pa.getPort1() + " should " +
-                                        "report an invalid agent state");
-                }
-                if (!checks[1]) {
-                    throw new Exception("Starting agent on poprt " + pa.getPort2() + " should " +
-                                        "report an invalid agent state");
-                }
-                if (!checks[2]) {
-                    throw new Exception("Starting agent on port " + ss.getLocalPort() + " should " +
-                                        "report port in use");
-                }
+            }
+            if ((checks.get() & 1) == 0) {
+                throw new Exception("Starting agent on port " + pa.getPort1() + " should " +
+                                    "report an invalid agent state");
+            }
+            if ((checks.get() & 2) == 0) {
+                throw new Exception("Starting agent on poprt " + pa.getPort2() + " should " +
+                                    "report an invalid agent state");
+            }
+            if ((checks.get() & 4) == 0) {
+                throw new Exception("Starting agent on port " + busyPort + " should " +
+                                    "report port in use");
             }
         } finally {
             s.stop();
-- 
GitLab


From ea1882be4f9759f79f47cd8b57699ebcb2adfbc3 Mon Sep 17 00:00:00 2001
From: Weijun Wang <weijun@openjdk.org>
Date: Wed, 25 Jun 2014 18:49:02 +0800
Subject: [PATCH 091/192] 8048073: Cannot read ccache entry with a realm-less
 service name

Reviewed-by: xuelei
---
 .../internal/ccache/CCacheInputStream.java    | 29 ++++++--
 .../security/krb5/ccache/EmptyRealmCC.java    | 68 +++++++++++++++++++
 .../security/krb5/ccache/TimeInCCache.java    |  6 +-
 3 files changed, 94 insertions(+), 9 deletions(-)
 create mode 100644 jdk/test/sun/security/krb5/ccache/EmptyRealmCC.java

diff --git a/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java b/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
index 6f745f4fd30..e7707e84807 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
@@ -334,15 +334,29 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
      * returns null.
      */
     Credentials readCred(int version) throws IOException,RealmException, KrbApErrException, Asn1Exception {
-        PrincipalName cpname = readPrincipal(version);
-        if (DEBUG)
+        PrincipalName cpname = null;
+        try {
+            cpname = readPrincipal(version);
+        } catch (Exception e) {
+            // Do not return here. All data for this cred should be fully
+            // consumed so that we can read the next one.
+        }
+        if (DEBUG) {
             System.out.println(">>>DEBUG <CCacheInputStream>  client principal is " + cpname);
-        PrincipalName spname = readPrincipal(version);
-        if (DEBUG)
+        }
+        PrincipalName spname = null;
+        try {
+            spname = readPrincipal(version);
+        } catch (Exception e) {
+            // same as above
+        }
+        if (DEBUG) {
             System.out.println(">>>DEBUG <CCacheInputStream> server principal is " + spname);
+        }
         EncryptionKey key = readKey(version);
-        if (DEBUG)
+        if (DEBUG) {
             System.out.println(">>>DEBUG <CCacheInputStream> key type: " + key.getEType());
+        }
         long times[] = readTimes();
         KerberosTime authtime = new KerberosTime(times[0]);
         KerberosTime starttime =
@@ -375,6 +389,11 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
         byte[] ticketData = readData();
         byte[] ticketData2 = readData();
 
+        // Skip this cred if either cpname or spname isn't created.
+        if (cpname == null || spname == null) {
+            return null;
+        }
+
         try {
             return new Credentials(cpname, spname, key, authtime, starttime,
                 endtime, renewTill, skey, tFlags,
diff --git a/jdk/test/sun/security/krb5/ccache/EmptyRealmCC.java b/jdk/test/sun/security/krb5/ccache/EmptyRealmCC.java
new file mode 100644
index 00000000000..315cc06a35e
--- /dev/null
+++ b/jdk/test/sun/security/krb5/ccache/EmptyRealmCC.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8048073
+ * @summary Cannot read ccache entry with a realm-less service name
+ * @compile -XDignore.symbol.file EmptyRealmCC.java
+ * @run main EmptyRealmCC
+ */
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import sun.security.krb5.internal.ccache.CredentialsCache;
+
+public class EmptyRealmCC {
+    public static void main(String[] args) throws Exception {
+        byte[] ccache = TimeInCCache.ccache;
+
+        // The service name starts at 0x52:
+        //
+        //    0050:    00 00 00 02 00 00 00 0A 4D 41 58 49 2E 4C
+        //             ----------- -----------
+        //    0060: 4F 43 41 4C 00 00 00 06 6B 72 62 74 67 74 00 00
+        //                      -----------                   -----
+        //    0070: 00 0A 4D 41 58 49 2E 4C 4F 43 41 4C
+        //          -----
+        //
+        // which contains 2 (the length of names), a 10-byte realm, a 6-byte
+        // name[0], and a 10-byte name[1].
+
+        // We will empty the realm, and pack the realm string to another
+        // name (6-byte ".LOCAL"). Finally "krbtgt/MAXI.LOCAL@MAXI.LOCAL"
+        // becomes ".LOCAL/krbtgt/MAXI.LOCAL@".
+
+        // length of names is now 3
+        ccache[0x55] = 3;
+        // The empty realm
+        System.arraycopy(new byte[4], 0, ccache, 0x56, 4);
+        // Length of inserted name is 6
+        System.arraycopy(new byte[]{0,0,0,6}, 0, ccache, 0x5A, 4);
+
+        Files.write(Paths.get("tmpcc"), TimeInCCache.ccache);
+        if (CredentialsCache.getInstance("tmpcc").getCredsList() != null) {
+            throw new Exception("Nothing should be there");
+        }
+    }
+}
diff --git a/jdk/test/sun/security/krb5/ccache/TimeInCCache.java b/jdk/test/sun/security/krb5/ccache/TimeInCCache.java
index 1bb4e7dfb34..e81ff909b98 100644
--- a/jdk/test/sun/security/krb5/ccache/TimeInCCache.java
+++ b/jdk/test/sun/security/krb5/ccache/TimeInCCache.java
@@ -28,16 +28,14 @@
  */
 
 import java.io.ByteArrayInputStream;
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.nio.file.Files;
-import java.nio.file.Paths;
 
 import sun.security.krb5.internal.ccache.CCacheInputStream;
 import sun.security.krb5.internal.ccache.Credentials;
 
 public class TimeInCCache {
-    // Attention: this field is also used by CorruptedCC.java test
+    // Attention: this field is also used by 2 other tests:
+    // CorruptedCC.java and EmptyRealmCC.java
     public static byte[] ccache;
 
     static {
-- 
GitLab


From fd148509ce5d52f3161e22be6877f3768eed908e Mon Sep 17 00:00:00 2001
From: Michael McMahon <michaelm@openjdk.org>
Date: Wed, 25 Jun 2014 15:55:42 +0100
Subject: [PATCH 092/192] 8029607: Type of Service (TOS) cannot be set in IPv6
 header

Reviewed-by: alanb
---
 .../genconstants/ch/genSocketOptionRegistry.c |  1 +
 .../sun/nio/ch/DatagramChannelImpl.java       | 23 ++++---------------
 jdk/src/share/classes/sun/nio/ch/Net.java     |  5 ++--
 .../sun/nio/ch/ServerSocketChannelImpl.java   |  9 ++++++++
 .../classes/sun/nio/ch/SocketChannelImpl.java | 17 +++++++-------
 jdk/src/solaris/native/java/net/net_util_md.c |  8 ++++---
 jdk/src/solaris/native/sun/nio/ch/Net.c       |  9 +++++++-
 jdk/src/windows/native/sun/nio/ch/Net.c       |  2 +-
 8 files changed, 40 insertions(+), 34 deletions(-)

diff --git a/jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c b/jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c
index d5ed5d7a87e..41bd5484ab7 100644
--- a/jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c
+++ b/jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c
@@ -110,6 +110,7 @@ int main(int argc, const char* argv[]) {
     emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
 
 #ifdef AF_INET6
+    emit_inet6("StandardSocketOptions.IP_TOS",            IPPROTO_IPV6,  IPV6_TCLASS);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
index fe32f63880b..a34286bddb4 100644
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -195,15 +195,8 @@ class DatagramChannelImpl
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOptions.IP_TOS) {
-                // IPv4 only; no-op for IPv6
-                if (family == StandardProtocolFamily.INET) {
-                    Net.setSocketOption(fd, family, name, value);
-                }
-                return this;
-            }
-
-            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+            if (name == StandardSocketOptions.IP_TOS ||
+                name == StandardSocketOptions.IP_MULTICAST_TTL ||
                 name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 // options are protocol dependent
@@ -256,16 +249,8 @@ class DatagramChannelImpl
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOptions.IP_TOS) {
-                // IPv4 only; always return 0 on IPv6
-                if (family == StandardProtocolFamily.INET) {
-                    return (T) Net.getSocketOption(fd, family, name);
-                } else {
-                    return (T) Integer.valueOf(0);
-                }
-            }
-
-            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+            if (name == StandardSocketOptions.IP_TOS ||
+                name == StandardSocketOptions.IP_MULTICAST_TTL ||
                 name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 return (T) Net.getSocketOption(fd, family, name);
diff --git a/jdk/src/share/classes/sun/nio/ch/Net.java b/jdk/src/share/classes/sun/nio/ch/Net.java
index 753e5417310..37823e98c55 100644
--- a/jdk/src/share/classes/sun/nio/ch/Net.java
+++ b/jdk/src/share/classes/sun/nio/ch/Net.java
@@ -352,7 +352,8 @@ public class Net {
         }
 
         boolean mayNeedConversion = (family == UNSPEC);
-        setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg);
+        boolean isIPv6 = (family == StandardProtocolFamily.INET6);
+        setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg, isIPv6);
     }
 
     static Object getSocketOption(FileDescriptor fd, ProtocolFamily family,
@@ -499,7 +500,7 @@ public class Net {
         throws IOException;
 
     private static native void setIntOption0(FileDescriptor fd, boolean mayNeedConversion,
-                                             int level, int opt, int arg)
+                                             int level, int opt, int arg, boolean isIPv6)
         throws IOException;
 
     static native int poll(FileDescriptor fd, int events, long timeout)
diff --git a/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
index b35cf815272..a7cc1946904 100644
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
@@ -133,6 +133,14 @@ class ServerSocketChannelImpl
         synchronized (stateLock) {
             if (!isOpen())
                 throw new ClosedChannelException();
+
+            if (name == StandardSocketOptions.IP_TOS) {
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                Net.setSocketOption(fd, family, name, value);
+                return this;
+            }
+
             if (name == StandardSocketOptions.SO_REUSEADDR &&
                     Net.useExclusiveBind())
             {
@@ -177,6 +185,7 @@ class ServerSocketChannelImpl
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
             set.add(StandardSocketOptions.SO_RCVBUF);
             set.add(StandardSocketOptions.SO_REUSEADDR);
+            set.add(StandardSocketOptions.IP_TOS);
             return Collections.unmodifiableSet(set);
         }
     }
diff --git a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
index 3277de9f6a3..a72fe07e4a1 100644
--- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
@@ -173,14 +173,14 @@ class SocketChannelImpl
             if (!isOpen())
                 throw new ClosedChannelException();
 
-            // special handling for IP_TOS: no-op when IPv6
             if (name == StandardSocketOptions.IP_TOS) {
-                if (!Net.isIPv6Available())
-                    Net.setSocketOption(fd, StandardProtocolFamily.INET, name, value);
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                Net.setSocketOption(fd, family, name, value);
                 return this;
-            } else if (name == StandardSocketOptions.SO_REUSEADDR &&
-                           Net.useExclusiveBind())
-            {
+            }
+
+            if (name == StandardSocketOptions.SO_REUSEADDR && Net.useExclusiveBind()) {
                 // SO_REUSEADDR emulated when using exclusive bind
                 isReuseAddress = (Boolean)value;
                 return this;
@@ -215,8 +215,9 @@ class SocketChannelImpl
 
             // special handling for IP_TOS: always return 0 when IPv6
             if (name == StandardSocketOptions.IP_TOS) {
-                return (Net.isIPv6Available()) ? (T) Integer.valueOf(0) :
-                    (T) Net.getSocketOption(fd, StandardProtocolFamily.INET, name);
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                return (T) Net.getSocketOption(fd, family, name);
             }
 
             // no options that require special handling
diff --git a/jdk/src/solaris/native/java/net/net_util_md.c b/jdk/src/solaris/native/java/net/net_util_md.c
index e463d46276f..dedeedb669f 100644
--- a/jdk/src/solaris/native/java/net/net_util_md.c
+++ b/jdk/src/solaris/native/java/net/net_util_md.c
@@ -1317,7 +1317,7 @@ NET_SetSockOpt(int fd, int level, int  opt, const void *arg,
      *    or sending UDP packet.
      * 2. IPv6 on Linux: By default Linux ignores flowinfo
      *    field so enable IPV6_FLOWINFO_SEND so that flowinfo
-     *    will be examined.
+     *    will be examined. We also set the IPv4 TOS option in this case.
      * 3. IPv4: set socket option based on ToS and Precedence
      *    fields (otherwise get invalid argument)
      */
@@ -1333,8 +1333,10 @@ NET_SetSockOpt(int fd, int level, int  opt, const void *arg,
 #if defined(AF_INET6) && defined(__linux__)
         if (ipv6_available()) {
             int optval = 1;
-            return setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
-                              (void *)&optval, sizeof(optval));
+            if (setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
+                           (void *)&optval, sizeof(optval)) < 0) {
+                return -1;
+            }
         }
 #endif
 
diff --git a/jdk/src/solaris/native/sun/nio/ch/Net.c b/jdk/src/solaris/native/sun/nio/ch/Net.c
index 92f6f19a43e..8887f59109c 100644
--- a/jdk/src/solaris/native/sun/nio/ch/Net.c
+++ b/jdk/src/solaris/native/sun/nio/ch/Net.c
@@ -435,7 +435,8 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
-                                  jboolean mayNeedConversion, jint level, jint opt, jint arg)
+                                  jboolean mayNeedConversion, jint level,
+                                  jint opt, jint arg, jboolean isIPv6)
 {
     int result;
     struct linger linger;
@@ -478,6 +479,12 @@ Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
                                      JNU_JAVANETPKG "SocketException",
                                      "sun.nio.ch.Net.setIntOption");
     }
+#ifdef __linux__
+    if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS && isIPv6) {
+        // set the V4 option also
+        setsockopt(fdval(env, fdo), IPPROTO_IP, IP_TOS, parg, arglen);
+    }
+#endif
 }
 
 JNIEXPORT jint JNICALL
diff --git a/jdk/src/windows/native/sun/nio/ch/Net.c b/jdk/src/windows/native/sun/nio/ch/Net.c
index 9720d80ef62..fc96ea206ae 100644
--- a/jdk/src/windows/native/sun/nio/ch/Net.c
+++ b/jdk/src/windows/native/sun/nio/ch/Net.c
@@ -319,7 +319,7 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
-                                  jboolean mayNeedConversion, jint level, jint opt, jint arg)
+                                  jboolean mayNeedConversion, jint level, jint opt, jint arg, jboolean ipv6)
 {
     struct linger linger;
     char *parg;
-- 
GitLab


From 6c860a781a7da9ca6702de17d82bb230467bf4eb Mon Sep 17 00:00:00 2001
From: Mike Duigou <mduigou@openjdk.org>
Date: Wed, 25 Jun 2014 12:36:03 -0700
Subject: [PATCH 093/192] 8047795: Collections.checkedList checking bypassed by
 List.replaceAll

Reviewed-by: psandoz, chegar
---
 .../share/classes/java/util/Collections.java  | 23 +++++---
 .../Collections/CheckedListReplaceAll.java    | 50 +++++++++++++++++
 .../Collections/CheckedMapReplaceAll.java     | 54 +++++++++++++++++++
 3 files changed, 120 insertions(+), 7 deletions(-)
 create mode 100644 jdk/test/java/util/Collections/CheckedListReplaceAll.java
 create mode 100644 jdk/test/java/util/Collections/CheckedMapReplaceAll.java

diff --git a/jdk/src/share/classes/java/util/Collections.java b/jdk/src/share/classes/java/util/Collections.java
index e229f5f5dd4..0c0a105513e 100644
--- a/jdk/src/share/classes/java/util/Collections.java
+++ b/jdk/src/share/classes/java/util/Collections.java
@@ -3031,9 +3031,11 @@ public class Collections {
         final Collection<E> c;
         final Class<E> type;
 
-        void typeCheck(Object o) {
+        @SuppressWarnings("unchecked")
+        E typeCheck(Object o) {
             if (o != null && !type.isInstance(o))
                 throw new ClassCastException(badElementMsg(o));
+            return (E) o;
         }
 
         private String badElementMsg(Object o) {
@@ -3042,10 +3044,8 @@ public class Collections {
         }
 
         CheckedCollection(Collection<E> c, Class<E> type) {
-            if (c==null || type == null)
-                throw new NullPointerException();
-            this.c = c;
-            this.type = type;
+            this.c = Objects.requireNonNull(c, "c");
+            this.type = Objects.requireNonNull(type, "type");
         }
 
         public int size()                 { return c.size(); }
@@ -3091,7 +3091,7 @@ public class Collections {
 
         @SuppressWarnings("unchecked")
         Collection<E> checkedCopyOf(Collection<? extends E> coll) {
-            Object[] a = null;
+            Object[] a;
             try {
                 E[] z = zeroLengthElementArray();
                 a = coll.toArray(z);
@@ -3487,10 +3487,19 @@ public class Collections {
             return new CheckedList<>(list.subList(fromIndex, toIndex), type);
         }
 
+        /**
+         * {@inheritDoc}
+         *
+         * @throws ClassCastException if the class of an element returned by the
+         *         operator prevents it from being added to this collection. The
+         *         exception may be thrown after some elements of the list have
+         *         already been replaced.
+         */
         @Override
         public void replaceAll(UnaryOperator<E> operator) {
-            list.replaceAll(operator);
+            list.replaceAll(e -> typeCheck(operator.apply(e)));
         }
+
         @Override
         public void sort(Comparator<? super E> c) {
             list.sort(c);
diff --git a/jdk/test/java/util/Collections/CheckedListReplaceAll.java b/jdk/test/java/util/Collections/CheckedListReplaceAll.java
new file mode 100644
index 00000000000..8ac05d095f2
--- /dev/null
+++ b/jdk/test/java/util/Collections/CheckedListReplaceAll.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8047795
+ * @summary Ensure that replaceAll operator cannot add bad elements
+ * @author  Mike Duigou
+ */
+
+import java.util.*;
+import java.util.function.UnaryOperator;
+
+public class CheckedListReplaceAll {
+    public static void main(String[] args) {
+        List unwrapped = Arrays.asList(new Object[]{1, 2, 3});
+        List<Object> wrapped = Collections.checkedList(unwrapped, Integer.class);
+
+        UnaryOperator evil = e -> (((int) e) % 2 != 0) ? e : "evil";
+
+        try {
+            wrapped.replaceAll(evil);
+            System.out.printf("Bwahaha! I have defeated you! %s\n", wrapped);
+            throw new RuntimeException("String added to checked List<Integer>");
+        } catch (ClassCastException thwarted) {
+            thwarted.printStackTrace(System.out);
+            System.out.println("Curses! Foiled again!");
+        }
+    }
+}
diff --git a/jdk/test/java/util/Collections/CheckedMapReplaceAll.java b/jdk/test/java/util/Collections/CheckedMapReplaceAll.java
new file mode 100644
index 00000000000..05c4da3ad5e
--- /dev/null
+++ b/jdk/test/java/util/Collections/CheckedMapReplaceAll.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8047795
+ * @summary Ensure that replaceAll operator cannot add bad elements
+ * @author  Mike Duigou
+ */
+
+import java.util.*;
+import java.util.function.BiFunction;
+
+public class CheckedMapReplaceAll {
+    public static void main(String[] args) {
+        Map<Integer,Double> unwrapped = new HashMap<>();
+        unwrapped.put(1, 1.0);
+        unwrapped.put(2, 2.0);
+        unwrapped.put(3, 3.0);
+
+        Map<Integer,Double> wrapped = Collections.checkedMap(unwrapped, Integer.class, Double.class);
+
+        BiFunction evil = (k, v) -> (((int)k) % 2 != 0) ? v : "evil";
+
+        try {
+            wrapped.replaceAll(evil);
+            System.out.printf("Bwahaha! I have defeated you! %s\n", wrapped);
+            throw new RuntimeException("String added to checked Map<Integer,Double>");
+        } catch (ClassCastException thwarted) {
+            thwarted.printStackTrace(System.out);
+            System.out.println("Curses! Foiled again!");
+        }
+    }
+}
-- 
GitLab


From 689a3bb8c1d77161e09078d8e764fdacfc9e53a1 Mon Sep 17 00:00:00 2001
From: Rocky Sloan <rocky.sloan@oracle.com>
Date: Thu, 26 Jun 2014 15:58:06 +0400
Subject: [PATCH 094/192] 8044281: Fix doclint warnings (missing javadoc tags)
 in javax.swing.table

Reviewed-by: alexsch
---
 .../javax/swing/table/DefaultTableColumnModel.java  |  2 ++
 .../javax/swing/table/DefaultTableModel.java        |  5 +++++
 .../classes/javax/swing/table/JTableHeader.java     | 10 ++++++++++
 .../javax/swing/table/TableCellRenderer.java        |  5 ++++-
 .../classes/javax/swing/table/TableColumn.java      | 13 ++++++++++++-
 .../classes/javax/swing/table/TableColumnModel.java |  5 ++++-
 6 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java b/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java
index 96193cb35fd..7e02789f837 100644
--- a/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java
+++ b/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java
@@ -716,6 +716,8 @@ public class DefaultTableColumnModel implements TableColumnModel,
 
     /**
      * Creates a new default list selection model.
+     *
+     * @return a newly created default list selection model.
      */
     protected ListSelectionModel createSelectionModel() {
         return new DefaultListSelectionModel();
diff --git a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java
index 74b88c1160d..251738ae40d 100644
--- a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java
+++ b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java
@@ -335,6 +335,8 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl
      *
      *  @see #setColumnCount
      * @since 1.3
+     *
+     * @param rowCount  number of rows in the model
      */
     public void setRowCount(int rowCount) {
         setNumRows(rowCount);
@@ -577,6 +579,9 @@ public class DefaultTableModel extends AbstractTableModel implements Serializabl
      *  element going to row 0, etc.  This method will send a
      *  <code>tableChanged</code> notification message to all the listeners.
      *
+     * @param columnName  identifier of the newly created column
+     * @param columnData  new data to be added to the column
+     *
      * @see #addColumn(Object, Vector)
      */
     public void addColumn(Object columnName, Object[] columnData) {
diff --git a/jdk/src/share/classes/javax/swing/table/JTableHeader.java b/jdk/src/share/classes/javax/swing/table/JTableHeader.java
index 3995cccc288..5e923b1356d 100644
--- a/jdk/src/share/classes/javax/swing/table/JTableHeader.java
+++ b/jdk/src/share/classes/javax/swing/table/JTableHeader.java
@@ -336,6 +336,10 @@ public class JTableHeader extends JComponent implements TableColumnModelListener
      * Returns the index of the column that <code>point</code> lies in, or -1 if it
      * lies out of bounds.
      *
+     * @param point  if this <code>point</code> lies within a column, the index of
+     *               that column will be returned; otherwise it is out of bounds
+     *               and -1 is returned
+     *
      * @return  the index of the column that <code>point</code> lies in, or -1 if it
      *          lies out of bounds
      */
@@ -352,6 +356,8 @@ public class JTableHeader extends JComponent implements TableColumnModelListener
      * When the <code>column</code> parameter is out of bounds this method uses the
      * same conventions as the <code>JTable</code> method <code>getCellRect</code>.
      *
+     * @param column  index of the column
+     *
      * @return  the rectangle containing the header tile at <code>column</code>
      * @see JTable#getCellRect
      */
@@ -883,6 +889,10 @@ public class JTableHeader extends JComponent implements TableColumnModelListener
             /**
              *  Constructs an AccessiblJTableHeaaderEntry
              * @since 1.4
+             *
+             * @param c  the column index
+             * @param p  the parent <code>JTableHeader</code>
+             * @param t  the table <code>JTable</code>
              */
             public AccessibleJTableHeaderEntry(int c, JTableHeader p, JTable t) {
                 parent = p;
diff --git a/jdk/src/share/classes/javax/swing/table/TableCellRenderer.java b/jdk/src/share/classes/javax/swing/table/TableCellRenderer.java
index 892220bc47c..585d9221482 100644
--- a/jdk/src/share/classes/javax/swing/table/TableCellRenderer.java
+++ b/jdk/src/share/classes/javax/swing/table/TableCellRenderer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -86,6 +86,9 @@ public interface TableCellRenderer {
      *                          drawing the header, the value of
      *                          <code>row</code> is -1
      * @param   column          the column index of the cell being drawn
+     *
+     * @return                  the component used for drawing the cell.
+     *
      * @see javax.swing.JComponent#isPaintingForPrint()
      */
     Component getTableCellRendererComponent(JTable table, Object value,
diff --git a/jdk/src/share/classes/javax/swing/table/TableColumn.java b/jdk/src/share/classes/javax/swing/table/TableColumn.java
index 713bf5483dc..1f116c47832 100644
--- a/jdk/src/share/classes/javax/swing/table/TableColumn.java
+++ b/jdk/src/share/classes/javax/swing/table/TableColumn.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -201,6 +201,11 @@ public class TableColumn extends Object implements Serializable {
      *  Cover method, using a default width of 75, a <code>null</code>
      *  renderer and a <code>null</code> editor.
      *  @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
+     *
+     *  @param modelIndex  the index of the column in the model
+     *  that supplies the data for this column in the table;
+     *  the model index remains the same even when columns
+     *  are reordered in the view
      */
     public TableColumn(int modelIndex) {
         this(modelIndex, 75, null, null);
@@ -210,6 +215,12 @@ public class TableColumn extends Object implements Serializable {
      *  Cover method, using a <code>null</code> renderer and a
      *  <code>null</code> editor.
      *  @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
+     *
+     *  @param modelIndex  the index of the column in the model
+     *  that supplies the data for this column in the table;
+     *  the model index remains the same even when columns
+     *  are reordered in the view
+     *  @param width  this column's preferred width and initial width
      */
     public TableColumn(int modelIndex, int width) {
         this(modelIndex, width, null, null);
diff --git a/jdk/src/share/classes/javax/swing/table/TableColumnModel.java b/jdk/src/share/classes/javax/swing/table/TableColumnModel.java
index b6c308c0ea7..eaaa8447ef7 100644
--- a/jdk/src/share/classes/javax/swing/table/TableColumnModel.java
+++ b/jdk/src/share/classes/javax/swing/table/TableColumnModel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -162,6 +162,9 @@ public interface TableColumnModel
      * model.  If the column index for a given X coordinate in 2D space is
      * required, <code>JTable.columnAtPoint</code> can be used instead.
      *
+     * @param xPosition  width from the start of the first column in
+     * the model.
+     *
      * @return  the index of the column; or -1 if no column is found
      * @see javax.swing.JTable#columnAtPoint
      */
-- 
GitLab


From 1d0d27c3127392217b63cf4350e0fc0fd45ea608 Mon Sep 17 00:00:00 2001
From: Rocky Sloan <rocky.sloan@oracle.com>
Date: Thu, 26 Jun 2014 15:59:57 +0400
Subject: [PATCH 095/192] 8044276: Fix doclint warnings (missing javadoc tags)
 in javax.swing.plaf.synth

Reviewed-by: alexsch
---
 .../javax/swing/plaf/synth/SynthButtonUI.java      |  9 ++++++++-
 .../javax/swing/plaf/synth/SynthGraphicsUtils.java | 13 ++++++++++++-
 .../javax/swing/plaf/synth/SynthSeparatorUI.java   | 14 +++++++++++++-
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
index 38900d04b43..4bfa159602c 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -513,6 +513,13 @@ public class SynthButtonUI extends BasicButtonUI implements
     /**
      * Returns the Icon used in calculating the
      * preferred/minimum/maximum size.
+     *
+     * @param b specifies the {@code AbstractButton}
+     * used when calculating the preferred/minimum/maximum
+     * size.
+     *
+     * @return the Icon used in calculating the
+     * preferred/minimum/maximum size.
      */
     protected Icon getSizingIcon(AbstractButton b) {
         Icon icon = getEnabledIcon(b, b.getIcon());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java
index 9f68e956a48..8464dd25e49 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -137,6 +137,9 @@ public class SynthGraphicsUtils {
      * @param iconR Rectangle to place icon bounds in
      * @param textR Rectangle to place text in
      * @param iconTextGap gap between icon and text
+     *
+     * @return by reference, the location to
+     * place the icon and text.
      */
     public String layoutText(SynthContext ss, FontMetrics fm,
                          String text, Icon icon, int hAlign,
@@ -166,6 +169,8 @@ public class SynthGraphicsUtils {
      * @param font Font to use
      * @param metrics FontMetrics, may be ignored
      * @param text Text to get size of.
+     *
+     * @return the size of the passed in string.
      */
     public int computeStringWidth(SynthContext ss, Font font,
                                   FontMetrics metrics, String text) {
@@ -187,6 +192,8 @@ public class SynthGraphicsUtils {
      * @param iconTextGap gap between icon and text
      * @param mnemonicIndex Index into text to render the mnemonic at, -1
      *        indicates no mnemonic.
+     *
+     * @return the minimum size needed to properly render an icon and text.
      */
     public Dimension getMinimumSize(SynthContext ss, Font font, String text,
                       Icon icon, int hAlign, int vAlign, int hTextPosition,
@@ -218,6 +225,8 @@ public class SynthGraphicsUtils {
      * @param iconTextGap gap between icon and text
      * @param mnemonicIndex Index into text to render the mnemonic at, -1
      *        indicates no mnemonic.
+     *
+     * @return the maximum size needed to properly render an icon and text.
      */
     public Dimension getMaximumSize(SynthContext ss, Font font, String text,
                       Icon icon, int hAlign, int vAlign, int hTextPosition,
@@ -263,6 +272,8 @@ public class SynthGraphicsUtils {
      * @param iconTextGap gap between icon and text
      * @param mnemonicIndex Index into text to render the mnemonic at, -1
      *        indicates no mnemonic.
+     *
+     * @return the preferred size needed to properly render an icon and text.
      */
     public Dimension getPreferredSize(SynthContext ss, Font font, String text,
                       Icon icon, int hAlign, int vAlign, int hTextPosition,
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java
index 158e16bd5c9..a222a428080 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -78,6 +78,9 @@ public class SynthSeparatorUI extends SeparatorUI
     /**
      * Installs default setting. This method is called when a
      * {@code LookAndFeel} is installed.
+     *
+     * @param c specifies the {@code JSeparator} for the installed
+     * {@code LookAndFeel}.
      */
     public void installDefaults(JSeparator c) {
         updateStyle(c);
@@ -109,6 +112,9 @@ public class SynthSeparatorUI extends SeparatorUI
     /**
      * Uninstalls default setting. This method is called when a
      * {@code LookAndFeel} is uninstalled.
+     *
+     * @param c specifies the {@code JSeparator} for the (un)installed
+     * {@code LookAndFeel}.
      */
     public void uninstallDefaults(JSeparator c) {
         SynthContext context = getContext(c, ENABLED);
@@ -121,6 +127,9 @@ public class SynthSeparatorUI extends SeparatorUI
     /**
      * Installs listeners. This method is called when a
      * {@code LookAndFeel} is installed.
+     *
+     * @param c specifies the {@code JSeparator} for the installed
+     * {@code LookAndFeel}.
      */
     public void installListeners(JSeparator c) {
         c.addPropertyChangeListener(this);
@@ -129,6 +138,9 @@ public class SynthSeparatorUI extends SeparatorUI
     /**
      * Uninstalls listeners. This method is called when a
      * {@code LookAndFeel} is uninstalled.
+     *
+     * @param c specifies the {@code JSeparator} for the (un)installed
+     * {@code LookAndFeel}.
      */
     public void uninstallListeners(JSeparator c) {
         c.removePropertyChangeListener(this);
-- 
GitLab


From 72fb4c3adf1b6691bf79d54b2e6e77be9fe07970 Mon Sep 17 00:00:00 2001
From: Naoto Sato <naoto@openjdk.org>
Date: Thu, 26 Jun 2014 10:48:43 -0700
Subject: [PATCH 096/192] 8039317: Read currency.data as a resource

Reviewed-by: alanb, chegar
---
 jdk/make/GenerateData.gmk                         |  2 +-
 jdk/make/profile-includes.txt                     |  1 -
 jdk/src/share/classes/java/util/Currency.java     | 10 +++-------
 jdk/test/java/util/Currency/CheckDataVersion.java |  3 ++-
 jdk/test/java/util/Currency/CurrencyTest.java     |  4 ++--
 jdk/test/java/util/Currency/ValidateISO4217.java  |  3 ++-
 6 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/jdk/make/GenerateData.gmk b/jdk/make/GenerateData.gmk
index 28faec4826a..437dd0b1d38 100644
--- a/jdk/make/GenerateData.gmk
+++ b/jdk/make/GenerateData.gmk
@@ -62,7 +62,7 @@ GENDATA += $(GENDATA_UNINAME)
 
 ##########################################################################################
 
-GENDATA_CURDATA := $(JDK_OUTPUTDIR)/lib/currency.data
+GENDATA_CURDATA := $(JDK_OUTPUTDIR)/classes/java/util/currency.data
 
 $(GENDATA_CURDATA): $(JDK_TOPDIR)/make/data/currency/CurrencyData.properties $(BUILD_TOOLS)
 	$(MKDIR) -p $(@D)
diff --git a/jdk/make/profile-includes.txt b/jdk/make/profile-includes.txt
index 2d013fc26fe..17728a7f3d9 100644
--- a/jdk/make/profile-includes.txt
+++ b/jdk/make/profile-includes.txt
@@ -56,7 +56,6 @@ PROFILE_1_JRE_LIB_FILES := \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \
     calendars.properties \
     classlist \
-    currency.data \
     ext/localedata.jar \
     ext/meta-index \
     ext/sunec.jar \
diff --git a/jdk/src/share/classes/java/util/Currency.java b/jdk/src/share/classes/java/util/Currency.java
index 2c4a2e720be..5af9c7193ca 100644
--- a/jdk/src/share/classes/java/util/Currency.java
+++ b/jdk/src/share/classes/java/util/Currency.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -212,13 +212,9 @@ public final class Currency implements Serializable {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             @Override
             public Void run() {
-                String homeDir = System.getProperty("java.home");
                 try {
-                    String dataFile = homeDir + File.separator +
-                            "lib" + File.separator + "currency.data";
                     try (DataInputStream dis = new DataInputStream(
-                             new BufferedInputStream(
-                             new FileInputStream(dataFile)))) {
+                             new BufferedInputStream(getClass().getResourceAsStream("/java/util/currency.data")))) {
                         if (dis.readInt() != MAGIC_NUMBER) {
                             throw new InternalError("Currency data is possibly corrupted");
                         }
@@ -248,7 +244,7 @@ public final class Currency implements Serializable {
                 // look for the properties file for overrides
                 String propsFile = System.getProperty("java.util.currency.data");
                 if (propsFile == null) {
-                    propsFile = homeDir + File.separator + "lib" +
+                    propsFile = System.getProperty("java.home") + File.separator + "lib" +
                         File.separator + "currency.properties";
                 }
                 try {
diff --git a/jdk/test/java/util/Currency/CheckDataVersion.java b/jdk/test/java/util/Currency/CheckDataVersion.java
index be8b9417c68..70320cbb330 100644
--- a/jdk/test/java/util/Currency/CheckDataVersion.java
+++ b/jdk/test/java/util/Currency/CheckDataVersion.java
@@ -64,7 +64,8 @@ class CheckDataVersion {
                 public Object run() {
                     try {
                         String sep = File.separator;
-                        DataInputStream dis = new DataInputStream(new FileInputStream(System.getProperty("java.home")+sep+"lib"+sep+"currency.data"));
+                        DataInputStream dis = new DataInputStream(
+                             new BufferedInputStream(getClass().getResourceAsStream("/java/util/currency.data")));
                         int magic = dis.readInt();
                         if (magic != 0x43757244) {
                             throw new RuntimeException("The magic number in the JRE's currency data is incorrect.  Expected: 0x43757244, Got: 0x"+magic);
diff --git a/jdk/test/java/util/Currency/CurrencyTest.java b/jdk/test/java/util/Currency/CurrencyTest.java
index 6971442bfb0..372071e9371 100644
--- a/jdk/test/java/util/Currency/CurrencyTest.java
+++ b/jdk/test/java/util/Currency/CurrencyTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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,7 @@
 /*
  * @test
  * @bug 4290801 4692419 4693631 5101540 5104960 6296410 6336600 6371531
- *    6488442 7036905
+ *    6488442 7036905 8039317
  * @summary Basic tests for Currency class.
  */
 
diff --git a/jdk/test/java/util/Currency/ValidateISO4217.java b/jdk/test/java/util/Currency/ValidateISO4217.java
index bf433a1c8ed..17c76f79290 100644
--- a/jdk/test/java/util/Currency/ValidateISO4217.java
+++ b/jdk/test/java/util/Currency/ValidateISO4217.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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,6 +23,7 @@
 /*
  * @test
  * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
+ *     8039317
  * @summary Validate ISO 4217 data for Currency class.
  */
 
-- 
GitLab


From 589ee38cbdb09bade6a06873e805ac217a8f3398 Mon Sep 17 00:00:00 2001
From: Ivan Gerasimov <igerasim@openjdk.org>
Date: Fri, 27 Jun 2014 08:03:35 +0400
Subject: [PATCH 097/192] 8048080: (smartcardio)
 javax.smartcardio.Card.openLogicalChannel() dosn't work on MacOSX

Reviewed-by: valeriep
---
 .../security/smartcardio/MUSCLE/pcsclite.h    | 21 ++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h b/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h
index 02e7035b31c..251d83de930 100644
--- a/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h
+++ b/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h
@@ -75,6 +75,13 @@ typedef struct
 }
 SCARD_READERSTATE_A;
 
+typedef struct _SCARD_IO_REQUEST
+{
+        unsigned long dwProtocol;       /* Protocol identifier */
+        unsigned long cbPciLength;      /* Protocol Control Inf Length */
+}
+SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
+
 #else // __APPLE__
 
 #pragma pack(1)
@@ -88,6 +95,13 @@ typedef struct
         unsigned char rgbAtr[MAX_ATR_SIZE];
 }
 SCARD_READERSTATE_A;
+
+typedef struct _SCARD_IO_REQUEST
+{
+        uint32_t dwProtocol;            /* Protocol identifier */
+        uint32_t cbPciLength;           /* Protocol Control Inf Length */
+}
+SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
 #pragma pack()
 
 #endif // __APPLE__
@@ -95,13 +109,6 @@ SCARD_READERSTATE_A;
 typedef SCARD_READERSTATE_A SCARD_READERSTATE, *PSCARD_READERSTATE_A,
         *LPSCARD_READERSTATE_A;
 
-typedef struct _SCARD_IO_REQUEST
-{
-        unsigned long dwProtocol;       /* Protocol identifier */
-        unsigned long cbPciLength;      /* Protocol Control Inf Length */
-}
-SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
-
 typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
 
 extern SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci,
-- 
GitLab


From a8306dd34f5939e299964597e5e9cde922f112b3 Mon Sep 17 00:00:00 2001
From: Henry Jen <henryjen@openjdk.org>
Date: Mon, 16 Jun 2014 09:44:54 -0700
Subject: [PATCH 098/192] 8047721: @since should have JDK version

Reviewed-by: darcy, wetmore
---
 jdk/src/share/classes/java/lang/Package.java               | 1 +
 jdk/src/share/classes/javax/crypto/CipherInputStream.java  | 7 -------
 jdk/src/share/classes/javax/crypto/CipherOutputStream.java | 5 -----
 jdk/src/share/classes/javax/naming/InitialContext.java     | 2 +-
 4 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/jdk/src/share/classes/java/lang/Package.java b/jdk/src/share/classes/java/lang/Package.java
index f59176f558e..95abe98cd4b 100644
--- a/jdk/src/share/classes/java/lang/Package.java
+++ b/jdk/src/share/classes/java/lang/Package.java
@@ -107,6 +107,7 @@ import java.lang.annotation.Annotation;
  * loader to be found.
  *
  * @see ClassLoader#definePackage
+ * @since 1.2
  */
 public class Package implements java.lang.reflect.AnnotatedElement {
     /**
diff --git a/jdk/src/share/classes/javax/crypto/CipherInputStream.java b/jdk/src/share/classes/javax/crypto/CipherInputStream.java
index 0e80a6013d5..f9be4611d83 100644
--- a/jdk/src/share/classes/javax/crypto/CipherInputStream.java
+++ b/jdk/src/share/classes/javax/crypto/CipherInputStream.java
@@ -170,7 +170,6 @@ public class CipherInputStream extends FilterInputStream {
      * @return  the next byte of data, or <code>-1</code> if the end of the
      *          stream is reached.
      * @exception  IOException  if an I/O error occurs.
-     * @since JCE1.2
      */
     public int read() throws IOException {
         if (ostart >= ofinish) {
@@ -196,7 +195,6 @@ public class CipherInputStream extends FilterInputStream {
      *             the stream has been reached.
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.InputStream#read(byte[], int, int)
-     * @since      JCE1.2
      */
     public int read(byte b[]) throws IOException {
         return read(b, 0, b.length);
@@ -217,7 +215,6 @@ public class CipherInputStream extends FilterInputStream {
      *             the stream has been reached.
      * @exception  IOException  if an I/O error occurs.
      * @see        java.io.InputStream#read()
-     * @since      JCE1.2
      */
     public int read(byte b[], int off, int len) throws IOException {
         if (ostart >= ofinish) {
@@ -254,7 +251,6 @@ public class CipherInputStream extends FilterInputStream {
      * @param      n the number of bytes to be skipped.
      * @return     the actual number of bytes skipped.
      * @exception  IOException  if an I/O error occurs.
-     * @since JCE1.2
      */
     public long skip(long n) throws IOException {
         int available = ofinish - ostart;
@@ -277,7 +273,6 @@ public class CipherInputStream extends FilterInputStream {
      * @return     the number of bytes that can be read from this input stream
      *             without blocking.
      * @exception  IOException  if an I/O error occurs.
-     * @since      JCE1.2
      */
     public int available() throws IOException {
         return (ofinish - ostart);
@@ -292,7 +287,6 @@ public class CipherInputStream extends FilterInputStream {
      * stream.
      *
      * @exception  IOException  if an I/O error occurs.
-     * @since JCE1.2
      */
     public void close() throws IOException {
         if (closed) {
@@ -321,7 +315,6 @@ public class CipherInputStream extends FilterInputStream {
      *          <code>mark</code> and <code>reset</code> methods.
      * @see     java.io.InputStream#mark(int)
      * @see     java.io.InputStream#reset()
-     * @since   JCE1.2
      */
     public boolean markSupported() {
         return false;
diff --git a/jdk/src/share/classes/javax/crypto/CipherOutputStream.java b/jdk/src/share/classes/javax/crypto/CipherOutputStream.java
index 6b8d2734901..40e7dc49a6a 100644
--- a/jdk/src/share/classes/javax/crypto/CipherOutputStream.java
+++ b/jdk/src/share/classes/javax/crypto/CipherOutputStream.java
@@ -114,7 +114,6 @@ public class CipherOutputStream extends FilterOutputStream {
      *
      * @param      b   the <code>byte</code>.
      * @exception  IOException  if an I/O error occurs.
-     * @since      JCE1.2
      */
     public void write(int b) throws IOException {
         ibuffer[0] = (byte) b;
@@ -138,7 +137,6 @@ public class CipherOutputStream extends FilterOutputStream {
      * @exception  NullPointerException if <code>b</code> is null.
      * @exception  IOException  if an I/O error occurs.
      * @see        javax.crypto.CipherOutputStream#write(byte[], int, int)
-     * @since JCE1.2
      */
     public void write(byte b[]) throws IOException {
         write(b, 0, b.length);
@@ -152,7 +150,6 @@ public class CipherOutputStream extends FilterOutputStream {
      * @param      off   the start offset in the data.
      * @param      len   the number of bytes to write.
      * @exception  IOException  if an I/O error occurs.
-     * @since      JCE1.2
      */
     public void write(byte b[], int off, int len) throws IOException {
         obuffer = cipher.update(b, off, len);
@@ -174,7 +171,6 @@ public class CipherOutputStream extends FilterOutputStream {
      * the cipher's block size, no bytes will be written out.
      *
      * @exception  IOException  if an I/O error occurs.
-     * @since      JCE1.2
      */
     public void flush() throws IOException {
         if (obuffer != null) {
@@ -198,7 +194,6 @@ public class CipherOutputStream extends FilterOutputStream {
      * stream.
      *
      * @exception  IOException  if an I/O error occurs.
-     * @since      JCE1.2
      */
     public void close() throws IOException {
         if (closed) {
diff --git a/jdk/src/share/classes/javax/naming/InitialContext.java b/jdk/src/share/classes/javax/naming/InitialContext.java
index 7d5b6b45374..867af4ca598 100644
--- a/jdk/src/share/classes/javax/naming/InitialContext.java
+++ b/jdk/src/share/classes/javax/naming/InitialContext.java
@@ -125,7 +125,7 @@ import com.sun.naming.internal.ResourceManager;
  * @see Context
  * @see NamingManager#setInitialContextFactoryBuilder
  *      NamingManager.setInitialContextFactoryBuilder
- * @since JNDI 1.1 / Java 2 Platform, Standard Edition, v 1.3
+ * @since 1.3, JNDI 1.1
  */
 
 public class InitialContext implements Context {
-- 
GitLab


From da1c36533ec21e5f44bc158119a65a2cfca62dc2 Mon Sep 17 00:00:00 2001
From: Mikael Vidstedt <mikael@openjdk.org>
Date: Mon, 16 Jun 2014 16:27:41 -0700
Subject: [PATCH 099/192] 8046769: Set T family feature bit on Niagara systems

Reviewed-by: kvn, iveresov
---
 hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp
index 70dc8f0e5d8..2f3cdf9ac83 100644
--- a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp
+++ b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp
@@ -55,7 +55,7 @@ int VM_Version::platform_features(int features) {
 
   if (detect_niagara()) {
     NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Detected Linux on Niagara");)
-    features = niagara1_m;
+    features = niagara1_m | T_family_m;
   }
 
   return features;
-- 
GitLab


From d39a778d5f92928a5c01bfd5addb84b3e9919d72 Mon Sep 17 00:00:00 2001
From: Alexander Zvegintsev <azvegint@openjdk.org>
Date: Tue, 17 Jun 2014 19:05:06 +0400
Subject: [PATCH 100/192] 8040007: GtkFileDialog strips user inputted filepath

Reviewed-by: anthony, serb
---
 .../solaris/native/sun/awt/gtk2_interface.c   |   2 +
 .../solaris/native/sun/awt/gtk2_interface.h   |   2 +-
 .../sun/awt/sun_awt_X11_GtkFileDialogPeer.c   | 118 ++++++++----------
 3 files changed, 56 insertions(+), 66 deletions(-)

diff --git a/jdk/src/solaris/native/sun/awt/gtk2_interface.c b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
index 0b6cbd63a81..f61fee0b09d 100644
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
@@ -783,6 +783,8 @@ gboolean gtk2_load(JNIEnv *env)
         fp_gtk_widget_show = dl_symbol("gtk_widget_show");
         fp_gtk_main = dl_symbol("gtk_main");
 
+        fp_g_path_get_dirname = dl_symbol("g_path_get_dirname");
+
         /**
          * GLib thread system
          */
diff --git a/jdk/src/solaris/native/sun/awt/gtk2_interface.h b/jdk/src/solaris/native/sun/awt/gtk2_interface.h
index 1523f7464d5..3498e380813 100644
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.h
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.h
@@ -817,7 +817,7 @@ gulong (*fp_g_signal_connect_data)(gpointer instance,
 void (*fp_gtk_widget_show)(GtkWidget *widget);
 void (*fp_gtk_main)(void);
 guint (*fp_gtk_main_level)(void);
-
+gchar* (*fp_g_path_get_dirname) (const gchar *file_name);
 
 /**
  * This function is available for GLIB > 2.20, so it MUST be
diff --git a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
index 9d9678172f4..5eb6fe52d9a 100644
--- a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
+++ b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
@@ -59,7 +59,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
 static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gpointer obj)
 {
     JNIEnv *env;
-    jclass cx;
     jstring filename;
 
     env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -158,62 +157,55 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_setBounds
     fp_gdk_threads_leave();
 }
 
-/**
- * Convert a GSList to an array of filenames (without the parent folder)
+/*
+ * baseDir should be freed by user.
  */
-static jobjectArray toFilenamesArray(JNIEnv *env, GSList* list)
-{
-    jstring str;
-    jclass stringCls;
-    GSList *iterator;
-    jobjectArray array;
-    int i;
-    char* entry;
+static gboolean isFromSameDirectory(GSList* list, gchar** baseDir) {
 
-    if (NULL == list) {
-        return NULL;
-    }
+    GSList *it = list;
+    gchar* prevDir = NULL;
+    gboolean isAllDirsSame = TRUE;
 
-    stringCls = (*env)->FindClass(env, "java/lang/String");
-    if (stringCls == NULL) {
-        (*env)->ExceptionClear(env);
-        JNU_ThrowInternalError(env, "Could not get java.lang.String class");
-        return NULL;
-    }
+    while (it) {
+        gchar* dir = fp_g_path_get_dirname((gchar*) it->data);
 
-    array = (*env)->NewObjectArray(env, fp_gtk_g_slist_length(list), stringCls, NULL);
-    if (array == NULL) {
-        (*env)->ExceptionClear(env);
-        JNU_ThrowInternalError(env, "Could not instantiate array files array");
-        return NULL;
-    }
+        if (prevDir && strcmp(prevDir, dir) != 0) {
+            isAllDirsSame = FALSE;
+            fp_g_free(dir);
+            break;
+        }
 
-    i = 0;
-    for (iterator = list; iterator; iterator = iterator->next) {
-        entry = (char*) iterator->data;
-        entry = strrchr(entry, '/') + 1;
-        str = (*env)->NewStringUTF(env, entry);
-        if (str && !(*env)->ExceptionCheck(env)) {
-            (*env)->SetObjectArrayElement(env, array, i, str);
+        if (!prevDir) {
+            prevDir = strdup(dir);
         }
-        i++;
+        fp_g_free(dir);
+
+        it = it->next;
     }
 
-    return array;
+    if (isAllDirsSame) {
+        *baseDir = prevDir;
+    } else {
+        free(prevDir);
+        *baseDir = strdup("/");
+    }
+
+    return isAllDirsSame;
 }
 
 /**
- * Convert a GSList to an array of filenames (with the parent folder)
+ * Convert a GSList to an array of filenames
  */
-static jobjectArray toPathAndFilenamesArray(JNIEnv *env, GSList* list)
+static jobjectArray toFilenamesArray(JNIEnv *env, GSList* list, jstring* jcurrent_folder)
 {
     jstring str;
     jclass stringCls;
     GSList *iterator;
     jobjectArray array;
     int i;
-    char* entry;
-
+    gchar* entry;
+    gchar * baseDir;
+    gboolean isFromSameDir;
 
     if (list == NULL) {
         return NULL;
@@ -233,12 +225,23 @@ static jobjectArray toPathAndFilenamesArray(JNIEnv *env, GSList* list)
         return NULL;
     }
 
-    i = 0;
-    for (iterator = list; iterator; iterator = iterator->next) {
-        entry = (char*) iterator->data;
+    isFromSameDir = isFromSameDirectory(list, &baseDir);
 
-        //check for leading slash.
-        if (entry[0] == '/') {
+    *jcurrent_folder = (*env)->NewStringUTF(env, baseDir);
+    if (*jcurrent_folder == NULL) {
+        free(baseDir);
+        return NULL;
+    }
+
+    for (iterator = list, i=0;
+            iterator;
+            iterator = iterator->next, i++) {
+
+        entry = (gchar*) iterator->data;
+
+        if (isFromSameDir) {
+            entry = strrchr(entry, '/') + 1;
+        } else if (entry[0] == '/') {
             entry++;
         }
 
@@ -246,48 +249,33 @@ static jobjectArray toPathAndFilenamesArray(JNIEnv *env, GSList* list)
         if (str && !(*env)->ExceptionCheck(env)) {
             (*env)->SetObjectArrayElement(env, array, i, str);
         }
-        i++;
     }
 
+    free(baseDir);
     return array;
 }
 
 static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
 {
     JNIEnv *env;
-    char *current_folder;
     GSList *filenames;
-    jclass cx;
-    jstring jcurrent_folder;
+    jstring jcurrent_folder = NULL;
     jobjectArray jfilenames;
 
     env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
-    current_folder = NULL;
     filenames = NULL;
-    gboolean full_path_names = FALSE;
 
     if (responseId == GTK_RESPONSE_ACCEPT) {
-        current_folder = fp_gtk_file_chooser_get_current_folder(
-                GTK_FILE_CHOOSER(aDialog));
-        if (current_folder == NULL) {
-            full_path_names = TRUE;
-        }
         filenames = fp_gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(aDialog));
     }
-    if (full_path_names) {
-        //This is a hack for use with "Recent Folders" in gtk where each
-        //file could have its own directory.
-        jfilenames = toPathAndFilenamesArray(env, filenames);
-        jcurrent_folder = (*env)->NewStringUTF(env, "/");
-    } else {
-        jfilenames = toFilenamesArray(env, filenames);
-        jcurrent_folder = (*env)->NewStringUTF(env, current_folder);
-    }
+
+    jfilenames = toFilenamesArray(env, filenames, &jcurrent_folder);
+
     if (!(*env)->ExceptionCheck(env)) {
         (*env)->CallVoidMethod(env, obj, setFileInternalMethodID,
                                jcurrent_folder, jfilenames);
     }
-    fp_g_free(current_folder);
+
     quit(env, (jobject)obj, TRUE);
 }
 
-- 
GitLab


From 7d153c461edc280f412c93992fc4ab19279a77bf Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty" <dcubed@openjdk.org>
Date: Tue, 17 Jun 2014 12:54:01 -0700
Subject: [PATCH 101/192] 8046758: cleanup non-indent white space issues prior
 to Contended Locking cleanup bucket

Checkpoint do_space_filter.ksh cleanups for Contended Locking.

Reviewed-by: sspitsyn, coleenp
---
 hotspot/src/os/bsd/vm/os_bsd.cpp              |  140 +-
 hotspot/src/os/linux/vm/os_linux.cpp          |  148 +-
 hotspot/src/os/solaris/vm/os_solaris.cpp      |  230 +--
 hotspot/src/os/windows/vm/os_windows.cpp      |  196 +--
 .../src/share/vm/runtime/objectMonitor.cpp    | 1324 ++++++++---------
 .../src/share/vm/runtime/objectMonitor.hpp    |  164 +-
 .../src/share/vm/runtime/sharedRuntime.cpp    |  152 +-
 hotspot/src/share/vm/runtime/synchronizer.cpp |  486 +++---
 hotspot/src/share/vm/runtime/thread.cpp       |  270 ++--
 hotspot/src/share/vm/runtime/thread.hpp       |   94 +-
 10 files changed, 1602 insertions(+), 1602 deletions(-)

diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
index 9d817380e3e..7facffe684d 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -786,7 +786,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
       case os::java_thread:
         // Java threads use ThreadStackSize which default value can be
         // changed with the flag -Xss
-        assert (JavaThread::stack_size_at_create() > 0, "this should be set");
+        assert(JavaThread::stack_size_at_create() > 0, "this should be set");
         stack_size = JavaThread::stack_size_at_create();
         break;
       case os::compiler_thread:
@@ -1303,7 +1303,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       // Really shouldn't be NULL, but check can't hurt
       if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
         continue; // skip the empty path values
@@ -1316,7 +1316,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1467,7 +1467,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
 
   bool failed_to_read_elf_head=
     (sizeof(elf_head)!=
-        (::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
+        (::read(file_descriptor, &elf_head,sizeof(elf_head))));
 
   ::close(file_descriptor);
   if (failed_to_read_elf_head) {
@@ -1565,7 +1565,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
   int running_arch_index=-1;
 
-  for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
+  for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
     if (running_arch_code == arch_array[i].code) {
       running_arch_index    = i;
     }
@@ -1596,7 +1596,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
 #endif // !S390
 
   if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
-    if ( lib_arch.name!=NULL ) {
+    if (lib_arch.name!=NULL) {
       ::snprintf(diag_msg_buf, diag_msg_max_length-1,
         " (Possible cause: can't load %s-bit .so on a %s-bit platform)",
         lib_arch.name, arch_array[running_arch_index].name);
@@ -2598,7 +2598,7 @@ void os::yield() {
   sched_yield();
 }
 
-os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN ;}
+os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
 
 void os::yield_all() {
   // Yields to all threads, including threads with lower priorities
@@ -2686,7 +2686,7 @@ static int prio_init() {
 }
 
 OSReturn os::set_native_priority(Thread* thread, int newpri) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) return OS_OK;
 
 #ifdef __OpenBSD__
   // OpenBSD pthread_setprio starves low priority threads
@@ -2713,7 +2713,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
 }
 
 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) {
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
     *priority_ptr = java_to_os_priority[NormPriority];
     return OS_OK;
   }
@@ -3079,7 +3079,7 @@ bool os::Bsd::chained_handler(int sig, siginfo_t* siginfo, void* context) {
 }
 
 struct sigaction* os::Bsd::get_preinstalled_handler(int sig) {
-  if ((( (unsigned int)1 << sig ) & sigs) != 0) {
+  if ((((unsigned int)1 << sig) & sigs) != 0) {
     return &sigact[sig];
   }
   return NULL;
@@ -3300,7 +3300,7 @@ static void print_signal_handler(outputStream* st, int sig,
 
   address rh = VMError::get_resetted_sighandler(sig);
   // May be, handler was resetted by VMError?
-  if(rh != NULL) {
+  if (rh != NULL) {
     handler = rh;
     sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
   }
@@ -3309,11 +3309,11 @@ static void print_signal_handler(outputStream* st, int sig,
   os::Posix::print_sa_flags(st, sa.sa_flags);
 
   // Check: is it our handler?
-  if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
+  if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
      handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) {
     // It is our signal handler
     // check for flags, reset system-used one!
-    if((int)sa.sa_flags != os::Bsd::get_our_sigflags(sig)) {
+    if ((int)sa.sa_flags != os::Bsd::get_our_sigflags(sig)) {
       st->print(
                 ", flags was changed from " PTR32_FORMAT ", consider using jsig library",
                 os::Bsd::get_our_sigflags(sig));
@@ -3382,10 +3382,10 @@ void os::Bsd::check_signal_handler(int sig) {
 
   address thisHandler = (act.sa_flags & SA_SIGINFO)
     ? CAST_FROM_FN_PTR(address, act.sa_sigaction)
-    : CAST_FROM_FN_PTR(address, act.sa_handler) ;
+    : CAST_FROM_FN_PTR(address, act.sa_handler);
 
 
-  switch(sig) {
+  switch (sig) {
   case SIGSEGV:
   case SIGBUS:
   case SIGFPE:
@@ -3515,22 +3515,22 @@ jint os::init_2(void)
 {
   // Allocate a single page and mark it as readable for safepoint polling
   address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-  guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" );
+  guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
 
-  os::set_polling_page( polling_page );
+  os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if(Verbose && PrintMiscellaneous)
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
     address mem_serialize_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-    guarantee( mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page( mem_serialize_page );
+    guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -3631,13 +3631,13 @@ void os::init_3(void) { }
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
-  if( !guard_memory((char*)_polling_page, Bsd::page_size()) )
+  if (!guard_memory((char*)_polling_page, Bsd::page_size()))
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
-  if( !bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) {
+  if (!bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) {
     fatal("Could not enable polling page");
   }
 };
@@ -4229,9 +4229,9 @@ static struct timespec* compute_abstime(struct timespec* abstime, jlong millis)
 
 int os::PlatformEvent::TryPark() {
   for (;;) {
-    const int v = _Event ;
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (Atomic::cmpxchg (0, &_Event, v) == v) return v  ;
+    const int v = _Event;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
   }
 }
 
@@ -4239,18 +4239,18 @@ void os::PlatformEvent::park() {       // AKA "down()"
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
   // TODO: assert that _Assoc != NULL or _Assoc == Self
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
+  guarantee(v >= 0, "invariant");
   if (v == 0) {
      // Do this the hard way by blocking ...
      int status = pthread_mutex_lock(_mutex);
      assert_status(status == 0, status, "mutex_lock");
-     guarantee (_nParked == 0, "invariant") ;
-     ++ _nParked ;
+     guarantee(_nParked == 0, "invariant");
+     ++_nParked;
      while (_Event < 0) {
         status = pthread_cond_wait(_cond, _mutex);
         // for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
@@ -4258,28 +4258,28 @@ void os::PlatformEvent::park() {       // AKA "down()"
         if (status == ETIMEDOUT) { status = EINTR; }
         assert_status(status == 0 || status == EINTR, status, "cond_wait");
      }
-     -- _nParked ;
+     --_nParked;
 
-    _Event = 0 ;
+    _Event = 0;
      status = pthread_mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other.
     OrderAccess::fence();
   }
-  guarantee (_Event >= 0, "invariant") ;
+  guarantee(_Event >= 0, "invariant");
 }
 
 int os::PlatformEvent::park(jlong millis) {
-  guarantee (_nParked == 0, "invariant") ;
+  guarantee(_nParked == 0, "invariant");
 
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
-  if (v != 0) return OS_OK ;
+  guarantee(v >= 0, "invariant");
+  if (v != 0) return OS_OK;
 
   // We do this the hard way, by blocking the thread.
   // Consider enforcing a minimum timeout value.
@@ -4289,8 +4289,8 @@ int os::PlatformEvent::park(jlong millis) {
   int ret = OS_TIMEOUT;
   int status = pthread_mutex_lock(_mutex);
   assert_status(status == 0, status, "mutex_lock");
-  guarantee (_nParked == 0, "invariant") ;
-  ++_nParked ;
+  guarantee(_nParked == 0, "invariant");
+  ++_nParked;
 
   // Object.wait(timo) will return because of
   // (a) notification
@@ -4308,24 +4308,24 @@ int os::PlatformEvent::park(jlong millis) {
   while (_Event < 0) {
     status = os::Bsd::safe_cond_timedwait(_cond, _mutex, &abst);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (_cond);
-      pthread_cond_init (_cond, NULL) ;
+      pthread_cond_destroy(_cond);
+      pthread_cond_init(_cond, NULL);
     }
     assert_status(status == 0 || status == EINTR ||
                   status == ETIMEDOUT,
                   status, "cond_timedwait");
-    if (!FilterSpuriousWakeups) break ;                 // previous semantics
-    if (status == ETIMEDOUT) break ;
+    if (!FilterSpuriousWakeups) break;                 // previous semantics
+    if (status == ETIMEDOUT) break;
     // We consume and ignore EINTR and spurious wakeups.
   }
-  --_nParked ;
+  --_nParked;
   if (_Event >= 0) {
      ret = OS_OK;
   }
-  _Event = 0 ;
+  _Event = 0;
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
-  assert (_nParked == 0, "invariant") ;
+  assert(_nParked == 0, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other.
   OrderAccess::fence();
@@ -4409,7 +4409,7 @@ void os::PlatformEvent::unpark() {
  */
 
 static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) {
-  assert (time > 0, "convertTime");
+  assert(time > 0, "convertTime");
 
   struct timeval now;
   int status = gettimeofday(&now, NULL);
@@ -4470,7 +4470,7 @@ void Parker::park(bool isAbsolute, jlong time) {
 
   // Next, demultiplex/decode time arguments
   struct timespec absTime;
-  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
+  if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
     return;
   }
   if (time > 0) {
@@ -4492,11 +4492,11 @@ void Parker::park(bool isAbsolute, jlong time) {
     return;
   }
 
-  int status ;
+  int status;
   if (_counter > 0)  { // no wait needed
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other and Java-level accesses.
     OrderAccess::fence();
@@ -4516,12 +4516,12 @@ void Parker::park(bool isAbsolute, jlong time) {
   // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
 
   if (time == 0) {
-    status = pthread_cond_wait (_cond, _mutex) ;
+    status = pthread_cond_wait(_cond, _mutex);
   } else {
-    status = os::Bsd::safe_cond_timedwait (_cond, _mutex, &absTime) ;
+    status = os::Bsd::safe_cond_timedwait(_cond, _mutex, &absTime);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (_cond) ;
-      pthread_cond_init    (_cond, NULL);
+      pthread_cond_destroy(_cond);
+      pthread_cond_init(_cond, NULL);
     }
   }
   assert_status(status == 0 || status == EINTR ||
@@ -4532,9 +4532,9 @@ void Parker::park(bool isAbsolute, jlong time) {
   pthread_sigmask(SIG_SETMASK, &oldsigs, NULL);
 #endif
 
-  _counter = 0 ;
-  status = pthread_mutex_unlock(_mutex) ;
-  assert_status(status == 0, status, "invariant") ;
+  _counter = 0;
+  status = pthread_mutex_unlock(_mutex);
+  assert_status(status == 0, status, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other and Java-level accesses.
   OrderAccess::fence();
@@ -4546,26 +4546,26 @@ void Parker::park(bool isAbsolute, jlong time) {
 }
 
 void Parker::unpark() {
-  int s, status ;
+  int s, status;
   status = pthread_mutex_lock(_mutex);
-  assert (status == 0, "invariant") ;
+  assert(status == 0, "invariant");
   s = _counter;
   _counter = 1;
   if (s < 1) {
      if (WorkAroundNPTLTimedWaitHang) {
-        status = pthread_cond_signal (_cond) ;
-        assert (status == 0, "invariant") ;
+        status = pthread_cond_signal(_cond);
+        assert(status == 0, "invariant");
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant") ;
+        assert(status == 0, "invariant");
      } else {
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant") ;
-        status = pthread_cond_signal (_cond) ;
-        assert (status == 0, "invariant") ;
+        assert(status == 0, "invariant");
+        status = pthread_cond_signal(_cond);
+        assert(status == 0, "invariant");
      }
   } else {
     pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
   }
 }
 
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 89ffc72d972..7057bcd557b 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -862,7 +862,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
       case os::java_thread:
         // Java threads use ThreadStackSize which default value can be
         // changed with the flag -Xss
-        assert (JavaThread::stack_size_at_create() > 0, "this should be set");
+        assert(JavaThread::stack_size_at_create() > 0, "this should be set");
         stack_size = JavaThread::stack_size_at_create();
         break;
       case os::compiler_thread:
@@ -1097,7 +1097,7 @@ static bool find_vma(address addr, address* vma_low, address* vma_high) {
         if (low <= addr && addr < high) {
            if (vma_low)  *vma_low  = low;
            if (vma_high) *vma_high = high;
-           fclose (fp);
+           fclose(fp);
            return true;
         }
       }
@@ -1420,7 +1420,7 @@ void os::Linux::fast_thread_clock_init() {
   // must return at least tp.tv_sec == 0 which means a resolution
   // better than 1 sec. This is extra check for reliability.
 
-  if(pthread_getcpuclockid_func &&
+  if (pthread_getcpuclockid_func &&
      pthread_getcpuclockid_func(_main_thread, &clockid) == 0 &&
      sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) {
 
@@ -1630,7 +1630,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       // Really shouldn't be NULL, but check can't hurt
       if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
         continue; // skip the empty path values
@@ -1642,7 +1642,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1906,7 +1906,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
 
   bool failed_to_read_elf_head=
     (sizeof(elf_head)!=
-        (::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
+        (::read(file_descriptor, &elf_head,sizeof(elf_head))));
 
   ::close(file_descriptor);
   if (failed_to_read_elf_head) {
@@ -1988,7 +1988,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
   int running_arch_index=-1;
 
-  for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
+  for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
     if (running_arch_code == arch_array[i].code) {
       running_arch_index    = i;
     }
@@ -2019,7 +2019,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
 #endif // !S390
 
   if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
-    if ( lib_arch.name!=NULL ) {
+    if (lib_arch.name!=NULL) {
       ::snprintf(diag_msg_buf, diag_msg_max_length-1,
         " (Possible cause: can't load %s-bit .so on a %s-bit platform)",
         lib_arch.name, arch_array[running_arch_index].name);
@@ -3793,7 +3793,7 @@ void os::yield() {
   sched_yield();
 }
 
-os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN ;}
+os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
 
 void os::yield_all() {
   // Yields to all threads, including threads with lower priorities
@@ -3858,14 +3858,14 @@ static int prio_init() {
 }
 
 OSReturn os::set_native_priority(Thread* thread, int newpri) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) return OS_OK;
 
   int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
   return (ret == 0) ? OS_OK : OS_ERR;
 }
 
 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
-  if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) {
+  if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
     *priority_ptr = java_to_os_priority[NormPriority];
     return OS_OK;
   }
@@ -4219,7 +4219,7 @@ bool os::Linux::chained_handler(int sig, siginfo_t* siginfo, void* context) {
 }
 
 struct sigaction* os::Linux::get_preinstalled_handler(int sig) {
-  if ((( (unsigned int)1 << sig ) & sigs) != 0) {
+  if ((((unsigned int)1 << sig) & sigs) != 0) {
     return &sigact[sig];
   }
   return NULL;
@@ -4423,7 +4423,7 @@ static void print_signal_handler(outputStream* st, int sig,
 
   address rh = VMError::get_resetted_sighandler(sig);
   // May be, handler was resetted by VMError?
-  if(rh != NULL) {
+  if (rh != NULL) {
     handler = rh;
     sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
   }
@@ -4432,11 +4432,11 @@ static void print_signal_handler(outputStream* st, int sig,
   os::Posix::print_sa_flags(st, sa.sa_flags);
 
   // Check: is it our handler?
-  if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
+  if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
      handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) {
     // It is our signal handler
     // check for flags, reset system-used one!
-    if((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) {
+    if ((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) {
       st->print(
                 ", flags was changed from " PTR32_FORMAT ", consider using jsig library",
                 os::Linux::get_our_sigflags(sig));
@@ -4507,10 +4507,10 @@ void os::Linux::check_signal_handler(int sig) {
 
   address thisHandler = (act.sa_flags & SA_SIGINFO)
     ? CAST_FROM_FN_PTR(address, act.sa_sigaction)
-    : CAST_FROM_FN_PTR(address, act.sa_handler) ;
+    : CAST_FROM_FN_PTR(address, act.sa_handler);
 
 
-  switch(sig) {
+  switch (sig) {
   case SIGSEGV:
   case SIGBUS:
   case SIGFPE:
@@ -4662,22 +4662,22 @@ jint os::init_2(void)
 
   // Allocate a single page and mark it as readable for safepoint polling
   address polling_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-  guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" );
+  guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
 
-  os::set_polling_page( polling_page );
+  os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if(Verbose && PrintMiscellaneous)
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
     address mem_serialize_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-    guarantee( mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page( mem_serialize_page );
+    guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -4819,13 +4819,13 @@ void os::init_3(void) {
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
-  if( !guard_memory((char*)_polling_page, Linux::page_size()) )
+  if (!guard_memory((char*)_polling_page, Linux::page_size()))
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
-  if( !linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
+  if (!linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
     fatal("Could not enable polling page");
   }
 };
@@ -5288,7 +5288,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
 
   snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid);
   fp = fopen(proc_name, "r");
-  if ( fp == NULL ) return -1;
+  if (fp == NULL) return -1;
   statlen = fread(stat, 1, 2047, fp);
   stat[statlen] = '\0';
   fclose(fp);
@@ -5300,7 +5300,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
   // We don't really need to know the command string, just find the last
   // occurrence of ")" and then start parsing from there. See bug 4726580.
   s = strrchr(stat, ')');
-  if (s == NULL ) return -1;
+  if (s == NULL) return -1;
 
   // Skip blank chars
   do s++; while (isspace(*s));
@@ -5309,7 +5309,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
                  &cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
                  &ldummy, &ldummy, &ldummy, &ldummy, &ldummy,
                  &user_time, &sys_time);
-  if ( count != 13 ) return -1;
+  if (count != 13) return -1;
   if (user_sys_cpu_time) {
     return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec);
   } else {
@@ -5468,9 +5468,9 @@ static struct timespec* compute_abstime(timespec* abstime, jlong millis) {
 
 int os::PlatformEvent::TryPark() {
   for (;;) {
-    const int v = _Event ;
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (Atomic::cmpxchg (0, &_Event, v) == v) return v  ;
+    const int v = _Event;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
   }
 }
 
@@ -5478,18 +5478,18 @@ void os::PlatformEvent::park() {       // AKA "down()"
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
   // TODO: assert that _Assoc != NULL or _Assoc == Self
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
+  guarantee(v >= 0, "invariant");
   if (v == 0) {
      // Do this the hard way by blocking ...
      int status = pthread_mutex_lock(_mutex);
      assert_status(status == 0, status, "mutex_lock");
-     guarantee (_nParked == 0, "invariant") ;
-     ++ _nParked ;
+     guarantee(_nParked == 0, "invariant");
+     ++_nParked;
      while (_Event < 0) {
         status = pthread_cond_wait(_cond, _mutex);
         // for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
@@ -5497,28 +5497,28 @@ void os::PlatformEvent::park() {       // AKA "down()"
         if (status == ETIME) { status = EINTR; }
         assert_status(status == 0 || status == EINTR, status, "cond_wait");
      }
-     -- _nParked ;
+     --_nParked;
 
-    _Event = 0 ;
+    _Event = 0;
      status = pthread_mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other.
     OrderAccess::fence();
   }
-  guarantee (_Event >= 0, "invariant") ;
+  guarantee(_Event >= 0, "invariant");
 }
 
 int os::PlatformEvent::park(jlong millis) {
-  guarantee (_nParked == 0, "invariant") ;
+  guarantee(_nParked == 0, "invariant");
 
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
-  if (v != 0) return OS_OK ;
+  guarantee(v >= 0, "invariant");
+  if (v != 0) return OS_OK;
 
   // We do this the hard way, by blocking the thread.
   // Consider enforcing a minimum timeout value.
@@ -5528,8 +5528,8 @@ int os::PlatformEvent::park(jlong millis) {
   int ret = OS_TIMEOUT;
   int status = pthread_mutex_lock(_mutex);
   assert_status(status == 0, status, "mutex_lock");
-  guarantee (_nParked == 0, "invariant") ;
-  ++_nParked ;
+  guarantee(_nParked == 0, "invariant");
+  ++_nParked;
 
   // Object.wait(timo) will return because of
   // (a) notification
@@ -5547,24 +5547,24 @@ int os::PlatformEvent::park(jlong millis) {
   while (_Event < 0) {
     status = os::Linux::safe_cond_timedwait(_cond, _mutex, &abst);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (_cond);
-      pthread_cond_init (_cond, os::Linux::condAttr()) ;
+      pthread_cond_destroy(_cond);
+      pthread_cond_init(_cond, os::Linux::condAttr());
     }
     assert_status(status == 0 || status == EINTR ||
                   status == ETIME || status == ETIMEDOUT,
                   status, "cond_timedwait");
-    if (!FilterSpuriousWakeups) break ;                 // previous semantics
-    if (status == ETIME || status == ETIMEDOUT) break ;
+    if (!FilterSpuriousWakeups) break;                 // previous semantics
+    if (status == ETIME || status == ETIMEDOUT) break;
     // We consume and ignore EINTR and spurious wakeups.
   }
-  --_nParked ;
+  --_nParked;
   if (_Event >= 0) {
      ret = OS_OK;
   }
-  _Event = 0 ;
+  _Event = 0;
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
-  assert (_nParked == 0, "invariant") ;
+  assert(_nParked == 0, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other.
   OrderAccess::fence();
@@ -5647,7 +5647,7 @@ void os::PlatformEvent::unpark() {
  */
 
 static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
-  assert (time > 0, "convertTime");
+  assert(time > 0, "convertTime");
   time_t max_secs = 0;
 
   if (!os::supports_monotonic_clock() || isAbsolute) {
@@ -5726,7 +5726,7 @@ void Parker::park(bool isAbsolute, jlong time) {
 
   // Next, demultiplex/decode time arguments
   timespec absTime;
-  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
+  if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
     return;
   }
   if (time > 0) {
@@ -5748,11 +5748,11 @@ void Parker::park(bool isAbsolute, jlong time) {
     return;
   }
 
-  int status ;
+  int status;
   if (_counter > 0)  { // no wait needed
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other and Java-level accesses.
     OrderAccess::fence();
@@ -5774,13 +5774,13 @@ void Parker::park(bool isAbsolute, jlong time) {
   assert(_cur_index == -1, "invariant");
   if (time == 0) {
     _cur_index = REL_INDEX; // arbitrary choice when not timed
-    status = pthread_cond_wait (&_cond[_cur_index], _mutex) ;
+    status = pthread_cond_wait(&_cond[_cur_index], _mutex);
   } else {
     _cur_index = isAbsolute ? ABS_INDEX : REL_INDEX;
-    status = os::Linux::safe_cond_timedwait (&_cond[_cur_index], _mutex, &absTime) ;
+    status = os::Linux::safe_cond_timedwait(&_cond[_cur_index], _mutex, &absTime);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (&_cond[_cur_index]) ;
-      pthread_cond_init    (&_cond[_cur_index], isAbsolute ? NULL : os::Linux::condAttr());
+      pthread_cond_destroy(&_cond[_cur_index]);
+      pthread_cond_init(&_cond[_cur_index], isAbsolute ? NULL : os::Linux::condAttr());
     }
   }
   _cur_index = -1;
@@ -5792,9 +5792,9 @@ void Parker::park(bool isAbsolute, jlong time) {
   pthread_sigmask(SIG_SETMASK, &oldsigs, NULL);
 #endif
 
-  _counter = 0 ;
-  status = pthread_mutex_unlock(_mutex) ;
-  assert_status(status == 0, status, "invariant") ;
+  _counter = 0;
+  status = pthread_mutex_unlock(_mutex);
+  assert_status(status == 0, status, "invariant");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other and Java-level accesses.
   OrderAccess::fence();
@@ -5806,9 +5806,9 @@ void Parker::park(bool isAbsolute, jlong time) {
 }
 
 void Parker::unpark() {
-  int s, status ;
+  int s, status;
   status = pthread_mutex_lock(_mutex);
-  assert (status == 0, "invariant") ;
+  assert(status == 0, "invariant");
   s = _counter;
   _counter = 1;
   if (s < 1) {
@@ -5817,22 +5817,22 @@ void Parker::unpark() {
       // thread is definitely parked
       if (WorkAroundNPTLTimedWaitHang) {
         status = pthread_cond_signal (&_cond[_cur_index]);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
       } else {
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
         status = pthread_cond_signal (&_cond[_cur_index]);
-        assert (status == 0, "invariant");
+        assert(status == 0, "invariant");
       }
     } else {
       pthread_mutex_unlock(_mutex);
-      assert (status == 0, "invariant") ;
+      assert(status == 0, "invariant");
     }
   } else {
     pthread_mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
   }
 }
 
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index 5272029561b..77cc8abb192 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -212,13 +212,13 @@ Thread* ThreadLocalStorage::get_thread_via_cache_slowly(uintptr_t raw_id,
               "sp must be inside of selected thread stack");
 
     thread->set_self_raw_id(raw_id);  // mark for quick retrieval
-    _get_thread_cache[ index ] = thread;
+    _get_thread_cache[index] = thread;
   }
   return thread;
 }
 
 
-static const double all_zero[ sizeof(Thread) / sizeof(double) + 1 ] = {0};
+static const double all_zero[sizeof(Thread) / sizeof(double) + 1] = {0};
 #define NO_CACHED_THREAD ((Thread*)all_zero)
 
 void ThreadLocalStorage::pd_set_thread(Thread* thread) {
@@ -270,8 +270,8 @@ static inline stack_t get_stack_info() {
 }
 
 address os::current_stack_base() {
-  int r = thr_main() ;
-  guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
+  int r = thr_main();
+  guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
   bool is_primordial_thread = r;
 
   // Workaround 4352906, avoid calls to thr_stksegment by
@@ -293,9 +293,9 @@ address os::current_stack_base() {
 size_t os::current_stack_size() {
   size_t size;
 
-  int r = thr_main() ;
-  guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
-  if(!r) {
+  int r = thr_main();
+  guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
+  if (!r) {
     size = get_stack_info().ss_size;
   } else {
     struct rlimit limits;
@@ -409,7 +409,7 @@ static bool find_processors_in_pset(psetid_t        pset,
 
 static bool find_processors_online(processorid_t** id_array,
                                    uint*           id_length) {
-  const processorid_t MAX_PROCESSOR_ID = 100000 ;
+  const processorid_t MAX_PROCESSOR_ID = 100000;
   // Find the number of processors online.
   *id_length = sysconf(_SC_NPROCESSORS_ONLN);
   // Make up an array to hold their ids.
@@ -436,7 +436,7 @@ static bool find_processors_online(processorid_t** id_array,
       // we've got.  Note that in the worst case find_processors_online() could
       // return an empty set.  (As a fall-back in the case of the empty set we
       // could just return the ID of the current processor).
-      *id_length = found ;
+      *id_length = found;
   }
 
   return true;
@@ -552,13 +552,13 @@ bool os::bind_to_processor(uint processor_id) {
 }
 
 bool os::getenv(const char* name, char* buffer, int len) {
-  char* val = ::getenv( name );
-  if ( val == NULL
+  char* val = ::getenv(name);
+  if (val == NULL
   ||   strlen(val) + 1  >  len ) {
     if (len > 0)  buffer[0] = 0; // return a null string
     return false;
   }
-  strcpy( buffer, val );
+  strcpy(buffer, val);
   return true;
 }
 
@@ -672,7 +672,7 @@ void os::init_system_properties_values() {
 
     // Determine search path count and required buffer size.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf,  mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
       vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror());
     }
 
@@ -683,7 +683,7 @@ void os::init_system_properties_values() {
 
     // Obtain search path information.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf,  mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
       FREE_C_HEAP_ARRAY(char, info, mtInternal);
       vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
     }
@@ -794,7 +794,7 @@ bool os::obsolete_option(const JavaVMOption *option)
 bool os::Solaris::valid_stack_address(Thread* thread, address sp) {
   address  stackStart  = (address)thread->stack_base();
   address  stackEnd    = (address)(stackStart - (address)thread->stack_size());
-  if (sp < stackStart && sp >= stackEnd ) return true;
+  if (sp < stackStart && sp >= stackEnd) return true;
   return false;
 }
 
@@ -819,8 +819,8 @@ extern "C" void* java_start(void* thread_addr) {
   Thread* thread = (Thread*)thread_addr;
   OSThread* osthr = thread->osthread();
 
-  osthr->set_lwp_id( _lwp_self() );  // Store lwp in case we are bound
-  thread->_schedctl = (void *) schedctl_init () ;
+  osthr->set_lwp_id(_lwp_self());  // Store lwp in case we are bound
+  thread->_schedctl = (void *) schedctl_init();
 
   if (UseNUMA) {
     int lgrp_id = os::numa_get_group_id();
@@ -839,8 +839,8 @@ extern "C" void* java_start(void* thread_addr) {
   // in java_to_os_priority. So we save the native priority
   // in the osThread and recall it here.
 
-  if ( osthr->thread_id() != -1 ) {
-    if ( UseThreadPriorities ) {
+  if (osthr->thread_id() != -1) {
+    if (UseThreadPriorities) {
       int prio = osthr->native_priority();
       if (ThreadPriorityVerbose) {
         tty->print_cr("Starting Thread " INTPTR_FORMAT ", LWP is "
@@ -882,7 +882,7 @@ static OSThread* create_os_thread(Thread* thread, thread_t thread_id) {
   // Store info on the Solaris thread into the OSThread
   osthread->set_thread_id(thread_id);
   osthread->set_lwp_id(_lwp_self());
-  thread->_schedctl = (void *) schedctl_init () ;
+  thread->_schedctl = (void *) schedctl_init();
 
   if (UseNUMA) {
     int lgrp_id = os::numa_get_group_id();
@@ -891,9 +891,9 @@ static OSThread* create_os_thread(Thread* thread, thread_t thread_id) {
     }
   }
 
-  if ( ThreadPriorityVerbose ) {
+  if (ThreadPriorityVerbose) {
     tty->print_cr("In create_os_thread, Thread " INTPTR_FORMAT ", LWP is " INTPTR_FORMAT "\n",
-                  osthread->thread_id(), osthread->lwp_id() );
+                  osthread->thread_id(), osthread->lwp_id());
   }
 
   // Initial thread state is INITIALIZED, not SUSPENDED
@@ -974,9 +974,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
     return false;
   }
 
-  if ( ThreadPriorityVerbose ) {
+  if (ThreadPriorityVerbose) {
     char *thrtyp;
-    switch ( thr_type ) {
+    switch (thr_type) {
       case vm_thread:
         thrtyp = (char *)"vm";
         break;
@@ -1207,11 +1207,11 @@ void _handle_uncaught_cxx_exception() {
 
 // First crack at OS-specific initialization, from inside the new thread.
 void os::initialize_thread(Thread* thr) {
-  int r = thr_main() ;
-  guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
+  int r = thr_main();
+  guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
   if (r) {
     JavaThread* jt = (JavaThread *)thr;
-    assert(jt != NULL,"Sanity check");
+    assert(jt != NULL, "Sanity check");
     size_t stack_size;
     address base = jt->stack_base();
     if (Arguments::created_by_java_launcher()) {
@@ -1322,7 +1322,7 @@ int os::allocate_thread_local_storage() {
   //           JavaThread in Java code, and have stubs simply
   //           treat %g2 as a caller-save register, preserving it in a %lN.
   thread_key_t tk;
-  if (thr_keycreate( &tk, NULL ) )
+  if (thr_keycreate( &tk, NULL))
     fatal(err_msg("os::allocate_thread_local_storage: thr_keycreate failed "
                   "(%s)", strerror(errno)));
   return int(tk);
@@ -1347,7 +1347,7 @@ void os::thread_local_storage_at_put(int index, void* value) {
                     "(%s)", strerror(errno)));
     }
   } else {
-      ThreadLocalStorage::set_thread_in_slot ((Thread *) value) ;
+      ThreadLocalStorage::set_thread_in_slot((Thread *) value);
   }
 }
 
@@ -1579,7 +1579,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       // really shouldn't be NULL but what the heck, check can't hurt
       if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
         continue; // skip the empty path values
@@ -1591,7 +1591,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1795,7 +1795,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
 
   bool failed_to_read_elf_head=
     (sizeof(elf_head)!=
-        (::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
+        (::read(file_descriptor, &elf_head,sizeof(elf_head))));
 
   ::close(file_descriptor);
   if (failed_to_read_elf_head) {
@@ -1851,7 +1851,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
   arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
   int running_arch_index=-1;
 
-  for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
+  for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
     if (running_arch_code == arch_array[i].code) {
       running_arch_index    = i;
     }
@@ -1880,7 +1880,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
   }
 
   if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
-    if ( lib_arch.name!=NULL ) {
+    if (lib_arch.name!=NULL) {
       ::snprintf(diag_msg_buf, diag_msg_max_length-1,
         " (Possible cause: can't load %s-bit .so on a %s-bit platform)",
         lib_arch.name, arch_array[running_arch_index].name);
@@ -1969,7 +1969,7 @@ static bool check_addr0(outputStream* st) {
   int fd = ::open("/proc/self/map",O_RDONLY);
   if (fd >= 0) {
     prmap_t p;
-    while(::read(fd, &p, sizeof(p)) > 0) {
+    while (::read(fd, &p, sizeof(p)) > 0) {
       if (p.pr_vaddr == 0x0) {
         st->print("Warning: Address: 0x%x, Size: %dK, ",p.pr_vaddr, p.pr_size/1024, p.pr_mapname);
         st->print("Mapped file: %s, ", p.pr_mapname[0] == '\0' ? "None" : p.pr_mapname);
@@ -2079,7 +2079,7 @@ static void print_signal_handler(outputStream* st, int sig,
 
   address rh = VMError::get_resetted_sighandler(sig);
   // May be, handler was resetted by VMError?
-  if(rh != NULL) {
+  if (rh != NULL) {
     handler = rh;
     sa.sa_flags = VMError::get_resetted_sigflags(sig);
   }
@@ -2088,11 +2088,11 @@ static void print_signal_handler(outputStream* st, int sig,
   os::Posix::print_sa_flags(st, sa.sa_flags);
 
   // Check: is it our handler?
-  if(handler == CAST_FROM_FN_PTR(address, signalHandler) ||
+  if (handler == CAST_FROM_FN_PTR(address, signalHandler) ||
      handler == CAST_FROM_FN_PTR(address, sigINTRHandler)) {
     // It is our signal handler
     // check for flags
-    if(sa.sa_flags != os::Solaris::get_our_sigflags(sig)) {
+    if (sa.sa_flags != os::Solaris::get_our_sigflags(sig)) {
       st->print(
         ", flags was changed from " PTR32_FORMAT ", consider using jsig library",
         os::Solaris::get_our_sigflags(sig));
@@ -2403,7 +2403,7 @@ static int check_pending_signals(bool wait_for_signal) {
     do {
       thread->set_suspend_equivalent();
       // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
-      while((ret = ::sema_wait(&sig_sem)) == EINTR)
+      while ((ret = ::sema_wait(&sig_sem)) == EINTR)
           ;
       assert(ret == 0, "sema_wait() failed");
 
@@ -2635,7 +2635,7 @@ size_t os::numa_get_leaf_groups(int *ids, size_t size) {
      }
      if (!r) {
        // That's a leaf node.
-       assert (bottom <= cur, "Sanity check");
+       assert(bottom <= cur, "Sanity check");
        // Check if the node has memory
        if (Solaris::lgrp_resources(Solaris::lgrp_cookie(), ids[cur],
                                    NULL, 0, LGRP_RSRC_MEM) > 0) {
@@ -3051,7 +3051,7 @@ bool os::Solaris::mpss_sanity_check(bool warn, size_t* page_size) {
   const size_t size_limit =
     FLAG_IS_DEFAULT(LargePageSizeInBytes) ? 4 * M : LargePageSizeInBytes;
   int beg;
-  for (beg = 0; beg < n && _page_sizes[beg] > size_limit; ++beg) /* empty */ ;
+  for (beg = 0; beg < n && _page_sizes[beg] > size_limit; ++beg) /* empty */;
   const int end = MIN2((int)usable_count, n) - 1;
   for (int cur = 0; cur < end; ++cur, ++beg) {
     _page_sizes[cur] = _page_sizes[beg];
@@ -3264,7 +3264,7 @@ static int java_MaxPriority_to_os_priority = 0; // Saved mapping
 //
 // Return errno or 0 if OK.
 //
-static int lwp_priocntl_init () {
+static int lwp_priocntl_init() {
   int rslt;
   pcinfo_t ClassInfo;
   pcparms_t ParmInfo;
@@ -3274,7 +3274,7 @@ static int lwp_priocntl_init () {
 
   // If ThreadPriorityPolicy is 1, switch tables
   if (ThreadPriorityPolicy == 1) {
-    for (i = 0 ; i < CriticalPriority+1; i++)
+    for (i = 0; i < CriticalPriority+1; i++)
       os::java_to_os_priority[i] = prio_policy1[i];
   }
   if (UseCriticalJavaThreadPriority) {
@@ -3373,12 +3373,12 @@ static int lwp_priocntl_init () {
   } else {
     // No clue - punt
     if (ThreadPriorityVerbose)
-      tty->print_cr ("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname);
+      tty->print_cr("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname);
     return EINVAL;      // no clue, punt
   }
 
   if (ThreadPriorityVerbose) {
-    tty->print_cr ("Thread priority Range: [%d..%d]\n", myMin, myMax);
+    tty->print_cr("Thread priority Range: [%d..%d]\n", myMin, myMax);
   }
 
   priocntl_enable = true;  // Enable changing priorities
@@ -3424,7 +3424,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
   // TODO: elide set-to-same-value
 
   // If something went wrong on init, don't change priorities.
-  if ( !priocntl_enable ) {
+  if (!priocntl_enable) {
     if (ThreadPriorityVerbose)
       tty->print_cr("Trying to set priority but init failed, ignoring");
     return EINVAL;
@@ -3432,9 +3432,9 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
 
   // If lwp hasn't started yet, just return
   // the _start routine will call us again.
-  if ( lwpid <= 0 ) {
+  if (lwpid <= 0) {
     if (ThreadPriorityVerbose) {
-      tty->print_cr ("deferring the set_lwp_class_and_priority of thread "
+      tty->print_cr("deferring the set_lwp_class_and_priority of thread "
                      INTPTR_FORMAT " to %d, lwpid not set",
                      ThreadID, newPrio);
     }
@@ -3653,7 +3653,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
 
 OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
   int p;
-  if ( !UseThreadPriorities ) {
+  if (!UseThreadPriorities) {
     *priority_ptr = NormalPriority;
     return OS_OK;
   }
@@ -4099,7 +4099,7 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain
 void os::run_periodic_checks() {
   // A big source of grief is hijacking virt. addr 0x0 on Solaris,
   // thereby preventing a NULL checks.
-  if(!check_addr0_done) check_addr0_done = check_addr0(tty);
+  if (!check_addr0_done) check_addr0_done = check_addr0(tty);
 
   if (check_signals == false) return;
 
@@ -4148,10 +4148,10 @@ void os::Solaris::check_signal_handler(int sig) {
 
   address thisHandler = (act.sa_flags & SA_SIGINFO)
     ? CAST_FROM_FN_PTR(address, act.sa_sigaction)
-    : CAST_FROM_FN_PTR(address, act.sa_handler) ;
+    : CAST_FROM_FN_PTR(address, act.sa_handler);
 
 
-  switch(sig) {
+  switch (sig) {
     case SIGSEGV:
     case SIGBUS:
     case SIGFPE:
@@ -4332,7 +4332,7 @@ os::Solaris::meminfo_func_t os::Solaris::_meminfo = 0;
 
 static address resolve_symbol_lazy(const char* name) {
   address addr = (address) dlsym(RTLD_DEFAULT, name);
-  if(addr == NULL) {
+  if (addr == NULL) {
     // RTLD_DEFAULT was not defined on some early versions of 2.5.1
     addr = (address) dlsym(RTLD_NEXT, name);
   }
@@ -4341,7 +4341,7 @@ static address resolve_symbol_lazy(const char* name) {
 
 static address resolve_symbol(const char* name) {
   address addr = resolve_symbol_lazy(name);
-  if(addr == NULL) {
+  if (addr == NULL) {
     fatal(dlerror());
   }
   return addr;
@@ -4353,7 +4353,7 @@ void os::Solaris::libthread_init() {
   lwp_priocntl_init();
 
   // RTLD_DEFAULT was not defined on some early versions of 5.5.1
-  if(func == NULL) {
+  if (func == NULL) {
     func = (address) dlsym(RTLD_NEXT, "_thr_suspend_allmutators");
     // Guarantee that this VM is running on an new enough OS (5.6 or
     // later) that it will have a new enough libthread.so.
@@ -4384,7 +4384,7 @@ int_fnP_cond_tP os::Solaris::_cond_destroy;
 int os::Solaris::_cond_scope = USYNC_THREAD;
 
 void os::Solaris::synchronization_init() {
-  if(UseLWPSynchronization) {
+  if (UseLWPSynchronization) {
     os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_lock")));
     os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_trylock")));
     os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_unlock")));
@@ -4404,7 +4404,7 @@ void os::Solaris::synchronization_init() {
     os::Solaris::set_mutex_scope(USYNC_THREAD);
     os::Solaris::set_cond_scope(USYNC_THREAD);
 
-    if(UsePthreads) {
+    if (UsePthreads) {
       os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_lock")));
       os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_trylock")));
       os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_unlock")));
@@ -4576,17 +4576,17 @@ jint os::init_2(void) {
   os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if( Verbose && PrintMiscellaneous )
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
-    address mem_serialize_page = (address)Solaris::mmap_chunk( NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE );
-    guarantee( mem_serialize_page != NULL, "mmap Failed for memory serialize page");
-    os::set_memory_serialize_page( mem_serialize_page );
+    address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
+    guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -4725,13 +4725,13 @@ void os::init_3(void) {
 
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
-  if( mprotect((char *)_polling_page, page_size, PROT_NONE) != 0 )
+  if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0)
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
-  if( mprotect((char *)_polling_page, page_size, PROT_READ) != 0 )
+  if (mprotect((char *)_polling_page, page_size, PROT_READ) != 0)
     fatal("Could not enable polling page");
 };
 
@@ -5221,7 +5221,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
                      getpid(),
                      thread->osthread()->lwp_id());
   fd = ::open(proc_name, O_RDONLY);
-  if ( fd == -1 ) return -1;
+  if (fd == -1) return -1;
 
   do {
     count = ::pread(fd,
@@ -5230,7 +5230,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
                   thr_time_off);
   } while (count < 0 && errno == EINTR);
   ::close(fd);
-  if ( count < 0 ) return -1;
+  if (count < 0) return -1;
 
   if (user_sys_cpu_time) {
     // user + system CPU time
@@ -5244,7 +5244,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
                 (jlong)prusage.pr_utime.tv_nsec;
   }
 
-  return(lwp_time);
+  return (lwp_time);
 }
 
 void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) {
@@ -5448,43 +5448,43 @@ static timestruc_t* compute_abstime(timestruc_t* abstime, jlong millis) {
 
 int os::PlatformEvent::TryPark() {
   for (;;) {
-    const int v = _Event ;
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (Atomic::cmpxchg (0, &_Event, v) == v) return v  ;
+    const int v = _Event;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
   }
 }
 
 void os::PlatformEvent::park() {           // AKA: down()
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
-  int v ;
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
+  guarantee(v >= 0, "invariant");
   if (v == 0) {
      // Do this the hard way by blocking ...
      // See http://monaco.sfbay/detail.jsf?cr=5094058.
      // TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking.
      // Only for SPARC >= V8PlusA
 #if defined(__sparc) && defined(COMPILER2)
-     if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
+     if (ClearFPUAtPark) { _mark_fpu_nosave(); }
 #endif
      int status = os::Solaris::mutex_lock(_mutex);
-     assert_status(status == 0, status,  "mutex_lock");
-     guarantee (_nParked == 0, "invariant") ;
-     ++ _nParked ;
+     assert_status(status == 0, status, "mutex_lock");
+     guarantee(_nParked == 0, "invariant");
+     ++_nParked;
      while (_Event < 0) {
         // for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
         // Treat this the same as if the wait was interrupted
         // With usr/lib/lwp going to kernel, always handle ETIME
         status = os::Solaris::cond_wait(_cond, _mutex);
-        if (status == ETIME) status = EINTR ;
+        if (status == ETIME) status = EINTR;
         assert_status(status == 0 || status == EINTR, status, "cond_wait");
      }
-     -- _nParked ;
-     _Event = 0 ;
+     --_nParked;
+     _Event = 0;
      status = os::Solaris::mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
     // Paranoia to ensure our locked and lock-free paths interact
@@ -5494,41 +5494,41 @@ void os::PlatformEvent::park() {           // AKA: down()
 }
 
 int os::PlatformEvent::park(jlong millis) {
-  guarantee (_nParked == 0, "invariant") ;
-  int v ;
+  guarantee(_nParked == 0, "invariant");
+  int v;
   for (;;) {
-      v = _Event ;
-      if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+      v = _Event;
+      if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
   }
-  guarantee (v >= 0, "invariant") ;
-  if (v != 0) return OS_OK ;
+  guarantee(v >= 0, "invariant");
+  if (v != 0) return OS_OK;
 
   int ret = OS_TIMEOUT;
   timestruc_t abst;
-  compute_abstime (&abst, millis);
+  compute_abstime(&abst, millis);
 
   // See http://monaco.sfbay/detail.jsf?cr=5094058.
   // For Solaris SPARC set fprs.FEF=0 prior to parking.
   // Only for SPARC >= V8PlusA
 #if defined(__sparc) && defined(COMPILER2)
- if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
+ if (ClearFPUAtPark) { _mark_fpu_nosave(); }
 #endif
   int status = os::Solaris::mutex_lock(_mutex);
   assert_status(status == 0, status, "mutex_lock");
-  guarantee (_nParked == 0, "invariant") ;
-  ++ _nParked ;
+  guarantee(_nParked == 0, "invariant");
+  ++_nParked;
   while (_Event < 0) {
      int status = os::Solaris::cond_timedwait(_cond, _mutex, &abst);
      assert_status(status == 0 || status == EINTR ||
                    status == ETIME || status == ETIMEDOUT,
                    status, "cond_timedwait");
-     if (!FilterSpuriousWakeups) break ;                // previous semantics
-     if (status == ETIME || status == ETIMEDOUT) break ;
+     if (!FilterSpuriousWakeups) break;                // previous semantics
+     if (status == ETIME || status == ETIMEDOUT) break;
      // We consume and ignore EINTR and spurious wakeups.
   }
-  -- _nParked ;
-  if (_Event >= 0) ret = OS_OK ;
-  _Event = 0 ;
+  --_nParked;
+  if (_Event >= 0) ret = OS_OK;
+  _Event = 0;
   status = os::Solaris::mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
   // Paranoia to ensure our locked and lock-free paths interact
@@ -5605,7 +5605,7 @@ void os::PlatformEvent::unpark() {
  * years from "now".
  */
 static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
-  assert (time > 0, "convertTime");
+  assert(time > 0, "convertTime");
 
   struct timeval now;
   int status = gettimeofday(&now, NULL);
@@ -5664,7 +5664,7 @@ void Parker::park(bool isAbsolute, jlong time) {
 
   // First, demultiplex/decode time arguments
   timespec absTime;
-  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
+  if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
     return;
   }
   if (time > 0) {
@@ -5688,12 +5688,12 @@ void Parker::park(bool isAbsolute, jlong time) {
     return;
   }
 
-  int status ;
+  int status;
 
   if (_counter > 0)  { // no wait needed
     _counter = 0;
     status = os::Solaris::mutex_unlock(_mutex);
-    assert (status == 0, "invariant") ;
+    assert(status == 0, "invariant");
     // Paranoia to ensure our locked and lock-free paths interact
     // correctly with each other and Java-level accesses.
     OrderAccess::fence();
@@ -5717,11 +5717,11 @@ void Parker::park(bool isAbsolute, jlong time) {
   // TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking.
   // Only for SPARC >= V8PlusA
 #if defined(__sparc) && defined(COMPILER2)
-  if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
+  if (ClearFPUAtPark) { _mark_fpu_nosave(); }
 #endif
 
   if (time == 0) {
-    status = os::Solaris::cond_wait (_cond, _mutex) ;
+    status = os::Solaris::cond_wait(_cond, _mutex);
   } else {
     status = os::Solaris::cond_timedwait (_cond, _mutex, &absTime);
   }
@@ -5734,9 +5734,9 @@ void Parker::park(bool isAbsolute, jlong time) {
 #ifdef ASSERT
   thr_sigsetmask(SIG_SETMASK, &oldsigs, NULL);
 #endif
-  _counter = 0 ;
+  _counter = 0;
   status = os::Solaris::mutex_unlock(_mutex);
-  assert_status(status == 0, status, "mutex_unlock") ;
+  assert_status(status == 0, status, "mutex_unlock");
   // Paranoia to ensure our locked and lock-free paths interact
   // correctly with each other and Java-level accesses.
   OrderAccess::fence();
@@ -5748,17 +5748,17 @@ void Parker::park(bool isAbsolute, jlong time) {
 }
 
 void Parker::unpark() {
-  int s, status ;
-  status = os::Solaris::mutex_lock (_mutex) ;
-  assert (status == 0, "invariant") ;
+  int s, status;
+  status = os::Solaris::mutex_lock(_mutex);
+  assert(status == 0, "invariant");
   s = _counter;
   _counter = 1;
-  status = os::Solaris::mutex_unlock (_mutex) ;
-  assert (status == 0, "invariant") ;
+  status = os::Solaris::mutex_unlock(_mutex);
+  assert(status == 0, "invariant");
 
   if (s < 1) {
-    status = os::Solaris::cond_signal (_cond) ;
-    assert (status == 0, "invariant") ;
+    status = os::Solaris::cond_signal(_cond);
+    assert(status == 0, "invariant");
   }
 }
 
@@ -5925,14 +5925,14 @@ int os::timeout(int fd, long timeout) {
   gettimeofday(&t, &aNull);
   prevtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
 
-  for(;;) {
+  for (;;) {
     res = ::poll(&pfd, 1, timeout);
-    if(res == OS_ERR && errno == EINTR) {
-        if(timeout != -1) {
+    if (res == OS_ERR && errno == EINTR) {
+        if (timeout != -1) {
           gettimeofday(&t, &aNull);
           newtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec /1000;
           timeout -= newtime - prevtime;
-          if(timeout <= 0)
+          if (timeout <= 0)
             return OS_OK;
           prevtime = newtime;
         }
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 04b72a9d37d..e3ca08a747e 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -125,11 +125,11 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
   switch (reason) {
     case DLL_PROCESS_ATTACH:
       vm_lib_handle = hinst;
-      if(ForceTimeHighResolution)
+      if (ForceTimeHighResolution)
         timeBeginPeriod(1L);
       break;
     case DLL_PROCESS_DETACH:
-      if(ForceTimeHighResolution)
+      if (ForceTimeHighResolution)
         timeEndPeriod(1L);
 
       // Workaround for issue when a custom launcher doesn't call
@@ -318,7 +318,7 @@ extern "C" void breakpoint() {
  */
 address os::get_caller_pc(int n) {
 #ifdef _NMT_NOINLINE_
-  n ++;
+  n++;
 #endif
   address pc;
   if (os::Kernel32Dll::RtlCaptureStackBackTrace(n + 1, 1, (PVOID*)&pc, NULL) == 1) {
@@ -345,10 +345,10 @@ address os::current_stack_base() {
 
   // Add up the sizes of all the regions with the same
   // AllocationBase.
-  while( 1 )
+  while (1)
   {
     VirtualQuery(stack_bottom+stack_size, &minfo, sizeof(minfo));
-    if ( stack_bottom == (address)minfo.AllocationBase )
+    if (stack_bottom == (address)minfo.AllocationBase)
       stack_size += minfo.RegionSize;
     else
       break;
@@ -644,7 +644,7 @@ static jlong performance_frequency;
 jlong as_long(LARGE_INTEGER x) {
   jlong result = 0; // initialization to avoid warning
   set_high(&result, x.HighPart);
-  set_low(&result,  x.LowPart);
+  set_low(&result, x.LowPart);
   return result;
 }
 
@@ -999,7 +999,7 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char*
 #endif
 
   cwd = get_current_directory(NULL, 0);
-  jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp",cwd, current_process_id());
+  jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp", cwd, current_process_id());
   dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
 
   if (dumpFile == INVALID_HANDLE_VALUE) {
@@ -1217,7 +1217,7 @@ bool os::dll_build_name(char *buffer, size_t buflen,
     if (pelements == NULL) {
       return false;
     }
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       char* path = pelements[i];
       // Really shouldn't be NULL, but check can't hurt
       size_t plen = (path == NULL) ? 0 : strlen(path);
@@ -1236,7 +1236,7 @@ bool os::dll_build_name(char *buffer, size_t buflen,
       }
     }
     // release the storage
-    for (int i = 0 ; i < n ; i++) {
+    for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
         FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
       }
@@ -1271,12 +1271,12 @@ static bool _addr_in_ntdll( address addr )
   MODULEINFO minfo;
 
   hmod = GetModuleHandle("NTDLL.DLL");
-  if ( hmod == NULL ) return false;
-  if ( !os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod,
+  if (hmod == NULL) return false;
+  if (!os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod,
                                &minfo, sizeof(MODULEINFO)) )
     return false;
 
-  if ( (addr >= minfo.lpBaseOfDll) &&
+  if ((addr >= minfo.lpBaseOfDll) &&
        (addr < (address)((uintptr_t)minfo.lpBaseOfDll + (uintptr_t)minfo.SizeOfImage)))
     return true;
   else
@@ -1304,11 +1304,11 @@ typedef int (*EnumModulesCallbackFunc)(int, char *, address, unsigned, void *);
 // enumerate_modules for Windows NT, using PSAPI
 static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void * param)
 {
-  HANDLE   hProcess ;
+  HANDLE   hProcess;
 
 # define MAX_NUM_MODULES 128
   HMODULE     modules[MAX_NUM_MODULES];
-  static char filename[ MAX_PATH ];
+  static char filename[MAX_PATH];
   int         result = 0;
 
   if (!os::PSApiDll::PSApiAvailable()) {
@@ -1316,13 +1316,13 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
   }
 
   hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
-                         FALSE, pid ) ;
+                         FALSE, pid);
   if (hProcess == NULL) return 0;
 
   DWORD size_needed;
   if (!os::PSApiDll::EnumProcessModules(hProcess, modules,
                            sizeof(modules), &size_needed)) {
-      CloseHandle( hProcess );
+      CloseHandle(hProcess);
       return 0;
   }
 
@@ -1331,7 +1331,7 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
 
   for (int i = 0; i < MIN2(num_modules, MAX_NUM_MODULES); i++) {
     // Get Full pathname:
-    if(!os::PSApiDll::GetModuleFileNameEx(hProcess, modules[i],
+    if (!os::PSApiDll::GetModuleFileNameEx(hProcess, modules[i],
                              filename, sizeof(filename))) {
         filename[0] = '\0';
     }
@@ -1349,7 +1349,7 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
     if (result) break;
   }
 
-  CloseHandle( hProcess ) ;
+  CloseHandle(hProcess);
   return result;
 }
 
@@ -1357,8 +1357,8 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
 // enumerate_modules for Windows 95/98/ME, using TOOLHELP
 static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, void *param)
 {
-  HANDLE                hSnapShot ;
-  static MODULEENTRY32  modentry ;
+  HANDLE                hSnapShot;
+  static MODULEENTRY32  modentry;
   int                   result = 0;
 
   if (!os::Kernel32Dll::HelpToolsAvailable()) {
@@ -1366,22 +1366,22 @@ static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, vo
   }
 
   // Get a handle to a Toolhelp snapshot of the system
-  hSnapShot = os::Kernel32Dll::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid ) ;
-  if( hSnapShot == INVALID_HANDLE_VALUE ) {
-      return FALSE ;
+  hSnapShot = os::Kernel32Dll::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
+  if (hSnapShot == INVALID_HANDLE_VALUE) {
+      return FALSE;
   }
 
   // iterate through all modules
-  modentry.dwSize = sizeof(MODULEENTRY32) ;
+  modentry.dwSize = sizeof(MODULEENTRY32);
   bool not_done = os::Kernel32Dll::Module32First( hSnapShot, &modentry ) != 0;
 
-  while( not_done ) {
+  while (not_done) {
     // invoke the callback
     result=func(pid, modentry.szExePath, (address)modentry.modBaseAddr,
                 modentry.modBaseSize, param);
     if (result) break;
 
-    modentry.dwSize = sizeof(MODULEENTRY32) ;
+    modentry.dwSize = sizeof(MODULEENTRY32);
     not_done = os::Kernel32Dll::Module32Next( hSnapShot, &modentry ) != 0;
   }
 
@@ -1941,7 +1941,7 @@ void os::signal_raise(int signal_number) {
 // that raises SIGTERM for the latter cases.
 //
 static BOOL WINAPI consoleHandler(DWORD event) {
-  switch(event) {
+  switch (event) {
     case CTRL_C_EVENT:
       if (is_error_reported()) {
         // Ctrl-C is pressed during error reporting, likely because the error
@@ -1965,7 +1965,7 @@ static BOOL WINAPI consoleHandler(DWORD event) {
       HANDLE handle = GetProcessWindowStation();
       if (handle != NULL &&
           GetUserObjectInformation(handle, UOI_FLAGS, &flags,
-            sizeof( USEROBJECTFLAGS), NULL)) {
+            sizeof(USEROBJECTFLAGS), NULL)) {
         // If it is a non-interactive session, let next handler to deal
         // with it.
         if ((flags.dwFlags & WSF_VISIBLE) == 0) {
@@ -1991,7 +1991,7 @@ static BOOL WINAPI consoleHandler(DWORD event) {
 
 // Return maximum OS signal used + 1 for internal use only
 // Used as exit signal for signal_thread
-int os::sigexitnum_pd(){
+int os::sigexitnum_pd() {
   return NSIG;
 }
 
@@ -2422,11 +2422,11 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
   // process of write protecting the memory serialization page.
   // It write enables the page immediately after protecting it
   // so just return.
-  if ( exception_code == EXCEPTION_ACCESS_VIOLATION ) {
+  if (exception_code == EXCEPTION_ACCESS_VIOLATION) {
     JavaThread* thread = (JavaThread*) t;
     PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
     address addr = (address) exceptionRecord->ExceptionInformation[1];
-    if ( os::is_memory_serialize_page(thread, addr) ) {
+    if (os::is_memory_serialize_page(thread, addr)) {
       // Block current thread until the memory serialize page permission restored.
       os::block_on_serialize_page_trap();
       return EXCEPTION_CONTINUE_EXECUTION;
@@ -2543,7 +2543,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
           //
           PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
           address addr = (address) exceptionRecord->ExceptionInformation[1];
-          if (addr > thread->stack_yellow_zone_base() && addr < thread->stack_base() ) {
+          if (addr > thread->stack_yellow_zone_base() && addr < thread->stack_base()) {
                   addr = (address)((uintptr_t)addr &
                          (~((uintptr_t)os::vm_page_size() - (uintptr_t)1)));
                   os::commit_memory((char *)addr, thread->stack_base() - addr,
@@ -2623,7 +2623,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
       // Compiled method patched to be non entrant? Following conditions must apply:
       // 1. must be first instruction in bundle
       // 2. must be a break instruction with appropriate code
-      if((((uint64_t) pc & 0x0F) == 0) &&
+      if ((((uint64_t) pc & 0x0F) == 0) &&
          (((IPF_Bundle*) pc)->get_slot0() == handle_wrong_method_break.bits())) {
         return Handle_Exception(exceptionInfo,
                                 (address)SharedRuntime::get_handle_wrong_method_stub());
@@ -2794,7 +2794,7 @@ public:
     return (_numa_used_node_count > 1);
   }
 
-  int get_count() {return _numa_used_node_count;}
+  int get_count() { return _numa_used_node_count; }
   int get_node_list_entry(int n) {
     // for indexes out of range, returns -1
     return (n < _numa_used_node_count ? _numa_used_node_list[n] : -1);
@@ -3112,14 +3112,14 @@ char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
     res = (char*)VirtualAlloc(addr, bytes, MEM_RESERVE, PAGE_READWRITE);
   } else {
     elapsedTimer reserveTimer;
-    if( Verbose && PrintMiscellaneous ) reserveTimer.start();
+    if (Verbose && PrintMiscellaneous) reserveTimer.start();
     // in numa interleaving, we have to allocate pages individually
     // (well really chunks of NUMAInterleaveGranularity size)
     res = allocate_pages_individually(bytes, addr, MEM_RESERVE, PAGE_READWRITE);
     if (res == NULL) {
       warning("NUMA page allocation failed");
     }
-    if( Verbose && PrintMiscellaneous ) {
+    if (Verbose && PrintMiscellaneous) {
       reserveTimer.stop();
       tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
                     reserveTimer.milliseconds(), reserveTimer.ticks());
@@ -3450,14 +3450,14 @@ public:
 int os::sleep(Thread* thread, jlong ms, bool interruptable) {
   jlong limit = (jlong) MAXDWORD;
 
-  while(ms > limit) {
+  while (ms > limit) {
     int res;
     if ((res = sleep(thread, limit, interruptable)) != OS_TIMEOUT)
       return res;
     ms -= limit;
   }
 
-  assert(thread == Thread::current(),  "thread consistency check");
+  assert(thread == Thread::current(), "thread consistency check");
   OSThread* osthread = thread->osthread();
   OSThreadWaitState osts(osthread, false /* not Object.wait() */);
   int result;
@@ -3473,8 +3473,8 @@ int os::sleep(Thread* thread, jlong ms, bool interruptable) {
     HANDLE events[1];
     events[0] = osthread->interrupt_event();
     HighResolutionInterval *phri=NULL;
-    if(!ForceTimeHighResolution)
-      phri = new HighResolutionInterval( ms );
+    if (!ForceTimeHighResolution)
+      phri = new HighResolutionInterval(ms);
     if (WaitForMultipleObjects(1, events, FALSE, (DWORD)ms) == WAIT_TIMEOUT) {
       result = OS_TIMEOUT;
     } else {
@@ -3511,17 +3511,17 @@ void os::infinite_sleep() {
   }
 }
 
-typedef BOOL (WINAPI * STTSignature)(void) ;
+typedef BOOL (WINAPI * STTSignature)(void);
 
 os::YieldResult os::NakedYield() {
   // Use either SwitchToThread() or Sleep(0)
   // Consider passing back the return value from SwitchToThread().
   if (os::Kernel32Dll::SwitchToThreadAvailable()) {
-    return SwitchToThread() ? os::YIELD_SWITCHED : os::YIELD_NONEREADY ;
+    return SwitchToThread() ? os::YIELD_SWITCHED : os::YIELD_NONEREADY;
   } else {
     Sleep(0);
   }
-  return os::YIELD_UNKNOWN ;
+  return os::YIELD_UNKNOWN;
 }
 
 void os::yield() {  os::NakedYield(); }
@@ -3574,7 +3574,7 @@ static int prio_init() {
     }
   }
   if (UseCriticalJavaThreadPriority) {
-    os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority] ;
+    os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority];
   }
   return 0;
 }
@@ -3586,7 +3586,7 @@ OSReturn os::set_native_priority(Thread* thread, int priority) {
 }
 
 OSReturn os::get_native_priority(const Thread* const thread, int* priority_ptr) {
-  if ( !UseThreadPriorities ) {
+  if (!UseThreadPriorities) {
     *priority_ptr = java_to_os_priority[NormPriority];
     return OS_OK;
   }
@@ -3620,8 +3620,8 @@ void os::interrupt(Thread* thread) {
   if (thread->is_Java_thread())
     ((JavaThread*)thread)->parker()->unpark();
 
-  ParkEvent * ev = thread->_ParkEvent ;
-  if (ev != NULL) ev->unpark() ;
+  ParkEvent * ev = thread->_ParkEvent;
+  if (ev != NULL) ev->unpark();
 
 }
 
@@ -3715,7 +3715,7 @@ void os::win32::initialize_system_info() {
   OSVERSIONINFOEX oi;
   oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
   GetVersionEx((OSVERSIONINFO*)&oi);
-  switch(oi.dwPlatformId) {
+  switch (oi.dwPlatformId) {
     case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break;
     case VER_PLATFORM_WIN32_NT:
       _is_nt = true;
@@ -3898,29 +3898,29 @@ static jint initSock();
 jint os::init_2(void) {
   // Allocate a single page and mark it as readable for safepoint polling
   address polling_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READONLY);
-  guarantee( polling_page != NULL, "Reserve Failed for polling page");
+  guarantee(polling_page != NULL, "Reserve Failed for polling page");
 
   address return_page  = (address)VirtualAlloc(polling_page, os::vm_page_size(), MEM_COMMIT, PAGE_READONLY);
-  guarantee( return_page != NULL, "Commit Failed for polling page");
+  guarantee(return_page != NULL, "Commit Failed for polling page");
 
-  os::set_polling_page( polling_page );
+  os::set_polling_page(polling_page);
 
 #ifndef PRODUCT
-  if( Verbose && PrintMiscellaneous )
+  if (Verbose && PrintMiscellaneous)
     tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
 #endif
 
   if (!UseMembar) {
     address mem_serialize_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READWRITE);
-    guarantee( mem_serialize_page != NULL, "Reserve Failed for memory serialize page");
+    guarantee(mem_serialize_page != NULL, "Reserve Failed for memory serialize page");
 
     return_page  = (address)VirtualAlloc(mem_serialize_page, os::vm_page_size(), MEM_COMMIT, PAGE_READWRITE);
-    guarantee( return_page != NULL, "Commit Failed for memory serialize page");
+    guarantee(return_page != NULL, "Commit Failed for memory serialize page");
 
-    os::set_memory_serialize_page( mem_serialize_page );
+    os::set_memory_serialize_page(mem_serialize_page);
 
 #ifndef PRODUCT
-    if(Verbose && PrintMiscellaneous)
+    if (Verbose && PrintMiscellaneous)
       tty->print("[Memory Serialize  Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
 #endif
   }
@@ -4036,14 +4036,14 @@ void os::init_3(void) {
 // Mark the polling page as unreadable
 void os::make_polling_page_unreadable(void) {
   DWORD old_status;
-  if( !VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_NOACCESS, &old_status) )
+  if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_NOACCESS, &old_status))
     fatal("Could not disable polling page");
 };
 
 // Mark the polling page as readable
 void os::make_polling_page_readable(void) {
   DWORD old_status;
-  if( !VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_READONLY, &old_status) )
+  if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_READONLY, &old_status))
     fatal("Could not enable polling page");
 };
 
@@ -4121,7 +4121,7 @@ jlong os::thread_cpu_time(Thread* thread, bool user_sys_cpu_time) {
     FILETIME KernelTime;
     FILETIME UserTime;
 
-    if ( GetThreadTimes(thread->osthread()->thread_handle(),
+    if (GetThreadTimes(thread->osthread()->thread_handle(),
                     &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0)
       return -1;
     else
@@ -4157,7 +4157,7 @@ bool os::is_thread_cpu_time_supported() {
     FILETIME KernelTime;
     FILETIME UserTime;
 
-    if ( GetThreadTimes(GetCurrentThread(),
+    if (GetThreadTimes(GetCurrentThread(),
                     &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0)
       return false;
     else
@@ -4391,7 +4391,7 @@ int os::ftruncate(int fd, jlong length) {
 int os::fsync(int fd) {
   HANDLE handle = (HANDLE)::_get_osfhandle(fd);
 
-  if ( (!::FlushFileBuffers(handle)) &&
+  if ((!::FlushFileBuffers(handle)) &&
          (GetLastError() != ERROR_ACCESS_DENIED) ) {
     /* from winerror.h */
     return -1;
@@ -4512,7 +4512,7 @@ static int stdinAvailable(int fd, long *pbytes) {
   }
 
   /* Examine input records for the number of bytes available */
-  for(i=0; i<numEvents; i++) {
+  for (i=0; i<numEvents; i++) {
     if (lpBuffer[i].EventType == KEY_EVENT) {
 
       KEY_EVENT_RECORD *keyRecord = (KEY_EVENT_RECORD *)
@@ -4527,7 +4527,7 @@ static int stdinAvailable(int fd, long *pbytes) {
     }
   }
 
-  if(lpBuffer != NULL) {
+  if (lpBuffer != NULL) {
     os::free(lpBuffer, mtInternal);
   }
 
@@ -4790,19 +4790,19 @@ bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) {
 // with explicit "PARKED" and "SIGNALED" bits.
 
 int os::PlatformEvent::park (jlong Millis) {
-    guarantee (_ParkHandle != NULL , "Invariant") ;
-    guarantee (Millis > 0          , "Invariant") ;
-    int v ;
+    guarantee(_ParkHandle != NULL , "Invariant");
+    guarantee(Millis > 0          , "Invariant");
+    int v;
 
     // CONSIDER: defer assigning a CreateEvent() handle to the Event until
     // the initial park() operation.
 
     for (;;) {
-        v = _Event ;
-        if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+        v = _Event;
+        if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
     }
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (v != 0) return OS_OK ;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (v != 0) return OS_OK;
 
     // Do this the hard way by blocking ...
     // TODO: consider a brief spin here, gated on the success of recent
@@ -4820,59 +4820,59 @@ int os::PlatformEvent::park (jlong Millis) {
     // In the future, however, we might want to track the accumulated wait time and
     // adjust Millis accordingly if we encounter a spurious wakeup.
 
-    const int MAXTIMEOUT = 0x10000000 ;
-    DWORD rv = WAIT_TIMEOUT ;
+    const int MAXTIMEOUT = 0x10000000;
+    DWORD rv = WAIT_TIMEOUT;
     while (_Event < 0 && Millis > 0) {
-       DWORD prd = Millis ;     // set prd = MAX (Millis, MAXTIMEOUT)
+       DWORD prd = Millis;     // set prd = MAX (Millis, MAXTIMEOUT)
        if (Millis > MAXTIMEOUT) {
-          prd = MAXTIMEOUT ;
+          prd = MAXTIMEOUT;
        }
-       rv = ::WaitForSingleObject (_ParkHandle, prd) ;
-       assert (rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed") ;
+       rv = ::WaitForSingleObject(_ParkHandle, prd);
+       assert(rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed");
        if (rv == WAIT_TIMEOUT) {
-           Millis -= prd ;
+           Millis -= prd;
        }
     }
-    v = _Event ;
-    _Event = 0 ;
+    v = _Event;
+    _Event = 0;
     // see comment at end of os::PlatformEvent::park() below:
-    OrderAccess::fence() ;
+    OrderAccess::fence();
     // If we encounter a nearly simultanous timeout expiry and unpark()
     // we return OS_OK indicating we awoke via unpark().
     // Implementor's license -- returning OS_TIMEOUT would be equally valid, however.
-    return (v >= 0) ? OS_OK : OS_TIMEOUT ;
+    return (v >= 0) ? OS_OK : OS_TIMEOUT;
 }
 
-void os::PlatformEvent::park () {
-    guarantee (_ParkHandle != NULL, "Invariant") ;
+void os::PlatformEvent::park() {
+    guarantee(_ParkHandle != NULL, "Invariant");
     // Invariant: Only the thread associated with the Event/PlatformEvent
     // may call park().
-    int v ;
+    int v;
     for (;;) {
-        v = _Event ;
-        if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
+        v = _Event;
+        if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
     }
-    guarantee ((v == 0) || (v == 1), "invariant") ;
-    if (v != 0) return ;
+    guarantee((v == 0) || (v == 1), "invariant");
+    if (v != 0) return;
 
     // Do this the hard way by blocking ...
     // TODO: consider a brief spin here, gated on the success of recent
     // spin attempts by this thread.
     while (_Event < 0) {
-       DWORD rv = ::WaitForSingleObject (_ParkHandle, INFINITE) ;
-       assert (rv == WAIT_OBJECT_0, "WaitForSingleObject failed") ;
+       DWORD rv = ::WaitForSingleObject(_ParkHandle, INFINITE);
+       assert(rv == WAIT_OBJECT_0, "WaitForSingleObject failed");
     }
 
     // Usually we'll find _Event == 0 at this point, but as
     // an optional optimization we clear it, just in case can
     // multiple unpark() operations drove _Event up to 1.
-    _Event = 0 ;
-    OrderAccess::fence() ;
-    guarantee (_Event >= 0, "invariant") ;
+    _Event = 0;
+    OrderAccess::fence();
+    guarantee(_Event >= 0, "invariant");
 }
 
 void os::PlatformEvent::unpark() {
-  guarantee (_ParkHandle != NULL, "Invariant") ;
+  guarantee(_ParkHandle != NULL, "Invariant");
 
   // Transitions for _Event:
   //    0 :=> 1
@@ -4907,7 +4907,7 @@ void os::PlatformEvent::unpark() {
 
 
 void Parker::park(bool isAbsolute, jlong time) {
-  guarantee (_ParkEvent != NULL, "invariant") ;
+  guarantee(_ParkEvent != NULL, "invariant");
   // First, demultiplex/decode time arguments
   if (time < 0) { // don't wait
     return;
@@ -4941,7 +4941,7 @@ void Parker::park(bool isAbsolute, jlong time) {
     OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */);
     jt->set_suspend_equivalent();
 
-    WaitForSingleObject(_ParkEvent,  time);
+    WaitForSingleObject(_ParkEvent, time);
     ResetEvent(_ParkEvent);
 
     // If externally suspended while waiting, re-suspend
@@ -4952,7 +4952,7 @@ void Parker::park(bool isAbsolute, jlong time) {
 }
 
 void Parker::unpark() {
-  guarantee (_ParkEvent != NULL, "invariant") ;
+  guarantee(_ParkEvent != NULL, "invariant");
   SetEvent(_ParkEvent);
 }
 
@@ -5040,7 +5040,7 @@ bool os::find(address addr, outputStream* st) {
 LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
   DWORD exception_code = e->ExceptionRecord->ExceptionCode;
 
-  if ( exception_code == EXCEPTION_ACCESS_VIOLATION ) {
+  if (exception_code == EXCEPTION_ACCESS_VIOLATION) {
     JavaThread* thread = (JavaThread*)ThreadLocalStorage::get_thread_slow();
     PEXCEPTION_RECORD exceptionRecord = e->ExceptionRecord;
     address addr = (address) exceptionRecord->ExceptionInformation[1];
diff --git a/hotspot/src/share/vm/runtime/objectMonitor.cpp b/hotspot/src/share/vm/runtime/objectMonitor.cpp
index 6f2323c8668..d9682ebf601 100644
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp
@@ -114,38 +114,38 @@
 // The knob* variables are effectively final.  Once set they should
 // never be modified hence.  Consider using __read_mostly with GCC.
 
-int ObjectMonitor::Knob_Verbose    = 0 ;
-int ObjectMonitor::Knob_SpinLimit  = 5000 ;    // derived by an external tool -
-static int Knob_LogSpins           = 0 ;       // enable jvmstat tally for spins
-static int Knob_HandOff            = 0 ;
-static int Knob_ReportSettings     = 0 ;
-
-static int Knob_SpinBase           = 0 ;       // Floor AKA SpinMin
-static int Knob_SpinBackOff        = 0 ;       // spin-loop backoff
-static int Knob_CASPenalty         = -1 ;      // Penalty for failed CAS
-static int Knob_OXPenalty          = -1 ;      // Penalty for observed _owner change
-static int Knob_SpinSetSucc        = 1 ;       // spinners set the _succ field
-static int Knob_SpinEarly          = 1 ;
-static int Knob_SuccEnabled        = 1 ;       // futile wake throttling
-static int Knob_SuccRestrict       = 0 ;       // Limit successors + spinners to at-most-one
-static int Knob_MaxSpinners        = -1 ;      // Should be a function of # CPUs
-static int Knob_Bonus              = 100 ;     // spin success bonus
-static int Knob_BonusB             = 100 ;     // spin success bonus
-static int Knob_Penalty            = 200 ;     // spin failure penalty
-static int Knob_Poverty            = 1000 ;
-static int Knob_SpinAfterFutile    = 1 ;       // Spin after returning from park()
-static int Knob_FixedSpin          = 0 ;
-static int Knob_OState             = 3 ;       // Spinner checks thread state of _owner
-static int Knob_UsePause           = 1 ;
-static int Knob_ExitPolicy         = 0 ;
-static int Knob_PreSpin            = 10 ;      // 20-100 likely better
-static int Knob_ResetEvent         = 0 ;
-static int BackOffMask             = 0 ;
-
-static int Knob_FastHSSEC          = 0 ;
-static int Knob_MoveNotifyee       = 2 ;       // notify() - disposition of notifyee
-static int Knob_QMode              = 0 ;       // EntryList-cxq policy - queue discipline
-static volatile int InitDone       = 0 ;
+int ObjectMonitor::Knob_Verbose    = 0;
+int ObjectMonitor::Knob_SpinLimit  = 5000;    // derived by an external tool -
+static int Knob_LogSpins           = 0;       // enable jvmstat tally for spins
+static int Knob_HandOff            = 0;
+static int Knob_ReportSettings     = 0;
+
+static int Knob_SpinBase           = 0;       // Floor AKA SpinMin
+static int Knob_SpinBackOff        = 0;       // spin-loop backoff
+static int Knob_CASPenalty         = -1;      // Penalty for failed CAS
+static int Knob_OXPenalty          = -1;      // Penalty for observed _owner change
+static int Knob_SpinSetSucc        = 1;       // spinners set the _succ field
+static int Knob_SpinEarly          = 1;
+static int Knob_SuccEnabled        = 1;       // futile wake throttling
+static int Knob_SuccRestrict       = 0;       // Limit successors + spinners to at-most-one
+static int Knob_MaxSpinners        = -1;      // Should be a function of # CPUs
+static int Knob_Bonus              = 100;     // spin success bonus
+static int Knob_BonusB             = 100;     // spin success bonus
+static int Knob_Penalty            = 200;     // spin failure penalty
+static int Knob_Poverty            = 1000;
+static int Knob_SpinAfterFutile    = 1;       // Spin after returning from park()
+static int Knob_FixedSpin          = 0;
+static int Knob_OState             = 3;       // Spinner checks thread state of _owner
+static int Knob_UsePause           = 1;
+static int Knob_ExitPolicy         = 0;
+static int Knob_PreSpin            = 10;      // 20-100 likely better
+static int Knob_ResetEvent         = 0;
+static int BackOffMask             = 0;
+
+static int Knob_FastHSSEC          = 0;
+static int Knob_MoveNotifyee       = 2;       // notify() - disposition of notifyee
+static int Knob_QMode              = 0;       // EntryList-cxq policy - queue discipline
+static volatile int InitDone       = 0;
 
 #define TrySpin TrySpin_VaryDuration
 
@@ -265,9 +265,9 @@ bool ObjectMonitor::try_enter(Thread* THREAD) {
   if (THREAD != _owner) {
     if (THREAD->is_lock_owned ((address)_owner)) {
        assert(_recursions == 0, "internal state error");
-       _owner = THREAD ;
-       _recursions = 1 ;
-       OwnerIsThread = 1 ;
+       _owner = THREAD;
+       _recursions = 1;
+       OwnerIsThread = 1;
        return true;
     }
     if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) {
@@ -283,37 +283,37 @@ bool ObjectMonitor::try_enter(Thread* THREAD) {
 void ATTR ObjectMonitor::enter(TRAPS) {
   // The following code is ordered to check the most common cases first
   // and to reduce RTS->RTO cache line upgrades on SPARC and IA32 processors.
-  Thread * const Self = THREAD ;
-  void * cur ;
+  Thread * const Self = THREAD;
+  void * cur;
 
-  cur = Atomic::cmpxchg_ptr (Self, &_owner, NULL) ;
+  cur = Atomic::cmpxchg_ptr(Self, &_owner, NULL);
   if (cur == NULL) {
      // Either ASSERT _recursions == 0 or explicitly set _recursions = 0.
-     assert (_recursions == 0   , "invariant") ;
-     assert (_owner      == Self, "invariant") ;
+     assert(_recursions == 0   , "invariant");
+     assert(_owner      == Self, "invariant");
      // CONSIDER: set or assert OwnerIsThread == 1
-     return ;
+     return;
   }
 
   if (cur == Self) {
      // TODO-FIXME: check for integer overflow!  BUGID 6557169.
-     _recursions ++ ;
-     return ;
+     _recursions++;
+     return;
   }
 
   if (Self->is_lock_owned ((address)cur)) {
-    assert (_recursions == 0, "internal state error");
-    _recursions = 1 ;
+    assert(_recursions == 0, "internal state error");
+    _recursions = 1;
     // Commute owner from a thread-specific on-stack BasicLockObject address to
     // a full-fledged "Thread *".
-    _owner = Self ;
-    OwnerIsThread = 1 ;
-    return ;
+    _owner = Self;
+    OwnerIsThread = 1;
+    return;
   }
 
   // We've encountered genuine contention.
-  assert (Self->_Stalled == 0, "invariant") ;
-  Self->_Stalled = intptr_t(this) ;
+  assert(Self->_Stalled == 0, "invariant");
+  Self->_Stalled = intptr_t(this);
 
   // Try one round of spinning *before* enqueueing Self
   // and before going through the awkward and expensive state
@@ -321,21 +321,21 @@ void ATTR ObjectMonitor::enter(TRAPS) {
   // Note that if we acquire the monitor from an initial spin
   // we forgo posting JVMTI events and firing DTRACE probes.
   if (Knob_SpinEarly && TrySpin (Self) > 0) {
-     assert (_owner == Self      , "invariant") ;
-     assert (_recursions == 0    , "invariant") ;
-     assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
-     Self->_Stalled = 0 ;
-     return ;
+     assert(_owner == Self      , "invariant");
+     assert(_recursions == 0    , "invariant");
+     assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
+     Self->_Stalled = 0;
+     return;
   }
 
-  assert (_owner != Self          , "invariant") ;
-  assert (_succ  != Self          , "invariant") ;
-  assert (Self->is_Java_thread()  , "invariant") ;
-  JavaThread * jt = (JavaThread *) Self ;
-  assert (!SafepointSynchronize::is_at_safepoint(), "invariant") ;
-  assert (jt->thread_state() != _thread_blocked   , "invariant") ;
-  assert (this->object() != NULL  , "invariant") ;
-  assert (_count >= 0, "invariant") ;
+  assert(_owner != Self          , "invariant");
+  assert(_succ  != Self          , "invariant");
+  assert(Self->is_Java_thread()  , "invariant");
+  JavaThread * jt = (JavaThread *) Self;
+  assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert(jt->thread_state() != _thread_blocked   , "invariant");
+  assert(this->object() != NULL  , "invariant");
+  assert(_count >= 0, "invariant");
 
   // Prevent deflation at STW-time.  See deflate_idle_monitors() and is_busy().
   // Ensure the object-monitor relationship remains stable while there's contention.
@@ -368,9 +368,9 @@ void ATTR ObjectMonitor::enter(TRAPS) {
       // cleared by handle_special_suspend_equivalent_condition()
       // or java_suspend_self()
 
-      EnterI (THREAD) ;
+      EnterI(THREAD);
 
-      if (!ExitSuspendEquivalent(jt)) break ;
+      if (!ExitSuspendEquivalent(jt)) break;
 
       //
       // We have acquired the contended monitor, but while we were
@@ -378,9 +378,9 @@ void ATTR ObjectMonitor::enter(TRAPS) {
       // the monitor while suspended because that would surprise the
       // thread that suspended us.
       //
-          _recursions = 0 ;
-      _succ = NULL ;
-      exit (false, Self) ;
+          _recursions = 0;
+      _succ = NULL;
+      exit(false, Self);
 
       jt->java_suspend_self();
     }
@@ -397,14 +397,14 @@ void ATTR ObjectMonitor::enter(TRAPS) {
   }
 
   Atomic::dec_ptr(&_count);
-  assert (_count >= 0, "invariant") ;
-  Self->_Stalled = 0 ;
+  assert(_count >= 0, "invariant");
+  Self->_Stalled = 0;
 
   // Must either set _recursions = 0 or ASSERT _recursions == 0.
-  assert (_recursions == 0     , "invariant") ;
-  assert (_owner == Self       , "invariant") ;
-  assert (_succ  != Self       , "invariant") ;
-  assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
+  assert(_recursions == 0     , "invariant");
+  assert(_owner == Self       , "invariant");
+  assert(_succ  != Self       , "invariant");
+  assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
 
   // The thread -- now the owner -- is back in vm mode.
   // Report the glorious news via TI,DTrace and jvmstat.
@@ -437,7 +437,7 @@ void ATTR ObjectMonitor::enter(TRAPS) {
   }
 
   if (ObjectMonitor::_sync_ContendedLockAttempts != NULL) {
-     ObjectMonitor::_sync_ContendedLockAttempts->inc() ;
+     ObjectMonitor::_sync_ContendedLockAttempts->inc();
   }
 }
 
@@ -447,37 +447,37 @@ void ATTR ObjectMonitor::enter(TRAPS) {
 
 int ObjectMonitor::TryLock (Thread * Self) {
    for (;;) {
-      void * own = _owner ;
-      if (own != NULL) return 0 ;
+      void * own = _owner;
+      if (own != NULL) return 0;
       if (Atomic::cmpxchg_ptr (Self, &_owner, NULL) == NULL) {
          // Either guarantee _recursions == 0 or set _recursions = 0.
-         assert (_recursions == 0, "invariant") ;
-         assert (_owner == Self, "invariant") ;
+         assert(_recursions == 0, "invariant");
+         assert(_owner == Self, "invariant");
          // CONSIDER: set or assert that OwnerIsThread == 1
-         return 1 ;
+         return 1;
       }
       // The lock had been free momentarily, but we lost the race to the lock.
       // Interference -- the CAS failed.
       // We can either return -1 or retry.
       // Retry doesn't make as much sense because the lock was just acquired.
-      if (true) return -1 ;
+      if (true) return -1;
    }
 }
 
 void ATTR ObjectMonitor::EnterI (TRAPS) {
-    Thread * Self = THREAD ;
-    assert (Self->is_Java_thread(), "invariant") ;
-    assert (((JavaThread *) Self)->thread_state() == _thread_blocked   , "invariant") ;
+    Thread * Self = THREAD;
+    assert(Self->is_Java_thread(), "invariant");
+    assert(((JavaThread *) Self)->thread_state() == _thread_blocked   , "invariant");
 
     // Try the lock - TATAS
     if (TryLock (Self) > 0) {
-        assert (_succ != Self              , "invariant") ;
-        assert (_owner == Self             , "invariant") ;
-        assert (_Responsible != Self       , "invariant") ;
-        return ;
+        assert(_succ != Self              , "invariant");
+        assert(_owner == Self             , "invariant");
+        assert(_Responsible != Self       , "invariant");
+        return;
     }
 
-    DeferredInitialize () ;
+    DeferredInitialize();
 
     // We try one round of spinning *before* enqueueing Self.
     //
@@ -487,16 +487,16 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
     // effects.
 
     if (TrySpin (Self) > 0) {
-        assert (_owner == Self        , "invariant") ;
-        assert (_succ != Self         , "invariant") ;
-        assert (_Responsible != Self  , "invariant") ;
-        return ;
+        assert(_owner == Self        , "invariant");
+        assert(_succ != Self         , "invariant");
+        assert(_Responsible != Self  , "invariant");
+        return;
     }
 
     // The Spin failed -- Enqueue and park the thread ...
-    assert (_succ  != Self            , "invariant") ;
-    assert (_owner != Self            , "invariant") ;
-    assert (_Responsible != Self      , "invariant") ;
+    assert(_succ  != Self            , "invariant");
+    assert(_owner != Self            , "invariant");
+    assert(_Responsible != Self      , "invariant");
 
     // Enqueue "Self" on ObjectMonitor's _cxq.
     //
@@ -508,27 +508,27 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
     // TODO: eliminate ObjectWaiter and enqueue either Threads or Events.
     //
 
-    ObjectWaiter node(Self) ;
-    Self->_ParkEvent->reset() ;
-    node._prev   = (ObjectWaiter *) 0xBAD ;
-    node.TState  = ObjectWaiter::TS_CXQ ;
+    ObjectWaiter node(Self);
+    Self->_ParkEvent->reset();
+    node._prev   = (ObjectWaiter *) 0xBAD;
+    node.TState  = ObjectWaiter::TS_CXQ;
 
     // Push "Self" onto the front of the _cxq.
     // Once on cxq/EntryList, Self stays on-queue until it acquires the lock.
     // Note that spinning tends to reduce the rate at which threads
     // enqueue and dequeue on EntryList|cxq.
-    ObjectWaiter * nxt ;
+    ObjectWaiter * nxt;
     for (;;) {
-        node._next = nxt = _cxq ;
-        if (Atomic::cmpxchg_ptr (&node, &_cxq, nxt) == nxt) break ;
+        node._next = nxt = _cxq;
+        if (Atomic::cmpxchg_ptr(&node, &_cxq, nxt) == nxt) break;
 
         // Interference - the CAS failed because _cxq changed.  Just retry.
         // As an optional optimization we retry the lock.
         if (TryLock (Self) > 0) {
-            assert (_succ != Self         , "invariant") ;
-            assert (_owner == Self        , "invariant") ;
-            assert (_Responsible != Self  , "invariant") ;
-            return ;
+            assert(_succ != Self         , "invariant");
+            assert(_owner == Self        , "invariant");
+            assert(_Responsible != Self  , "invariant");
+            return;
         }
     }
 
@@ -558,7 +558,7 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
     if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) {
         // Try to assume the role of responsible thread for the monitor.
         // CONSIDER:  ST vs CAS vs { if (Responsible==null) Responsible=Self }
-        Atomic::cmpxchg_ptr (Self, &_Responsible, NULL) ;
+        Atomic::cmpxchg_ptr(Self, &_Responsible, NULL);
     }
 
     // The lock have been released while this thread was occupied queueing
@@ -572,49 +572,49 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
     // to defer the state transitions until absolutely necessary,
     // and in doing so avoid some transitions ...
 
-    TEVENT (Inflated enter - Contention) ;
-    int nWakeups = 0 ;
-    int RecheckInterval = 1 ;
+    TEVENT(Inflated enter - Contention);
+    int nWakeups = 0;
+    int RecheckInterval = 1;
 
     for (;;) {
 
-        if (TryLock (Self) > 0) break ;
-        assert (_owner != Self, "invariant") ;
+        if (TryLock(Self) > 0) break;
+        assert(_owner != Self, "invariant");
 
         if ((SyncFlags & 2) && _Responsible == NULL) {
-           Atomic::cmpxchg_ptr (Self, &_Responsible, NULL) ;
+           Atomic::cmpxchg_ptr(Self, &_Responsible, NULL);
         }
 
         // park self
         if (_Responsible == Self || (SyncFlags & 1)) {
-            TEVENT (Inflated enter - park TIMED) ;
-            Self->_ParkEvent->park ((jlong) RecheckInterval) ;
+            TEVENT(Inflated enter - park TIMED);
+            Self->_ParkEvent->park((jlong) RecheckInterval);
             // Increase the RecheckInterval, but clamp the value.
-            RecheckInterval *= 8 ;
-            if (RecheckInterval > 1000) RecheckInterval = 1000 ;
+            RecheckInterval *= 8;
+            if (RecheckInterval > 1000) RecheckInterval = 1000;
         } else {
-            TEVENT (Inflated enter - park UNTIMED) ;
-            Self->_ParkEvent->park() ;
+            TEVENT(Inflated enter - park UNTIMED);
+            Self->_ParkEvent->park();
         }
 
-        if (TryLock(Self) > 0) break ;
+        if (TryLock(Self) > 0) break;
 
         // The lock is still contested.
         // Keep a tally of the # of futile wakeups.
         // Note that the counter is not protected by a lock or updated by atomics.
         // That is by design - we trade "lossy" counters which are exposed to
         // races during updates for a lower probe effect.
-        TEVENT (Inflated enter - Futile wakeup) ;
+        TEVENT(Inflated enter - Futile wakeup);
         if (ObjectMonitor::_sync_FutileWakeups != NULL) {
-           ObjectMonitor::_sync_FutileWakeups->inc() ;
+           ObjectMonitor::_sync_FutileWakeups->inc();
         }
-        ++ nWakeups ;
+        ++nWakeups;
 
         // Assuming this is not a spurious wakeup we'll normally find _succ == Self.
         // We can defer clearing _succ until after the spin completes
         // TrySpin() must tolerate being called with _succ == Self.
         // Try yet another round of adaptive spinning.
-        if ((Knob_SpinAfterFutile & 1) && TrySpin (Self) > 0) break ;
+        if ((Knob_SpinAfterFutile & 1) && TrySpin(Self) > 0) break;
 
         // We can find that we were unpark()ed and redesignated _succ while
         // we were spinning.  That's harmless.  If we iterate and call park(),
@@ -625,13 +625,13 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
         // in the next iteration.
 
         if ((Knob_ResetEvent & 1) && Self->_ParkEvent->fired()) {
-           Self->_ParkEvent->reset() ;
-           OrderAccess::fence() ;
+           Self->_ParkEvent->reset();
+           OrderAccess::fence();
         }
-        if (_succ == Self) _succ = NULL ;
+        if (_succ == Self) _succ = NULL;
 
         // Invariant: after clearing _succ a thread *must* retry _owner before parking.
-        OrderAccess::fence() ;
+        OrderAccess::fence();
     }
 
     // Egress :
@@ -642,18 +642,18 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
     // The head of cxq is volatile but the interior is stable.
     // In addition, Self.TState is stable.
 
-    assert (_owner == Self      , "invariant") ;
-    assert (object() != NULL    , "invariant") ;
+    assert(_owner == Self      , "invariant");
+    assert(object() != NULL    , "invariant");
     // I'd like to write:
     //   guarantee (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
     // but as we're at a safepoint that's not safe.
 
-    UnlinkAfterAcquire (Self, &node) ;
-    if (_succ == Self) _succ = NULL ;
+    UnlinkAfterAcquire(Self, &node);
+    if (_succ == Self) _succ = NULL;
 
-    assert (_succ != Self, "invariant") ;
+    assert(_succ != Self, "invariant");
     if (_Responsible == Self) {
-        _Responsible = NULL ;
+        _Responsible = NULL;
         OrderAccess::fence(); // Dekker pivot-point
 
         // We may leave threads on cxq|EntryList without a designated
@@ -700,9 +700,9 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
     // execute a serializing instruction.
 
     if (SyncFlags & 8) {
-       OrderAccess::fence() ;
+       OrderAccess::fence();
     }
-    return ;
+    return;
 }
 
 // ReenterI() is a specialized inline form of the latter half of the
@@ -714,24 +714,24 @@ void ATTR ObjectMonitor::EnterI (TRAPS) {
 // loop accordingly.
 
 void ATTR ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) {
-    assert (Self != NULL                , "invariant") ;
-    assert (SelfNode != NULL            , "invariant") ;
-    assert (SelfNode->_thread == Self   , "invariant") ;
-    assert (_waiters > 0                , "invariant") ;
-    assert (((oop)(object()))->mark() == markOopDesc::encode(this) , "invariant") ;
-    assert (((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant") ;
-    JavaThread * jt = (JavaThread *) Self ;
-
-    int nWakeups = 0 ;
+    assert(Self != NULL                , "invariant");
+    assert(SelfNode != NULL            , "invariant");
+    assert(SelfNode->_thread == Self   , "invariant");
+    assert(_waiters > 0                , "invariant");
+    assert(((oop)(object()))->mark() == markOopDesc::encode(this) , "invariant");
+    assert(((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant");
+    JavaThread * jt = (JavaThread *) Self;
+
+    int nWakeups = 0;
     for (;;) {
-        ObjectWaiter::TStates v = SelfNode->TState ;
-        guarantee (v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant") ;
-        assert    (_owner != Self, "invariant") ;
+        ObjectWaiter::TStates v = SelfNode->TState;
+        guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant");
+        assert(_owner != Self, "invariant");
 
-        if (TryLock (Self) > 0) break ;
-        if (TrySpin (Self) > 0) break ;
+        if (TryLock(Self) > 0) break;
+        if (TrySpin(Self) > 0) break;
 
-        TEVENT (Wait Reentry - parking) ;
+        TEVENT(Wait Reentry - parking);
 
         // State transition wrappers around park() ...
         // ReenterI() wisely defers state transitions until
@@ -744,14 +744,14 @@ void ATTR ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) {
            // or java_suspend_self()
            jt->set_suspend_equivalent();
            if (SyncFlags & 1) {
-              Self->_ParkEvent->park ((jlong)1000) ;
+              Self->_ParkEvent->park((jlong)1000);
            } else {
-              Self->_ParkEvent->park () ;
+              Self->_ParkEvent->park();
            }
 
            // were we externally suspended while we were waiting?
            for (;;) {
-              if (!ExitSuspendEquivalent (jt)) break ;
+              if (!ExitSuspendEquivalent(jt)) break;
               if (_succ == Self) { _succ = NULL; OrderAccess::fence(); }
               jt->java_suspend_self();
               jt->set_suspend_equivalent();
@@ -761,26 +761,26 @@ void ATTR ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) {
         // Try again, but just so we distinguish between futile wakeups and
         // successful wakeups.  The following test isn't algorithmically
         // necessary, but it helps us maintain sensible statistics.
-        if (TryLock(Self) > 0) break ;
+        if (TryLock(Self) > 0) break;
 
         // The lock is still contested.
         // Keep a tally of the # of futile wakeups.
         // Note that the counter is not protected by a lock or updated by atomics.
         // That is by design - we trade "lossy" counters which are exposed to
         // races during updates for a lower probe effect.
-        TEVENT (Wait Reentry - futile wakeup) ;
-        ++ nWakeups ;
+        TEVENT(Wait Reentry - futile wakeup);
+        ++nWakeups;
 
         // Assuming this is not a spurious wakeup we'll normally
         // find that _succ == Self.
-        if (_succ == Self) _succ = NULL ;
+        if (_succ == Self) _succ = NULL;
 
         // Invariant: after clearing _succ a contending thread
         // *must* retry  _owner before parking.
-        OrderAccess::fence() ;
+        OrderAccess::fence();
 
         if (ObjectMonitor::_sync_FutileWakeups != NULL) {
-          ObjectMonitor::_sync_FutileWakeups->inc() ;
+          ObjectMonitor::_sync_FutileWakeups->inc();
         }
     }
 
@@ -792,13 +792,13 @@ void ATTR ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) {
     // The head of cxq is volatile but the interior is stable.
     // In addition, Self.TState is stable.
 
-    assert (_owner == Self, "invariant") ;
-    assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
-    UnlinkAfterAcquire (Self, SelfNode) ;
-    if (_succ == Self) _succ = NULL ;
-    assert (_succ != Self, "invariant") ;
-    SelfNode->TState = ObjectWaiter::TS_RUN ;
-    OrderAccess::fence() ;      // see comments at the end of EnterI()
+    assert(_owner == Self, "invariant");
+    assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
+    UnlinkAfterAcquire(Self, SelfNode);
+    if (_succ == Self) _succ = NULL;
+    assert(_succ != Self, "invariant");
+    SelfNode->TState = ObjectWaiter::TS_RUN;
+    OrderAccess::fence();      // see comments at the end of EnterI()
 }
 
 // after the thread acquires the lock in ::enter().  Equally, we could defer
@@ -806,22 +806,22 @@ void ATTR ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) {
 
 void ObjectMonitor::UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode)
 {
-    assert (_owner == Self, "invariant") ;
-    assert (SelfNode->_thread == Self, "invariant") ;
+    assert(_owner == Self, "invariant");
+    assert(SelfNode->_thread == Self, "invariant");
 
     if (SelfNode->TState == ObjectWaiter::TS_ENTER) {
         // Normal case: remove Self from the DLL EntryList .
         // This is a constant-time operation.
-        ObjectWaiter * nxt = SelfNode->_next ;
-        ObjectWaiter * prv = SelfNode->_prev ;
-        if (nxt != NULL) nxt->_prev = prv ;
-        if (prv != NULL) prv->_next = nxt ;
-        if (SelfNode == _EntryList ) _EntryList = nxt ;
-        assert (nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        assert (prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        TEVENT (Unlink from EntryList) ;
+        ObjectWaiter * nxt = SelfNode->_next;
+        ObjectWaiter * prv = SelfNode->_prev;
+        if (nxt != NULL) nxt->_prev = prv;
+        if (prv != NULL) prv->_next = nxt;
+        if (SelfNode == _EntryList) _EntryList = nxt;
+        assert(nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant");
+        assert(prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant");
+        TEVENT(Unlink from EntryList);
     } else {
-        guarantee (SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant") ;
+        guarantee(SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant");
         // Inopportune interleaving -- Self is still on the cxq.
         // This usually means the enqueue of self raced an exiting thread.
         // Normally we'll find Self near the front of the cxq, so
@@ -835,36 +835,36 @@ void ObjectMonitor::UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode)
         // and then unlink Self from EntryList.  We have to drain eventually,
         // so it might as well be now.
 
-        ObjectWaiter * v = _cxq ;
-        assert (v != NULL, "invariant") ;
+        ObjectWaiter * v = _cxq;
+        assert(v != NULL, "invariant");
         if (v != SelfNode || Atomic::cmpxchg_ptr (SelfNode->_next, &_cxq, v) != v) {
             // The CAS above can fail from interference IFF a "RAT" arrived.
             // In that case Self must be in the interior and can no longer be
             // at the head of cxq.
             if (v == SelfNode) {
-                assert (_cxq != v, "invariant") ;
-                v = _cxq ;          // CAS above failed - start scan at head of list
+                assert(_cxq != v, "invariant");
+                v = _cxq;          // CAS above failed - start scan at head of list
             }
-            ObjectWaiter * p ;
-            ObjectWaiter * q = NULL ;
-            for (p = v ; p != NULL && p != SelfNode; p = p->_next) {
-                q = p ;
-                assert (p->TState == ObjectWaiter::TS_CXQ, "invariant") ;
+            ObjectWaiter * p;
+            ObjectWaiter * q = NULL;
+            for (p = v; p != NULL && p != SelfNode; p = p->_next) {
+                q = p;
+                assert(p->TState == ObjectWaiter::TS_CXQ, "invariant");
             }
-            assert (v != SelfNode,  "invariant") ;
-            assert (p == SelfNode,  "Node not found on cxq") ;
-            assert (p != _cxq,      "invariant") ;
-            assert (q != NULL,      "invariant") ;
-            assert (q->_next == p,  "invariant") ;
-            q->_next = p->_next ;
+            assert(v != SelfNode, "invariant");
+            assert(p == SelfNode, "Node not found on cxq");
+            assert(p != _cxq, "invariant");
+            assert(q != NULL, "invariant");
+            assert(q->_next == p, "invariant");
+            q->_next = p->_next;
         }
-        TEVENT (Unlink from cxq) ;
+        TEVENT(Unlink from cxq);
     }
 
     // Diagnostic hygiene ...
-    SelfNode->_prev  = (ObjectWaiter *) 0xBAD ;
-    SelfNode->_next  = (ObjectWaiter *) 0xBAD ;
-    SelfNode->TState = ObjectWaiter::TS_RUN ;
+    SelfNode->_prev  = (ObjectWaiter *) 0xBAD;
+    SelfNode->_next  = (ObjectWaiter *) 0xBAD;
+    SelfNode->TState = ObjectWaiter::TS_RUN;
 }
 
 // -----------------------------------------------------------------------------
@@ -919,22 +919,22 @@ void ObjectMonitor::UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode)
 // a monitor will use a timer.
 
 void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
-   Thread * Self = THREAD ;
+   Thread * Self = THREAD;
    if (THREAD != _owner) {
      if (THREAD->is_lock_owned((address) _owner)) {
        // Transmute _owner from a BasicLock pointer to a Thread address.
        // We don't need to hold _mutex for this transition.
        // Non-null to Non-null is safe as long as all readers can
        // tolerate either flavor.
-       assert (_recursions == 0, "invariant") ;
-       _owner = THREAD ;
-       _recursions = 0 ;
-       OwnerIsThread = 1 ;
+       assert(_recursions == 0, "invariant");
+       _owner = THREAD;
+       _recursions = 0;
+       OwnerIsThread = 1;
      } else {
        // NOTE: we need to handle unbalanced monitor enter/exit
        // in native code by throwing an exception.
        // TODO: Throw an IllegalMonitorStateException ?
-       TEVENT (Exit - Throw IMSX) ;
+       TEVENT(Exit - Throw IMSX);
        assert(false, "Non-balanced monitor enter/exit!");
        if (false) {
           THROW(vmSymbols::java_lang_IllegalMonitorStateException());
@@ -945,14 +945,14 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
 
    if (_recursions != 0) {
      _recursions--;        // this is simple recursive enter
-     TEVENT (Inflated exit - recursive) ;
-     return ;
+     TEVENT(Inflated exit - recursive);
+     return;
    }
 
    // Invariant: after setting Responsible=null an thread must execute
    // a MEMBAR or other serializing instruction before fetching EntryList|cxq.
    if ((SyncFlags & 4) == 0) {
-      _Responsible = NULL ;
+      _Responsible = NULL;
    }
 
 #if INCLUDE_TRACE
@@ -964,7 +964,7 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
 #endif
 
    for (;;) {
-      assert (THREAD == _owner, "invariant") ;
+      assert(THREAD == _owner, "invariant");
 
 
       if (Knob_ExitPolicy == 0) {
@@ -980,13 +980,13 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
          // in massive wasteful coherency traffic on classic SMP systems.
          // Instead, I use release_store(), which is implemented as just a simple
          // ST on x64, x86 and SPARC.
-         OrderAccess::release_store_ptr (&_owner, NULL) ;   // drop the lock
-         OrderAccess::storeload() ;                         // See if we need to wake a successor
+         OrderAccess::release_store_ptr(&_owner, NULL);   // drop the lock
+         OrderAccess::storeload();                         // See if we need to wake a successor
          if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) {
-            TEVENT (Inflated exit - simple egress) ;
-            return ;
+            TEVENT(Inflated exit - simple egress);
+            return;
          }
-         TEVENT (Inflated exit - complex egress) ;
+         TEVENT(Inflated exit - complex egress);
 
          // Normally the exiting thread is responsible for ensuring succession,
          // but if other successors are ready or other entering threads are spinning
@@ -1026,17 +1026,17 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
          // falls to the new owner.
          //
          if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) {
-            return ;
+            return;
          }
-         TEVENT (Exit - Reacquired) ;
+         TEVENT(Exit - Reacquired);
       } else {
          if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) {
-            OrderAccess::release_store_ptr (&_owner, NULL) ;   // drop the lock
-            OrderAccess::storeload() ;
+            OrderAccess::release_store_ptr(&_owner, NULL);   // drop the lock
+            OrderAccess::storeload();
             // Ratify the previously observed values.
             if (_cxq == NULL || _succ != NULL) {
-                TEVENT (Inflated exit - simple egress) ;
-                return ;
+                TEVENT(Inflated exit - simple egress);
+                return;
             }
 
             // inopportune interleaving -- the exiting thread (this thread)
@@ -1051,29 +1051,29 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
             //     we could simply unpark() the lead thread and return
             //     without having set _succ.
             if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) {
-               TEVENT (Inflated exit - reacquired succeeded) ;
-               return ;
+               TEVENT(Inflated exit - reacquired succeeded);
+               return;
             }
-            TEVENT (Inflated exit - reacquired failed) ;
+            TEVENT(Inflated exit - reacquired failed);
          } else {
-            TEVENT (Inflated exit - complex egress) ;
+            TEVENT(Inflated exit - complex egress);
          }
       }
 
-      guarantee (_owner == THREAD, "invariant") ;
+      guarantee(_owner == THREAD, "invariant");
 
-      ObjectWaiter * w = NULL ;
-      int QMode = Knob_QMode ;
+      ObjectWaiter * w = NULL;
+      int QMode = Knob_QMode;
 
       if (QMode == 2 && _cxq != NULL) {
           // QMode == 2 : cxq has precedence over EntryList.
           // Try to directly wake a successor from the cxq.
           // If successful, the successor will need to unlink itself from cxq.
-          w = _cxq ;
-          assert (w != NULL, "invariant") ;
-          assert (w->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-          ExitEpilog (Self, w) ;
-          return ;
+          w = _cxq;
+          assert(w != NULL, "invariant");
+          assert(w->TState == ObjectWaiter::TS_CXQ, "Invariant");
+          ExitEpilog(Self, w);
+          return;
       }
 
       if (QMode == 3 && _cxq != NULL) {
@@ -1082,33 +1082,33 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
           // Drain _cxq into EntryList - bulk transfer.
           // First, detach _cxq.
           // The following loop is tantamount to: w = swap (&cxq, NULL)
-          w = _cxq ;
+          w = _cxq;
           for (;;) {
-             assert (w != NULL, "Invariant") ;
-             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr (NULL, &_cxq, w) ;
-             if (u == w) break ;
-             w = u ;
+             assert(w != NULL, "Invariant");
+             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w);
+             if (u == w) break;
+             w = u;
           }
-          assert (w != NULL              , "invariant") ;
-
-          ObjectWaiter * q = NULL ;
-          ObjectWaiter * p ;
-          for (p = w ; p != NULL ; p = p->_next) {
-              guarantee (p->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-              p->TState = ObjectWaiter::TS_ENTER ;
-              p->_prev = q ;
-              q = p ;
+          assert(w != NULL              , "invariant");
+
+          ObjectWaiter * q = NULL;
+          ObjectWaiter * p;
+          for (p = w; p != NULL; p = p->_next) {
+              guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant");
+              p->TState = ObjectWaiter::TS_ENTER;
+              p->_prev = q;
+              q = p;
           }
 
           // Append the RATs to the EntryList
           // TODO: organize EntryList as a CDLL so we can locate the tail in constant-time.
-          ObjectWaiter * Tail ;
-          for (Tail = _EntryList ; Tail != NULL && Tail->_next != NULL ; Tail = Tail->_next) ;
+          ObjectWaiter * Tail;
+          for (Tail = _EntryList; Tail != NULL && Tail->_next != NULL; Tail = Tail->_next);
           if (Tail == NULL) {
-              _EntryList = w ;
+              _EntryList = w;
           } else {
-              Tail->_next = w ;
-              w->_prev = Tail ;
+              Tail->_next = w;
+              w->_prev = Tail;
           }
 
           // Fall thru into code that tries to wake a successor from EntryList
@@ -1121,35 +1121,35 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
           // Drain _cxq into EntryList - bulk transfer.
           // First, detach _cxq.
           // The following loop is tantamount to: w = swap (&cxq, NULL)
-          w = _cxq ;
+          w = _cxq;
           for (;;) {
-             assert (w != NULL, "Invariant") ;
-             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr (NULL, &_cxq, w) ;
-             if (u == w) break ;
-             w = u ;
+             assert(w != NULL, "Invariant");
+             ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w);
+             if (u == w) break;
+             w = u;
           }
-          assert (w != NULL              , "invariant") ;
-
-          ObjectWaiter * q = NULL ;
-          ObjectWaiter * p ;
-          for (p = w ; p != NULL ; p = p->_next) {
-              guarantee (p->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-              p->TState = ObjectWaiter::TS_ENTER ;
-              p->_prev = q ;
-              q = p ;
+          assert(w != NULL              , "invariant");
+
+          ObjectWaiter * q = NULL;
+          ObjectWaiter * p;
+          for (p = w; p != NULL; p = p->_next) {
+              guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant");
+              p->TState = ObjectWaiter::TS_ENTER;
+              p->_prev = q;
+              q = p;
           }
 
           // Prepend the RATs to the EntryList
           if (_EntryList != NULL) {
-              q->_next = _EntryList ;
-              _EntryList->_prev = q ;
+              q->_next = _EntryList;
+              _EntryList->_prev = q;
           }
-          _EntryList = w ;
+          _EntryList = w;
 
           // Fall thru into code that tries to wake a successor from EntryList
       }
 
-      w = _EntryList  ;
+      w = _EntryList;
       if (w != NULL) {
           // I'd like to write: guarantee (w->_thread != Self).
           // But in practice an exiting thread may find itself on the EntryList.
@@ -1162,29 +1162,29 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
           // reacquires the lock and then finds itself on the EntryList.
           // Given all that, we have to tolerate the circumstance where "w" is
           // associated with Self.
-          assert (w->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-          ExitEpilog (Self, w) ;
-          return ;
+          assert(w->TState == ObjectWaiter::TS_ENTER, "invariant");
+          ExitEpilog(Self, w);
+          return;
       }
 
       // If we find that both _cxq and EntryList are null then just
       // re-run the exit protocol from the top.
-      w = _cxq ;
-      if (w == NULL) continue ;
+      w = _cxq;
+      if (w == NULL) continue;
 
       // Drain _cxq into EntryList - bulk transfer.
       // First, detach _cxq.
       // The following loop is tantamount to: w = swap (&cxq, NULL)
       for (;;) {
-          assert (w != NULL, "Invariant") ;
-          ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr (NULL, &_cxq, w) ;
-          if (u == w) break ;
-          w = u ;
+          assert(w != NULL, "Invariant");
+          ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w);
+          if (u == w) break;
+          w = u;
       }
-      TEVENT (Inflated exit - drain cxq into EntryList) ;
+      TEVENT(Inflated exit - drain cxq into EntryList);
 
-      assert (w != NULL              , "invariant") ;
-      assert (_EntryList  == NULL    , "invariant") ;
+      assert(w != NULL              , "invariant");
+      assert(_EntryList  == NULL    , "invariant");
 
       // Convert the LIFO SLL anchored by _cxq into a DLL.
       // The list reorganization step operates in O(LENGTH(w)) time.
@@ -1198,30 +1198,30 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
       if (QMode == 1) {
          // QMode == 1 : drain cxq to EntryList, reversing order
          // We also reverse the order of the list.
-         ObjectWaiter * s = NULL ;
-         ObjectWaiter * t = w ;
-         ObjectWaiter * u = NULL ;
+         ObjectWaiter * s = NULL;
+         ObjectWaiter * t = w;
+         ObjectWaiter * u = NULL;
          while (t != NULL) {
-             guarantee (t->TState == ObjectWaiter::TS_CXQ, "invariant") ;
-             t->TState = ObjectWaiter::TS_ENTER ;
-             u = t->_next ;
-             t->_prev = u ;
-             t->_next = s ;
+             guarantee(t->TState == ObjectWaiter::TS_CXQ, "invariant");
+             t->TState = ObjectWaiter::TS_ENTER;
+             u = t->_next;
+             t->_prev = u;
+             t->_next = s;
              s = t;
-             t = u ;
+             t = u;
          }
-         _EntryList  = s ;
-         assert (s != NULL, "invariant") ;
+         _EntryList  = s;
+         assert(s != NULL, "invariant");
       } else {
          // QMode == 0 or QMode == 2
-         _EntryList = w ;
-         ObjectWaiter * q = NULL ;
-         ObjectWaiter * p ;
-         for (p = w ; p != NULL ; p = p->_next) {
-             guarantee (p->TState == ObjectWaiter::TS_CXQ, "Invariant") ;
-             p->TState = ObjectWaiter::TS_ENTER ;
-             p->_prev = q ;
-             q = p ;
+         _EntryList = w;
+         ObjectWaiter * q = NULL;
+         ObjectWaiter * p;
+         for (p = w; p != NULL; p = p->_next) {
+             guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant");
+             p->TState = ObjectWaiter::TS_ENTER;
+             p->_prev = q;
+             q = p;
          }
       }
 
@@ -1233,11 +1233,11 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
       // context-switch rate.
       if (_succ != NULL) continue;
 
-      w = _EntryList  ;
+      w = _EntryList;
       if (w != NULL) {
-          guarantee (w->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-          ExitEpilog (Self, w) ;
-          return ;
+          guarantee(w->TState == ObjectWaiter::TS_ENTER, "invariant");
+          ExitEpilog(Self, w);
+          return;
       }
    }
 }
@@ -1275,22 +1275,22 @@ void ATTR ObjectMonitor::exit(bool not_suspended, TRAPS) {
 
 
 bool ObjectMonitor::ExitSuspendEquivalent (JavaThread * jSelf) {
-   int Mode = Knob_FastHSSEC ;
+   int Mode = Knob_FastHSSEC;
    if (Mode && !jSelf->is_external_suspend()) {
-      assert (jSelf->is_suspend_equivalent(), "invariant") ;
-      jSelf->clear_suspend_equivalent() ;
-      if (2 == Mode) OrderAccess::storeload() ;
-      if (!jSelf->is_external_suspend()) return false ;
+      assert(jSelf->is_suspend_equivalent(), "invariant");
+      jSelf->clear_suspend_equivalent();
+      if (2 == Mode) OrderAccess::storeload();
+      if (!jSelf->is_external_suspend()) return false;
       // We raced a suspension -- fall thru into the slow path
-      TEVENT (ExitSuspendEquivalent - raced) ;
-      jSelf->set_suspend_equivalent() ;
+      TEVENT(ExitSuspendEquivalent - raced);
+      jSelf->set_suspend_equivalent();
    }
-   return jSelf->handle_special_suspend_equivalent_condition() ;
+   return jSelf->handle_special_suspend_equivalent_condition();
 }
 
 
 void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) {
-   assert (_owner == Self, "invariant") ;
+   assert(_owner == Self, "invariant");
 
    // Exit protocol:
    // 1. ST _succ = wakee
@@ -1298,28 +1298,28 @@ void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) {
    // 2. ST _owner = NULL
    // 3. unpark(wakee)
 
-   _succ = Knob_SuccEnabled ? Wakee->_thread : NULL ;
-   ParkEvent * Trigger = Wakee->_event ;
+   _succ = Knob_SuccEnabled ? Wakee->_thread : NULL;
+   ParkEvent * Trigger = Wakee->_event;
 
    // Hygiene -- once we've set _owner = NULL we can't safely dereference Wakee again.
    // The thread associated with Wakee may have grabbed the lock and "Wakee" may be
    // out-of-scope (non-extant).
-   Wakee  = NULL ;
+   Wakee  = NULL;
 
    // Drop the lock
-   OrderAccess::release_store_ptr (&_owner, NULL) ;
-   OrderAccess::fence() ;                               // ST _owner vs LD in unpark()
+   OrderAccess::release_store_ptr(&_owner, NULL);
+   OrderAccess::fence();                               // ST _owner vs LD in unpark()
 
    if (SafepointSynchronize::do_call_back()) {
-      TEVENT (unpark before SAFEPOINT) ;
+      TEVENT(unpark before SAFEPOINT);
    }
 
    DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self);
-   Trigger->unpark() ;
+   Trigger->unpark();
 
    // Maintain stats and report events to JVMTI
    if (ObjectMonitor::_sync_Parks != NULL) {
-      ObjectMonitor::_sync_Parks->inc() ;
+      ObjectMonitor::_sync_Parks->inc();
    }
 }
 
@@ -1343,17 +1343,17 @@ intptr_t ObjectMonitor::complete_exit(TRAPS) {
    if (THREAD != _owner) {
     if (THREAD->is_lock_owned ((address)_owner)) {
        assert(_recursions == 0, "internal state error");
-       _owner = THREAD ;   /* Convert from basiclock addr to Thread addr */
-       _recursions = 0 ;
-       OwnerIsThread = 1 ;
+       _owner = THREAD;   /* Convert from basiclock addr to Thread addr */
+       _recursions = 0;
+       OwnerIsThread = 1;
     }
    }
 
    guarantee(Self == _owner, "complete_exit not owner");
    intptr_t save = _recursions; // record the old recursion count
    _recursions = 0;        // set the recursion level to be 0
-   exit (true, Self) ;           // exit the monitor
-   guarantee (_owner != Self, "invariant");
+   exit(true, Self);           // exit the monitor
+   guarantee(_owner != Self, "invariant");
    return save;
 }
 
@@ -1365,8 +1365,8 @@ void ObjectMonitor::reenter(intptr_t recursions, TRAPS) {
    JavaThread *jt = (JavaThread *)THREAD;
 
    guarantee(_owner != Self, "reenter already owner");
-   enter (THREAD);       // enter the monitor
-   guarantee (_recursions == 0, "reenter recursion");
+   enter(THREAD);       // enter the monitor
+   guarantee(_recursions == 0, "reenter recursion");
    _recursions = recursions;
    return;
 }
@@ -1382,11 +1382,11 @@ void ObjectMonitor::reenter(intptr_t recursions, TRAPS) {
   do {                                                                            \
     if (THREAD != _owner) {                                                       \
       if (THREAD->is_lock_owned((address) _owner)) {                              \
-        _owner = THREAD ;  /* Convert from basiclock addr to Thread addr */       \
+        _owner = THREAD;  /* Convert from basiclock addr to Thread addr */       \
         _recursions = 0;                                                          \
-        OwnerIsThread = 1 ;                                                       \
+        OwnerIsThread = 1;                                                       \
       } else {                                                                    \
-        TEVENT (Throw IMSX) ;                                                     \
+        TEVENT(Throw IMSX);                                                     \
         THROW(vmSymbols::java_lang_IllegalMonitorStateException());               \
       }                                                                           \
     }                                                                             \
@@ -1396,15 +1396,15 @@ void ObjectMonitor::reenter(intptr_t recursions, TRAPS) {
 // TODO-FIXME: remove check_slow() -- it's likely dead.
 
 void ObjectMonitor::check_slow(TRAPS) {
-  TEVENT (check_slow - throw IMSX) ;
+  TEVENT(check_slow - throw IMSX);
   assert(THREAD != _owner && !THREAD->is_lock_owned((address) _owner), "must not be owner");
   THROW_MSG(vmSymbols::java_lang_IllegalMonitorStateException(), "current thread not owner");
 }
 
 static int Adjust (volatile int * adr, int dx) {
-  int v ;
-  for (v = *adr ; Atomic::cmpxchg (v + dx, adr, v) != v; v = *adr) ;
-  return v ;
+  int v;
+  for (v = *adr; Atomic::cmpxchg(v + dx, adr, v) != v; v = *adr);
+  return v;
 }
 
 // helper method for posting a monitor wait event
@@ -1426,11 +1426,11 @@ void ObjectMonitor::post_monitor_wait_event(EventJavaMonitorWait* event,
 // Note: a subset of changes to ObjectMonitor::wait()
 // will need to be replicated in complete_exit above
 void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
-   Thread * const Self = THREAD ;
+   Thread * const Self = THREAD;
    assert(Self->is_Java_thread(), "Must be Java thread!");
    JavaThread *jt = (JavaThread *)THREAD;
 
-   DeferredInitialize () ;
+   DeferredInitialize();
 
    // Throw IMSX or IEX.
    CHECK_OWNER();
@@ -1456,23 +1456,23 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
      if (event.should_commit()) {
        post_monitor_wait_event(&event, 0, millis, false);
      }
-     TEVENT (Wait - Throw IEX) ;
+     TEVENT(Wait - Throw IEX);
      THROW(vmSymbols::java_lang_InterruptedException());
-     return ;
+     return;
    }
 
-   TEVENT (Wait) ;
+   TEVENT(Wait);
 
-   assert (Self->_Stalled == 0, "invariant") ;
-   Self->_Stalled = intptr_t(this) ;
+   assert(Self->_Stalled == 0, "invariant");
+   Self->_Stalled = intptr_t(this);
    jt->set_current_waiting_monitor(this);
 
    // create a node to be put into the queue
    // Critically, after we reset() the event but prior to park(), we must check
    // for a pending interrupt.
    ObjectWaiter node(Self);
-   node.TState = ObjectWaiter::TS_WAIT ;
-   Self->_ParkEvent->reset() ;
+   node.TState = ObjectWaiter::TS_WAIT;
+   Self->_ParkEvent->reset();
    OrderAccess::fence();          // ST into Event; membar ; LD interrupted-flag
 
    // Enter the waiting queue, which is a circular doubly linked list in this case
@@ -1482,18 +1482,18 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
    // returns because of a timeout of interrupt.  Contention is exceptionally rare
    // so we use a simple spin-lock instead of a heavier-weight blocking lock.
 
-   Thread::SpinAcquire (&_WaitSetLock, "WaitSet - add") ;
-   AddWaiter (&node) ;
-   Thread::SpinRelease (&_WaitSetLock) ;
+   Thread::SpinAcquire(&_WaitSetLock, "WaitSet - add");
+   AddWaiter(&node);
+   Thread::SpinRelease(&_WaitSetLock);
 
    if ((SyncFlags & 4) == 0) {
-      _Responsible = NULL ;
+      _Responsible = NULL;
    }
    intptr_t save = _recursions; // record the old recursion count
    _waiters++;                  // increment the number of waiters
    _recursions = 0;             // set the recursion level to be 1
-   exit (true, Self) ;                    // exit the monitor
-   guarantee (_owner != Self, "invariant") ;
+   exit(true, Self);                    // exit the monitor
+   guarantee(_owner != Self, "invariant");
 
    // The thread is on the WaitSet list - now park() it.
    // On MP systems it's conceivable that a brief spin before we park
@@ -1502,8 +1502,8 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
    // TODO-FIXME: change the following logic to a loop of the form
    //   while (!timeout && !interrupted && _notified == 0) park()
 
-   int ret = OS_OK ;
-   int WasNotified = 0 ;
+   int ret = OS_OK;
+   int WasNotified = 0;
    { // State transition wrappers
      OSThread* osthread = Self->osthread();
      OSThreadWaitState osts(osthread, true);
@@ -1517,9 +1517,9 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
        } else
        if (node._notified == 0) {
          if (millis <= 0) {
-            Self->_ParkEvent->park () ;
+            Self->_ParkEvent->park();
          } else {
-            ret = Self->_ParkEvent->park (millis) ;
+            ret = Self->_ParkEvent->park(millis);
          }
        }
 
@@ -1548,23 +1548,23 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
      // That is, we fail toward safety.
 
      if (node.TState == ObjectWaiter::TS_WAIT) {
-         Thread::SpinAcquire (&_WaitSetLock, "WaitSet - unlink") ;
+         Thread::SpinAcquire(&_WaitSetLock, "WaitSet - unlink");
          if (node.TState == ObjectWaiter::TS_WAIT) {
-            DequeueSpecificWaiter (&node) ;       // unlink from WaitSet
+            DequeueSpecificWaiter(&node);       // unlink from WaitSet
             assert(node._notified == 0, "invariant");
-            node.TState = ObjectWaiter::TS_RUN ;
+            node.TState = ObjectWaiter::TS_RUN;
          }
-         Thread::SpinRelease (&_WaitSetLock) ;
+         Thread::SpinRelease(&_WaitSetLock);
      }
 
      // The thread is now either on off-list (TS_RUN),
      // on the EntryList (TS_ENTER), or on the cxq (TS_CXQ).
      // The Node's TState variable is stable from the perspective of this thread.
      // No other threads will asynchronously modify TState.
-     guarantee (node.TState != ObjectWaiter::TS_WAIT, "invariant") ;
-     OrderAccess::loadload() ;
-     if (_succ == Self) _succ = NULL ;
-     WasNotified = node._notified ;
+     guarantee(node.TState != ObjectWaiter::TS_WAIT, "invariant");
+     OrderAccess::loadload();
+     if (_succ == Self) _succ = NULL;
+     WasNotified = node._notified;
 
      // Reentry phase -- reacquire the monitor.
      // re-enter contended monitor after object.wait().
@@ -1601,18 +1601,18 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
        post_monitor_wait_event(&event, node._notifier_tid, millis, ret == OS_TIMEOUT);
      }
 
-     OrderAccess::fence() ;
+     OrderAccess::fence();
 
-     assert (Self->_Stalled != 0, "invariant") ;
-     Self->_Stalled = 0 ;
+     assert(Self->_Stalled != 0, "invariant");
+     Self->_Stalled = 0;
 
-     assert (_owner != Self, "invariant") ;
-     ObjectWaiter::TStates v = node.TState ;
+     assert(_owner != Self, "invariant");
+     ObjectWaiter::TStates v = node.TState;
      if (v == ObjectWaiter::TS_RUN) {
-         enter (Self) ;
+         enter(Self);
      } else {
-         guarantee (v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant") ;
-         ReenterI (Self, &node) ;
+         guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant");
+         ReenterI(Self, &node);
          node.wait_reenter_end(this);
      }
 
@@ -1620,24 +1620,24 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
      // Lifecycle - the node representing Self must not appear on any queues.
      // Node is about to go out-of-scope, but even if it were immortal we wouldn't
      // want residual elements associated with this thread left on any lists.
-     guarantee (node.TState == ObjectWaiter::TS_RUN, "invariant") ;
-     assert    (_owner == Self, "invariant") ;
-     assert    (_succ != Self , "invariant") ;
+     guarantee(node.TState == ObjectWaiter::TS_RUN, "invariant");
+     assert(_owner == Self, "invariant");
+     assert(_succ != Self , "invariant");
    } // OSThreadWaitState()
 
    jt->set_current_waiting_monitor(NULL);
 
-   guarantee (_recursions == 0, "invariant") ;
+   guarantee(_recursions == 0, "invariant");
    _recursions = save;     // restore the old recursion count
    _waiters--;             // decrement the number of waiters
 
    // Verify a few postconditions
-   assert (_owner == Self       , "invariant") ;
-   assert (_succ  != Self       , "invariant") ;
-   assert (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ;
+   assert(_owner == Self       , "invariant");
+   assert(_succ  != Self       , "invariant");
+   assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
 
    if (SyncFlags & 32) {
-      OrderAccess::fence() ;
+      OrderAccess::fence();
    }
 
    // check if the notification happened
@@ -1645,7 +1645,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
      // no, it could be timeout or Thread.interrupt() or both
      // check for interrupt event, otherwise it is timeout
      if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) {
-       TEVENT (Wait - throw IEX from epilog) ;
+       TEVENT(Wait - throw IEX from epilog);
        THROW(vmSymbols::java_lang_InterruptedException());
      }
    }
@@ -1663,99 +1663,99 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
 void ObjectMonitor::notify(TRAPS) {
   CHECK_OWNER();
   if (_WaitSet == NULL) {
-     TEVENT (Empty-Notify) ;
-     return ;
+     TEVENT(Empty-Notify);
+     return;
   }
   DTRACE_MONITOR_PROBE(notify, this, object(), THREAD);
 
-  int Policy = Knob_MoveNotifyee ;
+  int Policy = Knob_MoveNotifyee;
 
-  Thread::SpinAcquire (&_WaitSetLock, "WaitSet - notify") ;
-  ObjectWaiter * iterator = DequeueWaiter() ;
+  Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notify");
+  ObjectWaiter * iterator = DequeueWaiter();
   if (iterator != NULL) {
-     TEVENT (Notify1 - Transfer) ;
-     guarantee (iterator->TState == ObjectWaiter::TS_WAIT, "invariant") ;
-     guarantee (iterator->_notified == 0, "invariant") ;
+     TEVENT(Notify1 - Transfer);
+     guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant");
+     guarantee(iterator->_notified == 0, "invariant");
      if (Policy != 4) {
-        iterator->TState = ObjectWaiter::TS_ENTER ;
+        iterator->TState = ObjectWaiter::TS_ENTER;
      }
-     iterator->_notified = 1 ;
+     iterator->_notified = 1;
      Thread * Self = THREAD;
      iterator->_notifier_tid = Self->osthread()->thread_id();
 
-     ObjectWaiter * List = _EntryList ;
+     ObjectWaiter * List = _EntryList;
      if (List != NULL) {
-        assert (List->_prev == NULL, "invariant") ;
-        assert (List->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        assert (List != iterator, "invariant") ;
+        assert(List->_prev == NULL, "invariant");
+        assert(List->TState == ObjectWaiter::TS_ENTER, "invariant");
+        assert(List != iterator, "invariant");
      }
 
      if (Policy == 0) {       // prepend to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
-             List->_prev = iterator ;
-             iterator->_next = List ;
-             iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             List->_prev = iterator;
+             iterator->_next = List;
+             iterator->_prev = NULL;
+             _EntryList = iterator;
         }
      } else
      if (Policy == 1) {      // append to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
             // CONSIDER:  finding the tail currently requires a linear-time walk of
             // the EntryList.  We can make tail access constant-time by converting to
             // a CDLL instead of using our current DLL.
-            ObjectWaiter * Tail ;
-            for (Tail = List ; Tail->_next != NULL ; Tail = Tail->_next) ;
-            assert (Tail != NULL && Tail->_next == NULL, "invariant") ;
-            Tail->_next = iterator ;
-            iterator->_prev = Tail ;
-            iterator->_next = NULL ;
+            ObjectWaiter * Tail;
+            for (Tail = List; Tail->_next != NULL; Tail = Tail->_next);
+            assert(Tail != NULL && Tail->_next == NULL, "invariant");
+            Tail->_next = iterator;
+            iterator->_prev = Tail;
+            iterator->_next = NULL;
         }
      } else
      if (Policy == 2) {      // prepend to cxq
          // prepend to cxq
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
-            iterator->TState = ObjectWaiter::TS_CXQ ;
+            iterator->TState = ObjectWaiter::TS_CXQ;
             for (;;) {
-                ObjectWaiter * Front = _cxq ;
-                iterator->_next = Front ;
+                ObjectWaiter * Front = _cxq;
+                iterator->_next = Front;
                 if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) {
-                    break ;
+                    break;
                 }
             }
          }
      } else
      if (Policy == 3) {      // append to cxq
-        iterator->TState = ObjectWaiter::TS_CXQ ;
+        iterator->TState = ObjectWaiter::TS_CXQ;
         for (;;) {
-            ObjectWaiter * Tail ;
-            Tail = _cxq ;
+            ObjectWaiter * Tail;
+            Tail = _cxq;
             if (Tail == NULL) {
-                iterator->_next = NULL ;
+                iterator->_next = NULL;
                 if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) {
-                   break ;
+                   break;
                 }
             } else {
-                while (Tail->_next != NULL) Tail = Tail->_next ;
-                Tail->_next = iterator ;
-                iterator->_prev = Tail ;
-                iterator->_next = NULL ;
-                break ;
+                while (Tail->_next != NULL) Tail = Tail->_next;
+                Tail->_next = iterator;
+                iterator->_prev = Tail;
+                iterator->_next = NULL;
+                break;
             }
         }
      } else {
-        ParkEvent * ev = iterator->_event ;
-        iterator->TState = ObjectWaiter::TS_RUN ;
-        OrderAccess::fence() ;
-        ev->unpark() ;
+        ParkEvent * ev = iterator->_event;
+        iterator->TState = ObjectWaiter::TS_RUN;
+        OrderAccess::fence();
+        ev->unpark();
      }
 
      if (Policy < 4) {
@@ -1771,10 +1771,10 @@ void ObjectMonitor::notify(TRAPS) {
      // critical section.
   }
 
-  Thread::SpinRelease (&_WaitSetLock) ;
+  Thread::SpinRelease(&_WaitSetLock);
 
   if (iterator != NULL && ObjectMonitor::_sync_Notifications != NULL) {
-     ObjectMonitor::_sync_Notifications->inc() ;
+     ObjectMonitor::_sync_Notifications->inc();
   }
 }
 
@@ -1783,103 +1783,103 @@ void ObjectMonitor::notifyAll(TRAPS) {
   CHECK_OWNER();
   ObjectWaiter* iterator;
   if (_WaitSet == NULL) {
-      TEVENT (Empty-NotifyAll) ;
-      return ;
+      TEVENT(Empty-NotifyAll);
+      return;
   }
   DTRACE_MONITOR_PROBE(notifyAll, this, object(), THREAD);
 
-  int Policy = Knob_MoveNotifyee ;
-  int Tally = 0 ;
-  Thread::SpinAcquire (&_WaitSetLock, "WaitSet - notifyall") ;
+  int Policy = Knob_MoveNotifyee;
+  int Tally = 0;
+  Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notifyall");
 
   for (;;) {
-     iterator = DequeueWaiter () ;
-     if (iterator == NULL) break ;
-     TEVENT (NotifyAll - Transfer1) ;
-     ++Tally ;
+     iterator = DequeueWaiter();
+     if (iterator == NULL) break;
+     TEVENT(NotifyAll - Transfer1);
+     ++Tally;
 
      // Disposition - what might we do with iterator ?
      // a.  add it directly to the EntryList - either tail or head.
      // b.  push it onto the front of the _cxq.
      // For now we use (a).
 
-     guarantee (iterator->TState == ObjectWaiter::TS_WAIT, "invariant") ;
-     guarantee (iterator->_notified == 0, "invariant") ;
-     iterator->_notified = 1 ;
+     guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant");
+     guarantee(iterator->_notified == 0, "invariant");
+     iterator->_notified = 1;
      Thread * Self = THREAD;
      iterator->_notifier_tid = Self->osthread()->thread_id();
      if (Policy != 4) {
-        iterator->TState = ObjectWaiter::TS_ENTER ;
+        iterator->TState = ObjectWaiter::TS_ENTER;
      }
 
-     ObjectWaiter * List = _EntryList ;
+     ObjectWaiter * List = _EntryList;
      if (List != NULL) {
-        assert (List->_prev == NULL, "invariant") ;
-        assert (List->TState == ObjectWaiter::TS_ENTER, "invariant") ;
-        assert (List != iterator, "invariant") ;
+        assert(List->_prev == NULL, "invariant");
+        assert(List->TState == ObjectWaiter::TS_ENTER, "invariant");
+        assert(List != iterator, "invariant");
      }
 
      if (Policy == 0) {       // prepend to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
-             List->_prev = iterator ;
-             iterator->_next = List ;
-             iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             List->_prev = iterator;
+             iterator->_next = List;
+             iterator->_prev = NULL;
+             _EntryList = iterator;
         }
      } else
      if (Policy == 1) {      // append to EntryList
          if (List == NULL) {
-             iterator->_next = iterator->_prev = NULL ;
-             _EntryList = iterator ;
+             iterator->_next = iterator->_prev = NULL;
+             _EntryList = iterator;
          } else {
             // CONSIDER:  finding the tail currently requires a linear-time walk of
             // the EntryList.  We can make tail access constant-time by converting to
             // a CDLL instead of using our current DLL.
-            ObjectWaiter * Tail ;
-            for (Tail = List ; Tail->_next != NULL ; Tail = Tail->_next) ;
-            assert (Tail != NULL && Tail->_next == NULL, "invariant") ;
-            Tail->_next = iterator ;
-            iterator->_prev = Tail ;
-            iterator->_next = NULL ;
+            ObjectWaiter * Tail;
+            for (Tail = List; Tail->_next != NULL; Tail = Tail->_next);
+            assert(Tail != NULL && Tail->_next == NULL, "invariant");
+            Tail->_next = iterator;
+            iterator->_prev = Tail;
+            iterator->_next = NULL;
         }
      } else
      if (Policy == 2) {      // prepend to cxq
          // prepend to cxq
-         iterator->TState = ObjectWaiter::TS_CXQ ;
+         iterator->TState = ObjectWaiter::TS_CXQ;
          for (;;) {
-             ObjectWaiter * Front = _cxq ;
-             iterator->_next = Front ;
+             ObjectWaiter * Front = _cxq;
+             iterator->_next = Front;
              if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) {
-                 break ;
+                 break;
              }
          }
      } else
      if (Policy == 3) {      // append to cxq
-        iterator->TState = ObjectWaiter::TS_CXQ ;
+        iterator->TState = ObjectWaiter::TS_CXQ;
         for (;;) {
-            ObjectWaiter * Tail ;
-            Tail = _cxq ;
+            ObjectWaiter * Tail;
+            Tail = _cxq;
             if (Tail == NULL) {
-                iterator->_next = NULL ;
+                iterator->_next = NULL;
                 if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) {
-                   break ;
+                   break;
                 }
             } else {
-                while (Tail->_next != NULL) Tail = Tail->_next ;
-                Tail->_next = iterator ;
-                iterator->_prev = Tail ;
-                iterator->_next = NULL ;
-                break ;
+                while (Tail->_next != NULL) Tail = Tail->_next;
+                Tail->_next = iterator;
+                iterator->_prev = Tail;
+                iterator->_next = NULL;
+                break;
             }
         }
      } else {
-        ParkEvent * ev = iterator->_event ;
-        iterator->TState = ObjectWaiter::TS_RUN ;
-        OrderAccess::fence() ;
-        ev->unpark() ;
+        ParkEvent * ev = iterator->_event;
+        iterator->TState = ObjectWaiter::TS_RUN;
+        OrderAccess::fence();
+        ev->unpark();
      }
 
      if (Policy < 4) {
@@ -1895,10 +1895,10 @@ void ObjectMonitor::notifyAll(TRAPS) {
      // critical section.
   }
 
-  Thread::SpinRelease (&_WaitSetLock) ;
+  Thread::SpinRelease(&_WaitSetLock);
 
   if (Tally != 0 && ObjectMonitor::_sync_Notifications != NULL) {
-     ObjectMonitor::_sync_Notifications->inc(Tally) ;
+     ObjectMonitor::_sync_Notifications->inc(Tally);
   }
 }
 
@@ -1968,8 +1968,8 @@ void ObjectMonitor::notifyAll(TRAPS) {
 // not spinning.
 //
 
-intptr_t ObjectMonitor::SpinCallbackArgument = 0 ;
-int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL ;
+intptr_t ObjectMonitor::SpinCallbackArgument = 0;
+int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL;
 
 // Spinning: Fixed frequency (100%), vary duration
 
@@ -1977,28 +1977,28 @@ int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL ;
 int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
 
     // Dumb, brutal spin.  Good for comparative measurements against adaptive spinning.
-    int ctr = Knob_FixedSpin ;
+    int ctr = Knob_FixedSpin;
     if (ctr != 0) {
         while (--ctr >= 0) {
-            if (TryLock (Self) > 0) return 1 ;
-            SpinPause () ;
+            if (TryLock(Self) > 0) return 1;
+            SpinPause();
         }
-        return 0 ;
+        return 0;
     }
 
-    for (ctr = Knob_PreSpin + 1; --ctr >= 0 ; ) {
+    for (ctr = Knob_PreSpin + 1; --ctr >= 0;) {
       if (TryLock(Self) > 0) {
         // Increase _SpinDuration ...
         // Note that we don't clamp SpinDuration precisely at SpinLimit.
         // Raising _SpurDuration to the poverty line is key.
-        int x = _SpinDuration ;
+        int x = _SpinDuration;
         if (x < Knob_SpinLimit) {
-           if (x < Knob_Poverty) x = Knob_Poverty ;
-           _SpinDuration = x + Knob_BonusB ;
+           if (x < Knob_Poverty) x = Knob_Poverty;
+           _SpinDuration = x + Knob_BonusB;
         }
-        return 1 ;
+        return 1;
       }
-      SpinPause () ;
+      SpinPause();
     }
 
     // Admission control - verify preconditions for spinning
@@ -2015,37 +2015,37 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
     // This takes us into the realm of 1-out-of-N spinning, where we
     // hold the duration constant but vary the frequency.
 
-    ctr = _SpinDuration  ;
-    if (ctr < Knob_SpinBase) ctr = Knob_SpinBase ;
-    if (ctr <= 0) return 0 ;
+    ctr = _SpinDuration;
+    if (ctr < Knob_SpinBase) ctr = Knob_SpinBase;
+    if (ctr <= 0) return 0;
 
-    if (Knob_SuccRestrict && _succ != NULL) return 0 ;
+    if (Knob_SuccRestrict && _succ != NULL) return 0;
     if (Knob_OState && NotRunnable (Self, (Thread *) _owner)) {
-       TEVENT (Spin abort - notrunnable [TOP]);
-       return 0 ;
+       TEVENT(Spin abort - notrunnable [TOP]);
+       return 0;
     }
 
-    int MaxSpin = Knob_MaxSpinners ;
+    int MaxSpin = Knob_MaxSpinners;
     if (MaxSpin >= 0) {
        if (_Spinner > MaxSpin) {
-          TEVENT (Spin abort -- too many spinners) ;
-          return 0 ;
+          TEVENT(Spin abort -- too many spinners);
+          return 0;
        }
        // Slightly racy, but benign ...
-       Adjust (&_Spinner, 1) ;
+       Adjust(&_Spinner, 1);
     }
 
     // We're good to spin ... spin ingress.
     // CONSIDER: use Prefetch::write() to avoid RTS->RTO upgrades
     // when preparing to LD...CAS _owner, etc and the CAS is likely
     // to succeed.
-    int hits    = 0 ;
-    int msk     = 0 ;
-    int caspty  = Knob_CASPenalty ;
-    int oxpty   = Knob_OXPenalty ;
-    int sss     = Knob_SpinSetSucc ;
-    if (sss && _succ == NULL ) _succ = Self ;
-    Thread * prv = NULL ;
+    int hits    = 0;
+    int msk     = 0;
+    int caspty  = Knob_CASPenalty;
+    int oxpty   = Knob_OXPenalty;
+    int sss     = Knob_SpinSetSucc;
+    if (sss && _succ == NULL) _succ = Self;
+    Thread * prv = NULL;
 
     // There are three ways to exit the following loop:
     // 1.  A successful spin where this thread has acquired the lock.
@@ -2065,18 +2065,18 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
       // We periodically check to see if there's a safepoint pending.
       if ((ctr & 0xFF) == 0) {
          if (SafepointSynchronize::do_call_back()) {
-            TEVENT (Spin: safepoint) ;
-            goto Abort ;           // abrupt spin egress
+            TEVENT(Spin: safepoint);
+            goto Abort;           // abrupt spin egress
          }
-         if (Knob_UsePause & 1) SpinPause () ;
+         if (Knob_UsePause & 1) SpinPause();
 
-         int (*scb)(intptr_t,int) = SpinCallbackFunction ;
+         int (*scb)(intptr_t,int) = SpinCallbackFunction;
          if (hits > 50 && scb != NULL) {
-            int abend = (*scb)(SpinCallbackArgument, 0) ;
+            int abend = (*scb)(SpinCallbackArgument, 0);
          }
       }
 
-      if (Knob_UsePause & 2) SpinPause() ;
+      if (Knob_UsePause & 2) SpinPause();
 
       // Exponential back-off ...  Stay off the bus to reduce coherency traffic.
       // This is useful on classic SMP systems, but is of less utility on
@@ -2093,12 +2093,12 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
       // coherency bandwidth.  Relatedly, if we _oversample _owner we
       // can inadvertently interfere with the the ST m->owner=null.
       // executed by the lock owner.
-      if (ctr & msk) continue ;
-      ++hits ;
+      if (ctr & msk) continue;
+      ++hits;
       if ((hits & 0xF) == 0) {
         // The 0xF, above, corresponds to the exponent.
         // Consider: (msk+1)|msk
-        msk = ((msk << 2)|3) & BackOffMask ;
+        msk = ((msk << 2)|3) & BackOffMask;
       }
 
       // Probe _owner with TATAS
@@ -2111,16 +2111,16 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
       // the spin without prejudice or apply a "penalty" to the
       // spin count-down variable "ctr", reducing it by 100, say.
 
-      Thread * ox = (Thread *) _owner ;
+      Thread * ox = (Thread *) _owner;
       if (ox == NULL) {
-         ox = (Thread *) Atomic::cmpxchg_ptr (Self, &_owner, NULL) ;
+         ox = (Thread *) Atomic::cmpxchg_ptr(Self, &_owner, NULL);
          if (ox == NULL) {
             // The CAS succeeded -- this thread acquired ownership
             // Take care of some bookkeeping to exit spin state.
             if (sss && _succ == Self) {
-               _succ = NULL ;
+               _succ = NULL;
             }
-            if (MaxSpin > 0) Adjust (&_Spinner, -1) ;
+            if (MaxSpin > 0) Adjust(&_Spinner, -1);
 
             // Increase _SpinDuration :
             // The spin was successful (profitable) so we tend toward
@@ -2129,12 +2129,12 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
             // If we acquired the lock early in the spin cycle it
             // makes sense to increase _SpinDuration proportionally.
             // Note that we don't clamp SpinDuration precisely at SpinLimit.
-            int x = _SpinDuration ;
+            int x = _SpinDuration;
             if (x < Knob_SpinLimit) {
-                if (x < Knob_Poverty) x = Knob_Poverty ;
-                _SpinDuration = x + Knob_Bonus ;
+                if (x < Knob_Poverty) x = Knob_Poverty;
+                _SpinDuration = x + Knob_Bonus;
             }
-            return 1 ;
+            return 1;
          }
 
          // The CAS failed ... we can take any of the following actions:
@@ -2142,61 +2142,61 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
          // * exit spin with prejudice -- goto Abort;
          // * exit spin without prejudice.
          // * Since CAS is high-latency, retry again immediately.
-         prv = ox ;
-         TEVENT (Spin: cas failed) ;
-         if (caspty == -2) break ;
-         if (caspty == -1) goto Abort ;
-         ctr -= caspty ;
-         continue ;
+         prv = ox;
+         TEVENT(Spin: cas failed);
+         if (caspty == -2) break;
+         if (caspty == -1) goto Abort;
+         ctr -= caspty;
+         continue;
       }
 
       // Did lock ownership change hands ?
-      if (ox != prv && prv != NULL ) {
-          TEVENT (spin: Owner changed)
-          if (oxpty == -2) break ;
-          if (oxpty == -1) goto Abort ;
-          ctr -= oxpty ;
+      if (ox != prv && prv != NULL) {
+          TEVENT(spin: Owner changed)
+          if (oxpty == -2) break;
+          if (oxpty == -1) goto Abort;
+          ctr -= oxpty;
       }
-      prv = ox ;
+      prv = ox;
 
       // Abort the spin if the owner is not executing.
       // The owner must be executing in order to drop the lock.
       // Spinning while the owner is OFFPROC is idiocy.
       // Consider: ctr -= RunnablePenalty ;
       if (Knob_OState && NotRunnable (Self, ox)) {
-         TEVENT (Spin abort - notrunnable);
-         goto Abort ;
+         TEVENT(Spin abort - notrunnable);
+         goto Abort;
       }
-      if (sss && _succ == NULL ) _succ = Self ;
+      if (sss && _succ == NULL) _succ = Self;
    }
 
    // Spin failed with prejudice -- reduce _SpinDuration.
    // TODO: Use an AIMD-like policy to adjust _SpinDuration.
    // AIMD is globally stable.
-   TEVENT (Spin failure) ;
+   TEVENT(Spin failure);
    {
-     int x = _SpinDuration ;
+     int x = _SpinDuration;
      if (x > 0) {
         // Consider an AIMD scheme like: x -= (x >> 3) + 100
         // This is globally sample and tends to damp the response.
-        x -= Knob_Penalty ;
-        if (x < 0) x = 0 ;
-        _SpinDuration = x ;
+        x -= Knob_Penalty;
+        if (x < 0) x = 0;
+        _SpinDuration = x;
      }
    }
 
  Abort:
-   if (MaxSpin >= 0) Adjust (&_Spinner, -1) ;
+   if (MaxSpin >= 0) Adjust(&_Spinner, -1);
    if (sss && _succ == Self) {
-      _succ = NULL ;
+      _succ = NULL;
       // Invariant: after setting succ=null a contending thread
       // must recheck-retry _owner before parking.  This usually happens
       // in the normal usage of TrySpin(), but it's safest
       // to make TrySpin() as foolproof as possible.
-      OrderAccess::fence() ;
-      if (TryLock(Self) > 0) return 1 ;
+      OrderAccess::fence();
+      if (TryLock(Self) > 0) return 1;
    }
-   return 0 ;
+   return 0;
 }
 
 // NotRunnable() -- informed spinning
@@ -2240,9 +2240,9 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) {
 
 int ObjectMonitor::NotRunnable (Thread * Self, Thread * ox) {
     // Check either OwnerIsThread or ox->TypeTag == 2BAD.
-    if (!OwnerIsThread) return 0 ;
+    if (!OwnerIsThread) return 0;
 
-    if (ox == NULL) return 0 ;
+    if (ox == NULL) return 0;
 
     // Avoid transitive spinning ...
     // Say T1 spins or blocks trying to acquire L.  T1._Stalled is set to L.
@@ -2251,17 +2251,17 @@ int ObjectMonitor::NotRunnable (Thread * Self, Thread * ox) {
     // This occurs transiently after T1 acquired L but before
     // T1 managed to clear T1.Stalled.  T2 does not need to abort
     // its spin in this circumstance.
-    intptr_t BlockedOn = SafeFetchN ((intptr_t *) &ox->_Stalled, intptr_t(1)) ;
+    intptr_t BlockedOn = SafeFetchN((intptr_t *) &ox->_Stalled, intptr_t(1));
 
-    if (BlockedOn == 1) return 1 ;
+    if (BlockedOn == 1) return 1;
     if (BlockedOn != 0) {
-      return BlockedOn != intptr_t(this) && _owner == ox ;
+      return BlockedOn != intptr_t(this) && _owner == ox;
     }
 
-    assert (sizeof(((JavaThread *)ox)->_thread_state == sizeof(int)), "invariant") ;
-    int jst = SafeFetch32 ((int *) &((JavaThread *) ox)->_thread_state, -1) ; ;
+    assert(sizeof(((JavaThread *)ox)->_thread_state == sizeof(int)), "invariant");
+    int jst = SafeFetch32((int *) &((JavaThread *) ox)->_thread_state, -1);;
     // consider also: jst != _thread_in_Java -- but that's overspecific.
-    return jst == _thread_blocked || jst == _thread_in_native ;
+    return jst == _thread_blocked || jst == _thread_in_native;
 }
 
 
@@ -2272,11 +2272,11 @@ ObjectWaiter::ObjectWaiter(Thread* thread) {
   _next     = NULL;
   _prev     = NULL;
   _notified = 0;
-  TState    = TS_RUN ;
+  TState    = TS_RUN;
   _thread   = thread;
-  _event    = thread->_ParkEvent ;
+  _event    = thread->_ParkEvent;
   _active   = false;
-  assert (_event != NULL, "invariant") ;
+  assert(_event != NULL, "invariant");
 }
 
 void ObjectWaiter::wait_reenter_begin(ObjectMonitor *mon) {
@@ -2299,7 +2299,7 @@ inline void ObjectMonitor::AddWaiter(ObjectWaiter* node) {
     node->_prev = node;
     node->_next = node;
   } else {
-    ObjectWaiter* head = _WaitSet ;
+    ObjectWaiter* head = _WaitSet;
     ObjectWaiter* tail = head->_prev;
     assert(tail->_next == head, "invariant check");
     tail->_next = node;
@@ -2345,56 +2345,56 @@ inline void ObjectMonitor::DequeueSpecificWaiter(ObjectWaiter* node) {
 
 // -----------------------------------------------------------------------------
 // PerfData support
-PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts       = NULL ;
-PerfCounter * ObjectMonitor::_sync_FutileWakeups               = NULL ;
-PerfCounter * ObjectMonitor::_sync_Parks                       = NULL ;
-PerfCounter * ObjectMonitor::_sync_EmptyNotifications          = NULL ;
-PerfCounter * ObjectMonitor::_sync_Notifications               = NULL ;
-PerfCounter * ObjectMonitor::_sync_PrivateA                    = NULL ;
-PerfCounter * ObjectMonitor::_sync_PrivateB                    = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowExit                    = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowEnter                   = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowNotify                  = NULL ;
-PerfCounter * ObjectMonitor::_sync_SlowNotifyAll               = NULL ;
-PerfCounter * ObjectMonitor::_sync_FailedSpins                 = NULL ;
-PerfCounter * ObjectMonitor::_sync_SuccessfulSpins             = NULL ;
-PerfCounter * ObjectMonitor::_sync_MonInCirculation            = NULL ;
-PerfCounter * ObjectMonitor::_sync_MonScavenged                = NULL ;
-PerfCounter * ObjectMonitor::_sync_Inflations                  = NULL ;
-PerfCounter * ObjectMonitor::_sync_Deflations                  = NULL ;
-PerfLongVariable * ObjectMonitor::_sync_MonExtant              = NULL ;
+PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts       = NULL;
+PerfCounter * ObjectMonitor::_sync_FutileWakeups               = NULL;
+PerfCounter * ObjectMonitor::_sync_Parks                       = NULL;
+PerfCounter * ObjectMonitor::_sync_EmptyNotifications          = NULL;
+PerfCounter * ObjectMonitor::_sync_Notifications               = NULL;
+PerfCounter * ObjectMonitor::_sync_PrivateA                    = NULL;
+PerfCounter * ObjectMonitor::_sync_PrivateB                    = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowExit                    = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowEnter                   = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowNotify                  = NULL;
+PerfCounter * ObjectMonitor::_sync_SlowNotifyAll               = NULL;
+PerfCounter * ObjectMonitor::_sync_FailedSpins                 = NULL;
+PerfCounter * ObjectMonitor::_sync_SuccessfulSpins             = NULL;
+PerfCounter * ObjectMonitor::_sync_MonInCirculation            = NULL;
+PerfCounter * ObjectMonitor::_sync_MonScavenged                = NULL;
+PerfCounter * ObjectMonitor::_sync_Inflations                  = NULL;
+PerfCounter * ObjectMonitor::_sync_Deflations                  = NULL;
+PerfLongVariable * ObjectMonitor::_sync_MonExtant              = NULL;
 
 // One-shot global initialization for the sync subsystem.
 // We could also defer initialization and initialize on-demand
 // the first time we call inflate().  Initialization would
 // be protected - like so many things - by the MonitorCache_lock.
 
-void ObjectMonitor::Initialize () {
-  static int InitializationCompleted = 0 ;
-  assert (InitializationCompleted == 0, "invariant") ;
-  InitializationCompleted = 1 ;
+void ObjectMonitor::Initialize() {
+  static int InitializationCompleted = 0;
+  assert(InitializationCompleted == 0, "invariant");
+  InitializationCompleted = 1;
   if (UsePerfData) {
-      EXCEPTION_MARK ;
+      EXCEPTION_MARK;
       #define NEWPERFCOUNTER(n)   {n = PerfDataManager::create_counter(SUN_RT, #n, PerfData::U_Events,CHECK); }
       #define NEWPERFVARIABLE(n)  {n = PerfDataManager::create_variable(SUN_RT, #n, PerfData::U_Events,CHECK); }
-      NEWPERFCOUNTER(_sync_Inflations) ;
-      NEWPERFCOUNTER(_sync_Deflations) ;
-      NEWPERFCOUNTER(_sync_ContendedLockAttempts) ;
-      NEWPERFCOUNTER(_sync_FutileWakeups) ;
-      NEWPERFCOUNTER(_sync_Parks) ;
-      NEWPERFCOUNTER(_sync_EmptyNotifications) ;
-      NEWPERFCOUNTER(_sync_Notifications) ;
-      NEWPERFCOUNTER(_sync_SlowEnter) ;
-      NEWPERFCOUNTER(_sync_SlowExit) ;
-      NEWPERFCOUNTER(_sync_SlowNotify) ;
-      NEWPERFCOUNTER(_sync_SlowNotifyAll) ;
-      NEWPERFCOUNTER(_sync_FailedSpins) ;
-      NEWPERFCOUNTER(_sync_SuccessfulSpins) ;
-      NEWPERFCOUNTER(_sync_PrivateA) ;
-      NEWPERFCOUNTER(_sync_PrivateB) ;
-      NEWPERFCOUNTER(_sync_MonInCirculation) ;
-      NEWPERFCOUNTER(_sync_MonScavenged) ;
-      NEWPERFVARIABLE(_sync_MonExtant) ;
+      NEWPERFCOUNTER(_sync_Inflations);
+      NEWPERFCOUNTER(_sync_Deflations);
+      NEWPERFCOUNTER(_sync_ContendedLockAttempts);
+      NEWPERFCOUNTER(_sync_FutileWakeups);
+      NEWPERFCOUNTER(_sync_Parks);
+      NEWPERFCOUNTER(_sync_EmptyNotifications);
+      NEWPERFCOUNTER(_sync_Notifications);
+      NEWPERFCOUNTER(_sync_SlowEnter);
+      NEWPERFCOUNTER(_sync_SlowExit);
+      NEWPERFCOUNTER(_sync_SlowNotify);
+      NEWPERFCOUNTER(_sync_SlowNotifyAll);
+      NEWPERFCOUNTER(_sync_FailedSpins);
+      NEWPERFCOUNTER(_sync_SuccessfulSpins);
+      NEWPERFCOUNTER(_sync_PrivateA);
+      NEWPERFCOUNTER(_sync_PrivateB);
+      NEWPERFCOUNTER(_sync_MonInCirculation);
+      NEWPERFCOUNTER(_sync_MonScavenged);
+      NEWPERFVARIABLE(_sync_MonExtant);
       #undef NEWPERFCOUNTER
   }
 }
@@ -2414,33 +2414,33 @@ void ObjectMonitor::ctAsserts() {
 
 
 static char * kvGet (char * kvList, const char * Key) {
-    if (kvList == NULL) return NULL ;
-    size_t n = strlen (Key) ;
-    char * Search ;
-    for (Search = kvList ; *Search ; Search += strlen(Search) + 1) {
+    if (kvList == NULL) return NULL;
+    size_t n = strlen(Key);
+    char * Search;
+    for (Search = kvList; *Search; Search += strlen(Search) + 1) {
         if (strncmp (Search, Key, n) == 0) {
-            if (Search[n] == '=') return Search + n + 1 ;
-            if (Search[n] == 0)   return (char *) "1" ;
+            if (Search[n] == '=') return Search + n + 1;
+            if (Search[n] == 0)   return(char *) "1";
         }
     }
-    return NULL ;
+    return NULL;
 }
 
 static int kvGetInt (char * kvList, const char * Key, int Default) {
-    char * v = kvGet (kvList, Key) ;
-    int rslt = v ? ::strtol (v, NULL, 0) : Default ;
+    char * v = kvGet(kvList, Key);
+    int rslt = v ? ::strtol(v, NULL, 0) : Default;
     if (Knob_ReportSettings && v != NULL) {
         ::printf ("  SyncKnob: %s %d(%d)\n", Key, rslt, Default) ;
-        ::fflush (stdout) ;
+        ::fflush(stdout);
     }
-    return rslt ;
+    return rslt;
 }
 
-void ObjectMonitor::DeferredInitialize () {
-  if (InitDone > 0) return ;
+void ObjectMonitor::DeferredInitialize() {
+  if (InitDone > 0) return;
   if (Atomic::cmpxchg (-1, &InitDone, 0) != 0) {
-      while (InitDone != 1) ;
-      return ;
+      while (InitDone != 1);
+      return;
   }
 
   // One-shot global initialization ...
@@ -2449,68 +2449,68 @@ void ObjectMonitor::DeferredInitialize () {
   // SyncKnobs consist of <Key>=<Value> pairs in the style
   // of environment variables.  Start by converting ':' to NUL.
 
-  if (SyncKnobs == NULL) SyncKnobs = "" ;
+  if (SyncKnobs == NULL) SyncKnobs = "";
 
-  size_t sz = strlen (SyncKnobs) ;
-  char * knobs = (char *) malloc (sz + 2) ;
+  size_t sz = strlen(SyncKnobs);
+  char * knobs = (char *) malloc(sz + 2);
   if (knobs == NULL) {
-     vm_exit_out_of_memory (sz + 2, OOM_MALLOC_ERROR, "Parse SyncKnobs") ;
-     guarantee (0, "invariant") ;
+     vm_exit_out_of_memory(sz + 2, OOM_MALLOC_ERROR, "Parse SyncKnobs");
+     guarantee(0, "invariant");
   }
-  strcpy (knobs, SyncKnobs) ;
-  knobs[sz+1] = 0 ;
-  for (char * p = knobs ; *p ; p++) {
-     if (*p == ':') *p = 0 ;
+  strcpy(knobs, SyncKnobs);
+  knobs[sz+1] = 0;
+  for (char * p = knobs; *p; p++) {
+     if (*p == ':') *p = 0;
   }
 
   #define SETKNOB(x) { Knob_##x = kvGetInt (knobs, #x, Knob_##x); }
-  SETKNOB(ReportSettings) ;
-  SETKNOB(Verbose) ;
-  SETKNOB(FixedSpin) ;
-  SETKNOB(SpinLimit) ;
-  SETKNOB(SpinBase) ;
+  SETKNOB(ReportSettings);
+  SETKNOB(Verbose);
+  SETKNOB(FixedSpin);
+  SETKNOB(SpinLimit);
+  SETKNOB(SpinBase);
   SETKNOB(SpinBackOff);
-  SETKNOB(CASPenalty) ;
-  SETKNOB(OXPenalty) ;
-  SETKNOB(LogSpins) ;
-  SETKNOB(SpinSetSucc) ;
-  SETKNOB(SuccEnabled) ;
-  SETKNOB(SuccRestrict) ;
-  SETKNOB(Penalty) ;
-  SETKNOB(Bonus) ;
-  SETKNOB(BonusB) ;
-  SETKNOB(Poverty) ;
-  SETKNOB(SpinAfterFutile) ;
-  SETKNOB(UsePause) ;
-  SETKNOB(SpinEarly) ;
-  SETKNOB(OState) ;
-  SETKNOB(MaxSpinners) ;
-  SETKNOB(PreSpin) ;
-  SETKNOB(ExitPolicy) ;
+  SETKNOB(CASPenalty);
+  SETKNOB(OXPenalty);
+  SETKNOB(LogSpins);
+  SETKNOB(SpinSetSucc);
+  SETKNOB(SuccEnabled);
+  SETKNOB(SuccRestrict);
+  SETKNOB(Penalty);
+  SETKNOB(Bonus);
+  SETKNOB(BonusB);
+  SETKNOB(Poverty);
+  SETKNOB(SpinAfterFutile);
+  SETKNOB(UsePause);
+  SETKNOB(SpinEarly);
+  SETKNOB(OState);
+  SETKNOB(MaxSpinners);
+  SETKNOB(PreSpin);
+  SETKNOB(ExitPolicy);
   SETKNOB(QMode);
-  SETKNOB(ResetEvent) ;
-  SETKNOB(MoveNotifyee) ;
-  SETKNOB(FastHSSEC) ;
+  SETKNOB(ResetEvent);
+  SETKNOB(MoveNotifyee);
+  SETKNOB(FastHSSEC);
   #undef SETKNOB
 
   if (os::is_MP()) {
-     BackOffMask = (1 << Knob_SpinBackOff) - 1 ;
-     if (Knob_ReportSettings) ::printf ("BackOffMask=%X\n", BackOffMask) ;
+     BackOffMask = (1 << Knob_SpinBackOff) - 1;
+     if (Knob_ReportSettings) ::printf("BackOffMask=%X\n", BackOffMask);
      // CONSIDER: BackOffMask = ROUNDUP_NEXT_POWER2 (ncpus-1)
   } else {
-     Knob_SpinLimit = 0 ;
-     Knob_SpinBase  = 0 ;
-     Knob_PreSpin   = 0 ;
-     Knob_FixedSpin = -1 ;
+     Knob_SpinLimit = 0;
+     Knob_SpinBase  = 0;
+     Knob_PreSpin   = 0;
+     Knob_FixedSpin = -1;
   }
 
   if (Knob_LogSpins == 0) {
-     ObjectMonitor::_sync_FailedSpins = NULL ;
+     ObjectMonitor::_sync_FailedSpins = NULL;
   }
 
-  free (knobs) ;
-  OrderAccess::fence() ;
-  InitDone = 1 ;
+  free(knobs);
+  OrderAccess::fence();
+  InitDone = 1;
 }
 
 #ifndef PRODUCT
diff --git a/hotspot/src/share/vm/runtime/objectMonitor.hpp b/hotspot/src/share/vm/runtime/objectMonitor.hpp
index 5a2756826cb..9feaf7b8a90 100644
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp
@@ -37,17 +37,17 @@
 
 class ObjectWaiter : public StackObj {
  public:
-  enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ } ;
-  enum Sorted  { PREPEND, APPEND, SORTED } ;
+  enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ };
+  enum Sorted  { PREPEND, APPEND, SORTED };
   ObjectWaiter * volatile _next;
   ObjectWaiter * volatile _prev;
   Thread*       _thread;
   jlong         _notifier_tid;
   ParkEvent *   _event;
-  volatile int  _notified ;
-  volatile TStates TState ;
-  Sorted        _Sorted ;           // List placement disposition
-  bool          _active ;           // Contention monitoring is enabled
+  volatile int  _notified;
+  volatile TStates TState;
+  Sorted        _Sorted;           // List placement disposition
+  bool          _active;           // Contention monitoring is enabled
  public:
   ObjectWaiter(Thread* thread);
 
@@ -92,19 +92,19 @@ class ObjectMonitor {
   static int owner_offset_in_bytes()       { return offset_of(ObjectMonitor, _owner);      }
   static int count_offset_in_bytes()       { return offset_of(ObjectMonitor, _count);      }
   static int recursions_offset_in_bytes()  { return offset_of(ObjectMonitor, _recursions); }
-  static int cxq_offset_in_bytes()         { return offset_of(ObjectMonitor, _cxq) ;       }
-  static int succ_offset_in_bytes()        { return offset_of(ObjectMonitor, _succ) ;      }
+  static int cxq_offset_in_bytes()         { return offset_of(ObjectMonitor, _cxq);       }
+  static int succ_offset_in_bytes()        { return offset_of(ObjectMonitor, _succ);      }
   static int EntryList_offset_in_bytes()   { return offset_of(ObjectMonitor, _EntryList);  }
   static int FreeNext_offset_in_bytes()    { return offset_of(ObjectMonitor, FreeNext);    }
-  static int WaitSet_offset_in_bytes()     { return offset_of(ObjectMonitor, _WaitSet) ;   }
-  static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible);}
+  static int WaitSet_offset_in_bytes()     { return offset_of(ObjectMonitor, _WaitSet);   }
+  static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); }
   static int Spinner_offset_in_bytes()     { return offset_of(ObjectMonitor, _Spinner);    }
 
  public:
   // Eventually we'll make provisions for multiple callbacks, but
   // now one will suffice.
-  static int (*SpinCallbackFunction)(intptr_t, int) ;
-  static intptr_t SpinCallbackArgument ;
+  static int (*SpinCallbackFunction)(intptr_t, int);
+  static intptr_t SpinCallbackArgument;
 
 
  public:
@@ -115,7 +115,7 @@ class ObjectMonitor {
     // TODO-FIXME: merge _count and _waiters.
     // TODO-FIXME: assert _owner == null implies _recursions = 0
     // TODO-FIXME: assert _WaitSet != null implies _count > 0
-    return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList ) ;
+    return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList);
   }
 
   intptr_t  is_entered(Thread* current) const;
@@ -127,7 +127,7 @@ class ObjectMonitor {
 
   intptr_t  count() const;
   void      set_count(intptr_t count);
-  intptr_t  contentions() const ;
+  intptr_t  contentions() const;
   intptr_t  recursions() const                                         { return _recursions; }
 
   // JVM/DI GetMonitorInfo() needs this
@@ -145,15 +145,15 @@ class ObjectMonitor {
     _object       = NULL;
     _owner        = NULL;
     _WaitSet      = NULL;
-    _WaitSetLock  = 0 ;
-    _Responsible  = NULL ;
-    _succ         = NULL ;
-    _cxq          = NULL ;
-    FreeNext      = NULL ;
-    _EntryList    = NULL ;
-    _SpinFreq     = 0 ;
-    _SpinClock    = 0 ;
-    OwnerIsThread = 0 ;
+    _WaitSetLock  = 0;
+    _Responsible  = NULL;
+    _succ         = NULL;
+    _cxq          = NULL;
+    FreeNext      = NULL;
+    _EntryList    = NULL;
+    _SpinFreq     = 0;
+    _SpinClock    = 0;
+    OwnerIsThread = 0;
     _previous_owner_tid = 0;
   }
 
@@ -164,20 +164,20 @@ class ObjectMonitor {
   }
 
 private:
-  void Recycle () {
+  void Recycle() {
     // TODO: add stronger asserts ...
     // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
     // _count == 0 EntryList  == NULL
     // _recursions == 0 _WaitSet == NULL
     // TODO: assert (is_busy()|_recursions) == 0
-    _succ          = NULL ;
-    _EntryList     = NULL ;
-    _cxq           = NULL ;
-    _WaitSet       = NULL ;
-    _recursions    = 0 ;
-    _SpinFreq      = 0 ;
-    _SpinClock     = 0 ;
-    OwnerIsThread  = 0 ;
+    _succ          = NULL;
+    _EntryList     = NULL;
+    _cxq           = NULL;
+    _WaitSet       = NULL;
+    _recursions    = 0;
+    _SpinFreq      = 0;
+    _SpinClock     = 0;
+    OwnerIsThread  = 0;
   }
 
 public:
@@ -194,7 +194,7 @@ public:
   void      print();
 #endif
 
-  bool      try_enter (TRAPS) ;
+  bool      try_enter(TRAPS);
   void      enter(TRAPS);
   void      exit(bool not_suspended, TRAPS);
   void      wait(jlong millis, bool interruptable, TRAPS);
@@ -206,22 +206,22 @@ public:
   void      reenter(intptr_t recursions, TRAPS);
 
  private:
-  void      AddWaiter (ObjectWaiter * waiter) ;
+  void      AddWaiter(ObjectWaiter * waiter);
   static    void DeferredInitialize();
 
-  ObjectWaiter * DequeueWaiter () ;
-  void      DequeueSpecificWaiter (ObjectWaiter * waiter) ;
-  void      EnterI (TRAPS) ;
-  void      ReenterI (Thread * Self, ObjectWaiter * SelfNode) ;
-  void      UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode) ;
-  int       TryLock (Thread * Self) ;
-  int       NotRunnable (Thread * Self, Thread * Owner) ;
-  int       TrySpin_Fixed (Thread * Self) ;
-  int       TrySpin_VaryFrequency (Thread * Self) ;
-  int       TrySpin_VaryDuration  (Thread * Self) ;
-  void      ctAsserts () ;
-  void      ExitEpilog (Thread * Self, ObjectWaiter * Wakee) ;
-  bool      ExitSuspendEquivalent (JavaThread * Self) ;
+  ObjectWaiter * DequeueWaiter();
+  void      DequeueSpecificWaiter(ObjectWaiter * waiter);
+  void      EnterI(TRAPS);
+  void      ReenterI(Thread * Self, ObjectWaiter * SelfNode);
+  void      UnlinkAfterAcquire(Thread * Self, ObjectWaiter * SelfNode);
+  int       TryLock(Thread * Self);
+  int       NotRunnable(Thread * Self, Thread * Owner);
+  int       TrySpin_Fixed(Thread * Self);
+  int       TrySpin_VaryFrequency(Thread * Self);
+  int       TrySpin_VaryDuration(Thread * Self);
+  void      ctAsserts();
+  void      ExitEpilog(Thread * Self, ObjectWaiter * Wakee);
+  bool      ExitSuspendEquivalent(JavaThread * Self);
   void      post_monitor_wait_event(EventJavaMonitorWait * event,
                                                    jlong notifier_tid,
                                                    jlong timeout,
@@ -240,7 +240,7 @@ public:
   volatile markOop   _header;       // displaced object header word - mark
   void*     volatile _object;       // backward object pointer - strong root
 
-  double SharingPad [1] ;           // temp to reduce false sharing
+  double SharingPad[1];           // temp to reduce false sharing
 
   // All the following fields must be machine word aligned
   // The VM assumes write ordering wrt these fields, which can be
@@ -251,22 +251,22 @@ public:
   volatile jlong _previous_owner_tid; // thread id of the previous owner of the monitor
   volatile intptr_t  _recursions;   // recursion count, 0 for first entry
  private:
-  int OwnerIsThread ;               // _owner is (Thread *) vs SP/BasicLock
-  ObjectWaiter * volatile _cxq ;    // LL of recently-arrived threads blocked on entry.
+  int OwnerIsThread;               // _owner is (Thread *) vs SP/BasicLock
+  ObjectWaiter * volatile _cxq;    // LL of recently-arrived threads blocked on entry.
                                     // The list is actually composed of WaitNodes, acting
                                     // as proxies for Threads.
  protected:
-  ObjectWaiter * volatile _EntryList ;     // Threads blocked on entry or reentry.
+  ObjectWaiter * volatile _EntryList;     // Threads blocked on entry or reentry.
  private:
-  Thread * volatile _succ ;          // Heir presumptive thread - used for futile wakeup throttling
-  Thread * volatile _Responsible ;
-  int _PromptDrain ;                // rqst to drain cxq into EntryList ASAP
+  Thread * volatile _succ;          // Heir presumptive thread - used for futile wakeup throttling
+  Thread * volatile _Responsible;
+  int _PromptDrain;                // rqst to drain cxq into EntryList ASAP
 
-  volatile int _Spinner ;           // for exit->spinner handoff optimization
-  volatile int _SpinFreq ;          // Spin 1-out-of-N attempts: success rate
-  volatile int _SpinClock ;
-  volatile int _SpinDuration ;
-  volatile intptr_t _SpinState ;    // MCS/CLH list of spinners
+  volatile int _Spinner;           // for exit->spinner handoff optimization
+  volatile int _SpinFreq;          // Spin 1-out-of-N attempts: success rate
+  volatile int _SpinClock;
+  volatile int _SpinDuration;
+  volatile intptr_t _SpinState;    // MCS/CLH list of spinners
 
   // TODO-FIXME: _count, _waiters and _recursions should be of
   // type int, or int32_t but not intptr_t.  There's no reason
@@ -284,30 +284,30 @@ public:
   volatile int _WaitSetLock;        // protects Wait Queue - simple spinlock
 
  public:
-  int _QMix ;                       // Mixed prepend queue discipline
-  ObjectMonitor * FreeNext ;        // Free list linkage
-  intptr_t StatA, StatsB ;
+  int _QMix;                       // Mixed prepend queue discipline
+  ObjectMonitor * FreeNext;        // Free list linkage
+  intptr_t StatA, StatsB;
 
  public:
-  static void Initialize () ;
-  static PerfCounter * _sync_ContendedLockAttempts ;
-  static PerfCounter * _sync_FutileWakeups ;
-  static PerfCounter * _sync_Parks ;
-  static PerfCounter * _sync_EmptyNotifications ;
-  static PerfCounter * _sync_Notifications ;
-  static PerfCounter * _sync_SlowEnter ;
-  static PerfCounter * _sync_SlowExit ;
-  static PerfCounter * _sync_SlowNotify ;
-  static PerfCounter * _sync_SlowNotifyAll ;
-  static PerfCounter * _sync_FailedSpins ;
-  static PerfCounter * _sync_SuccessfulSpins ;
-  static PerfCounter * _sync_PrivateA ;
-  static PerfCounter * _sync_PrivateB ;
-  static PerfCounter * _sync_MonInCirculation ;
-  static PerfCounter * _sync_MonScavenged ;
-  static PerfCounter * _sync_Inflations ;
-  static PerfCounter * _sync_Deflations ;
-  static PerfLongVariable * _sync_MonExtant ;
+  static void Initialize();
+  static PerfCounter * _sync_ContendedLockAttempts;
+  static PerfCounter * _sync_FutileWakeups;
+  static PerfCounter * _sync_Parks;
+  static PerfCounter * _sync_EmptyNotifications;
+  static PerfCounter * _sync_Notifications;
+  static PerfCounter * _sync_SlowEnter;
+  static PerfCounter * _sync_SlowExit;
+  static PerfCounter * _sync_SlowNotify;
+  static PerfCounter * _sync_SlowNotifyAll;
+  static PerfCounter * _sync_FailedSpins;
+  static PerfCounter * _sync_SuccessfulSpins;
+  static PerfCounter * _sync_PrivateA;
+  static PerfCounter * _sync_PrivateB;
+  static PerfCounter * _sync_MonInCirculation;
+  static PerfCounter * _sync_MonScavenged;
+  static PerfCounter * _sync_Inflations;
+  static PerfCounter * _sync_Deflations;
+  static PerfLongVariable * _sync_MonExtant;
 
  public:
   static int Knob_Verbose;
@@ -329,7 +329,7 @@ public:
 #undef TEVENT
 #define TEVENT(nom) {if (SyncVerbose) FEVENT(nom); }
 
-#define FEVENT(nom) { static volatile int ctr = 0 ; int v = ++ctr ; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
+#define FEVENT(nom) { static volatile int ctr = 0; int v = ++ctr; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
 
 #undef  TEVENT
 #define TEVENT(nom) {;}
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
index fad31fd02f1..efd8be473b3 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
@@ -198,13 +198,13 @@ void SharedRuntime::trace_ic_miss(address at) {
 
 void SharedRuntime::print_ic_miss_histogram() {
   if (ICMissHistogram) {
-    tty->print_cr ("IC Miss Histogram:");
+    tty->print_cr("IC Miss Histogram:");
     int tot_misses = 0;
     for (int i = 0; i < _ICmiss_index; i++) {
       tty->print_cr("  at: " INTPTR_FORMAT "  nof: %d", _ICmiss_at[i], _ICmiss_count[i]);
       tot_misses += _ICmiss_count[i];
     }
-    tty->print_cr ("Total IC misses: %7d", tot_misses);
+    tty->print_cr("Total IC misses: %7d", tot_misses);
   }
 }
 #endif // PRODUCT
@@ -266,7 +266,7 @@ JRT_LEAF(jfloat, SharedRuntime::frem(jfloat  x, jfloat  y))
   xbits.f = x;
   ybits.f = y;
   // x Mod Infinity == x unless x is infinity
-  if ( ((xbits.i & float_sign_mask) != float_infinity) &&
+  if (((xbits.i & float_sign_mask) != float_infinity) &&
        ((ybits.i & float_sign_mask) == float_infinity) ) {
     return x;
   }
@@ -281,7 +281,7 @@ JRT_LEAF(jdouble, SharedRuntime::drem(jdouble x, jdouble y))
   xbits.d = x;
   ybits.d = y;
   // x Mod Infinity == x unless x is infinity
-  if ( ((xbits.l & double_sign_mask) != double_infinity) &&
+  if (((xbits.l & double_sign_mask) != double_infinity) &&
        ((ybits.l & double_sign_mask) == double_infinity) ) {
     return x;
   }
@@ -537,13 +537,13 @@ address SharedRuntime::get_poll_stub(address pc) {
   CodeBlob *cb = CodeCache::find_blob(pc);
 
   // Should be an nmethod
-  assert( cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod" );
+  assert(cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod");
 
   // Look up the relocation information
-  assert( ((nmethod*)cb)->is_at_poll_or_poll_return(pc),
-    "safepoint polling: type must be poll" );
+  assert(((nmethod*)cb)->is_at_poll_or_poll_return(pc),
+    "safepoint polling: type must be poll");
 
-  assert( ((NativeInstruction*)pc)->is_safepoint_poll(),
+  assert(((NativeInstruction*)pc)->is_safepoint_poll(),
     "Only polling locations are used for safepoint");
 
   bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc);
@@ -562,7 +562,7 @@ address SharedRuntime::get_poll_stub(address pc) {
     stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point();
   }
 #ifndef PRODUCT
-  if( TraceSafepoint ) {
+  if (TraceSafepoint) {
     char buf[256];
     jio_snprintf(buf, sizeof(buf),
                  "... found polling page %s exception at pc = "
@@ -1474,7 +1474,7 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) {
         should_be_mono = true;
       } else if (inline_cache->is_icholder_call()) {
         CompiledICHolder* ic_oop = inline_cache->cached_icholder();
-        if ( ic_oop != NULL) {
+        if (ic_oop != NULL) {
 
           if (receiver()->klass() == ic_oop->holder_klass()) {
             // This isn't a real miss. We must have seen that compiled code
@@ -1728,7 +1728,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
       iter.next();
       assert(iter.has_current(), "must have a reloc at java call site");
       relocInfo::relocType typ = iter.reloc()->type();
-      if ( typ != relocInfo::static_call_type &&
+      if (typ != relocInfo::static_call_type &&
            typ != relocInfo::opt_virtual_call_type &&
            typ != relocInfo::static_stub_type) {
         return;
@@ -1784,7 +1784,7 @@ JRT_ENTRY(void, SharedRuntime::slow_arraycopy_C(oopDesc* src,  jint src_pos,
   // The copy_array mechanism is awkward and could be removed, but
   // the compilers don't call this function except as a last resort,
   // so it probably doesn't matter.
-  src->klass()->copy_array((arrayOopDesc*)src,  src_pos,
+  src->klass()->copy_array((arrayOopDesc*)src, src_pos,
                                         (arrayOopDesc*)dest, dest_pos,
                                         length, thread);
 }
@@ -1891,8 +1891,8 @@ void SharedRuntime::print_statistics() {
   ttyLocker ttyl;
   if (xtty != NULL)  xtty->head("statistics type='SharedRuntime'");
 
-  if (_monitor_enter_ctr ) tty->print_cr("%5d monitor enter slow",  _monitor_enter_ctr);
-  if (_monitor_exit_ctr  ) tty->print_cr("%5d monitor exit slow",   _monitor_exit_ctr);
+  if (_monitor_enter_ctr) tty->print_cr("%5d monitor enter slow",  _monitor_enter_ctr);
+  if (_monitor_exit_ctr) tty->print_cr("%5d monitor exit slow",   _monitor_exit_ctr);
   if (_throw_null_ctr) tty->print_cr("%5d implicit null throw", _throw_null_ctr);
 
   SharedRuntime::print_ic_miss_histogram();
@@ -1905,36 +1905,36 @@ void SharedRuntime::print_statistics() {
   }
 
   // Dump the JRT_ENTRY counters
-  if( _new_instance_ctr ) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
-  if( _new_array_ctr ) tty->print_cr("%5d new array requires GC", _new_array_ctr);
-  if( _multi1_ctr ) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
-  if( _multi2_ctr ) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
-  if( _multi3_ctr ) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
-  if( _multi4_ctr ) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
-  if( _multi5_ctr ) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
-
-  tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr );
-  tty->print_cr("%5d wrong method", _wrong_method_ctr );
-  tty->print_cr("%5d unresolved static call site", _resolve_static_ctr );
-  tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr );
-  tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr );
-
-  if( _mon_enter_stub_ctr ) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr );
-  if( _mon_exit_stub_ctr ) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr );
-  if( _mon_enter_ctr ) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr );
-  if( _mon_exit_ctr ) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr );
-  if( _partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr );
-  if( _jbyte_array_copy_ctr ) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr );
-  if( _jshort_array_copy_ctr ) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr );
-  if( _jint_array_copy_ctr ) tty->print_cr("%5d int array copies", _jint_array_copy_ctr );
-  if( _jlong_array_copy_ctr ) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr );
-  if( _oop_array_copy_ctr ) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr );
-  if( _checkcast_array_copy_ctr ) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr );
-  if( _unsafe_array_copy_ctr ) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr );
-  if( _generic_array_copy_ctr ) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr );
-  if( _slow_array_copy_ctr ) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr );
-  if( _find_handler_ctr ) tty->print_cr("%5d find exception handler", _find_handler_ctr );
-  if( _rethrow_ctr ) tty->print_cr("%5d rethrow handler", _rethrow_ctr );
+  if (_new_instance_ctr) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
+  if (_new_array_ctr) tty->print_cr("%5d new array requires GC", _new_array_ctr);
+  if (_multi1_ctr) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
+  if (_multi2_ctr) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
+  if (_multi3_ctr) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
+  if (_multi4_ctr) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
+  if (_multi5_ctr) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
+
+  tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr);
+  tty->print_cr("%5d wrong method", _wrong_method_ctr);
+  tty->print_cr("%5d unresolved static call site", _resolve_static_ctr);
+  tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr);
+  tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr);
+
+  if (_mon_enter_stub_ctr) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr);
+  if (_mon_exit_stub_ctr) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr);
+  if (_mon_enter_ctr) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr);
+  if (_mon_exit_ctr) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr);
+  if (_partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr);
+  if (_jbyte_array_copy_ctr) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr);
+  if (_jshort_array_copy_ctr) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr);
+  if (_jint_array_copy_ctr) tty->print_cr("%5d int array copies", _jint_array_copy_ctr);
+  if (_jlong_array_copy_ctr) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr);
+  if (_oop_array_copy_ctr) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr);
+  if (_checkcast_array_copy_ctr) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr);
+  if (_unsafe_array_copy_ctr) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr);
+  if (_generic_array_copy_ctr) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr);
+  if (_slow_array_copy_ctr) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr);
+  if (_find_handler_ctr) tty->print_cr("%5d find exception handler", _find_handler_ctr);
+  if (_rethrow_ctr) tty->print_cr("%5d rethrow handler", _rethrow_ctr);
 
   AdapterHandlerLibrary::print_statistics();
 
@@ -1997,7 +1997,7 @@ class MethodArityHistogram {
   MethodArityHistogram() {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     _max_arity = _max_size = 0;
-    for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram [i] = 0;
+    for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram[i] = 0;
     CodeCache::nmethods_do(add_method_to_histogram);
     print_histogram();
   }
@@ -2062,7 +2062,7 @@ class AdapterFingerPrint : public CHeapObj<mtCode> {
   // These are correct for the current system but someday it might be
   // necessary to make this mapping platform dependent.
   static int adapter_encoding(BasicType in) {
-    switch(in) {
+    switch (in) {
       case T_BOOLEAN:
       case T_BYTE:
       case T_SHORT:
@@ -2479,7 +2479,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
       tty->print_cr("i2c argument handler #%d for: %s %s (%d bytes generated)",
                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
                     method->signature()->as_C_string(), insts_size);
-      tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
+      tty->print_cr("c2i argument handler starts at %p", entry->get_c2i_entry());
       if (Verbose || PrintStubCode) {
         address first_pc = entry->base_address();
         if (first_pc != NULL) {
@@ -2504,7 +2504,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
                  new_adapter->name(),
                  fingerprint->as_string(),
                  new_adapter->content_begin());
-    Forte::register_stub(blob_id, new_adapter->content_begin(),new_adapter->content_end());
+    Forte::register_stub(blob_id, new_adapter->content_begin(), new_adapter->content_end());
 
     if (JvmtiExport::should_post_dynamic_code_generated()) {
       JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
@@ -2605,12 +2605,12 @@ void AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
       BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
       VMRegPair*   regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
       int i=0;
-      if( !method->is_static() )  // Pass in receiver first
+      if (!method->is_static())  // Pass in receiver first
         sig_bt[i++] = T_OBJECT;
       SignatureStream ss(method->signature());
-      for( ; !ss.at_return_type(); ss.next()) {
+      for (; !ss.at_return_type(); ss.next()) {
         sig_bt[i++] = ss.type();  // Collect remaining bits of signature
-        if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
+        if (ss.type() == T_LONG || ss.type() == T_DOUBLE)
           sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
       }
       assert(i == total_args_passed, "");
@@ -2762,10 +2762,10 @@ void SharedRuntime::convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
         case T_SHORT:
         case T_INT:
           // Convert (bt) to (T_LONG,bt).
-          new_in_sig_bt[argcnt  ] = T_LONG;
+          new_in_sig_bt[argcnt] = T_LONG;
           new_in_sig_bt[argcnt+1] = bt;
           assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
-          new_in_regs[argcnt  ].set2(reg.first());
+          new_in_regs[argcnt].set2(reg.first());
           new_in_regs[argcnt+1].set_bad();
           argcnt++;
           break;
@@ -2808,17 +2808,17 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
   int len = (int)strlen(s);
   s++; len--;                   // Skip opening paren
   char *t = s+len;
-  while( *(--t) != ')' ) ;      // Find close paren
+  while (*(--t) != ')');      // Find close paren
 
-  BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, 256 );
-  VMRegPair *regs = NEW_RESOURCE_ARRAY( VMRegPair, 256 );
+  BasicType *sig_bt = NEW_RESOURCE_ARRAY(BasicType, 256);
+  VMRegPair *regs = NEW_RESOURCE_ARRAY(VMRegPair, 256);
   int cnt = 0;
   if (has_receiver) {
     sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
   }
 
-  while( s < t ) {
-    switch( *s++ ) {            // Switch on signature character
+  while (s < t) {
+    switch (*s++) {            // Switch on signature character
     case 'B': sig_bt[cnt++] = T_BYTE;    break;
     case 'C': sig_bt[cnt++] = T_CHAR;    break;
     case 'D': sig_bt[cnt++] = T_DOUBLE;  sig_bt[cnt++] = T_VOID; break;
@@ -2829,16 +2829,16 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
     case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
     case 'V': sig_bt[cnt++] = T_VOID;    break;
     case 'L':                   // Oop
-      while( *s++ != ';'  ) ;   // Skip signature
+      while (*s++ != ';');   // Skip signature
       sig_bt[cnt++] = T_OBJECT;
       break;
     case '[': {                 // Array
       do {                      // Skip optional size
-        while( *s >= '0' && *s <= '9' ) s++;
-      } while( *s++ == '[' );   // Nested arrays?
+        while (*s >= '0' && *s <= '9') s++;
+      } while (*s++ == '[');   // Nested arrays?
       // Skip element type
-      if( s[-1] == 'L' )
-        while( *s++ != ';'  ) ; // Skip signature
+      if (s[-1] == 'L')
+        while (*s++ != ';'); // Skip signature
       sig_bt[cnt++] = T_ARRAY;
       break;
     }
@@ -2850,7 +2850,7 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
     sig_bt[cnt++] = T_OBJECT;
   }
 
-  assert( cnt < 256, "grow table size" );
+  assert(cnt < 256, "grow table size");
 
   int comp_args_on_stack;
   comp_args_on_stack = java_calling_convention(sig_bt, regs, cnt, true);
@@ -2861,12 +2861,12 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
   if (comp_args_on_stack) {
     for (int i = 0; i < cnt; i++) {
       VMReg reg1 = regs[i].first();
-      if( reg1->is_stack()) {
+      if (reg1->is_stack()) {
         // Yuck
         reg1 = reg1->bias(out_preserve_stack_slots());
       }
       VMReg reg2 = regs[i].second();
-      if( reg2->is_stack()) {
+      if (reg2->is_stack()) {
         // Yuck
         reg2 = reg2->bias(out_preserve_stack_slots());
       }
@@ -2904,15 +2904,15 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
   // frame accessor methods and be platform independent.
 
   frame fr = thread->last_frame();
-  assert( fr.is_interpreted_frame(), "" );
-  assert( fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks" );
+  assert(fr.is_interpreted_frame(), "");
+  assert(fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks");
 
   // Figure out how many monitors are active.
   int active_monitor_count = 0;
-  for( BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
+  for (BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
        kptr < fr.interpreter_frame_monitor_begin();
        kptr = fr.next_monitor_in_interpreter_frame(kptr) ) {
-    if( kptr->obj() != NULL ) active_monitor_count++;
+    if (kptr->obj() != NULL) active_monitor_count++;
   }
 
   // QQQ we could place number of active monitors in the array so that compiled code
@@ -2926,17 +2926,17 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
 
   // Copy the locals.  Order is preserved so that loading of longs works.
   // Since there's no GC I can copy the oops blindly.
-  assert( sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
+  assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
   Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
                        (HeapWord*)&buf[0],
                        max_locals);
 
   // Inflate locks.  Copy the displaced headers.  Be careful, there can be holes.
   int i = max_locals;
-  for( BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
+  for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
        kptr2 < fr.interpreter_frame_monitor_begin();
        kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
-    if( kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
+    if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
       BasicLock *lock = kptr2->lock();
       // Inflate so the displaced header becomes position-independent
       if (lock->displaced_header()->is_unlocked())
@@ -2946,20 +2946,20 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
       buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
     }
   }
-  assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );
+  assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
 
   return buf;
 JRT_END
 
 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
-  FREE_C_HEAP_ARRAY(intptr_t,buf, mtCode);
+  FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
 JRT_END
 
 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
   AdapterHandlerTableIterator iter(_adapters);
   while (iter.has_next()) {
     AdapterHandlerEntry* a = iter.next();
-    if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) return true;
+    if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
   }
   return false;
 }
diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp
index 62bd1ab9139..7af5fe72b62 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp
@@ -120,15 +120,15 @@ int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, Thread* thr) {
 }
 
 #define NINFLATIONLOCKS 256
-static volatile intptr_t InflationLocks [NINFLATIONLOCKS] ;
+static volatile intptr_t InflationLocks[NINFLATIONLOCKS];
 
-ObjectMonitor * ObjectSynchronizer::gBlockList = NULL ;
-ObjectMonitor * volatile ObjectSynchronizer::gFreeList  = NULL ;
-ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList  = NULL ;
+ObjectMonitor * ObjectSynchronizer::gBlockList = NULL;
+ObjectMonitor * volatile ObjectSynchronizer::gFreeList  = NULL;
+ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList  = NULL;
 int ObjectSynchronizer::gOmInUseCount = 0;
-static volatile intptr_t ListLock = 0 ;      // protects global monitor free-list cache
-static volatile int MonitorFreeCount  = 0 ;      // # on gFreeList
-static volatile int MonitorPopulation = 0 ;      // # Extant -- in circulation
+static volatile intptr_t ListLock = 0;      // protects global monitor free-list cache
+static volatile int MonitorFreeCount  = 0;      // # on gFreeList
+static volatile int MonitorPopulation = 0;      // # Extant -- in circulation
 #define CHAINMARKER (cast_to_oop<intptr_t>(-1))
 
 // -----------------------------------------------------------------------------
@@ -152,43 +152,43 @@ void ObjectSynchronizer::fast_enter(Handle obj, BasicLock* lock, bool attempt_re
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
  }
 
- slow_enter (obj, lock, THREAD) ;
+ slow_enter(obj, lock, THREAD);
 }
 
 void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) {
   assert(!object->mark()->has_bias_pattern(), "should not see bias pattern here");
   // if displaced header is null, the previous enter is recursive enter, no-op
   markOop dhw = lock->displaced_header();
-  markOop mark ;
+  markOop mark;
   if (dhw == NULL) {
      // Recursive stack-lock.
      // Diagnostics -- Could be: stack-locked, inflating, inflated.
-     mark = object->mark() ;
-     assert (!mark->is_neutral(), "invariant") ;
+     mark = object->mark();
+     assert(!mark->is_neutral(), "invariant");
      if (mark->has_locker() && mark != markOopDesc::INFLATING()) {
-        assert(THREAD->is_lock_owned((address)mark->locker()), "invariant") ;
+        assert(THREAD->is_lock_owned((address)mark->locker()), "invariant");
      }
      if (mark->has_monitor()) {
-        ObjectMonitor * m = mark->monitor() ;
-        assert(((oop)(m->object()))->mark() == mark, "invariant") ;
-        assert(m->is_entered(THREAD), "invariant") ;
+        ObjectMonitor * m = mark->monitor();
+        assert(((oop)(m->object()))->mark() == mark, "invariant");
+        assert(m->is_entered(THREAD), "invariant");
      }
-     return ;
+     return;
   }
 
-  mark = object->mark() ;
+  mark = object->mark();
 
   // If the object is stack-locked by the current thread, try to
   // swing the displaced header from the box back to the mark.
   if (mark == (markOop) lock) {
-     assert (dhw->is_neutral(), "invariant") ;
+     assert(dhw->is_neutral(), "invariant");
      if ((markOop) Atomic::cmpxchg_ptr (dhw, object->mark_addr(), mark) == mark) {
-        TEVENT (fast_exit: release stacklock) ;
+        TEVENT(fast_exit: release stacklock);
         return;
      }
   }
 
-  ObjectSynchronizer::inflate(THREAD, object)->exit (true, THREAD) ;
+  ObjectSynchronizer::inflate(THREAD, object)->exit(true, THREAD);
 }
 
 // -----------------------------------------------------------------------------
@@ -205,8 +205,8 @@ void ObjectSynchronizer::slow_enter(Handle obj, BasicLock* lock, TRAPS) {
     // be visible <= the ST performed by the CAS.
     lock->set_displaced_header(mark);
     if (mark == (markOop) Atomic::cmpxchg_ptr(lock, obj()->mark_addr(), mark)) {
-      TEVENT (slow_enter: release stacklock) ;
-      return ;
+      TEVENT(slow_enter: release stacklock);
+      return;
     }
     // Fall through to inflate() ...
   } else
@@ -220,8 +220,8 @@ void ObjectSynchronizer::slow_enter(Handle obj, BasicLock* lock, TRAPS) {
 #if 0
   // The following optimization isn't particularly useful.
   if (mark->has_monitor() && mark->monitor()->is_entered(THREAD)) {
-    lock->set_displaced_header (NULL) ;
-    return ;
+    lock->set_displaced_header(NULL);
+    return;
   }
 #endif
 
@@ -238,7 +238,7 @@ void ObjectSynchronizer::slow_enter(Handle obj, BasicLock* lock, TRAPS) {
 // failed in the interpreter/compiler code. Simply use the heavy
 // weight monitor should be ok, unless someone find otherwise.
 void ObjectSynchronizer::slow_exit(oop object, BasicLock* lock, TRAPS) {
-  fast_exit (object, lock, THREAD) ;
+  fast_exit(object, lock, THREAD);
 }
 
 // -----------------------------------------------------------------------------
@@ -254,7 +254,7 @@ void ObjectSynchronizer::slow_exit(oop object, BasicLock* lock, TRAPS) {
 //  5) lock lock2
 // NOTE: must use heavy weight monitor to handle complete_exit/reenter()
 intptr_t ObjectSynchronizer::complete_exit(Handle obj, TRAPS) {
-  TEVENT (complete_exit) ;
+  TEVENT(complete_exit);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -267,7 +267,7 @@ intptr_t ObjectSynchronizer::complete_exit(Handle obj, TRAPS) {
 
 // NOTE: must use heavy weight monitor to handle complete_exit/reenter()
 void ObjectSynchronizer::reenter(Handle obj, intptr_t recursion, TRAPS) {
-  TEVENT (reenter) ;
+  TEVENT(reenter);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -282,7 +282,7 @@ void ObjectSynchronizer::reenter(Handle obj, intptr_t recursion, TRAPS) {
 // NOTE: must use heavy weight monitor to handle jni monitor enter
 void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) { // possible entry from jni enter
   // the current locking is from JNI instead of Java code
-  TEVENT (jni_enter) ;
+  TEVENT(jni_enter);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -306,7 +306,7 @@ bool ObjectSynchronizer::jni_try_enter(Handle obj, Thread* THREAD) {
 
 // NOTE: must use heavy weight monitor to handle jni monitor exit
 void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) {
-  TEVENT (jni_exit) ;
+  TEVENT(jni_exit);
   if (UseBiasedLocking) {
     Handle h_obj(THREAD, obj);
     BiasedLocking::revoke_and_rebias(h_obj, false, THREAD);
@@ -332,7 +332,7 @@ ObjectLocker::ObjectLocker(Handle obj, Thread* thread, bool doLock) {
   _obj = obj;
 
   if (_dolock) {
-    TEVENT (ObjectLocker) ;
+    TEVENT(ObjectLocker);
 
     ObjectSynchronizer::fast_enter(_obj, &_lock, false, _thread);
   }
@@ -354,7 +354,7 @@ int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) {
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   }
   if (millis < 0) {
-    TEVENT (wait - throw IAX) ;
+    TEVENT(wait - throw IAX);
     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   }
   ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj());
@@ -374,10 +374,10 @@ void ObjectSynchronizer::waitUninterruptibly (Handle obj, jlong millis, TRAPS) {
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   }
   if (millis < 0) {
-    TEVENT (wait - throw IAX) ;
+    TEVENT(wait - throw IAX);
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   }
-  ObjectSynchronizer::inflate(THREAD, obj()) -> wait(millis, false, THREAD) ;
+  ObjectSynchronizer::inflate(THREAD, obj()) -> wait(millis, false, THREAD);
 }
 
 void ObjectSynchronizer::notify(Handle obj, TRAPS) {
@@ -428,31 +428,31 @@ void ObjectSynchronizer::notifyall(Handle obj, TRAPS) {
 struct SharedGlobals {
     // These are highly shared mostly-read variables.
     // To avoid false-sharing they need to be the sole occupants of a $ line.
-    double padPrefix [8];
-    volatile int stwRandom ;
-    volatile int stwCycle ;
+    double padPrefix[8];
+    volatile int stwRandom;
+    volatile int stwCycle;
 
     // Hot RW variables -- Sequester to avoid false-sharing
-    double padSuffix [16];
-    volatile int hcSequence ;
-    double padFinal [8] ;
-} ;
+    double padSuffix[16];
+    volatile int hcSequence;
+    double padFinal[8];
+};
 
-static SharedGlobals GVars ;
-static int MonitorScavengeThreshold = 1000000 ;
-static volatile int ForceMonitorScavenge = 0 ; // Scavenge required and pending
+static SharedGlobals GVars;
+static int MonitorScavengeThreshold = 1000000;
+static volatile int ForceMonitorScavenge = 0; // Scavenge required and pending
 
 static markOop ReadStableMark (oop obj) {
-  markOop mark = obj->mark() ;
+  markOop mark = obj->mark();
   if (!mark->is_being_inflated()) {
-    return mark ;       // normal fast-path return
+    return mark;       // normal fast-path return
   }
 
-  int its = 0 ;
+  int its = 0;
   for (;;) {
-    markOop mark = obj->mark() ;
+    markOop mark = obj->mark();
     if (!mark->is_being_inflated()) {
-      return mark ;    // normal fast-path return
+      return mark;    // normal fast-path return
     }
 
     // The object is being inflated by some other thread.
@@ -465,11 +465,11 @@ static markOop ReadStableMark (oop obj) {
     // TODO: add inflation contention performance counters.
     // TODO: restrict the aggregate number of spinners.
 
-    ++its ;
+    ++its;
     if (its > 10000 || !os::is_MP()) {
        if (its & 1) {
-         os::NakedYield() ;
-         TEVENT (Inflate: INFLATING - yield) ;
+         os::NakedYield();
+         TEVENT(Inflate: INFLATING - yield);
        } else {
          // Note that the following code attenuates the livelock problem but is not
          // a complete remedy.  A more complete solution would require that the inflating
@@ -486,26 +486,26 @@ static markOop ReadStableMark (oop obj) {
          // then for each thread on the list, set the flag and unpark() the thread.
          // This is conceptually similar to muxAcquire-muxRelease, except that muxRelease
          // wakes at most one thread whereas we need to wake the entire list.
-         int ix = (cast_from_oop<intptr_t>(obj) >> 5) & (NINFLATIONLOCKS-1) ;
-         int YieldThenBlock = 0 ;
-         assert (ix >= 0 && ix < NINFLATIONLOCKS, "invariant") ;
-         assert ((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant") ;
-         Thread::muxAcquire (InflationLocks + ix, "InflationLock") ;
+         int ix = (cast_from_oop<intptr_t>(obj) >> 5) & (NINFLATIONLOCKS-1);
+         int YieldThenBlock = 0;
+         assert(ix >= 0 && ix < NINFLATIONLOCKS, "invariant");
+         assert((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant");
+         Thread::muxAcquire(InflationLocks + ix, "InflationLock");
          while (obj->mark() == markOopDesc::INFLATING()) {
            // Beware: NakedYield() is advisory and has almost no effect on some platforms
            // so we periodically call Self->_ParkEvent->park(1).
            // We use a mixed spin/yield/block mechanism.
            if ((YieldThenBlock++) >= 16) {
-              Thread::current()->_ParkEvent->park(1) ;
+              Thread::current()->_ParkEvent->park(1);
            } else {
-              os::NakedYield() ;
+              os::NakedYield();
            }
          }
-         Thread::muxRelease (InflationLocks + ix ) ;
-         TEVENT (Inflate: INFLATING - yield/park) ;
+         Thread::muxRelease(InflationLocks + ix);
+         TEVENT(Inflate: INFLATING - yield/park);
        }
     } else {
-       SpinPause() ;       // SMP-polite spinning
+       SpinPause();       // SMP-polite spinning
     }
   }
 }
@@ -529,48 +529,48 @@ static markOop ReadStableMark (oop obj) {
 //
 
 static inline intptr_t get_next_hash(Thread * Self, oop obj) {
-  intptr_t value = 0 ;
+  intptr_t value = 0;
   if (hashCode == 0) {
      // This form uses an unguarded global Park-Miller RNG,
      // so it's possible for two threads to race and generate the same RNG.
      // On MP system we'll have lots of RW access to a global, so the
      // mechanism induces lots of coherency traffic.
-     value = os::random() ;
+     value = os::random();
   } else
   if (hashCode == 1) {
      // This variation has the property of being stable (idempotent)
      // between STW operations.  This can be useful in some of the 1-0
      // synchronization schemes.
-     intptr_t addrBits = cast_from_oop<intptr_t>(obj) >> 3 ;
-     value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom ;
+     intptr_t addrBits = cast_from_oop<intptr_t>(obj) >> 3;
+     value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom;
   } else
   if (hashCode == 2) {
-     value = 1 ;            // for sensitivity testing
+     value = 1;            // for sensitivity testing
   } else
   if (hashCode == 3) {
-     value = ++GVars.hcSequence ;
+     value = ++GVars.hcSequence;
   } else
   if (hashCode == 4) {
-     value = cast_from_oop<intptr_t>(obj) ;
+     value = cast_from_oop<intptr_t>(obj);
   } else {
      // Marsaglia's xor-shift scheme with thread-specific state
      // This is probably the best overall implementation -- we'll
      // likely make this the default in future releases.
-     unsigned t = Self->_hashStateX ;
-     t ^= (t << 11) ;
-     Self->_hashStateX = Self->_hashStateY ;
-     Self->_hashStateY = Self->_hashStateZ ;
-     Self->_hashStateZ = Self->_hashStateW ;
-     unsigned v = Self->_hashStateW ;
-     v = (v ^ (v >> 19)) ^ (t ^ (t >> 8)) ;
-     Self->_hashStateW = v ;
-     value = v ;
+     unsigned t = Self->_hashStateX;
+     t ^= (t << 11);
+     Self->_hashStateX = Self->_hashStateY;
+     Self->_hashStateY = Self->_hashStateZ;
+     Self->_hashStateZ = Self->_hashStateW;
+     unsigned v = Self->_hashStateW;
+     v = (v ^ (v >> 19)) ^ (t ^ (t >> 8));
+     Self->_hashStateW = v;
+     value = v;
   }
 
   value &= markOopDesc::hash_mask;
-  if (value == 0) value = 0xBAD ;
-  assert (value != markOopDesc::no_hash, "invariant") ;
-  TEVENT (hashCode: GENERATE) ;
+  if (value == 0) value = 0xBAD;
+  assert(value != markOopDesc::no_hash, "invariant");
+  TEVENT(hashCode: GENERATE);
   return value;
 }
 //
@@ -585,25 +585,25 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) {
     // thread-local storage.
     if (obj->mark()->has_bias_pattern()) {
       // Box and unbox the raw reference just in case we cause a STW safepoint.
-      Handle hobj (Self, obj) ;
+      Handle hobj(Self, obj);
       // Relaxing assertion for bug 6320749.
-      assert (Universe::verify_in_progress() ||
+      assert(Universe::verify_in_progress() ||
               !SafepointSynchronize::is_at_safepoint(),
              "biases should not be seen by VM thread here");
       BiasedLocking::revoke_and_rebias(hobj, false, JavaThread::current());
-      obj = hobj() ;
+      obj = hobj();
       assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
     }
   }
 
   // hashCode() is a heap mutator ...
   // Relaxing assertion for bug 6320749.
-  assert (Universe::verify_in_progress() ||
-          !SafepointSynchronize::is_at_safepoint(), "invariant") ;
-  assert (Universe::verify_in_progress() ||
-          Self->is_Java_thread() , "invariant") ;
-  assert (Universe::verify_in_progress() ||
-         ((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant") ;
+  assert(Universe::verify_in_progress() ||
+          !SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert(Universe::verify_in_progress() ||
+          Self->is_Java_thread() , "invariant");
+  assert(Universe::verify_in_progress() ||
+         ((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant");
 
   ObjectMonitor* monitor = NULL;
   markOop temp, test;
@@ -611,7 +611,7 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) {
   markOop mark = ReadStableMark (obj);
 
   // object should remain ineligible for biased locking
-  assert (!mark->has_bias_pattern(), "invariant") ;
+  assert(!mark->has_bias_pattern(), "invariant");
 
   if (mark->is_neutral()) {
     hash = mark->hash();              // this is a normal header
@@ -631,7 +631,7 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) {
   } else if (mark->has_monitor()) {
     monitor = mark->monitor();
     temp = monitor->header();
-    assert (temp->is_neutral(), "invariant") ;
+    assert(temp->is_neutral(), "invariant");
     hash = temp->hash();
     if (hash) {
       return hash;
@@ -639,7 +639,7 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) {
     // Skip to the following code to reduce code size
   } else if (Self->is_lock_owned((address)mark->locker())) {
     temp = mark->displaced_mark_helper(); // this is a lightweight monitor owned
-    assert (temp->is_neutral(), "invariant") ;
+    assert(temp->is_neutral(), "invariant");
     hash = temp->hash();              // by current thread, check if the displaced
     if (hash) {                       // header contains hash code
       return hash;
@@ -659,20 +659,20 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) {
   monitor = ObjectSynchronizer::inflate(Self, obj);
   // Load displaced header and check it has hash code
   mark = monitor->header();
-  assert (mark->is_neutral(), "invariant") ;
+  assert(mark->is_neutral(), "invariant");
   hash = mark->hash();
   if (hash == 0) {
     hash = get_next_hash(Self, obj);
     temp = mark->copy_set_hash(hash); // merge hash code into header
-    assert (temp->is_neutral(), "invariant") ;
+    assert(temp->is_neutral(), "invariant");
     test = (markOop) Atomic::cmpxchg_ptr(temp, monitor, mark);
     if (test != mark) {
       // The only update to the header in the monitor (outside GC)
       // is install the hash code. If someone add new usage of
       // displaced header, please update this code
       hash = test->hash();
-      assert (test->is_neutral(), "invariant") ;
-      assert (hash != 0, "Trivial unexpected object/monitor header usage.");
+      assert(test->is_neutral(), "invariant");
+      assert(hash != 0, "Trivial unexpected object/monitor header usage.");
     }
   }
   // We finally get the hash
@@ -682,7 +682,7 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) {
 // Deprecated -- use FastHashCode() instead.
 
 intptr_t ObjectSynchronizer::identity_hash_value_for(Handle obj) {
-  return FastHashCode (Thread::current(), obj()) ;
+  return FastHashCode(Thread::current(), obj());
 }
 
 
@@ -696,7 +696,7 @@ bool ObjectSynchronizer::current_thread_holds_lock(JavaThread* thread,
   assert(thread == JavaThread::current(), "Can only be called on current thread");
   oop obj = h_obj();
 
-  markOop mark = ReadStableMark (obj) ;
+  markOop mark = ReadStableMark(obj);
 
   // Uncontended case, header points to stack
   if (mark->has_locker()) {
@@ -705,7 +705,7 @@ bool ObjectSynchronizer::current_thread_holds_lock(JavaThread* thread,
   // Contended case, header points to ObjectMonitor (tagged pointer)
   if (mark->has_monitor()) {
     ObjectMonitor* monitor = mark->monitor();
-    return monitor->is_entered(thread) != 0 ;
+    return monitor->is_entered(thread) != 0;
   }
   // Unlocked case, header in place
   assert(mark->is_neutral(), "sanity check");
@@ -721,8 +721,8 @@ ObjectSynchronizer::LockOwnership ObjectSynchronizer::query_lock_ownership
 (JavaThread *self, Handle h_obj) {
   // The caller must beware this method can revoke bias, and
   // revocation can result in a safepoint.
-  assert (!SafepointSynchronize::is_at_safepoint(), "invariant") ;
-  assert (self->thread_state() != _thread_blocked , "invariant") ;
+  assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
+  assert(self->thread_state() != _thread_blocked , "invariant");
 
   // Possible mark states: neutral, biased, stack-locked, inflated
 
@@ -735,7 +735,7 @@ ObjectSynchronizer::LockOwnership ObjectSynchronizer::query_lock_ownership
 
   assert(self == JavaThread::current(), "Can only be called on current thread");
   oop obj = h_obj();
-  markOop mark = ReadStableMark (obj) ;
+  markOop mark = ReadStableMark(obj);
 
   // CASE: stack-locked.  Mark points to a BasicLock on the owner's stack.
   if (mark->has_locker()) {
@@ -747,15 +747,15 @@ ObjectSynchronizer::LockOwnership ObjectSynchronizer::query_lock_ownership
   // The Object:ObjectMonitor relationship is stable as long as we're
   // not at a safepoint.
   if (mark->has_monitor()) {
-    void * owner = mark->monitor()->_owner ;
-    if (owner == NULL) return owner_none ;
+    void * owner = mark->monitor()->_owner;
+    if (owner == NULL) return owner_none;
     return (owner == self ||
             self->is_lock_owned((address)owner)) ? owner_self : owner_other;
   }
 
   // CASE: neutral
   assert(mark->is_neutral(), "sanity check");
-  return owner_none ;           // it's unlocked
+  return owner_none;           // it's unlocked
 }
 
 // FIXME: jvmti should call this
@@ -772,7 +772,7 @@ JavaThread* ObjectSynchronizer::get_lock_owner(Handle h_obj, bool doLock) {
   oop obj = h_obj();
   address owner = NULL;
 
-  markOop mark = ReadStableMark (obj) ;
+  markOop mark = ReadStableMark(obj);
 
   // Uncontended case, header points to stack
   if (mark->has_locker()) {
@@ -819,7 +819,7 @@ void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) {
 // Get the next block in the block list.
 static inline ObjectMonitor* next(ObjectMonitor* block) {
   assert(block->object() == CHAINMARKER, "must be a block header");
-  block = block->FreeNext ;
+  block = block->FreeNext;
   assert(block == NULL || block->object() == CHAINMARKER, "must be a block header");
   return block;
 }
@@ -887,17 +887,17 @@ static void InduceScavenge (Thread * Self, const char * Whence) {
   if (ForceMonitorScavenge == 0 && Atomic::xchg (1, &ForceMonitorScavenge) == 0) {
     if (ObjectMonitor::Knob_Verbose) {
       ::printf ("Monitor scavenge - Induced STW @%s (%d)\n", Whence, ForceMonitorScavenge) ;
-      ::fflush(stdout) ;
+      ::fflush(stdout);
     }
     // Induce a 'null' safepoint to scavenge monitors
     // Must VM_Operation instance be heap allocated as the op will be enqueue and posted
     // to the VMthread and have a lifespan longer than that of this activation record.
     // The VMThread will delete the op when completed.
-    VMThread::execute (new VM_ForceAsyncSafepoint()) ;
+    VMThread::execute(new VM_ForceAsyncSafepoint());
 
     if (ObjectMonitor::Knob_Verbose) {
       ::printf ("Monitor scavenge - STW posted @%s (%d)\n", Whence, ForceMonitorScavenge) ;
-      ::fflush(stdout) ;
+      ::fflush(stdout);
     }
   }
 }
@@ -923,9 +923,9 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
     // number of objectMonitors in circulation as well as the STW
     // scavenge costs.  As usual, we lean toward time in space-time
     // tradeoffs.
-    const int MAXPRIVATE = 1024 ;
+    const int MAXPRIVATE = 1024;
     for (;;) {
-        ObjectMonitor * m ;
+        ObjectMonitor * m;
 
         // 1: try to allocate from the thread's local omFreeList.
         // Threads will attempt to allocate first from their local list, then
@@ -933,21 +933,21 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
         // attempt to instantiate new monitors.   Thread-local free lists take
         // heat off the ListLock and improve allocation latency, as well as reducing
         // coherency traffic on the shared global list.
-        m = Self->omFreeList ;
+        m = Self->omFreeList;
         if (m != NULL) {
-           Self->omFreeList = m->FreeNext ;
-           Self->omFreeCount -- ;
+           Self->omFreeList = m->FreeNext;
+           Self->omFreeCount--;
            // CONSIDER: set m->FreeNext = BAD -- diagnostic hygiene
-           guarantee (m->object() == NULL, "invariant") ;
+           guarantee(m->object() == NULL, "invariant");
            if (MonitorInUseLists) {
              m->FreeNext = Self->omInUseList;
              Self->omInUseList = m;
-             Self->omInUseCount ++;
+             Self->omInUseCount++;
              // verifyInUse(Self);
            } else {
              m->FreeNext = NULL;
            }
-           return m ;
+           return m;
         }
 
         // 2: try to allocate from the global gFreeList
@@ -959,27 +959,27 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
             // Reprovision the thread's omFreeList.
             // Use bulk transfers to reduce the allocation rate and heat
             // on various locks.
-            Thread::muxAcquire (&ListLock, "omAlloc") ;
-            for (int i = Self->omFreeProvision; --i >= 0 && gFreeList != NULL; ) {
-                MonitorFreeCount --;
-                ObjectMonitor * take = gFreeList ;
-                gFreeList = take->FreeNext ;
-                guarantee (take->object() == NULL, "invariant") ;
-                guarantee (!take->is_busy(), "invariant") ;
-                take->Recycle() ;
-                omRelease (Self, take, false) ;
+            Thread::muxAcquire(&ListLock, "omAlloc");
+            for (int i = Self->omFreeProvision; --i >= 0 && gFreeList != NULL;) {
+                MonitorFreeCount--;
+                ObjectMonitor * take = gFreeList;
+                gFreeList = take->FreeNext;
+                guarantee(take->object() == NULL, "invariant");
+                guarantee(!take->is_busy(), "invariant");
+                take->Recycle();
+                omRelease(Self, take, false);
             }
-            Thread::muxRelease (&ListLock) ;
-            Self->omFreeProvision += 1 + (Self->omFreeProvision/2) ;
-            if (Self->omFreeProvision > MAXPRIVATE ) Self->omFreeProvision = MAXPRIVATE ;
-            TEVENT (omFirst - reprovision) ;
+            Thread::muxRelease(&ListLock);
+            Self->omFreeProvision += 1 + (Self->omFreeProvision/2);
+            if (Self->omFreeProvision > MAXPRIVATE) Self->omFreeProvision = MAXPRIVATE;
+            TEVENT(omFirst - reprovision);
 
-            const int mx = MonitorBound ;
+            const int mx = MonitorBound;
             if (mx > 0 && (MonitorPopulation-MonitorFreeCount) > mx) {
               // We can't safely induce a STW safepoint from omAlloc() as our thread
               // state may not be appropriate for such activities and callers may hold
               // naked oops, so instead we defer the action.
-              InduceScavenge (Self, "omAlloc") ;
+              InduceScavenge(Self, "omAlloc");
             }
             continue;
         }
@@ -987,14 +987,14 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
         // 3: allocate a block of new ObjectMonitors
         // Both the local and global free lists are empty -- resort to malloc().
         // In the current implementation objectMonitors are TSM - immortal.
-        assert (_BLOCKSIZE > 1, "invariant") ;
+        assert(_BLOCKSIZE > 1, "invariant");
         ObjectMonitor * temp = new ObjectMonitor[_BLOCKSIZE];
 
         // NOTE: (almost) no way to recover if allocation failed.
         // We might be able to induce a STW safepoint and scavenge enough
         // objectMonitors to permit progress.
         if (temp == NULL) {
-            vm_exit_out_of_memory (sizeof (ObjectMonitor[_BLOCKSIZE]), OOM_MALLOC_ERROR,
+            vm_exit_out_of_memory(sizeof (ObjectMonitor[_BLOCKSIZE]), OOM_MALLOC_ERROR,
                                    "Allocate ObjectMonitors");
         }
 
@@ -1006,12 +1006,12 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
         // linkage should be reconsidered.  A better implementation would
         // look like: class Block { Block * next; int N; ObjectMonitor Body [N] ; }
 
-        for (int i = 1; i < _BLOCKSIZE ; i++) {
+        for (int i = 1; i < _BLOCKSIZE; i++) {
            temp[i].FreeNext = &temp[i+1];
         }
 
         // terminate the last monitor as the end of list
-        temp[_BLOCKSIZE - 1].FreeNext = NULL ;
+        temp[_BLOCKSIZE - 1].FreeNext = NULL;
 
         // Element [0] is reserved for global list linkage
         temp[0].set_object(CHAINMARKER);
@@ -1022,7 +1022,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
 
         // Acquire the ListLock to manipulate BlockList and FreeList.
         // An Oyama-Taura-Yonezawa scheme might be more efficient.
-        Thread::muxAcquire (&ListLock, "omAlloc [2]") ;
+        Thread::muxAcquire(&ListLock, "omAlloc [2]");
         MonitorPopulation += _BLOCKSIZE-1;
         MonitorFreeCount += _BLOCKSIZE-1;
 
@@ -1033,10 +1033,10 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
         gBlockList = temp;
 
         // Add the new string of objectMonitors to the global free list
-        temp[_BLOCKSIZE - 1].FreeNext = gFreeList ;
+        temp[_BLOCKSIZE - 1].FreeNext = gFreeList;
         gFreeList = temp + 1;
-        Thread::muxRelease (&ListLock) ;
-        TEVENT (Allocate block of monitors) ;
+        Thread::muxRelease(&ListLock);
+        TEVENT(Allocate block of monitors);
     }
 }
 
@@ -1049,12 +1049,12 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
 //
 
 void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromPerThreadAlloc) {
-    guarantee (m->object() == NULL, "invariant") ;
+    guarantee(m->object() == NULL, "invariant");
 
     // Remove from omInUseList
     if (MonitorInUseLists && fromPerThreadAlloc) {
       ObjectMonitor* curmidinuse = NULL;
-      for (ObjectMonitor* mid = Self->omInUseList; mid != NULL; ) {
+      for (ObjectMonitor* mid = Self->omInUseList; mid != NULL;) {
        if (m == mid) {
          // extract from per-thread in-use-list
          if (mid == Self->omInUseList) {
@@ -1062,7 +1062,7 @@ void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromP
          } else if (curmidinuse != NULL) {
            curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist
          }
-         Self->omInUseCount --;
+         Self->omInUseCount--;
          // verifyInUse(Self);
          break;
        } else {
@@ -1073,9 +1073,9 @@ void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromP
   }
 
   // FreeNext is used for both onInUseList and omFreeList, so clear old before setting new
-  m->FreeNext = Self->omFreeList ;
-  Self->omFreeList = m ;
-  Self->omFreeCount ++ ;
+  m->FreeNext = Self->omFreeList;
+  Self->omFreeList = m;
+  Self->omFreeCount++;
 }
 
 // Return the monitors of a moribund thread's local free list to
@@ -1099,25 +1099,25 @@ void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromP
 // operator.
 
 void ObjectSynchronizer::omFlush (Thread * Self) {
-    ObjectMonitor * List = Self->omFreeList ;  // Null-terminated SLL
-    Self->omFreeList = NULL ;
-    ObjectMonitor * Tail = NULL ;
+    ObjectMonitor * List = Self->omFreeList;  // Null-terminated SLL
+    Self->omFreeList = NULL;
+    ObjectMonitor * Tail = NULL;
     int Tally = 0;
     if (List != NULL) {
-      ObjectMonitor * s ;
-      for (s = List ; s != NULL ; s = s->FreeNext) {
-          Tally ++ ;
-          Tail = s ;
-          guarantee (s->object() == NULL, "invariant") ;
-          guarantee (!s->is_busy(), "invariant") ;
-          s->set_owner (NULL) ;   // redundant but good hygiene
-          TEVENT (omFlush - Move one) ;
+      ObjectMonitor * s;
+      for (s = List; s != NULL; s = s->FreeNext) {
+          Tally++;
+          Tail = s;
+          guarantee(s->object() == NULL, "invariant");
+          guarantee(!s->is_busy(), "invariant");
+          s->set_owner(NULL);   // redundant but good hygiene
+          TEVENT(omFlush - Move one);
       }
-      guarantee (Tail != NULL && List != NULL, "invariant") ;
+      guarantee(Tail != NULL && List != NULL, "invariant");
     }
 
     ObjectMonitor * InUseList = Self->omInUseList;
-    ObjectMonitor * InUseTail = NULL ;
+    ObjectMonitor * InUseTail = NULL;
     int InUseTally = 0;
     if (InUseList != NULL) {
       Self->omInUseList = NULL;
@@ -1129,13 +1129,13 @@ void ObjectSynchronizer::omFlush (Thread * Self) {
 // TODO debug
       assert(Self->omInUseCount == InUseTally, "inuse count off");
       Self->omInUseCount = 0;
-      guarantee (InUseTail != NULL && InUseList != NULL, "invariant");
+      guarantee(InUseTail != NULL && InUseList != NULL, "invariant");
     }
 
-    Thread::muxAcquire (&ListLock, "omFlush") ;
+    Thread::muxAcquire(&ListLock, "omFlush");
     if (Tail != NULL) {
-      Tail->FreeNext = gFreeList ;
-      gFreeList = List ;
+      Tail->FreeNext = gFreeList;
+      gFreeList = List;
       MonitorFreeCount += Tally;
     }
 
@@ -1145,8 +1145,8 @@ void ObjectSynchronizer::omFlush (Thread * Self) {
       gOmInUseCount += InUseTally;
     }
 
-    Thread::muxRelease (&ListLock) ;
-    TEVENT (omFlush) ;
+    Thread::muxRelease(&ListLock);
+    TEVENT(omFlush);
 }
 
 // Fast path code shared by multiple functions
@@ -1168,12 +1168,12 @@ ObjectMonitor* ObjectSynchronizer::inflate_helper(oop obj) {
 ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
   // Inflate mutates the heap ...
   // Relaxing assertion for bug 6320749.
-  assert (Universe::verify_in_progress() ||
-          !SafepointSynchronize::is_at_safepoint(), "invariant") ;
+  assert(Universe::verify_in_progress() ||
+          !SafepointSynchronize::is_at_safepoint(), "invariant");
 
   for (;;) {
-      const markOop mark = object->mark() ;
-      assert (!mark->has_bias_pattern(), "invariant") ;
+      const markOop mark = object->mark();
+      assert(!mark->has_bias_pattern(), "invariant");
 
       // The mark can be in one of the following states:
       // *  Inflated     - just return
@@ -1184,11 +1184,11 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
 
       // CASE: inflated
       if (mark->has_monitor()) {
-          ObjectMonitor * inf = mark->monitor() ;
-          assert (inf->header()->is_neutral(), "invariant");
-          assert (inf->object() == object, "invariant") ;
-          assert (ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid");
-          return inf ;
+          ObjectMonitor * inf = mark->monitor();
+          assert(inf->header()->is_neutral(), "invariant");
+          assert(inf->object() == object, "invariant");
+          assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid");
+          return inf;
       }
 
       // CASE: inflation in progress - inflating over a stack-lock.
@@ -1198,9 +1198,9 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
       // Currently, we spin/yield/park and poll the markword, waiting for inflation to finish.
       // We could always eliminate polling by parking the thread on some auxiliary list.
       if (mark == markOopDesc::INFLATING()) {
-         TEVENT (Inflate: spin while INFLATING) ;
-         ReadStableMark(object) ;
-         continue ;
+         TEVENT(Inflate: spin while INFLATING);
+         ReadStableMark(object);
+         continue;
       }
 
       // CASE: stack-locked
@@ -1223,20 +1223,20 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
       // See the comments in omAlloc().
 
       if (mark->has_locker()) {
-          ObjectMonitor * m = omAlloc (Self) ;
+          ObjectMonitor * m = omAlloc(Self);
           // Optimistically prepare the objectmonitor - anticipate successful CAS
           // We do this before the CAS in order to minimize the length of time
           // in which INFLATING appears in the mark.
           m->Recycle();
-          m->_Responsible  = NULL ;
-          m->OwnerIsThread = 0 ;
-          m->_recursions   = 0 ;
-          m->_SpinDuration = ObjectMonitor::Knob_SpinLimit ;   // Consider: maintain by type/class
+          m->_Responsible  = NULL;
+          m->OwnerIsThread = 0;
+          m->_recursions   = 0;
+          m->_SpinDuration = ObjectMonitor::Knob_SpinLimit;   // Consider: maintain by type/class
 
-          markOop cmp = (markOop) Atomic::cmpxchg_ptr (markOopDesc::INFLATING(), object->mark_addr(), mark) ;
+          markOop cmp = (markOop) Atomic::cmpxchg_ptr(markOopDesc::INFLATING(), object->mark_addr(), mark);
           if (cmp != mark) {
-             omRelease (Self, m, true) ;
-             continue ;       // Interference -- just retry
+             omRelease(Self, m, true);
+             continue;       // Interference -- just retry
           }
 
           // We've successfully installed INFLATING (0) into the mark-word.
@@ -1269,11 +1269,11 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
           // The owner can't die or unwind past the lock while our INFLATING
           // object is in the mark.  Furthermore the owner can't complete
           // an unlock on the object, either.
-          markOop dmw = mark->displaced_mark_helper() ;
-          assert (dmw->is_neutral(), "invariant") ;
+          markOop dmw = mark->displaced_mark_helper();
+          assert(dmw->is_neutral(), "invariant");
 
           // Setup monitor fields to proper values -- prepare the monitor
-          m->set_header(dmw) ;
+          m->set_header(dmw);
 
           // Optimization: if the mark->locker stack address is associated
           // with this thread we could simply set m->_owner = Self and
@@ -1286,13 +1286,13 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
 
           // Must preserve store ordering. The monitor state must
           // be stable at the time of publishing the monitor address.
-          guarantee (object->mark() == markOopDesc::INFLATING(), "invariant") ;
+          guarantee(object->mark() == markOopDesc::INFLATING(), "invariant");
           object->release_set_mark(markOopDesc::encode(m));
 
           // Hopefully the performance counters are allocated on distinct cache lines
           // to avoid false sharing on MP systems ...
-          if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc() ;
-          TEVENT(Inflate: overwrite stacklock) ;
+          if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
+          TEVENT(Inflate: overwrite stacklock);
           if (TraceMonitorInflation) {
             if (object->is_instance()) {
               ResourceMark rm;
@@ -1301,7 +1301,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
                 object->klass()->external_name());
             }
           }
-          return m ;
+          return m;
       }
 
       // CASE: neutral
@@ -1314,26 +1314,26 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
       // An inflateTry() method that we could call from fast_enter() and slow_enter()
       // would be useful.
 
-      assert (mark->is_neutral(), "invariant");
-      ObjectMonitor * m = omAlloc (Self) ;
+      assert(mark->is_neutral(), "invariant");
+      ObjectMonitor * m = omAlloc(Self);
       // prepare m for installation - set monitor to initial state
       m->Recycle();
       m->set_header(mark);
       m->set_owner(NULL);
       m->set_object(object);
-      m->OwnerIsThread = 1 ;
-      m->_recursions   = 0 ;
-      m->_Responsible  = NULL ;
-      m->_SpinDuration = ObjectMonitor::Knob_SpinLimit ;       // consider: keep metastats by type/class
+      m->OwnerIsThread = 1;
+      m->_recursions   = 0;
+      m->_Responsible  = NULL;
+      m->_SpinDuration = ObjectMonitor::Knob_SpinLimit;       // consider: keep metastats by type/class
 
       if (Atomic::cmpxchg_ptr (markOopDesc::encode(m), object->mark_addr(), mark) != mark) {
-          m->set_object (NULL) ;
-          m->set_owner  (NULL) ;
-          m->OwnerIsThread = 0 ;
-          m->Recycle() ;
-          omRelease (Self, m, true) ;
-          m = NULL ;
-          continue ;
+          m->set_object(NULL);
+          m->set_owner(NULL);
+          m->OwnerIsThread = 0;
+          m->Recycle();
+          omRelease(Self, m, true);
+          m = NULL;
+          continue;
           // interference - the markword changed - just retry.
           // The state-transitions are one-way, so there's no chance of
           // live-lock -- "Inflated" is an absorbing state.
@@ -1341,8 +1341,8 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
 
       // Hopefully the performance counters are allocated on distinct
       // cache lines to avoid false sharing on MP systems ...
-      if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc() ;
-      TEVENT(Inflate: overwrite neutral) ;
+      if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
+      TEVENT(Inflate: overwrite neutral);
       if (TraceMonitorInflation) {
         if (object->is_instance()) {
           ResourceMark rm;
@@ -1351,7 +1351,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
             object->klass()->external_name());
         }
       }
-      return m ;
+      return m;
   }
 }
 
@@ -1391,7 +1391,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
 enum ManifestConstants {
     ClearResponsibleAtSTW   = 0,
     MaximumRecheckInterval  = 1000
-} ;
+};
 
 // Deflate a single monitor if not in use
 // Return true if deflated, false if in use
@@ -1399,18 +1399,18 @@ bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj,
                                          ObjectMonitor** FreeHeadp, ObjectMonitor** FreeTailp) {
   bool deflated;
   // Normal case ... The monitor is associated with obj.
-  guarantee (obj->mark() == markOopDesc::encode(mid), "invariant") ;
-  guarantee (mid == obj->mark()->monitor(), "invariant");
-  guarantee (mid->header()->is_neutral(), "invariant");
+  guarantee(obj->mark() == markOopDesc::encode(mid), "invariant");
+  guarantee(mid == obj->mark()->monitor(), "invariant");
+  guarantee(mid->header()->is_neutral(), "invariant");
 
   if (mid->is_busy()) {
-     if (ClearResponsibleAtSTW) mid->_Responsible = NULL ;
+     if (ClearResponsibleAtSTW) mid->_Responsible = NULL;
      deflated = false;
   } else {
      // Deflate the monitor if it is no longer being used
      // It's idle - scavenge and return to the global free list
      // plain old deflation ...
-     TEVENT (deflate_idle_monitors - scavenge1) ;
+     TEVENT(deflate_idle_monitors - scavenge1);
      if (TraceMonitorInflation) {
        if (obj->is_instance()) {
          ResourceMark rm;
@@ -1423,7 +1423,7 @@ bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj,
      obj->release_set_mark(mid->header());
      mid->clear();
 
-     assert (mid->object() == NULL, "invariant") ;
+     assert(mid->object() == NULL, "invariant");
 
      // Move the object to the working free list defined by FreeHead,FreeTail.
      if (*FreeHeadp == NULL) *FreeHeadp = mid;
@@ -1446,7 +1446,7 @@ int ObjectSynchronizer::walk_monitor_list(ObjectMonitor** listheadp,
   ObjectMonitor* curmidinuse = NULL;
   int deflatedcount = 0;
 
-  for (mid = *listheadp; mid != NULL; ) {
+  for (mid = *listheadp; mid != NULL;) {
      oop obj = (oop) mid->object();
      bool deflated = false;
      if (obj != NULL) {
@@ -1473,19 +1473,19 @@ int ObjectSynchronizer::walk_monitor_list(ObjectMonitor** listheadp,
 
 void ObjectSynchronizer::deflate_idle_monitors() {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  int nInuse = 0 ;              // currently associated with objects
-  int nInCirculation = 0 ;      // extant
-  int nScavenged = 0 ;          // reclaimed
+  int nInuse = 0;              // currently associated with objects
+  int nInCirculation = 0;      // extant
+  int nScavenged = 0;          // reclaimed
   bool deflated = false;
 
-  ObjectMonitor * FreeHead = NULL ;  // Local SLL of scavenged monitors
-  ObjectMonitor * FreeTail = NULL ;
+  ObjectMonitor * FreeHead = NULL;  // Local SLL of scavenged monitors
+  ObjectMonitor * FreeTail = NULL;
 
-  TEVENT (deflate_idle_monitors) ;
+  TEVENT(deflate_idle_monitors);
   // Prevent omFlush from changing mids in Thread dtor's during deflation
   // And in case the vm thread is acquiring a lock during a safepoint
   // See e.g. 6320749
-  Thread::muxAcquire (&ListLock, "scavenge - return") ;
+  Thread::muxAcquire(&ListLock, "scavenge - return");
 
   if (MonitorInUseLists) {
     int inUse = 0;
@@ -1510,8 +1510,8 @@ void ObjectSynchronizer::deflate_idle_monitors() {
   } else for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) {
   // Iterate over all extant monitors - Scavenge all idle monitors.
     assert(block->object() == CHAINMARKER, "must be a block header");
-    nInCirculation += _BLOCKSIZE ;
-    for (int i = 1 ; i < _BLOCKSIZE; i++) {
+    nInCirculation += _BLOCKSIZE;
+    for (int i = 1; i < _BLOCKSIZE; i++) {
       ObjectMonitor* mid = &block[i];
       oop obj = (oop) mid->object();
 
@@ -1520,16 +1520,16 @@ void ObjectSynchronizer::deflate_idle_monitors() {
         // The monitor should either be a thread-specific private
         // free list or the global free list.
         // obj == NULL IMPLIES mid->is_busy() == 0
-        guarantee (!mid->is_busy(), "invariant") ;
-        continue ;
+        guarantee(!mid->is_busy(), "invariant");
+        continue;
       }
       deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail);
 
       if (deflated) {
-        mid->FreeNext = NULL ;
-        nScavenged ++ ;
+        mid->FreeNext = NULL;
+        nScavenged++;
       } else {
-        nInuse ++;
+        nInuse++;
       }
     }
   }
@@ -1539,31 +1539,31 @@ void ObjectSynchronizer::deflate_idle_monitors() {
   // Consider: audit gFreeList to ensure that MonitorFreeCount and list agree.
 
   if (ObjectMonitor::Knob_Verbose) {
-    ::printf ("Deflate: InCirc=%d InUse=%d Scavenged=%d ForceMonitorScavenge=%d : pop=%d free=%d\n",
+    ::printf("Deflate: InCirc=%d InUse=%d Scavenged=%d ForceMonitorScavenge=%d : pop=%d free=%d\n",
         nInCirculation, nInuse, nScavenged, ForceMonitorScavenge,
-        MonitorPopulation, MonitorFreeCount) ;
-    ::fflush(stdout) ;
+        MonitorPopulation, MonitorFreeCount);
+    ::fflush(stdout);
   }
 
   ForceMonitorScavenge = 0;    // Reset
 
   // Move the scavenged monitors back to the global free list.
   if (FreeHead != NULL) {
-     guarantee (FreeTail != NULL && nScavenged > 0, "invariant") ;
-     assert (FreeTail->FreeNext == NULL, "invariant") ;
+     guarantee(FreeTail != NULL && nScavenged > 0, "invariant");
+     assert(FreeTail->FreeNext == NULL, "invariant");
      // constant-time list splice - prepend scavenged segment to gFreeList
-     FreeTail->FreeNext = gFreeList ;
-     gFreeList = FreeHead ;
+     FreeTail->FreeNext = gFreeList;
+     gFreeList = FreeHead;
   }
-  Thread::muxRelease (&ListLock) ;
+  Thread::muxRelease(&ListLock);
 
-  if (ObjectMonitor::_sync_Deflations != NULL) ObjectMonitor::_sync_Deflations->inc(nScavenged) ;
+  if (ObjectMonitor::_sync_Deflations != NULL) ObjectMonitor::_sync_Deflations->inc(nScavenged);
   if (ObjectMonitor::_sync_MonExtant  != NULL) ObjectMonitor::_sync_MonExtant ->set_value(nInCirculation);
 
   // TODO: Add objectMonitor leak detection.
   // Audit/inventory the objectMonitors -- make sure they're all accounted for.
-  GVars.stwRandom = os::random() ;
-  GVars.stwCycle ++ ;
+  GVars.stwRandom = os::random();
+  GVars.stwCycle++;
 }
 
 // Monitor cleanup on JavaThread::exit
@@ -1601,7 +1601,7 @@ public:
 
 void ObjectSynchronizer::release_monitors_owned_by_thread(TRAPS) {
   assert(THREAD == JavaThread::current(), "must be current Java thread");
-  No_Safepoint_Verifier nsv ;
+  No_Safepoint_Verifier nsv;
   ReleaseJavaMonitorsClosure rjmc(THREAD);
   Thread::muxAcquire(&ListLock, "release_monitors_owned_by_thread");
   ObjectSynchronizer::monitors_iterate(&rjmc);
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index e3ab1725a1d..baca4a1bea7 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -225,11 +225,11 @@ Thread::Thread() {
   _current_pending_monitor_is_from_java = true;
   _current_waiting_monitor = NULL;
   _num_nested_signal = 0;
-  omFreeList = NULL ;
-  omFreeCount = 0 ;
-  omFreeProvision = 32 ;
-  omInUseList = NULL ;
-  omInUseCount = 0 ;
+  omFreeList = NULL;
+  omFreeCount = 0;
+  omFreeProvision = 32;
+  omInUseList = NULL;
+  omInUseCount = 0;
 
 #ifdef ASSERT
   _visited_for_critical_count = false;
@@ -239,15 +239,15 @@ Thread::Thread() {
   _suspend_flags = 0;
 
   // thread-specific hashCode stream generator state - Marsaglia shift-xor form
-  _hashStateX = os::random() ;
-  _hashStateY = 842502087 ;
-  _hashStateZ = 0x8767 ;    // (int)(3579807591LL & 0xffff) ;
-  _hashStateW = 273326509 ;
+  _hashStateX = os::random();
+  _hashStateY = 842502087;
+  _hashStateZ = 0x8767;    // (int)(3579807591LL & 0xffff) ;
+  _hashStateW = 273326509;
 
-  _OnTrap   = 0 ;
-  _schedctl = NULL ;
-  _Stalled  = 0 ;
-  _TypeTag  = 0x2BAD ;
+  _OnTrap   = 0;
+  _schedctl = NULL;
+  _Stalled  = 0;
+  _TypeTag  = 0x2BAD;
 
   // Many of the following fields are effectively final - immutable
   // Note that nascent threads can't use the Native Monitor-Mutex
@@ -256,10 +256,10 @@ Thread::Thread() {
   // we might instead use a stack of ParkEvents that we could provision on-demand.
   // The stack would act as a cache to avoid calls to ParkEvent::Allocate()
   // and ::Release()
-  _ParkEvent   = ParkEvent::Allocate (this) ;
-  _SleepEvent  = ParkEvent::Allocate (this) ;
-  _MutexEvent  = ParkEvent::Allocate (this) ;
-  _MuxEvent    = ParkEvent::Allocate (this) ;
+  _ParkEvent   = ParkEvent::Allocate(this);
+  _SleepEvent  = ParkEvent::Allocate(this);
+  _MutexEvent  = ParkEvent::Allocate(this);
+  _MuxEvent    = ParkEvent::Allocate(this);
 
 #ifdef CHECK_UNHANDLED_OOPS
   if (CheckUnhandledOops) {
@@ -314,7 +314,7 @@ void Thread::record_stack_base_and_size() {
 
 Thread::~Thread() {
   // Reclaim the objectmonitors from the omFreeList of the moribund thread.
-  ObjectSynchronizer::omFlush (this) ;
+  ObjectSynchronizer::omFlush(this);
 
   EVENT_THREAD_DESTRUCT(this);
 
@@ -342,10 +342,10 @@ Thread::~Thread() {
 
   // It's possible we can encounter a null _ParkEvent, etc., in stillborn threads.
   // We NULL out the fields for good hygiene.
-  ParkEvent::Release (_ParkEvent)   ; _ParkEvent   = NULL ;
-  ParkEvent::Release (_SleepEvent)  ; _SleepEvent  = NULL ;
-  ParkEvent::Release (_MutexEvent)  ; _MutexEvent  = NULL ;
-  ParkEvent::Release (_MuxEvent)    ; _MuxEvent    = NULL ;
+  ParkEvent::Release(_ParkEvent); _ParkEvent   = NULL;
+  ParkEvent::Release(_SleepEvent); _SleepEvent  = NULL;
+  ParkEvent::Release(_MutexEvent); _MutexEvent  = NULL;
+  ParkEvent::Release(_MuxEvent); _MuxEvent    = NULL;
 
   delete handle_area();
   delete metadata_handles();
@@ -844,7 +844,7 @@ void Thread::print_on(outputStream* st) const {
 // Thread::print_on_error() is called by fatal error handler. Don't use
 // any lock or allocate memory.
 void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
-  if      (is_VM_thread())                  st->print("VMThread");
+  if (is_VM_thread())                  st->print("VMThread");
   else if (is_Compiler_thread())            st->print("CompilerThread");
   else if (is_Java_thread())                st->print("JavaThread");
   else if (is_GC_task_thread())             st->print("GCTaskThread");
@@ -867,7 +867,7 @@ void Thread::print_owned_locks_on(outputStream* st) const {
     st->print(" (no locks) ");
   } else {
     st->print_cr(" Locks owned:");
-    while(cur) {
+    while (cur) {
       cur->print_on(st);
       cur = cur->next();
     }
@@ -877,7 +877,7 @@ void Thread::print_owned_locks_on(outputStream* st) const {
 static int ref_use_count  = 0;
 
 bool Thread::owns_locks_but_compiled_lock() const {
-  for(Monitor *cur = _owned_locks; cur; cur = cur->next()) {
+  for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
     if (cur != Compile_lock) return true;
   }
   return false;
@@ -904,12 +904,12 @@ void Thread::check_for_valid_safepoint_state(bool potential_vm_operation) {
         && !Universe::is_bootstrapping()) {
       // Make sure we do not hold any locks that the VM thread also uses.
       // This could potentially lead to deadlocks
-      for(Monitor *cur = _owned_locks; cur; cur = cur->next()) {
+      for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
         // Threads_lock is special, since the safepoint synchronization will not start before this is
         // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock,
         // since it is used to transfer control between JavaThreads and the VMThread
         // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first!
-        if ( (cur->allow_vm_block() &&
+        if ((cur->allow_vm_block() &&
               cur != Threads_lock &&
               cur != Compile_lock &&               // Temporary: should not be necessary when we get separate compilation
               cur != VMOperationRequest_lock &&
@@ -1291,9 +1291,9 @@ void WatcherThread::run() {
   this->record_stack_base_and_size();
   this->initialize_thread_local_storage();
   this->set_active_handles(JNIHandleBlock::allocate_block());
-  while(!_should_terminate) {
-    assert(watcher_thread() == Thread::current(),  "thread consistency check");
-    assert(watcher_thread() == this,  "thread consistency check");
+  while (!_should_terminate) {
+    assert(watcher_thread() == Thread::current(), "thread consistency check");
+    assert(watcher_thread() == this, "thread consistency check");
 
     // Calculate how long it'll be until the next PeriodicTask work
     // should be done, and sleep that amount of time.
@@ -1370,7 +1370,7 @@ void WatcherThread::stop() {
   // it is ok to take late safepoints here, if needed
   MutexLocker mu(Terminator_lock);
 
-  while(watcher_thread() != NULL) {
+  while (watcher_thread() != NULL) {
     // This wait should make safepoint checks, wait without a timeout,
     // and wait as a suspend-equivalent condition.
     //
@@ -1451,11 +1451,11 @@ void JavaThread::initialize() {
   _pending_jni_exception_check_fn = NULL;
   _do_not_unlock_if_synchronized = false;
   _cached_monitor_info = NULL;
-  _parker = Parker::Allocate(this) ;
+  _parker = Parker::Allocate(this);
 
 #ifndef PRODUCT
   _jmp_ring_index = 0;
-  for (int ji = 0 ; ji < jump_ring_buffer_size ; ji++ ) {
+  for (int ji = 0; ji < jump_ring_buffer_size; ji++) {
     record_jump(NULL, NULL, NULL, 0);
   }
 #endif /* PRODUCT */
@@ -1592,7 +1592,7 @@ JavaThread::~JavaThread() {
 
   // JSR166 -- return the parker to the free list
   Parker::Release(_parker);
-  _parker = NULL ;
+  _parker = NULL;
 
   // Free any remaining  previous UnrollBlock
   vframeArray* old_array = vframe_array_last();
@@ -1718,7 +1718,7 @@ static void ensure_join(JavaThread* thread) {
 // For any new cleanup additions, please check to see if they need to be applied to
 // cleanup_failed_attach_current_thread as well.
 void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
-  assert(this == JavaThread::current(),  "thread consistency check");
+  assert(this == JavaThread::current(), "thread consistency check");
 
   HandleMark hm(this);
   Handle uncaught_exception(this, this->pending_exception());
@@ -2058,7 +2058,7 @@ void JavaThread::check_and_handle_async_exceptions(bool check_unsafe_error) {
       if (TraceExceptions) {
         ResourceMark rm;
         tty->print("Async. exception installed at runtime exit (" INTPTR_FORMAT ")", this);
-        if (has_last_Java_frame() ) {
+        if (has_last_Java_frame()) {
           frame f = last_frame();
           tty->print(" (pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " )", f.pc(), f.sp());
         }
@@ -2302,11 +2302,11 @@ int JavaThread::java_suspend_self() {
 void JavaThread::verify_not_published() {
   if (!Threads_lock->owned_by_self()) {
    MutexLockerEx ml(Threads_lock,  Mutex::_no_safepoint_check_flag);
-   assert( !Threads::includes(this),
+   assert(!Threads::includes(this),
            "java thread shouldn't have been published yet!");
   }
   else {
-   assert( !Threads::includes(this),
+   assert(!Threads::includes(this),
            "java thread shouldn't have been published yet!");
   }
 }
@@ -2375,7 +2375,7 @@ void JavaThread::check_safepoint_and_suspend_for_native_trans(JavaThread *thread
     thread->clear_deopt_suspend();
     RegisterMap map(thread, false);
     frame f = thread->last_frame();
-    while ( f.id() != thread->must_deopt_id() && ! f.is_first_frame()) {
+    while (f.id() != thread->must_deopt_id() && ! f.is_first_frame()) {
       f = f.sender(&map);
     }
     if (f.id() == thread->must_deopt_id()) {
@@ -2499,8 +2499,8 @@ void JavaThread::enable_stack_yellow_zone() {
   // We need to adjust it to work correctly with guard_memory()
   address base = stack_yellow_zone_base() - stack_yellow_zone_size();
 
-  guarantee(base < stack_base(),"Error calculating stack yellow zone");
-  guarantee(base < os::current_stack_pointer(),"Error calculating stack yellow zone");
+  guarantee(base < stack_base(), "Error calculating stack yellow zone");
+  guarantee(base < os::current_stack_pointer(), "Error calculating stack yellow zone");
 
   if (os::guard_memory((char *) base, stack_yellow_zone_size())) {
     _stack_guard_state = stack_guard_enabled;
@@ -2535,10 +2535,10 @@ void JavaThread::enable_stack_red_zone() {
   assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
   address base = stack_red_zone_base() - stack_red_zone_size();
 
-  guarantee(base < stack_base(),"Error calculating stack red zone");
-  guarantee(base < os::current_stack_pointer(),"Error calculating stack red zone");
+  guarantee(base < stack_base(), "Error calculating stack red zone");
+  guarantee(base < os::current_stack_pointer(), "Error calculating stack red zone");
 
-  if(!os::guard_memory((char *) base, stack_red_zone_size())) {
+  if (!os::guard_memory((char *) base, stack_red_zone_size())) {
     warning("Attempt to guard stack red zone failed.");
   }
 }
@@ -2557,7 +2557,7 @@ void JavaThread::frames_do(void f(frame*, const RegisterMap* map)) {
   // ignore is there is no stack
   if (!has_last_Java_frame()) return;
   // traverse the stack frames. Starts from top frame.
-  for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
     frame* fr = fst.current();
     f(fr, fst.register_map());
   }
@@ -2573,8 +2573,8 @@ void JavaThread::deoptimize() {
   bool deopt = false;           // Dump stack only if a deopt actually happens.
   bool only_at = strlen(DeoptimizeOnlyAt) > 0;
   // Iterate over all frames in the thread and deoptimize
-  for(; !fst.is_done(); fst.next()) {
-    if(fst.current()->can_be_deoptimized()) {
+  for (; !fst.is_done(); fst.next()) {
+    if (fst.current()->can_be_deoptimized()) {
 
       if (only_at) {
         // Deoptimize only at particular bcis.  DeoptimizeOnlyAt
@@ -2619,7 +2619,7 @@ void JavaThread::deoptimize() {
 
 // Make zombies
 void JavaThread::make_zombies() {
-  for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
     if (fst.current()->can_be_deoptimized()) {
       // it is a Java nmethod
       nmethod* nm = CodeCache::find_nmethod(fst.current()->pc());
@@ -2634,7 +2634,7 @@ void JavaThread::deoptimized_wrt_marked_nmethods() {
   if (!has_last_Java_frame()) return;
   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
   StackFrameStream fst(this, UseBiasedLocking);
-  for(; !fst.is_done(); fst.next()) {
+  for (; !fst.is_done(); fst.next()) {
     if (fst.current()->should_be_deoptimized()) {
       if (LogCompilation && xtty != NULL) {
         nmethod* nm = fst.current()->cb()->as_nmethod_or_null();
@@ -2694,7 +2694,7 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf)
   // Traverse the GCHandles
   Thread::oops_do(f, cld_f, cf);
 
-  assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
+  assert((!has_last_Java_frame() && java_call_counter() == 0) ||
           (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
 
   if (has_last_Java_frame()) {
@@ -2719,7 +2719,7 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf)
     }
 
     // Traverse the execution stack
-    for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+    for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
       fst.current()->oops_do(f, cld_f, cf, fst.register_map());
     }
   }
@@ -2754,12 +2754,12 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf)
 void JavaThread::nmethods_do(CodeBlobClosure* cf) {
   Thread::nmethods_do(cf);  // (super method is a no-op)
 
-  assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
+  assert((!has_last_Java_frame() && java_call_counter() == 0) ||
           (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
 
   if (has_last_Java_frame()) {
     // Traverse the execution stack
-    for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+    for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
       fst.current()->nmethods_do(cf);
     }
   }
@@ -2769,7 +2769,7 @@ void JavaThread::metadata_do(void f(Metadata*)) {
   Thread::metadata_do(f);
   if (has_last_Java_frame()) {
     // Traverse the execution stack to call f() on the methods in the stack
-    for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+    for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
       fst.current()->metadata_do(f);
     }
   } else if (is_Compiler_thread()) {
@@ -2832,7 +2832,7 @@ void JavaThread::print_on(outputStream *st) const {
 // Called by fatal error handler. The difference between this and
 // JavaThread::print() is that we can't grab lock or allocate memory.
 void JavaThread::print_on_error(outputStream* st, char *buf, int buflen) const {
-  st->print("JavaThread \"%s\"",  get_thread_name_string(buf, buflen));
+  st->print("JavaThread \"%s\"", get_thread_name_string(buf, buflen));
   oop thread_obj = threadObj();
   if (thread_obj != NULL) {
      if (java_lang_Thread::is_daemon(thread_obj)) st->print(" daemon");
@@ -3015,7 +3015,7 @@ void JavaThread::print_stack_on(outputStream* st) {
   RegisterMap reg_map(this);
   vframe* start_vf = last_java_vframe(&reg_map);
   int count = 0;
-  for (vframe* f = start_vf; f; f = f->sender() ) {
+  for (vframe* f = start_vf; f; f = f->sender()) {
     if (f->is_java_frame()) {
       javaVFrame* jvf = javaVFrame::cast(f);
       java_lang_Throwable::print_stack_element(st, jvf->method(), jvf->bci());
@@ -3071,9 +3071,9 @@ void JavaThread::popframe_free_preserved_args() {
 void JavaThread::trace_frames() {
   tty->print_cr("[Describe stack]");
   int frame_no = 1;
-  for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
     tty->print("  %d. ", frame_no++);
-    fst.current()->print_value_on(tty,this);
+    fst.current()->print_value_on(tty, this);
     tty->cr();
   }
 }
@@ -3124,7 +3124,7 @@ void JavaThread::print_frame_layout(int depth, bool validate_only) {
   PRESERVE_EXCEPTION_MARK;
   FrameValues values;
   int frame_no = 0;
-  for(StackFrameStream fst(this, false); !fst.is_done(); fst.next()) {
+  for (StackFrameStream fst(this, false); !fst.is_done(); fst.next()) {
     fst.current()->describe(values, ++frame_no);
     if (depth == frame_no) break;
   }
@@ -3140,7 +3140,7 @@ void JavaThread::print_frame_layout(int depth, bool validate_only) {
 void JavaThread::trace_stack_from(vframe* start_vf) {
   ResourceMark rm;
   int vframe_no = 1;
-  for (vframe* f = start_vf; f; f = f->sender() ) {
+  for (vframe* f = start_vf; f; f = f->sender()) {
     if (f->is_java_frame()) {
       javaVFrame::cast(f)->print_activation(vframe_no++);
     } else {
@@ -3169,7 +3169,7 @@ void JavaThread::trace_stack() {
 javaVFrame* JavaThread::last_java_vframe(RegisterMap *reg_map) {
   assert(reg_map != NULL, "a map must be given");
   frame f = last_frame();
-  for (vframe* vf = vframe::new_vframe(&f, reg_map, this); vf; vf = vf->sender() ) {
+  for (vframe* vf = vframe::new_vframe(&f, reg_map, this); vf; vf = vf->sender()) {
     if (vf->is_java_frame()) return javaVFrame::cast(vf);
   }
   return NULL;
@@ -3291,7 +3291,7 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
 
   // The VM preresolves methods to these classes. Make sure that they get initialized
   initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK);
-  initialize_class(vmSymbols::java_lang_ref_Finalizer(),  CHECK);
+  initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK);
   call_initializeSystemClass(CHECK);
 
   // get the Java runtime name after java.lang.System is initialized
@@ -3425,7 +3425,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
   main_thread->create_stack_guard_pages();
 
   // Initialize Java-Level synchronization subsystem
-  ObjectMonitor::Initialize() ;
+  ObjectMonitor::Initialize();
 
   // Second phase of bootstrapping, VM is about entering multi-thread mode
   MemTracker::bootstrap_multi_thread();
@@ -3473,7 +3473,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
     }
   }
 
-  assert (Universe::is_fully_initialized(), "not initialized");
+  assert(Universe::is_fully_initialized(), "not initialized");
   if (VerifyDuringStartup) {
     // Make sure we're starting with a clean slate.
     VM_Verify verify_op;
@@ -3899,7 +3899,7 @@ bool Threads::destroy_vm() {
 #endif
   // Wait until we are the last non-daemon thread to execute
   { MutexLocker nu(Threads_lock);
-    while (Threads::number_of_non_daemon_threads() > 1 )
+    while (Threads::number_of_non_daemon_threads() > 1)
       // This wait should make safepoint checks, wait without a timeout,
       // and wait as a suspend-equivalent condition.
       //
@@ -4078,7 +4078,7 @@ void Threads::remove(JavaThread* p) {
 bool Threads::includes(JavaThread* p) {
   assert(Threads_lock->is_locked(), "sanity check");
   ALL_JAVA_THREADS(q) {
-    if (q == p ) {
+    if (q == p) {
       return true;
     }
   }
@@ -4363,43 +4363,43 @@ void Threads::print_on_error(outputStream* st, Thread* current, char* buf, int b
 // cache-coherency traffic.
 
 
-typedef volatile int SpinLockT ;
+typedef volatile int SpinLockT;
 
 void Thread::SpinAcquire (volatile int * adr, const char * LockName) {
   if (Atomic::cmpxchg (1, adr, 0) == 0) {
-     return ;   // normal fast-path return
+     return;   // normal fast-path return
   }
 
   // Slow-path : We've encountered contention -- Spin/Yield/Block strategy.
-  TEVENT (SpinAcquire - ctx) ;
-  int ctr = 0 ;
-  int Yields = 0 ;
+  TEVENT(SpinAcquire - ctx);
+  int ctr = 0;
+  int Yields = 0;
   for (;;) {
      while (*adr != 0) {
-        ++ctr ;
+        ++ctr;
         if ((ctr & 0xFFF) == 0 || !os::is_MP()) {
            if (Yields > 5) {
              os::naked_short_sleep(1);
            } else {
-             os::NakedYield() ;
-             ++Yields ;
+             os::NakedYield();
+             ++Yields;
            }
         } else {
-           SpinPause() ;
+           SpinPause();
         }
      }
-     if (Atomic::cmpxchg (1, adr, 0) == 0) return ;
+     if (Atomic::cmpxchg(1, adr, 0) == 0) return;
   }
 }
 
 void Thread::SpinRelease (volatile int * adr) {
-  assert (*adr != 0, "invariant") ;
-  OrderAccess::fence() ;      // guarantee at least release consistency.
+  assert(*adr != 0, "invariant");
+  OrderAccess::fence();      // guarantee at least release consistency.
   // Roach-motel semantics.
   // It's safe if subsequent LDs and STs float "up" into the critical section,
   // but prior LDs and STs within the critical section can't be allowed
   // to reorder or float past the ST that releases the lock.
-  *adr = 0 ;
+  *adr = 0;
 }
 
 // muxAcquire and muxRelease:
@@ -4452,111 +4452,111 @@ void Thread::SpinRelease (volatile int * adr) {
 //
 
 
-typedef volatile intptr_t MutexT ;      // Mux Lock-word
-enum MuxBits { LOCKBIT = 1 } ;
+typedef volatile intptr_t MutexT;      // Mux Lock-word
+enum MuxBits { LOCKBIT = 1 };
 
 void Thread::muxAcquire (volatile intptr_t * Lock, const char * LockName) {
-  intptr_t w = Atomic::cmpxchg_ptr (LOCKBIT, Lock, 0) ;
-  if (w == 0) return ;
+  intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0);
+  if (w == 0) return;
   if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-     return ;
+     return;
   }
 
-  TEVENT (muxAcquire - Contention) ;
-  ParkEvent * const Self = Thread::current()->_MuxEvent ;
-  assert ((intptr_t(Self) & LOCKBIT) == 0, "invariant") ;
+  TEVENT(muxAcquire - Contention);
+  ParkEvent * const Self = Thread::current()->_MuxEvent;
+  assert((intptr_t(Self) & LOCKBIT) == 0, "invariant");
   for (;;) {
-     int its = (os::is_MP() ? 100 : 0) + 1 ;
+     int its = (os::is_MP() ? 100 : 0) + 1;
 
      // Optional spin phase: spin-then-park strategy
      while (--its >= 0) {
-       w = *Lock ;
+       w = *Lock;
        if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-          return ;
+          return;
        }
      }
 
-     Self->reset() ;
-     Self->OnList = intptr_t(Lock) ;
+     Self->reset();
+     Self->OnList = intptr_t(Lock);
      // The following fence() isn't _strictly necessary as the subsequent
      // CAS() both serializes execution and ratifies the fetched *Lock value.
      OrderAccess::fence();
      for (;;) {
-        w = *Lock ;
+        w = *Lock;
         if ((w & LOCKBIT) == 0) {
             if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-                Self->OnList = 0 ;   // hygiene - allows stronger asserts
-                return ;
+                Self->OnList = 0;   // hygiene - allows stronger asserts
+                return;
             }
-            continue ;      // Interference -- *Lock changed -- Just retry
+            continue;      // Interference -- *Lock changed -- Just retry
         }
-        assert (w & LOCKBIT, "invariant") ;
-        Self->ListNext = (ParkEvent *) (w & ~LOCKBIT );
-        if (Atomic::cmpxchg_ptr (intptr_t(Self)|LOCKBIT, Lock, w) == w) break ;
+        assert(w & LOCKBIT, "invariant");
+        Self->ListNext = (ParkEvent *) (w & ~LOCKBIT);
+        if (Atomic::cmpxchg_ptr(intptr_t(Self)|LOCKBIT, Lock, w) == w) break;
      }
 
      while (Self->OnList != 0) {
-        Self->park() ;
+        Self->park();
      }
   }
 }
 
 void Thread::muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) {
-  intptr_t w = Atomic::cmpxchg_ptr (LOCKBIT, Lock, 0) ;
-  if (w == 0) return ;
+  intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0);
+  if (w == 0) return;
   if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-    return ;
+    return;
   }
 
-  TEVENT (muxAcquire - Contention) ;
-  ParkEvent * ReleaseAfter = NULL ;
+  TEVENT(muxAcquire - Contention);
+  ParkEvent * ReleaseAfter = NULL;
   if (ev == NULL) {
-    ev = ReleaseAfter = ParkEvent::Allocate (NULL) ;
+    ev = ReleaseAfter = ParkEvent::Allocate(NULL);
   }
-  assert ((intptr_t(ev) & LOCKBIT) == 0, "invariant") ;
+  assert((intptr_t(ev) & LOCKBIT) == 0, "invariant");
   for (;;) {
-    guarantee (ev->OnList == 0, "invariant") ;
-    int its = (os::is_MP() ? 100 : 0) + 1 ;
+    guarantee(ev->OnList == 0, "invariant");
+    int its = (os::is_MP() ? 100 : 0) + 1;
 
     // Optional spin phase: spin-then-park strategy
     while (--its >= 0) {
-      w = *Lock ;
+      w = *Lock;
       if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
         if (ReleaseAfter != NULL) {
-          ParkEvent::Release (ReleaseAfter) ;
+          ParkEvent::Release(ReleaseAfter);
         }
-        return ;
+        return;
       }
     }
 
-    ev->reset() ;
-    ev->OnList = intptr_t(Lock) ;
+    ev->reset();
+    ev->OnList = intptr_t(Lock);
     // The following fence() isn't _strictly necessary as the subsequent
     // CAS() both serializes execution and ratifies the fetched *Lock value.
     OrderAccess::fence();
     for (;;) {
-      w = *Lock ;
+      w = *Lock;
       if ((w & LOCKBIT) == 0) {
         if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
-          ev->OnList = 0 ;
+          ev->OnList = 0;
           // We call ::Release while holding the outer lock, thus
           // artificially lengthening the critical section.
           // Consider deferring the ::Release() until the subsequent unlock(),
           // after we've dropped the outer lock.
           if (ReleaseAfter != NULL) {
-            ParkEvent::Release (ReleaseAfter) ;
+            ParkEvent::Release(ReleaseAfter);
           }
-          return ;
+          return;
         }
-        continue ;      // Interference -- *Lock changed -- Just retry
+        continue;      // Interference -- *Lock changed -- Just retry
       }
-      assert (w & LOCKBIT, "invariant") ;
-      ev->ListNext = (ParkEvent *) (w & ~LOCKBIT );
-      if (Atomic::cmpxchg_ptr (intptr_t(ev)|LOCKBIT, Lock, w) == w) break ;
+      assert(w & LOCKBIT, "invariant");
+      ev->ListNext = (ParkEvent *) (w & ~LOCKBIT);
+      if (Atomic::cmpxchg_ptr(intptr_t(ev)|LOCKBIT, Lock, w) == w) break;
     }
 
     while (ev->OnList != 0) {
-      ev->park() ;
+      ev->park();
     }
   }
 }
@@ -4583,22 +4583,22 @@ void Thread::muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) {
 
 void Thread::muxRelease (volatile intptr_t * Lock)  {
   for (;;) {
-    const intptr_t w = Atomic::cmpxchg_ptr (0, Lock, LOCKBIT) ;
-    assert (w & LOCKBIT, "invariant") ;
-    if (w == LOCKBIT) return ;
-    ParkEvent * List = (ParkEvent *) (w & ~LOCKBIT) ;
-    assert (List != NULL, "invariant") ;
-    assert (List->OnList == intptr_t(Lock), "invariant") ;
-    ParkEvent * nxt = List->ListNext ;
+    const intptr_t w = Atomic::cmpxchg_ptr(0, Lock, LOCKBIT);
+    assert(w & LOCKBIT, "invariant");
+    if (w == LOCKBIT) return;
+    ParkEvent * List = (ParkEvent *)(w & ~LOCKBIT);
+    assert(List != NULL, "invariant");
+    assert(List->OnList == intptr_t(Lock), "invariant");
+    ParkEvent * nxt = List->ListNext;
 
     // The following CAS() releases the lock and pops the head element.
     if (Atomic::cmpxchg_ptr (intptr_t(nxt), Lock, w) != w) {
-      continue ;
+      continue;
     }
-    List->OnList = 0 ;
-    OrderAccess::fence() ;
-    List->unpark () ;
-    return ;
+    List->OnList = 0;
+    OrderAccess::fence();
+    List->unpark();
+    return;
   }
 }
 
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index 64bed4610b0..68c9248dea4 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -244,7 +244,7 @@ class Thread: public ThreadShadow {
   // The two classes No_Safepoint_Verifier and No_Allocation_Verifier are used to set these counters.
   //
   NOT_PRODUCT(int _allow_safepoint_count;)      // If 0, thread allow a safepoint to happen
-  debug_only (int _allow_allocation_count;)     // If 0, the thread is allowed to allocate oops.
+  debug_only(int _allow_allocation_count;)     // If 0, the thread is allowed to allocate oops.
 
   // Used by SkipGCALot class.
   NOT_PRODUCT(bool _skip_gcalot;)               // Should we elide gc-a-lot?
@@ -593,12 +593,12 @@ public:
   bool is_inside_jvmti_env_iteration()           { return _jvmti_env_iteration_count > 0; }
 
   // Code generation
-  static ByteSize exception_file_offset()        { return byte_offset_of(Thread, _exception_file   ); }
-  static ByteSize exception_line_offset()        { return byte_offset_of(Thread, _exception_line   ); }
-  static ByteSize active_handles_offset()        { return byte_offset_of(Thread, _active_handles   ); }
+  static ByteSize exception_file_offset()        { return byte_offset_of(Thread, _exception_file); }
+  static ByteSize exception_line_offset()        { return byte_offset_of(Thread, _exception_line); }
+  static ByteSize active_handles_offset()        { return byte_offset_of(Thread, _active_handles); }
 
-  static ByteSize stack_base_offset()            { return byte_offset_of(Thread, _stack_base ); }
-  static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size ); }
+  static ByteSize stack_base_offset()            { return byte_offset_of(Thread, _stack_base); }
+  static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size); }
 
 #define TLAB_FIELD_OFFSET(name) \
   static ByteSize tlab_##name##_offset()         { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); }
@@ -615,35 +615,35 @@ public:
 
 #undef TLAB_FIELD_OFFSET
 
-  static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes ); }
+  static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes); }
 
  public:
-  volatile intptr_t _Stalled ;
-  volatile int _TypeTag ;
-  ParkEvent * _ParkEvent ;                     // for synchronized()
-  ParkEvent * _SleepEvent ;                    // for Thread.sleep
-  ParkEvent * _MutexEvent ;                    // for native internal Mutex/Monitor
-  ParkEvent * _MuxEvent ;                      // for low-level muxAcquire-muxRelease
-  int NativeSyncRecursion ;                    // diagnostic
+  volatile intptr_t _Stalled;
+  volatile int _TypeTag;
+  ParkEvent * _ParkEvent;                     // for synchronized()
+  ParkEvent * _SleepEvent;                    // for Thread.sleep
+  ParkEvent * _MutexEvent;                    // for native internal Mutex/Monitor
+  ParkEvent * _MuxEvent;                      // for low-level muxAcquire-muxRelease
+  int NativeSyncRecursion;                    // diagnostic
 
-  volatile int _OnTrap ;                       // Resume-at IP delta
-  jint _hashStateW ;                           // Marsaglia Shift-XOR thread-local RNG
-  jint _hashStateX ;                           // thread-specific hashCode generator state
-  jint _hashStateY ;
-  jint _hashStateZ ;
-  void * _schedctl ;
+  volatile int _OnTrap;                       // Resume-at IP delta
+  jint _hashStateW;                           // Marsaglia Shift-XOR thread-local RNG
+  jint _hashStateX;                           // thread-specific hashCode generator state
+  jint _hashStateY;
+  jint _hashStateZ;
+  void * _schedctl;
 
 
-  volatile jint rng [4] ;                      // RNG for spin loop
+  volatile jint rng[4];                      // RNG for spin loop
 
   // Low-level leaf-lock primitives used to implement synchronization
   // and native monitor-mutex infrastructure.
   // Not for general synchronization use.
-  static void SpinAcquire (volatile int * Lock, const char * Name) ;
-  static void SpinRelease (volatile int * Lock) ;
-  static void muxAcquire  (volatile intptr_t * Lock, const char * Name) ;
-  static void muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) ;
-  static void muxRelease  (volatile intptr_t * Lock) ;
+  static void SpinAcquire(volatile int * Lock, const char * Name);
+  static void SpinRelease(volatile int * Lock);
+  static void muxAcquire(volatile intptr_t * Lock, const char * Name);
+  static void muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev);
+  static void muxRelease(volatile intptr_t * Lock);
 };
 
 // Inline implementation of Thread::current()
@@ -933,7 +933,7 @@ class JavaThread: public Thread {
       intptr_t _instruction;
       const char*  _file;
       int _line;
-  }   _jmp_ring[ jump_ring_buffer_size ];
+  }   _jmp_ring[jump_ring_buffer_size];
 #endif /* PRODUCT */
 
 #if INCLUDE_ALL_GCS
@@ -1336,34 +1336,34 @@ class JavaThread: public Thread {
 #endif /* PRODUCT */
 
   // For assembly stub generation
-  static ByteSize threadObj_offset()             { return byte_offset_of(JavaThread, _threadObj           ); }
+  static ByteSize threadObj_offset()             { return byte_offset_of(JavaThread, _threadObj); }
 #ifndef PRODUCT
-  static ByteSize jmp_ring_index_offset()        { return byte_offset_of(JavaThread, _jmp_ring_index      ); }
-  static ByteSize jmp_ring_offset()              { return byte_offset_of(JavaThread, _jmp_ring            ); }
+  static ByteSize jmp_ring_index_offset()        { return byte_offset_of(JavaThread, _jmp_ring_index); }
+  static ByteSize jmp_ring_offset()              { return byte_offset_of(JavaThread, _jmp_ring); }
 #endif /* PRODUCT */
-  static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment     ); }
-  static ByteSize last_Java_sp_offset()          {
+  static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment); }
+  static ByteSize last_Java_sp_offset() {
     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
   }
-  static ByteSize last_Java_pc_offset()          {
+  static ByteSize last_Java_pc_offset() {
     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
   }
-  static ByteSize frame_anchor_offset()          {
+  static ByteSize frame_anchor_offset() {
     return byte_offset_of(JavaThread, _anchor);
   }
-  static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target       ); }
-  static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result           ); }
-  static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2         ); }
-  static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state        ); }
-  static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
-  static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
-  static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
-  static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
+  static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target); }
+  static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result); }
+  static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2); }
+  static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state); }
+  static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc); }
+  static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread); }
+  static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop); }
+  static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc); }
   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
   static ByteSize stack_overflow_limit_offset()  { return byte_offset_of(JavaThread, _stack_overflow_limit); }
   static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
-  static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state   ); }
-  static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags       ); }
+  static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state); }
+  static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags); }
 
   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
   static ByteSize should_post_on_exceptions_flag_offset() {
@@ -1422,7 +1422,7 @@ class JavaThread: public Thread {
   void remove_monitor_chunk(MonitorChunk* chunk);
   bool in_deopt_handler() const                  { return _in_deopt_handler > 0; }
   void inc_in_deopt_handler()                    { _in_deopt_handler++; }
-  void dec_in_deopt_handler()                    {
+  void dec_in_deopt_handler() {
     assert(_in_deopt_handler > 0, "mismatched deopt nesting");
     if (_in_deopt_handler > 0) { // robustness
       _in_deopt_handler--;
@@ -1776,7 +1776,7 @@ private:
   uint _claimed_par_id;
 public:
   uint get_claimed_par_id() { return _claimed_par_id; }
-  void set_claimed_par_id(uint id) { _claimed_par_id = id;}
+  void set_claimed_par_id(uint id) { _claimed_par_id = id; }
 };
 
 // Inline implementation of JavaThread::current
@@ -1811,7 +1811,7 @@ inline bool JavaThread::stack_yellow_zone_enabled() {
 inline size_t JavaThread::stack_available(address cur_sp) {
   // This code assumes java stacks grow down
   address low_addr; // Limit on the address for deepest stack depth
-  if ( _stack_guard_state == stack_guard_unused) {
+  if (_stack_guard_state == stack_guard_unused) {
     low_addr =  stack_base() - stack_size();
   } else {
     low_addr = stack_yellow_zone_base();
-- 
GitLab


From 02f3dbb898c271693cad1107dfe55948a2b02022 Mon Sep 17 00:00:00 2001
From: David Dehaven <ddehaven@openjdk.org>
Date: Tue, 17 Jun 2014 11:18:10 -0700
Subject: [PATCH 102/192] 8043340: [macosx] Fix hard-wired paths to
 JavaVM.framework

Build system tweaks to allow building with Xcode 5 and on OS X 10.9 and later

Reviewed-by: erikj, henryjen, dholmes
---
 .../agent/src/os/bsd/MacosxDebuggerLocal.m    |  4 +--
 hotspot/agent/src/os/bsd/Makefile             |  6 ++---
 hotspot/make/bsd/makefiles/saproc.make        | 27 ++++++++++++-------
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m
index 0f0ff4e5da4..044340aa511 100644
--- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m
+++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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,7 +26,7 @@
 #import <Foundation/Foundation.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 
-#include <JavaVM/jni.h>
+#include <jni.h>
 
 #import <mach/mach.h>
 #import <mach/mach_types.h>
diff --git a/hotspot/agent/src/os/bsd/Makefile b/hotspot/agent/src/os/bsd/Makefile
index ce3e2c4c32c..eabe1f7730d 100644
--- a/hotspot/agent/src/os/bsd/Makefile
+++ b/hotspot/agent/src/os/bsd/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, 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
@@ -50,9 +50,9 @@ SOURCES  = symtab.c     \
 	ps_core.c
 OBJS    = $(SOURCES:.c=.o)
 OBJSPLUS = MacosxDebuggerLocal.o sadis.o $(OBJS)
-EXTINCLUDE = -I/System/Library/Frameworks/JavaVM.framework/Headers -I.
+EXTINCLUDE = -I.
 EXTCFLAGS = -m64 -D__APPLE__ -framework JavaNativeFoundation
-FOUNDATIONFLAGS = -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
+FOUNDATIONFLAGS = -framework Foundation -framework JavaNativeFoundation -framework Security -framework CoreFoundation
 LIBSA = $(ARCH)/libsaproc.dylib
 endif   # Darwin
 
diff --git a/hotspot/make/bsd/makefiles/saproc.make b/hotspot/make/bsd/makefiles/saproc.make
index a147325979f..1b0d5d603e8 100644
--- a/hotspot/make/bsd/makefiles/saproc.make
+++ b/hotspot/make/bsd/makefiles/saproc.make
@@ -64,9 +64,23 @@ ifeq ($(OS_VENDOR), FreeBSD)
 else
   ifeq ($(OS_VENDOR), Darwin)
     SASRCFILES = $(DARWIN_NON_STUB_SASRCFILES)
-    SALIBS = -g -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
+    SALIBS = -g \
+             -framework Foundation \
+             -framework JavaNativeFoundation \
+             -framework Security \
+             -framework CoreFoundation
     #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
     SAARCH = $(subst -march=i586,,$(ARCHFLAG))
+
+    # This is needed to locate JavaNativeFoundation.framework
+    ifeq ($(SYSROOT_CFLAGS),)
+      # this will happen when building without spec.gmk, set SDKROOT to a valid SDK
+      # path if your system does not have headers installed in the system frameworks
+      SA_SYSROOT_FLAGS = -F"$(SDKROOT)/System/Library/Frameworks/JavaVM.framework/Frameworks"
+    else
+      # Just use SYSROOT_CFLAGS
+      SA_SYSROOT_FLAGS=$(SYSROOT_CFLAGS)
+    endif
   else
     SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
     SALIBS = 
@@ -100,14 +114,8 @@ SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
 endif
 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
 
-ifeq ($(OS_VENDOR), Darwin)
-  BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
-    -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
-    -I/System/Library/Frameworks/JavaVM.framework/Headers
-else
-  BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
-    -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
-endif
+BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
+  -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
 
 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
@@ -116,6 +124,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
 	fi
 	@echo Making SA debugger back-end...
 	$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE                   \
+	           $(SA_SYSROOT_FLAGS)                                  \
 	           $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG)       \
 	           -I$(SASRCDIR)                                        \
 	           -I$(GENERATED)                                       \
-- 
GitLab


From be48d07662c123b2252bc51269204aa046ff131a Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Wed, 18 Jun 2014 13:21:59 +0400
Subject: [PATCH 103/192] 8047061: [macosx] Crash when setting display mode

Reviewed-by: anthony, alexsch
---
 .../macosx/native/sun/awt/CGraphicsDevice.m   |   2 +-
 .../AltTabCrashTest/AltTabCrashTest.java      | 480 ++++++++++++++++++
 2 files changed, 481 insertions(+), 1 deletion(-)
 create mode 100644 jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java

diff --git a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m
index a1813b6154d..36df94b1236 100644
--- a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m
+++ b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m
@@ -57,7 +57,7 @@ static CFMutableArrayRef getAllValidDisplayModes(jint displayID){
     CFArrayRef allModes = CGDisplayCopyAllDisplayModes(displayID, NULL);
 
     CFIndex numModes = CFArrayGetCount(allModes);
-    CFMutableArrayRef validModes = CFArrayCreateMutable(kCFAllocatorDefault, numModes + 1, NULL);
+    CFMutableArrayRef validModes = CFArrayCreateMutable(kCFAllocatorDefault, numModes + 1, &kCFTypeArrayCallBacks);
 
     CFIndex n;
     for (n=0; n < numModes; n++) {
diff --git a/jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java b/jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java
new file mode 100644
index 00000000000..5bb69314b25
--- /dev/null
+++ b/jdk/test/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java
@@ -0,0 +1,480 @@
+/*
+ * Copyright (c) 2005, 2014 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 6275887 6429971 6459792
+ @summary Test that we don't crash when alt+tabbing in and out of
+         fullscreen app
+ @author Dmitri.Trembovetski@sun.com: area=FullScreen
+ @run main/othervm/timeout=100  AltTabCrashTest -auto -changedm
+ @run main/othervm/timeout=100 -Dsun.java2d.d3d=True AltTabCrashTest -auto -changedm
+ @run main/othervm/timeout=100 -Dsun.java2d.d3d=True AltTabCrashTest -auto -usebs -changedm
+ @run main/othervm/timeout=100 -Dsun.java2d.opengl=True AltTabCrashTest -auto
+*/
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.DisplayMode;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.RenderingHints;
+import java.awt.Robot;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferStrategy;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.util.Random;
+import java.util.Vector;
+
+/**
+ * Note that the alt+tabbing in and out part will most likely only work
+ * on Windows, and only if there are no interventions.
+ */
+
+public class AltTabCrashTest extends Frame {
+    public static int width;
+    public static int height;
+    public static volatile boolean autoMode;
+    public static boolean useBS;
+    public static final int NUM_OF_BALLS = 70;
+    // number of times to alt+tab in and out of the app
+    public static int altTabs = 5;
+    private final Vector<Ball> balls = new Vector<>();
+    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment()
+        .getDefaultScreenDevice();
+    VolatileImage vimg = null;
+    BufferStrategy bufferStrategy = null;
+    volatile boolean timeToQuit = false;
+    static final Object lock = new Object();
+
+    enum SpriteType {
+        OVALS, VIMAGES, BIMAGES, AAOVALS, TEXT
+    }
+
+    private static boolean changeDM = false;
+    private static SpriteType spriteType;
+    static Random rnd = new Random();
+
+    public AltTabCrashTest( ) {
+        addKeyListener(new KeyAdapter() {
+            public void keyPressed(KeyEvent e) {
+                if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+                    timeToQuit = true;
+                }
+            }
+        });
+        setIgnoreRepaint(true);
+        addMouseListener(new MouseHandler());
+        for (int i = 0; i < NUM_OF_BALLS; i++) {
+            int x = 50 + rnd.nextInt(550), y = 50 + rnd.nextInt(400);
+
+            balls.addElement(createRandomBall(y, x));
+        }
+        setUndecorated(true);
+        gd.setFullScreenWindow(this);
+        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
+        if (gd.isDisplayChangeSupported() && changeDM) {
+            DisplayMode dm = findDisplayMode();
+            if (dm != null) {
+                try {
+                    gd.setDisplayMode(dm);
+                } catch (IllegalArgumentException iae) {
+                    System.err.println("Error setting display mode");
+                }
+            }
+        }
+        if (useBS) {
+            createBufferStrategy(2);
+            bufferStrategy = getBufferStrategy();
+        } else {
+            Graphics2D g = (Graphics2D) getGraphics();
+            render(g);
+            g.dispose();
+        }
+        Thread t = new BallThread();
+        t.start();
+        if (autoMode) {
+            Thread tt = new AltTabberThread();
+            tt.start();
+            synchronized (lock) {
+                while (!timeToQuit) {
+                    try {
+                        lock.wait(200);
+                    } catch (InterruptedException ex) {
+                        ex.printStackTrace();
+                    }
+                }
+            }
+            t = null;
+            dispose();
+        }
+    }
+
+    private Ball createRandomBall(final int y, final int x) {
+        Ball b;
+        SpriteType type;
+
+        if (spriteType == null) {
+            int index = rnd.nextInt(SpriteType.values().length);
+            type = SpriteType.values()[index];
+        } else {
+            type = spriteType;
+        }
+        switch (type) {
+            case VIMAGES: b = new VISpriteBall(x, y); break;
+            case AAOVALS: b = new AAOvalBall(x, y); break;
+            case BIMAGES: b = new BISpriteBall(x, y); break;
+            case TEXT: b = new TextBall(x,y, "Text Sprite!"); break;
+            default: b = new Ball(x, y); break;
+        }
+        return b;
+    }
+
+    private class MouseHandler extends MouseAdapter  {
+        public void mousePressed(MouseEvent e) {
+            synchronized (balls) {
+                balls.addElement(createRandomBall(e.getX(), e.getY()));
+            }
+        }
+    }
+
+    private class AltTabberThread extends Thread {
+        Robot robot;
+
+        void pressAltTab() {
+            robot.keyPress(KeyEvent.VK_ALT);
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_ALT);
+        }
+        void pressShiftAltTab() {
+            robot.keyPress(KeyEvent.VK_SHIFT);
+            pressAltTab();
+            robot.keyRelease(KeyEvent.VK_SHIFT);
+        }
+        public void run() {
+            try {
+                robot = new Robot();
+                robot.setAutoDelay(200);
+            } catch (AWTException e) {
+                throw new RuntimeException("Can't create robot");
+            }
+            boolean out = true;
+            while (altTabs-- > 0 && !timeToQuit) {
+                System.err.println("Alt+tabber Iteration: "+altTabs);
+                try { Thread.sleep(2500); } catch (InterruptedException ex) {}
+
+                if (out) {
+                    System.err.println("Issuing alt+tab");
+                    pressAltTab();
+                } else {
+                    System.err.println("Issuing shift ");
+                    pressShiftAltTab();
+                }
+                out = !out;
+            }
+            System.err.println("Alt+tabber finished.");
+            synchronized (lock) {
+                timeToQuit = true;
+                lock.notify();
+            }
+        }
+    }
+
+    private class BallThread extends Thread {
+        public void run() {
+            while (!timeToQuit) {
+                if (useBS) {
+                    renderToBS();
+                    bufferStrategy.show();
+                } else {
+                    Graphics g = AltTabCrashTest.this.getGraphics();
+                    render(g);
+                    g.dispose();
+                }
+            }
+            gd.setFullScreenWindow(null);
+            AltTabCrashTest.this.dispose();
+        }
+    }
+
+    static class Ball {
+
+        int x, y;     // current location
+        int dx, dy;   // motion delta
+        int diameter = 40;
+        Color color = Color.red;
+
+        public Ball() {
+        }
+
+        public Ball(int x, int y) {
+            this.x = x;
+            this.y = y;
+            dx = x % 20 + 1;
+            dy = y % 20 + 1;
+            color = new Color(rnd.nextInt(0x00ffffff));
+        }
+
+        public void move() {
+            if (x < 10 || x >= AltTabCrashTest.width - 20)
+                dx = -dx;
+            if (y < 10 || y > AltTabCrashTest.height - 20)
+                dy = -dy;
+            x += dx;
+            y += dy;
+        }
+
+        public void paint(Graphics g, Color c) {
+            if (c == null) {
+                g.setColor(color);
+            } else {
+                g.setColor(c);
+            }
+            g.fillOval(x, y, diameter, diameter);
+        }
+
+    }
+
+    static class TextBall extends Ball {
+        String text;
+        public TextBall(int x, int y, String text) {
+            super(x, y);
+            this.text = text;
+        }
+
+        public void paint(Graphics g, Color c) {
+            if (c == null) {
+                g.setColor(color);
+            } else {
+                g.setColor(c);
+            }
+            g.drawString(text, x, y);
+        }
+    }
+
+    static class AAOvalBall extends Ball {
+        public AAOvalBall(int x, int y) {
+            super(x, y);
+        }
+        public void paint(Graphics g, Color c) {
+            if (c == null) {
+                Graphics2D g2d = (Graphics2D)g.create();
+                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                     RenderingHints.VALUE_ANTIALIAS_ON);
+                g2d.setColor(color);
+                g2d.fillOval(x, y, diameter, diameter);
+            } else {
+                g.setColor(c);
+                g.fillOval(x-2, y-2, diameter+4, diameter+4);
+            }
+        }
+    }
+
+    static abstract class SpriteBall extends Ball {
+        Image image;
+        public SpriteBall(int x, int y) {
+            super(x, y);
+            image = createSprite();
+            Graphics g = image.getGraphics();
+            g.setColor(color);
+            g.fillRect(0, 0, image.getWidth(null), image.getHeight(null));
+        }
+        public void paint(Graphics g, Color c) {
+            if (c != null) {
+                g.setColor(c);
+                g.fillRect(x, y, image.getWidth(null), image.getHeight(null));
+            } else do {
+                validateSprite();
+                g.drawImage(image, x, y, null);
+            } while (renderingIncomplete());
+        }
+        public abstract Image createSprite();
+        public void validateSprite() {}
+        public boolean renderingIncomplete() { return false; }
+    }
+    class VISpriteBall extends SpriteBall {
+
+        public VISpriteBall(int x, int y) {
+            super(x, y);
+        }
+        public boolean renderingIncomplete() {
+            return ((VolatileImage)image).contentsLost();
+        }
+
+        public Image createSprite() {
+            return gd.getDefaultConfiguration().
+                createCompatibleVolatileImage(20, 20);
+        }
+        public void validateSprite() {
+            int result =
+                ((VolatileImage)image).validate(getGraphicsConfiguration());
+            if (result == VolatileImage.IMAGE_INCOMPATIBLE) {
+                image = createSprite();
+                result = VolatileImage.IMAGE_RESTORED;
+            }
+            if (result == VolatileImage.IMAGE_RESTORED) {
+                Graphics g = image.getGraphics();
+                g.setColor(color);
+                g.fillRect(0, 0, image.getWidth(null), image.getHeight(null));
+            }
+        }
+    }
+    class BISpriteBall extends SpriteBall {
+        public BISpriteBall(int x, int y) {
+            super(x, y);
+        }
+        public Image createSprite() {
+            return new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB);
+        }
+    }
+
+
+    public void renderOffscreen() {
+        Graphics2D g2d = (Graphics2D) vimg.getGraphics();
+        synchronized (balls) {
+            for (Ball b : balls) {
+                b.paint(g2d, getBackground());
+                b.move();
+                b.paint(g2d, null);
+            }
+        }
+        g2d.dispose();
+    }
+
+    public void renderToBS() {
+        width = getWidth();
+        height = getHeight();
+
+        do {
+            Graphics2D g2d = (Graphics2D)bufferStrategy.getDrawGraphics();
+
+            g2d.clearRect(0, 0, width, height);
+            synchronized (balls) {
+                for (Ball b : balls) {
+                    b.move();
+                    b.paint(g2d, null);
+                }
+            }
+            g2d.dispose();
+        } while (bufferStrategy.contentsLost() ||
+                bufferStrategy.contentsRestored());
+    }
+
+    public void render(Graphics g)  {
+        do {
+            height = getBounds().height;
+            width = getBounds().width;
+            if (vimg == null) {
+                vimg = createVolatileImage(width, height);
+                renderOffscreen();
+            }
+            int returnCode = vimg.validate(getGraphicsConfiguration());
+            if (returnCode == VolatileImage.IMAGE_RESTORED) {
+                renderOffscreen();
+            } else if (returnCode == VolatileImage.IMAGE_INCOMPATIBLE) {
+                vimg = getGraphicsConfiguration().
+                    createCompatibleVolatileImage(width, height);
+                renderOffscreen();
+            } else if (returnCode == VolatileImage.IMAGE_OK) {
+                renderOffscreen();
+            }
+            g.drawImage(vimg, 0, 0, this);
+        } while (vimg.contentsLost());
+    }
+
+    public static void main(String args[])  {
+        for (String arg : args) {
+            if (arg.equalsIgnoreCase("-auto")) {
+                autoMode = true;
+                System.err.println("Running in automatic mode using Robot");
+            } else if (arg.equalsIgnoreCase("-usebs")) {
+                useBS = true;
+                System.err.println("Using BufferStrategy instead of VI");
+            } else if (arg.equalsIgnoreCase("-changedm")) {
+                changeDM= true;
+                System.err.println("The test will change display mode");
+            } else if (arg.equalsIgnoreCase("-vi")) {
+                spriteType = SpriteType.VIMAGES;
+            } else if (arg.equalsIgnoreCase("-bi")) {
+                spriteType = SpriteType.BIMAGES;
+            } else if (arg.equalsIgnoreCase("-ov")) {
+                spriteType = SpriteType.OVALS;
+            } else if (arg.equalsIgnoreCase("-aaov")) {
+                spriteType = SpriteType.AAOVALS;
+            } else if (arg.equalsIgnoreCase("-tx")) {
+                spriteType = SpriteType.TEXT;
+            } else {
+                System.err.println("Usage: AltTabCrashTest [-usebs][-auto]" +
+                                   "[-changedm][-vi|-bi|-ov|-aaov|-tx]");
+                System.err.println(" -usebs: use BufferStrategy instead of VI");
+                System.err.println(" -auto: automatically alt+tab in and out" +
+                                   " of the application ");
+                System.err.println(" -changedm: change display mode");
+                System.err.println(" -(vi|bi|ov|tx|aaov) : use only VI, BI, " +
+                                   "text or [AA] [draw]Oval sprites");
+                System.exit(0);
+            }
+        }
+        if (spriteType != null) {
+            System.err.println("The test will only use "+spriteType+" sprites.");
+        }
+        new AltTabCrashTest();
+    }
+
+    private DisplayMode findDisplayMode() {
+        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
+        DisplayMode dms[] = gd.getDisplayModes();
+        DisplayMode currentDM = gd.getDisplayMode();
+        for (DisplayMode dm : dms) {
+            if (dm.getBitDepth() > 8 &&
+                dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI &&
+                dm.getBitDepth() != currentDM.getBitDepth() &&
+                dm.getWidth() == currentDM.getWidth() &&
+                dm.getHeight() == currentDM.getHeight())
+            {
+                // found a mode which has the same dimensions but different
+                // depth
+                return dm;
+            }
+            if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI &&
+                (dm.getWidth() != currentDM.getWidth() ||
+                 dm.getHeight() != currentDM.getHeight()))
+            {
+                // found a mode which has the same depth but different
+                // dimensions
+                return dm;
+            }
+        }
+
+        return null;
+    }
+}
-- 
GitLab


From 88577971d09c29b9b15cc7a61c8c0c4416d9e078 Mon Sep 17 00:00:00 2001
From: Dan Horak <dhorak@redhat.com>
Date: Wed, 18 Jun 2014 13:25:40 +0200
Subject: [PATCH 104/192] 8043722: Swapped usage of idx_t and bm_word_t types
 in parMarkBitMap.cpp

Clean up usage of idx_t and uintptr_t when using it in conjunction with BitMap::set_map(), casting to the appropriate type. Fixes compilation on S390.

Reviewed-by: tschatzl
---
 hotspot/src/share/vm/compiler/methodLiveness.cpp              | 4 ++--
 hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp  | 2 +-
 .../vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hotspot/src/share/vm/compiler/methodLiveness.cpp b/hotspot/src/share/vm/compiler/methodLiveness.cpp
index 0c1d9b09232..eda1ab156b3 100644
--- a/hotspot/src/share/vm/compiler/methodLiveness.cpp
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp
@@ -475,7 +475,7 @@ MethodLivenessResult MethodLiveness::get_liveness_at(int entry_bci) {
     bci = 0;
   }
 
-  MethodLivenessResult answer((uintptr_t*)NULL,0);
+  MethodLivenessResult answer((BitMap::bm_word_t*)NULL,0);
 
   if (_block_count > 0) {
     if (TimeLivenessAnalysis) _time_total.start();
@@ -1000,7 +1000,7 @@ bool MethodLiveness::BasicBlock::merge_exception(BitMap other) {
 }
 
 MethodLivenessResult MethodLiveness::BasicBlock::get_liveness_at(ciMethod* method, int bci) {
-  MethodLivenessResult answer(NEW_RESOURCE_ARRAY(uintptr_t, _analyzer->bit_map_size_words()),
+  MethodLivenessResult answer(NEW_RESOURCE_ARRAY(BitMap::bm_word_t, _analyzer->bit_map_size_words()),
                 _analyzer->bit_map_size_bits());
   answer.set_is_valid();
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index 24c62d775bd..9d80a5c7212 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -127,7 +127,7 @@ bool CMBitMap::allocate(ReservedSpace heap_rs) {
   }
   assert(_virtual_space.committed_size() == brs.size(),
          "didn't reserve backing store for all of concurrent marking bit map?");
-  _bm.set_map((uintptr_t*)_virtual_space.low());
+  _bm.set_map((BitMap::bm_word_t*)_virtual_space.low());
   assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >=
          _bmWordSize, "inconsistency in bit map sizing");
   _bm.set_size(_bmWordSize >> _shifter);
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp
index 76a368b692c..19a055cc040 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp
@@ -71,7 +71,7 @@ ParMarkBitMap::initialize(MemRegion covered_region)
   if (_virtual_space != NULL && _virtual_space->expand_by(_reserved_byte_size)) {
     _region_start = covered_region.start();
     _region_size = covered_region.word_size();
-    idx_t* map = (idx_t*)_virtual_space->reserved_low_addr();
+    BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr();
     _beg_bits.set_map(map);
     _beg_bits.set_size(bits / 2);
     _end_bits.set_map(map + words / 2);
-- 
GitLab


From 410ba2a8f021de023711412d4a96c8ea78ffdcad Mon Sep 17 00:00:00 2001
From: Henry Jen <henryjen@openjdk.org>
Date: Wed, 18 Jun 2014 09:13:46 -0700
Subject: [PATCH 105/192] 8046485: Add missing @since tag under javax.swing.*

Reviewed-by: alexsch, prr
---
 jdk/src/share/classes/javax/swing/AbstractAction.java           | 1 +
 jdk/src/share/classes/javax/swing/AbstractButton.java           | 1 +
 jdk/src/share/classes/javax/swing/AbstractListModel.java        | 1 +
 jdk/src/share/classes/javax/swing/Action.java                   | 1 +
 jdk/src/share/classes/javax/swing/BorderFactory.java            | 1 +
 jdk/src/share/classes/javax/swing/BoundedRangeModel.java        | 1 +
 jdk/src/share/classes/javax/swing/Box.java                      | 1 +
 jdk/src/share/classes/javax/swing/BoxLayout.java                | 1 +
 jdk/src/share/classes/javax/swing/ButtonGroup.java              | 1 +
 jdk/src/share/classes/javax/swing/ButtonModel.java              | 1 +
 jdk/src/share/classes/javax/swing/CellEditor.java               | 1 +
 jdk/src/share/classes/javax/swing/CellRendererPane.java         | 1 +
 jdk/src/share/classes/javax/swing/ComboBoxEditor.java           | 1 +
 jdk/src/share/classes/javax/swing/ComboBoxModel.java            | 1 +
 jdk/src/share/classes/javax/swing/DebugGraphics.java            | 1 +
 jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java | 1 +
 jdk/src/share/classes/javax/swing/DefaultButtonModel.java       | 1 +
 jdk/src/share/classes/javax/swing/DefaultCellEditor.java        | 1 +
 jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java     | 1 +
 jdk/src/share/classes/javax/swing/DefaultDesktopManager.java    | 1 +
 jdk/src/share/classes/javax/swing/DefaultFocusManager.java      | 1 +
 jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java  | 1 +
 jdk/src/share/classes/javax/swing/DefaultListModel.java         | 1 +
 .../share/classes/javax/swing/DefaultListSelectionModel.java    | 1 +
 .../share/classes/javax/swing/DefaultSingleSelectionModel.java  | 1 +
 jdk/src/share/classes/javax/swing/DesktopManager.java           | 1 +
 jdk/src/share/classes/javax/swing/FocusManager.java             | 1 +
 jdk/src/share/classes/javax/swing/GrayFilter.java               | 1 +
 jdk/src/share/classes/javax/swing/Icon.java                     | 1 +
 jdk/src/share/classes/javax/swing/ImageIcon.java                | 1 +
 jdk/src/share/classes/javax/swing/JApplet.java                  | 1 +
 jdk/src/share/classes/javax/swing/JButton.java                  | 1 +
 jdk/src/share/classes/javax/swing/JCheckBox.java                | 1 +
 jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java        | 1 +
 jdk/src/share/classes/javax/swing/JColorChooser.java            | 1 +
 jdk/src/share/classes/javax/swing/JComboBox.java                | 1 +
 jdk/src/share/classes/javax/swing/JComponent.java               | 1 +
 jdk/src/share/classes/javax/swing/JDesktopPane.java             | 1 +
 jdk/src/share/classes/javax/swing/JDialog.java                  | 1 +
 jdk/src/share/classes/javax/swing/JEditorPane.java              | 1 +
 jdk/src/share/classes/javax/swing/JFileChooser.java             | 2 +-
 jdk/src/share/classes/javax/swing/JFrame.java                   | 1 +
 jdk/src/share/classes/javax/swing/JInternalFrame.java           | 1 +
 jdk/src/share/classes/javax/swing/JLabel.java                   | 1 +
 jdk/src/share/classes/javax/swing/JLayeredPane.java             | 1 +
 jdk/src/share/classes/javax/swing/JList.java                    | 1 +
 jdk/src/share/classes/javax/swing/JMenu.java                    | 1 +
 jdk/src/share/classes/javax/swing/JMenuBar.java                 | 1 +
 jdk/src/share/classes/javax/swing/JMenuItem.java                | 1 +
 jdk/src/share/classes/javax/swing/JOptionPane.java              | 1 +
 jdk/src/share/classes/javax/swing/JPanel.java                   | 1 +
 jdk/src/share/classes/javax/swing/JPasswordField.java           | 1 +
 jdk/src/share/classes/javax/swing/JPopupMenu.java               | 1 +
 jdk/src/share/classes/javax/swing/JProgressBar.java             | 1 +
 jdk/src/share/classes/javax/swing/JRadioButton.java             | 1 +
 jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java     | 1 +
 jdk/src/share/classes/javax/swing/JRootPane.java                | 1 +
 jdk/src/share/classes/javax/swing/JScrollBar.java               | 1 +
 jdk/src/share/classes/javax/swing/JScrollPane.java              | 1 +
 jdk/src/share/classes/javax/swing/JSeparator.java               | 1 +
 jdk/src/share/classes/javax/swing/JSlider.java                  | 1 +
 jdk/src/share/classes/javax/swing/JSplitPane.java               | 1 +
 jdk/src/share/classes/javax/swing/JTabbedPane.java              | 1 +
 jdk/src/share/classes/javax/swing/JTable.java                   | 1 +
 jdk/src/share/classes/javax/swing/JTextArea.java                | 1 +
 jdk/src/share/classes/javax/swing/JTextField.java               | 1 +
 jdk/src/share/classes/javax/swing/JTextPane.java                | 1 +
 jdk/src/share/classes/javax/swing/JToggleButton.java            | 1 +
 jdk/src/share/classes/javax/swing/JToolBar.java                 | 1 +
 jdk/src/share/classes/javax/swing/JToolTip.java                 | 1 +
 jdk/src/share/classes/javax/swing/JTree.java                    | 1 +
 jdk/src/share/classes/javax/swing/JViewport.java                | 1 +
 jdk/src/share/classes/javax/swing/JWindow.java                  | 1 +
 jdk/src/share/classes/javax/swing/KeyStroke.java                | 1 +
 jdk/src/share/classes/javax/swing/ListCellRenderer.java         | 1 +
 jdk/src/share/classes/javax/swing/ListModel.java                | 1 +
 jdk/src/share/classes/javax/swing/ListSelectionModel.java       | 1 +
 jdk/src/share/classes/javax/swing/LookAndFeel.java              | 1 +
 jdk/src/share/classes/javax/swing/MenuElement.java              | 1 +
 jdk/src/share/classes/javax/swing/MenuSelectionManager.java     | 1 +
 jdk/src/share/classes/javax/swing/MutableComboBoxModel.java     | 1 +
 jdk/src/share/classes/javax/swing/OverlayLayout.java            | 1 +
 jdk/src/share/classes/javax/swing/Painter.java                  | 1 +
 jdk/src/share/classes/javax/swing/ProgressMonitor.java          | 1 +
 .../share/classes/javax/swing/ProgressMonitorInputStream.java   | 1 +
 jdk/src/share/classes/javax/swing/Renderer.java                 | 1 +
 jdk/src/share/classes/javax/swing/RepaintManager.java           | 1 +
 jdk/src/share/classes/javax/swing/RootPaneContainer.java        | 1 +
 jdk/src/share/classes/javax/swing/ScrollPaneConstants.java      | 1 +
 jdk/src/share/classes/javax/swing/ScrollPaneLayout.java         | 1 +
 jdk/src/share/classes/javax/swing/Scrollable.java               | 1 +
 jdk/src/share/classes/javax/swing/SingleSelectionModel.java     | 1 +
 jdk/src/share/classes/javax/swing/SizeRequirements.java         | 1 +
 jdk/src/share/classes/javax/swing/SwingConstants.java           | 1 +
 jdk/src/share/classes/javax/swing/SwingUtilities.java           | 1 +
 jdk/src/share/classes/javax/swing/Timer.java                    | 1 +
 jdk/src/share/classes/javax/swing/ToolTipManager.java           | 1 +
 jdk/src/share/classes/javax/swing/UIDefaults.java               | 1 +
 jdk/src/share/classes/javax/swing/UIManager.java                | 1 +
 .../classes/javax/swing/UnsupportedLookAndFeelException.java    | 1 +
 jdk/src/share/classes/javax/swing/ViewportLayout.java           | 1 +
 jdk/src/share/classes/javax/swing/WindowConstants.java          | 1 +
 102 files changed, 102 insertions(+), 1 deletion(-)

diff --git a/jdk/src/share/classes/javax/swing/AbstractAction.java b/jdk/src/share/classes/javax/swing/AbstractAction.java
index f8f15f4f992..1f0ef990243 100644
--- a/jdk/src/share/classes/javax/swing/AbstractAction.java
+++ b/jdk/src/share/classes/javax/swing/AbstractAction.java
@@ -55,6 +55,7 @@ import sun.security.action.GetPropertyAction;
  *
  * @author Georges Saab
  * @see Action
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public abstract class AbstractAction implements Action, Cloneable, Serializable
diff --git a/jdk/src/share/classes/javax/swing/AbstractButton.java b/jdk/src/share/classes/javax/swing/AbstractButton.java
index 02ddcfe729c..58f9e943c9f 100644
--- a/jdk/src/share/classes/javax/swing/AbstractButton.java
+++ b/jdk/src/share/classes/javax/swing/AbstractButton.java
@@ -71,6 +71,7 @@ import java.util.*;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author Jeff Dinkins
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public abstract class AbstractButton extends JComponent implements ItemSelectable, SwingConstants {
diff --git a/jdk/src/share/classes/javax/swing/AbstractListModel.java b/jdk/src/share/classes/javax/swing/AbstractListModel.java
index 33145a51e8e..cc3003dc132 100644
--- a/jdk/src/share/classes/javax/swing/AbstractListModel.java
+++ b/jdk/src/share/classes/javax/swing/AbstractListModel.java
@@ -45,6 +45,7 @@ import java.util.EventListener;
  * @param <E> the type of the elements of this model
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public abstract class AbstractListModel<E> implements ListModel<E>, Serializable
diff --git a/jdk/src/share/classes/javax/swing/Action.java b/jdk/src/share/classes/javax/swing/Action.java
index b803b37d96f..b1ebbec40a8 100644
--- a/jdk/src/share/classes/javax/swing/Action.java
+++ b/jdk/src/share/classes/javax/swing/Action.java
@@ -210,6 +210,7 @@ import java.beans.*;
  *
  * @author Georges Saab
  * @see AbstractAction
+ * @since 1.2
  */
 public interface Action extends ActionListener {
     /**
diff --git a/jdk/src/share/classes/javax/swing/BorderFactory.java b/jdk/src/share/classes/javax/swing/BorderFactory.java
index f821e76f8cc..9f2393cb91d 100644
--- a/jdk/src/share/classes/javax/swing/BorderFactory.java
+++ b/jdk/src/share/classes/javax/swing/BorderFactory.java
@@ -40,6 +40,7 @@ import javax.swing.border.*;
  * a section in <em>The Java Tutorial</em>.
  *
  * @author David Kloba
+ * @since 1.2
  */
 public class BorderFactory
 {
diff --git a/jdk/src/share/classes/javax/swing/BoundedRangeModel.java b/jdk/src/share/classes/javax/swing/BoundedRangeModel.java
index ea0a41119e2..bc6a84ac891 100644
--- a/jdk/src/share/classes/javax/swing/BoundedRangeModel.java
+++ b/jdk/src/share/classes/javax/swing/BoundedRangeModel.java
@@ -76,6 +76,7 @@ import javax.swing.event.*;
  *
  * @author Hans Muller
  * @see DefaultBoundedRangeModel
+ * @since 1.2
  */
 public interface BoundedRangeModel
 {
diff --git a/jdk/src/share/classes/javax/swing/Box.java b/jdk/src/share/classes/javax/swing/Box.java
index 9bf5474c746..d332214a3c5 100644
--- a/jdk/src/share/classes/javax/swing/Box.java
+++ b/jdk/src/share/classes/javax/swing/Box.java
@@ -75,6 +75,7 @@ import javax.accessibility.*;
  * @see BoxLayout
  *
  * @author  Timothy Prinzing
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class Box extends JComponent implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/BoxLayout.java b/jdk/src/share/classes/javax/swing/BoxLayout.java
index 8723a15f048..c3565fb1741 100644
--- a/jdk/src/share/classes/javax/swing/BoxLayout.java
+++ b/jdk/src/share/classes/javax/swing/BoxLayout.java
@@ -134,6 +134,7 @@ import java.io.PrintStream;
  * @see JComponent#getAlignmentY
  *
  * @author   Timothy Prinzing
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class BoxLayout implements LayoutManager2, Serializable {
diff --git a/jdk/src/share/classes/javax/swing/ButtonGroup.java b/jdk/src/share/classes/javax/swing/ButtonGroup.java
index 64f5b641774..21c13a49cbb 100644
--- a/jdk/src/share/classes/javax/swing/ButtonGroup.java
+++ b/jdk/src/share/classes/javax/swing/ButtonGroup.java
@@ -64,6 +64,7 @@ import java.io.Serializable;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author Jeff Dinkins
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class ButtonGroup implements Serializable {
diff --git a/jdk/src/share/classes/javax/swing/ButtonModel.java b/jdk/src/share/classes/javax/swing/ButtonModel.java
index 1668c673b56..85ba48f6ba2 100644
--- a/jdk/src/share/classes/javax/swing/ButtonModel.java
+++ b/jdk/src/share/classes/javax/swing/ButtonModel.java
@@ -72,6 +72,7 @@ import javax.swing.event.*;
  * <code>ActionEvent</code> to be fired.
  *
  * @author Jeff Dinkins
+ * @since 1.2
  */
 public interface ButtonModel extends ItemSelectable {
 
diff --git a/jdk/src/share/classes/javax/swing/CellEditor.java b/jdk/src/share/classes/javax/swing/CellEditor.java
index 3211a788cb9..f1b625b7969 100644
--- a/jdk/src/share/classes/javax/swing/CellEditor.java
+++ b/jdk/src/share/classes/javax/swing/CellEditor.java
@@ -57,6 +57,7 @@ import javax.swing.event.*;
  * @see javax.swing.event.CellEditorListener
  *
  * @author Alan Chung
+ * @since 1.2
  */
 public interface CellEditor {
 
diff --git a/jdk/src/share/classes/javax/swing/CellRendererPane.java b/jdk/src/share/classes/javax/swing/CellRendererPane.java
index 33539284e2d..70ba2afa04c 100644
--- a/jdk/src/share/classes/javax/swing/CellRendererPane.java
+++ b/jdk/src/share/classes/javax/swing/CellRendererPane.java
@@ -62,6 +62,7 @@ import javax.accessibility.*;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class CellRendererPane extends Container implements Accessible
diff --git a/jdk/src/share/classes/javax/swing/ComboBoxEditor.java b/jdk/src/share/classes/javax/swing/ComboBoxEditor.java
index de191d1bcf9..f7dd950471c 100644
--- a/jdk/src/share/classes/javax/swing/ComboBoxEditor.java
+++ b/jdk/src/share/classes/javax/swing/ComboBoxEditor.java
@@ -31,6 +31,7 @@ import java.awt.event.*;
  * The editor component used for JComboBox components.
  *
  * @author Arnaud Weber
+ * @since 1.2
  */
 public interface ComboBoxEditor {
 
diff --git a/jdk/src/share/classes/javax/swing/ComboBoxModel.java b/jdk/src/share/classes/javax/swing/ComboBoxModel.java
index e7c3be9811b..50bd87d66f0 100644
--- a/jdk/src/share/classes/javax/swing/ComboBoxModel.java
+++ b/jdk/src/share/classes/javax/swing/ComboBoxModel.java
@@ -36,6 +36,7 @@ package javax.swing;
  * @param <E> the type of the elements of this model
  *
  * @author Arnaud Weber
+ * @since 1.2
  */
 public interface ComboBoxModel<E> extends ListModel<E> {
 
diff --git a/jdk/src/share/classes/javax/swing/DebugGraphics.java b/jdk/src/share/classes/javax/swing/DebugGraphics.java
index a41e9c62f55..53219b74c33 100644
--- a/jdk/src/share/classes/javax/swing/DebugGraphics.java
+++ b/jdk/src/share/classes/javax/swing/DebugGraphics.java
@@ -45,6 +45,7 @@ import java.text.AttributedCharacterIterator;
  * @see RepaintManager#setDoubleBufferingEnabled
  *
  * @author Dave Karlton
+ * @since 1.2
  */
 public class DebugGraphics extends Graphics {
     Graphics                    graphics;
diff --git a/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java b/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java
index 8d316ce28ac..b7b989e07fa 100644
--- a/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java
+++ b/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java
@@ -44,6 +44,7 @@ import java.util.EventListener;
  * @author David Kloba
  * @author Hans Muller
  * @see BoundedRangeModel
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable
diff --git a/jdk/src/share/classes/javax/swing/DefaultButtonModel.java b/jdk/src/share/classes/javax/swing/DefaultButtonModel.java
index 8fba596f3fe..fe2ddd143cd 100644
--- a/jdk/src/share/classes/javax/swing/DefaultButtonModel.java
+++ b/jdk/src/share/classes/javax/swing/DefaultButtonModel.java
@@ -44,6 +44,7 @@ import javax.swing.event.*;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author Jeff Dinkins
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class DefaultButtonModel implements ButtonModel, Serializable {
diff --git a/jdk/src/share/classes/javax/swing/DefaultCellEditor.java b/jdk/src/share/classes/javax/swing/DefaultCellEditor.java
index 1eea9e1fb3f..ba8942c5b21 100644
--- a/jdk/src/share/classes/javax/swing/DefaultCellEditor.java
+++ b/jdk/src/share/classes/javax/swing/DefaultCellEditor.java
@@ -49,6 +49,7 @@ import java.io.Serializable;
  *
  * @author Alan Chung
  * @author Philip Milne
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class DefaultCellEditor extends AbstractCellEditor
diff --git a/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java b/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java
index b42dc109b50..813ebd39ef1 100644
--- a/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java
+++ b/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java
@@ -35,6 +35,7 @@ import java.io.Serializable;
  *
  * @author Arnaud Weber
  * @author Tom Santos
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Superclass is not serializable across versions
 public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements MutableComboBoxModel<E>, Serializable {
diff --git a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java
index d140e98c5d7..6c66c8d6cce 100644
--- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java
+++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java
@@ -46,6 +46,7 @@ import java.beans.PropertyVetoException;
   * @see JInternalFrame
   * @author David Kloba
   * @author Steve Wilson
+  * @since 1.2
   */
 @SuppressWarnings("serial") // No Interesting Non-Transient State
 public class DefaultDesktopManager implements DesktopManager, java.io.Serializable {
diff --git a/jdk/src/share/classes/javax/swing/DefaultFocusManager.java b/jdk/src/share/classes/javax/swing/DefaultFocusManager.java
index 31240737791..502fc6c7f42 100644
--- a/jdk/src/share/classes/javax/swing/DefaultFocusManager.java
+++ b/jdk/src/share/classes/javax/swing/DefaultFocusManager.java
@@ -45,6 +45,7 @@ import java.util.Comparator;
  *
  * @author Arnaud Weber
  * @author David Mendenhall
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Obsolete class
 public class DefaultFocusManager extends FocusManager {
diff --git a/jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java b/jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java
index e4968364cc0..3cc567480c1 100644
--- a/jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java
+++ b/jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java
@@ -69,6 +69,7 @@ import sun.swing.DefaultLookup;
  *
  * @author Philip Milne
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class DefaultListCellRenderer extends JLabel
diff --git a/jdk/src/share/classes/javax/swing/DefaultListModel.java b/jdk/src/share/classes/javax/swing/DefaultListModel.java
index 063c18e2716..2b10f45ad47 100644
--- a/jdk/src/share/classes/javax/swing/DefaultListModel.java
+++ b/jdk/src/share/classes/javax/swing/DefaultListModel.java
@@ -51,6 +51,7 @@ import javax.swing.event.*;
  * @param <E> the type of the elements of this model
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class DefaultListModel<E> extends AbstractListModel<E>
diff --git a/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java b/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java
index f7b00bee086..a1cb79f8ea6 100644
--- a/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java
+++ b/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java
@@ -48,6 +48,7 @@ import javax.swing.event.*;
  * @author Philip Milne
  * @author Hans Muller
  * @see ListSelectionModel
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class DefaultListSelectionModel implements ListSelectionModel, Cloneable, Serializable
diff --git a/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java b/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java
index d5e5ab81e1d..75c522e79c9 100644
--- a/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java
+++ b/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java
@@ -42,6 +42,7 @@ import java.util.EventListener;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author Dave Moore
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class DefaultSingleSelectionModel implements SingleSelectionModel,
diff --git a/jdk/src/share/classes/javax/swing/DesktopManager.java b/jdk/src/share/classes/javax/swing/DesktopManager.java
index 07e40a07b21..edcfaf4fabb 100644
--- a/jdk/src/share/classes/javax/swing/DesktopManager.java
+++ b/jdk/src/share/classes/javax/swing/DesktopManager.java
@@ -43,6 +43,7 @@ package javax.swing;
   * @see JInternalFrame.JDesktopIcon
   *
   * @author David Kloba
+  * @since 1.2
   */
 public interface DesktopManager
 {
diff --git a/jdk/src/share/classes/javax/swing/FocusManager.java b/jdk/src/share/classes/javax/swing/FocusManager.java
index 9fa9b5666eb..45fc6b6e5b9 100644
--- a/jdk/src/share/classes/javax/swing/FocusManager.java
+++ b/jdk/src/share/classes/javax/swing/FocusManager.java
@@ -44,6 +44,7 @@ import java.awt.*;
  *
  * @author Arnaud Weber
  * @author David Mendenhall
+ * @since 1.2
  */
 public abstract class FocusManager extends DefaultKeyboardFocusManager {
 
diff --git a/jdk/src/share/classes/javax/swing/GrayFilter.java b/jdk/src/share/classes/javax/swing/GrayFilter.java
index d53f5d39c76..573edbedb63 100644
--- a/jdk/src/share/classes/javax/swing/GrayFilter.java
+++ b/jdk/src/share/classes/javax/swing/GrayFilter.java
@@ -36,6 +36,7 @@ import java.awt.image.*;
  * @author      Jeff Dinkins
  * @author      Tom Ball
  * @author      Jim Graham
+ * @since 1.2
  */
 public class GrayFilter extends RGBImageFilter {
     private boolean brighter;
diff --git a/jdk/src/share/classes/javax/swing/Icon.java b/jdk/src/share/classes/javax/swing/Icon.java
index f4e68840ab9..87c53684711 100644
--- a/jdk/src/share/classes/javax/swing/Icon.java
+++ b/jdk/src/share/classes/javax/swing/Icon.java
@@ -32,6 +32,7 @@ import java.awt.Component;
  * A small fixed size picture, typically used to decorate components.
  *
  * @see ImageIcon
+ * @since 1.2
  */
 
 public interface Icon
diff --git a/jdk/src/share/classes/javax/swing/ImageIcon.java b/jdk/src/share/classes/javax/swing/ImageIcon.java
index e286e936f11..8f7812e5919 100644
--- a/jdk/src/share/classes/javax/swing/ImageIcon.java
+++ b/jdk/src/share/classes/javax/swing/ImageIcon.java
@@ -65,6 +65,7 @@ import java.security.*;
  *
  * @author Jeff Dinkins
  * @author Lynn Monsanto
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class ImageIcon implements Icon, Serializable, Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JApplet.java b/jdk/src/share/classes/javax/swing/JApplet.java
index 539458979d4..651d004660d 100644
--- a/jdk/src/share/classes/javax/swing/JApplet.java
+++ b/jdk/src/share/classes/javax/swing/JApplet.java
@@ -89,6 +89,7 @@ import javax.accessibility.*;
  *    description: Swing's Applet subclass.
  *
  * @author Arnaud Weber
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JApplet extends Applet implements Accessible,
diff --git a/jdk/src/share/classes/javax/swing/JButton.java b/jdk/src/share/classes/javax/swing/JButton.java
index 5823cf1bffa..937de3adad6 100644
--- a/jdk/src/share/classes/javax/swing/JButton.java
+++ b/jdk/src/share/classes/javax/swing/JButton.java
@@ -74,6 +74,7 @@ import java.io.IOException;
  * description: An implementation of a \"push\" button.
  *
  * @author Jeff Dinkins
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JButton extends AbstractButton implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JCheckBox.java b/jdk/src/share/classes/javax/swing/JCheckBox.java
index 53502645c72..c912a383cae 100644
--- a/jdk/src/share/classes/javax/swing/JCheckBox.java
+++ b/jdk/src/share/classes/javax/swing/JCheckBox.java
@@ -74,6 +74,7 @@ import java.io.IOException;
  * description: A component which can be selected or deselected.
  *
  * @author Jeff Dinkins
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JCheckBox extends JToggleButton implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java b/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java
index 08eb53864c4..962ef73f3c0 100644
--- a/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java
+++ b/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java
@@ -87,6 +87,7 @@ import javax.accessibility.*;
  *
  * @author Georges Saab
  * @author David Karlton
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
diff --git a/jdk/src/share/classes/javax/swing/JColorChooser.java b/jdk/src/share/classes/javax/swing/JColorChooser.java
index 9420f499c41..a2aa8146c6b 100644
--- a/jdk/src/share/classes/javax/swing/JColorChooser.java
+++ b/jdk/src/share/classes/javax/swing/JColorChooser.java
@@ -82,6 +82,7 @@ import sun.swing.SwingUtilities2;
  * @author James Gosling
  * @author Amy Fowler
  * @author Steve Wilson
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JColorChooser extends JComponent implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JComboBox.java b/jdk/src/share/classes/javax/swing/JComboBox.java
index a8c4267d63f..4bab4916931 100644
--- a/jdk/src/share/classes/javax/swing/JComboBox.java
+++ b/jdk/src/share/classes/javax/swing/JComboBox.java
@@ -77,6 +77,7 @@ import javax.accessibility.*;
  *
  * @author Arnaud Weber
  * @author Mark Davidson
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JComboBox<E> extends JComponent
diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java
index c7bd205aac6..41dc5e54497 100644
--- a/jdk/src/share/classes/javax/swing/JComponent.java
+++ b/jdk/src/share/classes/javax/swing/JComponent.java
@@ -179,6 +179,7 @@ import sun.swing.UIClientPropertyKey;
  *
  * @author Hans Muller
  * @author Arnaud Weber
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public abstract class JComponent extends Container implements Serializable,
diff --git a/jdk/src/share/classes/javax/swing/JDesktopPane.java b/jdk/src/share/classes/javax/swing/JDesktopPane.java
index 94f7db248e1..35d53d2d918 100644
--- a/jdk/src/share/classes/javax/swing/JDesktopPane.java
+++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java
@@ -85,6 +85,7 @@ import java.util.TreeSet;
  * @see DesktopManager
  *
  * @author David Kloba
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JDesktopPane extends JLayeredPane implements Accessible
diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java
index 242f0ee4c47..ae0a3519e93 100644
--- a/jdk/src/share/classes/javax/swing/JDialog.java
+++ b/jdk/src/share/classes/javax/swing/JDialog.java
@@ -94,6 +94,7 @@ import javax.accessibility.*;
  * @author David Kloba
  * @author James Gosling
  * @author Scott Violet
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JDialog extends Dialog implements WindowConstants,
diff --git a/jdk/src/share/classes/javax/swing/JEditorPane.java b/jdk/src/share/classes/javax/swing/JEditorPane.java
index bf2e28fbd37..d650c4816e8 100644
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java
@@ -188,6 +188,7 @@ import javax.accessibility.*;
  * description: A text component to edit various types of content.
  *
  * @author  Timothy Prinzing
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JEditorPane extends JTextComponent {
diff --git a/jdk/src/share/classes/javax/swing/JFileChooser.java b/jdk/src/share/classes/javax/swing/JFileChooser.java
index ac6374c2a40..336f57c438b 100644
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java
@@ -86,7 +86,7 @@ import java.lang.ref.WeakReference;
  * description: A component which allows for the interactive selection of a file.
  *
  * @author Jeff Dinkins
- *
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Superclass is not serializable across versions
 public class JFileChooser extends JComponent implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JFrame.java b/jdk/src/share/classes/javax/swing/JFrame.java
index c773a3b66a8..e4a5efef662 100644
--- a/jdk/src/share/classes/javax/swing/JFrame.java
+++ b/jdk/src/share/classes/javax/swing/JFrame.java
@@ -111,6 +111,7 @@ import javax.accessibility.*;
  * @author Jeff Dinkins
  * @author Georges Saab
  * @author David Kloba
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JFrame  extends Frame implements WindowConstants,
diff --git a/jdk/src/share/classes/javax/swing/JInternalFrame.java b/jdk/src/share/classes/javax/swing/JInternalFrame.java
index e94854f9f12..3ecb82450d2 100644
--- a/jdk/src/share/classes/javax/swing/JInternalFrame.java
+++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java
@@ -104,6 +104,7 @@ import sun.swing.SwingUtilities2;
  *
  * @author David Kloba
  * @author Rich Schiavi
+ * @since 1.2
  * @beaninfo
  *      attribute: isContainer true
  *      attribute: containerDelegate getContentPane
diff --git a/jdk/src/share/classes/javax/swing/JLabel.java b/jdk/src/share/classes/javax/swing/JLabel.java
index af080be9564..2b0be80b1c7 100644
--- a/jdk/src/share/classes/javax/swing/JLabel.java
+++ b/jdk/src/share/classes/javax/swing/JLabel.java
@@ -103,6 +103,7 @@ import java.util.*;
  * description: A component that displays a short string and an icon.
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JLabel extends JComponent implements SwingConstants, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JLayeredPane.java b/jdk/src/share/classes/javax/swing/JLayeredPane.java
index 56685df9e66..ecb40a60bf5 100644
--- a/jdk/src/share/classes/javax/swing/JLayeredPane.java
+++ b/jdk/src/share/classes/javax/swing/JLayeredPane.java
@@ -153,6 +153,7 @@ import javax.accessibility.*;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author David Kloba
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JLayeredPane extends JComponent implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JList.java b/jdk/src/share/classes/javax/swing/JList.java
index 8088396fcc3..808f9780c3f 100644
--- a/jdk/src/share/classes/javax/swing/JList.java
+++ b/jdk/src/share/classes/javax/swing/JList.java
@@ -276,6 +276,7 @@ import static sun.swing.SwingUtilities2.Section.*;
  * description: A component which allows for the selection of one or more objects from a list.
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JList<E> extends JComponent implements Scrollable, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JMenu.java b/jdk/src/share/classes/javax/swing/JMenu.java
index a9cec084d7e..ea3b1b970d3 100644
--- a/jdk/src/share/classes/javax/swing/JMenu.java
+++ b/jdk/src/share/classes/javax/swing/JMenu.java
@@ -108,6 +108,7 @@ import java.lang.ref.WeakReference;
  * @see JSeparator
  * @see JMenuBar
  * @see JPopupMenu
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JMenu extends JMenuItem implements Accessible,MenuElement
diff --git a/jdk/src/share/classes/javax/swing/JMenuBar.java b/jdk/src/share/classes/javax/swing/JMenuBar.java
index 7c7cc541be9..4b4f6f91643 100644
--- a/jdk/src/share/classes/javax/swing/JMenuBar.java
+++ b/jdk/src/share/classes/javax/swing/JMenuBar.java
@@ -88,6 +88,7 @@ import javax.accessibility.*;
  * @see JMenu
  * @see JPopupMenu
  * @see JMenuItem
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JMenuBar extends JComponent implements Accessible,MenuElement
diff --git a/jdk/src/share/classes/javax/swing/JMenuItem.java b/jdk/src/share/classes/javax/swing/JMenuItem.java
index 4ee5b67bc43..f63dd709a3e 100644
--- a/jdk/src/share/classes/javax/swing/JMenuItem.java
+++ b/jdk/src/share/classes/javax/swing/JMenuItem.java
@@ -86,6 +86,7 @@ import javax.accessibility.*;
  * @see JMenu
  * @see JCheckBoxMenuItem
  * @see JRadioButtonMenuItem
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JMenuItem extends AbstractButton implements Accessible,MenuElement  {
diff --git a/jdk/src/share/classes/javax/swing/JOptionPane.java b/jdk/src/share/classes/javax/swing/JOptionPane.java
index 34bbdd2b320..77fab724208 100644
--- a/jdk/src/share/classes/javax/swing/JOptionPane.java
+++ b/jdk/src/share/classes/javax/swing/JOptionPane.java
@@ -310,6 +310,7 @@ import sun.awt.AWTAccessor;
  *
  * @author James Gosling
  * @author Scott Violet
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JOptionPane extends JComponent implements Accessible
diff --git a/jdk/src/share/classes/javax/swing/JPanel.java b/jdk/src/share/classes/javax/swing/JPanel.java
index 6211c8bcd29..293ca2237df 100644
--- a/jdk/src/share/classes/javax/swing/JPanel.java
+++ b/jdk/src/share/classes/javax/swing/JPanel.java
@@ -61,6 +61,7 @@ import java.io.IOException;
  *
  * @author Arnaud Weber
  * @author Steve Wilson
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JPanel extends JComponent implements Accessible
diff --git a/jdk/src/share/classes/javax/swing/JPasswordField.java b/jdk/src/share/classes/javax/swing/JPasswordField.java
index a869d80c1f0..82b6457e8ec 100644
--- a/jdk/src/share/classes/javax/swing/JPasswordField.java
+++ b/jdk/src/share/classes/javax/swing/JPasswordField.java
@@ -73,6 +73,7 @@ import java.util.Arrays;
  * description: Allows the editing of a line of text but doesn't show the characters.
  *
  * @author  Timothy Prinzing
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JPasswordField extends JTextField {
diff --git a/jdk/src/share/classes/javax/swing/JPopupMenu.java b/jdk/src/share/classes/javax/swing/JPopupMenu.java
index 4112de64db0..3f2a57323a5 100644
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java
@@ -82,6 +82,7 @@ import java.applet.Applet;
  * @author Georges Saab
  * @author David Karlton
  * @author Arnaud Weber
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JPopupMenu extends JComponent implements Accessible,MenuElement {
diff --git a/jdk/src/share/classes/javax/swing/JProgressBar.java b/jdk/src/share/classes/javax/swing/JProgressBar.java
index d8010e7b60b..5a3611131b8 100644
--- a/jdk/src/share/classes/javax/swing/JProgressBar.java
+++ b/jdk/src/share/classes/javax/swing/JProgressBar.java
@@ -128,6 +128,7 @@ import javax.swing.plaf.ProgressBarUI;
  *
  * @author Michael C. Albers
  * @author Kathy Walrath
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JProgressBar extends JComponent implements SwingConstants, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JRadioButton.java b/jdk/src/share/classes/javax/swing/JRadioButton.java
index cdc0329b55e..c5eaf6813bd 100644
--- a/jdk/src/share/classes/javax/swing/JRadioButton.java
+++ b/jdk/src/share/classes/javax/swing/JRadioButton.java
@@ -85,6 +85,7 @@ import java.io.IOException;
  * @see ButtonGroup
  * @see JCheckBox
  * @author Jeff Dinkins
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JRadioButton extends JToggleButton implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java b/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java
index c7acf05b847..e1c219b4037 100644
--- a/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java
+++ b/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java
@@ -82,6 +82,7 @@ import javax.accessibility.*;
  * @author Georges Saab
  * @author David Karlton
  * @see ButtonGroup
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JRadioButtonMenuItem extends JMenuItem implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JRootPane.java b/jdk/src/share/classes/javax/swing/JRootPane.java
index 8cab327305b..f9dea90da3e 100644
--- a/jdk/src/share/classes/javax/swing/JRootPane.java
+++ b/jdk/src/share/classes/javax/swing/JRootPane.java
@@ -197,6 +197,7 @@ import sun.security.action.GetBooleanAction;
  * Mixing Heavy and Light Components</a>
  *
  * @author David Kloba
+ * @since 1.2
  */
 /// PENDING(klobad) Who should be opaque in this component?
 @SuppressWarnings("serial")
diff --git a/jdk/src/share/classes/javax/swing/JScrollBar.java b/jdk/src/share/classes/javax/swing/JScrollBar.java
index f3001c017e5..230ba8081c7 100644
--- a/jdk/src/share/classes/javax/swing/JScrollBar.java
+++ b/jdk/src/share/classes/javax/swing/JScrollBar.java
@@ -77,6 +77,7 @@ import java.io.IOException;
  *    description: A component that helps determine the visible content range of an area.
  *
  * @author David Kloba
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JScrollBar extends JComponent implements Adjustable, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JScrollPane.java b/jdk/src/share/classes/javax/swing/JScrollPane.java
index 444a1c22526..373523e936e 100644
--- a/jdk/src/share/classes/javax/swing/JScrollPane.java
+++ b/jdk/src/share/classes/javax/swing/JScrollPane.java
@@ -167,6 +167,7 @@ import java.beans.Transient;
  *   description: A specialized container that manages a viewport, optional scrollbars and headers
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JScrollPane extends JComponent implements ScrollPaneConstants, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JSeparator.java b/jdk/src/share/classes/javax/swing/JSeparator.java
index 179c7fe91af..2614096679b 100644
--- a/jdk/src/share/classes/javax/swing/JSeparator.java
+++ b/jdk/src/share/classes/javax/swing/JSeparator.java
@@ -70,6 +70,7 @@ import java.io.IOException;
  *
  * @author Georges Saab
  * @author Jeff Shapiro
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JSeparator extends JComponent implements SwingConstants, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JSlider.java b/jdk/src/share/classes/javax/swing/JSlider.java
index d75e1030634..09129a479f0 100644
--- a/jdk/src/share/classes/javax/swing/JSlider.java
+++ b/jdk/src/share/classes/javax/swing/JSlider.java
@@ -77,6 +77,7 @@ import java.beans.*;
  *    description: A component that supports selecting a integer value from a range.
  *
  * @author David Kloba
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JSlider extends JComponent implements SwingConstants, Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JSplitPane.java b/jdk/src/share/classes/javax/swing/JSplitPane.java
index 533d9a971af..072fefd8d3a 100644
--- a/jdk/src/share/classes/javax/swing/JSplitPane.java
+++ b/jdk/src/share/classes/javax/swing/JSplitPane.java
@@ -97,6 +97,7 @@ import java.io.IOException;
  * @see #resetToPreferredSizes
  *
  * @author Scott Violet
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JSplitPane extends JComponent implements Accessible
diff --git a/jdk/src/share/classes/javax/swing/JTabbedPane.java b/jdk/src/share/classes/javax/swing/JTabbedPane.java
index e5c303489c6..c3b135ac85e 100644
--- a/jdk/src/share/classes/javax/swing/JTabbedPane.java
+++ b/jdk/src/share/classes/javax/swing/JTabbedPane.java
@@ -105,6 +105,7 @@ import java.io.IOException;
  * @author Amy Fowler
  *
  * @see SingleSelectionModel
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JTabbedPane extends JComponent
diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java
index 8d25315a03c..f4573926a95 100644
--- a/jdk/src/share/classes/javax/swing/JTable.java
+++ b/jdk/src/share/classes/javax/swing/JTable.java
@@ -212,6 +212,7 @@ import sun.swing.PrintingStatus;
  * @author Shannon Hickey (printing support)
  * @see javax.swing.table.DefaultTableModel
  * @see javax.swing.table.TableRowSorter
+ * @since 1.2
  */
 /* The first versions of the JTable, contained in Swing-0.1 through
  * Swing-0.4, were written by Alan Chung.
diff --git a/jdk/src/share/classes/javax/swing/JTextArea.java b/jdk/src/share/classes/javax/swing/JTextArea.java
index a6af9e241fa..96fb6b33e31 100644
--- a/jdk/src/share/classes/javax/swing/JTextArea.java
+++ b/jdk/src/share/classes/javax/swing/JTextArea.java
@@ -123,6 +123,7 @@ import java.io.IOException;
  * @author  Timothy Prinzing
  * @see JTextPane
  * @see JEditorPane
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JTextArea extends JTextComponent {
diff --git a/jdk/src/share/classes/javax/swing/JTextField.java b/jdk/src/share/classes/javax/swing/JTextField.java
index f50f6aa9be9..0e39cdbc955 100644
--- a/jdk/src/share/classes/javax/swing/JTextField.java
+++ b/jdk/src/share/classes/javax/swing/JTextField.java
@@ -160,6 +160,7 @@ import java.io.Serializable;
  * @see #setActionCommand
  * @see JPasswordField
  * @see #addActionListener
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JTextField extends JTextComponent implements SwingConstants {
diff --git a/jdk/src/share/classes/javax/swing/JTextPane.java b/jdk/src/share/classes/javax/swing/JTextPane.java
index 017f897177c..f9c2de42a65 100644
--- a/jdk/src/share/classes/javax/swing/JTextPane.java
+++ b/jdk/src/share/classes/javax/swing/JTextPane.java
@@ -78,6 +78,7 @@ import javax.swing.plaf.*;
  *
  * @author  Timothy Prinzing
  * @see javax.swing.text.StyledEditorKit
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JTextPane extends JEditorPane {
diff --git a/jdk/src/share/classes/javax/swing/JToggleButton.java b/jdk/src/share/classes/javax/swing/JToggleButton.java
index 60c6f0cdf48..08ec0be8659 100644
--- a/jdk/src/share/classes/javax/swing/JToggleButton.java
+++ b/jdk/src/share/classes/javax/swing/JToggleButton.java
@@ -75,6 +75,7 @@ import java.io.IOException;
  * @see JRadioButton
  * @see JCheckBox
  * @author Jeff Dinkins
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JToggleButton extends AbstractButton implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JToolBar.java b/jdk/src/share/classes/javax/swing/JToolBar.java
index 8229f1891da..6fff218430f 100644
--- a/jdk/src/share/classes/javax/swing/JToolBar.java
+++ b/jdk/src/share/classes/javax/swing/JToolBar.java
@@ -85,6 +85,7 @@ import java.util.Hashtable;
  * @author Georges Saab
  * @author Jeff Shapiro
  * @see Action
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JToolBar extends JComponent implements SwingConstants, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JToolTip.java b/jdk/src/share/classes/javax/swing/JToolTip.java
index e5409121421..dad092dc5fd 100644
--- a/jdk/src/share/classes/javax/swing/JToolTip.java
+++ b/jdk/src/share/classes/javax/swing/JToolTip.java
@@ -66,6 +66,7 @@ import java.util.Objects;
  * @see JComponent#createToolTip
  * @author Dave Moore
  * @author Rich Shiavi
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JToolTip extends JComponent implements Accessible {
diff --git a/jdk/src/share/classes/javax/swing/JTree.java b/jdk/src/share/classes/javax/swing/JTree.java
index f78fa5533b9..dcdf7a58946 100644
--- a/jdk/src/share/classes/javax/swing/JTree.java
+++ b/jdk/src/share/classes/javax/swing/JTree.java
@@ -141,6 +141,7 @@ import static sun.swing.SwingUtilities2.Section.*;
  * @author Rob Davis
  * @author Ray Ryan
  * @author Scott Violet
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JTree extends JComponent implements Scrollable, Accessible
diff --git a/jdk/src/share/classes/javax/swing/JViewport.java b/jdk/src/share/classes/javax/swing/JViewport.java
index 5b019699ee6..2875d95918d 100644
--- a/jdk/src/share/classes/javax/swing/JViewport.java
+++ b/jdk/src/share/classes/javax/swing/JViewport.java
@@ -97,6 +97,7 @@ import java.io.Serializable;
  * @author Hans Muller
  * @author Philip Milne
  * @see JScrollPane
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class JViewport extends JComponent implements Accessible
diff --git a/jdk/src/share/classes/javax/swing/JWindow.java b/jdk/src/share/classes/javax/swing/JWindow.java
index 4de51d23a5c..cf95a417fd5 100644
--- a/jdk/src/share/classes/javax/swing/JWindow.java
+++ b/jdk/src/share/classes/javax/swing/JWindow.java
@@ -89,6 +89,7 @@ import javax.accessibility.*;
  *    description: A toplevel window which has no system border or controls.
  *
  * @author David Kloba
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class JWindow extends Window implements Accessible,
diff --git a/jdk/src/share/classes/javax/swing/KeyStroke.java b/jdk/src/share/classes/javax/swing/KeyStroke.java
index e9f846c3d9c..24969f76aec 100644
--- a/jdk/src/share/classes/javax/swing/KeyStroke.java
+++ b/jdk/src/share/classes/javax/swing/KeyStroke.java
@@ -60,6 +60,7 @@ import java.awt.event.KeyEvent;
  *
  * @author Arnaud Weber
  * @author David Mendenhall
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class KeyStroke extends AWTKeyStroke {
diff --git a/jdk/src/share/classes/javax/swing/ListCellRenderer.java b/jdk/src/share/classes/javax/swing/ListCellRenderer.java
index 8f389412158..79cfa2ac348 100644
--- a/jdk/src/share/classes/javax/swing/ListCellRenderer.java
+++ b/jdk/src/share/classes/javax/swing/ListCellRenderer.java
@@ -85,6 +85,7 @@ import java.awt.Component;
  * @see DefaultListCellRenderer
  *
  * @author Hans Muller
+ * @since 1.2
  */
 public interface ListCellRenderer<E>
 {
diff --git a/jdk/src/share/classes/javax/swing/ListModel.java b/jdk/src/share/classes/javax/swing/ListModel.java
index 84d4b9025b5..231fa10b121 100644
--- a/jdk/src/share/classes/javax/swing/ListModel.java
+++ b/jdk/src/share/classes/javax/swing/ListModel.java
@@ -39,6 +39,7 @@ import javax.swing.event.ListDataListener;
  *
  * @author Hans Muller
  * @see JList
+ * @since 1.2
  */
 public interface ListModel<E>
 {
diff --git a/jdk/src/share/classes/javax/swing/ListSelectionModel.java b/jdk/src/share/classes/javax/swing/ListSelectionModel.java
index 82e1fe8499f..c4d91a4b50d 100644
--- a/jdk/src/share/classes/javax/swing/ListSelectionModel.java
+++ b/jdk/src/share/classes/javax/swing/ListSelectionModel.java
@@ -41,6 +41,7 @@ import javax.swing.event.*;
  * @author Hans Muller
  * @author Philip Milne
  * @see DefaultListSelectionModel
+ * @since 1.2
  */
 
 public interface ListSelectionModel
diff --git a/jdk/src/share/classes/javax/swing/LookAndFeel.java b/jdk/src/share/classes/javax/swing/LookAndFeel.java
index 16f4308f263..30c4c83dfc9 100644
--- a/jdk/src/share/classes/javax/swing/LookAndFeel.java
+++ b/jdk/src/share/classes/javax/swing/LookAndFeel.java
@@ -147,6 +147,7 @@ import java.util.StringTokenizer;
  *
  * @author Tom Ball
  * @author Hans Muller
+ * @since 1.2
  */
 public abstract class LookAndFeel
 {
diff --git a/jdk/src/share/classes/javax/swing/MenuElement.java b/jdk/src/share/classes/javax/swing/MenuElement.java
index 7141da85223..916811e08eb 100644
--- a/jdk/src/share/classes/javax/swing/MenuElement.java
+++ b/jdk/src/share/classes/javax/swing/MenuElement.java
@@ -33,6 +33,7 @@ import java.awt.event.*;
  * to handle selection and navigation in menu hierarchies.
  *
  * @author Arnaud Weber
+ * @since 1.2
  */
 
 public interface MenuElement {
diff --git a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java
index 67e35dc918e..8a691c1b9cd 100644
--- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java
+++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java
@@ -36,6 +36,7 @@ import sun.swing.SwingUtilities2;
  * A MenuSelectionManager owns the selection in menu hierarchy.
  *
  * @author Arnaud Weber
+ * @since 1.2
  */
 public class MenuSelectionManager {
     private Vector<MenuElement> selection = new Vector<MenuElement>();
diff --git a/jdk/src/share/classes/javax/swing/MutableComboBoxModel.java b/jdk/src/share/classes/javax/swing/MutableComboBoxModel.java
index 09fb03713fb..a98dea117a5 100644
--- a/jdk/src/share/classes/javax/swing/MutableComboBoxModel.java
+++ b/jdk/src/share/classes/javax/swing/MutableComboBoxModel.java
@@ -30,6 +30,7 @@ package javax.swing;
  * @param <E> the type of the elements of this model
  *
  * @author Tom Santos
+ * @since 1.2
  */
 
 public interface MutableComboBoxModel<E> extends ComboBoxModel<E> {
diff --git a/jdk/src/share/classes/javax/swing/OverlayLayout.java b/jdk/src/share/classes/javax/swing/OverlayLayout.java
index 6f3735cd50f..b62bb5faf17 100644
--- a/jdk/src/share/classes/javax/swing/OverlayLayout.java
+++ b/jdk/src/share/classes/javax/swing/OverlayLayout.java
@@ -50,6 +50,7 @@ import java.io.Serializable;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author   Timothy Prinzing
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class OverlayLayout implements LayoutManager2,Serializable {
diff --git a/jdk/src/share/classes/javax/swing/Painter.java b/jdk/src/share/classes/javax/swing/Painter.java
index bd1b5a19d31..946819313cb 100644
--- a/jdk/src/share/classes/javax/swing/Painter.java
+++ b/jdk/src/share/classes/javax/swing/Painter.java
@@ -59,6 +59,7 @@ import java.awt.Graphics2D;
  * <p>This interface makes no guarantees of threadsafety.</p>
  *
  * @author rbair
+ * @since 1.7
  */
 public interface Painter<T> {
     /**
diff --git a/jdk/src/share/classes/javax/swing/ProgressMonitor.java b/jdk/src/share/classes/javax/swing/ProgressMonitor.java
index 889f30d734a..506b443b4f5 100644
--- a/jdk/src/share/classes/javax/swing/ProgressMonitor.java
+++ b/jdk/src/share/classes/javax/swing/ProgressMonitor.java
@@ -77,6 +77,7 @@ import javax.swing.text.*;
  * @see ProgressMonitorInputStream
  * @author James Gosling
  * @author Lynn Monsanto (accessibility)
+ * @since 1.2
  */
 public class ProgressMonitor implements Accessible
 {
diff --git a/jdk/src/share/classes/javax/swing/ProgressMonitorInputStream.java b/jdk/src/share/classes/javax/swing/ProgressMonitorInputStream.java
index 67fc068d15e..3edb0e1f35b 100644
--- a/jdk/src/share/classes/javax/swing/ProgressMonitorInputStream.java
+++ b/jdk/src/share/classes/javax/swing/ProgressMonitorInputStream.java
@@ -60,6 +60,7 @@ import java.awt.Component;
  * @see ProgressMonitor
  * @see JOptionPane
  * @author James Gosling
+ * @since 1.2
  */
 public class ProgressMonitorInputStream extends FilterInputStream
 {
diff --git a/jdk/src/share/classes/javax/swing/Renderer.java b/jdk/src/share/classes/javax/swing/Renderer.java
index e0c3d78305e..41203f29493 100644
--- a/jdk/src/share/classes/javax/swing/Renderer.java
+++ b/jdk/src/share/classes/javax/swing/Renderer.java
@@ -32,6 +32,7 @@ import java.awt.Component;
  * "rendering" (displaying) a value.
  *
  * @author Arnaud Weber
+ * @since 1.2
  */
 public interface Renderer {
     /**
diff --git a/jdk/src/share/classes/javax/swing/RepaintManager.java b/jdk/src/share/classes/javax/swing/RepaintManager.java
index 6e3def5ae99..c1340d17c5b 100644
--- a/jdk/src/share/classes/javax/swing/RepaintManager.java
+++ b/jdk/src/share/classes/javax/swing/RepaintManager.java
@@ -60,6 +60,7 @@ import sun.swing.SwingUtilities2.RepaintListener;
  * appropriate <code>addDirtyRegion</code> method.
  *
  * @author Arnaud Weber
+ * @since 1.2
  */
 public class RepaintManager
 {
diff --git a/jdk/src/share/classes/javax/swing/RootPaneContainer.java b/jdk/src/share/classes/javax/swing/RootPaneContainer.java
index cd000b07ef2..76dc2286f87 100644
--- a/jdk/src/share/classes/javax/swing/RootPaneContainer.java
+++ b/jdk/src/share/classes/javax/swing/RootPaneContainer.java
@@ -77,6 +77,7 @@ import java.awt.Container;
  * @see JInternalFrame
  *
  * @author Hans Muller
+ * @since 1.2
  */
 public interface RootPaneContainer
 {
diff --git a/jdk/src/share/classes/javax/swing/ScrollPaneConstants.java b/jdk/src/share/classes/javax/swing/ScrollPaneConstants.java
index 6fef77a1b4b..4f8c66f4ec6 100644
--- a/jdk/src/share/classes/javax/swing/ScrollPaneConstants.java
+++ b/jdk/src/share/classes/javax/swing/ScrollPaneConstants.java
@@ -30,6 +30,7 @@ package javax.swing;
  * Constants used with the JScrollPane component.
  *
  * @author Hans Muller
+ * @since 1.2
  */
 public interface ScrollPaneConstants
 {
diff --git a/jdk/src/share/classes/javax/swing/ScrollPaneLayout.java b/jdk/src/share/classes/javax/swing/ScrollPaneLayout.java
index 69b103f7c42..4d353253a3c 100644
--- a/jdk/src/share/classes/javax/swing/ScrollPaneLayout.java
+++ b/jdk/src/share/classes/javax/swing/ScrollPaneLayout.java
@@ -56,6 +56,7 @@ import java.io.Serializable;
  * @see JViewport
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class ScrollPaneLayout
diff --git a/jdk/src/share/classes/javax/swing/Scrollable.java b/jdk/src/share/classes/javax/swing/Scrollable.java
index cf2214bdbd2..c5956367fe6 100644
--- a/jdk/src/share/classes/javax/swing/Scrollable.java
+++ b/jdk/src/share/classes/javax/swing/Scrollable.java
@@ -39,6 +39,7 @@ import java.awt.Rectangle;
  * @see JScrollPane
  * @see JScrollBar
  * @author Hans Muller
+ * @since 1.2
  */
 public interface Scrollable
 {
diff --git a/jdk/src/share/classes/javax/swing/SingleSelectionModel.java b/jdk/src/share/classes/javax/swing/SingleSelectionModel.java
index becefe7c029..251b7c1d7e2 100644
--- a/jdk/src/share/classes/javax/swing/SingleSelectionModel.java
+++ b/jdk/src/share/classes/javax/swing/SingleSelectionModel.java
@@ -31,6 +31,7 @@ import javax.swing.event.*;
  * A model that supports at most one indexed selection.
  *
  * @author Dave Moore
+ * @since 1.2
  */
 public interface SingleSelectionModel {
     /**
diff --git a/jdk/src/share/classes/javax/swing/SizeRequirements.java b/jdk/src/share/classes/javax/swing/SizeRequirements.java
index d4a590bfd0f..a592ef6b563 100644
--- a/jdk/src/share/classes/javax/swing/SizeRequirements.java
+++ b/jdk/src/share/classes/javax/swing/SizeRequirements.java
@@ -92,6 +92,7 @@ import java.io.Serializable;
  * @see Component#getAlignmentY
  *
  * @author Timothy Prinzing
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class SizeRequirements implements Serializable {
diff --git a/jdk/src/share/classes/javax/swing/SwingConstants.java b/jdk/src/share/classes/javax/swing/SwingConstants.java
index 1865fec54bf..390d2e6b828 100644
--- a/jdk/src/share/classes/javax/swing/SwingConstants.java
+++ b/jdk/src/share/classes/javax/swing/SwingConstants.java
@@ -31,6 +31,7 @@ package javax.swing;
  *
  * @author Jeff Dinkins
  * @author Ralph Kar (orientation support)
+ * @since 1.2
  */
 public interface SwingConstants {
 
diff --git a/jdk/src/share/classes/javax/swing/SwingUtilities.java b/jdk/src/share/classes/javax/swing/SwingUtilities.java
index 99c4d8b0d67..fb7b2820fd2 100644
--- a/jdk/src/share/classes/javax/swing/SwingUtilities.java
+++ b/jdk/src/share/classes/javax/swing/SwingUtilities.java
@@ -49,6 +49,7 @@ import sun.awt.AppContext;
  * A collection of utility methods for Swing.
  *
  * @author unknown
+ * @since 1.2
  */
 public class SwingUtilities implements SwingConstants
 {
diff --git a/jdk/src/share/classes/javax/swing/Timer.java b/jdk/src/share/classes/javax/swing/Timer.java
index 5ef34add10e..2c25598b88c 100644
--- a/jdk/src/share/classes/javax/swing/Timer.java
+++ b/jdk/src/share/classes/javax/swing/Timer.java
@@ -145,6 +145,7 @@ import javax.swing.event.EventListenerList;
  *
  *
  * @author Dave Moore
+ * @since 1.2
  */
 @SuppressWarnings("serial")
 public class Timer implements Serializable
diff --git a/jdk/src/share/classes/javax/swing/ToolTipManager.java b/jdk/src/share/classes/javax/swing/ToolTipManager.java
index 6a3954f7ecc..b127284be09 100644
--- a/jdk/src/share/classes/javax/swing/ToolTipManager.java
+++ b/jdk/src/share/classes/javax/swing/ToolTipManager.java
@@ -49,6 +49,7 @@ import java.awt.*;
  * @see JComponent#createToolTip
  * @author Dave Moore
  * @author Rich Schiavi
+ * @since 1.2
  */
 public class ToolTipManager extends MouseAdapter implements MouseMotionListener  {
     Timer enterTimer, exitTimer, insideTimer;
diff --git a/jdk/src/share/classes/javax/swing/UIDefaults.java b/jdk/src/share/classes/javax/swing/UIDefaults.java
index b6797bd232f..257c5e71a22 100644
--- a/jdk/src/share/classes/javax/swing/UIDefaults.java
+++ b/jdk/src/share/classes/javax/swing/UIDefaults.java
@@ -71,6 +71,7 @@ import sun.util.CoreResourceBundleControl;
  *
  * @see UIManager
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class UIDefaults extends Hashtable<Object,Object>
diff --git a/jdk/src/share/classes/javax/swing/UIManager.java b/jdk/src/share/classes/javax/swing/UIManager.java
index 026f8a7b80f..951d0f6c239 100644
--- a/jdk/src/share/classes/javax/swing/UIManager.java
+++ b/jdk/src/share/classes/javax/swing/UIManager.java
@@ -173,6 +173,7 @@ import sun.awt.AWTAccessor;
  *
  * @author Thomas Ball
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class UIManager implements Serializable
diff --git a/jdk/src/share/classes/javax/swing/UnsupportedLookAndFeelException.java b/jdk/src/share/classes/javax/swing/UnsupportedLookAndFeelException.java
index 07b8e18c6ff..e28166cd2db 100644
--- a/jdk/src/share/classes/javax/swing/UnsupportedLookAndFeelException.java
+++ b/jdk/src/share/classes/javax/swing/UnsupportedLookAndFeelException.java
@@ -38,6 +38,7 @@ package javax.swing;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author unattributed
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class UnsupportedLookAndFeelException extends Exception
diff --git a/jdk/src/share/classes/javax/swing/ViewportLayout.java b/jdk/src/share/classes/javax/swing/ViewportLayout.java
index 2aa83bede3e..f2a01f0771b 100644
--- a/jdk/src/share/classes/javax/swing/ViewportLayout.java
+++ b/jdk/src/share/classes/javax/swing/ViewportLayout.java
@@ -55,6 +55,7 @@ import java.io.Serializable;
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author Hans Muller
+ * @since 1.2
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class ViewportLayout implements LayoutManager, Serializable
diff --git a/jdk/src/share/classes/javax/swing/WindowConstants.java b/jdk/src/share/classes/javax/swing/WindowConstants.java
index 6b1fdb3c15b..9ed3eb84628 100644
--- a/jdk/src/share/classes/javax/swing/WindowConstants.java
+++ b/jdk/src/share/classes/javax/swing/WindowConstants.java
@@ -44,6 +44,7 @@ package javax.swing;
  *
  *
  * @author Amy Fowler
+ * @since 1.2
  */
 public interface WindowConstants
 {
-- 
GitLab


From 7ae9df8697cae73952af9a023aeb519c520af1c8 Mon Sep 17 00:00:00 2001
From: Igor Veresov <iveresov@openjdk.org>
Date: Wed, 18 Jun 2014 10:54:32 -0700
Subject: [PATCH 106/192] 8046684:
 sharedRuntime.cpp...assert(((nmethod*)cb)->is_at_poll_or_poll_return(pc))
 failed: safepoint polling: type must be poll

Emit a poll relocation for the testl in is_polling_page_far() on x86

Reviewed-by: vlivanov, roland
---
 hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
index b9702a35e41..62bb56fe97f 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
@@ -625,6 +625,7 @@ int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
     __ lea(rscratch1, polling_page);
     offset = __ offset();
     add_debug_info_for_branch(info);
+    __ relocate(relocInfo::poll_type);
     __ testl(rax, Address(rscratch1, 0));
   } else {
     add_debug_info_for_branch(info);
-- 
GitLab


From cef2b3be11ec6e8c9adfcafea46f6ae347685737 Mon Sep 17 00:00:00 2001
From: Coleen Phillimore <coleenp@openjdk.org>
Date: Wed, 18 Jun 2014 13:58:13 -0400
Subject: [PATCH 107/192] 8039150: host_klass invariant fails when verifying
 newly loaded JSR-292 anonymous classes

Initialize host_klass while parsing the class with the other initializations.

Reviewed-by: sspitsyn, stefank
---
 hotspot/src/share/vm/classfile/classFileParser.cpp  | 5 +++++
 hotspot/src/share/vm/classfile/systemDictionary.cpp | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index d72a50cbb52..3ea6d0c9aee 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -4070,6 +4070,11 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
     this_klass->set_major_version(major_version);
     this_klass->set_has_default_methods(has_default_methods);
 
+    if (!host_klass.is_null()) {
+      assert (this_klass->is_anonymous(), "should be the same");
+      this_klass->set_host_klass(host_klass());
+    }
+
     // Set up Method*::intrinsic_id as soon as we know the names of methods.
     // (We used to do this lazily, but now we query it in Rewriter,
     // which is eagerly done for every method, so we might as well do it now,
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index 9a6fa98908b..4a6e1c3e377 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -997,7 +997,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name,
 
 
   if (host_klass.not_null() && k.not_null()) {
-    k->set_host_klass(host_klass());
     // If it's anonymous, initialize it now, since nobody else will.
 
     {
-- 
GitLab


From 9110c16bd91c36e2afe4fb29008aea46842a3508 Mon Sep 17 00:00:00 2001
From: David Dehaven <ddehaven@openjdk.org>
Date: Wed, 18 Jun 2014 12:52:13 -0700
Subject: [PATCH 108/192] 8043340: [macosx] Fix hard-wired paths to
 JavaVM.framework

Build system tweaks to allow building with Xcode 5 and on OS X 10.9 and later

Reviewed-by: erikj, henryjen, dholmes
---
 common/autoconf/basics.m4              |  71 +++++++-
 common/autoconf/flags.m4               |  41 +++--
 common/autoconf/generated-configure.sh | 227 ++++++++++++++++++-------
 common/autoconf/libraries.m4           |  16 --
 common/autoconf/spec.gmk.in            |   5 +-
 common/autoconf/toolchain.m4           |  33 ++--
 6 files changed, 282 insertions(+), 111 deletions(-)

diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4
index 649f8ddfc29..00ee498ed82 100644
--- a/common/autoconf/basics.m4
+++ b/common/autoconf/basics.m4
@@ -512,7 +512,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
   )
 
   AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
-      [use this directory as sysroot)])],
+      [use this directory as sysroot])],
       [SYSROOT=$with_sysroot]
   )
 
@@ -531,6 +531,75 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
       [BASIC_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
   )
 
+  if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
+    # detect if Xcode is installed by running xcodebuild -version
+    # if no Xcode installed, xcodebuild exits with 1
+    # if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
+    if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
+      # We need to use xcodebuild in the toolchain dir provided by the user, this will
+      # fall back on the stub binary in /usr/bin/xcodebuild
+      AC_PATH_PROG([XCODEBUILD], [xcodebuild], [/usr/bin/xcodebuild], [$TOOLCHAIN_PATH])
+    else
+      # this should result in SYSROOT being empty, unless --with-sysroot is provided
+      # when only the command line tools are installed there are no SDKs, so headers
+      # are copied into the system frameworks
+      XCODEBUILD=
+      AC_SUBST(XCODEBUILD)
+    fi
+  
+    AC_MSG_CHECKING([for sdk name])
+    AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name],
+        [use the platform SDK of the given name. @<:@macosx@:>@])],
+        [SDKNAME=$with_sdk_name]
+    )
+    AC_MSG_RESULT([$SDKNAME])
+
+    # if toolchain path is specified then don't rely on system headers, they may not compile
+    HAVE_SYSTEM_FRAMEWORK_HEADERS=0
+    test -z "$TOOLCHAIN_PATH" && \
+      HAVE_SYSTEM_FRAMEWORK_HEADERS=`test ! -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; echo $?`
+
+    if test -z "$SYSROOT"; then
+      if test -n "$XCODEBUILD"; then
+        # if we don't have system headers, use default SDK name (last resort)
+        if test -z "$SDKNAME" -a $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          SDKNAME=${SDKNAME:-macosx}
+        fi
+
+        if test -n "$SDKNAME"; then
+          # Call xcodebuild to determine SYSROOT
+          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+        fi
+      else
+        if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          AC_MSG_ERROR([No xcodebuild tool and no system framework headers found, use --with-sysroot or --with-sdk-name to provide a path to a valid SDK])
+        fi
+      fi
+    else
+      # warn user if --with-sdk-name was also set
+      if test -n "$with_sdk_name"; then
+        AC_MSG_WARN([Both SYSROOT and --with-sdk-name are set, only SYSROOT will be used])
+      fi
+    fi
+
+    if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0 -a -z "$SYSROOT"; then
+      # If no system framework headers, then SYSROOT must be set, or we won't build
+      AC_MSG_ERROR([Unable to determine SYSROOT and no headers found in /System/Library/Frameworks. Check Xcode configuration, --with-sysroot or --with-sdk-name arguments.])
+    fi
+
+    # Perform a basic sanity test
+    if test ! -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
+      if test -z "$SYSROOT"; then
+        AC_MSG_ERROR([Unable to find required framework headers, provide a path to an SDK via --with-sysroot or --with-sdk-name and be sure Xcode is installed properly])
+      else
+        AC_MSG_ERROR([Invalid SDK or SYSROOT path, dependent framework headers not found])
+      fi
+    fi
+
+    # set SDKROOT too, Xcode tools will pick it up
+    AC_SUBST(SDKROOT,$SYSROOT)
+  fi
+
   # Prepend the extra path to the global path
   BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
 
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index 95fa6521575..40f60a9c85d 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -131,6 +131,10 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
             -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
             -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
       fi
+    elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
+      # Apple only wants -isysroot <path>, but we also need -iframework<path>/System/Library/Frameworks
+      SYSROOT_CFLAGS="-isysroot \"$SYSROOT\" -iframework\"$SYSROOT/System/Library/Frameworks\""
+      SYSROOT_LDFLAGS=$SYSROOT_CFLAGS
     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
       SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\""
       SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\""
@@ -143,6 +147,14 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
     LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS"
     LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
   fi
+
+  # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
+  # set this here so it doesn't have to be peppered throughout the forest
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    SYSROOT_CFLAGS="$SYSROOT_CFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+    SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+  fi
+
   AC_SUBST(SYSROOT_CFLAGS)
   AC_SUBST(SYSROOT_LDFLAGS)
 ])
@@ -644,23 +656,18 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
 
   # Additional macosx handling
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    if test "x$TOOLCHAIN_TYPE" = xgcc; then
-      # FIXME: This needs to be exported in spec.gmk due to closed legacy code.
-      # FIXME: clean this up, and/or move it elsewhere.
-
-      # Setting these parameters makes it an error to link to macosx APIs that are
-      # newer than the given OS version and makes the linked binaries compatible
-      # even if built on a newer version of the OS.
-      # The expected format is X.Y.Z
-      MACOSX_VERSION_MIN=10.7.0
-      AC_SUBST(MACOSX_VERSION_MIN)
-
-      # The macro takes the version with no dots, ex: 1070
-      # Let the flags variables get resolved in make for easier override on make
-      # command line.
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-      LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-    fi
+    # Setting these parameters makes it an error to link to macosx APIs that are
+    # newer than the given OS version and makes the linked binaries compatible
+    # even if built on a newer version of the OS.
+    # The expected format is X.Y.Z
+    MACOSX_VERSION_MIN=10.7.0
+    AC_SUBST(MACOSX_VERSION_MIN)
+
+    # The macro takes the version with no dots, ex: 1070
+    # Let the flags variables get resolved in make for easier override on make
+    # command line.
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
+    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
   fi
 
   # Setup some hard coded includes
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 4d95f64e34d..4299e53d566 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -874,6 +874,8 @@ PKGHANDLER
 OUTPUT_ROOT
 CONF_NAME
 SPEC
+SDKROOT
+XCODEBUILD
 BUILD_VARIANT_RELEASE
 DEBUG_CLASSFILES
 FASTDEBUG
@@ -1040,6 +1042,7 @@ with_sysroot
 with_tools_dir
 with_toolchain_path
 with_extra_path
+with_sdk_name
 with_conf_name
 with_builddeps_conf
 with_builddeps_server
@@ -1074,7 +1077,6 @@ with_extra_cxxflags
 with_extra_ldflags
 enable_debug_symbols
 enable_zip_debug_info
-enable_macosx_runtime_support
 with_x
 with_cups
 with_cups_include
@@ -1841,9 +1843,6 @@ Optional Features:
   --disable-debug-symbols disable generation of debug symbols [enabled]
   --disable-zip-debug-info
                           disable zipping of debug-info files [enabled]
-  --enable-macosx-runtime-support
-                          Deprecated. Option is kept for backwards
-                          compatibility and is ignored
   --disable-freetype-bundling
                           disable bundling of the freetype library with the
                           build result [enabled on Windows or when using
@@ -1872,12 +1871,13 @@ Optional Packages:
                           optimized (HotSpot build only)) [release]
   --with-devkit           use this devkit for compilers, tools and resources
   --with-sys-root         alias for --with-sysroot for backwards compatability
-  --with-sysroot          use this directory as sysroot)
+  --with-sysroot          use this directory as sysroot
   --with-tools-dir        alias for --with-toolchain-path for backwards
                           compatibility
   --with-toolchain-path   prepend these directories when searching for
                           toolchain binaries (compilers etc)
   --with-extra-path       prepend these directories to the default path
+  --with-sdk-name         use the platform SDK of the given name. [macosx]
   --with-conf-name        use this as the name of the configuration [generated
                           from important configuration options]
   --with-builddeps-conf   use this configuration file for the builddeps
@@ -4308,7 +4308,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1402614845
+DATE_WHEN_GENERATED=1403110135
 
 ###############################################################################
 #
@@ -14968,6 +14968,122 @@ if test "${with_extra_path+set}" = set; then :
 fi
 
 
+  if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
+    # detect if Xcode is installed by running xcodebuild -version
+    # if no Xcode installed, xcodebuild exits with 1
+    # if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
+    if /usr/bin/xcodebuild -version >/dev/null 2>&1; then
+      # We need to use xcodebuild in the toolchain dir provided by the user, this will
+      # fall back on the stub binary in /usr/bin/xcodebuild
+      # Extract the first word of "xcodebuild", so it can be a program name with args.
+set dummy xcodebuild; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XCODEBUILD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XCODEBUILD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XCODEBUILD="$XCODEBUILD" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $TOOLCHAIN_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XCODEBUILD="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XCODEBUILD" && ac_cv_path_XCODEBUILD="/usr/bin/xcodebuild"
+  ;;
+esac
+fi
+XCODEBUILD=$ac_cv_path_XCODEBUILD
+if test -n "$XCODEBUILD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XCODEBUILD" >&5
+$as_echo "$XCODEBUILD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    else
+      # this should result in SYSROOT being empty, unless --with-sysroot is provided
+      # when only the command line tools are installed there are no SDKs, so headers
+      # are copied into the system frameworks
+      XCODEBUILD=
+
+    fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdk name" >&5
+$as_echo_n "checking for sdk name... " >&6; }
+
+# Check whether --with-sdk-name was given.
+if test "${with_sdk_name+set}" = set; then :
+  withval=$with_sdk_name; SDKNAME=$with_sdk_name
+
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDKNAME" >&5
+$as_echo "$SDKNAME" >&6; }
+
+    # if toolchain path is specified then don't rely on system headers, they may not compile
+    HAVE_SYSTEM_FRAMEWORK_HEADERS=0
+    test -z "$TOOLCHAIN_PATH" && \
+      HAVE_SYSTEM_FRAMEWORK_HEADERS=`test ! -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; echo $?`
+
+    if test -z "$SYSROOT"; then
+      if test -n "$XCODEBUILD"; then
+        # if we don't have system headers, use default SDK name (last resort)
+        if test -z "$SDKNAME" -a $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          SDKNAME=${SDKNAME:-macosx}
+        fi
+
+        if test -n "$SDKNAME"; then
+          # Call xcodebuild to determine SYSROOT
+          SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+        fi
+      else
+        if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
+          as_fn_error $? "No xcodebuild tool and no system framework headers found, use --with-sysroot or --with-sdk-name to provide a path to a valid SDK" "$LINENO" 5
+        fi
+      fi
+    else
+      # warn user if --with-sdk-name was also set
+      if test -n "$with_sdk_name"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Both SYSROOT and --with-sdk-name are set, only SYSROOT will be used" >&5
+$as_echo "$as_me: WARNING: Both SYSROOT and --with-sdk-name are set, only SYSROOT will be used" >&2;}
+      fi
+    fi
+
+    if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0 -a -z "$SYSROOT"; then
+      # If no system framework headers, then SYSROOT must be set, or we won't build
+      as_fn_error $? "Unable to determine SYSROOT and no headers found in /System/Library/Frameworks. Check Xcode configuration, --with-sysroot or --with-sdk-name arguments." "$LINENO" 5
+    fi
+
+    # Perform a basic sanity test
+    if test ! -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
+      if test -z "$SYSROOT"; then
+        as_fn_error $? "Unable to find required framework headers, provide a path to an SDK via --with-sysroot or --with-sdk-name and be sure Xcode is installed properly" "$LINENO" 5
+      else
+        as_fn_error $? "Invalid SDK or SYSROOT path, dependent framework headers not found" "$LINENO" 5
+      fi
+    fi
+
+    # set SDKROOT too, Xcode tools will pick it up
+    SDKROOT=$SYSROOT
+
+  fi
+
   # Prepend the extra path to the global path
 
   if test "x$EXTRA_PATH" != x; then
@@ -26596,21 +26712,28 @@ fi
   VALID_TOOLCHAINS=${!toolchain_var_name}
 
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    # On Mac OS X, default toolchain to clang after Xcode 5
-    XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
-    $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
-    if test $? -ne 0; then
-      as_fn_error $? "Failed to determine Xcode version." "$LINENO" 5
-    fi
-    XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
-        $SED -e 's/^Xcode \([1-9][0-9.]*\)/\1/' | \
-        $CUT -f 1 -d .`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Xcode major version: $XCODE_MAJOR_VERSION" >&5
+    if test -n "$XCODEBUILD"; then
+      # On Mac OS X, default toolchain to clang after Xcode 5
+      XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $HEAD -n 1`
+      $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
+      if test $? -ne 0; then
+        as_fn_error $? "Failed to determine Xcode version." "$LINENO" 5
+      fi
+      XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
+          $SED -e 's/^Xcode \([1-9][0-9.]*\)/\1/' | \
+          $CUT -f 1 -d .`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Xcode major version: $XCODE_MAJOR_VERSION" >&5
 $as_echo "$as_me: Xcode major version: $XCODE_MAJOR_VERSION" >&6;}
-    if test $XCODE_MAJOR_VERSION -ge 5; then
-        DEFAULT_TOOLCHAIN="clang"
+      if test $XCODE_MAJOR_VERSION -ge 5; then
+          DEFAULT_TOOLCHAIN="clang"
+      else
+          DEFAULT_TOOLCHAIN="gcc"
+      fi
     else
-        DEFAULT_TOOLCHAIN="gcc"
+      # If Xcode is not installed, but the command line tools are
+      # then we can't run xcodebuild. On these systems we should
+      # default to clang
+      DEFAULT_TOOLCHAIN="clang"
     fi
   else
     # First toolchain type in the list is the default
@@ -41076,6 +41199,10 @@ $as_echo "$tool_specified" >&6; }
             -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
             -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
       fi
+    elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
+      # Apple only wants -isysroot <path>, but we also need -iframework<path>/System/Library/Frameworks
+      SYSROOT_CFLAGS="-isysroot \"$SYSROOT\" -iframework\"$SYSROOT/System/Library/Frameworks\""
+      SYSROOT_LDFLAGS=$SYSROOT_CFLAGS
     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
       SYSROOT_CFLAGS="--sysroot=\"$SYSROOT\""
       SYSROOT_LDFLAGS="--sysroot=\"$SYSROOT\""
@@ -41089,6 +41216,14 @@ $as_echo "$tool_specified" >&6; }
     LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
   fi
 
+  # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
+  # set this here so it doesn't have to be peppered throughout the forest
+  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+    SYSROOT_CFLAGS="$SYSROOT_CFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+    SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -F\"$SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks\""
+  fi
+
+
 
 
 
@@ -42135,23 +42270,18 @@ fi
 
   # Additional macosx handling
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    if test "x$TOOLCHAIN_TYPE" = xgcc; then
-      # FIXME: This needs to be exported in spec.gmk due to closed legacy code.
-      # FIXME: clean this up, and/or move it elsewhere.
-
-      # Setting these parameters makes it an error to link to macosx APIs that are
-      # newer than the given OS version and makes the linked binaries compatible
-      # even if built on a newer version of the OS.
-      # The expected format is X.Y.Z
-      MACOSX_VERSION_MIN=10.7.0
+    # Setting these parameters makes it an error to link to macosx APIs that are
+    # newer than the given OS version and makes the linked binaries compatible
+    # even if built on a newer version of the OS.
+    # The expected format is X.Y.Z
+    MACOSX_VERSION_MIN=10.7.0
 
 
-      # The macro takes the version with no dots, ex: 1070
-      # Let the flags variables get resolved in make for easier override on make
-      # command line.
-      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-      LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
-    fi
+    # The macro takes the version with no dots, ex: 1070
+    # Let the flags variables get resolved in make for easier override on make
+    # command line.
+    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
+    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
   fi
 
   # Setup some hard coded includes
@@ -42654,8 +42784,6 @@ $as_echo_n "checking what is not needed on MacOSX?... " >&6; }
     ALSA_NOT_NEEDED=yes
     PULSE_NOT_NEEDED=yes
     X11_NOT_NEEDED=yes
-    # If the java runtime framework is disabled, then we need X11.
-    # This will be adjusted below.
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: alsa pulse x11" >&5
 $as_echo "alsa pulse x11" >&6; }
   fi
@@ -42676,33 +42804,6 @@ $as_echo "alsa" >&6; }
     X11_NOT_NEEDED=yes
   fi
 
-  ###############################################################################
-  #
-  # Check for MacOSX support for OpenJDK.
-  #
-
-
-  # Check whether --enable-macosx-runtime-support was given.
-if test "${enable_macosx_runtime_support+set}" = set; then :
-  enableval=$enable_macosx_runtime_support;
-fi
-
-  if test "x$enable_macosx_runtime_support" != x; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --enable-macosx-runtime-support is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --enable-macosx-runtime-support is deprecated and will be ignored." >&2;}
-  fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mac OS X Java Framework" >&5
-$as_echo_n "checking for Mac OS X Java Framework... " >&6; }
-  if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: /System/Library/Frameworks/JavaVM.framework" >&5
-$as_echo "/System/Library/Frameworks/JavaVM.framework" >&6; }
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  fi
-
 
 
   ###############################################################################
diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4
index 6ee3221ad96..833efa63e74 100644
--- a/common/autoconf/libraries.m4
+++ b/common/autoconf/libraries.m4
@@ -65,8 +65,6 @@ AC_DEFUN_ONCE([LIB_SETUP_INIT],
     ALSA_NOT_NEEDED=yes
     PULSE_NOT_NEEDED=yes
     X11_NOT_NEEDED=yes
-    # If the java runtime framework is disabled, then we need X11.
-    # This will be adjusted below.
     AC_MSG_RESULT([alsa pulse x11])
   fi
 
@@ -83,20 +81,6 @@ AC_DEFUN_ONCE([LIB_SETUP_INIT],
   if test "x$SUPPORT_HEADFUL" = xno; then
     X11_NOT_NEEDED=yes
   fi
-
-  ###############################################################################
-  #
-  # Check for MacOSX support for OpenJDK.
-  #
-
-  BASIC_DEPRECATED_ARG_ENABLE(macosx-runtime-support, macosx_runtime_support)
-
-  AC_MSG_CHECKING([for Mac OS X Java Framework])
-  if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
-    AC_MSG_RESULT([/System/Library/Frameworks/JavaVM.framework])
-  else
-    AC_MSG_RESULT([no])
-  fi
 ])
 
 AC_DEFUN_ONCE([LIB_SETUP_X11],
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 2f6d7bd3746..bc916f636c3 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -347,6 +347,9 @@ CPP:=@FIXPATH@ @CPP@
 # The linker can be gcc or ld on posix systems, or link.exe on windows systems.
 LD:=@FIXPATH@ @LD@
 
+# Xcode SDK path
+SDKROOT:=@SDKROOT@
+
 # The linker on older SuSE distros (e.g. on SLES 10) complains with:
 # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
 # if feeded with a version script which contains named tags.
@@ -544,7 +547,7 @@ SETFILE:=@SETFILE@
 XATTR:=@XATTR@
 JT_HOME:=@JT_HOME@
 JTREGEXE:=@JTREGEXE@
-
+XCODEBUILD=@XCODEBUILD@
 FIXPATH:=@FIXPATH@
 
 # Where the build output is stored for your convenience.
diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
index 4686517151b..f380bf446ad 100644
--- a/common/autoconf/toolchain.m4
+++ b/common/autoconf/toolchain.m4
@@ -98,20 +98,27 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
   VALID_TOOLCHAINS=${!toolchain_var_name}
 
   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    # On Mac OS X, default toolchain to clang after Xcode 5
-    XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
-    $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
-    if test $? -ne 0; then
-      AC_MSG_ERROR([Failed to determine Xcode version.])
-    fi
-    XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
-        $SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
-        $CUT -f 1 -d .`
-    AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
-    if test $XCODE_MAJOR_VERSION -ge 5; then
-        DEFAULT_TOOLCHAIN="clang"
+    if test -n "$XCODEBUILD"; then
+      # On Mac OS X, default toolchain to clang after Xcode 5
+      XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $HEAD -n 1`
+      $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
+      if test $? -ne 0; then
+        AC_MSG_ERROR([Failed to determine Xcode version.])
+      fi
+      XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
+          $SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
+          $CUT -f 1 -d .`
+      AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
+      if test $XCODE_MAJOR_VERSION -ge 5; then
+          DEFAULT_TOOLCHAIN="clang"
+      else
+          DEFAULT_TOOLCHAIN="gcc"
+      fi
     else
-        DEFAULT_TOOLCHAIN="gcc"
+      # If Xcode is not installed, but the command line tools are
+      # then we can't run xcodebuild. On these systems we should
+      # default to clang
+      DEFAULT_TOOLCHAIN="clang"
     fi
   else
     # First toolchain type in the list is the default
-- 
GitLab


From 62fa4b7e0c78338cd572d7362213c1e171166186 Mon Sep 17 00:00:00 2001
From: David Dehaven <ddehaven@openjdk.org>
Date: Wed, 18 Jun 2014 12:52:14 -0700
Subject: [PATCH 109/192] 8043340: [macosx] Fix hard-wired paths to
 JavaVM.framework

Build system tweaks to allow building with Xcode 5 and on OS X 10.9 and later

Reviewed-by: erikj, henryjen, dholmes
---
 jdk/make/lib/Awt2dLibraries.gmk    | 21 +++------------------
 jdk/make/lib/CoreLibraries.gmk     |  2 +-
 jdk/make/lib/PlatformLibraries.gmk | 15 +++------------
 jdk/make/lib/SecurityLibraries.gmk |  5 ++---
 4 files changed, 9 insertions(+), 34 deletions(-)

diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index a689e52f03a..e3de7447e65 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -319,7 +319,6 @@ endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBAWT_FILES += awt_LoadLibrary.c
-  LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
 endif
 
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
@@ -484,7 +483,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
     LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm $(LIBM) \
         -framework Cocoa \
         -framework OpenGL \
-        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
         -framework JavaNativeFoundation \
         -framework JavaRuntimeSupport \
         -framework ApplicationServices \
@@ -1130,12 +1128,6 @@ ifeq ($(BUILD_HEADLESS), true)
         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
         $(foreach dir, $(LIBAWT_HEADLESS_DIRS), -I$(dir))
 
-    ifeq ($(OPENJDK_TARGET_OS), macosx)
-      LIBAWT_HEADLESS_CFLAGS += \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-          -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
-    endif
-
     LIBAWT_HEADLESS_FILES := \
         awt_Font.c \
         HeadlessToolkit.c \
@@ -1229,8 +1221,7 @@ ifndef BUILD_HEADLESS_ONLY
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     LIBSPLASHSCREEN_CFLAGS := -I$(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen \
-        $(LIBSPLASHSCREEN_CFLAGS) \
-        -F/System/Library/Frameworks/JavaVM.framework/Frameworks
+        $(LIBSPLASHSCREEN_CFLAGS)
     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
     LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp
 
@@ -1260,7 +1251,6 @@ ifndef BUILD_HEADLESS_ONLY
         -framework ApplicationServices \
         -framework Foundation \
         -framework Cocoa \
-        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
         -framework JavaNativeFoundation
   else ifeq ($(OPENJDK_TARGET_OS), windows)
     LIBSPLASHSCREEN_LDFLAGS_SUFFIX += kernel32.lib user32.lib gdi32.lib delayimp.lib -DELAYLOAD:user32.dll
@@ -1445,9 +1435,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
           -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
           -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
-          -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-          -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+          -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
@@ -1458,7 +1446,6 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -framework Cocoa \
           -framework Security \
           -framework ExceptionHandling \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
           -framework JavaNativeFoundation \
           -framework JavaRuntimeSupport \
           -framework OpenGL \
@@ -1491,8 +1478,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       CFLAGS := $(CFLAGS_JDKLIB) \
           -I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \
           -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
-          -I$(JDK_TOPDIR)/src/macosx/native/sun/awt \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
+          -I$(JDK_TOPDIR)/src/macosx/native/sun/awt, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
           -Xlinker -rpath -Xlinker @loader_path, \
@@ -1500,7 +1486,6 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -framework Cocoa \
           -framework Carbon \
           -framework ApplicationServices \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
           -framework JavaNativeFoundation \
           -framework JavaRuntimeSupport \
           -ljava -ljvm, \
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index aa4d90c3e14..871e95a0dff 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -306,7 +306,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \
     LDFLAGS_SUFFIX_solaris := -ljvm -ljava -lc, \
     LDFLAGS_SUFFIX_aix := -ljvm -ljava, \
     LDFLAGS_SUFFIX_windows := advapi32.lib jvm.lib $(WIN_JAVA_LIB), \
-    LDFLAGS_SUFFIX_macosx := -ljvm -framework CoreFoundation, \
+    LDFLAGS_SUFFIX_macosx := -ljvm -framework CoreFoundation -framework Foundation, \
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
     RC_FLAGS := $(RC_FLAGS) \
         -D "JDK_FNAME=prefs.dll" \
diff --git a/jdk/make/lib/PlatformLibraries.gmk b/jdk/make/lib/PlatformLibraries.gmk
index e78a9833dd5..e3fc71c4bf9 100644
--- a/jdk/make/lib/PlatformLibraries.gmk
+++ b/jdk/make/lib/PlatformLibraries.gmk
@@ -32,14 +32,11 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
-          -I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-          -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+          -I$(JDK_TOPDIR)/src/macosx/native/apple/applescript, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := -framework Cocoa \
           -framework Carbon \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
           -framework JavaNativeFoundation \
           $(LDFLAGS_JDKLIB_SUFFIX), \
       OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libAppleScriptEngine, \
@@ -63,9 +60,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
-          -I$(JDK_OUTPUTDIR)/gensrc_headers_icons \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-          -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+          -I$(JDK_OUTPUTDIR)/gensrc_headers_icons, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX_macosx := \
@@ -76,7 +71,6 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -framework Cocoa \
           -framework Security \
           -framework ExceptionHandling \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
           -framework JavaNativeFoundation \
           -framework JavaRuntimeSupport \
           -framework OpenGL \
@@ -107,16 +101,13 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(foreach dir, $(LIBOSX_DIRS), -I$(dir)) \
-          -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-          -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+          -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX_macosx := \
           -losxapp \
           -framework Cocoa \
           -framework ApplicationServices \
-          -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
           -framework JavaNativeFoundation \
           -framework JavaRuntimeSupport \
           -framework Security \
diff --git a/jdk/make/lib/SecurityLibraries.gmk b/jdk/make/lib/SecurityLibraries.gmk
index 66c55b8264d..eeb062a30da 100644
--- a/jdk/make/lib/SecurityLibraries.gmk
+++ b/jdk/make/lib/SecurityLibraries.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -130,7 +130,7 @@ ifneq ($(BUILD_CRYPTO), no)
     BUILD_LIBKRB5_NAME := osxkrb5
     BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
         $(JDK_TOPDIR)/src/macosx/native/sun/security/krb5
-    BUILD_LIBKRB5_LIBS := -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+    BUILD_LIBKRB5_LIBS := \
         -framework JavaNativeFoundation \
         -framework Cocoa \
         -framework SystemConfiguration \
@@ -147,7 +147,6 @@ ifneq ($(BUILD_CRYPTO), no)
         CFLAGS := $(CFLAGS_JDKLIB) \
             -I$(JDK_TOPDIR)/src/share/native/sun/security/krb5, \
         CFLAGS_windows := -I$(JDK_TOPDIR)/src/windows/native/sun/security/krb5, \
-        CFLAGS_macosx := -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
-- 
GitLab


From c1c9f333d59f21ceba69e083dcc5c83cb677d992 Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty" <dcubed@openjdk.org>
Date: Wed, 18 Jun 2014 14:21:28 -0700
Subject: [PATCH 110/192] 8047156: cleanup more non-indent white space issues
 prior to Contended Locking cleanup bucket

Checkpoint some missed do_space_filter.ksh cleanups for Contended Locking.

Reviewed-by: sspitsyn, lfoltan, coleenp
---
 hotspot/src/os/bsd/vm/os_bsd.hpp              |  40 +-
 hotspot/src/os/linux/vm/os_linux.hpp          |  42 +-
 hotspot/src/os/solaris/vm/os_solaris.hpp      |  42 +-
 hotspot/src/share/vm/runtime/atomic.hpp       |   2 +-
 hotspot/src/share/vm/runtime/mutex.cpp        | 492 +++++++++---------
 .../src/share/vm/runtime/sharedRuntime.hpp    |  10 +-
 hotspot/src/share/vm/runtime/synchronizer.hpp |  14 +-
 7 files changed, 321 insertions(+), 321 deletions(-)

diff --git a/hotspot/src/os/bsd/vm/os_bsd.hpp b/hotspot/src/os/bsd/vm/os_bsd.hpp
index 25a16562dee..36fb913f38a 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.hpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.hpp
@@ -191,16 +191,16 @@ public:
 
 class PlatformEvent : public CHeapObj<mtInternal> {
   private:
-    double CachePad [4] ;   // increase odds that _mutex is sole occupant of cache line
-    volatile int _Event ;
-    volatile int _nParked ;
-    pthread_mutex_t _mutex  [1] ;
-    pthread_cond_t  _cond   [1] ;
-    double PostPad  [2] ;
-    Thread * _Assoc ;
+    double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
+    volatile int _Event;
+    volatile int _nParked;
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[1];
+    double PostPad[2];
+    Thread * _Assoc;
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformEvent() { guarantee (0, "invariant") ; }
+    ~PlatformEvent() { guarantee(0, "invariant"); }
 
   public:
     PlatformEvent() {
@@ -209,28 +209,28 @@ class PlatformEvent : public CHeapObj<mtInternal> {
       assert_status(status == 0, status, "cond_init");
       status = pthread_mutex_init (_mutex, NULL);
       assert_status(status == 0, status, "mutex_init");
-      _Event   = 0 ;
-      _nParked = 0 ;
-      _Assoc   = NULL ;
+      _Event   = 0;
+      _nParked = 0;
+      _Assoc   = NULL;
     }
 
     // Use caution with reset() and fired() -- they may require MEMBARs
-    void reset() { _Event = 0 ; }
+    void reset() { _Event = 0; }
     int  fired() { return _Event; }
-    void park () ;
-    void unpark () ;
-    int  TryPark () ;
-    int  park (jlong millis) ;
-    void SetAssociation (Thread * a) { _Assoc = a ; }
+    void park();
+    void unpark();
+    int  TryPark();
+    int  park(jlong millis);
+    void SetAssociation(Thread * a) { _Assoc = a; }
 };
 
 class PlatformParker : public CHeapObj<mtInternal> {
   protected:
-    pthread_mutex_t _mutex [1] ;
-    pthread_cond_t  _cond  [1] ;
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[1];
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformParker() { guarantee (0, "invariant") ; }
+    ~PlatformParker() { guarantee(0, "invariant"); }
 
   public:
     PlatformParker() {
diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp
index 2dfda6be0cf..3e287387b05 100644
--- a/hotspot/src/os/linux/vm/os_linux.hpp
+++ b/hotspot/src/os/linux/vm/os_linux.hpp
@@ -287,16 +287,16 @@ public:
 
 class PlatformEvent : public CHeapObj<mtInternal> {
   private:
-    double CachePad [4] ;   // increase odds that _mutex is sole occupant of cache line
-    volatile int _Event ;
-    volatile int _nParked ;
-    pthread_mutex_t _mutex  [1] ;
-    pthread_cond_t  _cond   [1] ;
-    double PostPad  [2] ;
-    Thread * _Assoc ;
+    double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
+    volatile int _Event;
+    volatile int _nParked;
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[1];
+    double PostPad[2];
+    Thread * _Assoc;
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformEvent() { guarantee (0, "invariant") ; }
+    ~PlatformEvent() { guarantee(0, "invariant"); }
 
   public:
     PlatformEvent() {
@@ -305,20 +305,20 @@ class PlatformEvent : public CHeapObj<mtInternal> {
       assert_status(status == 0, status, "cond_init");
       status = pthread_mutex_init (_mutex, NULL);
       assert_status(status == 0, status, "mutex_init");
-      _Event   = 0 ;
-      _nParked = 0 ;
-      _Assoc   = NULL ;
+      _Event   = 0;
+      _nParked = 0;
+      _Assoc   = NULL;
     }
 
     // Use caution with reset() and fired() -- they may require MEMBARs
-    void reset() { _Event = 0 ; }
+    void reset() { _Event = 0; }
     int  fired() { return _Event; }
-    void park () ;
-    void unpark () ;
-    int  TryPark () ;
-    int  park (jlong millis) ; // relative timed-wait only
-    void SetAssociation (Thread * a) { _Assoc = a ; }
-} ;
+    void park();
+    void unpark();
+    int  TryPark();
+    int  park(jlong millis); // relative timed-wait only
+    void SetAssociation(Thread * a) { _Assoc = a; }
+};
 
 class PlatformParker : public CHeapObj<mtInternal> {
   protected:
@@ -327,11 +327,11 @@ class PlatformParker : public CHeapObj<mtInternal> {
         ABS_INDEX = 1
     };
     int _cur_index;  // which cond is in use: -1, 0, 1
-    pthread_mutex_t _mutex [1] ;
-    pthread_cond_t  _cond  [2] ; // one for relative times and one for abs.
+    pthread_mutex_t _mutex[1];
+    pthread_cond_t  _cond[2]; // one for relative times and one for abs.
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformParker() { guarantee (0, "invariant") ; }
+    ~PlatformParker() { guarantee(0, "invariant"); }
 
   public:
     PlatformParker() {
diff --git a/hotspot/src/os/solaris/vm/os_solaris.hpp b/hotspot/src/os/solaris/vm/os_solaris.hpp
index 7c5bedb4d41..28d1700ca62 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.hpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.hpp
@@ -301,48 +301,48 @@ class Solaris {
 
 class PlatformEvent : public CHeapObj<mtInternal> {
   private:
-    double CachePad [4] ;   // increase odds that _mutex is sole occupant of cache line
-    volatile int _Event ;
-    int _nParked ;
-    int _pipev [2] ;
-    mutex_t _mutex  [1] ;
-    cond_t  _cond   [1] ;
-    double PostPad  [2] ;
+    double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
+    volatile int _Event;
+    int _nParked;
+    int _pipev[2];
+    mutex_t _mutex[1];
+    cond_t  _cond[1];
+    double PostPad[2];
 
   protected:
     // Defining a protected ctor effectively gives us an abstract base class.
     // That is, a PlatformEvent can never be instantiated "naked" but only
     // as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent).
     // TODO-FIXME: make dtor private
-    ~PlatformEvent() { guarantee (0, "invariant") ; }
+    ~PlatformEvent() { guarantee(0, "invariant"); }
     PlatformEvent() {
       int status;
       status = os::Solaris::cond_init(_cond);
       assert_status(status == 0, status, "cond_init");
       status = os::Solaris::mutex_init(_mutex);
       assert_status(status == 0, status, "mutex_init");
-      _Event   = 0 ;
-      _nParked = 0 ;
-      _pipev[0] = _pipev[1] = -1 ;
+      _Event   = 0;
+      _nParked = 0;
+      _pipev[0] = _pipev[1] = -1;
     }
 
   public:
     // Exercise caution using reset() and fired() -- they may require MEMBARs
-    void reset() { _Event = 0 ; }
+    void reset() { _Event = 0; }
     int  fired() { return _Event; }
-    void park () ;
-    int  park (jlong millis) ;
-    int  TryPark () ;
-    void unpark () ;
-} ;
+    void park();
+    int  park(jlong millis);
+    int  TryPark();
+    void unpark();
+};
 
 class PlatformParker : public CHeapObj<mtInternal> {
   protected:
-    mutex_t _mutex [1] ;
-    cond_t  _cond  [1] ;
+    mutex_t _mutex[1];
+    cond_t  _cond[1];
 
   public:       // TODO-FIXME: make dtor private
-    ~PlatformParker() { guarantee (0, "invariant") ; }
+    ~PlatformParker() { guarantee(0, "invariant"); }
 
   public:
     PlatformParker() {
@@ -352,6 +352,6 @@ class PlatformParker : public CHeapObj<mtInternal> {
       status = os::Solaris::mutex_init(_mutex);
       assert_status(status == 0, status, "mutex_init");
     }
-} ;
+};
 
 #endif // OS_SOLARIS_VM_OS_SOLARIS_HPP
diff --git a/hotspot/src/share/vm/runtime/atomic.hpp b/hotspot/src/share/vm/runtime/atomic.hpp
index 5b46b530b51..b2b56171362 100644
--- a/hotspot/src/share/vm/runtime/atomic.hpp
+++ b/hotspot/src/share/vm/runtime/atomic.hpp
@@ -116,7 +116,7 @@ class Atomic : AllStatic {
     atomic_decl
 #else
 #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \
-    atomic_decl ; \
+    atomic_decl; \
     non_atomic_decl
 #endif
 
diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp
index 34c9366f0d1..f5ac0f8ea15 100644
--- a/hotspot/src/share/vm/runtime/mutex.cpp
+++ b/hotspot/src/share/vm/runtime/mutex.cpp
@@ -269,62 +269,62 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 #define CASPTR(a,c,s) intptr_t(Atomic::cmpxchg_ptr ((void *)(s),(void *)(a),(void *)(c)))
 #define UNS(x) (uintptr_t(x))
-#define TRACE(m) { static volatile int ctr = 0 ; int x = ++ctr ; if ((x & (x-1))==0) { ::printf ("%d:%s\n", x, #m); ::fflush(stdout); }}
+#define TRACE(m) { static volatile int ctr = 0; int x = ++ctr; if ((x & (x-1))==0) { ::printf ("%d:%s\n", x, #m); ::fflush(stdout); }}
 
 // Simplistic low-quality Marsaglia SHIFT-XOR RNG.
 // Bijective except for the trailing mask operation.
 // Useful for spin loops as the compiler can't optimize it away.
 
 static inline jint MarsagliaXORV (jint x) {
-  if (x == 0) x = 1|os::random() ;
+  if (x == 0) x = 1|os::random();
   x ^= x << 6;
   x ^= ((unsigned)x) >> 21;
-  x ^= x << 7 ;
-  return x & 0x7FFFFFFF ;
+  x ^= x << 7;
+  return x & 0x7FFFFFFF;
 }
 
 static int Stall (int its) {
-  static volatile jint rv = 1 ;
-  volatile int OnFrame = 0 ;
-  jint v = rv ^ UNS(OnFrame) ;
+  static volatile jint rv = 1;
+  volatile int OnFrame = 0;
+  jint v = rv ^ UNS(OnFrame);
   while (--its >= 0) {
-    v = MarsagliaXORV (v) ;
+    v = MarsagliaXORV(v);
   }
   // Make this impossible for the compiler to optimize away,
   // but (mostly) avoid W coherency sharing on MP systems.
-  if (v == 0x12345) rv = v ;
-  return v ;
+  if (v == 0x12345) rv = v;
+  return v;
 }
 
-int Monitor::TryLock () {
-  intptr_t v = _LockWord.FullWord ;
+int Monitor::TryLock() {
+  intptr_t v = _LockWord.FullWord;
   for (;;) {
-    if ((v & _LBIT) != 0) return 0 ;
-    const intptr_t u = CASPTR (&_LockWord, v, v|_LBIT) ;
-    if (v == u) return 1 ;
-    v = u ;
+    if ((v & _LBIT) != 0) return 0;
+    const intptr_t u = CASPTR(&_LockWord, v, v|_LBIT);
+    if (v == u) return 1;
+    v = u;
   }
 }
 
-int Monitor::TryFast () {
+int Monitor::TryFast() {
   // Optimistic fast-path form ...
   // Fast-path attempt for the common uncontended case.
   // Avoid RTS->RTO $ coherence upgrade on typical SMP systems.
-  intptr_t v = CASPTR (&_LockWord, 0, _LBIT) ;  // agro ...
-  if (v == 0) return 1 ;
+  intptr_t v = CASPTR(&_LockWord, 0, _LBIT);  // agro ...
+  if (v == 0) return 1;
 
   for (;;) {
-    if ((v & _LBIT) != 0) return 0 ;
-    const intptr_t u = CASPTR (&_LockWord, v, v|_LBIT) ;
-    if (v == u) return 1 ;
-    v = u ;
+    if ((v & _LBIT) != 0) return 0;
+    const intptr_t u = CASPTR(&_LockWord, v, v|_LBIT);
+    if (v == u) return 1;
+    v = u;
   }
 }
 
-int Monitor::ILocked () {
-  const intptr_t w = _LockWord.FullWord & 0xFF ;
-  assert (w == 0 || w == _LBIT, "invariant") ;
-  return w == _LBIT ;
+int Monitor::ILocked() {
+  const intptr_t w = _LockWord.FullWord & 0xFF;
+  assert(w == 0 || w == _LBIT, "invariant");
+  return w == _LBIT;
 }
 
 // Polite TATAS spinlock with exponential backoff - bounded spin.
@@ -342,38 +342,38 @@ int Monitor::ILocked () {
 // See synchronizer.cpp for details and rationale.
 
 int Monitor::TrySpin (Thread * const Self) {
-  if (TryLock())    return 1 ;
-  if (!os::is_MP()) return 0 ;
-
-  int Probes  = 0 ;
-  int Delay   = 0 ;
-  int Steps   = 0 ;
-  int SpinMax = NativeMonitorSpinLimit ;
-  int flgs    = NativeMonitorFlags ;
+  if (TryLock())    return 1;
+  if (!os::is_MP()) return 0;
+
+  int Probes  = 0;
+  int Delay   = 0;
+  int Steps   = 0;
+  int SpinMax = NativeMonitorSpinLimit;
+  int flgs    = NativeMonitorFlags;
   for (;;) {
     intptr_t v = _LockWord.FullWord;
     if ((v & _LBIT) == 0) {
       if (CASPTR (&_LockWord, v, v|_LBIT) == v) {
-        return 1 ;
+        return 1;
       }
-      continue ;
+      continue;
     }
 
     if ((flgs & 8) == 0) {
-      SpinPause () ;
+      SpinPause();
     }
 
     // Periodically increase Delay -- variable Delay form
     // conceptually: delay *= 1 + 1/Exponent
-    ++ Probes;
-    if (Probes > SpinMax) return 0 ;
+    ++Probes;
+    if (Probes > SpinMax) return 0;
 
     if ((Probes & 0x7) == 0) {
-      Delay = ((Delay << 1)|1) & 0x7FF ;
+      Delay = ((Delay << 1)|1) & 0x7FF;
       // CONSIDER: Delay += 1 + (Delay/4); Delay &= 0x7FF ;
     }
 
-    if (flgs & 2) continue ;
+    if (flgs & 2) continue;
 
     // Consider checking _owner's schedctl state, if OFFPROC abort spin.
     // If the owner is OFFPROC then it's unlike that the lock will be dropped
@@ -389,48 +389,48 @@ int Monitor::TrySpin (Thread * const Self) {
     // spin loop.  N1 and brethren write-around the L1$ over the xbar into the L2$.
     // Furthermore, they don't have a W$ like traditional SPARC processors.
     // We currently use a Marsaglia Shift-Xor RNG loop.
-    Steps += Delay ;
+    Steps += Delay;
     if (Self != NULL) {
-      jint rv = Self->rng[0] ;
-      for (int k = Delay ; --k >= 0; ) {
-        rv = MarsagliaXORV (rv) ;
-        if ((flgs & 4) == 0 && SafepointSynchronize::do_call_back()) return 0 ;
+      jint rv = Self->rng[0];
+      for (int k = Delay; --k >= 0;) {
+        rv = MarsagliaXORV(rv);
+        if ((flgs & 4) == 0 && SafepointSynchronize::do_call_back()) return 0;
       }
-      Self->rng[0] = rv ;
+      Self->rng[0] = rv;
     } else {
-      Stall (Delay) ;
+      Stall(Delay);
     }
   }
 }
 
 static int ParkCommon (ParkEvent * ev, jlong timo) {
   // Diagnostic support - periodically unwedge blocked threads
-  intx nmt = NativeMonitorTimeout ;
+  intx nmt = NativeMonitorTimeout;
   if (nmt > 0 && (nmt < timo || timo <= 0)) {
-     timo = nmt ;
+     timo = nmt;
   }
-  int err = OS_OK ;
+  int err = OS_OK;
   if (0 == timo) {
-    ev->park() ;
+    ev->park();
   } else {
-    err = ev->park(timo) ;
+    err = ev->park(timo);
   }
-  return err ;
+  return err;
 }
 
 inline int Monitor::AcquireOrPush (ParkEvent * ESelf) {
-  intptr_t v = _LockWord.FullWord ;
+  intptr_t v = _LockWord.FullWord;
   for (;;) {
     if ((v & _LBIT) == 0) {
-      const intptr_t u = CASPTR (&_LockWord, v, v|_LBIT) ;
-      if (u == v) return 1 ;        // indicate acquired
-      v = u ;
+      const intptr_t u = CASPTR(&_LockWord, v, v|_LBIT);
+      if (u == v) return 1;        // indicate acquired
+      v = u;
     } else {
       // Anticipate success ...
-      ESelf->ListNext = (ParkEvent *) (v & ~_LBIT) ;
-      const intptr_t u = CASPTR (&_LockWord, v, intptr_t(ESelf)|_LBIT) ;
-      if (u == v) return 0 ;        // indicate pushed onto cxq
-      v = u ;
+      ESelf->ListNext = (ParkEvent *)(v & ~_LBIT);
+      const intptr_t u = CASPTR(&_LockWord, v, intptr_t(ESelf)|_LBIT);
+      if (u == v) return 0;        // indicate pushed onto cxq
+      v = u;
     }
     // Interference - LockWord change - just retry
   }
@@ -444,33 +444,33 @@ inline int Monitor::AcquireOrPush (ParkEvent * ESelf) {
 // _owner is a higher-level logical concept.
 
 void Monitor::ILock (Thread * Self) {
-  assert (_OnDeck != Self->_MutexEvent, "invariant") ;
+  assert(_OnDeck != Self->_MutexEvent, "invariant");
 
   if (TryFast()) {
  Exeunt:
-    assert (ILocked(), "invariant") ;
-    return ;
+    assert(ILocked(), "invariant");
+    return;
   }
 
-  ParkEvent * const ESelf = Self->_MutexEvent ;
-  assert (_OnDeck != ESelf, "invariant") ;
+  ParkEvent * const ESelf = Self->_MutexEvent;
+  assert(_OnDeck != ESelf, "invariant");
 
   // As an optimization, spinners could conditionally try to set ONDECK to _LBIT
   // Synchronizer.cpp uses a similar optimization.
-  if (TrySpin (Self)) goto Exeunt ;
+  if (TrySpin(Self)) goto Exeunt;
 
   // Slow-path - the lock is contended.
   // Either Enqueue Self on cxq or acquire the outer lock.
   // LockWord encoding = (cxq,LOCKBYTE)
-  ESelf->reset() ;
-  OrderAccess::fence() ;
+  ESelf->reset();
+  OrderAccess::fence();
 
   // Optional optimization ... try barging on the inner lock
   if ((NativeMonitorFlags & 32) && CASPTR (&_OnDeck, NULL, UNS(Self)) == 0) {
-    goto OnDeck_LOOP ;
+    goto OnDeck_LOOP;
   }
 
-  if (AcquireOrPush (ESelf)) goto Exeunt ;
+  if (AcquireOrPush(ESelf)) goto Exeunt;
 
   // At any given time there is at most one ondeck thread.
   // ondeck implies not resident on cxq and not resident on EntryList
@@ -478,26 +478,26 @@ void Monitor::ILock (Thread * Self) {
   // CONSIDER: use Self->OnDeck instead of m->OnDeck.
   // Deschedule Self so that others may run.
   while (_OnDeck != ESelf) {
-    ParkCommon (ESelf, 0) ;
+    ParkCommon(ESelf, 0);
   }
 
   // Self is now in the ONDECK position and will remain so until it
   // manages to acquire the lock.
  OnDeck_LOOP:
   for (;;) {
-    assert (_OnDeck == ESelf, "invariant") ;
-    if (TrySpin (Self)) break ;
+    assert(_OnDeck == ESelf, "invariant");
+    if (TrySpin(Self)) break;
     // CONSIDER: if ESelf->TryPark() && TryLock() break ...
     // It's probably wise to spin only if we *actually* blocked
     // CONSIDER: check the lockbyte, if it remains set then
     // preemptively drain the cxq into the EntryList.
     // The best place and time to perform queue operations -- lock metadata --
     // is _before having acquired the outer lock, while waiting for the lock to drop.
-    ParkCommon (ESelf, 0) ;
+    ParkCommon(ESelf, 0);
   }
 
-  assert (_OnDeck == ESelf, "invariant") ;
-  _OnDeck = NULL ;
+  assert(_OnDeck == ESelf, "invariant");
+  _OnDeck = NULL;
 
   // Note that we current drop the inner lock (clear OnDeck) in the slow-path
   // epilogue immediately after having acquired the outer lock.
@@ -512,11 +512,11 @@ void Monitor::ILock (Thread * Self) {
   //    effective length of the critical section.
   // Note that (A) and (B) are tantamount to succession by direct handoff for
   // the inner lock.
-  goto Exeunt ;
+  goto Exeunt;
 }
 
 void Monitor::IUnlock (bool RelaxAssert) {
-  assert (ILocked(), "invariant") ;
+  assert(ILocked(), "invariant");
   // Conceptually we need a MEMBAR #storestore|#loadstore barrier or fence immediately
   // before the store that releases the lock.  Crucially, all the stores and loads in the
   // critical section must be globally visible before the store of 0 into the lock-word
@@ -532,9 +532,9 @@ void Monitor::IUnlock (bool RelaxAssert) {
   // safety or lock release consistency.
   OrderAccess::release_store(&_LockWord.Bytes[_LSBINDEX], 0); // drop outer lock
 
-  OrderAccess::storeload ();
-  ParkEvent * const w = _OnDeck ;
-  assert (RelaxAssert || w != Thread::current()->_MutexEvent, "invariant") ;
+  OrderAccess::storeload();
+  ParkEvent * const w = _OnDeck;
+  assert(RelaxAssert || w != Thread::current()->_MutexEvent, "invariant");
   if (w != NULL) {
     // Either we have a valid ondeck thread or ondeck is transiently "locked"
     // by some exiting thread as it arranges for succession.  The LSBit of
@@ -549,19 +549,19 @@ void Monitor::IUnlock (bool RelaxAssert) {
     // then progress is known to have occurred as that means the thread associated
     // with "w" acquired the lock.  In that case this thread need take no further
     // action to guarantee progress.
-    if ((UNS(w) & _LBIT) == 0) w->unpark() ;
-    return ;
+    if ((UNS(w) & _LBIT) == 0) w->unpark();
+    return;
   }
 
-  intptr_t cxq = _LockWord.FullWord ;
+  intptr_t cxq = _LockWord.FullWord;
   if (((cxq & ~_LBIT)|UNS(_EntryList)) == 0) {
-    return ;      // normal fast-path exit - cxq and EntryList both empty
+    return;      // normal fast-path exit - cxq and EntryList both empty
   }
   if (cxq & _LBIT) {
     // Optional optimization ...
     // Some other thread acquired the lock in the window since this
     // thread released it.  Succession is now that thread's responsibility.
-    return ;
+    return;
   }
 
  Succession:
@@ -575,22 +575,22 @@ void Monitor::IUnlock (bool RelaxAssert) {
   // picks a successor and marks that thread as OnDeck.  That successor
   // thread will then clear OnDeck once it eventually acquires the outer lock.
   if (CASPTR (&_OnDeck, NULL, _LBIT) != UNS(NULL)) {
-    return ;
+    return;
   }
 
-  ParkEvent * List = _EntryList ;
+  ParkEvent * List = _EntryList;
   if (List != NULL) {
     // Transfer the head of the EntryList to the OnDeck position.
     // Once OnDeck, a thread stays OnDeck until it acquires the lock.
     // For a given lock there is at most OnDeck thread at any one instant.
    WakeOne:
-    assert (List == _EntryList, "invariant") ;
-    ParkEvent * const w = List ;
-    assert (RelaxAssert || w != Thread::current()->_MutexEvent, "invariant") ;
-    _EntryList = w->ListNext ;
+    assert(List == _EntryList, "invariant");
+    ParkEvent * const w = List;
+    assert(RelaxAssert || w != Thread::current()->_MutexEvent, "invariant");
+    _EntryList = w->ListNext;
     // as a diagnostic measure consider setting w->_ListNext = BAD
-    assert (UNS(_OnDeck) == _LBIT, "invariant") ;
-    _OnDeck = w ;           // pass OnDeck to w.
+    assert(UNS(_OnDeck) == _LBIT, "invariant");
+    _OnDeck = w;           // pass OnDeck to w.
                             // w will clear OnDeck once it acquires the outer lock
 
     // Another optional optimization ...
@@ -599,25 +599,25 @@ void Monitor::IUnlock (bool RelaxAssert) {
     // Try to defer the unpark() operation - Delegate the responsibility
     // for unpark()ing the OnDeck thread to the current or subsequent owners
     // That is, the new owner is responsible for unparking the OnDeck thread.
-    OrderAccess::storeload() ;
-    cxq = _LockWord.FullWord ;
-    if (cxq & _LBIT) return ;
+    OrderAccess::storeload();
+    cxq = _LockWord.FullWord;
+    if (cxq & _LBIT) return;
 
-    w->unpark() ;
-    return ;
+    w->unpark();
+    return;
   }
 
-  cxq = _LockWord.FullWord ;
+  cxq = _LockWord.FullWord;
   if ((cxq & ~_LBIT) != 0) {
     // The EntryList is empty but the cxq is populated.
     // drain RATs from cxq into EntryList
     // Detach RATs segment with CAS and then merge into EntryList
     for (;;) {
       // optional optimization - if locked, the owner is responsible for succession
-      if (cxq & _LBIT) goto Punt ;
-      const intptr_t vfy = CASPTR (&_LockWord, cxq, cxq & _LBIT) ;
-      if (vfy == cxq) break ;
-      cxq = vfy ;
+      if (cxq & _LBIT) goto Punt;
+      const intptr_t vfy = CASPTR(&_LockWord, cxq, cxq & _LBIT);
+      if (vfy == cxq) break;
+      cxq = vfy;
       // Interference - LockWord changed - Just retry
       // We can see concurrent interference from contending threads
       // pushing themselves onto the cxq or from lock-unlock operations.
@@ -639,10 +639,10 @@ void Monitor::IUnlock (bool RelaxAssert) {
     // the EntryList, but it might make sense to reverse the order
     // or perhaps sort by thread priority.  See the comments in
     // synchronizer.cpp objectMonitor::exit().
-    assert (_EntryList == NULL, "invariant") ;
-    _EntryList = List = (ParkEvent *)(cxq & ~_LBIT) ;
-    assert (List != NULL, "invariant") ;
-    goto WakeOne ;
+    assert(_EntryList == NULL, "invariant");
+    _EntryList = List = (ParkEvent *)(cxq & ~_LBIT);
+    assert(List != NULL, "invariant");
+    goto WakeOne;
   }
 
   // cxq|EntryList is empty.
@@ -651,8 +651,8 @@ void Monitor::IUnlock (bool RelaxAssert) {
   // A thread could have added itself to cxq since this thread previously checked.
   // Detect and recover by refetching cxq.
  Punt:
-  assert (UNS(_OnDeck) == _LBIT, "invariant") ;
-  _OnDeck = NULL ;            // Release inner lock.
+  assert(UNS(_OnDeck) == _LBIT, "invariant");
+  _OnDeck = NULL;            // Release inner lock.
   OrderAccess::storeload();   // Dekker duality - pivot point
 
   // Resample LockWord/cxq to recover from possible race.
@@ -665,32 +665,32 @@ void Monitor::IUnlock (bool RelaxAssert) {
   // Note that we don't need to recheck EntryList, just cxq.
   // If threads moved onto EntryList since we dropped OnDeck
   // that implies some other thread forced succession.
-  cxq = _LockWord.FullWord ;
+  cxq = _LockWord.FullWord;
   if ((cxq & ~_LBIT) != 0 && (cxq & _LBIT) == 0) {
-    goto Succession ;         // potential race -- re-run succession
+    goto Succession;         // potential race -- re-run succession
   }
-  return ;
+  return;
 }
 
 bool Monitor::notify() {
-  assert (_owner == Thread::current(), "invariant") ;
-  assert (ILocked(), "invariant") ;
-  if (_WaitSet == NULL) return true ;
-  NotifyCount ++ ;
+  assert(_owner == Thread::current(), "invariant");
+  assert(ILocked(), "invariant");
+  if (_WaitSet == NULL) return true;
+  NotifyCount++;
 
   // Transfer one thread from the WaitSet to the EntryList or cxq.
   // Currently we just unlink the head of the WaitSet and prepend to the cxq.
   // And of course we could just unlink it and unpark it, too, but
   // in that case it'd likely impale itself on the reentry.
-  Thread::muxAcquire (_WaitLock, "notify:WaitLock") ;
-  ParkEvent * nfy = _WaitSet ;
+  Thread::muxAcquire(_WaitLock, "notify:WaitLock");
+  ParkEvent * nfy = _WaitSet;
   if (nfy != NULL) {                  // DCL idiom
-    _WaitSet = nfy->ListNext ;
-    assert (nfy->Notified == 0, "invariant") ;
+    _WaitSet = nfy->ListNext;
+    assert(nfy->Notified == 0, "invariant");
     // push nfy onto the cxq
     for (;;) {
-      const intptr_t v = _LockWord.FullWord ;
-      assert ((v & 0xFF) == _LBIT, "invariant") ;
+      const intptr_t v = _LockWord.FullWord;
+      assert((v & 0xFF) == _LBIT, "invariant");
       nfy->ListNext = (ParkEvent *)(v & ~_LBIT);
       if (CASPTR (&_LockWord, v, UNS(nfy)|_LBIT) == v) break;
       // interference - _LockWord changed -- just retry
@@ -698,17 +698,17 @@ bool Monitor::notify() {
     // Note that setting Notified before pushing nfy onto the cxq is
     // also legal and safe, but the safety properties are much more
     // subtle, so for the sake of code stewardship ...
-    OrderAccess::fence() ;
+    OrderAccess::fence();
     nfy->Notified = 1;
   }
-  Thread::muxRelease (_WaitLock) ;
+  Thread::muxRelease(_WaitLock);
   if (nfy != NULL && (NativeMonitorFlags & 16)) {
     // Experimental code ... light up the wakee in the hope that this thread (the owner)
     // will drop the lock just about the time the wakee comes ONPROC.
-    nfy->unpark() ;
+    nfy->unpark();
   }
-  assert (ILocked(), "invariant") ;
-  return true ;
+  assert(ILocked(), "invariant");
+  return true;
 }
 
 // Currently notifyAll() transfers the waiters one-at-a-time from the waitset
@@ -719,14 +719,14 @@ bool Monitor::notify() {
 // will be empty and the cxq will be "DCBAXYZ".  This is benign, of course.
 
 bool Monitor::notify_all() {
-  assert (_owner == Thread::current(), "invariant") ;
-  assert (ILocked(), "invariant") ;
-  while (_WaitSet != NULL) notify() ;
-  return true ;
+  assert(_owner == Thread::current(), "invariant");
+  assert(ILocked(), "invariant");
+  while (_WaitSet != NULL) notify();
+  return true;
 }
 
 int Monitor::IWait (Thread * Self, jlong timo) {
-  assert (ILocked(), "invariant") ;
+  assert(ILocked(), "invariant");
 
   // Phases:
   // 1. Enqueue Self on WaitSet - currently prepend
@@ -734,10 +734,10 @@ int Monitor::IWait (Thread * Self, jlong timo) {
   // 3. wait for either notification or timeout
   // 4. lock - reentry - reacquire the outer lock
 
-  ParkEvent * const ESelf = Self->_MutexEvent ;
-  ESelf->Notified = 0 ;
-  ESelf->reset() ;
-  OrderAccess::fence() ;
+  ParkEvent * const ESelf = Self->_MutexEvent;
+  ESelf->Notified = 0;
+  ESelf->reset();
+  OrderAccess::fence();
 
   // Add Self to WaitSet
   // Ideally only the holder of the outer lock would manipulate the WaitSet -
@@ -766,10 +766,10 @@ int Monitor::IWait (Thread * Self, jlong timo) {
   // In that case we could have one ListElement on the WaitSet and another
   // on the EntryList, with both referring to the same pure Event.
 
-  Thread::muxAcquire (_WaitLock, "wait:WaitLock:Add") ;
-  ESelf->ListNext = _WaitSet ;
-  _WaitSet = ESelf ;
-  Thread::muxRelease (_WaitLock) ;
+  Thread::muxAcquire(_WaitLock, "wait:WaitLock:Add");
+  ESelf->ListNext = _WaitSet;
+  _WaitSet = ESelf;
+  Thread::muxRelease(_WaitLock);
 
   // Release the outer lock
   // We call IUnlock (RelaxAssert=true) as a thread T1 might
@@ -781,16 +781,16 @@ int Monitor::IWait (Thread * Self, jlong timo) {
   // IUnlock() call a thread should _never find itself on the EntryList
   // or cxq, but in the case of wait() it's possible.
   // See synchronizer.cpp objectMonitor::wait().
-  IUnlock (true) ;
+  IUnlock(true);
 
   // Wait for either notification or timeout
   // Beware that in some circumstances we might propagate
   // spurious wakeups back to the caller.
 
   for (;;) {
-    if (ESelf->Notified) break ;
-    int err = ParkCommon (ESelf, timo) ;
-    if (err == OS_TIMEOUT || (NativeMonitorFlags & 1)) break ;
+    if (ESelf->Notified) break;
+    int err = ParkCommon(ESelf, timo);
+    if (err == OS_TIMEOUT || (NativeMonitorFlags & 1)) break;
   }
 
   // Prepare for reentry - if necessary, remove ESelf from WaitSet
@@ -799,55 +799,55 @@ int Monitor::IWait (Thread * Self, jlong timo) {
   // 2. On the cxq or EntryList
   // 3. Not resident on cxq, EntryList or WaitSet, but in the OnDeck position.
 
-  OrderAccess::fence() ;
-  int WasOnWaitSet = 0 ;
+  OrderAccess::fence();
+  int WasOnWaitSet = 0;
   if (ESelf->Notified == 0) {
-    Thread::muxAcquire (_WaitLock, "wait:WaitLock:remove") ;
+    Thread::muxAcquire(_WaitLock, "wait:WaitLock:remove");
     if (ESelf->Notified == 0) {     // DCL idiom
-      assert (_OnDeck != ESelf, "invariant") ;   // can't be both OnDeck and on WaitSet
+      assert(_OnDeck != ESelf, "invariant");   // can't be both OnDeck and on WaitSet
       // ESelf is resident on the WaitSet -- unlink it.
       // A doubly-linked list would be better here so we can unlink in constant-time.
       // We have to unlink before we potentially recontend as ESelf might otherwise
       // end up on the cxq|EntryList -- it can't be on two lists at once.
-      ParkEvent * p = _WaitSet ;
-      ParkEvent * q = NULL ;            // classic q chases p
+      ParkEvent * p = _WaitSet;
+      ParkEvent * q = NULL;            // classic q chases p
       while (p != NULL && p != ESelf) {
-        q = p ;
-        p = p->ListNext ;
+        q = p;
+        p = p->ListNext;
       }
-      assert (p == ESelf, "invariant") ;
+      assert(p == ESelf, "invariant");
       if (p == _WaitSet) {      // found at head
-        assert (q == NULL, "invariant") ;
-        _WaitSet = p->ListNext ;
+        assert(q == NULL, "invariant");
+        _WaitSet = p->ListNext;
       } else {                  // found in interior
-        assert (q->ListNext == p, "invariant") ;
-        q->ListNext = p->ListNext ;
+        assert(q->ListNext == p, "invariant");
+        q->ListNext = p->ListNext;
       }
-      WasOnWaitSet = 1 ;        // We were *not* notified but instead encountered timeout
+      WasOnWaitSet = 1;        // We were *not* notified but instead encountered timeout
     }
-    Thread::muxRelease (_WaitLock) ;
+    Thread::muxRelease(_WaitLock);
   }
 
   // Reentry phase - reacquire the lock
   if (WasOnWaitSet) {
     // ESelf was previously on the WaitSet but we just unlinked it above
     // because of a timeout.  ESelf is not resident on any list and is not OnDeck
-    assert (_OnDeck != ESelf, "invariant") ;
-    ILock (Self) ;
+    assert(_OnDeck != ESelf, "invariant");
+    ILock(Self);
   } else {
     // A prior notify() operation moved ESelf from the WaitSet to the cxq.
     // ESelf is now on the cxq, EntryList or at the OnDeck position.
     // The following fragment is extracted from Monitor::ILock()
     for (;;) {
-      if (_OnDeck == ESelf && TrySpin(Self)) break ;
-      ParkCommon (ESelf, 0) ;
+      if (_OnDeck == ESelf && TrySpin(Self)) break;
+      ParkCommon(ESelf, 0);
     }
-    assert (_OnDeck == ESelf, "invariant") ;
-    _OnDeck = NULL ;
+    assert(_OnDeck == ESelf, "invariant");
+    _OnDeck = NULL;
   }
 
-  assert (ILocked(), "invariant") ;
-  return WasOnWaitSet != 0 ;        // return true IFF timeout
+  assert(ILocked(), "invariant");
+  return WasOnWaitSet != 0;        // return true IFF timeout
 }
 
 
@@ -896,15 +896,15 @@ void Monitor::lock (Thread * Self) {
 #endif // CHECK_UNHANDLED_OOPS
 
   debug_only(check_prelock_state(Self));
-  assert (_owner != Self              , "invariant") ;
-  assert (_OnDeck != Self->_MutexEvent, "invariant") ;
+  assert(_owner != Self              , "invariant");
+  assert(_OnDeck != Self->_MutexEvent, "invariant");
 
   if (TryFast()) {
  Exeunt:
-    assert (ILocked(), "invariant") ;
-    assert (owner() == NULL, "invariant");
-    set_owner (Self);
-    return ;
+    assert(ILocked(), "invariant");
+    assert(owner() == NULL, "invariant");
+    set_owner(Self);
+    return;
   }
 
   // The lock is contended ...
@@ -916,23 +916,23 @@ void Monitor::lock (Thread * Self) {
     // and go on.  we note this with _snuck so we can also
     // pretend to unlock when the time comes.
     _snuck = true;
-    goto Exeunt ;
+    goto Exeunt;
   }
 
   // Try a brief spin to avoid passing thru thread state transition ...
-  if (TrySpin (Self)) goto Exeunt ;
+  if (TrySpin(Self)) goto Exeunt;
 
   check_block_state(Self);
   if (Self->is_Java_thread()) {
     // Horrible dictu - we suffer through a state transition
     assert(rank() > Mutex::special, "Potential deadlock with special or lesser rank mutex");
-    ThreadBlockInVM tbivm ((JavaThread *) Self) ;
-    ILock (Self) ;
+    ThreadBlockInVM tbivm((JavaThread *) Self);
+    ILock(Self);
   } else {
     // Mirabile dictu
-    ILock (Self) ;
+    ILock(Self);
   }
-  goto Exeunt ;
+  goto Exeunt;
 }
 
 void Monitor::lock() {
@@ -945,14 +945,14 @@ void Monitor::lock() {
 // thread state set to be in VM, the safepoint synchronization code will deadlock!
 
 void Monitor::lock_without_safepoint_check (Thread * Self) {
-  assert (_owner != Self, "invariant") ;
-  ILock (Self) ;
-  assert (_owner == NULL, "invariant");
-  set_owner (Self);
+  assert(_owner != Self, "invariant");
+  ILock(Self);
+  assert(_owner == NULL, "invariant");
+  set_owner(Self);
 }
 
-void Monitor::lock_without_safepoint_check () {
-  lock_without_safepoint_check (Thread::current()) ;
+void Monitor::lock_without_safepoint_check() {
+  lock_without_safepoint_check(Thread::current());
 }
 
 
@@ -976,23 +976,23 @@ bool Monitor::try_lock() {
 
   if (TryLock()) {
     // We got the lock
-    assert (_owner == NULL, "invariant");
-    set_owner (Self);
+    assert(_owner == NULL, "invariant");
+    set_owner(Self);
     return true;
   }
   return false;
 }
 
 void Monitor::unlock() {
-  assert (_owner  == Thread::current(), "invariant") ;
-  assert (_OnDeck != Thread::current()->_MutexEvent , "invariant") ;
-  set_owner (NULL) ;
+  assert(_owner  == Thread::current(), "invariant");
+  assert(_OnDeck != Thread::current()->_MutexEvent , "invariant");
+  set_owner(NULL);
   if (_snuck) {
     assert(SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread(), "sneak");
     _snuck = false;
-    return ;
+    return;
   }
-  IUnlock (false) ;
+  IUnlock(false);
 }
 
 // Yet another degenerate version of Monitor::lock() or lock_without_safepoint_check()
@@ -1020,29 +1020,29 @@ void Monitor::jvm_raw_lock() {
 
   if (TryLock()) {
  Exeunt:
-    assert (ILocked(), "invariant") ;
-    assert (_owner == NULL, "invariant");
+    assert(ILocked(), "invariant");
+    assert(_owner == NULL, "invariant");
     // This can potentially be called by non-java Threads. Thus, the ThreadLocalStorage
     // might return NULL. Don't call set_owner since it will break on an NULL owner
     // Consider installing a non-null "ANON" distinguished value instead of just NULL.
     _owner = ThreadLocalStorage::thread();
-    return ;
+    return;
   }
 
-  if (TrySpin(NULL)) goto Exeunt ;
+  if (TrySpin(NULL)) goto Exeunt;
 
   // slow-path - apparent contention
   // Allocate a ParkEvent for transient use.
   // The ParkEvent remains associated with this thread until
   // the time the thread manages to acquire the lock.
-  ParkEvent * const ESelf = ParkEvent::Allocate(NULL) ;
-  ESelf->reset() ;
-  OrderAccess::storeload() ;
+  ParkEvent * const ESelf = ParkEvent::Allocate(NULL);
+  ESelf->reset();
+  OrderAccess::storeload();
 
   // Either Enqueue Self on cxq or acquire the outer lock.
   if (AcquireOrPush (ESelf)) {
-    ParkEvent::Release (ESelf) ;      // surrender the ParkEvent
-    goto Exeunt ;
+    ParkEvent::Release(ESelf);      // surrender the ParkEvent
+    goto Exeunt;
   }
 
   // At any given time there is at most one ondeck thread.
@@ -1050,37 +1050,37 @@ void Monitor::jvm_raw_lock() {
   // Only the OnDeck thread can try to acquire -- contended for -- the lock.
   // CONSIDER: use Self->OnDeck instead of m->OnDeck.
   for (;;) {
-    if (_OnDeck == ESelf && TrySpin(NULL)) break ;
-    ParkCommon (ESelf, 0) ;
+    if (_OnDeck == ESelf && TrySpin(NULL)) break;
+    ParkCommon(ESelf, 0);
   }
 
-  assert (_OnDeck == ESelf, "invariant") ;
-  _OnDeck = NULL ;
-  ParkEvent::Release (ESelf) ;      // surrender the ParkEvent
-  goto Exeunt ;
+  assert(_OnDeck == ESelf, "invariant");
+  _OnDeck = NULL;
+  ParkEvent::Release(ESelf);      // surrender the ParkEvent
+  goto Exeunt;
 }
 
 void Monitor::jvm_raw_unlock() {
   // Nearly the same as Monitor::unlock() ...
   // directly set _owner instead of using set_owner(null)
-  _owner = NULL ;
+  _owner = NULL;
   if (_snuck) {         // ???
     assert(SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread(), "sneak");
     _snuck = false;
-    return ;
+    return;
   }
-  IUnlock(false) ;
+  IUnlock(false);
 }
 
 bool Monitor::wait(bool no_safepoint_check, long timeout, bool as_suspend_equivalent) {
-  Thread * const Self = Thread::current() ;
-  assert (_owner == Self, "invariant") ;
-  assert (ILocked(), "invariant") ;
+  Thread * const Self = Thread::current();
+  assert(_owner == Self, "invariant");
+  assert(ILocked(), "invariant");
 
   // as_suspend_equivalent logically implies !no_safepoint_check
-  guarantee (!as_suspend_equivalent || !no_safepoint_check, "invariant") ;
+  guarantee(!as_suspend_equivalent || !no_safepoint_check, "invariant");
   // !no_safepoint_check logically implies java_thread
-  guarantee (no_safepoint_check || Self->is_Java_thread(), "invariant") ;
+  guarantee(no_safepoint_check || Self->is_Java_thread(), "invariant");
 
   #ifdef ASSERT
     Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks());
@@ -1093,14 +1093,14 @@ bool Monitor::wait(bool no_safepoint_check, long timeout, bool as_suspend_equiva
     }
   #endif // ASSERT
 
-  int wait_status ;
+  int wait_status;
   // conceptually set the owner to NULL in anticipation of
   // abdicating the lock in wait
   set_owner(NULL);
   if (no_safepoint_check) {
-    wait_status = IWait (Self, timeout) ;
+    wait_status = IWait(Self, timeout);
   } else {
-    assert (Self->is_Java_thread(), "invariant") ;
+    assert(Self->is_Java_thread(), "invariant");
     JavaThread *jt = (JavaThread *)Self;
 
     // Enter safepoint region - ornate and Rococo ...
@@ -1113,7 +1113,7 @@ bool Monitor::wait(bool no_safepoint_check, long timeout, bool as_suspend_equiva
       // java_suspend_self()
     }
 
-    wait_status = IWait (Self, timeout) ;
+    wait_status = IWait(Self, timeout);
 
     // were we externally suspended while we were waiting?
     if (as_suspend_equivalent && jt->handle_special_suspend_equivalent_condition()) {
@@ -1121,67 +1121,67 @@ bool Monitor::wait(bool no_safepoint_check, long timeout, bool as_suspend_equiva
       // while we were waiting another thread suspended us. We don't
       // want to hold the lock while suspended because that
       // would surprise the thread that suspended us.
-      assert (ILocked(), "invariant") ;
-      IUnlock (true) ;
+      assert(ILocked(), "invariant");
+      IUnlock(true);
       jt->java_suspend_self();
-      ILock (Self) ;
-      assert (ILocked(), "invariant") ;
+      ILock(Self);
+      assert(ILocked(), "invariant");
     }
   }
 
   // Conceptually reestablish ownership of the lock.
   // The "real" lock -- the LockByte -- was reacquired by IWait().
-  assert (ILocked(), "invariant") ;
-  assert (_owner == NULL, "invariant") ;
-  set_owner (Self) ;
-  return wait_status != 0 ;          // return true IFF timeout
+  assert(ILocked(), "invariant");
+  assert(_owner == NULL, "invariant");
+  set_owner(Self);
+  return wait_status != 0;          // return true IFF timeout
 }
 
 Monitor::~Monitor() {
-  assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
+  assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "");
 }
 
 void Monitor::ClearMonitor (Monitor * m, const char *name) {
-  m->_owner             = NULL ;
-  m->_snuck             = false ;
+  m->_owner             = NULL;
+  m->_snuck             = false;
   if (name == NULL) {
-    strcpy(m->_name, "UNKNOWN") ;
+    strcpy(m->_name, "UNKNOWN");
   } else {
     strncpy(m->_name, name, MONITOR_NAME_LEN - 1);
     m->_name[MONITOR_NAME_LEN - 1] = '\0';
   }
-  m->_LockWord.FullWord = 0 ;
-  m->_EntryList         = NULL ;
-  m->_OnDeck            = NULL ;
-  m->_WaitSet           = NULL ;
-  m->_WaitLock[0]       = 0 ;
+  m->_LockWord.FullWord = 0;
+  m->_EntryList         = NULL;
+  m->_OnDeck            = NULL;
+  m->_WaitSet           = NULL;
+  m->_WaitLock[0]       = 0;
 }
 
 Monitor::Monitor() { ClearMonitor(this); }
 
 Monitor::Monitor (int Rank, const char * name, bool allow_vm_block) {
-  ClearMonitor (this, name) ;
+  ClearMonitor(this, name);
 #ifdef ASSERT
   _allow_vm_block  = allow_vm_block;
-  _rank            = Rank ;
+  _rank            = Rank;
 #endif
 }
 
 Mutex::~Mutex() {
-  assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ;
+  assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "");
 }
 
 Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) {
-  ClearMonitor ((Monitor *) this, name) ;
+  ClearMonitor((Monitor *) this, name);
 #ifdef ASSERT
  _allow_vm_block   = allow_vm_block;
- _rank             = Rank ;
+ _rank             = Rank;
 #endif
 }
 
 bool Monitor::owned_by_self() const {
   bool ret = _owner == Thread::current();
-  assert (!ret || _LockWord.Bytes[_LSBINDEX] != 0, "invariant") ;
+  assert(!ret || _LockWord.Bytes[_LSBINDEX] != 0, "invariant");
   return ret;
 }
 
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
index c28c469d0e8..a6d4dfd704d 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
@@ -217,7 +217,7 @@ class SharedRuntime: AllStatic {
   static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
 #endif // COMPILER2
 
-  static address get_resolve_opt_virtual_call_stub(){
+  static address get_resolve_opt_virtual_call_stub() {
     assert(_resolve_opt_virtual_call_blob != NULL, "oops");
     return _resolve_opt_virtual_call_blob->entry_point();
   }
@@ -253,7 +253,7 @@ class SharedRuntime: AllStatic {
   // bytecode tracing is only used by the TraceBytecodes
   static intptr_t trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2) PRODUCT_RETURN0;
 
-  static oop retrieve_receiver( Symbol* sig, frame caller );
+  static oop retrieve_receiver(Symbol* sig, frame caller);
 
   static void register_finalizer(JavaThread* thread, oopDesc* obj);
 
@@ -446,8 +446,8 @@ class SharedRuntime: AllStatic {
   static bool is_wide_vector(int size);
 
   // Save and restore a native result
-  static void    save_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots );
-  static void restore_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots );
+  static void    save_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots);
+  static void restore_native_result(MacroAssembler *_masm, BasicType ret_type, int frame_slots);
 
   // Generate a native wrapper for a given method.  The method takes arguments
   // in the Java compiled code convention, marshals them to the native
@@ -463,7 +463,7 @@ class SharedRuntime: AllStatic {
                                           int compile_id,
                                           BasicType* sig_bt,
                                           VMRegPair* regs,
-                                          BasicType ret_type );
+                                          BasicType ret_type);
 
   // Block before entering a JNI critical method
   static void block_for_jni_critical(JavaThread* thread);
diff --git a/hotspot/src/share/vm/runtime/synchronizer.hpp b/hotspot/src/share/vm/runtime/synchronizer.hpp
index 4f95b31350d..bf3959be688 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.hpp
@@ -75,7 +75,7 @@ class ObjectSynchronizer : AllStatic {
   // Special internal-use-only method for use by JVM infrastructure
   // that needs to wait() on a java-level object but that can't risk
   // throwing unexpected InterruptedExecutionExceptions.
-  static void waitUninterruptibly (Handle obj, jlong Millis, Thread * THREAD) ;
+  static void waitUninterruptibly(Handle obj, jlong Millis, Thread * THREAD);
 
   // used by classloading to free classloader object lock,
   // wait on an internal lock, and reclaim original lock
@@ -85,9 +85,9 @@ class ObjectSynchronizer : AllStatic {
 
   // thread-specific and global objectMonitor free list accessors
 //  static void verifyInUse (Thread * Self) ; too slow for general assert/debug
-  static ObjectMonitor * omAlloc (Thread * Self) ;
-  static void omRelease (Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc) ;
-  static void omFlush   (Thread * Self) ;
+  static ObjectMonitor * omAlloc(Thread * Self);
+  static void omRelease(Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc);
+  static void omFlush(Thread * Self);
 
   // Inflate light weight monitor to heavy weight monitor
   static ObjectMonitor* inflate(Thread * Self, oop obj);
@@ -97,7 +97,7 @@ class ObjectSynchronizer : AllStatic {
   // Returns the identity hash value for an oop
   // NOTE: It may cause monitor inflation
   static intptr_t identity_hash_value_for(Handle obj);
-  static intptr_t FastHashCode (Thread * Self, oop obj) ;
+  static intptr_t FastHashCode(Thread * Self, oop obj);
 
   // java.lang.Thread support
   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
@@ -124,7 +124,7 @@ class ObjectSynchronizer : AllStatic {
   static void verify() PRODUCT_RETURN;
   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
 
-  static void RegisterSpinCallback (int (*)(intptr_t, int), intptr_t) ;
+  static void RegisterSpinCallback(int(*)(intptr_t, int), intptr_t);
 
  private:
   enum { _BLOCKSIZE = 128 };
@@ -155,7 +155,7 @@ class ObjectLocker : public StackObj {
   // Monitor behavior
   void wait      (TRAPS)      { ObjectSynchronizer::wait     (_obj, 0, CHECK); } // wait forever
   void notify_all(TRAPS)      { ObjectSynchronizer::notifyall(_obj,    CHECK); }
-  void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK);}
+  void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK); }
   // complete_exit gives up lock completely, returning recursion count
   // reenter reclaims lock with original recursion count
   intptr_t complete_exit(TRAPS) { return  ObjectSynchronizer::complete_exit(_obj, CHECK_0); }
-- 
GitLab


From 0228c51129d501c446fc09834efcaa42912f2905 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Wed, 18 Jun 2014 18:27:39 -0700
Subject: [PATCH 111/192] 8044715: Add finally lint warning to build of jdk
 repository

Reviewed-by: henryjen, tbell
---
 jdk/make/Setup.gmk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/make/Setup.gmk b/jdk/make/Setup.gmk
index 123a03e2c17..c4119d787d8 100644
--- a/jdk/make/Setup.gmk
+++ b/jdk/make/Setup.gmk
@@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-
 
 # To build with all warnings enabled, do the following:
 # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
-JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,fallthrough,overloads,serial,static,try,varargs -Werror
+JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,fallthrough,finally,overloads,serial,static,try,varargs -Werror
 
 # Any java code executed during a JDK build to build other parts of the JDK must be 
 # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 
-- 
GitLab


From 5a66e76eff6f76043452c77c383f7960b0ca2976 Mon Sep 17 00:00:00 2001
From: Alexander Stepanov <alexander.v.stepanov@oracle.com>
Date: Thu, 19 Jun 2014 12:44:41 +0400
Subject: [PATCH 112/192] 8044429: move awt automated tests for AWT_Modality to
 OpenJDK repository

Reviewed-by: pchelko
---
 .../ApplicationExcludeDialogFileTest.java     |  49 +++
 ...ApplicationExcludeDialogPageSetupTest.java |  49 +++
 ...pplicationExcludeDialogPrintSetupTest.java |  49 +++
 .../ApplicationExcludeFrameFileTest.java      |  50 +++
 .../ApplicationExcludeFramePageSetupTest.java |  50 +++
 ...ApplicationExcludeFramePrintSetupTest.java |  50 +++
 .../ExcludeDialogTest.java                    | 199 ++++++++++
 .../ModalExclusionTests/ExcludeFrameTest.java | 192 +++++++++
 .../ToolkitExcludeDialogFileTest.java         |  50 +++
 .../ToolkitExcludeDialogPageSetupTest.java    |  50 +++
 .../ToolkitExcludeDialogPrintSetupTest.java   |  50 +++
 .../ToolkitExcludeFrameFileTest.java          |  50 +++
 .../ToolkitExcludeFramePageSetupTest.java     |  50 +++
 .../ToolkitExcludeFramePrintSetupTest.java    |  50 +++
 jdk/test/java/awt/Modal/helpers/Flag.java     |  84 ++++
 .../java/awt/Modal/helpers/TestDialog.java    | 366 +++++++++++++++++
 .../java/awt/Modal/helpers/TestFrame.java     | 369 ++++++++++++++++++
 .../java/awt/Modal/helpers/TestWindow.java    | 333 ++++++++++++++++
 18 files changed, 2140 insertions(+)
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeDialogTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeFrameTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java
 create mode 100644 jdk/test/java/awt/Modal/helpers/Flag.java
 create mode 100644 jdk/test/java/awt/Modal/helpers/TestDialog.java
 create mode 100644 jdk/test/java/awt/Modal/helpers/TestFrame.java
 create mode 100644 jdk/test/java/awt/Modal/helpers/TestWindow.java

diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java
new file mode 100644
index 00000000000..b86c2b2c2ef
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogFileTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8047179 8044429
+ * @summary Check whether a FileDialog blocks an application modality excluded Dialog
+ *          (it shouldn't). Checks also whether setting a parent dialog to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestWindow
+ * @run main ApplicationExcludeDialogFileTest
+ */
+
+public class ApplicationExcludeDialogFileTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeDialogTest test = new ExcludeDialogTest(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE,
+                ExcludeDialogTest.DialogToShow.FILE_DIALOG);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java
new file mode 100644
index 00000000000..c3b083b4e76
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPageSetupTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a pageDialog blocks an application modality excluded Dialog
+ *          (it shouldn't). Checks also whether setting a parent dialog to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestWindow
+ * @run main ApplicationExcludeDialogPageSetupTest
+ */
+
+public class ApplicationExcludeDialogPageSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeDialogTest test = new ExcludeDialogTest(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE,
+                ExcludeDialogTest.DialogToShow.PAGE_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java
new file mode 100644
index 00000000000..8bd4330efdf
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeDialogPrintSetupTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a printDialog blocks an application modality excluded Dialog
+ *          (it shouldn't). Checks also whether setting a parent dialog to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestWindow
+ * @run main ApplicationExcludeDialogPrintSetupTest
+ */
+
+public class ApplicationExcludeDialogPrintSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeDialogTest test = new ExcludeDialogTest(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE,
+                ExcludeDialogTest.DialogToShow.PRINT_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java
new file mode 100644
index 00000000000..83ebdff711d
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFrameFileTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8047179 8044429
+ * @summary Check whether a FileDialog blocks an application modality excluded Frame
+ *          (it shouldn't). Checks also whether setting a parent frame to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ApplicationExcludeFrameFileTest
+ */
+
+public class ApplicationExcludeFrameFileTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeFrameTest test = new ExcludeFrameTest(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE,
+                ExcludeFrameTest.DialogToShow.FILE_DIALOG);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java
new file mode 100644
index 00000000000..ce34348dbc8
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePageSetupTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a pageDialog blocks an application modality excluded Frame
+ *          (it shouldn't). Checks also whether setting a parent frame to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ApplicationExcludeFramePageSetupTest
+ */
+
+public class ApplicationExcludeFramePageSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeFrameTest test = new ExcludeFrameTest(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE,
+                ExcludeFrameTest.DialogToShow.PAGE_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java
new file mode 100644
index 00000000000..66aeb64e08b
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ApplicationExcludeFramePrintSetupTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a printDialog blocks an application modality excluded Frame
+ *          (it shouldn't). Checks also whether setting a parent frame to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ApplicationExcludeFramePrintSetupTest
+ */
+
+public class ApplicationExcludeFramePrintSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeFrameTest test = new ExcludeFrameTest(
+                Dialog.ModalExclusionType.APPLICATION_EXCLUDE,
+                ExcludeFrameTest.DialogToShow.PRINT_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeDialogTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeDialogTest.java
new file mode 100644
index 00000000000..9b15ecefe4f
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeDialogTest.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.print.*;
+
+import static jdk.testlibrary.Asserts.*;
+
+
+public class ExcludeDialogTest implements AWTEventListener {
+
+    class ParentDialog extends TestDialog {
+
+        public ParentDialog() {
+            super((Frame) null);
+        }
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) {
+                window.setVisible(true);
+            }
+        }
+    }
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Dialog dialog) {
+            super(dialog);
+        }
+
+        @Override
+        public void doOpenAction() {
+
+            switch (childDialogType) {
+                case PRINT_SETUP:
+                    PrinterJob.getPrinterJob().printDialog();
+                    break;
+                case PAGE_SETUP:
+                    PrinterJob.getPrinterJob().pageDialog(new PageFormat());
+                    break;
+                case FILE_DIALOG:
+                    fileDialog = new FileDialog((Dialog) null);
+                    fileDialog.setLocation(20, 200);
+                    fileDialog.setVisible(true);
+                    break;
+            }
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(Dialog parent) {
+            super(parent);
+        }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) {
+                dialog.setVisible(true);
+            }
+        }
+    }
+
+    private TestWindow window;
+    private TestDialog dialog;
+    private ParentDialog parent;
+    private FileDialog fileDialog;
+
+    private static final int delay = 1000;
+
+    private final ExtendedRobot robot;
+
+    private boolean windowAppeared = false;
+    private final Object windowLock;
+
+    private final Dialog.ModalExclusionType exclusionType;
+
+    public enum DialogToShow {PAGE_SETUP, PRINT_SETUP, FILE_DIALOG};
+    private DialogToShow childDialogType;
+    private String type;
+
+    @Override
+    public void eventDispatched(AWTEvent event) {
+        if (event.getID() == WindowEvent.WINDOW_OPENED) {
+            windowAppeared = true;
+            synchronized (windowLock) {
+                windowLock.notifyAll();
+            }
+        }
+    }
+
+    ExcludeDialogTest(Dialog.ModalExclusionType exclType,
+                      DialogToShow dialogType) throws Exception {
+        exclusionType = exclType;
+        childDialogType = dialogType;
+
+        type = "File";
+        if (dialogType == DialogToShow.PAGE_SETUP) {
+            type = "Page setup";
+        } else if (dialogType == DialogToShow.PRINT_SETUP) {
+            type = "Print setup";
+        }
+
+        robot = new ExtendedRobot();
+        windowLock = new Object();
+        EventQueue.invokeAndWait( this::createGUI );
+    }
+
+    private void createGUI() {
+        parent = new ParentDialog();
+        parent.setLocation(20, 20);
+        parent.setModalExclusionType(exclusionType);
+        dialog = new CustomDialog(parent);
+        dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+        dialog.setLocation(220, 20);
+        window = new CustomWindow(parent);
+        window.setLocation(420, 20);
+        Toolkit.getDefaultToolkit().addAWTEventListener(
+            ExcludeDialogTest.this, AWTEvent.WINDOW_EVENT_MASK);
+        parent.setVisible(true);
+    }
+
+    private void closeAll() {
+        if (dialog != null) { dialog.dispose(); }
+        if (parent != null) { parent.dispose(); }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) {
+            fileDialog.dispose();
+        } else {
+            robot.type(KeyEvent.VK_ESCAPE);
+        }
+    }
+
+    public void doTest() throws Exception {
+
+        robot.waitForIdle(delay);
+
+        parent.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+
+        if (! windowAppeared) {
+            synchronized (windowLock) {
+                try {
+                    windowLock.wait(10 * delay);
+                } catch (InterruptedException e) {}
+            }
+        }
+
+        assertTrue(windowAppeared, type + " dialog didn't appear");
+
+        parent.toFront();
+        robot.waitForIdle(delay);
+
+        String excl = "";
+        if (exclusionType == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) {
+            excl = "Application";
+        } else if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) {
+            excl = "Toolkit";
+        }
+
+        parent.checkUnblockedDialog(robot, excl + " modal " + type +
+                " dialog should not block this modal excluded Dialog");
+        dialog.checkUnblockedDialog(robot, excl + " modal " + type +
+                " dialog should not block this modal excluded app. modal Dialog");
+        window.checkUnblockedWindow(robot, excl + " modal " + type +
+                " dialog should not block this modal excluded Window");
+
+        robot.waitForIdle();
+        closeAll();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeFrameTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeFrameTest.java
new file mode 100644
index 00000000000..6253c23be51
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ExcludeFrameTest.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.print.*;
+
+import static jdk.testlibrary.Asserts.*;
+
+
+public class ExcludeFrameTest implements AWTEventListener {
+    class CustomFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) {
+                window.setVisible(true);
+            }
+        }
+    }
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Frame frame) {
+            super(frame);
+        }
+
+        @Override
+        public void doOpenAction() {
+            switch (childDialogType) {
+                case PRINT_SETUP:
+                    PrinterJob.getPrinterJob().printDialog();
+                    break;
+                case PAGE_SETUP:
+                    PrinterJob.getPrinterJob().pageDialog(new PageFormat());
+                    break;
+                case FILE_DIALOG:
+                    fileDialog = new FileDialog((Frame) null);
+                    fileDialog.setLocation(20, 200);
+                    fileDialog.setVisible(true);
+                    break;
+            }
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(Frame frame) {
+            super(frame);
+        }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) {
+                dialog.setVisible(true);
+            }
+        }
+    }
+
+    private TestDialog dialog;
+    private TestFrame  frame;
+    private TestWindow window;
+    private FileDialog fileDialog;
+
+    private boolean windowAppeared = false;
+    private final Object windowLock;
+
+    private static final int delay = 1000;
+    private final ExtendedRobot robot;
+
+    private final Dialog.ModalExclusionType exclusionType;
+
+    public enum DialogToShow {PAGE_SETUP, PRINT_SETUP, FILE_DIALOG};
+    private final DialogToShow childDialogType;
+    private String type;
+
+    public ExcludeFrameTest(Dialog.ModalExclusionType exclType,
+                            DialogToShow dialogType) throws Exception {
+        exclusionType = exclType;
+        childDialogType = dialogType;
+
+        type = "File";
+        if (dialogType == DialogToShow.PAGE_SETUP) {
+            type = "Page setup";
+        } else if (dialogType == DialogToShow.PRINT_SETUP) {
+            type = "Print setup";
+        }
+
+        windowLock = new Object();
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait( this::createGUI );
+    }
+
+    @Override
+    public void eventDispatched(AWTEvent event) {
+        if (event.getID() == WindowEvent.WINDOW_OPENED) {
+            windowAppeared = true;
+            synchronized (windowLock) {
+                windowLock.notifyAll();
+            }
+        }
+    }
+
+    private void createGUI() {
+        frame = new CustomFrame();
+        frame.setLocation(20, 20);
+        frame.setModalExclusionType(exclusionType);
+        dialog = new CustomDialog(frame);
+        dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+        dialog.setLocation(220, 20);
+        window = new CustomWindow(frame);
+        window.setLocation(420, 20);
+        Toolkit.getDefaultToolkit().addAWTEventListener(
+                ExcludeFrameTest.this, AWTEvent.WINDOW_EVENT_MASK);
+        frame.setVisible(true);
+    }
+
+    private void closeAll() {
+        if (dialog != null) { dialog.dispose(); }
+        if (frame  != null) { frame.dispose();  }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) {
+            fileDialog.dispose();
+        } else {
+            robot.type(KeyEvent.VK_ESCAPE);
+        }
+    }
+
+    public void doTest() throws Exception {
+
+        robot.waitForIdle(delay);
+
+        frame.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+
+        if (! windowAppeared) {
+            synchronized (windowLock) {
+                try {
+                    windowLock.wait(10 * delay);
+                } catch (InterruptedException e) {}
+            }
+        }
+
+        assertTrue(windowAppeared, type + " dialog didn't appear");
+
+        frame.toFront();
+        robot.waitForIdle(delay);
+
+        String excl = "";
+        if (exclusionType == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) {
+            excl = "Application";
+        } else if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) {
+            excl = "Toolkit";
+        }
+
+        frame.checkUnblockedFrame(robot, excl + " modal " + type +
+                " dialog should not block this modal excluded Frame");
+        dialog.checkUnblockedDialog(robot, excl + " modal " + type +
+                " dialog should not block this modal excluded app. modal Dialog");
+        window.checkUnblockedWindow(robot, excl + " modal " + type +
+                " dialog should not block this modal excluded Window");
+
+        robot.waitForIdle();
+        closeAll();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java
new file mode 100644
index 00000000000..78c612d3d53
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogFileTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8047179 8044429
+ * @summary Check whether a FileDialog blocks a toolkit modality excluded Dialog
+ *          (it shouldn't). Checks also whether setting a parent dialog to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ToolkitExcludeDialogFileTest
+ */
+
+public class ToolkitExcludeDialogFileTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeDialogTest test = new ExcludeDialogTest(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
+                ExcludeDialogTest.DialogToShow.FILE_DIALOG);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java
new file mode 100644
index 00000000000..4e67f651c0a
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPageSetupTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a pageDialog blocks a toolkit modality excluded Dialog
+ *          (it shouldn't). Checks also whether setting a parent dialog to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ToolkitExcludeDialogPageSetupTest
+ */
+
+public class ToolkitExcludeDialogPageSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeDialogTest test = new ExcludeDialogTest(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
+                ExcludeDialogTest.DialogToShow.PAGE_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java
new file mode 100644
index 00000000000..5f0bd425915
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeDialogPrintSetupTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a printDialog blocks a toolkit modality excluded Dialog
+ *          (it shouldn't). Checks also whether setting a parent dialog to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ToolkitExcludeDialogPrintSetupTest
+ */
+
+public class ToolkitExcludeDialogPrintSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeDialogTest test = new ExcludeDialogTest(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
+                ExcludeDialogTest.DialogToShow.PRINT_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java
new file mode 100644
index 00000000000..ec845086ae4
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFrameFileTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8047179 8044429
+ * @summary Check whether a FileDialog blocks a toolkit modality excluded Frame
+ *          (it shouldn't). Checks also whether setting a parent frame to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ToolkitExcludeFrameFileTest
+ */
+
+public class ToolkitExcludeFrameFileTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeFrameTest test = new ExcludeFrameTest(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
+                ExcludeFrameTest.DialogToShow.FILE_DIALOG);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java
new file mode 100644
index 00000000000..f26bc8feaed
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePageSetupTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a pageDialog blocks a toolkit modality excluded Frame
+ *          (it shouldn't). Checks also whether setting a parent frame to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ToolkitExcludeFramePageSetupTest
+ */
+
+public class ToolkitExcludeFramePageSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeFrameTest test = new ExcludeFrameTest(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
+                ExcludeFrameTest.DialogToShow.PAGE_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java
new file mode 100644
index 00000000000..809dd20bd10
--- /dev/null
+++ b/jdk/test/java/awt/Modal/ModalExclusionTests/ToolkitExcludeFramePrintSetupTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 7125054 8044429
+ * @summary Check whether a printDialog blocks a toolkit modality excluded Frame
+ *          (it shouldn't). Checks also whether setting a parent frame to be
+ *          modality excluded excludes its children from being blocked too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main ToolkitExcludeFramePrintSetupTest
+ */
+
+public class ToolkitExcludeFramePrintSetupTest {
+
+    public static void main(String[] args) throws Exception {
+        ExcludeFrameTest test = new ExcludeFrameTest(
+                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
+                ExcludeFrameTest.DialogToShow.PRINT_SETUP);
+        test.doTest();
+    }
+}
diff --git a/jdk/test/java/awt/Modal/helpers/Flag.java b/jdk/test/java/awt/Modal/helpers/Flag.java
new file mode 100644
index 00000000000..c03787186aa
--- /dev/null
+++ b/jdk/test/java/awt/Modal/helpers/Flag.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Component;
+import java.awt.IllegalComponentStateException;
+
+public class Flag {
+
+    public static final int ATTEMPTS = 50;
+
+    private volatile boolean flag;
+    private final Object monitor = new Object();
+    private final long delay;
+
+    public Flag() {
+        this.delay = 500;
+    }
+
+    public void reset() {
+        flag = false;
+    }
+
+    public void flagTriggered() {
+        synchronized (monitor) {
+            flag = true;
+            monitor.notifyAll();
+        }
+    }
+
+    public boolean flag() {
+        return flag;
+    }
+
+    public void waitForFlagTriggered() throws InterruptedException {
+        waitForFlagTriggered(delay, ATTEMPTS);
+    }
+
+    public void waitForFlagTriggered(int attempts) throws InterruptedException {
+        waitForFlagTriggered(delay, attempts);
+    }
+
+    public void waitForFlagTriggered(long delay) throws InterruptedException {
+        waitForFlagTriggered(delay, ATTEMPTS);
+    }
+
+    private void waitForFlagTriggered(long delay, int attempts) throws InterruptedException {
+        int a = 0;
+        synchronized (monitor) {
+            while (!flag && (a++ < attempts)) {
+                monitor.wait(delay);
+            }
+        }
+    }
+
+    public static void waitTillShown(final Component comp) throws InterruptedException {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                comp.getLocationOnScreen();
+                break;
+            } catch (IllegalComponentStateException e) {}
+        }
+    }
+}
diff --git a/jdk/test/java/awt/Modal/helpers/TestDialog.java b/jdk/test/java/awt/Modal/helpers/TestDialog.java
new file mode 100644
index 00000000000..a3791778bc1
--- /dev/null
+++ b/jdk/test/java/awt/Modal/helpers/TestDialog.java
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.event.*;
+
+import static jdk.testlibrary.Asserts.*;
+
+
+
+public class TestDialog extends Dialog implements ActionListener,
+    FocusListener, WindowFocusListener, WindowListener {
+
+    public Button closeButton, openButton, dummyButton;
+
+    public Flag closeClicked, openClicked, dummyClicked;
+    public Flag closeGained,  openGained,  dummyGained;
+    public Flag closeLost,    openLost,    dummyLost;
+    public Flag focusGained, focusLost;
+    public Flag activated;
+
+    public Panel topPanel;
+
+    public static int delay = 500;
+    public static int keyDelay = 100;
+
+    public TestDialog(Frame frame) {
+        super(frame);
+        initializeGUI();
+    }
+
+    public TestDialog(Dialog dialog) {
+        super(dialog);
+        initializeGUI();
+    }
+
+    public void resetStatus() {
+        activated.reset();
+        focusGained.reset();
+        closeGained.reset();
+        openGained.reset();
+        closeClicked.reset();
+        openClicked.reset();
+    }
+
+    private void initFlags() {
+        closeClicked = new Flag();
+        openClicked  = new Flag();
+        dummyClicked = new Flag();
+        closeGained  = new Flag();
+        openGained   = new Flag();
+        dummyGained  = new Flag();
+        closeLost    = new Flag();
+        openLost     = new Flag();
+        dummyLost    = new Flag();
+        focusGained  = new Flag();
+        focusLost    = new Flag();
+        activated    = new Flag();
+    }
+
+    private void initializeGUI() {
+
+        initFlags();
+        this.setTitle("Dialog");
+
+        this.addWindowFocusListener(this);
+        this.addWindowListener(this);
+
+        this.setLayout(new GridLayout(3, 1));
+
+        topPanel = new Panel();
+        topPanel.setFocusable(false);
+        this.add(topPanel);
+
+        Panel p = new Panel();
+        p.setLayout(new GridLayout(1, 3));
+
+        closeButton = new Button("Close");
+        closeButton.addActionListener(this);
+        closeButton.addFocusListener(this);
+
+        openButton = new Button("Open");
+        openButton.addActionListener(this);
+        openButton.addFocusListener(this);
+
+        dummyButton = new Button("Dummy");
+        dummyButton.addActionListener(this);
+        dummyButton.addFocusListener(this);
+
+        p.add(closeButton);
+        p.add(openButton);
+        p.add(dummyButton);
+
+        this.add(p);
+
+        Panel bottomPanel = new Panel();
+        bottomPanel.setFocusable(false);
+        this.add(bottomPanel);
+
+        setSize(150, 150);
+    }
+
+    public void doOpenAction()  {}
+    public void doCloseAction() {}
+    public void doDummyAction() {}
+
+    @Override
+    public void actionPerformed(ActionEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeClicked.flagTriggered();
+            doCloseAction();
+        } else if (openButton.equals(event.getSource())) {
+            openClicked.flagTriggered();
+            doOpenAction();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyClicked.flagTriggered();
+            doDummyAction();
+        }
+    }
+
+    @Override
+    public void focusGained(FocusEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeGained.flagTriggered();
+        } else if (openButton.equals(event.getSource())) {
+            openGained.flagTriggered();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyGained.flagTriggered();
+        }
+    }
+
+    @Override
+    public void focusLost(FocusEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeLost.flagTriggered();
+        } else if (openButton.equals(event.getSource())) {
+            openLost.flagTriggered();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyLost.flagTriggered();
+        }
+    }
+
+    @Override
+    public void windowGainedFocus(WindowEvent event) {
+        focusGained.flagTriggered();
+    }
+
+    @Override
+    public void windowLostFocus(WindowEvent event) {
+        focusLost.flagTriggered();
+    }
+
+    @Override
+    public void windowActivated(WindowEvent e) {
+        activated.flagTriggered();
+    }
+
+    @Override
+    public void windowClosed(WindowEvent e) {
+    }
+
+    @Override
+    public void windowClosing(WindowEvent e) {
+        assertTrue(false, "user closed window");
+    }
+
+    @Override
+    public void windowDeactivated(WindowEvent e) {}
+    @Override
+    public void windowDeiconified(WindowEvent e) {}
+    @Override
+    public void windowIconified(WindowEvent e) {}
+    @Override
+    public void windowOpened(WindowEvent e) {}
+
+    public void clickButton(Button b, ExtendedRobot robot) {
+
+        try {
+            Flag.waitTillShown(b);
+        } catch (InterruptedException e) {}
+
+        if ((closeButton.equals(b) || openButton.equals(b) ||
+            dummyButton.equals(b)) && robot != null) {
+            robot.mouseMove((int) b.getLocationOnScreen().x + b.getSize().width / 2,
+                            (int) b.getLocationOnScreen().y + b.getSize().height / 2);
+            robot.delay(delay);
+            robot.click();
+            robot.delay(delay);
+        }
+    }
+
+    public void clickOpenButton(ExtendedRobot robot) throws Exception {
+        openClicked.reset();
+        clickButton(openButton, robot);
+
+        openClicked.waitForFlagTriggered();
+        assertTrue(openClicked.flag(),
+            "clicking the dialog Open button did not trigger an action");
+    }
+
+    public void clickCloseButton(ExtendedRobot robot) throws Exception {
+        closeClicked.reset();
+        clickButton(closeButton, robot);
+
+        closeClicked.waitForFlagTriggered();
+        assertTrue(closeClicked.flag(),
+            "clicking the dialog Close button did not trigger an action");
+    }
+
+    public void clickDummyButton(ExtendedRobot robot) throws Exception {
+        clickDummyButton(robot, Flag.ATTEMPTS);
+    }
+
+    public void clickDummyButton(ExtendedRobot robot, int attempts) throws Exception {
+        dummyClicked.reset();
+        clickButton(dummyButton, robot);
+
+        dummyClicked.waitForFlagTriggered(attempts);
+        assertTrue(dummyClicked.flag(),
+            "clicking the dialog Dummy button did not trigger an action");
+    }
+
+    private void clickInside(ExtendedRobot robot) throws Exception {
+
+        try {
+            Flag.waitTillShown(topPanel);
+        } catch (InterruptedException e) {}
+
+        if (robot != null) {
+            robot.mouseMove((int) topPanel.getLocationOnScreen().x + topPanel.getSize().width / 2,
+                            (int) topPanel.getLocationOnScreen().y + topPanel.getSize().height / 2);
+            robot.delay(delay);
+            robot.click();
+            robot.delay(delay);
+        }
+    }
+
+    public void transferFocusToDialog(ExtendedRobot robot,
+                                      String message,
+                                      Button b) throws Exception {
+        focusGained.reset();
+        clickInside(robot);
+        focusGained.waitForFlagTriggered();
+        assertTrue(focusGained.flag(),
+            "clicking inside the Dialog did not make it focused. " + message);
+
+        robot.waitForIdle(delay);
+        if (b != null) {
+            assertTrue(b.hasFocus(), "button " + b.getLabel() +
+                " did not gain focus when Dialog brought to top");
+        }
+    }
+
+    public void transferFocusToBlockedDialog(ExtendedRobot robot,
+                                             String message,
+                                             Button b) throws Exception {
+        focusGained.reset();
+        clickInside(robot);
+        robot.waitForIdle(delay);
+
+        assertFalse(focusGained.flag(),
+            "clicking inside a blocked Dialog made it focused. " + message);
+
+        robot.waitForIdle(delay);
+        if (b != null) {
+            assertFalse(b.hasFocus(),
+                "button " + b.getLabel() + " present in a blocked dialog gained focus");
+        }
+    }
+
+    public void checkBlockedDialog(ExtendedRobot robot,
+                                   String message) throws Exception {
+        dummyGained.reset();
+        dummyClicked.reset();
+        focusGained.reset();
+
+        clickButton(dummyButton, robot);
+
+        robot.waitForIdle(delay);
+
+        assertFalse(dummyClicked.flag(),
+            "DummyButton on blocked Dialog triggered action when clicked. " + message);
+
+        assertFalse(dummyGained.flag(),
+            "DummyButton on blocked Dialog gained focus when clicked. " + message);
+
+        assertFalse(focusGained.flag(),
+            "A blocked Dialog gained focus when component clicked. " + message);
+    }
+
+    public void checkUnblockedDialog(ExtendedRobot robot,
+                                     String message) throws Exception {
+        dummyGained.reset();
+        dummyClicked.reset();
+        clickButton(dummyButton, robot);
+
+        dummyGained.waitForFlagTriggered();
+        assertTrue(dummyGained.flag(),
+            "DummyButton on Dialog did not gain focus when clicked. " + message);
+
+        dummyClicked.waitForFlagTriggered();
+        assertTrue(dummyClicked.flag(),
+            "DummyButton on Dialog did not trigger action when clicked. " + message);
+
+        closeGained.reset();
+        robot.type(KeyEvent.VK_TAB);
+
+        closeGained.waitForFlagTriggered();
+        assertTrue(closeGained.flag(),
+            "Tab navigation on Dialog did not happen properly. First " +
+            "button did not gain focus. " + message);
+    }
+
+    public void checkCloseButtonFocusGained() {
+        checkCloseButtonFocusGained(Flag.ATTEMPTS);
+    }
+
+    public void checkCloseButtonFocusGained(int attempts) {
+        try {
+            closeGained.waitForFlagTriggered(attempts);
+        } catch (InterruptedException e) {}
+        assertTrue(closeGained.flag(),
+            "dialog Close button did not gain focus");
+    }
+
+    public void checkOpenButtonFocusGained() {
+        try {
+            openGained.waitForFlagTriggered();
+        } catch (InterruptedException e) {}
+        assertTrue(openGained.flag(),
+            "dialog Open button did not gain focus");
+    }
+
+    public void checkOpenButtonFocusLost() {
+        checkOpenButtonFocusLost(Flag.ATTEMPTS);
+    }
+
+    public void checkOpenButtonFocusLost(int attempts) {
+        try {
+            openLost.waitForFlagTriggered(attempts);
+        } catch (InterruptedException e) {}
+        assertTrue(openLost.flag(),
+            "dialog Open button did not lose focus");
+    }
+}
diff --git a/jdk/test/java/awt/Modal/helpers/TestFrame.java b/jdk/test/java/awt/Modal/helpers/TestFrame.java
new file mode 100644
index 00000000000..8b646f82291
--- /dev/null
+++ b/jdk/test/java/awt/Modal/helpers/TestFrame.java
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+
+import static jdk.testlibrary.Asserts.*;
+
+
+
+public class TestFrame extends Frame implements ActionListener,
+    FocusListener, WindowFocusListener, WindowListener {
+
+    public Button closeButton, openButton, dummyButton;
+
+    public Flag closeClicked, openClicked, dummyClicked;
+    public Flag closeGained,  openGained,  dummyGained;
+    public Flag closeLost,    openLost,    dummyLost;
+    public Flag focusGained, focusLost;
+    public Flag activated;
+
+    public Panel topPanel;
+
+    public static int delay = 500;
+    public static int keyDelay = 100;
+
+    public TestFrame() {
+        super();
+        initializeGUI();
+    }
+
+    private void initFlags() {
+        closeClicked = new Flag();
+        openClicked  = new Flag();
+        dummyClicked = new Flag();
+        closeGained  = new Flag();
+        openGained   = new Flag();
+        dummyGained  = new Flag();
+        closeLost    = new Flag();
+        openLost     = new Flag();
+        dummyLost    = new Flag();
+        focusGained  = new Flag();
+        focusLost    = new Flag();
+        activated    = new Flag();
+    }
+
+    public void resetStatus() {
+        activated.reset();
+        focusGained.reset();
+        closeGained.reset();
+        openGained.reset();
+        closeClicked.reset();
+        openClicked.reset();
+    }
+
+    private void initializeGUI() {
+
+        initFlags();
+        this.setTitle("Frame");
+
+        this.addWindowFocusListener(this);
+        this.addWindowListener(this);
+
+        this.setLayout(new GridLayout(3, 1));
+
+        topPanel = new Panel();
+        topPanel.setFocusable(false);
+        this.add(topPanel);
+
+        Panel p = new Panel();
+        p.setLayout(new GridLayout(1, 3));
+
+        closeButton = new Button("Close");
+        closeButton.addActionListener(this);
+        closeButton.addFocusListener(this);
+
+        openButton = new Button("Open");
+        openButton.addActionListener(this);
+        openButton.addFocusListener(this);
+
+        dummyButton = new Button("Dummy");
+        dummyButton.addActionListener(this);
+        dummyButton.addFocusListener(this);
+
+        p.add(closeButton);
+        p.add(openButton);
+        p.add(dummyButton);
+
+        this.add(p);
+
+        Panel bottomPanel = new Panel();
+        bottomPanel.setFocusable(false);
+        this.add(bottomPanel);
+
+        setSize(150, 150);
+    }
+
+    public void doOpenAction()  {}
+    public void doCloseAction() {}
+    public void doDummyAction() {}
+
+    @Override
+    public void actionPerformed(ActionEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeClicked.flagTriggered();
+            doCloseAction();
+        } else if (openButton.equals(event.getSource())) {
+            openClicked.flagTriggered();
+            doOpenAction();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyClicked.flagTriggered();
+            doDummyAction();
+        }
+    }
+
+    @Override
+    public void focusGained(FocusEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeGained.flagTriggered();
+        } else if (openButton.equals(event.getSource())) {
+            openGained.flagTriggered();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyGained.flagTriggered();
+        }
+    }
+
+    @Override
+    public void focusLost(FocusEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeLost.flagTriggered();
+        } else if (openButton.equals(event.getSource())) {
+            openLost.flagTriggered();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyLost.flagTriggered();
+        }
+    }
+
+    @Override
+    public void windowGainedFocus(WindowEvent event) {
+        focusGained.flagTriggered();
+    }
+
+    @Override
+    public void windowLostFocus(WindowEvent event) {
+        focusLost.flagTriggered();
+    }
+
+    @Override
+    public void windowActivated(WindowEvent e) {
+        activated.flagTriggered();
+    }
+
+    @Override
+    public void windowClosed(WindowEvent e) {}
+
+    @Override
+    public void windowClosing(WindowEvent e) {
+        assertTrue(false, "user closed window");
+    }
+
+    @Override
+    public void windowDeactivated(WindowEvent e) {}
+    @Override
+    public void windowDeiconified(WindowEvent e) {}
+    @Override
+    public void windowIconified(WindowEvent e) {}
+    @Override
+    public void windowOpened(WindowEvent e) {}
+
+    public void clickButton(Button b, ExtendedRobot robot) {
+        try {
+            Flag.waitTillShown(b);
+        } catch (InterruptedException e) {}
+
+        if ((closeButton.equals(b) || openButton.equals(b) ||
+            dummyButton.equals(b)) && robot != null) {
+            robot.mouseMove((int) b.getLocationOnScreen().x + b.getSize().width / 2,
+                            (int) b.getLocationOnScreen().y + b.getSize().height / 2);
+            robot.delay(delay);
+            robot.click();
+            robot.delay(delay);
+        }
+    }
+
+    public void clickOpenButton(ExtendedRobot robot) throws Exception {
+        openClicked.reset();
+        clickButton(openButton, robot);
+        openClicked.waitForFlagTriggered();
+        assertTrue(openClicked.flag(),
+            "clicking the frame Open button did not trigger an action");
+    }
+
+    public void clickCloseButton(ExtendedRobot robot) throws Exception {
+        closeClicked.reset();
+        clickButton(closeButton, robot);
+        closeClicked.waitForFlagTriggered();
+        assertTrue(closeClicked.flag(),
+            "clicking the frame Close button did not trigger an action");
+    }
+
+    public void clickDummyButton(ExtendedRobot robot) throws Exception {
+        clickDummyButton(robot, Flag.ATTEMPTS);
+    }
+
+    public void clickDummyButton(ExtendedRobot robot,
+                                 int amountOfAttempts) throws Exception {
+        dummyClicked.reset();
+        clickButton(dummyButton, robot);
+
+        dummyClicked.waitForFlagTriggered();
+        assertTrue(dummyClicked.flag(),
+            "clicking the frame Dummy button did not trigger an action");
+    }
+
+    public void clickInside(ExtendedRobot robot) throws Exception {
+        try {
+            Flag.waitTillShown(topPanel);
+        } catch (InterruptedException e) {}
+
+        if (robot != null) {
+            robot.mouseMove((int) topPanel.getLocationOnScreen().x + topPanel.getSize().width / 2,
+                            (int) topPanel.getLocationOnScreen().y + topPanel.getSize().height / 2);
+            robot.delay(delay);
+            robot.click();
+            robot.delay(delay);
+        }
+    }
+
+    public void transferFocusToFrame(ExtendedRobot robot,
+                                     String message,
+                                     Button b) throws Exception {
+        focusGained.reset();
+        clickInside(robot);
+
+        focusGained.waitForFlagTriggered();
+        assertTrue(focusGained.flag(),
+            "Clicking inside the Frame did not make it focused. " + message);
+
+        if (b != null) {
+            assertTrue(b.hasFocus(), "Button " + b.getLabel() +
+                " did not gain focus when Frame brought to top");
+        }
+    }
+
+    public void transferFocusToBlockedFrame(ExtendedRobot robot,
+                                            String message,
+                                            Button b) throws Exception {
+        focusGained.reset();
+        clickInside(robot);
+
+        robot.waitForIdle(delay);
+
+        assertFalse(focusGained.flag(),
+            "Clicking inside a blocked Frame made it focused. " + message);
+
+        robot.waitForIdle(delay);
+        if (b != null) {
+            assertFalse(b.hasFocus(), "Button " + b.getLabel() +
+                " present in a blocked frame gained focus");
+        }
+    }
+
+    public void checkBlockedFrame(
+            ExtendedRobot robot, String message) throws Exception {
+
+        dummyGained.reset();
+        dummyClicked.reset();
+        focusGained.reset();
+
+        clickButton(dummyButton, robot);
+
+        robot.waitForIdle(delay);
+
+        assertFalse(dummyClicked.flag(),
+            "DummyButton on blocked Window triggered action when clicked. " + message);
+
+        assertFalse(dummyGained.flag(),
+            "DummyButton on blocked Window gained focus when clicked. " + message);
+
+        assertFalse(focusGained.flag(),
+            "A blocked Dialog gained focus when component clicked. " + message);
+    }
+
+    public void checkUnblockedFrame(ExtendedRobot robot,
+                                    String message) throws Exception {
+        dummyGained.reset();
+        dummyClicked.reset();
+        clickButton(dummyButton, robot);
+
+        dummyGained.waitForFlagTriggered();
+        assertTrue(dummyGained.flag(),
+            "DummyButton on Frame did not gain focus on clicking. " + message);
+
+        dummyClicked.waitForFlagTriggered();
+        assertTrue(dummyClicked.flag(),
+            "DummyButton on Frame did not trigger action on clicking. " + message);
+
+        closeGained.reset();
+        robot.type(KeyEvent.VK_TAB);
+
+        closeGained.waitForFlagTriggered();
+        assertTrue(closeGained.flag(),
+            "FAIL: Tab navigation did not happen properly on Frame. First " +
+            "button did not gain focus on tab press. " + message);
+    }
+
+    public void checkCloseButtonFocusGained() {
+        checkCloseButtonFocusGained(Flag.ATTEMPTS);
+    }
+
+    public void checkCloseButtonFocusGained(int attempts) {
+
+        try {
+            closeGained.waitForFlagTriggered(attempts);
+        } catch (InterruptedException e) {}
+
+        if (closeGained.flag()) {
+            Component focusOwner =
+                KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+            assertTrue(closeButton.equals(focusOwner),
+                "close button gained focus, but it is not the current focus owner");
+        } else {
+            assertTrue(false, "frame Close button did not gain focus");
+        }
+    }
+
+    public void checkOpenButtonFocusGained() {
+        try {
+            openGained.waitForFlagTriggered();
+        } catch (InterruptedException e) {}
+
+        if (openGained.flag()) {
+            Component focusOwner =
+                KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+            assertTrue(openButton.equals(focusOwner),
+                "open button gained focus, but it is not the current focus owner");
+        } else {
+            assertTrue(false, "frame Open button did not gain focus");
+        }
+    }
+
+    public void checkOpenButtonFocusLost() {
+        try {
+            openLost.waitForFlagTriggered();
+        } catch (InterruptedException e) {}
+
+        assertTrue(openLost.flag(), "frame Open button did not lose focus");
+    }
+}
diff --git a/jdk/test/java/awt/Modal/helpers/TestWindow.java b/jdk/test/java/awt/Modal/helpers/TestWindow.java
new file mode 100644
index 00000000000..c929aefbf73
--- /dev/null
+++ b/jdk/test/java/awt/Modal/helpers/TestWindow.java
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+
+import static jdk.testlibrary.Asserts.*;
+
+
+
+public class TestWindow extends Window implements ActionListener,
+    FocusListener, WindowFocusListener, WindowListener {
+
+    public Button closeButton, openButton, dummyButton;
+
+    public Flag closeClicked, openClicked, dummyClicked;
+    public Flag closeGained,  openGained,  dummyGained;
+    public Flag closeLost,    openLost,    dummyLost;
+    public Flag focusGained, focusLost;
+    public Flag activated;
+
+    public static int delay = 500;
+    public static int keyDelay = 100;
+
+    public TestWindow(Frame owner) {
+        super(owner);
+        initializeGUI();
+    }
+
+    public TestWindow(Window window) {
+        super(window);
+        initializeGUI();
+    }
+
+    public void resetStatus() {
+        activated.reset();
+        focusGained.reset();
+        closeGained.reset();
+        openGained.reset();
+        closeClicked.reset();
+        openClicked.reset();
+    }
+
+    private void initFlags() {
+        closeClicked = new Flag();
+        openClicked  = new Flag();
+        dummyClicked = new Flag();
+        closeGained  = new Flag();
+        openGained   = new Flag();
+        dummyGained  = new Flag();
+        closeLost    = new Flag();
+        openLost     = new Flag();
+        dummyLost    = new Flag();
+        focusGained  = new Flag();
+        focusLost    = new Flag();
+        activated    = new Flag();
+    }
+
+    private void initializeGUI() {
+
+        initFlags();
+
+        this.addWindowFocusListener(this);
+        this.addWindowListener(this);
+
+        this.setLayout(new GridLayout(3, 1));
+
+        Panel topPanel;
+        topPanel = new Panel();
+        topPanel.setFocusable(false);
+        this.add(topPanel);
+
+        Panel p = new Panel();
+        p.setLayout(new GridLayout(1, 3));
+
+        closeButton = new Button("Close");
+        closeButton.addActionListener(this);
+        closeButton.addFocusListener(this);
+
+        openButton = new Button("Open");
+        openButton.addActionListener(this);
+        openButton.addFocusListener(this);
+
+        dummyButton = new Button("Dummy");
+        dummyButton.addActionListener(this);
+        dummyButton.addFocusListener(this);
+
+        p.add(closeButton);
+        p.add(openButton);
+        p.add(dummyButton);
+
+        this.add(p);
+
+        Panel bottomPanel = new Panel();
+        bottomPanel.setFocusable(false);
+        this.add(bottomPanel);
+
+        setSize(150, 150);
+    }
+
+    public void doOpenAction()  {}
+    public void doCloseAction() {}
+    public void doDummyAction() {}
+
+    @Override
+    public void actionPerformed(ActionEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeClicked.flagTriggered();
+            doCloseAction();
+        } else if (openButton.equals(event.getSource())) {
+            openClicked.flagTriggered();
+            doOpenAction();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyClicked.flagTriggered();
+            doDummyAction();
+        }
+    }
+
+    @Override
+    public void focusGained(FocusEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeGained.flagTriggered();
+        } else if (openButton.equals(event.getSource())) {
+            openGained.flagTriggered();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyGained.flagTriggered();
+        }
+    }
+
+    @Override
+    public void focusLost(FocusEvent event) {
+        if (closeButton.equals(event.getSource())) {
+            closeLost.flagTriggered();
+        } else if (openButton.equals(event.getSource())) {
+            openLost.flagTriggered();
+        } else if (dummyButton.equals(event.getSource())) {
+            dummyLost.flagTriggered();
+        }
+    }
+
+    @Override
+    public void windowGainedFocus(WindowEvent event) {
+        focusGained.flagTriggered();
+    }
+
+    @Override
+    public void windowLostFocus(WindowEvent event) {
+        focusLost.flagTriggered();
+    }
+
+    @Override
+    public void windowActivated(WindowEvent e) {
+        activated.flagTriggered();
+    }
+
+    @Override
+    public void windowClosed(WindowEvent e) {}
+
+    @Override
+    public void windowClosing(WindowEvent e) {
+        System.err.println("User closed window!");
+        System.exit(1);
+    }
+
+    @Override
+    public void windowDeactivated(WindowEvent e) {}
+
+    @Override
+    public void windowDeiconified(WindowEvent e) {}
+
+    @Override
+    public void windowIconified(WindowEvent e) {}
+
+    @Override
+    public void windowOpened(WindowEvent e) {}
+
+    public void clickButton(Button b, ExtendedRobot robot) {
+        try {
+            Flag.waitTillShown(b);
+        } catch (InterruptedException e) {}
+
+        if ((closeButton.equals(b) || openButton.equals(b) ||
+            dummyButton.equals(b)) && robot != null) {
+            robot.mouseMove((int) b.getLocationOnScreen().x + b.getSize().width / 2,
+                            (int) b.getLocationOnScreen().y + b.getSize().height / 2);
+            robot.delay(delay);
+            robot.click();
+            robot.delay(delay);
+        }
+    }
+
+    public void clickOpenButton(ExtendedRobot robot) throws Exception {
+        openClicked.reset();
+        clickButton(openButton, robot);
+
+        openClicked.waitForFlagTriggered();
+        assertTrue(openClicked.flag(),
+            "clicking the window Open button did not trigger an action");
+    }
+
+    public void clickCloseButton(ExtendedRobot robot) throws Exception {
+        closeClicked.reset();
+        clickButton(closeButton, robot);
+
+        closeClicked.waitForFlagTriggered();
+        assertTrue(closeClicked.flag(),
+            "clicking the window Close button did not trigger an action");
+    }
+
+    public void clickDummyButton(ExtendedRobot robot) throws Exception {
+        dummyClicked.reset();
+        clickButton(dummyButton, robot);
+
+        dummyClicked.waitForFlagTriggered();
+        assertTrue(dummyClicked.flag(),
+            "clicking the window Dummy button did not trigger an action");
+    }
+
+    public void checkBlockedWindow(ExtendedRobot robot,
+                                   String message) throws Exception {
+        dummyGained.reset();
+        dummyClicked.reset();
+        focusGained.reset();
+
+        clickButton(dummyButton, robot);
+
+        robot.waitForIdle(delay);
+
+        assertFalse(dummyClicked.flag(),
+            "DummyButton on blocked Window triggered action when clicked. " + message);
+
+        assertFalse(dummyGained.flag(),
+            "DummyButton on blocked Window gained focus when clicked. " + message);
+
+        assertFalse(focusGained.flag(),
+            "A blocked window gained focus when component clicked. " + message);
+    }
+
+    public void checkUnblockedWindowWithBlockedParent(
+            ExtendedRobot robot, String message) throws Exception {
+
+        dummyGained.reset();
+        dummyClicked.reset();
+        clickButton(dummyButton, robot);
+
+        dummyClicked.waitForFlagTriggered();
+
+        assertTrue(dummyClicked.flag(),
+            "DummyButton on Window did not trigger action when clicked. " + message);
+
+        assertFalse(dummyGained.flag(),
+            "DummyButton on Window gained focus " +
+            "when its parent is non-focusable. "  + message);
+    }
+
+    public void checkUnblockedWindow(ExtendedRobot robot,
+                                     String message) throws Exception {
+        dummyGained.reset();
+        dummyClicked.reset();
+        clickButton(dummyButton, robot);
+
+        dummyGained.waitForFlagTriggered();
+        assertTrue(dummyGained.flag(),
+            "DummyButton on Window did not gain focus on clicking. " + message);
+
+        assertTrue(dummyClicked.flag(),
+            "DummyButton on Window did not trigger action on clicking. " + message);
+
+        closeGained.reset();
+        robot.type(KeyEvent.VK_TAB);
+
+        closeGained.waitForFlagTriggered();
+        assertTrue(closeGained.flag(),
+            "Tab navigation did not happen properly on Window. First " +
+            "button did not gain focus on tab press. " + message);
+    }
+
+    public void checkCloseButtonFocusGained() {
+        checkCloseButtonFocusGained(Flag.ATTEMPTS);
+    }
+
+    public void checkCloseButtonFocusGained(int attempts) {
+        try {
+            closeGained.waitForFlagTriggered(attempts);
+        } catch (InterruptedException e) {}
+        assertTrue(closeGained.flag(),
+            "window Close button did not gain focus");
+    }
+
+    public void checkOpenButtonFocusGained() {
+        checkOpenButtonFocusGained(Flag.ATTEMPTS);
+    }
+
+    public void checkOpenButtonFocusGained(int attempts) {
+        try {
+            openGained.waitForFlagTriggered(attempts);
+        } catch (InterruptedException e) {}
+        assertTrue(openGained.flag(),
+            "window Open button did not gain focus");
+    }
+
+    public void checkOpenButtonFocusLost() {
+        checkOpenButtonFocusLost(Flag.ATTEMPTS);
+    }
+
+    public void checkOpenButtonFocusLost(int attempts) {
+        try {
+            openLost.waitForFlagTriggered(attempts);
+        } catch (InterruptedException e) {}
+        assertTrue(openLost.flag(),
+            "window Open button did not lose focus");
+    }
+}
-- 
GitLab


From 18ac28e76f627d1ece50a0da257a67ca4d9a41c6 Mon Sep 17 00:00:00 2001
From: Marcus Lagergren <lagergren@openjdk.org>
Date: Thu, 19 Jun 2014 10:46:31 +0200
Subject: [PATCH 113/192] 8047078: Fuzzing bug discovered when
 ArrayLiteralNodes weren't immutable

Reviewed-by: attila, sundar
---
 .../internal/codegen/CompilationPhase.java    |  15 +-
 .../codegen/LocalVariableTypesCalculator.java |  10 +-
 .../nashorn/internal/codegen/Splitter.java    |   2 +-
 .../nashorn/internal/codegen/WeighNodes.java  |   1 -
 .../jdk/nashorn/internal/ir/LiteralNode.java  | 330 ++++++++++--------
 nashorn/test/script/basic/JDK-8047057.js      |  12 +-
 nashorn/test/script/basic/JDK-8047078.js      |  38 ++
 7 files changed, 257 insertions(+), 151 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8047078.js

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
index aba9962373d..c415d0cec6d 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
@@ -173,7 +173,18 @@ enum CompilationPhase {
         @Override
         FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
             final CompileUnit  outermostCompileUnit = compiler.addCompileUnit(0L);
-            final FunctionNode newFunctionNode      = new Splitter(compiler, fn, outermostCompileUnit).split(fn, true);
+
+            FunctionNode newFunctionNode;
+
+            //ensure elementTypes, postsets and presets exist for splitter and arraynodes
+            newFunctionNode = (FunctionNode)fn.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
+                @Override
+                public LiteralNode<?> leaveLiteralNode(final LiteralNode<?> literalNode) {
+                    return literalNode.initialize(lc);
+                }
+            });
+
+            newFunctionNode = new Splitter(compiler, newFunctionNode, outermostCompileUnit).split(newFunctionNode, true);
 
             assert newFunctionNode.getCompileUnit() == outermostCompileUnit : "fn=" + fn.getName() + ", fn.compileUnit (" + newFunctionNode.getCompileUnit() + ") != " + outermostCompileUnit;
             assert newFunctionNode.isStrict() == compiler.isStrict() : "functionNode.isStrict() != compiler.isStrict() for " + quote(newFunctionNode.getName());
@@ -374,7 +385,7 @@ enum CompilationPhase {
                             assert newUnit != null;
                             newArrayUnits.add(new ArrayUnit(newUnit, au.getLo(), au.getHi()));
                         }
-                        aln.setUnits(newArrayUnits);
+                        return aln.setUnits(lc, newArrayUnits);
                     }
                     return node;
                 }
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 5a1f09ae1ec..7112a53eb76 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -39,6 +39,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.function.Function;
+
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BaseNode;
@@ -63,7 +64,6 @@ import jdk.nashorn.internal.ir.LabelNode;
 import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.LexicalContextNode;
 import jdk.nashorn.internal.ir.LiteralNode;
-import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
 import jdk.nashorn.internal.ir.LocalVariableConversion;
 import jdk.nashorn.internal.ir.LoopNode;
 import jdk.nashorn.internal.ir.Node;
@@ -1207,10 +1207,10 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
 
             @Override
             public Node leaveLiteralNode(final LiteralNode<?> literalNode) {
-                if(literalNode instanceof ArrayLiteralNode) {
-                    ((ArrayLiteralNode)literalNode).analyze();
-                }
-                return literalNode;
+                //for e.g. ArrayLiteralNodes the initial types may have been narrowed due to the
+                //introduction of optimistic behavior - hence ensure that all literal nodes are
+                //reinitialized
+                return literalNode.initialize(lc);
             }
 
             @Override
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java b/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java
index 088e49e1b66..9405d062faa 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java
@@ -307,7 +307,7 @@ final class Splitter extends NodeVisitor<LexicalContext> {
                 units.add(new ArrayUnit(unit, lo, postsets.length));
             }
 
-            arrayLiteralNode.setUnits(units);
+            return arrayLiteralNode.setUnits(lc, units);
         }
 
         return literal;
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java b/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java
index 7f735a2933b..26660a3a859 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java
@@ -173,7 +173,6 @@ final class WeighNodes extends NodeOperatorVisitor<LexicalContext> {
         if (functionNode == topFunction) {
             // the function being weighted; descend into its statements
             return true;
-//            functionNode.visitStatements(this);
         }
         // just a reference to inner function from outer function
         weight += FUNC_EXPR_WEIGHT;
diff --git a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java
index e83901e4442..b71e450389f 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java
@@ -29,6 +29,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.function.Function;
+
 import jdk.nashorn.internal.codegen.CompileUnit;
 import jdk.nashorn.internal.codegen.types.ArrayType;
 import jdk.nashorn.internal.codegen.types.Type;
@@ -86,6 +87,17 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
         this.value = newValue;
     }
 
+    /**
+     * Initialization setter, if required for immutable state. This is used for
+     * things like ArrayLiteralNodes that need to carry state for the splitter.
+     * Default implementation is just a nop.
+     * @param lc lexical context
+     * @return new literal node with initialized state, or same if nothing changed
+     */
+    public LiteralNode<?> initialize(final LexicalContext lc) {
+        return this;
+    }
+
     /**
      * Check if the literal value is null
      * @return true if literal value is null
@@ -573,24 +585,26 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
     /**
      * Array literal node class.
      */
+    @Immutable
     public static final class ArrayLiteralNode extends LiteralNode<Expression[]> implements LexicalContextNode {
 
         /** Array element type. */
-        private Type elementType;
+        private final Type elementType;
 
         /** Preset constant array. */
-        private Object presets;
+        private final Object presets;
 
         /** Indices of array elements requiring computed post sets. */
-        private int[] postsets;
+        private final int[] postsets;
 
-        private List<ArrayUnit> units;
+        /** Sub units with indexes ranges, in which to split up code generation, for large literals */
+        private final List<ArrayUnit> units;
 
         /**
          * An ArrayUnit is a range in an ArrayLiteral. ArrayLiterals can
          * be split if they are too large, for bytecode generation reasons
          */
-        public static class ArrayUnit {
+        public static final class ArrayUnit {
             /** Compile unit associated with the postsets range. */
             private final CompileUnit compileUnit;
 
@@ -634,146 +648,175 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
             }
         }
 
-        /**
-         * Constructor
-         *
-         * @param token   token
-         * @param finish  finish
-         * @param value   array literal value, a Node array
-         */
-        protected ArrayLiteralNode(final long token, final int finish, final Expression[] value) {
-            super(Token.recast(token, TokenType.ARRAY), finish, value);
-            this.elementType = Type.UNKNOWN;
-        }
+        private static final class ArrayLiteralInitializer {
 
-        /**
-         * Copy constructor
-         * @param node source array literal node
-         */
-        private ArrayLiteralNode(final ArrayLiteralNode node, final Expression[] value) {
-            super(node, value);
-            this.elementType = node.elementType;
-            this.presets     = node.presets;
-            this.postsets    = node.postsets;
-            this.units       = node.units;
-        }
+            static ArrayLiteralNode initialize(final ArrayLiteralNode node) {
+                final Type elementType = computeElementType(node.value, node.elementType);
+                final int[] postsets = computePostsets(node.value);
+                final Object presets = computePresets(node.value, elementType, postsets);
+                return new ArrayLiteralNode(node, node.value, elementType, postsets, presets, node.units);
+            }
 
-        /**
-         * Compute things like widest element type needed. Internal use from compiler only
-         */
-        public void analyze() {
-            assert elementType.isUnknown();
-            elementType = getNarrowestElementType(value);
-        }
+            private static Type computeElementType(final Expression[] value, final Type elementType) {
+                Type widestElementType = Type.INT;
 
-        private int[] presetIntArray() {
-            final int[] array = new int[value.length];
-            int nComputed = 0;
+                for (final Expression elem : value) {
+                    if (elem == null) {
+                        widestElementType = widestElementType.widest(Type.OBJECT); //no way to represent undefined as number
+                        break;
+                    }
 
-            for (int i = 0; i < value.length; i++) {
-                final Object element = objectAsConstant(value[i]);
+                    final Type type = elem.getType().isUnknown() ? Type.OBJECT : elem.getType();
+                    if (type.isBoolean()) {
+                        //TODO fix this with explicit boolean types
+                        widestElementType = widestElementType.widest(Type.OBJECT);
+                        break;
+                    }
 
-                if (element instanceof Number) {
-                    array[i] = ((Number)element).intValue();
-                } else {
-                    assert getPostsets()[nComputed++] == i;
+                    widestElementType = widestElementType.widest(type);
+                    if (widestElementType.isObject()) {
+                        break;
+                    }
                 }
+                return widestElementType;
             }
 
-            assert getPostsets().length == nComputed;
-            return array;
-        }
-
-        private long[] presetLongArray() {
-            final long[] array = new long[value.length];
-            int nComputed = 0;
+            private static int[] computePostsets(final Expression[] value) {
+                final int[] computed = new int[value.length];
+                int nComputed = 0;
 
-            for (int i = 0; i < value.length; i++) {
-                final Object element = objectAsConstant(value[i]);
+                for (int i = 0; i < value.length; i++) {
+                    final Expression element = value[i];
+                    if (element == null || objectAsConstant(element) == POSTSET_MARKER) {
+                        computed[nComputed++] = i;
+                    }
+                }
+                return Arrays.copyOf(computed, nComputed);
+            }
 
-                if (element instanceof Number) {
-                    array[i] = ((Number)element).longValue();
-                } else {
-                    assert getPostsets()[nComputed++] == i;
+            private static boolean setArrayElement(final int[] array, final int i, final Object n) {
+                if (n instanceof Number) {
+                    array[i] = ((Number)n).intValue();
+                    return true;
                 }
+                return false;
             }
 
-            assert getPostsets().length == nComputed;
-            return array;
-        }
+            private static boolean setArrayElement(final long[] array, final int i, final Object n) {
+                if (n instanceof Number) {
+                    array[i] = ((Number)n).longValue();
+                    return true;
+                }
+                return false;
+            }
 
-        private double[] presetNumberArray() {
-            final double[] array = new double[value.length];
-            int nComputed = 0;
+            private static boolean setArrayElement(final double[] array, final int i, final Object n) {
+                if (n instanceof Number) {
+                    array[i] = ((Number)n).doubleValue();
+                    return true;
+                }
+                return false;
+            }
 
-            for (int i = 0; i < value.length; i++) {
-                final Object element = objectAsConstant(value[i]);
+            private static int[] presetIntArray(final Expression[] value, final int[] postsets) {
+                final int[] array = new int[value.length];
+                int nComputed = 0;
+                for (int i = 0; i < value.length; i++) {
+                    if (!setArrayElement(array, i, objectAsConstant(value[i]))) {
+                        assert postsets[nComputed++] == i;
+                    }
+                }
+                assert postsets.length == nComputed;
+                return array;
+            }
 
-                if (element instanceof Number) {
-                    array[i] = ((Number)element).doubleValue();
-                } else {
-                    assert getPostsets()[nComputed++] == i;
+            private static long[] presetLongArray(final Expression[] value, final int[] postsets) {
+                final long[] array = new long[value.length];
+                int nComputed = 0;
+                for (int i = 0; i < value.length; i++) {
+                    if (!setArrayElement(array, i, objectAsConstant(value[i]))) {
+                        assert postsets[nComputed++] == i;
+                    }
                 }
+                assert postsets.length == nComputed;
+                return array;
             }
 
-            assert getPostsets().length == nComputed;
-            return array;
-        }
+            private static double[] presetDoubleArray(final Expression[] value, final int[] postsets) {
+                final double[] array = new double[value.length];
+                int nComputed = 0;
+                for (int i = 0; i < value.length; i++) {
+                    if (!setArrayElement(array, i, objectAsConstant(value[i]))) {
+                        assert postsets[nComputed++] == i;
+                    }
+                }
+                assert postsets.length == nComputed;
+                return array;
+            }
 
-        private Object[] presetObjectArray() {
-            final Object[] array = new Object[value.length];
-            int nComputed = 0;
+            private static Object[] presetObjectArray(final Expression[] value, final int[] postsets) {
+                final Object[] array = new Object[value.length];
+                int nComputed = 0;
 
-            for (int i = 0; i < value.length; i++) {
-                final Node node = value[i];
+                for (int i = 0; i < value.length; i++) {
+                    final Node node = value[i];
 
-                if (node == null) {
-                    assert getPostsets()[nComputed++] == i;
-                } else {
+                    if (node == null) {
+                        assert postsets[nComputed++] == i;
+                        continue;
+                    }
                     final Object element = objectAsConstant(node);
 
                     if (element != POSTSET_MARKER) {
                         array[i] = element;
                     } else {
-                        assert getPostsets()[nComputed++] == i;
+                        assert postsets[nComputed++] == i;
                     }
                 }
+
+                assert postsets.length == nComputed;
+                return array;
             }
 
-            assert getPostsets().length == nComputed;
-            return array;
+            static Object computePresets(final Expression[] value, final Type elementType, final int[] postsets) {
+                assert !elementType.isUnknown();
+                if (elementType.isInteger()) {
+                    return presetIntArray(value, postsets);
+                } else if (elementType.isLong()) {
+                    return presetLongArray(value, postsets);
+                } else if (elementType.isNumeric()) {
+                    return presetDoubleArray(value, postsets);
+                } else {
+                    return presetObjectArray(value, postsets);
+                }
+            }
         }
 
         /**
-         * Returns the narrowest element type that is wide enough to represent all the expressions in the array.
-         * @param elementExpressions the array of expressions
-         * @return the narrowest element type that is wide enough to represent all the expressions in the array.
+         * Constructor
+         *
+         * @param token   token
+         * @param finish  finish
+         * @param value   array literal value, a Node array
          */
-        private static Type getNarrowestElementType(final Expression[] elementExpressions) {
-            Type widestElementType = Type.INT;
-            for (final Expression element : elementExpressions) {
-                if (element == null) {
-                    widestElementType = widestElementType.widest(Type.OBJECT); //no way to represent undefined as number
-                    break;
-                }
-
-                Type elementType = element.getType();
-                if (elementType.isUnknown()) {
-                    elementType = Type.OBJECT;
-                }
-
-                if (elementType.isBoolean()) {
-                    widestElementType = widestElementType.widest(Type.OBJECT);
-                    break;
-                }
-
-                widestElementType = widestElementType.widest(elementType);
+        protected ArrayLiteralNode(final long token, final int finish, final Expression[] value) {
+            super(Token.recast(token, TokenType.ARRAY), finish, value);
+            this.elementType = Type.UNKNOWN;
+            this.presets     = null;
+            this.postsets    = null;
+            this.units       = null;
+        }
 
-                if (widestElementType.isObject()) {
-                    break;
-                }
-            }
-            return widestElementType;
+        /**
+         * Copy constructor
+         * @param node source array literal node
+         */
+        private ArrayLiteralNode(final ArrayLiteralNode node, final Expression[] value, final Type elementType, final int[] postsets, final Object presets, final List<ArrayUnit> units) {
+            super(node, value);
+            this.elementType = elementType;
+            this.postsets    = postsets;
+            this.presets     = presets;
+            this.units       = units;
         }
 
         @Override
@@ -781,6 +824,19 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
             return value;
         }
 
+        /**
+         * Setter that initializes all code generation meta data for an
+         * ArrayLiteralNode. This acts a setter, so the return value may
+         * return a new node and must be handled
+         *
+         * @param lc lexical context
+         * @return new array literal node with postsets, presets and element types initialized
+         */
+        @Override
+        public ArrayLiteralNode initialize(final LexicalContext lc) {
+            return Node.replaceInLexicalContext(lc, this, ArrayLiteralInitializer.initialize(this));
+        }
+
         /**
          * Get the array element type as Java format, e.g. [I
          * @return array element type
@@ -811,7 +867,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
          * @return element type
          */
         public Type getElementType() {
-            assert !elementType.isUnknown();
+            assert !elementType.isUnknown() : this + " has elementType=unknown";
             return elementType;
         }
 
@@ -821,19 +877,20 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
          * @return post set indices
          */
         public int[] getPostsets() {
-            if(postsets == null) {
-                final int[] computed = new int[value.length];
-                int nComputed = 0;
+            assert postsets != null : this + " elementType=" + elementType + " has no postsets";
+            return postsets;
+        }
 
-                for (int i = 0; i < value.length; i++) {
-                    final Expression element = value[i];
-                    if(element == null || objectAsConstant(element) == POSTSET_MARKER) {
-                        computed[nComputed++] = i;
-                    }
-                }
-                postsets = Arrays.copyOf(computed, nComputed);
+        private boolean presetsMatchElementType() {
+            if (elementType == Type.INT) {
+                return presets instanceof int[];
+            } else if (elementType == Type.LONG) {
+                return presets instanceof long[];
+            } else if (elementType == Type.NUMBER) {
+                return presets instanceof double[];
+            } else {
+                return presets instanceof Object[];
             }
-            return postsets;
         }
 
         /**
@@ -841,18 +898,7 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
          * @return presets array, always returns an array type
          */
         public Object getPresets() {
-            if(presets == null) {
-                final Type type = getElementType();
-                if (type.isInteger()) {
-                    presets = presetIntArray();
-                } else if (type.isLong()) {
-                    presets = presetLongArray();
-                } else if (type.isNumeric()) {
-                    presets = presetNumberArray();
-                } else {
-                    presets = presetObjectArray();
-                }
-            }
+            assert presets != null && presetsMatchElementType() : this + " doesn't have presets, or invalid preset type: " + presets;
             return presets;
         }
 
@@ -867,11 +913,16 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
 
         /**
          * Set the ArrayUnits that make up this ArrayLiteral
+         * @param lc lexical context
          * @see ArrayUnit
          * @param units list of array units
+         * @return new or changed arrayliteralnode
          */
-        public void setUnits(final List<ArrayUnit> units) {
-            this.units = units;
+        public ArrayLiteralNode setUnits(final LexicalContext lc, final List<ArrayUnit> units) {
+            if (this.units == units) {
+                return this;
+            }
+            return Node.replaceInLexicalContext(lc, this, new ArrayLiteralNode(this, value, elementType, postsets, presets, units));
         }
 
         @Override
@@ -889,8 +940,15 @@ public abstract class LiteralNode<T> extends Expression implements PropertyKey {
             return this;
         }
 
+        private ArrayLiteralNode setValue(final LexicalContext lc, final Expression[] value) {
+            if (this.value == value) {
+                return this;
+            }
+            return Node.replaceInLexicalContext(lc, this, new ArrayLiteralNode(this, value, elementType, postsets, presets, units));
+        }
+
         private ArrayLiteralNode setValue(final LexicalContext lc, final List<Expression> value) {
-            return (ArrayLiteralNode)lc.replace(this, new ArrayLiteralNode(this, value.toArray(new Expression[value.size()])));
+            return setValue(lc, value.toArray(new Expression[value.size()]));
         }
 
         @Override
diff --git a/nashorn/test/script/basic/JDK-8047057.js b/nashorn/test/script/basic/JDK-8047057.js
index cf1263a1243..3ce588bfe6f 100644
--- a/nashorn/test/script/basic/JDK-8047057.js
+++ b/nashorn/test/script/basic/JDK-8047057.js
@@ -29,8 +29,7 @@
  */
 
 // commented out makeFuncAndCall calls are still result in crash
-// Tests commented with //** fail only within test framework.
-// Pass fine with standalone "jjs" mode.
+// Tests commented with //** fail only when assertions are turned on
 
 function makeFuncAndCall(code) {
     Function(code)();
@@ -52,19 +51,19 @@ makeFuncAndCall("L: { while(0) break L; return; }");
 makeFuncExpectError("L: {while(0) break L; return [](); }", TypeError);
 // makeFuncAndCall("do with({}) break ; while(0);");
 makeFuncAndCall("while(0) with({}) continue ;");
-//** makeFuncAndCall("eval([]);");
-//** makeFuncAndCall("try{} finally{[]}");
+makeFuncAndCall("eval([]);");
+makeFuncAndCall("try{} finally{[]}");
 makeFuncAndCall("try { } catch(x if 1) { try { } catch(x2) { } }");
 makeFuncAndCall("try { } catch(x if 1) { try { return; } catch(x2) { { } } }");
 makeFuncAndCall("Error() * (false)[-0]--");
 makeFuncAndCall("try { var x = 1, x = null; } finally { }");
 makeFuncAndCall("try { var x = {}, x = []; } catch(x3) { }");
-//** makeFuncAndCall("[delete this]");
+makeFuncAndCall("[delete this]");
 // makeFuncAndCall("if(eval('', eval('', function() {}))) { }");
 // makeFuncAndCall("if(eval('', eval('', function() {}))) { }");
 // makeFuncAndCall("eval(\"[,,];\", [11,12,13,14].some)");
 // makeFuncAndCall("eval(\"1.2e3\", ({})[ /x/ ])");
-// makeFuncAndCall("eval(\"x4\", x3);");
+makeFuncExpectError("eval(\"x4\", x3);", ReferenceError);
 makeFuncAndCall("with({5.0000000000000000000000: String()}){(false); }");
 makeFuncAndCall("try { var x = undefined, x = 5.0000000000000000000000; } catch(x) { x = undefined; }");
 makeFuncAndCall("(function (x){ x %= this}(false))");
@@ -73,3 +72,4 @@ makeFuncAndCall("(false % !this) && 0");
 makeFuncAndCall("with({8: 'fafafa'.replace()}){ }");
 makeFuncAndCall("(function (x) '' )(true)");
 makeFuncExpectError("new eval(function(){})", TypeError);
+//** makeFuncAndCall('eval("23", ({})[/x/])');
diff --git a/nashorn/test/script/basic/JDK-8047078.js b/nashorn/test/script/basic/JDK-8047078.js
new file mode 100644
index 00000000000..984e4f29abc
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047078.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047078: ArrayLiteral mutability caused trouble in optimistic types
+ *
+ * @test
+ * @run
+ */
+
+function makeFuncAndCall(code) {
+    Function(code)();
+}
+
+makeFuncAndCall("eval([]);");
+makeFuncAndCall("eval([1]);");
+makeFuncAndCall("eval([1,2,3,,4]);");
+makeFuncAndCall("try{} finally{[]}");
-- 
GitLab


From bdf68602c040489166334b9ec18bec2b78e0121f Mon Sep 17 00:00:00 2001
From: Staffan Larsen <sla@openjdk.org>
Date: Thu, 19 Jun 2014 12:56:16 +0200
Subject: [PATCH 114/192] 8046024: JDI shared memory transport failed with
 "Observed abandoned IP mutex"

Reviewed-by: alanb
---
 jdk/src/windows/transport/shmem/shmem_md.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/jdk/src/windows/transport/shmem/shmem_md.c b/jdk/src/windows/transport/shmem/shmem_md.c
index 2574bc3933b..056dce648f7 100644
--- a/jdk/src/windows/transport/shmem/shmem_md.c
+++ b/jdk/src/windows/transport/shmem/shmem_md.c
@@ -200,17 +200,6 @@ sysIPMutexEnter(sys_ipmutex_t mutex, sys_event_t event)
     rc = WaitForMultipleObjects(count, handles,
                                 FALSE,              /* wait for either, not both */
                                 INFINITE);          /* infinite timeout */
-
-    /* If the mutex is abandoned we will consider this a fatal error
-     * and abort with appropriate message.
-     *
-     * Note that only mutexes can be abandoned and that our mutex is
-     * always at position 0 in the handles array. Thus we only need
-     * to check WAIT_ABANDONED_0 (not WAIT_ABANDONED_0 + x).
-     */
-    if (rc == WAIT_ABANDONED_0) {
-        exitTransportWithError("Observed abandoned IP mutex. Aborting.",THIS_FILE, __DATE__, __LINE__);
-    }
     return (rc == WAIT_OBJECT_0) ? SYS_OK : SYS_ERR;
 }
 
-- 
GitLab


From 322ed96c4c01a97d93e68a84e1fb02e98e59a8e2 Mon Sep 17 00:00:00 2001
From: Andrei Eremeev <andrei.eremeev@oracle.com>
Date: Thu, 19 Jun 2014 16:54:59 +0400
Subject: [PATCH 115/192] 8046895: Fix doclint warnings in
 javax.swing.text.html.parser package

Reviewed-by: pchelko
---
 .../swing/text/html/parser/AttributeList.java |  36 +++++
 .../swing/text/html/parser/ContentModel.java  |   3 +
 .../javax/swing/text/html/parser/DTD.java     |  70 +++++++++
 .../swing/text/html/parser/DTDConstants.java  | 140 ++++++++++++++++++
 .../text/html/parser/DocumentParser.java      |  15 +-
 .../javax/swing/text/html/parser/Element.java |  44 ++++++
 .../javax/swing/text/html/parser/Entity.java  |  11 ++
 .../javax/swing/text/html/parser/Parser.java  |  33 +++++
 .../text/html/parser/ParserDelegator.java     |  16 +-
 .../swing/text/html/parser/TagElement.java    |  43 +++++-
 10 files changed, 407 insertions(+), 4 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java b/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java
index 2a87568aa32..898e9367171 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java
@@ -47,11 +47,35 @@ import java.io.*;
 @SuppressWarnings("serial") // Same-version serialization only
 public final
 class AttributeList implements DTDConstants, Serializable {
+
+    /**
+     * The attribute name
+     */
     public String name;
+
+    /**
+     * The attribute type
+     */
     public int type;
+
+    /**
+     * The possible attribute values
+     */
     public Vector<?> values;
+
+    /**
+     * The attribute modifier
+     */
     public int modifier;
+
+    /**
+     * The default attribute value
+     */
     public String value;
+
+    /**
+     * The next attribute in the list
+     */
     public AttributeList next;
 
     AttributeList() {
@@ -171,11 +195,23 @@ class AttributeList implements DTDConstants, Serializable {
         attributeTypes.put("implied", Integer.valueOf(IMPLIED));
     }
 
+    /**
+     * Converts an attribute name to the type
+     *
+     * @param nm an attribute name
+     * @return the type
+     */
     public static int name2type(String nm) {
         Integer i = (Integer)attributeTypes.get(nm);
         return (i == null) ? CDATA : i.intValue();
     }
 
+    /**
+     * Converts a type to the attribute name
+     *
+     * @param tp a type
+     * @return the attribute name
+     */
     public static String type2name(int tp) {
         return (String)attributeTypes.get(Integer.valueOf(tp));
     }
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java
index 59a3901d493..236bd850087 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java
@@ -57,6 +57,9 @@ public final class ContentModel implements Serializable {
      */
     public ContentModel next;
 
+    /**
+     * Creates {@code ContentModel}
+     */
     public ContentModel() {
     }
 
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java
index 2845ae49b4b..6705802491f 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java
@@ -57,27 +57,91 @@ import java.net.URL;
  */
 public
 class DTD implements DTDConstants {
+
+    /**
+     * the name of the DTD
+     */
     public String name;
+
+    /**
+     * The vector of elements
+     */
     public Vector<Element> elements = new Vector<Element>();
+
+    /**
+     * The hash table contains the name of element and
+     * the corresponding element.
+     */
     public Hashtable<String,Element> elementHash
         = new Hashtable<String,Element>();
+
+    /**
+     * The hash table contains an {@code Object} and the corresponding {@code Entity}
+     */
     public Hashtable<Object,Entity> entityHash
         = new Hashtable<Object,Entity>();
+
+    /**
+     * The element corresponding to pcdata.
+     */
     public final Element pcdata = getElement("#pcdata");
+
+    /**
+     * The element corresponding to html.
+     */
     public final Element html = getElement("html");
+
+    /**
+     * The element corresponding to meta.
+     */
     public final Element meta = getElement("meta");
+
+    /**
+     * The element corresponding to base.
+     */
     public final Element base = getElement("base");
+
+    /**
+     * The element corresponding to isindex.
+     */
     public final Element isindex = getElement("isindex");
+
+    /**
+     * The element corresponding to head.
+     */
     public final Element head = getElement("head");
+
+    /**
+     * The element corresponding to body.
+     */
     public final Element body = getElement("body");
+
+    /**
+     * The element corresponding to applet.
+     */
     public final Element applet = getElement("applet");
+
+    /**
+     * The element corresponding to param.
+     */
     public final Element param = getElement("param");
+
+    /**
+     * The element corresponding to p.
+     */
     public final Element p = getElement("p");
+
+    /**
+     * The element corresponding to title.
+     */
     public final Element title = getElement("title");
     final Element style = getElement("style");
     final Element link = getElement("link");
     final Element script = getElement("script");
 
+    /**
+     * The version of a file
+     */
     public static final int FILE_VERSION = 1;
 
     /**
@@ -344,6 +408,12 @@ class DTD implements DTDConstants {
      */
     private static final Object DTD_HASH_KEY = new Object();
 
+    /**
+     * Put a name and appropriate DTD to hashtable.
+     *
+     * @param name the name of the DTD
+     * @param dtd the DTD
+     */
     public static void putDTDHash(String name, DTD dtd) {
         getDtdHash().put(name, dtd);
     }
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/DTDConstants.java b/jdk/src/share/classes/javax/swing/text/html/parser/DTDConstants.java
index ae239236e7e..88980b42f91 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DTDConstants.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DTDConstants.java
@@ -37,46 +37,186 @@ package javax.swing.text.html.parser;
 public
 interface DTDConstants {
     // Attribute value types
+
+    /**
+     * The DTD constant corresponds to CDATA
+     */
     int CDATA           = 1;
+
+    /**
+     * The DTD constant corresponds to ENTITY
+     */
     int ENTITY          = 2;
+
+    /**
+     * The DTD constant corresponds to ENTITIES
+     */
     int ENTITIES        = 3;
+
+    /**
+     * The DTD constant corresponds to ID
+     */
     int ID              = 4;
+
+    /**
+     * The DTD constant corresponds to IDREF
+     */
     int IDREF           = 5;
+
+    /**
+     * The DTD constant corresponds to IDREFS
+     */
     int IDREFS          = 6;
+
+    /**
+     * The DTD constant corresponds to NAME
+     */
     int NAME            = 7;
+
+    /**
+     * The DTD constant corresponds to NAMES
+     */
     int NAMES           = 8;
+
+    /**
+     * The DTD constant corresponds to NMTOKEN
+     */
     int NMTOKEN         = 9;
+
+    /**
+     * The DTD constant corresponds to NMTOKENS
+     */
     int NMTOKENS        = 10;
+
+    /**
+     * The DTD constant corresponds to NOTATION
+     */
     int NOTATION        = 11;
+
+    /**
+     * The DTD constant corresponds to NUMBER
+     */
     int NUMBER          = 12;
+
+    /**
+     * The DTD constant corresponds to NUMBERS
+     */
     int NUMBERS         = 13;
+
+    /**
+     * The DTD constant corresponds to NUTOKEN
+     */
     int NUTOKEN         = 14;
+
+    /**
+     * The DTD constant corresponds to NUTOKENS
+     */
     int NUTOKENS        = 15;
 
     // Content model types
+
+    /**
+     * The DTD constant corresponds to RCDATA
+     */
     int RCDATA          = 16;
+
+    /**
+     * The DTD constant corresponds to EMPTY
+     */
     int EMPTY           = 17;
+
+    /**
+     * The DTD constant corresponds to MODEL
+     */
     int MODEL           = 18;
+
+    /**
+     * The DTD constant corresponds to ANY
+     */
     int ANY             = 19;
 
     // Attribute value modifiers
+
+    /**
+     * The DTD constant corresponds to FIXED
+     */
     int FIXED           = 1;
+
+    /**
+     * The DTD constant corresponds to REQUIRED
+     */
     int REQUIRED        = 2;
+
+    /**
+     * The DTD constant corresponds to CURRENT
+     */
     int CURRENT         = 3;
+
+    /**
+     * The DTD constant corresponds to CONREF
+     */
     int CONREF          = 4;
+
+    /**
+     * The DTD constant corresponds to IMPLIED
+     */
     int IMPLIED         = 5;
 
     // Entity types
+
+    /**
+     * The DTD constant corresponds to PUBLIC
+     */
     int PUBLIC          = 10;
+
+    /**
+     * The DTD constant corresponds to SDATA
+     */
     int SDATA           = 11;
+
+    /**
+     * The DTD constant corresponds to PI
+     */
     int PI              = 12;
+
+    /**
+     * The DTD constant corresponds to STARTTAG
+     */
     int STARTTAG        = 13;
+
+    /**
+     * The DTD constant corresponds to ENDTAG
+     */
     int ENDTAG          = 14;
+
+    /**
+     * The DTD constant corresponds to MS
+     */
     int MS              = 15;
+
+    /**
+     * The DTD constant corresponds to MD
+     */
     int MD              = 16;
+
+    /**
+     * The DTD constant corresponds to SYSTEM
+     */
     int SYSTEM          = 17;
 
+    /**
+     * The DTD constant corresponds to GENERAL
+     */
+
     int GENERAL         = 1<<16;
+
+    /**
+     * The DTD constant corresponds to DEFAULT
+     */
     int DEFAULT         = 1<<17;
+
+    /**
+     * The DTD constant corresponds to PARAMETER
+     */
     int PARAMETER       = 1<<18;
 }
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java b/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java
index 5d24ce5f90b..83f9e91b7e9 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java
@@ -112,11 +112,24 @@ public class DocumentParser extends javax.swing.text.html.parser.Parser {
     private boolean ignoreCharSet = false;
     private static final boolean debugFlag = false;
 
+    /**
+     * Creates document parser with the specified {@code dtd}.
+     *
+     * @param dtd the dtd.
+     */
     public DocumentParser(DTD dtd) {
         super(dtd);
     }
 
-    public void parse(Reader in,  HTMLEditorKit.ParserCallback callback, boolean ignoreCharSet) throws IOException {
+    /**
+     * Parse an HTML stream, given a DTD.
+     *
+     * @param in the reader to read the source from
+     * @param callback the callback
+     * @param ignoreCharSet if {@code true} the charset is ignored
+     * @throws IOException if an I/O error occurs
+     */
+    public void parse(Reader in, HTMLEditorKit.ParserCallback callback, boolean ignoreCharSet) throws IOException {
         this.ignoreCharSet = ignoreCharSet;
         this.callback = callback;
         parse(in);
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/Element.java b/jdk/src/share/classes/javax/swing/text/html/parser/Element.java
index 283bdad73be..6456696e364 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Element.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Element.java
@@ -43,14 +43,50 @@ import sun.awt.AppContext;
 @SuppressWarnings("serial") // Same-version serialization only
 public final
 class Element implements DTDConstants, Serializable {
+
+    /**
+     * The element index
+     */
     public int index;
+
+    /**
+     * The name of the element
+     */
     public String name;
+
+    /**
+     * {@code true} if the start tag can be omitted
+     */
     public boolean oStart;
+
+    /**
+     * {@code true} if the end tag can be omitted
+     */
     public boolean oEnd;
+
+    /**
+     * The set of elements that can occur inside the element
+     */
     public BitSet inclusions;
+
+    /**
+     * The set of elements that must not occur inside the element
+     */
     public BitSet exclusions;
+
+    /**
+     * The element type
+     */
     public int type = ANY;
+
+    /**
+     * The content model
+     */
     public ContentModel content;
+
+    /**
+     * The attributes
+     */
     public AttributeList atts;
 
     /**
@@ -208,6 +244,14 @@ class Element implements DTDConstants, Serializable {
         contentTypes.put("ANY", Integer.valueOf(ANY));
     }
 
+    /**
+     * Converts {@code nm} to type. Returns appropriate DTDConstants
+     * if the {@code nm} is equal to CDATA, RCDATA, EMPTY or ANY, 0 otherwise.
+     *
+     * @param nm a name
+     * @return appropriate DTDConstants if the {@code nm} is equal to
+     * CDATA, RCDATA, EMPTY or ANY, 0 otherwise.
+     */
     public static int name2type(String nm) {
         Integer val = contentTypes.get(nm);
         return (val != null) ? val.intValue() : 0;
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/Entity.java b/jdk/src/share/classes/javax/swing/text/html/parser/Entity.java
index fdac6342ff8..db1cea291e0 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Entity.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Entity.java
@@ -42,8 +42,19 @@ import java.net.URL;
  */
 public final
 class Entity implements DTDConstants {
+    /**
+     * The name of the entity.
+     */
     public String name;
+
+    /**
+     * The type of the entity.
+     */
     public int type;
+
+    /**
+     * The char array of data.
+     */
     public char data[];
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java
index 842c03a147b..66685c0d965 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java
@@ -88,6 +88,9 @@ class Parser implements DTDConstants {
     private char str[] = new char[128];
     private int strpos = 0;
 
+    /**
+     * The dtd.
+     */
     protected DTD dtd = null;
 
     private int ch;
@@ -198,6 +201,11 @@ class Parser implements DTDConstants {
         376    // &#159;
     };
 
+    /**
+     * Creates parser with the specified {@code dtd}.
+     *
+     * @param dtd the dtd.
+     */
     public Parser(DTD dtd) {
         this.dtd = dtd;
     }
@@ -421,12 +429,32 @@ class Parser implements DTDConstants {
         handleError(ln, err + " " + arg1 + " " + arg2 + " " + arg3);
     }
 
+    /**
+     * Invokes the error handler with the 3rd error message argument "?".
+     *
+     * @param err   the error type
+     * @param arg1  the 1st error message argument
+     * @param arg2  the 2nd error message argument
+     */
     protected void error(String err, String arg1, String arg2) {
         error(err, arg1, arg2, "?");
     }
+
+    /**
+     * Invokes the error handler with the 2nd and 3rd error message argument "?".
+     *
+     * @param err   the error type
+     * @param arg1  the 1st error message argument
+     */
     protected void error(String err, String arg1) {
         error(err, arg1, "?", "?");
     }
+
+    /**
+     * Invokes the error handler with the 1st, 2nd and 3rd error message argument "?".
+     *
+     * @param err   the error type
+     */
     protected void error(String err) {
         error(err, "?", "?", "?");
     }
@@ -2407,6 +2435,11 @@ class Parser implements DTDConstants {
     }
 
 
+    /**
+     * Returns the current position.
+     *
+     * @return the current position
+     */
     protected int getCurrentPos() {
         return currentPosition;
     }
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java b/jdk/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java
index 1278597898e..15366f979ce 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java
@@ -48,6 +48,9 @@ import java.security.PrivilegedAction;
 public class ParserDelegator extends HTMLEditorKit.Parser implements Serializable {
     private static final Object DTD_KEY = new Object();
 
+    /**
+     * Sets the default DTD.
+     */
     protected static void setDefaultDTD() {
         getDefaultDTD();
     }
@@ -75,6 +78,13 @@ public class ParserDelegator extends HTMLEditorKit.Parser implements Serializabl
         return dtd;
     }
 
+    /**
+     * Recreates a DTD from an archived format with the specified {@code name}.
+     *
+     * @param dtd a DTD
+     * @param name the name of the resource, relative to the  ParserDelegator class.
+     * @return the DTD with the specified {@code name}.
+     */
     protected static DTD createDTD(DTD dtd, String name) {
 
         InputStream in = null;
@@ -92,7 +102,9 @@ public class ParserDelegator extends HTMLEditorKit.Parser implements Serializabl
         return dtd;
     }
 
-
+    /**
+     * Creates {@code ParserDelegator} with default DTD.
+     */
     public ParserDelegator() {
         setDefaultDTD();
     }
@@ -109,7 +121,7 @@ public class ParserDelegator extends HTMLEditorKit.Parser implements Serializabl
      *
      * @param name the name of the resource, relative to the
      *  ParserDelegator class.
-     * @returns a stream representing the resource
+     * @return a stream representing the resource
      */
     static InputStream getResourceAsStream(final String name) {
         return AccessController.doPrivileged(
diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/TagElement.java b/jdk/src/share/classes/javax/swing/text/html/parser/TagElement.java
index c864df42f70..1cf75573882 100644
--- a/jdk/src/share/classes/javax/swing/text/html/parser/TagElement.java
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/TagElement.java
@@ -39,10 +39,21 @@ public class TagElement {
     HTML.Tag htmlTag;
     boolean insertedByErrorRecovery;
 
-    public TagElement ( Element elem ) {
+    /**
+     * Creates a generic HTML TagElement class with {@code fictional} equals to {@code false}.
+     *
+     * @param elem an element
+     */
+    public TagElement(Element elem) {
         this(elem, false);
     }
 
+    /**
+     * Creates a generic HTML TagElement class.
+     *
+     * @param elem an element
+     * @param fictional if {@code true} the tag is inserted by error recovery.
+     */
     public TagElement (Element elem, boolean fictional) {
         this.elem = elem;
         htmlTag = HTML.getTag(elem.getName());
@@ -52,22 +63,52 @@ public class TagElement {
         insertedByErrorRecovery = fictional;
     }
 
+    /**
+     * Returns {@code true} if this tag causes a
+     * line break to the flow of data, otherwise returns
+     * {@code false}.
+     *
+     * @return {@code true} if this tag causes a
+     *   line break to the flow of data, otherwise returns
+     *   {@code false}
+     */
     public boolean breaksFlow() {
         return htmlTag.breaksFlow();
     }
 
+    /**
+     * Returns {@code true} if this tag is pre-formatted.
+     *
+     * @return {@code true} if this tag is pre-formatted,
+     *   otherwise returns {@code false}
+     */
     public boolean isPreformatted() {
         return htmlTag.isPreformatted();
     }
 
+    /**
+     * Returns the element.
+     *
+     * @return the element
+     */
     public Element getElement() {
         return elem;
     }
 
+    /**
+     * Returns the tag constant corresponding to the name of the {@code element}
+     *
+     * @return the tag constant corresponding to the name of the {@code element}
+     */
     public HTML.Tag getHTMLTag() {
         return htmlTag;
     }
 
+    /**
+     * Returns {@code true} if the tag is fictional.
+     *
+     * @return {@code true} if the tag is fictional.
+     */
     public boolean fictional() {
         return insertedByErrorRecovery;
     }
-- 
GitLab


From 03bc9138d1d6be8323553d674bebaae53f695e68 Mon Sep 17 00:00:00 2001
From: Andrei Eremeev <andrei.eremeev@oracle.com>
Date: Thu, 19 Jun 2014 16:57:14 +0400
Subject: [PATCH 116/192] 8046446: Fix doclint warnings in
 javax.swing.text.html package

Reviewed-by: pchelko
---
 .../javax/swing/text/html/BlockView.java      |   5 +
 .../classes/javax/swing/text/html/CSS.java    | 186 ++++++
 .../swing/text/html/FormSubmitEvent.java      |  19 +-
 .../classes/javax/swing/text/html/HTML.java   | 620 +++++++++++++++++-
 .../javax/swing/text/html/HTMLDocument.java   |   7 +-
 .../javax/swing/text/html/HTMLEditorKit.java  | 168 ++++-
 .../javax/swing/text/html/HTMLWriter.java     |  17 +-
 .../javax/swing/text/html/ImageView.java      |  29 +-
 .../javax/swing/text/html/InlineView.java     |   6 +-
 .../swing/text/html/MinimalHTMLWriter.java    |  23 +-
 .../classes/javax/swing/text/html/Option.java |  19 +-
 .../javax/swing/text/html/ParagraphView.java  |   5 +
 .../javax/swing/text/html/StyleSheet.java     |  56 +-
 13 files changed, 1120 insertions(+), 40 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/text/html/BlockView.java b/jdk/src/share/classes/javax/swing/text/html/BlockView.java
index bdd1a20e939..524a57d93c1 100644
--- a/jdk/src/share/classes/javax/swing/text/html/BlockView.java
+++ b/jdk/src/share/classes/javax/swing/text/html/BlockView.java
@@ -417,6 +417,11 @@ public class BlockView extends BoxView  {
         cssHeight = (CSS.LengthValue) attr.getAttribute(CSS.Attribute.HEIGHT);
     }
 
+    /**
+     * Convenient method to get the StyleSheet.
+     *
+     * @return the StyleSheet
+     */
     protected StyleSheet getStyleSheet() {
         HTMLDocument doc = (HTMLDocument) getDocument();
         return doc.getStyleSheet();
diff --git a/jdk/src/share/classes/javax/swing/text/html/CSS.java b/jdk/src/share/classes/javax/swing/text/html/CSS.java
index 16f67026796..2f5a07261e9 100644
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java
@@ -175,144 +175,285 @@ public class CSS implements Serializable {
         private boolean inherited;
 
 
+        /**
+         * CSS attribute "background".
+         */
         public static final Attribute BACKGROUND =
             new Attribute("background", null, false);
 
+        /**
+         * CSS attribute "background-attachment".
+         */
         public static final Attribute BACKGROUND_ATTACHMENT =
             new Attribute("background-attachment", "scroll", false);
 
+        /**
+         * CSS attribute "background-color".
+         */
         public static final Attribute BACKGROUND_COLOR =
             new Attribute("background-color", "transparent", false);
 
+        /**
+         * CSS attribute "background-image".
+         */
         public static final Attribute BACKGROUND_IMAGE =
             new Attribute("background-image", "none", false);
 
+        /**
+         * CSS attribute "background-position".
+         */
         public static final Attribute BACKGROUND_POSITION =
             new Attribute("background-position", null, false);
 
+        /**
+         * CSS attribute "background-repeat".
+         */
         public static final Attribute BACKGROUND_REPEAT =
             new Attribute("background-repeat", "repeat", false);
 
+        /**
+         * CSS attribute "border".
+         */
         public static final Attribute BORDER =
             new Attribute("border", null, false);
 
+        /**
+         * CSS attribute "border-bottom".
+         */
         public static final Attribute BORDER_BOTTOM =
             new Attribute("border-bottom", null, false);
 
+        /**
+         * CSS attribute "border-bottom-color".
+         */
         public static final Attribute BORDER_BOTTOM_COLOR =
             new Attribute("border-bottom-color", null, false);
 
+        /**
+         * CSS attribute "border-bottom-style".
+         */
         public static final Attribute BORDER_BOTTOM_STYLE =
             new Attribute("border-bottom-style", "none", false);
 
+        /**
+         * CSS attribute "border-bottom-width".
+         */
         public static final Attribute BORDER_BOTTOM_WIDTH =
             new Attribute("border-bottom-width", "medium", false);
 
+        /**
+         * CSS attribute "border-color".
+         */
         public static final Attribute BORDER_COLOR =
             new Attribute("border-color", null, false);
 
+        /**
+         * CSS attribute "border-left".
+         */
         public static final Attribute BORDER_LEFT =
             new Attribute("border-left", null, false);
 
+        /**
+         * CSS attribute "margin-right".
+         */
         public static final Attribute BORDER_LEFT_COLOR =
             new Attribute("border-left-color", null, false);
 
+        /**
+         * CSS attribute "border-left-style".
+         */
         public static final Attribute BORDER_LEFT_STYLE =
             new Attribute("border-left-style", "none", false);
 
+        /**
+         * CSS attribute "border-left-width".
+         */
         public static final Attribute BORDER_LEFT_WIDTH =
             new Attribute("border-left-width", "medium", false);
 
+        /**
+         * CSS attribute "border-right".
+         */
         public static final Attribute BORDER_RIGHT =
             new Attribute("border-right", null, false);
 
+        /**
+         * CSS attribute "border-right-color".
+         */
         public static final Attribute BORDER_RIGHT_COLOR =
             new Attribute("border-right-color", null, false);
 
+        /**
+         * CSS attribute "border-right-style".
+         */
         public static final Attribute BORDER_RIGHT_STYLE =
             new Attribute("border-right-style", "none", false);
 
+        /**
+         * CSS attribute "border-right-width".
+         */
         public static final Attribute BORDER_RIGHT_WIDTH =
             new Attribute("border-right-width", "medium", false);
 
+        /**
+         * CSS attribute "border-style".
+         */
         public static final Attribute BORDER_STYLE =
             new Attribute("border-style", "none", false);
 
+        /**
+         * CSS attribute "border-top".
+         */
         public static final Attribute BORDER_TOP =
             new Attribute("border-top", null, false);
 
+        /**
+         * CSS attribute "border-top-color".
+         */
         public static final Attribute BORDER_TOP_COLOR =
             new Attribute("border-top-color", null, false);
 
+        /**
+         * CSS attribute "border-top-style".
+         */
         public static final Attribute BORDER_TOP_STYLE =
             new Attribute("border-top-style", "none", false);
 
+        /**
+         * CSS attribute "border-top-width".
+         */
         public static final Attribute BORDER_TOP_WIDTH =
             new Attribute("border-top-width", "medium", false);
 
+        /**
+         * CSS attribute "border-width".
+         */
         public static final Attribute BORDER_WIDTH =
             new Attribute("border-width", "medium", false);
 
+        /**
+         * CSS attribute "clear".
+         */
         public static final Attribute CLEAR =
             new Attribute("clear", "none", false);
 
+        /**
+         * CSS attribute "color".
+         */
         public static final Attribute COLOR =
             new Attribute("color", "black", true);
 
+        /**
+         * CSS attribute "display".
+         */
         public static final Attribute DISPLAY =
             new Attribute("display", "block", false);
 
+        /**
+         * CSS attribute "float".
+         */
         public static final Attribute FLOAT =
             new Attribute("float", "none", false);
 
+        /**
+         * CSS attribute "font".
+         */
         public static final Attribute FONT =
             new Attribute("font", null, true);
 
+        /**
+         * CSS attribute "font-family".
+         */
         public static final Attribute FONT_FAMILY =
             new Attribute("font-family", null, true);
 
+        /**
+         * CSS attribute "font-size".
+         */
         public static final Attribute FONT_SIZE =
             new Attribute("font-size", "medium", true);
 
+        /**
+         * CSS attribute "font-style".
+         */
         public static final Attribute FONT_STYLE =
             new Attribute("font-style", "normal", true);
 
+        /**
+         * CSS attribute "font-variant".
+         */
         public static final Attribute FONT_VARIANT =
             new Attribute("font-variant", "normal", true);
 
+        /**
+         * CSS attribute "font-weight".
+         */
         public static final Attribute FONT_WEIGHT =
             new Attribute("font-weight", "normal", true);
 
+        /**
+         * CSS attribute "height".
+         */
         public static final Attribute HEIGHT =
             new Attribute("height", "auto", false);
 
+        /**
+         * CSS attribute "letter-spacing".
+         */
         public static final Attribute LETTER_SPACING =
             new Attribute("letter-spacing", "normal", true);
 
+        /**
+         * CSS attribute "line-height".
+         */
         public static final Attribute LINE_HEIGHT =
             new Attribute("line-height", "normal", true);
 
+        /**
+         * CSS attribute "list-style".
+         */
         public static final Attribute LIST_STYLE =
             new Attribute("list-style", null, true);
 
+        /**
+         * CSS attribute "list-style-image".
+         */
         public static final Attribute LIST_STYLE_IMAGE =
             new Attribute("list-style-image", "none", true);
 
+        /**
+         * CSS attribute "list-style-position".
+         */
         public static final Attribute LIST_STYLE_POSITION =
             new Attribute("list-style-position", "outside", true);
 
+        /**
+         * CSS attribute "list-style-type".
+         */
         public static final Attribute LIST_STYLE_TYPE =
             new Attribute("list-style-type", "disc", true);
 
+        /**
+         * CSS attribute "margin".
+         */
         public static final Attribute MARGIN =
             new Attribute("margin", null, false);
 
+        /**
+         * CSS attribute "margin-bottom".
+         */
         public static final Attribute MARGIN_BOTTOM =
             new Attribute("margin-bottom", "0", false);
 
+        /**
+         * CSS attribute "margin-left".
+         */
         public static final Attribute MARGIN_LEFT =
             new Attribute("margin-left", "0", false);
 
+        /**
+         * CSS attribute "margin-right".
+         */
         public static final Attribute MARGIN_RIGHT =
             new Attribute("margin-right", "0", false);
 
@@ -338,45 +479,87 @@ public class CSS implements Serializable {
                           Integer.toString(Integer.MIN_VALUE), false);
 
 
+        /**
+         * CSS attribute "margin-top".
+         */
         public static final Attribute MARGIN_TOP =
             new Attribute("margin-top", "0", false);
 
+        /**
+         * CSS attribute "padding".
+         */
         public static final Attribute PADDING =
             new Attribute("padding", null, false);
 
+        /**
+         * CSS attribute "padding-bottom".
+         */
         public static final Attribute PADDING_BOTTOM =
             new Attribute("padding-bottom", "0", false);
 
+        /**
+         * CSS attribute "padding-left".
+         */
         public static final Attribute PADDING_LEFT =
             new Attribute("padding-left", "0", false);
 
+        /**
+         * CSS attribute "padding-right".
+         */
         public static final Attribute PADDING_RIGHT =
             new Attribute("padding-right", "0", false);
 
+        /**
+         * CSS attribute "padding-top".
+         */
         public static final Attribute PADDING_TOP =
             new Attribute("padding-top", "0", false);
 
+        /**
+         * CSS attribute "text-align".
+         */
         public static final Attribute TEXT_ALIGN =
             new Attribute("text-align", null, true);
 
+        /**
+         * CSS attribute "text-decoration".
+         */
         public static final Attribute TEXT_DECORATION =
             new Attribute("text-decoration", "none", true);
 
+        /**
+         * CSS attribute "text-indent".
+         */
         public static final Attribute TEXT_INDENT =
             new Attribute("text-indent", "0", true);
 
+        /**
+         * CSS attribute "text-transform".
+         */
         public static final Attribute TEXT_TRANSFORM =
             new Attribute("text-transform", "none", true);
 
+        /**
+         * CSS attribute "vertical-align".
+         */
         public static final Attribute VERTICAL_ALIGN =
             new Attribute("vertical-align", "baseline", false);
 
+        /**
+         * CSS attribute "word-spacing".
+         */
         public static final Attribute WORD_SPACING =
             new Attribute("word-spacing", "normal", true);
 
+        /**
+         * CSS attribute "white-space".
+         */
         public static final Attribute WHITE_SPACE =
             new Attribute("white-space", "normal", true);
 
+        /**
+         * CSS attribute "width".
+         */
         public static final Attribute WIDTH =
             new Attribute("width", "auto", false);
 
@@ -480,6 +663,9 @@ public class CSS implements Serializable {
         };
     }
 
+    /**
+     * Constructs a CSS object.
+     */
     public CSS() {
         baseFontSize = baseFontSizeIndex + 1;
         // setup the css conversion table
diff --git a/jdk/src/share/classes/javax/swing/text/html/FormSubmitEvent.java b/jdk/src/share/classes/javax/swing/text/html/FormSubmitEvent.java
index 93fb2035355..f429ba15479 100644
--- a/jdk/src/share/classes/javax/swing/text/html/FormSubmitEvent.java
+++ b/jdk/src/share/classes/javax/swing/text/html/FormSubmitEvent.java
@@ -40,19 +40,30 @@ public class FormSubmitEvent extends HTMLFrameHyperlinkEvent {
     /**
      * Represents an HTML form method type.
      * <UL>
-     * <LI><code>GET</code> corresponds to the GET form method</LI>
-     * <LI><code>POST</code> corresponds to the POST from method</LI>
+     * <LI>{@code GET} corresponds to the GET form method</LI>
+     * <LI>{@code POST} corresponds to the POST from method</LI>
      * </UL>
      * @since 1.5
      */
-    public enum MethodType { GET, POST };
+    public enum MethodType {
+
+        /**
+         * {@code GET} corresponds to the GET form method
+         */
+        GET,
+
+        /**
+         * {@code POST} corresponds to the POST from method
+         */
+        POST
+    }
 
     /**
      * Creates a new object representing an html form submit event.
      *
      * @param source the object responsible for the event
      * @param type the event type
-     * @param actionURL the form action URL
+     * @param targetURL the form action URL
      * @param sourceElement the element that corresponds to the source
      *                      of the event
      * @param targetFrame the Frame to display the document in
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTML.java b/jdk/src/share/classes/javax/swing/text/html/HTML.java
index 648312dea05..8b0d0bdc336 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTML.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTML.java
@@ -156,79 +156,369 @@ public class HTML {
 
         // --- Tag Names -----------------------------------
 
+        /**
+         * Tag &lt;a&gt;
+         */
         public static final Tag A = new Tag("a");
+
+        /**
+         * Tag &lt;address&gt;
+         */
         public static final Tag ADDRESS = new Tag("address");
+        /**
+         * Tag &lt;applet&gt;
+         */
         public static final Tag APPLET = new Tag("applet");
+
+        /**
+         * Tag &lt;area&gt;
+         */
         public static final Tag AREA = new Tag("area");
+
+        /**
+         * Tag &lt;b&gt;
+         */
         public static final Tag B = new Tag("b");
+
+        /**
+         * Tag &lt;base&gt;
+         */
         public static final Tag BASE = new Tag("base");
+
+        /**
+         * Tag &lt;basefont&gt;
+         */
         public static final Tag BASEFONT = new Tag("basefont");
+
+        /**
+         * Tag &lt;big&gt;
+         */
         public static final Tag BIG = new Tag("big");
+
+        /**
+         * Tag &lt;blockquote&gt;
+         */
         public static final Tag BLOCKQUOTE = new Tag("blockquote", true, true);
+
+        /**
+         * Tag &lt;body&gt;
+         */
         public static final Tag BODY = new Tag("body", true, true);
+
+        /**
+         * Tag &lt;br&gt;
+         */
         public static final Tag BR = new Tag("br", true, false);
+
+        /**
+         * Tag &lt;caption&gt;
+         */
         public static final Tag CAPTION = new Tag("caption");
+
+        /**
+         * Tag &lt;center&gt;
+         */
         public static final Tag CENTER = new Tag("center", true, false);
+
+        /**
+         * Tag &lt;cite&gt;
+         */
         public static final Tag CITE = new Tag("cite");
+
+        /**
+         * Tag &lt;code&gt;
+         */
         public static final Tag CODE = new Tag("code");
+
+        /**
+         * Tag &lt;dd&gt;
+         */
         public static final Tag DD = new Tag("dd", true, true);
+
+        /**
+         * Tag &lt;dfn&gt;
+         */
         public static final Tag DFN = new Tag("dfn");
+
+        /**
+         * Tag &lt;dir&gt;
+         */
         public static final Tag DIR = new Tag("dir", true, true);
+
+        /**
+         * Tag &lt;div&gt;
+         */
         public static final Tag DIV = new Tag("div", true, true);
+
+        /**
+         * Tag &lt;dl&gt;
+         */
         public static final Tag DL = new Tag("dl", true, true);
+
+        /**
+         * Tag &lt;dt&gt;
+         */
         public static final Tag DT = new Tag("dt", true, true);
+
+        /**
+         * Tag &lt;em&gt;
+         */
         public static final Tag EM = new Tag("em");
+
+        /**
+         * Tag &lt;font&gt;
+         */
         public static final Tag FONT = new Tag("font");
+
+        /**
+         * Tag &lt;form&gt;
+         */
         public static final Tag FORM = new Tag("form", true, false);
+
+        /**
+         * Tag &lt;frame&gt;
+         */
         public static final Tag FRAME = new Tag("frame");
+
+        /**
+         * Tag &lt;frameset&gt;
+         */
         public static final Tag FRAMESET = new Tag("frameset");
+
+        /**
+         * Tag &lt;h1&gt;
+         */
         public static final Tag H1 = new Tag("h1", true, true);
+
+        /**
+         * Tag &lt;h2&gt;
+         */
         public static final Tag H2 = new Tag("h2", true, true);
+
+        /**
+         * Tag &lt;h3&gt;
+         */
         public static final Tag H3 = new Tag("h3", true, true);
+
+        /**
+         * Tag &lt;h4&gt;
+         */
         public static final Tag H4 = new Tag("h4", true, true);
+
+        /**
+         * Tag &lt;h5&gt;
+         */
         public static final Tag H5 = new Tag("h5", true, true);
+
+        /**
+         * Tag &lt;h6&gt;
+         */
         public static final Tag H6 = new Tag("h6", true, true);
+
+        /**
+         * Tag &lt;head&gt;
+         */
         public static final Tag HEAD = new Tag("head", true, true);
+
+        /**
+         * Tag &lt;hr&gt;
+         */
         public static final Tag HR = new Tag("hr", true, false);
+
+        /**
+         * Tag &lt;html&gt;
+         */
         public static final Tag HTML = new Tag("html", true, false);
+
+        /**
+         * Tag &lt;i&gt;
+         */
         public static final Tag I = new Tag("i");
+
+        /**
+         * Tag &lt;img&gt;
+         */
         public static final Tag IMG = new Tag("img");
+
+        /**
+         * Tag &lt;input&gt;
+         */
         public static final Tag INPUT = new Tag("input");
+
+        /**
+         * Tag &lt;isindex&gt;
+         */
         public static final Tag ISINDEX = new Tag("isindex", true, false);
+
+        /**
+         * Tag &lt;kbd&gt;
+         */
         public static final Tag KBD = new Tag("kbd");
+
+        /**
+         * Tag &lt;li&gt;
+         */
         public static final Tag LI = new Tag("li", true, true);
+
+        /**
+         * Tag &lt;link&gt;
+         */
         public static final Tag LINK = new Tag("link");
+
+        /**
+         * Tag &lt;map&gt;
+         */
         public static final Tag MAP = new Tag("map");
+
+        /**
+         * Tag &lt;menu&gt;
+         */
         public static final Tag MENU = new Tag("menu", true, true);
+
+        /**
+         * Tag &lt;meta&gt;
+         */
         public static final Tag META = new Tag("meta");
         /*public*/ static final Tag NOBR = new Tag("nobr");
+
+        /**
+         * Tag &lt;noframes&gt;
+         */
         public static final Tag NOFRAMES = new Tag("noframes", true, true);
+
+        /**
+         * Tag &lt;object&gt;
+         */
         public static final Tag OBJECT = new Tag("object");
+
+        /**
+         * Tag &lt;ol&gt;
+         */
         public static final Tag OL = new Tag("ol", true, true);
+
+        /**
+         * Tag &lt;option&gt;
+         */
         public static final Tag OPTION = new Tag("option");
+
+        /**
+         * Tag &lt;p&gt;
+         */
         public static final Tag P = new Tag("p", true, true);
+
+        /**
+         * Tag &lt;param&gt;
+         */
         public static final Tag PARAM = new Tag("param");
+
+        /**
+         * Tag &lt;pre&gt;
+         */
         public static final Tag PRE = new Tag("pre", true, true);
+
+        /**
+         * Tag &lt;samp&gt;
+         */
         public static final Tag SAMP = new Tag("samp");
+
+        /**
+         * Tag &lt;script&gt;
+         */
         public static final Tag SCRIPT = new Tag("script");
+
+        /**
+         * Tag &lt;select&gt;
+         */
         public static final Tag SELECT = new Tag("select");
+
+        /**
+         * Tag &lt;small&gt;
+         */
         public static final Tag SMALL = new Tag("small");
+
+        /**
+         * Tag &lt;span&gt;
+         */
         public static final Tag SPAN = new Tag("span");
+
+        /**
+         * Tag &lt;strike&gt;
+         */
         public static final Tag STRIKE = new Tag("strike");
+
+        /**
+         * Tag &lt;s&gt;
+         */
         public static final Tag S = new Tag("s");
+
+        /**
+         * Tag &lt;strong&gt;
+         */
         public static final Tag STRONG = new Tag("strong");
+
+        /**
+         * Tag &lt;style&gt;
+         */
         public static final Tag STYLE = new Tag("style");
+
+        /**
+         * Tag &lt;sub&gt;
+         */
         public static final Tag SUB = new Tag("sub");
+
+        /**
+         * Tag &lt;sup&gt;
+         */
         public static final Tag SUP = new Tag("sup");
+
+        /**
+         * Tag &lt;table&gt;
+         */
         public static final Tag TABLE = new Tag("table", false, true);
+
+        /**
+         * Tag &lt;td&gt;
+         */
         public static final Tag TD = new Tag("td", true, true);
+
+        /**
+         * Tag &lt;textarea&gt;
+         */
         public static final Tag TEXTAREA = new Tag("textarea");
+
+        /**
+         * Tag &lt;th&gt;
+         */
         public static final Tag TH = new Tag("th", true, true);
+
+        /**
+         * Tag &lt;title&gt;
+         */
         public static final Tag TITLE = new Tag("title", true, true);
+
+        /**
+         * Tag &lt;tr&gt;
+         */
         public static final Tag TR = new Tag("tr", false, true);
+
+        /**
+         * Tag &lt;tt&gt;
+         */
         public static final Tag TT = new Tag("tt");
+
+        /**
+         * Tag &lt;u&gt;
+         */
         public static final Tag U = new Tag("u");
+
+        /**
+         * Tag &lt;ul&gt;
+         */
         public static final Tag UL = new Tag("ul", true, true);
+
+        /**
+         * Tag &lt;var&gt;
+         */
         public static final Tag VAR = new Tag("var");
 
         /**
@@ -281,6 +571,9 @@ public class HTML {
         }
     }
 
+    /**
+     * Class represents unknown HTML tag.
+     */
     // There is no unique instance of UnknownTag, so we allow it to be
     // Serializable.
     @SuppressWarnings("serial") // Same-version serialization only
@@ -365,85 +658,405 @@ public class HTML {
 
         private String name;
 
+
+        /**
+         * Attribute "size"
+         */
         public static final Attribute SIZE = new Attribute("size");
+
+        /**
+         * Attribute "color"
+         */
         public static final Attribute COLOR = new Attribute("color");
+
+        /**
+         * Attribute "clear"
+         */
         public static final Attribute CLEAR = new Attribute("clear");
+
+        /**
+         * Attribute "background"
+         */
         public static final Attribute BACKGROUND = new Attribute("background");
+
+        /**
+         * Attribute "bgcolor"
+         */
         public static final Attribute BGCOLOR = new Attribute("bgcolor");
+
+        /**
+         * Attribute "text"
+         */
         public static final Attribute TEXT = new Attribute("text");
+
+        /**
+         * Attribute "link"
+         */
         public static final Attribute LINK = new Attribute("link");
+
+        /**
+         * Attribute "vlink"
+         */
         public static final Attribute VLINK = new Attribute("vlink");
+
+        /**
+         * Attribute "alink"
+         */
         public static final Attribute ALINK = new Attribute("alink");
+
+        /**
+         * Attribute "width"
+         */
         public static final Attribute WIDTH = new Attribute("width");
+
+        /**
+         * Attribute "height"
+         */
         public static final Attribute HEIGHT = new Attribute("height");
+
+        /**
+         * Attribute "align"
+         */
         public static final Attribute ALIGN = new Attribute("align");
+
+        /**
+         * Attribute "name"
+         */
         public static final Attribute NAME = new Attribute("name");
+
+        /**
+         * Attribute "href"
+         */
         public static final Attribute HREF = new Attribute("href");
+
+        /**
+         * Attribute "rel"
+         */
         public static final Attribute REL = new Attribute("rel");
+
+        /**
+         * Attribute "rev"
+         */
         public static final Attribute REV = new Attribute("rev");
+
+        /**
+         * Attribute "title"
+         */
         public static final Attribute TITLE = new Attribute("title");
+
+        /**
+         * Attribute "target"
+         */
         public static final Attribute TARGET = new Attribute("target");
+
+        /**
+         * Attribute "shape"
+         */
         public static final Attribute SHAPE = new Attribute("shape");
+
+        /**
+         * Attribute "coords"
+         */
         public static final Attribute COORDS = new Attribute("coords");
+
+        /**
+         * Attribute "ismap"
+         */
         public static final Attribute ISMAP = new Attribute("ismap");
+
+        /**
+         * Attribute "nohref"
+         */
         public static final Attribute NOHREF = new Attribute("nohref");
+
+        /**
+         * Attribute "alt"
+         */
         public static final Attribute ALT = new Attribute("alt");
+
+        /**
+         * Attribute "id"
+         */
         public static final Attribute ID = new Attribute("id");
+
+        /**
+         * Attribute "src"
+         */
         public static final Attribute SRC = new Attribute("src");
+
+        /**
+         * Attribute "hspace"
+         */
         public static final Attribute HSPACE = new Attribute("hspace");
+
+        /**
+         * Attribute "vspace"
+         */
         public static final Attribute VSPACE = new Attribute("vspace");
+
+        /**
+         * Attribute "usemap"
+         */
         public static final Attribute USEMAP = new Attribute("usemap");
+
+        /**
+         * Attribute "lowsrc"
+         */
         public static final Attribute LOWSRC = new Attribute("lowsrc");
+
+        /**
+         * Attribute "codebase"
+         */
         public static final Attribute CODEBASE = new Attribute("codebase");
+
+        /**
+         * Attribute "code"
+         */
         public static final Attribute CODE = new Attribute("code");
+
+        /**
+         * Attribute "archive"
+         */
         public static final Attribute ARCHIVE = new Attribute("archive");
+
+        /**
+         * Attribute "value"
+         */
         public static final Attribute VALUE = new Attribute("value");
+
+        /**
+         * Attribute "valuetype"
+         */
         public static final Attribute VALUETYPE = new Attribute("valuetype");
+
+        /**
+         * Attribute "type"
+         */
         public static final Attribute TYPE = new Attribute("type");
+
+        /**
+         * Attribute "class"
+         */
         public static final Attribute CLASS = new Attribute("class");
+
+        /**
+         * Attribute "style"
+         */
         public static final Attribute STYLE = new Attribute("style");
+
+        /**
+         * Attribute "lang"
+         */
         public static final Attribute LANG = new Attribute("lang");
+
+        /**
+         * Attribute "face"
+         */
         public static final Attribute FACE = new Attribute("face");
+
+        /**
+         * Attribute "dir"
+         */
         public static final Attribute DIR = new Attribute("dir");
+
+        /**
+         * Attribute "declare"
+         */
         public static final Attribute DECLARE = new Attribute("declare");
+
+        /**
+         * Attribute "classid"
+         */
         public static final Attribute CLASSID = new Attribute("classid");
+
+        /**
+         * Attribute "data"
+         */
         public static final Attribute DATA = new Attribute("data");
+
+        /**
+         * Attribute "codetype"
+         */
         public static final Attribute CODETYPE = new Attribute("codetype");
+
+        /**
+         * Attribute "standby"
+         */
         public static final Attribute STANDBY = new Attribute("standby");
+
+        /**
+         * Attribute "border"
+         */
         public static final Attribute BORDER = new Attribute("border");
+
+        /**
+         * Attribute "shapes"
+         */
         public static final Attribute SHAPES = new Attribute("shapes");
+
+        /**
+         * Attribute "noshade"
+         */
         public static final Attribute NOSHADE = new Attribute("noshade");
+
+        /**
+         * Attribute "compact"
+         */
         public static final Attribute COMPACT = new Attribute("compact");
+
+        /**
+         * Attribute "start"
+         */
         public static final Attribute START = new Attribute("start");
+
+        /**
+         * Attribute "action"
+         */
         public static final Attribute ACTION = new Attribute("action");
+
+        /**
+         * Attribute "method"
+         */
         public static final Attribute METHOD = new Attribute("method");
+
+        /**
+         * Attribute "enctype"
+         */
         public static final Attribute ENCTYPE = new Attribute("enctype");
+
+        /**
+         * Attribute "checked"
+         */
         public static final Attribute CHECKED = new Attribute("checked");
+
+        /**
+         * Attribute "maxlength"
+         */
         public static final Attribute MAXLENGTH = new Attribute("maxlength");
+
+        /**
+         * Attribute "multiple"
+         */
         public static final Attribute MULTIPLE = new Attribute("multiple");
+
+        /**
+         * Attribute "selected"
+         */
         public static final Attribute SELECTED = new Attribute("selected");
+
+        /**
+         * Attribute "rows"
+         */
         public static final Attribute ROWS = new Attribute("rows");
+
+        /**
+         * Attribute "cols"
+         */
         public static final Attribute COLS = new Attribute("cols");
+
+        /**
+         * Attribute "dummy"
+         */
         public static final Attribute DUMMY = new Attribute("dummy");
+
+        /**
+         * Attribute "cellspacing"
+         */
         public static final Attribute CELLSPACING = new Attribute("cellspacing");
+
+        /**
+         * Attribute "cellpadding"
+         */
         public static final Attribute CELLPADDING = new Attribute("cellpadding");
+
+        /**
+         * Attribute "valign"
+         */
         public static final Attribute VALIGN = new Attribute("valign");
+
+        /**
+         * Attribute "halign"
+         */
         public static final Attribute HALIGN = new Attribute("halign");
+
+        /**
+         * Attribute "nowrap"
+         */
         public static final Attribute NOWRAP = new Attribute("nowrap");
+
+        /**
+         * Attribute "rowspan"
+         */
         public static final Attribute ROWSPAN = new Attribute("rowspan");
+
+        /**
+         * Attribute "colspan"
+         */
         public static final Attribute COLSPAN = new Attribute("colspan");
+
+        /**
+         * Attribute "prompt"
+         */
         public static final Attribute PROMPT = new Attribute("prompt");
+
+        /**
+         * Attribute "http-equiv"
+         */
         public static final Attribute HTTPEQUIV = new Attribute("http-equiv");
+
+        /**
+         * Attribute "content"
+         */
         public static final Attribute CONTENT = new Attribute("content");
+
+        /**
+         * Attribute "language"
+         */
         public static final Attribute LANGUAGE = new Attribute("language");
+
+        /**
+         * Attribute "version"
+         */
         public static final Attribute VERSION = new Attribute("version");
+
+        /**
+         * Attribute "n"
+         */
         public static final Attribute N = new Attribute("n");
+
+        /**
+         * Attribute "frameborder"
+         */
         public static final Attribute FRAMEBORDER = new Attribute("frameborder");
+
+        /**
+         * Attribute "marginwidth"
+         */
         public static final Attribute MARGINWIDTH = new Attribute("marginwidth");
+
+        /**
+         * Attribute "marginheight"
+         */
         public static final Attribute MARGINHEIGHT = new Attribute("marginheight");
+
+        /**
+         * Attribute "scrolling"
+         */
         public static final Attribute SCROLLING = new Attribute("scrolling");
+
+        /**
+         * Attribute "noresize"
+         */
         public static final Attribute NORESIZE = new Attribute("noresize");
+
+        /**
+         * Attribute "endtag"
+         */
         public static final Attribute ENDTAG = new Attribute("endtag");
+
+        /**
+         * Attribute "comment"
+         */
         public static final Attribute COMMENT = new Attribute("comment");
         static final Attribute MEDIA = new Attribute("media");
 
@@ -645,9 +1258,10 @@ public class HTML {
         return value;
     }
 
-    //  This is used in cases where the value for the attribute has not
-    //  been specified.
-    //
+    /**
+     *  {@code NULL_ATTRIBUTE_VALUE} used in cases where the value for the attribute has not
+     *  been specified.
+     */
     public static final String NULL_ATTRIBUTE_VALUE = "#DEFAULT";
 
     // size determined similar to size of tagHashtable
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
index 5ced35d36dc..f370a6d6312 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
@@ -2888,6 +2888,9 @@ public class HTMLDocument extends DefaultStyledDocument {
 
         }
 
+        /**
+         * Action assigned by default to handle the Isindex task of the reader.
+         */
         public class IsindexAction extends TagAction {
 
             public void start(HTML.Tag t, MutableAttributeSet a) {
@@ -3128,7 +3131,9 @@ public class HTMLDocument extends DefaultStyledDocument {
             }
         }
 
-
+        /**
+         * Action assigned by default to handle the Pre block task of the reader.
+         */
         public class PreAction extends BlockAction {
 
             public void start(HTML.Tag t, MutableAttributeSet attr) {
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
index e89997f45a9..0b3b8b19025 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
@@ -238,7 +238,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * be thrown. When inserting into a non-empty document all tags outside
      * of the body (head, title) will be dropped.
      *
-     * @param in  the stream to read from
+     * @param in the stream to read from
      * @param doc the destination for the insertion
      * @param pos the location in the document to place the
      *   content
@@ -269,14 +269,18 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
     /**
      * Inserts HTML into an existing document.
      *
-     * @param doc       the document to insert into
-     * @param offset    the offset to insert HTML at
-     * @param popDepth  the number of ElementSpec.EndTagTypes to generate before
-     *        inserting
+     * @param doc the document to insert into
+     * @param offset the offset to insert HTML at
+     * @param popDepth the number of ElementSpec.EndTagTypes to generate
+     *                  before inserting
+     * @param html the HTML string
      * @param pushDepth the number of ElementSpec.StartTagTypes with a direction
-     *        of ElementSpec.JoinNextDirection that should be generated
-     *        before inserting, but after the end tags have been generated
+     *                  of ElementSpec.JoinNextDirection that should be generated
+     *                  before inserting, but after the end tags have been generated
      * @param insertTag the first tag to start inserting into document
+     *
+     * @throws BadLocationException if {@code offset} is invalid
+     * @throws IOException on I/O error
      * @exception RuntimeException (will eventually be a BadLocationException)
      *            if pos is invalid
      */
@@ -302,13 +306,13 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * Write content from a document to the given stream
      * in a format appropriate for this kind of content handler.
      *
-     * @param out  the stream to write to
-     * @param doc  the source for the write
-     * @param pos  the location in the document to fetch the
+     * @param out the stream to write to
+     * @param doc the source for the write
+     * @param pos the location in the document to fetch the
      *   content
-     * @param len  the amount to write out
+     * @param len the amount to write out
      * @exception IOException on any I/O error
-     * @exception BadLocationException if pos represents an invalid
+     * @exception BadLocationException if {@code pos} represents an invalid
      *   location within the document
      */
     public void write(Writer out, Document doc, int pos, int len)
@@ -369,6 +373,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * specified is shared by all HTMLEditorKit instances.
      * This should be reimplemented to provide a finer granularity
      * if desired.
+     *
+     * @param s a StyleSheet
      */
     public void setStyleSheet(StyleSheet s) {
         if (s == null) {
@@ -383,6 +389,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * HTML elements.  By default the resource specified by
      * DEFAULT_CSS gets loaded, and is shared by all HTMLEditorKit
      * instances.
+     *
+     * @return the StyleSheet
      */
     public StyleSheet getStyleSheet() {
         AppContext appContext = AppContext.getAppContext();
@@ -412,7 +420,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * to function when used in an applet.
      *
      * @param name the name of the resource, relative to the
-     *  HTMLEditorKit class
+     *             HTMLEditorKit class
      * @return a stream representing the resource
      */
     static InputStream getResourceAsStream(final String name) {
@@ -506,6 +514,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
     /**
      * Sets the default cursor.
      *
+     * @param cursor a cursor
+     *
      * @since 1.3
      */
     public void setDefaultCursor(Cursor cursor) {
@@ -515,6 +525,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
     /**
      * Returns the default cursor.
      *
+     * @return the cursor
+     *
      * @since 1.3
      */
     public Cursor getDefaultCursor() {
@@ -524,6 +536,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
     /**
      * Sets the cursor to use over links.
      *
+     * @param cursor a cursor
+     *
      * @since 1.3
      */
     public void setLinkCursor(Cursor cursor) {
@@ -532,6 +546,9 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
 
     /**
      * Returns the cursor to use over hyper links.
+     *
+     * @return the cursor
+     *
      * @since 1.3
      */
     public Cursor getLinkCursor() {
@@ -557,6 +574,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * automatically or only <code>FormSubmitEvent</code> is fired.
      * By default it is set to true.
      *
+     * @param isAuto if {@code true}, html form submission is processed automatically.
+     *
      * @see #isAutoFormSubmission()
      * @see FormSubmitEvent
      * @since 1.5
@@ -586,6 +605,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      * to avoid the overhead of loading the default parser if
      * it's not used.  The default parser is the HotJava parser
      * using an HTML 3.2 DTD.
+     *
+     * @return the parser
      */
     protected Parser getParser() {
         if (defaultParser == null) {
@@ -972,6 +993,9 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
          * with the results of the parse.  This method should
          * be implemented to be thread-safe.
          *
+         * @param r a reader
+         * @param cb a parser callback
+         * @param ignoreCharSet if {@code true} charset is ignoring
          * @throws IOException if an I/O exception occurs
          */
         public abstract void parse(Reader r, ParserCallback cb, boolean ignoreCharSet) throws IOException;
@@ -1000,26 +1024,78 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
          */
         public static final Object IMPLIED = "_implied_";
 
-
+        /**
+         * The last method called on the reader. It allows
+         * any pending changes to be flushed into the document.
+         * Since this is currently loading synchronously, the entire
+         * set of changes are pushed in at this point.
+         *
+         * @throws BadLocationException if the given position does not
+         *   represent a valid location in the associated document.
+         */
         public void flush() throws BadLocationException {
         }
 
+        /**
+         * Called by the parser to indicate a block of text was
+         * encountered.
+         *
+         * @param data a data
+         * @param pos a position
+         */
         public void handleText(char[] data, int pos) {
         }
 
+        /**
+         * Called by the parser to indicate a block of comment was
+         * encountered.
+         *
+         * @param data a data
+         * @param pos a position
+         */
         public void handleComment(char[] data, int pos) {
         }
 
+        /**
+         * Callback from the parser. Route to the appropriate
+         * handler for the tag.
+         *
+         * @param t an HTML tag
+         * @param a a set of attributes
+         * @param pos a position
+         */
         public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
         }
 
+        /**
+         * Callback from the parser. Route to the appropriate
+         * handler for the tag.
+         *
+         * @param t an HTML tag
+         * @param pos a position
+         */
         public void handleEndTag(HTML.Tag t, int pos) {
         }
 
+        /**
+         * Callback from the parser. Route to the appropriate
+         * handler for the tag.
+         *
+         * @param t an HTML tag
+         * @param a a set of attributes
+         * @param pos a position
+         */
         public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) {
         }
 
-        public void handleError(String errorMsg, int pos){
+        /**
+         * Callback from the parser. Route to the appropriate
+         * handler for the error.
+         *
+         * @param errorMsg a error message
+         * @param pos a position
+         */
+        public void handleError(String errorMsg, int pos) {
         }
 
         /**
@@ -1489,6 +1565,12 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static abstract class HTMLTextAction extends StyledTextAction {
+
+        /**
+         * Creates a new HTMLTextAction from a string action name.
+         *
+         * @param name the name of the action
+         */
         public HTMLTextAction(String name) {
             super(name);
         }
@@ -1575,6 +1657,12 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
         /**
          * Returns the deepest element at <code>offset</code> matching
          * <code>tag</code>.
+         *
+         * @param doc an instance of HTMLDocument
+         * @param offset the specified offset &gt;= 0
+         * @param tag an instance of HTML.Tag
+         *
+         * @return the deepest element
          */
         protected Element findElementMatchingTag(HTMLDocument doc, int offset,
                                                  HTML.Tag tag) {
@@ -1611,11 +1699,30 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class InsertHTMLTextAction extends HTMLTextAction {
+
+        /**
+         * Creates a new InsertHTMLTextAction.
+         *
+         * @param name a name of the action
+         * @param html an HTML string
+         * @param parentTag a parent tag
+         * @param addTag the first tag to start inserting into document
+         */
         public InsertHTMLTextAction(String name, String html,
                                     HTML.Tag parentTag, HTML.Tag addTag) {
             this(name, html, parentTag, addTag, null, null);
         }
 
+        /**
+         * Creates a new InsertHTMLTextAction.
+         *
+         * @param name a name of the action
+         * @param html an HTML string
+         * @param parentTag a parent tag
+         * @param addTag the first tag to start inserting into document
+         * @param alternateParentTag an alternative parent tag
+         * @param alternateAddTag an alternative tag
+         */
         public InsertHTMLTextAction(String name, String html,
                                     HTML.Tag parentTag,
                                     HTML.Tag addTag,
@@ -1644,6 +1751,17 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
         /**
          * A cover for HTMLEditorKit.insertHTML. If an exception it
          * thrown it is wrapped in a RuntimeException and thrown.
+         *
+         * @param editor an instance of JEditorPane
+         * @param doc the document to insert into
+         * @param offset the offset to insert HTML at
+         * @param html an HTML string
+         * @param popDepth the number of ElementSpec.EndTagTypes to generate
+         *                  before inserting
+         * @param pushDepth the number of ElementSpec.StartTagTypes with a direction
+         *                  of ElementSpec.JoinNextDirection that should be generated
+         *                  before inserting, but after the end tags have been generated
+         * @param addTag the first tag to start inserting into document
          */
         protected void insertHTML(JEditorPane editor, HTMLDocument doc,
                                   int offset, String html, int popDepth,
@@ -1663,7 +1781,17 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
          * This is invoked when inserting at a boundary. It determines
          * the number of pops, and then the number of pushes that need
          * to be performed, and then invokes insertHTML.
+         *
+         * @param editor an instance of JEditorPane
+         * @param doc an instance of HTMLDocument
+         * @param offset an offset to start from
+         * @param insertElement an instance of Element
+         * @param html an HTML string
+         * @param parentTag a parent tag
+         * @param addTag the first tag to start inserting into document
+         *
          * @since 1.3
+         *
          */
         protected void insertAtBoundary(JEditorPane editor, HTMLDocument doc,
                                         int offset, Element insertElement,
@@ -1678,6 +1806,14 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
          * the number of pops, and then the number of pushes that need
          * to be performed, and then invokes insertHTML.
          * @deprecated As of Java 2 platform v1.3, use insertAtBoundary
+         *
+         * @param editor an instance of JEditorPane
+         * @param doc an instance of HTMLDocument
+         * @param offset an offset to start from
+         * @param insertElement an instance of Element
+         * @param html an HTML string
+         * @param parentTag a parent tag
+         * @param addTag the first tag to start inserting into document
          */
         @Deprecated
         protected void insertAtBoundry(JEditorPane editor, HTMLDocument doc,
@@ -2050,7 +2186,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
              * @param offs0 the starting model offset &ge; 0
              * @param offs1 the ending model offset &ge; offs1
              * @param bounds the bounding box of the view, which is not
-             *        necessarily the region to paint.
+             *               necessarily the region to paint.
              * @param c the editor
              * @param view View painting for
              * @return region in which drawing occurred
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java b/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java
index 0d154e2c3aa..6280efe3cc5 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java
@@ -361,8 +361,10 @@ public class HTMLWriter extends AbstractWriter {
      * Writes out a start tag for the element.
      * Ignores all synthesized elements.
      *
-     * @param elem   an Element
-     * @exception IOException on any I/O error
+     * @param elem an Element
+     * @throws IOException on any I/O error
+     * @throws BadLocationException if pos represents an invalid
+     *            location within the document.
      */
     protected void startTag(Element elem) throws IOException, BadLocationException {
 
@@ -667,9 +669,12 @@ public class HTMLWriter extends AbstractWriter {
 
 
     /**
-     * Returns true if the element is a
+     * Returns {@code true} if the element is a
      * synthesized element.  Currently we are only testing
      * for the p-implied tag.
+     *
+     * @param elem an element
+     * @return {@code true} if the element is a synthesized element.
      */
     protected boolean synthesizedElement(Element elem) {
         if (matchNameAttribute(elem.getAttributes(), HTML.Tag.IMPLIED)) {
@@ -682,6 +687,10 @@ public class HTMLWriter extends AbstractWriter {
     /**
      * Returns true if the StyleConstants.NameAttribute is
      * equal to the tag that is passed in as a parameter.
+     *
+     * @param attr a set of attributes
+     * @param tag an HTML tag
+     * @return {@code true} if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.
      */
     protected boolean matchNameAttribute(AttributeSet attr, HTML.Tag tag) {
         Object o = attr.getAttribute(StyleConstants.NameAttribute);
@@ -700,6 +709,7 @@ public class HTMLWriter extends AbstractWriter {
      * so that when appropriate the corresponding end tags can be
      * written out.
      *
+     * @param attr a set of attributes
      * @exception IOException on any I/O error
      */
     protected void writeEmbeddedTags(AttributeSet attr) throws IOException {
@@ -754,6 +764,7 @@ public class HTMLWriter extends AbstractWriter {
      * then the tag is removed from the vector and a corresponding
      * end tag is written out.
      *
+     * @param attr a set of attributes
      * @exception IOException on any I/O error
      */
     protected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException {
diff --git a/jdk/src/share/classes/javax/swing/text/html/ImageView.java b/jdk/src/share/classes/javax/swing/text/html/ImageView.java
index bf01379f12c..c3f0e1aadaf 100644
--- a/jdk/src/share/classes/javax/swing/text/html/ImageView.java
+++ b/jdk/src/share/classes/javax/swing/text/html/ImageView.java
@@ -141,9 +141,11 @@ public class ImageView extends View {
     }
 
     /**
-     * Returns the text to display if the image can't be loaded. This is
+     * Returns the text to display if the image cannot be loaded. This is
      * obtained from the Elements attribute set with the attribute name
      * <code>HTML.Attribute.ALT</code>.
+     *
+     * @return the test to display if the image cannot be loaded.
      */
     public String getAltText() {
         return (String)getElement().getAttributes().getAttribute
@@ -153,6 +155,8 @@ public class ImageView extends View {
     /**
      * Return a URL for the image source,
      * or null if it could not be determined.
+     *
+     * @return the URL for the image source, or null if it could not be determined.
      */
     public URL getImageURL() {
         String src = (String)getElement().getAttributes().
@@ -171,7 +175,9 @@ public class ImageView extends View {
     }
 
     /**
-     * Returns the icon to use if the image couldn't be found.
+     * Returns the icon to use if the image could not be found.
+     *
+     * @return the icon to use if the image could not be found.
      */
     public Icon getNoImageIcon() {
         return (Icon) UIManager.getLookAndFeelDefaults().get(MISSING_IMAGE);
@@ -179,6 +185,8 @@ public class ImageView extends View {
 
     /**
      * Returns the icon to use while in the process of loading the image.
+     *
+     * @return the icon to use while in the process of loading the image.
      */
     public Icon getLoadingImageIcon() {
         return (Icon) UIManager.getLookAndFeelDefaults().get(PENDING_IMAGE);
@@ -186,6 +194,8 @@ public class ImageView extends View {
 
     /**
      * Returns the image to render.
+     *
+     * @return the image to render.
      */
     public Image getImage() {
         sync();
@@ -205,9 +215,12 @@ public class ImageView extends View {
 
     /**
      * Sets how the image is loaded. If <code>newValue</code> is true,
-     * the image we be loaded when first asked for, otherwise it will
+     * the image will be loaded when first asked for, otherwise it will
      * be loaded asynchronously. The default is to not load synchronously,
      * that is to load the image asynchronously.
+     *
+     * @param newValue if {@code true} the image will be loaded when first asked for,
+     *                 otherwise it will be asynchronously.
      */
     public void setLoadsSynchronously(boolean newValue) {
         synchronized(this) {
@@ -221,14 +234,18 @@ public class ImageView extends View {
     }
 
     /**
-     * Returns true if the image should be loaded when first asked for.
+     * Returns {@code true} if the image should be loaded when first asked for.
+     *
+     * @return {@code true} if the image should be loaded when first asked for.
      */
     public boolean getLoadsSynchronously() {
         return ((state & SYNC_LOAD_FLAG) != 0);
     }
 
     /**
-     * Convenience method to get the StyleSheet.
+     * Convenient method to get the StyleSheet.
+     *
+     * @return the StyleSheet
      */
     protected StyleSheet getStyleSheet() {
         HTMLDocument doc = (HTMLDocument) getDocument();
@@ -613,7 +630,7 @@ public class ImageView extends View {
     }
 
     /**
-     * Convenience method for getting an integer attribute from the elements
+     * Convenient method for getting an integer attribute from the elements
      * AttributeSet.
      */
     private int getIntAttr(HTML.Attribute name, int deflt) {
diff --git a/jdk/src/share/classes/javax/swing/text/html/InlineView.java b/jdk/src/share/classes/javax/swing/text/html/InlineView.java
index d9515beb97b..c6fe5fe01fc 100644
--- a/jdk/src/share/classes/javax/swing/text/html/InlineView.java
+++ b/jdk/src/share/classes/javax/swing/text/html/InlineView.java
@@ -214,7 +214,11 @@ public class InlineView extends LabelView {
         }
     }
 
-
+    /**
+     * Convenient method to get the StyleSheet.
+     *
+     * @return the StyleSheet
+     */
     protected StyleSheet getStyleSheet() {
         HTMLDocument doc = (HTMLDocument) getDocument();
         return doc.getStyleSheet();
diff --git a/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java b/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java
index 8a69d172219..166bf95c20e 100644
--- a/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java
+++ b/jdk/src/share/classes/javax/swing/text/html/MinimalHTMLWriter.java
@@ -195,6 +195,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * Writes out a start tag appropriately
      * indented.  Also increments the indent level.
      *
+     * @param tag a start tag
      * @exception IOException on any I/O error
      */
     protected void writeStartTag(String tag) throws IOException {
@@ -209,6 +210,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * Writes out an end tag appropriately
      * indented.  Also decrements the indent level.
      *
+     * @param endTag an end tag
      * @exception IOException on any I/O error
      */
     protected void writeEndTag(String endTag) throws IOException {
@@ -284,7 +286,9 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * branch elements or leaf elements.  This method specially handles
      * leaf elements that are text.
      *
-     * @exception IOException on any I/O error
+     * @throws IOException on any I/O error
+     * @throws BadLocationException if we are in an invalid
+     *            location within the document.
      */
     protected void writeBody() throws IOException, BadLocationException {
         ElementIterator it = getElementIterator();
@@ -354,6 +358,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * &lt;p&gt; tag and sets its value to be the name of the
      * style.
      *
+     * @param elem an element
      * @exception IOException on any I/O error
      */
     protected void writeStartParagraph(Element elem) throws IOException {
@@ -371,6 +376,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * Responsible for writing out other non-text leaf
      * elements.
      *
+     * @param elem an element
      * @exception IOException on any I/O error
      */
     protected void writeLeaf(Element elem) throws IOException {
@@ -392,7 +398,8 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * In certain cases it could be a URL, in others it could
      * be read from a stream.
      *
-     * @param elem element of type StyleConstants.IconElementName
+     * @param elem an element of type StyleConstants.IconElementName
+     * @throws IOException if I/O error occured.
      */
     protected void writeImage(Element elem) throws IOException {
     }
@@ -402,6 +409,9 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * Responsible for handling Component Elements;
      * deliberately unimplemented.
      * How this method is implemented is a matter of policy.
+     *
+     * @param elem an element of type StyleConstants.ComponentElementName
+     * @throws IOException if I/O error occured.
      */
     protected void writeComponent(Element elem) throws IOException {
     }
@@ -410,6 +420,8 @@ public class MinimalHTMLWriter extends AbstractWriter {
     /**
      * Returns true if the element is a text element.
      *
+     * @param elem an element
+     * @return {@code true} if the element is a text element.
      */
     protected boolean isText(Element elem) {
         return (elem.getName() == AbstractDocument.ContentElementName);
@@ -420,6 +432,8 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * Writes out the attribute set
      * in an HTML-compliant manner.
      *
+     * @param elem an element
+     * @param needsIndenting indention will be added if {@code needsIndenting} is {@code true}
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *            location within the document.
@@ -442,6 +456,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * bold &lt;b&gt;, italic &lt;i&gt;, and &lt;u&gt; tags for the
      * text based on its attribute settings.
      *
+     * @param attr a set of attributes
      * @exception IOException on any I/O error
      */
 
@@ -553,6 +568,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * style attribute is set to contain the list of remaining
      * attributes just like inline styles.
      *
+     * @param attr a set of attributes
      * @exception IOException on any I/O error
      */
     protected void writeNonHTMLAttributes(AttributeSet attr) throws IOException {
@@ -608,6 +624,8 @@ public class MinimalHTMLWriter extends AbstractWriter {
 
     /**
      * Returns true if we are currently in a &lt;font&gt; tag.
+     *
+     * @return {@code true} if we are currently in a &lt;font&gt; tag.
      */
     protected boolean inFontTag() {
         return (fontAttributes != null);
@@ -636,6 +654,7 @@ public class MinimalHTMLWriter extends AbstractWriter {
      * any enclosing font tag before writing out a
      * new start tag.
      *
+     * @param style a font style
      * @exception IOException on any I/O error
      */
     protected void startFontTag(String style) throws IOException {
diff --git a/jdk/src/share/classes/javax/swing/text/html/Option.java b/jdk/src/share/classes/javax/swing/text/html/Option.java
index 011b28a49f4..8e9ce7e1944 100644
--- a/jdk/src/share/classes/javax/swing/text/html/Option.java
+++ b/jdk/src/share/classes/javax/swing/text/html/Option.java
@@ -61,6 +61,8 @@ public class Option implements Serializable {
 
     /**
      * Sets the label to be used for the option.
+     *
+     * @param label a label.
      */
     public void setLabel(String label) {
         this.label = label;
@@ -68,6 +70,8 @@ public class Option implements Serializable {
 
     /**
      * Fetch the label associated with the option.
+     *
+     * @return the label associated with the option.
      */
     public String getLabel() {
         return label;
@@ -75,6 +79,8 @@ public class Option implements Serializable {
 
     /**
      * Fetch the attributes associated with this option.
+     *
+     * @return the attributes associated with this option.
      */
     public AttributeSet getAttributes() {
         return attr;
@@ -89,6 +95,8 @@ public class Option implements Serializable {
 
     /**
      * Sets the selected state.
+     *
+     * @param state a selection state
      */
     protected void setSelection(boolean state) {
         selected = state;
@@ -96,16 +104,21 @@ public class Option implements Serializable {
 
     /**
      * Fetches the selection state associated with this option.
+     *
+     * @return the selection state.
      */
     public boolean isSelected() {
         return selected;
     }
 
     /**
-     * Convenience method to return the string associated
-     * with the <code>value</code> attribute.  If the
-     * value has not been specified, the label will be
+     * Convenient method to return the string associated
+     * with the {@code value} attribute. If the
+     * {@code value} has not been specified, the {@code label} will be
      * returned.
+     *
+     * @return the string associated with the {@code value} attribute,
+     * or {@code label} if the value has been not specified.
      */
     public String getValue() {
         String value = (String) attr.getAttribute(HTML.Attribute.VALUE);
diff --git a/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java b/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java
index 3c142104bdb..01c441f0593 100644
--- a/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java
+++ b/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java
@@ -128,6 +128,11 @@ public class ParagraphView extends javax.swing.text.ParagraphView {
         }
     }
 
+    /**
+     * Convenient method to get the StyleSheet.
+     *
+     * @return the StyleSheet
+     */
     protected StyleSheet getStyleSheet() {
         HTMLDocument doc = (HTMLDocument) getDocument();
         return doc.getStyleSheet();
diff --git a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
index 4c5d8d95ce5..fc0bf556d58 100644
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java
@@ -156,7 +156,7 @@ public class StyleSheet extends StyleContext {
     // . When one of the AttributeSets is mutated by way of a
     //   StyleConstants key, all the associated CSS keys are removed. This is
     //   done so that the two representations don't get out of sync. For
-    //   example, if the developer adds StyleConsants.BOLD, FALSE to an
+    //   example, if the developer adds StyleConstants.BOLD, FALSE to an
     //   AttributeSet that contains HTML.Tag.B, the HTML.Tag.B entry will
     //   be removed.
 
@@ -270,6 +270,9 @@ public class StyleSheet extends StyleContext {
      * with a selector "table p" and a new rule was added with a selector
      * of "p" the returned Style would include the new attributes from
      * the rule "p".
+     *
+     * @param selector a space separated String of the element names.
+     * @return the rule that best matches the selector.
      */
     public Style getRule(String selector) {
         selector = cleanSelectorString(selector);
@@ -284,6 +287,8 @@ public class StyleSheet extends StyleContext {
      * Adds a set of rules to the sheet.  The rules are expected to
      * be in valid CSS format.  Typically this would be called as
      * a result of parsing a &lt;style&gt; tag.
+     *
+     * @param rule a set of rules
      */
     public void addRule(String rule) {
         if (rule != null) {
@@ -315,6 +320,9 @@ public class StyleSheet extends StyleContext {
      * Translates a CSS declaration to an AttributeSet that represents
      * the CSS declaration.  Typically this would be called as a
      * result of encountering an HTML style attribute.
+     *
+     * @param decl a CSS declaration
+     * @return a set of attributes that represents the CSS declaration.
      */
     public AttributeSet getDeclaration(String decl) {
         if (decl == null) {
@@ -334,6 +342,7 @@ public class StyleSheet extends StyleContext {
      *  location of the stream and may be null.  All relative
      *  URLs specified in the stream will be based upon this
      *  parameter.
+     * @throws java.io.IOException if I/O error occured.
      */
     public void loadRules(Reader in, URL ref) throws IOException {
         CssParser parser = new CssParser();
@@ -344,6 +353,9 @@ public class StyleSheet extends StyleContext {
      * Fetches a set of attributes to use in the view for
      * displaying.  This is basically a set of attributes that
      * can be used for View.getAttributes.
+     *
+     * @param v a view
+     * @return the of attributes
      */
     public AttributeSet getViewAttributes(View v) {
         return new ViewAttributeSet(v);
@@ -388,6 +400,7 @@ public class StyleSheet extends StyleContext {
      * any previously added style sheets. An added StyleSheet will never
      * override the rules of the receiving style sheet.
      *
+     * @param ss a StyleSheet
      * @since 1.3
      */
     public void addStyleSheet(StyleSheet ss) {
@@ -410,6 +423,7 @@ public class StyleSheet extends StyleContext {
     /**
      * Removes the StyleSheet <code>ss</code> from those of the receiver.
      *
+     * @param ss a StyleSheet
      * @since 1.3
      */
     public void removeStyleSheet(StyleSheet ss) {
@@ -435,6 +449,7 @@ public class StyleSheet extends StyleContext {
      * Returns an array of the linked StyleSheets. Will return null
      * if there are no linked StyleSheets.
      *
+     * @return an array of StyleSheets.
      * @since 1.3
      */
     public StyleSheet[] getStyleSheets() {
@@ -458,6 +473,7 @@ public class StyleSheet extends StyleContext {
      * to become part of the receiver, create a new StyleSheet and use
      * addStyleSheet to link it in.
      *
+     * @param url an url
      * @since 1.3
      */
     public void importStyleSheet(URL url) {
@@ -480,6 +496,7 @@ public class StyleSheet extends StyleContext {
      * Sets the base. All import statements that are relative, will be
      * relative to <code>base</code>.
      *
+     * @param base a base.
      * @since 1.3
      */
     public void setBase(URL base) {
@@ -489,6 +506,7 @@ public class StyleSheet extends StyleContext {
     /**
      * Returns the base.
      *
+     * @return the base.
      * @since 1.3
      */
     public URL getBase() {
@@ -498,6 +516,9 @@ public class StyleSheet extends StyleContext {
     /**
      * Adds a CSS attribute to the given set.
      *
+     * @param attr a set of attributes
+     * @param key a CSS property
+     * @param value an HTML attribute value
      * @since 1.3
      */
     public void addCSSAttribute(MutableAttributeSet attr, CSS.Attribute key,
@@ -508,6 +529,11 @@ public class StyleSheet extends StyleContext {
     /**
      * Adds a CSS attribute to the given set.
      *
+     * @param attr a set of attributes
+     * @param key a CSS property
+     * @param value an HTML attribute value
+     * @return {@code true} if an HTML attribute {@code value} can be converted
+     *         to a CSS attribute, false otherwise.
      * @since 1.3
      */
     public boolean addCSSAttributeFromHTML(MutableAttributeSet attr,
@@ -527,6 +553,7 @@ public class StyleSheet extends StyleContext {
      * set of CSS attributes.
      *
      * @param htmlAttrSet AttributeSet containing the HTML attributes.
+     * @return the set of CSS attributes.
      */
     public AttributeSet translateHTMLToCSS(AttributeSet htmlAttrSet) {
         AttributeSet cssAttrSet = css.translateHTMLToCSS(htmlAttrSet);
@@ -917,6 +944,9 @@ public class StyleSheet extends StyleContext {
     /**
      * Fetches the box formatter to use for the given set
      * of CSS attributes.
+     *
+     * @param a a set of CSS attributes
+     * @return the box formatter.
      */
     public BoxPainter getBoxPainter(AttributeSet a) {
         return new BoxPainter(a, css, this);
@@ -925,6 +955,9 @@ public class StyleSheet extends StyleContext {
     /**
      * Fetches the list formatter to use for the given set
      * of CSS attributes.
+     *
+     * @param a a set of CSS attributes
+     * @return the list formatter.
      */
     public ListPainter getListPainter(AttributeSet a) {
         return new ListPainter(a, this);
@@ -932,6 +965,8 @@ public class StyleSheet extends StyleContext {
 
     /**
      * Sets the base font size, with valid values between 1 and 7.
+     *
+     * @param sz a font size.
      */
     public void setBaseFontSize(int sz) {
         css.setBaseFontSize(sz);
@@ -941,17 +976,29 @@ public class StyleSheet extends StyleContext {
      * Sets the base font size from the passed in String. The string
      * can either identify a specific font size, with legal values between
      * 1 and 7, or identify a relative font size such as +1 or -2.
+     *
+     * @param size a font size.
      */
     public void setBaseFontSize(String size) {
         css.setBaseFontSize(size);
     }
 
+    /**
+     *
+     * Returns the index of HTML/CSS size model.
+     *
+     * @param pt a size of point
+     * @return the index of HTML/CSS size model.
+     */
     public static int getIndexOfSize(float pt) {
         return CSS.getIndexOfSize(pt, sizeMapDefault);
     }
 
     /**
      * Returns the point size, given a size index.
+     *
+     * @param index a size index
+     * @return the point size value.
      */
     public float getPointSize(int index) {
         return css.getPointSize(index, this);
@@ -960,6 +1007,9 @@ public class StyleSheet extends StyleContext {
     /**
      *  Given a string such as "+2", "-2", or "2",
      *  returns a point size value.
+     *
+     * @param size a CSS string describing font size
+     * @return the point size value.
      */
     public float getPointSize(String size) {
         return css.getPointSize(size, this);
@@ -970,6 +1020,9 @@ public class StyleSheet extends StyleContext {
      * Note: This will only convert the HTML3.2 color strings
      *       or a string of length 7;
      *       otherwise, it will return null.
+     *
+     * @param string color string such as "RED" or "#NNNNNN"
+     * @return the color
      */
     public Color stringToColor(String string) {
         return CSS.stringToColor(string);
@@ -1816,6 +1869,7 @@ public class StyleSheet extends StyleContext {
          * @param v the view making the request.  This is
          *  used to get the AttributeSet, and may be used to
          *  resolve percentage arguments.
+         * @return the inset needed for the margin, border and padding.
          * @exception IllegalArgumentException for an invalid direction
          */
         public float getInset(int side, View v) {
-- 
GitLab


From a30dec6af68cee53fa331f828f55aaafa1f65545 Mon Sep 17 00:00:00 2001
From: Alexander Zuev <kizune@openjdk.org>
Date: Thu, 19 Jun 2014 18:07:02 +0400
Subject: [PATCH 117/192] 8000650: unpack200.exe should check gzip crc

Reviewed-by: ksrini
---
 .../com/sun/java/util/jar/pack/main.cpp       |  26 ++++-
 .../com/sun/java/util/jar/pack/unpack.h       |   1 +
 .../native/com/sun/java/util/jar/pack/zip.cpp |   2 +
 jdk/test/tools/pack200/PackChecksum.java      | 107 ++++++++++++++++++
 4 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 jdk/test/tools/pack200/PackChecksum.java

diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp
index 6fbc43a18ae..fdce8857c2c 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp
@@ -62,6 +62,13 @@ int main(int argc, char **argv) {
     return unpacker::run(argc, argv);
 }
 
+// Dealing with big-endian arch
+#ifdef _BIG_ENDIAN
+#define SWAP_INT(a) (((a>>24)&0xff) | ((a<<8)&0xff0000) | ((a>>8)&0xff00) | ((a<<24)&0xff000000))
+#else
+#define SWAP_INT(a) (a)
+#endif
+
 // Single-threaded, implementation, not reentrant.
 // Includes a weak error check against MT access.
 #ifndef THREAD_SELF
@@ -385,6 +392,7 @@ int unpacker::run(int argc, char **argv) {
       u.start();
     }
   } else {
+    u.gzcrc = 0;
     u.start(peek, sizeof(peek));
   }
 
@@ -425,7 +433,23 @@ int unpacker::run(int argc, char **argv) {
     status = 1;
   }
 
-  if (u.infileptr != null) {
+  if (!u.aborting() && u.infileptr != null) {
+    if (u.gzcrc != 0) {
+      // Read the CRC information from the gzip container
+      fseek(u.infileptr, -8, SEEK_END);
+      uint filecrc;
+      fread(&filecrc, sizeof(filecrc), 1, u.infileptr);
+      if (u.gzcrc != SWAP_INT(filecrc)) { // CRC error
+        if (strcmp(destination_file, "-") != 0) {
+          // Output is not stdout, remove it, it's broken
+          if (u.jarout != null)
+            u.jarout->closeJarFile(false);
+          remove(destination_file);
+        }
+        // Print out the error and exit with return code != 0
+        u.abort("CRC error, invalid compressed data.");
+      }
+    }
     fclose(u.infileptr);
     u.infileptr = null;
   }
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
index cec7a88b24e..621b1c1db01 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
@@ -171,6 +171,7 @@ struct unpacker {
   bytes inbytes;    // direct
   gunzip* gzin;     // gunzip filter, if any
   jar*  jarout;     // output JAR file
+  uint  gzcrc;      // CRC gathered from gzip content
 
 #ifndef PRODUCT
   int   nowrite;
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
index 786a83228bb..a6e511c5447 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
@@ -551,6 +551,7 @@ static jlong read_input_via_gzip(unpacker* u,
       break;
     }
     int nr = readlen - zs.avail_out;
+    u->gzcrc = crc32(u->gzcrc, (const unsigned char *)bufptr, nr);
     numread += nr;
     bufptr += nr;
     assert(numread <= maxlen);
@@ -589,6 +590,7 @@ void gunzip::init(unpacker* u_) {
   zstream = NEW(z_stream, 1);
   u->gzin = this;
   u->read_input_fn = read_input_via_gzip;
+  u->gzcrc = crc32(0L, Z_NULL, 0);
 }
 
 void gunzip::start(int magic) {
diff --git a/jdk/test/tools/pack200/PackChecksum.java b/jdk/test/tools/pack200/PackChecksum.java
new file mode 100644
index 00000000000..3d6a3b07a29
--- /dev/null
+++ b/jdk/test/tools/pack200/PackChecksum.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+/*
+ * @test
+ * @bug 8000650
+ * @summary unpack200.exe should check gzip crc
+ * @compile -XDignore.symbol.file Utils.java PackChecksum.java
+ * @run main PackChecksum
+ * @author kizune
+ */
+public class PackChecksum {
+
+    public static void main(String... args) throws Exception {
+        testChecksum();
+    }
+
+    static void testChecksum() throws Exception {
+
+        // Create a fresh .jar file
+        File testFile = new File("src_tools.jar");
+        File testPack = new File("src_tools.pack.gz");
+        generateJar(testFile);
+        List<String> cmdsList = new ArrayList<>();
+
+        // Create .pack file
+        cmdsList.add(Utils.getPack200Cmd());
+        cmdsList.add(testPack.getName());
+        cmdsList.add(testFile.getName());
+        Utils.runExec(cmdsList);
+
+        // Mess up with the checksum of the packed file
+        RandomAccessFile raf = new RandomAccessFile(testPack, "rw");
+        raf.seek(raf.length() - 8);
+        int val = raf.readInt();
+        val = Integer.MAX_VALUE - val;
+        raf.seek(raf.length() - 8);
+        raf.writeInt(val);
+        raf.close();
+
+        File dstFile = new File("dst_tools.jar");
+        cmdsList.clear();
+        cmdsList.add(Utils.getUnpack200Cmd());
+        cmdsList.add(testPack.getName());
+        cmdsList.add(dstFile.getName());
+
+        boolean passed = false;
+        try {
+            Utils.runExec(cmdsList);
+        } catch (RuntimeException re) {
+            // unpack200 should exit with non-zero exit code
+            passed = true;
+        }
+
+        // tidy up
+        if (testFile.exists()) testFile.delete();
+        if (testPack.exists()) testPack.delete();
+        if (dstFile.exists()) dstFile.delete();
+        if (!passed) {
+            throw new Exception("File with incorrect CRC unpacked without the error.");
+        }
+    }
+
+    static void generateJar(File result) throws IOException {
+        if (result.exists()) {
+            result.delete();
+        }
+
+        try (JarOutputStream output = new JarOutputStream(new FileOutputStream(result)); ) {
+            for (int i = 0 ; i < 100 ; i++) {
+                JarEntry e = new JarEntry("F-" + i + ".txt");
+                output.putNextEntry(e);
+            }
+            output.flush();
+            output.close();
+        }
+    }
+
+}
-- 
GitLab


From 2bdfb1233c343cf8de1accb210dceffbf3115cc5 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Thu, 19 Jun 2014 20:36:03 +0530
Subject: [PATCH 118/192] 8047369: Add regression tests for passing test cases
 of JDK-8024971

Reviewed-by: hannesw, jlaskey
---
 nashorn/test/script/basic/JDK-8047369.js | 186 +++++++++++++++++++++++
 1 file changed, 186 insertions(+)
 create mode 100644 nashorn/test/script/basic/JDK-8047369.js

diff --git a/nashorn/test/script/basic/JDK-8047369.js b/nashorn/test/script/basic/JDK-8047369.js
new file mode 100644
index 00000000000..dec55152bd5
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047369.js
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047369: Add regression tests for passing test cases of JDK-8024971
+ * 
+ * @test
+ * @run
+ * @option -scripting
+ */
+
+function makeFuncAndCall(code) {
+    Function(code)();
+}
+
+function makeFuncExpectError(code, ErrorType) {
+    try {
+        makeFuncAndCall(code);
+    } catch (e) {
+        if (! (e instanceof ErrorType)) {
+            fail(ErrorType.name + " expected, got " + e);
+        }
+    }
+}
+
+function evalExpectError(code, ErrorType) {
+    try {
+        eval(code)();
+    } catch (e) {
+        if (! (e instanceof ErrorType)) {
+            fail(ErrorType.name + " expected, got " + e);
+        }
+    }
+}
+
+function evalExpectValue(code, value) {
+    if (eval(code) != value) {
+        fail("Expected " + value + " with eval of " + code);
+    }
+}
+
+makeFuncAndCall("for(x.x in 0) {}");
+// bug JDK-8047357
+// makeFuncAndCall("switch((null >> x3)) { default: {var x; break ; }\nthrow x; }");
+makeFuncExpectError("switch(x) { case 8: break; case false: }", ReferenceError);
+makeFuncAndCall("try { return true; } finally { return false; } ");
+makeFuncAndCall("({ get 1e81(){} })");
+makeFuncAndCall("{var x, x3;try { return 0; } finally { return 3/0; } }");
+makeFuncExpectError("with(x ? 1e81 : (x2.constructor = 0.1)) {}", ReferenceError);
+makeFuncAndCall("while(x-=1) {var x=0; }");
+makeFuncAndCall("while((x-=false) && 0) { var x = this; }");
+makeFuncAndCall("/*infloop*/while(x4-=x) var x, x4 = x1;");
+makeFuncAndCall("/*infloop*/L:while(x+=null) { this;var x = /x/g ; }");
+makeFuncAndCall("while((x1|=0.1) && 0) { var x1 = -0, functional; }");
+makeFuncAndCall("with({}) return (eval(\"arguments\"));");
+
+evalExpectValue(<<CODE
+    var s = "(function() { return y })()";
+    (function() { 
+        with({ y:1 })
+            eval(s)
+    })();
+    (function() { 
+        with({ 
+            get y() { return "get"; }
+        }) 
+        return eval(s)
+    })();
+CODE, "get");
+
+// bug JDK-8047359
+// evalExpectValue("s = ' '; for (var i=0;i<31;++i) s+=s; s.length", RangeError);
+
+evalExpectValue(<<CODE
+    function f(o) {
+        var eval=0; 
+        with({
+            get eval() { return o.eval }
+        }) 
+        return eval("1+2");
+    } 
+    f(this);
+CODE, 3)
+
+evalExpectValue(<<CODE
+    function f() {
+        var a=1,e=2;
+        try { 
+            throw 3
+        } catch(e) {
+            return + function g(){return eval('a+e')}()
+        }
+    }
+    f();
+CODE, 4);
+
+//evalExpectValue(
+// "function f(){var a=1; with({get a(){return false}}) return a}; f()", false);
+
+evalExpectError("function public() {\"use strict\"}", SyntaxError);
+evalExpectError("function f(public) {\"use strict\"}", SyntaxError);
+evalExpectError("function f() { switch(x) {} } f()", ReferenceError);
+
+// bug JDK-8047364
+// makeFuncAndCall("L1:try { return } finally { break L1 }");
+
+evalExpectValue(<<CODE
+    function f() { 
+        function g() { return 0 }
+        function g() { return 1 } 
+        function g$1() { return 2 }
+        return g$1()
+    }
+
+    f();
+CODE, 2);
+
+evalExpectValue(<<CODE
+    function f() {
+        function g() {return 0 }
+        var h = function g() { return 1 };
+        function g$1() { return 2 }; 
+        return h()
+    }
+
+    f()
+CODE, 1);
+
+evalExpectValue(<<CODE
+    function f() {
+        var obj = { get ":"() {} }
+        var desc = Object.getOwnPropertyDescriptor(obj, ":")
+        return desc.get.name
+    }
+
+    f()
+CODE, ":");
+
+evalExpectValue(<<CODE
+    function f() {
+        var obj = { set ":"(a) {} };
+        var desc = Object.getOwnPropertyDescriptor(obj, ":");
+        return desc.set;
+    }
+
+    f()
+CODE, "set \":\"(a) {}");
+
+// bug JDK-8047366
+// evalExpectValue("(1000000000000000128).toString()", "1000000000000000100");
+// evalExpectValue("(1000000000000000128).toFixed().toString()", "1000000000000000128");
+
+try {
+    Function("-", { 
+        toString: function() {
+            throw "err"
+        }
+    })();
+} catch (e) {
+    if (e != "err") {
+        fail("Expected 'err' here, got " + e);
+    }
+}
+evalExpectError("function f() { switch(x) {} } f()", ReferenceError);
+Array.prototype.splice.call(Java.type("java.util.HashMap"))
+Array.prototype.slice.call(Java.type("java.util.HashMap"))
-- 
GitLab


From f301db3a9bdad6783256d0a1885c223b05a8aacb Mon Sep 17 00:00:00 2001
From: Mandy Chung <mchung@openjdk.org>
Date: Thu, 19 Jun 2014 13:12:08 -0700
Subject: [PATCH 119/192] 8047387: Generate different version of java.policy
 file for windows 32-bit and 64-bit

Reviewed-by: erikj, tbell
---
 jdk/make/CopyFiles.gmk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk
index c1fa0d4062b..396f2534317 100644
--- a/jdk/make/CopyFiles.gmk
+++ b/jdk/make/CopyFiles.gmk
@@ -373,7 +373,14 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
   POLICY_SRC_LIST += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/lib/security/java.policy
 endif
 ifndef OPENJDK
-  ifneq (, $(filter $(OPENJDK_TARGET_OS), windows solaris))
+  ifeq ($(OPENJDK_TARGET_OS), windows)
+    ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+      POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS)/lib/security/java.policy-win32
+    else
+      POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS)/lib/security/java.policy-win64
+    endif
+  endif
+  ifeq ($(OPENJDK_TARGET_OS), solaris)
     POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS)/lib/security/java.policy
   endif
 endif
-- 
GitLab


From cc269950dffd34d2b95b79669c0d02f3b7da252e Mon Sep 17 00:00:00 2001
From: Weijun Wang <weijun@openjdk.org>
Date: Fri, 20 Jun 2014 10:27:10 +0800
Subject: [PATCH 120/192] 8029994: Support "include" and "includedir" in
 krb5.conf

Reviewed-by: mullan
---
 .../classes/sun/security/krb5/Config.java     | 371 +++++++++++-------
 .../krb5/auto/HttpNegotiateServer.java        |   6 +
 .../sun/security/krb5/config/Duplicates.java  |  14 +-
 .../sun/security/krb5/config/Include.java     | 142 +++++++
 jdk/test/sun/security/krb5/config/k1.conf     |   4 +
 5 files changed, 385 insertions(+), 152 deletions(-)
 create mode 100644 jdk/test/sun/security/krb5/config/Include.java

diff --git a/jdk/src/share/classes/sun/security/krb5/Config.java b/jdk/src/share/classes/sun/security/krb5/Config.java
index f2f8754091c..7779cf0a4db 100644
--- a/jdk/src/share/classes/sun/security/krb5/Config.java
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java
@@ -31,10 +31,13 @@
 package sun.security.krb5;
 
 import java.io.File;
-import java.io.FileInputStream;
+import java.io.FilePermission;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.Path;
+import java.security.PrivilegedAction;
 import java.util.*;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -196,8 +199,11 @@ public class Config {
                 }
             }
         } catch (IOException ioe) {
-            // I/O error, mostly like krb5.conf missing.
-            // No problem. We'll use DNS or system property etc.
+            if (DEBUG) {
+                System.out.println("Exception thrown in loading config:");
+                ioe.printStackTrace(System.out);
+            }
+            throw new KrbException("krb5.conf loading failed");
         }
     }
 
@@ -206,7 +212,7 @@ public class Config {
      * @param keys the keys, as an array from section name, sub-section names
      * (if any), to value name.
      * @return the value. When there are multiple values for the same key,
-     * returns the last one. {@code null} is returned if not all the keys are
+     * returns the first one. {@code null} is returned if not all the keys are
      * defined. For example, {@code get("libdefaults", "forwardable")} will
      * return null if "forwardable" is not defined in [libdefaults], and
      * {@code get("realms", "R", "kdc")} will return null if "R" is not
@@ -223,7 +229,7 @@ public class Config {
     public String get(String... keys) {
         Vector<String> v = getString0(keys);
         if (v == null) return null;
-        return v.lastElement();
+        return v.firstElement();
     }
 
     /**
@@ -273,7 +279,7 @@ public class Config {
     }
 
     /**
-     * Returns true if keys exists, can be either final string(s) or sub-stanza
+     * Returns true if keys exists, can be final string(s) or a sub-section
      * @throws IllegalArgumentException if any of the keys is illegal
      *         (See {@link #get})
      */
@@ -291,9 +297,9 @@ public class Config {
         }
     }
 
-    // Internal method. Returns the value for keys, which can be a sub-stanza
-    // or final string value(s).
-    // The only method (except for toString) that reads stanzaTable directly.
+    // Internal method. Returns the value for keys, which can be a sub-section
+    // (as a Hashtable) or final string value(s) (as a Vector). This is the
+    // only method (except for toString) that reads stanzaTable directly.
     @SuppressWarnings("unchecked")
     private Object get0(String... keys) {
         Object current = stanzaTable;
@@ -453,142 +459,207 @@ public class Config {
     }
 
     /**
-     * Reads lines to the memory from the configuration file.
+     * Reads the lines of the configuration file. All include and includedir
+     * directives are resolved by calling this method recursively.
      *
-     * Configuration file contains information about the default realm,
-     * ticket parameters, location of the KDC and the admin server for
-     * known realms, etc. The file is divided into sections. Each section
-     * contains one or more name/value pairs with one pair per line. A
-     * typical file would be:
-     * <pre>
-     * [libdefaults]
-     *          default_realm = EXAMPLE.COM
-     *          default_tgs_enctypes = des-cbc-md5
-     *          default_tkt_enctypes = des-cbc-md5
-     * [realms]
-     *          EXAMPLE.COM = {
-     *                  kdc = kerberos.example.com
-     *                  kdc = kerberos-1.example.com
-     *                  admin_server = kerberos.example.com
-     *                  }
-     *          SAMPLE_COM = {
-     *                  kdc = orange.sample.com
-     *                  admin_server = orange.sample.com
-     *                  }
-     * [domain_realm]
-     *          blue.sample.com = TEST.SAMPLE.COM
-     *          .backup.com     = EXAMPLE.COM
-     * </pre>
-     * @return an ordered list of strings representing the config file after
-     * some initial processing, including:<ol>
-     * <li> Comment lines and empty lines are removed
-     * <li> "{" not at the end of a line is appended to the previous line
-     * <li> The content of a section is also placed between "{" and "}".
-     * <li> Lines are trimmed</ol>
+     * @param file the krb5.conf file, must be absolute
+     * @param content the lines. Comment and empty lines are removed,
+     *                all lines trimmed, include and includedir
+     *                directives resolved, unknown directives ignored
+     * @param dups a set of Paths to check for possible infinite loop
      * @throws IOException if there is an I/O error
-     * @throws KrbException if there is a file format error
+     */
+    private static Void readConfigFileLines(
+            Path file, List<String> content, Set<Path> dups)
+            throws IOException {
+
+        if (DEBUG) {
+            System.out.println("Loading krb5 profile at " + file);
+        }
+        if (!file.isAbsolute()) {
+            throw new IOException("Profile path not absolute");
+        }
+
+        if (!dups.add(file)) {
+            throw new IOException("Profile path included more than once");
+        }
+
+        List<String> lines = Files.readAllLines(file);
+
+        boolean inDirectives = true;
+        for (String line: lines) {
+            line = line.trim();
+            if (line.isEmpty() || line.startsWith("#")) {
+                continue;
+            }
+            if (inDirectives) {
+                if (line.charAt(0) == '[') {
+                    inDirectives = false;
+                    content.add(line);
+                } else if (line.startsWith("includedir ")) {
+                    Path dir = Paths.get(
+                            line.substring("includedir ".length()).trim());
+                    try (DirectoryStream<Path> files =
+                                 Files.newDirectoryStream(dir)) {
+                        for (Path p: files) {
+                            if (Files.isDirectory(p)) continue;
+                            String name = p.getFileName().toString();
+                            if (name.matches("[a-zA-Z0-9_-]+")) {
+                                // if dir is absolute, so is p
+                                readConfigFileLines(p, content, dups);
+                            }
+                        }
+                    }
+                } else if (line.startsWith("include ")) {
+                    readConfigFileLines(
+                            Paths.get(line.substring("include ".length()).trim()),
+                            content, dups);
+                } else {
+                    // Unsupported directives
+                    if (DEBUG) {
+                        System.out.println("Unknown directive: " + line);
+                    }
+                }
+            } else {
+                content.add(line);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Reads the configuration file and return normalized lines.
+     * If the original file is:
+     *
+     *     [realms]
+     *     EXAMPLE.COM =
+     *     {
+     *         kdc = kerberos.example.com
+     *         ...
+     *     }
+     *     ...
+     *
+     * The result will be (no indentations):
+     *
+     *     {
+     *         realms = {
+     *             EXAMPLE.COM = {
+     *                 kdc = kerberos.example.com
+     *                 ...
+     *             }
+     *         }
+     *         ...
+     *     }
+     *
+     * @param fileName the configuration file
+     * @return normalized lines
      */
     private List<String> loadConfigFile(final String fileName)
             throws IOException, KrbException {
+
+        List<String> result = new ArrayList<>();
+        List<String> raw = new ArrayList<>();
+        Set<Path> dupsCheck = new HashSet<>();
+
         try {
-            List<String> v = new ArrayList<>();
-            try (BufferedReader br = new BufferedReader(new InputStreamReader(
-                AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<FileInputStream> () {
-                        public FileInputStream run() throws IOException {
-                            return new FileInputStream(fileName);
-                        }
-                    })))) {
-                String line;
-                String previous = null;
-                while ((line = br.readLine()) != null) {
-                    line = line.trim();
-                    if (line.startsWith("#") || line.isEmpty()) {
-                        // ignore comments and blank line
-                        // Comments start with #.
-                        continue;
-                    }
-                    // In practice, a subsection might look like:
-                    //      [realms]
-                    //      EXAMPLE.COM =
-                    //      {
-                    //          kdc = kerberos.example.com
-                    //          ...
-                    //      }
-                    // Before parsed into stanza table, it needs to be
-                    // converted into a canonicalized style (no indent):
-                    //      realms = {
-                    //          EXAMPLE.COM = {
-                    //              kdc = kerberos.example.com
-                    //              ...
-                    //          }
-                    //      }
-                    //
-                    if (line.startsWith("[")) {
-                        if (!line.endsWith("]")) {
-                            throw new KrbException("Illegal config content:"
-                                    + line);
-                        }
-                        if (previous != null) {
-                            v.add(previous);
-                            v.add("}");
+            Path fullp = AccessController.doPrivileged((PrivilegedAction<Path>)
+                        () -> Paths.get(fileName).toAbsolutePath(),
+                    null,
+                    new PropertyPermission("user.dir", "read"));
+            AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Void>() {
+                        @Override
+                        public Void run() throws IOException {
+                            Path path = Paths.get(fileName);
+                            if (!Files.exists(path)) {
+                                // This is OK. There are other ways to get
+                                // Kerberos 5 settings
+                                return null;
+                            } else {
+                                return readConfigFileLines(
+                                        fullp, raw, dupsCheck);
+                            }
                         }
-                        String title = line.substring(
-                                1, line.length()-1).trim();
-                        if (title.isEmpty()) {
-                            throw new KrbException("Illegal config content:"
-                                    + line);
-                        }
-                        previous = title + " = {";
-                    } else if (line.startsWith("{")) {
-                        if (previous == null) {
-                            throw new KrbException(
-                                "Config file should not start with \"{\"");
-                        }
-                        previous += " {";
-                        if (line.length() > 1) {
-                            // { and content on the same line
-                            v.add(previous);
-                            previous = line.substring(1).trim();
-                        }
-                    } else {
-                        // Lines before the first section are ignored
-                        if (previous != null) {
-                            v.add(previous);
-                            previous = line;
-                        }
-                    }
+                    },
+                    null,
+                    // include/includedir can go anywhere
+                    new FilePermission("<<ALL FILES>>", "read"));
+        } catch (java.security.PrivilegedActionException pe) {
+            throw (IOException)pe.getException();
+        }
+        String previous = null;
+        for (String line: raw) {
+            if (line.startsWith("[")) {
+                if (!line.endsWith("]")) {
+                    throw new KrbException("Illegal config content:"
+                            + line);
                 }
                 if (previous != null) {
-                    v.add(previous);
-                    v.add("}");
+                    result.add(previous);
+                    result.add("}");
+                }
+                String title = line.substring(
+                        1, line.length()-1).trim();
+                if (title.isEmpty()) {
+                    throw new KrbException("Illegal config content:"
+                            + line);
+                }
+                previous = title + " = {";
+            } else if (line.startsWith("{")) {
+                if (previous == null) {
+                    throw new KrbException(
+                        "Config file should not start with \"{\"");
                 }
+                previous += " {";
+                if (line.length() > 1) {
+                    // { and content on the same line
+                    result.add(previous);
+                    previous = line.substring(1).trim();
+                }
+            } else {
+                if (previous == null) {
+                    // This won't happen, because before a section
+                    // all directives have been resolved
+                    throw new KrbException(
+                        "Config file must starts with a section");
+                }
+                result.add(previous);
+                previous = line;
             }
-            return v;
-        } catch (java.security.PrivilegedActionException pe) {
-            throw (IOException)pe.getException();
         }
+        if (previous != null) {
+            result.add(previous);
+            result.add("}");
+        }
+        return result;
     }
 
     /**
-     * Parses stanza names and values from configuration file to
-     * stanzaTable (Hashtable). Hashtable key would be stanza names,
-     * (libdefaults, realms, domain_realms, etc), and the hashtable value
-     * would be another hashtable which contains the key-value pairs under
-     * a stanza name. The value of this sub-hashtable can be another hashtable
-     * containing another sub-sub-section or a vector of strings for
-     * final values (even if there is only one value defined).
+     * Parses the input lines to a hashtable. The key would be section names
+     * (libdefaults, realms, domain_realms, etc), and the value would be
+     * another hashtable which contains the key-value pairs inside the section.
+     * The value of this sub-hashtable can be another hashtable containing
+     * another sub-sub-section or a non-empty vector of strings for final values
+     * (even if there is only one value defined).
+     * <p>
+     * For top-level sections with duplicates names, their contents are merged.
+     * For sub-sections the former overwrites the latter. For final values,
+     * they are stored in a vector in their appearing order. Please note these
+     * values must appear in the same sub-section. Otherwise, the sub-section
+     * appears first should have already overridden the others.
      * <p>
-     * For duplicates section names, the latter overwrites the former. For
-     * duplicate value names, the values are in a vector in its appearing order.
-     * </ol>
-     * Please note that this behavior is Java traditional. and it is
-     * not the same as the MIT krb5 behavior, where:<ol>
-     * <li>Duplicated root sections will be merged
-     * <li>For duplicated sub-sections, the former overwrites the latter
-     * <li>Duplicate keys for values are always saved in a vector
-     * </ol>
-     * @param v the strings in the file, never null, might be empty
+     * As a corner case, if the same name is used as both a section name and a
+     * value name, the first appearance decides the type. That is to say, if the
+     * first one is for a section, all latter appearances are ignored. If it's
+     * a value, latter appearances as sections are ignored, but those as values
+     * are added to the vector.
+     * <p>
+     * The behavior described above is compatible to other krb5 implementations
+     * but it's not decumented publicly anywhere. the best practice is not to
+     * assume any kind of override functionality and only specify values for
+     * a particular key in one place.
+     *
+     * @param v the normalized input as return by loadConfigFile
      * @throws KrbException if there is a file format error
      */
     @SuppressWarnings("unchecked")
@@ -596,7 +667,7 @@ public class Config {
             throws KrbException {
         Hashtable<String,Object> current = stanzaTable;
         for (String line: v) {
-            // There are 3 kinds of lines
+            // There are only 3 kinds of lines
             // 1. a = b
             // 2. a = {
             // 3. }
@@ -612,14 +683,25 @@ public class Config {
                     throw new KrbException("Illegal config content:" + line);
                 }
                 String key = line.substring(0, pos).trim();
-                String value = trimmed(line.substring(pos+1));
+                String value = unquote(line.substring(pos + 1));
                 if (value.equals("{")) {
                     Hashtable<String,Object> subTable;
                     if (current == stanzaTable) {
                         key = key.toLowerCase(Locale.US);
                     }
-                    subTable = new Hashtable<>();
-                    current.put(key, subTable);
+                    // When there are dup names for sections
+                    if (current.containsKey(key)) {
+                        if (current == stanzaTable) {   // top-level, merge
+                            // The value at top-level must be another Hashtable
+                            subTable = (Hashtable<String,Object>)current.get(key);
+                        } else {                        // otherwise, ignored
+                            // read and ignore it (do not put into current)
+                            subTable = new Hashtable<>();
+                        }
+                    } else {
+                        subTable = new Hashtable<>();
+                        current.put(key, subTable);
+                    }
                     // A special entry for its parent. Put whitespaces around,
                     // so will never be confused with a normal key
                     subTable.put(" PARENT ", current);
@@ -628,20 +710,19 @@ public class Config {
                     Vector<String> values;
                     if (current.containsKey(key)) {
                         Object obj = current.get(key);
-                        // If a key first shows as a section and then a value,
-                        // this is illegal. However, we haven't really forbid
-                        // first value then section, which the final result
-                        // is a section.
-                        if (!(obj instanceof Vector)) {
-                            throw new KrbException("Key " + key
-                                    + "used for both value and section");
+                        if (obj instanceof Vector) {
+                            // String values are merged
+                            values = (Vector<String>)obj;
+                            values.add(value);
+                        } else {
+                            // If a key shows as section first and then a value,
+                            // ignore the value.
                         }
-                        values = (Vector<String>)current.get(key);
                     } else {
                         values = new Vector<String>();
+                        values.add(value);
                         current.put(key, values);
                     }
-                    values.add(value);
                 }
             }
         }
@@ -764,7 +845,7 @@ public class Config {
         return "/etc/krb5.conf";
     }
 
-    private static String trimmed(String s) {
+    private static String unquote(String s) {
         s = s.trim();
         if (s.isEmpty()) return s;
         if (s.charAt(0) == '"' && s.charAt(s.length()-1) == '"' ||
diff --git a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java
index 3007454ef7b..fea76c829f9 100644
--- a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java
+++ b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java
@@ -55,6 +55,8 @@ import org.ietf.jgss.GSSCredential;
 import org.ietf.jgss.GSSManager;
 import sun.security.jgss.GSSUtil;
 import sun.security.krb5.Config;
+import sun.util.logging.PlatformLogger;
+
 import java.util.Base64;
 
 /**
@@ -148,6 +150,10 @@ public class HttpNegotiateServer {
     public static void main(String[] args)
             throws Exception {
 
+        String HTTPLOG = "sun.net.www.protocol.http.HttpURLConnection";
+        System.setProperty("sun.security.krb5.debug", "true");
+        PlatformLogger.getLogger(HTTPLOG).setLevel(PlatformLogger.Level.ALL);
+
         KDC kdcw = KDC.create(REALM_WEB);
         kdcw.addPrincipal(WEB_USER, WEB_PASS);
         kdcw.addPrincipalRandKey("krbtgt/" + REALM_WEB);
diff --git a/jdk/test/sun/security/krb5/config/Duplicates.java b/jdk/test/sun/security/krb5/config/Duplicates.java
index 0d8bac70c6d..41d0fa9b99d 100644
--- a/jdk/test/sun/security/krb5/config/Duplicates.java
+++ b/jdk/test/sun/security/krb5/config/Duplicates.java
@@ -38,22 +38,22 @@ public class Duplicates {
         config.listTable();
         String s;
 
-        // Latter overwrites former for root section
+        // root section merged
         s = config.get("libdefaults", "default_realm");
-        if (s != null) {
+        if (!s.equals("R1")) {
             throw new Exception();
         }
-        // Latter overwrites former for strings
+        // Former is preferred to latter for strings and sections
         s = config.get("libdefaults", "default_tkt_enctypes");
-        if (!s.equals("aes256-cts")) {
+        if (!s.equals("aes128-cts")) {
             throw new Exception();
         }
-        // Latter overwrites former for sub-section
         s = config.get("realms", "R1", "kdc");
-        if (!s.equals("k2")) {
+        if (!s.equals("k1")) {
             throw new Exception(s);
         }
-        // Duplicate keys in [realms] are merged
+        // Duplicate keys in [realms] are merged, and sections with the same
+        // name in between ignored
         s = config.getAll("realms", "R2", "kdc");
         if (!s.equals("k1 k2 k3 k4")) {
             throw new Exception(s);
diff --git a/jdk/test/sun/security/krb5/config/Include.java b/jdk/test/sun/security/krb5/config/Include.java
new file mode 100644
index 00000000000..945f8a0fc96
--- /dev/null
+++ b/jdk/test/sun/security/krb5/config/Include.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8029994
+ * @summary Support "include" and "includedir" in krb5.conf
+ * @compile -XDignore.symbol.file Include.java
+ * @run main/othervm Include
+ */
+import sun.security.krb5.Config;
+import sun.security.krb5.KrbException;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class Include {
+    public static void main(String[] args) throws Exception {
+
+        String krb5Conf = "[section]\nkey=";        // Skeleton of a section
+
+        Path conf = Paths.get("krb5.conf");         // base krb5.conf
+
+        Path ifile = Paths.get("f");                // include f
+        Path idir = Paths.get("x");                 // includedir fx
+        Path idirdir = Paths.get("x/xx");           // sub dir, will be ignored
+        Path idirdirfile = Paths.get("x/xx/ff");    // sub dir, will be ignored
+        Path idirfile1 = Paths.get("x/f1");         // one file
+        Path idirfile2 = Paths.get("x/f2");         // another file
+        Path idirfile3 = Paths.get("x/f.3");        // third file bad name
+
+        // OK: The base file can be missing
+        System.setProperty("java.security.krb5.conf", "no-such-file");
+        tryReload(true);
+
+        System.setProperty("java.security.krb5.conf", conf.toString());
+
+        // Write base file
+        Files.write(conf,
+                ("include " + ifile.toAbsolutePath() + "\n" +
+                        "includedir " + idir.toAbsolutePath() + "\n" +
+                        krb5Conf + "base").getBytes()
+        );
+
+        // Error: Neither include nor includedir exists
+        tryReload(false);
+
+        // Error: Only includedir exists
+        Files.createDirectory(idir);
+        tryReload(false);
+
+        // Error: Both exists, but include is a cycle
+        Files.write(ifile,
+                ("include " + conf.toAbsolutePath() + "\n" +
+                    krb5Conf + "incfile").getBytes());
+        tryReload(false);
+
+        // Error: A good include exists, but no includedir
+        Files.delete(idir);
+        Files.write(ifile, (krb5Conf + "incfile").getBytes());
+        tryReload(false);
+
+        // OK: Everything is set
+        Files.createDirectory(idir);
+        tryReload(true);   // Now OK
+
+        // fx1 and fx2 will be loaded
+        Files.write(idirfile1, (krb5Conf + "incdir1").getBytes());
+        Files.write(idirfile2, (krb5Conf + "incdir2").getBytes());
+        // fx3 and fxs (and file inside it) will be ignored
+        Files.write(idirfile3, (krb5Conf + "incdir3").getBytes());
+        Files.createDirectory(idirdir);
+        Files.write(idirdirfile, (krb5Conf + "incdirdir").getBytes());
+
+        // OK: All good files read
+        tryReload(true);
+
+        String v = Config.getInstance().getAll("section", "key");
+        // The order of files in includedir could be either
+        if (!v.equals("incfile incdir1 incdir2 base") &&
+                !v.equals("incfile incdir2 incdir1 base")) {
+            throw new Exception(v);
+        }
+
+        // Error: include file not absolute
+        Files.write(conf,
+                ("include " + ifile + "\n" +
+                        "includedir " + idir.toAbsolutePath() + "\n" +
+                        krb5Conf + "base").getBytes()
+        );
+        tryReload(false);
+
+        // Error: includedir not absolute
+        Files.write(conf,
+                ("include " + ifile.toAbsolutePath() + "\n" +
+                        "includedir " + idir + "\n" +
+                        krb5Conf + "base").getBytes()
+        );
+        tryReload(false);
+
+        // OK: unsupported directive
+        Files.write(conf,
+                ("module /lib/lib.so\n" +
+                        krb5Conf + "base").getBytes()
+        );
+        tryReload(true);
+    }
+
+    private static void tryReload(boolean expected) throws Exception {
+        if (expected) {
+            Config.refresh();
+        } else {
+            try {
+                Config.refresh();
+                throw new Exception("Should be illegal");
+            } catch (KrbException ke) {
+                // OK
+            }
+        }
+    }
+}
diff --git a/jdk/test/sun/security/krb5/config/k1.conf b/jdk/test/sun/security/krb5/config/k1.conf
index 76b8513e74d..a772e5e5894 100644
--- a/jdk/test/sun/security/krb5/config/k1.conf
+++ b/jdk/test/sun/security/krb5/config/k1.conf
@@ -9,11 +9,15 @@ default_tkt_enctypes = aes256-cts
 R1 = {
     kdc = k1
 }
+R1 = hello
 R1 = {
     kdc = k2
 }
 R2 = {
     kdc = k1
+    kdc = {
+        foo = bar
+    }
     kdc = k2 k3
     admin_server = a1
     kdc = k4
-- 
GitLab


From f4c68a9cfcd7408767c2c926e7166410f352189e Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Fri, 20 Jun 2014 12:25:00 +0200
Subject: [PATCH 121/192] 8046921: Deoptimization type information peristence

Reviewed-by: hannesw, lagergren
---
 nashorn/make/project.properties               |   1 +
 .../internal/codegen/CodeGenerator.java       |  36 +-
 .../internal/codegen/CompilationPhase.java    |   4 +-
 .../nashorn/internal/codegen/Compiler.java    |  32 +-
 .../codegen/OptimisticTypesPersistence.java   | 345 ++++++++++++++++++
 .../jdk/nashorn/internal/codegen/TypeMap.java |  15 +
 .../internal/runtime/CompiledFunction.java    |  10 +-
 .../RecompilableScriptFunctionData.java       |  69 +++-
 .../script/basic/JDK-8030182_2.js.EXPECTED    |   2 +-
 9 files changed, 484 insertions(+), 30 deletions(-)
 create mode 100644 nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java

diff --git a/nashorn/make/project.properties b/nashorn/make/project.properties
index eb708a41320..77f8ed73bf7 100644
--- a/nashorn/make/project.properties
+++ b/nashorn/make/project.properties
@@ -279,6 +279,7 @@ run.test.jvmargs.common=\
   -Dfile.encoding=UTF-8 \
   -Duser.language=${run.test.user.language} \
   -Duser.country=${run.test.user.country} \
+  -Dnashorn.typeInfo.cacheDir=${build.dir}${file.separator}test${file.separator}type_info_cache \
   ${jfr.args} \
   -XX:+HeapDumpOnOutOfMemoryError
 
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index 21b51b334c3..984440f39bf 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -145,6 +145,7 @@ import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.RecompilableScriptFunctionData;
 import jdk.nashorn.internal.runtime.RewriteException;
 import jdk.nashorn.internal.runtime.Scope;
+import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -1821,19 +1822,40 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
         method.storeCompilerConstant(ARGUMENTS);
     }
 
-    /**
-     * Should this code generator skip generating code for inner functions? If lazy compilation is on, or we're
-     * doing an on-demand ("just-in-time") compilation, then we aren't generating code for inner functions.
-     */
-    private boolean compileOutermostOnly() {
-        return compiler.isOnDemandCompilation() || compiler.getScriptEnvironment()._lazy_compilation;
+    private boolean skipFunction(final FunctionNode functionNode) {
+        final ScriptEnvironment env = compiler.getScriptEnvironment();
+        final boolean lazy = env._lazy_compilation;
+        final boolean onDemand = compiler.isOnDemandCompilation();
+
+        // If this is on-demand or lazy compilation, don't compile a nested (not topmost) function.
+        if((onDemand || lazy) && lc.getOutermostFunction() != functionNode) {
+            return true;
+        }
+
+        // If lazy compiling with optimistic types, don't compile the program eagerly either. It will soon be
+        // invalidated anyway. In presence of a class cache, this further means that an obsoleted program version
+        // lingers around. Also, currently loading previously persisted optimistic types information only works if
+        // we're on-demand compiling a function, so with this strategy the :program method can also have the warmup
+        // benefit of using previously persisted types.
+        // NOTE that this means the first compiled class will effectively just have a :createProgramFunction method, and
+        // the RecompilableScriptFunctionData (RSFD) object in its constants array. It won't even have the :program
+        // method. This is by design. It does mean that we're wasting one compiler execution (and we could minimize this
+        // by just running it up to scope depth calculation, which creates the RSFDs and then this limited codegen).
+        // We could emit an initial separate compile unit with the initial version of :program in it to better utilize
+        // the compilation pipeline, but that would need more invasive changes, as currently the assumption that
+        // :program is emitted into the first compilation unit of the function lives in many places.
+        if(!onDemand && lazy && env._optimistic_types && functionNode.isProgram()) {
+            return true;
+        }
+
+        return false;
     }
 
     @Override
     public boolean enterFunctionNode(final FunctionNode functionNode) {
         final int fnId = functionNode.getId();
 
-        if (compileOutermostOnly() && lc.getOutermostFunction() != functionNode) {
+        if (skipFunction(functionNode)) {
             // In case we are not generating code for the function, we must create or retrieve the function object and
             // load it on the stack here.
             newFunctionObject(functionNode, false);
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
index c415d0cec6d..85b805060cc 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
@@ -432,7 +432,9 @@ enum CompilationPhase {
             compiler.getLogger().fine("Starting bytecode generation for ", quote(fn.getName()), " - restOf=", phases.isRestOfCompilation());
             final CodeGenerator codegen = new CodeGenerator(compiler, phases.isRestOfCompilation() ? compiler.getContinuationEntryPoints() : null);
             try {
-                newFunctionNode = (FunctionNode)newFunctionNode.accept(codegen);
+                // Explicitly set BYTECODE_GENERATED here; it can not be set in case of skipping codegen for :program
+                // in the lazy + optimistic world. See CodeGenerator.skipFunction().
+                newFunctionNode = ((FunctionNode)newFunctionNode.accept(codegen)).setState(null, BYTECODE_GENERATED);
                 codegen.generateScopeCalls();
             } catch (final VerifyError e) {
                 if (senv._verify_code || senv._print_code) {
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
index 5c7757a1fa7..32888b0c2b0 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
@@ -45,11 +45,12 @@ import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
+import java.util.TreeMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
 import java.util.logging.Level;
-
 import jdk.internal.dynalink.support.NameCodec;
 import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
 import jdk.nashorn.internal.codegen.types.Type;
@@ -121,6 +122,15 @@ public final class Compiler implements Loggable {
      * that using whatever was at program point 17 as an int failed.
      */
     private final Map<Integer, Type> invalidatedProgramPoints;
+    /**
+     * The snapshot of invalidatedProgramPoints before the compilation. Used to compare it to invalidatedProgramPoints,
+     * and if the two are equal, not write the type information to a file.
+     */
+    private final Map<Integer, Type> invalidatedProgramPointsOnEntry;
+    /**
+     * Descriptor of the location where we write the type information after compilation.
+     */
+    private final Object typeInformationFile;
 
     /**
      * Compile unit name of first compile unit - this prefix will be used for all
@@ -317,7 +327,7 @@ public final class Compiler implements Loggable {
             final Source source,
             final String sourceURL,
             final boolean isStrict) {
-        this(context, env, installer, source, sourceURL, isStrict, false, null, null, null, null, null);
+        this(context, env, installer, source, sourceURL, isStrict, false, null, null, null, null, null, null);
     }
 
     /**
@@ -333,6 +343,7 @@ public final class Compiler implements Loggable {
      * @param compiledFunction         compiled function, if any
      * @param types                    parameter and return value type information, if any is known
      * @param invalidatedProgramPoints invalidated program points for recompilation
+     * @param typeInformationFile      descriptor of the location where type information is persisted
      * @param continuationEntryPoints  continuation entry points for restof method
      * @param runtimeScope             runtime scope for recompilation type lookup in {@code TypeEvaluator}
      */
@@ -347,6 +358,7 @@ public final class Compiler implements Loggable {
             final RecompilableScriptFunctionData compiledFunction,
             final TypeMap types,
             final Map<Integer, Type> invalidatedProgramPoints,
+            final Object typeInformationFile,
             final int[] continuationEntryPoints,
             final ScriptObject runtimeScope) {
         this.context                  = context;
@@ -363,11 +375,13 @@ public final class Compiler implements Loggable {
         this.compiledFunction         = compiledFunction;
         this.types                    = types;
         this.invalidatedProgramPoints = invalidatedProgramPoints == null ? new HashMap<Integer, Type>() : invalidatedProgramPoints;
+        this.typeInformationFile      = typeInformationFile;
         this.continuationEntryPoints  = continuationEntryPoints == null ? null: continuationEntryPoints.clone();
         this.typeEvaluator            = new TypeEvaluator(this, runtimeScope);
         this.firstCompileUnitName     = firstCompileUnitName();
         this.strict                   = isStrict;
 
+        this.invalidatedProgramPointsOnEntry = typeInformationFile == null ? null : new HashMap<>(this.invalidatedProgramPoints);
         this.optimistic = env._optimistic_types;
     }
 
@@ -457,6 +471,16 @@ public final class Compiler implements Loggable {
         invalidatedProgramPoints.put(programPoint, type);
     }
 
+
+    /**
+     * Returns a copy of this compiler's current mapping of invalidated optimistic program points to their types. The
+     * copy is not live with regard to changes in state in this compiler instance, and is mutable.
+     * @return a copy of this compiler's current mapping of invalidated optimistic program points to their types.
+     */
+    public Map<Integer, Type> getInvalidatedProgramPoints() {
+        return invalidatedProgramPoints == null ? null : new TreeMap<>(invalidatedProgramPoints);
+    }
+
     TypeMap getTypeMap() {
         return types;
     }
@@ -513,6 +537,10 @@ public final class Compiler implements Loggable {
             time += (env.isTimingEnabled() ? phase.getEndTime() - phase.getStartTime() : 0L);
         }
 
+        if(typeInformationFile != null && !phases.isRestOfCompilation() && !Objects.equals(invalidatedProgramPoints, invalidatedProgramPointsOnEntry)) {
+            OptimisticTypesPersistence.store(typeInformationFile, invalidatedProgramPoints);
+        }
+
         log.unindent();
 
         if (info) {
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
new file mode 100644
index 00000000000..317a3cf4f60
--- /dev/null
+++ b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.internal.codegen;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.MessageDigest;
+import java.security.PrivilegedAction;
+import java.sql.Date;
+import java.text.SimpleDateFormat;
+import java.util.Base64;
+import java.util.Map;
+import java.util.TreeMap;
+import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.RecompilableScriptFunctionData;
+import jdk.nashorn.internal.runtime.Source;
+import jdk.nashorn.internal.runtime.logging.DebugLogger;
+import jdk.nashorn.internal.runtime.options.Options;
+
+/**
+ * Static utility that encapsulates persistence of decompilation information for functions. Normally, the type info
+ * persistence feature is enabled and operates in an operating-system specific per-user cache directory. You can
+ * override the directory by specifying it in the {@code nashorn.typeInfo.cacheDir} directory. Also, you can disable the
+ * type info persistence altogether by specifying the {@code nashorn.typeInfo.disabled} system property.
+ */
+public final class OptimisticTypesPersistence {
+    private static final File cacheDir = createCacheDir();
+    // In-process locks to make sure we don't have a cross-thread race condition manipulating any file.
+    private static final Object[] locks = cacheDir == null ? null : createLockArray();
+
+    // Only report one read/write error every minute
+    private static final long ERROR_REPORT_THRESHOLD = 60000L;
+
+    private static volatile long lastReportedError;
+
+    /**
+     * Retrieves an opaque descriptor for the persistence location for a given function. It should be passed to
+     * {@link #load(Object)} and {@link #store(Object, Map)} methods.
+     * @param source the source where the function comes from
+     * @param functionId the unique ID number of the function within the source
+     * @param paramTypes the types of the function parameters (as persistence is per parameter type specialization).
+     * @return an opaque descriptor for the persistence location. Can be null if persistence is disabled.
+     */
+    public static Object getLocationDescriptor(final Source source, final int functionId, final Type[] paramTypes) {
+        if(cacheDir == null) {
+            return null;
+        }
+        final StringBuilder b = new StringBuilder(48);
+        // Base64-encode the digest of the source, and append the function id.
+        b.append(Base64.getUrlEncoder().encodeToString(source.getDigest())).append('-').append(functionId);
+        // Finally, if this is a parameter-type specialized version of the function, add the parameter types to the file
+        // name.
+        if(paramTypes != null && paramTypes.length > 0) {
+            b.append('-');
+            for(final Type t: paramTypes) {
+                b.append(t.getBytecodeStackType());
+            }
+        }
+        return new LocationDescriptor(new File(cacheDir, b.toString()));
+    }
+
+    private static final class LocationDescriptor {
+        private final File file;
+
+        LocationDescriptor(final File file) {
+            this.file = file;
+        }
+    }
+
+
+    /**
+     * Stores the map of optimistic types for a given function.
+     * @param locationDescriptor the opaque persistence location descriptor, retrieved by calling
+     * {@link #getLocationDescriptor(Source, int, Type[])}.
+     * @param optimisticTypes the map of optimistic types.
+     */
+    @SuppressWarnings("resource")
+    public static void store(final Object locationDescriptor, final Map<Integer, Type> optimisticTypes) {
+        if(locationDescriptor == null) {
+            return;
+        }
+        final File file = ((LocationDescriptor)locationDescriptor).file;
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                synchronized(getFileLock(file)) {
+                    try (final FileOutputStream out = new FileOutputStream(file);) {
+                        out.getChannel().lock(); // lock exclusive
+                        final DataOutputStream dout = new DataOutputStream(new BufferedOutputStream(out));
+                        dout.writeInt(optimisticTypes.size());
+                        for(Map.Entry<Integer, Type> e: optimisticTypes.entrySet()) {
+                            dout.writeInt(e.getKey());
+                            final byte typeChar;
+                            final Type type = e.getValue();
+                            if(type == Type.OBJECT) {
+                                typeChar = 'L';
+                            } else if(type == Type.NUMBER) {
+                                typeChar = 'D';
+                            } else if(type == Type.LONG) {
+                                typeChar = 'J';
+                            } else {
+                                throw new AssertionError();
+                            }
+                            dout.write(typeChar);
+                        }
+                        dout.flush();
+                    } catch(final Exception e) {
+                        final long now = System.currentTimeMillis();
+                        if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
+                            getLogger().warning("Failed to write " + file, e);
+                            lastReportedError = now;
+                        }
+                    }
+                }
+                return null;
+            }
+        });
+    }
+
+    /**
+     * Loads the map of optimistic types for a given function.
+     * @param locationDescriptor the opaque persistence location descriptor, retrieved by calling
+     * {@link #getLocationDescriptor(Source, int, Type[])}.
+     * @return the map of optimistic types, or null if persisted type information could not be retrieved.
+     */
+    @SuppressWarnings("resource")
+    public static Map<Integer, Type> load(final Object locationDescriptor) {
+        if (locationDescriptor == null) {
+            return null;
+        }
+        final File file = ((LocationDescriptor)locationDescriptor).file;
+
+        return AccessController.doPrivileged(new PrivilegedAction<Map<Integer, Type>>() {
+            @Override
+            public Map<Integer, Type> run() {
+                try {
+                    if(!file.isFile()) {
+                        return null;
+                    }
+                    synchronized(getFileLock(file)) {
+                        try (final FileInputStream in = new FileInputStream(file);) {
+                            in.getChannel().lock(0, Long.MAX_VALUE, true); // lock shared
+                            final DataInputStream din = new DataInputStream(new BufferedInputStream(in));
+                            final Map<Integer, Type> map = new TreeMap<>();
+                            final int size = din.readInt();
+                            for(int i = 0; i < size; ++i) {
+                                final int pp = din.readInt();
+                                final int typeChar = din.read();
+                                final Type type;
+                                switch(typeChar) {
+                                case 'L': type = Type.OBJECT; break;
+                                case 'D': type = Type.NUMBER; break;
+                                case 'J': type = Type.LONG; break;
+                                default: throw new AssertionError();
+                                }
+                                map.put(pp, type);
+                            }
+                            return map;
+                        }
+                    }
+                } catch (final Exception e) {
+                    final long now = System.currentTimeMillis();
+                    if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
+                        getLogger().warning("Failed to read " + file, e);
+                        lastReportedError = now;
+                    }
+                    return null;
+                }
+            }
+        });
+    }
+
+    private static File createCacheDir() {
+        if(Options.getBooleanProperty("nashorn.typeInfo.disabled")) {
+            return null;
+        }
+        try {
+            return createCacheDirPrivileged();
+        } catch(final Exception e) {
+            getLogger().warning("Failed to create cache dir", e);
+            return null;
+        }
+    }
+
+    private static File createCacheDirPrivileged() {
+        return AccessController.doPrivileged(new PrivilegedAction<File>() {
+            @Override
+            public File run() {
+                final String explicitDir = System.getProperty("nashorn.typeInfo.cacheDir");
+                final File dir;
+                if(explicitDir != null) {
+                    dir = new File(explicitDir);
+                } else {
+                    // When no directory is explicitly specified, get an operating system specific cache directory,
+                    // and create "com.oracle.java.NashornTypeInfo" in it.
+                    dir = new File(getCacheDirBase(), "com.oracle.java.NashornTypeInfo");
+                }
+                final String versionDirName;
+                try {
+                    versionDirName = getVersionDirName();
+                } catch(Exception e) {
+                    getLogger().warning("Failed to calculate version dir name", e);
+                    return null;
+                }
+                final File versionDir = new File(dir, versionDirName);
+                versionDir.mkdirs();
+                if(versionDir.isDirectory()) {
+                    getLogger().info("Optimistic type persistence directory is " + versionDir);
+                    return versionDir;
+                }
+                getLogger().warning("Could not create optimistic type persistence directory " + versionDir);
+                return null;
+            }
+        });
+    }
+
+    /**
+     * Returns an operating system specific root directory for cache files.
+     * @return an operating system specific root directory for cache files.
+     */
+    private static File getCacheDirBase() {
+        final String os = System.getProperty("os.name", "generic");
+        if("Mac OS X".equals(os)) {
+            // Mac OS X stores caches in ~/Library/Caches
+            return new File(new File(System.getProperty("user.home"), "Library"), "Caches");
+        } else if(os.startsWith("Windows")) {
+            // On Windows, temp directory is the best approximation of a cache directory, as its contents persist across
+            // reboots and various cleanup utilities know about it. java.io.tmpdir normally points to a user-specific
+            // temp directory, %HOME%\LocalSettings\Temp.
+            return new File(System.getProperty("java.io.tmpdir"));
+        } else {
+            // In all other cases we're presumably dealing with a UNIX flavor (Linux, Solaris, etc.); "~/.cache"
+            return new File(System.getProperty("user.home"), ".cache");
+        }
+    }
+
+    /**
+     * In order to ensure that changes in Nashorn code don't cause corruption in the data, we'll create a
+     * per-code-version directory. Normally, this will create the SHA-1 digest of the nashorn.jar. In case the classpath
+     * for nashorn is local directory (e.g. during development), this will create the string "dev-" followed by the
+     * timestamp of the most recent .class file.
+     * @return
+     */
+    private static String getVersionDirName() throws Exception {
+        final URL url = OptimisticTypesPersistence.class.getResource("");
+        final String protocol = url.getProtocol();
+        if(protocol.equals("jar")) {
+            // Normal deployment: nashorn.jar
+            final String jarUrlFile = url.getFile();
+            final String filePath = jarUrlFile.substring(0, jarUrlFile.indexOf('!'));
+            final URL file = new URL(filePath);
+            try (final InputStream in = file.openStream()) {
+                final byte[] buf = new byte[128*1024];
+                final MessageDigest digest = MessageDigest.getInstance("SHA-1");
+                for(;;) {
+                    final int l = in.read(buf);
+                    if(l == -1) {
+                        return Base64.getUrlEncoder().encodeToString(digest.digest());
+                    }
+                    digest.update(buf, 0, l);
+                }
+            }
+        } else if(protocol.equals("file")) {
+            // Development
+            final String fileStr = url.getFile();
+            final String className = OptimisticTypesPersistence.class.getName();
+            final int packageNameLen = className.lastIndexOf('.');
+            final String dirStr = fileStr.substring(0, fileStr.length() - packageNameLen - 1);
+            final File dir = new File(dirStr);
+            return "dev-" + new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date(getLastModifiedClassFile(dir, 0L)));
+        } else {
+            throw new AssertionError();
+        }
+    }
+
+    private static long getLastModifiedClassFile(final File dir, final long max) {
+        long currentMax = max;
+        for(File f: dir.listFiles()) {
+            if(f.getName().endsWith(".class")) {
+                final long lastModified = f.lastModified();
+                if(lastModified > currentMax) {
+                    currentMax = lastModified;
+                }
+            } else if(f.isDirectory()) {
+                final long lastModified = getLastModifiedClassFile(f, currentMax);
+                if(lastModified > currentMax) {
+                    currentMax = lastModified;
+                }
+            }
+        }
+        return currentMax;
+    }
+
+    private static Object[] createLockArray() {
+        final Object[] lockArray = new Object[Runtime.getRuntime().availableProcessors() * 2];
+        for(int i = 0; i < lockArray.length; ++i) {
+            lockArray[i] = new Object();
+        }
+        return lockArray;
+    }
+
+    private static Object getFileLock(final File file) {
+        return locks[(file.hashCode() & Integer.MAX_VALUE) % locks.length];
+    }
+
+    private static DebugLogger getLogger() {
+        try {
+            return Context.getContext().getLogger(RecompilableScriptFunctionData.class);
+        } catch (final Exception e) {
+            e.printStackTrace();
+            return DebugLogger.DISABLED_LOGGER;
+        }
+    }
+}
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/TypeMap.java b/nashorn/src/jdk/nashorn/internal/codegen/TypeMap.java
index eb337f55245..11efce1a3db 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/TypeMap.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/TypeMap.java
@@ -29,6 +29,7 @@ import java.lang.invoke.MethodType;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -61,6 +62,20 @@ public class TypeMap {
         this.needsCallee = needsCallee;
     }
 
+    /**
+     * Returns the array of parameter types for a particular function node
+     * @param functionNodeId the ID of the function node
+     * @return an array of parameter types
+     * @throws NoSuchElementException if the type map has no mapping for the requested function
+     */
+    public Type[] getParameterTypes(final int functionNodeId) {
+        final Type[] paramTypes = paramTypeMap.get(functionNodeId);
+        if (paramTypes == null) {
+            throw new NoSuchElementException(Integer.toString(functionNodeId));
+        }
+        return paramTypes.clone();
+    }
+
     MethodType getCallSiteType(final FunctionNode functionNode) {
         final Type[] types = paramTypeMap.get(functionNode.getId());
         if (types == null) {
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java b/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java
index 6c1ca1ec757..87e32fc6508 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java
@@ -89,11 +89,12 @@ final class CompiledFunction {
         this.log = log;
     }
 
-    CompiledFunction(final MethodHandle invoker, final RecompilableScriptFunctionData functionData, final int flags) {
+    CompiledFunction(final MethodHandle invoker, final RecompilableScriptFunctionData functionData,
+            final Map<Integer, Type> invalidatedProgramPoints, final int flags) {
         this(invoker, null, functionData.getLogger());
         this.flags = flags;
         if ((flags & FunctionNode.IS_DEOPTIMIZABLE) != 0) {
-            optimismInfo = new OptimismInfo(functionData);
+            optimismInfo = new OptimismInfo(functionData, invalidatedProgramPoints);
         } else {
             optimismInfo = null;
         }
@@ -691,13 +692,14 @@ final class CompiledFunction {
     private static class OptimismInfo {
         // TODO: this is pointing to its owning ScriptFunctionData. Re-evaluate if that's okay.
         private final RecompilableScriptFunctionData data;
-        private final Map<Integer, Type> invalidatedProgramPoints = new TreeMap<>();
+        private final Map<Integer, Type> invalidatedProgramPoints;
         private SwitchPoint optimisticAssumptions;
         private final DebugLogger log;
 
-        OptimismInfo(final RecompilableScriptFunctionData data) {
+        OptimismInfo(final RecompilableScriptFunctionData data, final Map<Integer, Type> invalidatedProgramPoints) {
             this.data = data;
             this.log  = data.getLogger();
+            this.invalidatedProgramPoints = invalidatedProgramPoints == null ? new TreeMap<Integer, Type>() : invalidatedProgramPoints;
             newOptimisticAssumptions();
         }
 
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
index 78ee06e58ce..b2c0ed6b57f 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
@@ -36,12 +36,14 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
 import jdk.internal.dynalink.support.NameCodec;
 import jdk.nashorn.internal.codegen.CompileUnit;
 import jdk.nashorn.internal.codegen.Compiler;
 import jdk.nashorn.internal.codegen.Compiler.CompilationPhases;
 import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.FunctionSignature;
+import jdk.nashorn.internal.codegen.OptimisticTypesPersistence;
 import jdk.nashorn.internal.codegen.TypeMap;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.FunctionNode;
@@ -390,7 +392,11 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
         return getCompiler(fn, actualCallSiteType, newLocals(runtimeScope), null, null);
     }
 
-    Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType, final ScriptObject runtimeScope, final Map<Integer, Type> ipp, final int[] cep) {
+    Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
+            final ScriptObject runtimeScope, final Map<Integer, Type> invalidatedProgramPoints,
+            final int[] continuationEntryPoints) {
+        final TypeMap typeMap = typeMap(actualCallSiteType);
+        final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, typeMap == null ? null : typeMap.getParameterTypes(functionNodeId));
         final Context context = Context.getContextTrusted();
         return new Compiler(
                 context,
@@ -402,12 +408,31 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
                 true,       // is on demand
                 this,       // compiledFunction, i.e. this RecompilableScriptFunctionData
                 typeMap(actualCallSiteType), // type map
-                ipp, // invalidated program points
-                cep, // continuation entry points
+                getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
+                typeInformationFile,
+                continuationEntryPoints, // continuation entry points
                 runtimeScope); // runtime scope
     }
 
-    private FunctionNode compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope) {
+    /**
+     * If the function being compiled already has its own invalidated program points map, use it. Otherwise, attempt to
+     * load invalidated program points map from the persistent type info cache.
+     * @param invalidatedProgramPoints the function's current invalidated program points map. Null if the function
+     * doesn't have it.
+     * @param typeInformationFile the object describing the location of the persisted type information.
+     * @return either the existing map, or a loaded map from the persistent type info cache, or a new empty map if
+     * neither an existing map or a persistent cached type info is available.
+     */
+    private static Map<Integer, Type> getEffectiveInvalidatedProgramPoints(
+            final Map<Integer, Type> invalidatedProgramPoints, final Object typeInformationFile) {
+        if(invalidatedProgramPoints != null) {
+            return invalidatedProgramPoints;
+        }
+        final Map<Integer, Type> loadedProgramPoints = OptimisticTypesPersistence.load(typeInformationFile);
+        return loadedProgramPoints != null ? loadedProgramPoints : new TreeMap<Integer, Type>();
+    }
+
+    private TypeSpecializedFunction compileTypeSpecialization(final MethodType actualCallSiteType, final ScriptObject runtimeScope) {
         // We're creating an empty script object for holding local variables. AssignSymbols will populate it with
         // explicit Undefined values for undefined local variables (see AssignSymbols#defineSymbol() and
         // CompilationEnvironment#declareLocalSymbol()).
@@ -417,7 +442,20 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
         }
 
         final FunctionNode fn = reparse();
-        return getCompiler(fn, actualCallSiteType, runtimeScope).compile(fn, CompilationPhases.COMPILE_ALL);
+        final Compiler compiler = getCompiler(fn, actualCallSiteType, runtimeScope);
+
+        final FunctionNode compiledFn = compiler.compile(fn, CompilationPhases.COMPILE_ALL);
+        return new TypeSpecializedFunction(compiledFn, compiler.getInvalidatedProgramPoints());
+    }
+
+    private static class TypeSpecializedFunction {
+        private final FunctionNode fn;
+        private final Map<Integer, Type> invalidatedProgramPoints;
+
+        TypeSpecializedFunction(final FunctionNode fn, final Map<Integer, Type> invalidatedProgramPoints) {
+            this.fn = fn;
+            this.invalidatedProgramPoints = invalidatedProgramPoints;
+        }
     }
 
     private MethodType explicitParams(final MethodType callSiteType) {
@@ -494,14 +532,14 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
         methodLocator = new MethodLocator(functionNode);
     }
 
-    private CompiledFunction addCode(final MethodHandle target, final int fnFlags) {
-        final CompiledFunction cfn = new CompiledFunction(target, this, fnFlags);
+    private CompiledFunction addCode(final MethodHandle target, final Map<Integer, Type> invalidatedProgramPoints, final int fnFlags) {
+        final CompiledFunction cfn = new CompiledFunction(target, this, invalidatedProgramPoints, fnFlags);
         code.add(cfn);
         return cfn;
     }
 
     private CompiledFunction addCode(final FunctionNode fn) {
-        return addCode(lookup(fn), fn.getFlags());
+        return addCode(lookup(fn), null, fn.getFlags());
     }
 
     /**
@@ -510,11 +548,12 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
      * up getting one that takes a "double" etc. because of internal function logic causes widening (e.g. assignment of
      * a wider value to the parameter variable). However, we use the method handle type for matching subsequent lookups
      * for the same specialization, so we must adapt the handle to the expected type.
-     * @param fn the function
+     * @param tfn the function
      * @param callSiteType the call site type
      * @return the compiled function object, with its type matching that of the call site type.
      */
-    private CompiledFunction addCode(final FunctionNode fn, final MethodType callSiteType) {
+    private CompiledFunction addCode(final TypeSpecializedFunction tfn, final MethodType callSiteType) {
+        final FunctionNode fn = tfn.fn;
         if (fn.isVarArg()) {
             return addCode(fn);
         }
@@ -544,7 +583,7 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
             toType = toType.dropParameterTypes(fromCount, toCount);
         }
 
-        return addCode(lookup(fn).asType(toType), fn.getFlags());
+        return addCode(lookup(fn).asType(toType), tfn.invalidatedProgramPoints, fn.getFlags());
     }
 
 
@@ -555,7 +594,7 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
             if (existingBest == null) {
                 if(code.isEmpty() && methodLocator != null) {
                     // This is a deserialized object, reconnect from method handle
-                    existingBest = addCode(methodLocator.getMethodHandle(), methodLocator.getFunctionFlags());
+                    existingBest = addCode(methodLocator.getMethodHandle(), null, methodLocator.getFunctionFlags());
                 } else {
                     existingBest = addCode(compileTypeSpecialization(callSiteType, runtimeScope), callSiteType);
                 }
@@ -576,9 +615,9 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
             }
 
             if (applyToCall) {
-                final FunctionNode fn = compileTypeSpecialization(callSiteType, runtimeScope);
-                if (fn.hasOptimisticApplyToCall()) { //did the specialization work
-                    existingBest = addCode(fn, callSiteType);
+                final TypeSpecializedFunction tfn = compileTypeSpecialization(callSiteType, runtimeScope);
+                if (tfn.fn.hasOptimisticApplyToCall()) { //did the specialization work
+                    existingBest = addCode(tfn, callSiteType);
                 }
             }
 
diff --git a/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED b/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED
index 772e504d917..090bd1f1ab2 100644
--- a/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED
@@ -1,3 +1,3 @@
 ReferenceError: "g" is not defined
-	at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@0:-1)
+	at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@1:-1)
 	at <program> (test/script/basic/JDK-8030182_2.js:42)
-- 
GitLab


From cbef61567d4034ef45ee620aee49e34c7398b931 Mon Sep 17 00:00:00 2001
From: Dmitriy Ermashov <dmitriy.ermashov@oracle.com>
Date: Fri, 20 Jun 2014 16:48:30 +0400
Subject: [PATCH 122/192] 8047180: Move functional tests AWT_Headless/Automated
 to OpenJDK repository

Reviewed-by: pchelko, alexsch
---
 .../HeadlessAlphaComposite.java               |  63 ++++
 jdk/test/java/awt/Color/HeadlessColor.java    | 225 ++++++++++++
 .../Component/Headless/HeadlessButton.java    |  57 +++
 .../Component/Headless/HeadlessCanvas.java    |  37 ++
 .../Component/Headless/HeadlessCheckbox.java  | 110 ++++++
 .../Component/Headless/HeadlessChoice.java    |  44 +++
 .../Component/Headless/HeadlessComponent.java | 199 +++++++++++
 .../Component/Headless/HeadlessContainer.java | 216 ++++++++++++
 .../Component/Headless/HeadlessDialog.java    |  92 +++++
 .../Headless/HeadlessFileDialog.java          |  72 ++++
 .../awt/Component/Headless/HeadlessFrame.java |  55 +++
 .../awt/Component/Headless/HeadlessLabel.java |  64 ++++
 .../awt/Component/Headless/HeadlessList.java  | 100 ++++++
 .../awt/Component/Headless/HeadlessPanel.java | 218 ++++++++++++
 .../Headless/HeadlessScrollPane.java          |  72 ++++
 .../Component/Headless/HeadlessScrollbar.java |  82 +++++
 .../Component/Headless/HeadlessTextArea.java  | 108 ++++++
 .../Component/Headless/HeadlessTextField.java |  88 +++++
 .../Component/Headless/HeadlessWindow.java    |  43 +++
 jdk/test/java/awt/Cursor/HeadlessCursor.java  |  93 +++++
 .../awt/EventQueue/HeadlessEventQueue.java    |  37 ++
 ...essContainerOrderFocusTraversalPolicy.java |  66 ++++
 .../HeadlessDefaultFocusTraversalPolicy.java  |  67 ++++
 .../HeadlessDefaultKeyboardFocusManager.java  |  37 ++
 jdk/test/java/awt/FontClass/HeadlessFont.java | 239 +++++++++++++
 .../GradientPaint/HeadlessGradientPaint.java  |  51 +++
 .../Graphics2D/Headless/HeadlessPoint.java    |  44 +++
 .../Graphics2D/Headless/HeadlessPolygon.java  |  37 ++
 .../Headless/HeadlessRectangle.java           |  70 ++++
 .../HeadlessGraphicsConfiguration.java        |  53 +++
 .../HeadlessGraphicsDevice.java               |  50 +++
 .../HeadlessGraphicsEnvironment.java          |  76 ++++
 .../Headless/HeadlessAWTEventMulticaster.java | 247 +++++++++++++
 .../awt/Headless/HeadlessAWTException.java    |  37 ++
 .../awt/Headless/HeadlessBasicStroke.java     | 151 ++++++++
 .../awt/Headless/HeadlessBorderLayout.java    |  62 ++++
 .../java/awt/Headless/HeadlessCardLayout.java |  44 +++
 .../awt/Headless/HeadlessCheckboxGroup.java   |  38 ++
 .../Headless/HeadlessCheckboxMenuItem.java    |  75 ++++
 .../HeadlessComponentOrientation.java         |  46 +++
 .../java/awt/Headless/HeadlessDimension.java  |  59 ++++
 .../java/awt/Headless/HeadlessFlowLayout.java |  42 +++
 .../awt/Headless/HeadlessMediaTracker.java    |  37 ++
 .../java/awt/Headless/HeadlessPopupMenu.java  |  53 +++
 jdk/test/java/awt/Insets/HeadlessInsets.java  |  37 ++
 .../java/awt/Menu/Headless/HeadlessMenu.java  |  72 ++++
 .../awt/Menu/Headless/HeadlessMenuItem.java   |  67 ++++
 .../Menu/Headless/HeadlessMenuShortcut.java   |  41 +++
 .../java/awt/MenuBar/HeadlessMenuBar.java     |  44 +++
 .../awt/Toolkit/Headless/HeadlessToolkit.java | 329 ++++++++++++++++++
 .../awt/applet/Applet/HeadlessApplet.java     |  49 +++
 .../Headless/HeadlessClipboard.java           |  38 ++
 .../Headless/HeadlessDataFlavor.java          |  43 +++
 .../Headless/HeadlessSystemFlavorMap.java     |  38 ++
 .../awt/im/Headless/HeadlessInputContext.java |  43 +++
 .../HeadlessInputMethodHighlight.java         |  41 +++
 .../Headless/HeadlessAffineTransformOp.java   |  44 +++
 .../HeadlessAreaAveragingScaleFilter.java     |  37 ++
 .../image/Headless/HeadlessBufferedImage.java |  80 +++++
 .../Headless/HeadlessBufferedImageFilter.java |  38 ++
 .../image/Headless/HeadlessColorModel.java    |  61 ++++
 .../Headless/HeadlessCropImageFilter.java     |  37 ++
 .../image/Headless/HeadlessImageFilter.java   |  37 ++
 .../Headless/HeadlessIndexColorModel.java     |  54 +++
 .../Headless/HeadlessRGBImageFilter.java      |  42 +++
 .../HeadlessReplicateScaleFilter.java         |  37 ++
 .../java/awt/print/Headless/HeadlessBook.java |  37 ++
 .../print/Headless/HeadlessPageFormat.java    |  61 ++++
 .../awt/print/Headless/HeadlessPaper.java     |  46 +++
 .../print/Headless/HeadlessPrinterJob.java    | 179 ++++++++++
 .../HeadlessAbstractSpinnerModel.java         |  46 +++
 .../javax/swing/Headless/HeadlessBox.java     | 221 ++++++++++++
 .../swing/Headless/HeadlessBox_Filler.java    | 194 +++++++++++
 .../Headless/HeadlessCellRendererPane.java    | 202 +++++++++++
 .../HeadlessDefaultListCellRenderer.java      | 198 +++++++++++
 ...essDefaultListCellRenderer_UIResource.java | 198 +++++++++++
 .../swing/Headless/HeadlessGrayFilter.java    |  37 ++
 .../javax/swing/Headless/HeadlessJApplet.java |  44 +++
 .../javax/swing/Headless/HeadlessJButton.java | 192 ++++++++++
 .../swing/Headless/HeadlessJCheckBox.java     | 195 +++++++++++
 .../Headless/HeadlessJCheckBoxMenuItem.java   | 192 ++++++++++
 .../swing/Headless/HeadlessJColorChooser.java | 192 ++++++++++
 .../swing/Headless/HeadlessJComboBox.java     | 192 ++++++++++
 .../swing/Headless/HeadlessJComponent.java    | 191 ++++++++++
 .../swing/Headless/HeadlessJDesktopPane.java  | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJDialog.java | 100 ++++++
 .../swing/Headless/HeadlessJEditorPane.java   | 194 +++++++++++
 .../swing/Headless/HeadlessJFileChooser.java  | 191 ++++++++++
 .../Headless/HeadlessJFormattedTextField.java |  41 +++
 .../javax/swing/Headless/HeadlessJFrame.java  |  53 +++
 .../Headless/HeadlessJInternalFrame.java      | 214 ++++++++++++
 .../HeadlessJInternalFrame_JDesktopIcon.java  | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJLabel.java  | 191 ++++++++++
 .../swing/Headless/HeadlessJLayeredPane.java  | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJList.java   | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJMenu.java   | 189 ++++++++++
 .../swing/Headless/HeadlessJMenuBar.java      | 191 ++++++++++
 .../swing/Headless/HeadlessJMenuItem.java     | 191 ++++++++++
 .../swing/Headless/HeadlessJOptionPane.java   | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJPanel.java  | 191 ++++++++++
 .../Headless/HeadlessJPasswordField.java      |  40 +++
 .../swing/Headless/HeadlessJPopupMenu.java    | 189 ++++++++++
 .../HeadlessJPopupMenu_Separator.java         | 191 ++++++++++
 .../swing/Headless/HeadlessJProgressBar.java  | 191 ++++++++++
 .../swing/Headless/HeadlessJRadioButton.java  | 191 ++++++++++
 .../HeadlessJRadioButtonMenuItem.java         | 191 ++++++++++
 .../swing/Headless/HeadlessJRootPane.java     | 191 ++++++++++
 .../swing/Headless/HeadlessJScrollBar.java    | 191 ++++++++++
 .../swing/Headless/HeadlessJScrollPane.java   | 191 ++++++++++
 .../swing/Headless/HeadlessJSeparator.java    | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJSlider.java | 191 ++++++++++
 .../swing/Headless/HeadlessJSpinner.java      | 191 ++++++++++
 .../swing/Headless/HeadlessJSplitPane.java    | 185 ++++++++++
 .../swing/Headless/HeadlessJTabbedPane.java   | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJTable.java  | 214 ++++++++++++
 .../swing/Headless/HeadlessJTextArea.java     | 195 +++++++++++
 .../swing/Headless/HeadlessJTextField.java    | 195 +++++++++++
 .../swing/Headless/HeadlessJTextPane.java     |  45 +++
 .../swing/Headless/HeadlessJToggleButton.java | 191 ++++++++++
 .../swing/Headless/HeadlessJToolBar.java      | 191 ++++++++++
 .../Headless/HeadlessJToolBar_Separator.java  | 191 ++++++++++
 .../swing/Headless/HeadlessJToolTip.java      | 191 ++++++++++
 .../javax/swing/Headless/HeadlessJTree.java   | 232 ++++++++++++
 .../swing/Headless/HeadlessJViewport.java     | 199 +++++++++++
 .../javax/swing/Headless/HeadlessJWindow.java |  56 +++
 .../swing/Headless/HeadlessLookAndFeel.java   |  37 ++
 .../HeadlessMenuSelectionManager.java         |  38 ++
 .../swing/Headless/HeadlessOverlayLayout.java |  38 ++
 .../swing/Headless/HeadlessPopupFactory.java  |  37 ++
 .../Headless/HeadlessScrollPaneLayout.java    |  37 ++
 .../Headless/HeadlessSizeRequirements.java    |  39 +++
 .../swing/Headless/HeadlessSizeSequence.java  |  41 +++
 .../Headless/HeadlessSpinnerListModel.java    |  49 +++
 .../Headless/HeadlessSpinnerNumberModel.java  |  41 +++
 .../javax/swing/Headless/HeadlessTimer.java   |  37 ++
 135 files changed, 15192 insertions(+)
 create mode 100644 jdk/test/java/awt/AlphaComposite/HeadlessAlphaComposite.java
 create mode 100644 jdk/test/java/awt/Color/HeadlessColor.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessButton.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessCanvas.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessCheckbox.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessChoice.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessComponent.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessContainer.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessDialog.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessFileDialog.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessFrame.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessLabel.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessList.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessPanel.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessScrollPane.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessScrollbar.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessTextArea.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessTextField.java
 create mode 100644 jdk/test/java/awt/Component/Headless/HeadlessWindow.java
 create mode 100644 jdk/test/java/awt/Cursor/HeadlessCursor.java
 create mode 100644 jdk/test/java/awt/EventQueue/HeadlessEventQueue.java
 create mode 100644 jdk/test/java/awt/Focus/Headless/HeadlessContainerOrderFocusTraversalPolicy.java
 create mode 100644 jdk/test/java/awt/Focus/Headless/HeadlessDefaultFocusTraversalPolicy.java
 create mode 100644 jdk/test/java/awt/Focus/Headless/HeadlessDefaultKeyboardFocusManager.java
 create mode 100644 jdk/test/java/awt/FontClass/HeadlessFont.java
 create mode 100644 jdk/test/java/awt/GradientPaint/HeadlessGradientPaint.java
 create mode 100644 jdk/test/java/awt/Graphics2D/Headless/HeadlessPoint.java
 create mode 100644 jdk/test/java/awt/Graphics2D/Headless/HeadlessPolygon.java
 create mode 100644 jdk/test/java/awt/Graphics2D/Headless/HeadlessRectangle.java
 create mode 100644 jdk/test/java/awt/GraphicsConfiguration/HeadlessGraphicsConfiguration.java
 create mode 100644 jdk/test/java/awt/GraphicsDevice/HeadlessGraphicsDevice.java
 create mode 100644 jdk/test/java/awt/GraphicsEnvironment/HeadlessGraphicsEnvironment.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessAWTEventMulticaster.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessAWTException.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessBasicStroke.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessBorderLayout.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessCardLayout.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessCheckboxGroup.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessCheckboxMenuItem.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessComponentOrientation.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessDimension.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessFlowLayout.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessMediaTracker.java
 create mode 100644 jdk/test/java/awt/Headless/HeadlessPopupMenu.java
 create mode 100644 jdk/test/java/awt/Insets/HeadlessInsets.java
 create mode 100644 jdk/test/java/awt/Menu/Headless/HeadlessMenu.java
 create mode 100644 jdk/test/java/awt/Menu/Headless/HeadlessMenuItem.java
 create mode 100644 jdk/test/java/awt/Menu/Headless/HeadlessMenuShortcut.java
 create mode 100644 jdk/test/java/awt/MenuBar/HeadlessMenuBar.java
 create mode 100644 jdk/test/java/awt/Toolkit/Headless/HeadlessToolkit.java
 create mode 100644 jdk/test/java/awt/applet/Applet/HeadlessApplet.java
 create mode 100644 jdk/test/java/awt/datatransfer/Headless/HeadlessClipboard.java
 create mode 100644 jdk/test/java/awt/datatransfer/Headless/HeadlessDataFlavor.java
 create mode 100644 jdk/test/java/awt/datatransfer/Headless/HeadlessSystemFlavorMap.java
 create mode 100644 jdk/test/java/awt/im/Headless/HeadlessInputContext.java
 create mode 100644 jdk/test/java/awt/im/Headless/HeadlessInputMethodHighlight.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessAffineTransformOp.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessAreaAveragingScaleFilter.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessBufferedImage.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessBufferedImageFilter.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessColorModel.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessCropImageFilter.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessImageFilter.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessIndexColorModel.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessRGBImageFilter.java
 create mode 100644 jdk/test/java/awt/image/Headless/HeadlessReplicateScaleFilter.java
 create mode 100644 jdk/test/java/awt/print/Headless/HeadlessBook.java
 create mode 100644 jdk/test/java/awt/print/Headless/HeadlessPageFormat.java
 create mode 100644 jdk/test/java/awt/print/Headless/HeadlessPaper.java
 create mode 100644 jdk/test/java/awt/print/Headless/HeadlessPrinterJob.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessAbstractSpinnerModel.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessBox.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessBox_Filler.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessGrayFilter.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJApplet.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJButton.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJCheckBox.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJColorChooser.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJComboBox.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJComponent.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJDialog.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJEditorPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJFileChooser.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJFormattedTextField.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJFrame.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJLabel.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJList.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJMenu.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJMenuBar.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJMenuItem.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJOptionPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJPanel.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJPasswordField.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJProgressBar.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJRadioButton.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJRootPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJScrollBar.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJScrollPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJSeparator.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJSlider.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJSpinner.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJSplitPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJTable.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJTextArea.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJTextField.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJTextPane.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJToggleButton.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJToolBar.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJToolTip.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJTree.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJViewport.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessJWindow.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessLookAndFeel.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessMenuSelectionManager.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessOverlayLayout.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessPopupFactory.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessScrollPaneLayout.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessSizeRequirements.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessSizeSequence.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessSpinnerListModel.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessSpinnerNumberModel.java
 create mode 100644 jdk/test/javax/swing/Headless/HeadlessTimer.java

diff --git a/jdk/test/java/awt/AlphaComposite/HeadlessAlphaComposite.java b/jdk/test/java/awt/AlphaComposite/HeadlessAlphaComposite.java
new file mode 100644
index 00000000000..71064d48bda
--- /dev/null
+++ b/jdk/test/java/awt/AlphaComposite/HeadlessAlphaComposite.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.ColorModel;
+
+/*
+ * @test
+ * @summary Check no exception occurrence when running AlphaComposite getInstance(),
+ *          createContext(), getAlpha(), getRule(), hashCode() methods in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAlphaComposite
+ */
+
+public class HeadlessAlphaComposite {
+
+    public static void main(String args[]) {
+        AlphaComposite ac;
+        ac = AlphaComposite.getInstance(AlphaComposite.CLEAR);
+        ac = AlphaComposite.getInstance(AlphaComposite.DST_IN);
+        ac = AlphaComposite.getInstance(AlphaComposite.DST_OUT);
+        ac = AlphaComposite.getInstance(AlphaComposite.DST_OVER);
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC);
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC_IN);
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC_OUT);
+        ac = AlphaComposite.getInstance(AlphaComposite.DST_IN);
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+        CompositeContext cc = ac.createContext(ColorModel.getRGBdefault(),
+                ColorModel.getRGBdefault(),
+                new RenderingHints(RenderingHints.KEY_ANTIALIASING,
+                        RenderingHints.VALUE_ANTIALIAS_ON));
+
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+        float alpha = ac.getAlpha();
+
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+        int rule = ac.getRule();
+
+        ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+        int hc = ac.hashCode();
+    }
+}
diff --git a/jdk/test/java/awt/Color/HeadlessColor.java b/jdk/test/java/awt/Color/HeadlessColor.java
new file mode 100644
index 00000000000..a7b23eff0ba
--- /dev/null
+++ b/jdk/test/java/awt/Color/HeadlessColor.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.color.ColorSpace;
+
+/*
+ * @test
+ * @summary Check Color constructors and methods works correctly in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessColor
+ */
+
+public class HeadlessColor {
+    public static void main(String args[]) {
+        Color c;
+
+        // Constructors without exceptions
+        c = new Color(1, 2, 3);
+        c = new Color(1, 2, 3, 4);
+        c = new Color((1 << 16) | (2 << 8) | (3));
+        c = new Color((1 << 24) | (1 << 16) | (2 << 8) | (3));
+        c = new Color((1 << 24) | (2 << 16) | (3 << 8) | (4), true);
+        c = new Color((2 << 16) | (3 << 8) | (4), false);
+        c = new Color(0.8f, 0.8f, 0.3f);
+        c = new Color(0.999f, 0.8f, 0.8f, 0.3f);
+        c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                new float[]{0.8f, 0.8f, 0.3f}, 1f);
+
+        // Constructors with exceptions
+        boolean exceptions = false;
+        try {
+            c = new Color(409, 400, 400);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(400, 3003, 400, 400);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(8f, 8f, 3f);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(-8f, -8f, -3f);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(0.999f, 8f, 8f, 3f);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(20f, 8f, 8f, 3f);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(-20f, -8f, -8f, -3f);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                    new float[]{-8f, -8f, -3f}, 1f);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+        exceptions = false;
+        try {
+            c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                    new float[]{-8f, -8f, -3f}, -1f);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+                    "when expected in headless mode");
+
+
+        c = new Color(1, 2, 3);
+        c.hashCode();
+        c.toString();
+        if (c.getRed() != 1)
+            throw new RuntimeException("Incorrect red value");
+        if (c.getGreen() != 2)
+            throw new RuntimeException("Incorrect green value");
+        if (c.getBlue() != 3)
+            throw new RuntimeException("Incorrect bluevalue");
+        if (c.getAlpha() != 255)
+            throw new RuntimeException("Incorrect alpha value");
+        if (c.getRGB() != ((255 << 24) | (1 << 16) | (2 << 8) | (3)))
+            throw new RuntimeException("Incorrect rgb value");
+
+        int rgb = c.getRGB();
+        c.brighter();
+        if (rgb != c.getRGB())
+            throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+        rgb = c.getRGB();
+        c.darker();
+        if (rgb != c.getRGB())
+            throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+        c = new Color(1, 2, 3, 4);
+        c.hashCode();
+        c.toString();
+        if (c.getRed() != 1)
+            throw new RuntimeException("Incorrect red value");
+        if (c.getGreen() != 2)
+            throw new RuntimeException("Incorrect green value");
+        if (c.getBlue() != 3)
+            throw new RuntimeException("Incorrect bluevalue");
+        if (c.getAlpha() != 4)
+            throw new RuntimeException("Incorrect alpha value");
+        if (c.getRGB() != ((4 << 24) | (1 << 16) | (2 << 8) | (3)))
+            throw new RuntimeException("Incorrect rgb value");
+
+        rgb = c.getRGB();
+        c.brighter();
+        if (rgb != c.getRGB())
+            throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+        rgb = c.getRGB();
+        c.darker();
+        if (rgb != c.getRGB())
+            throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+
+        if (!(new Color(1, 2, 3).equals(new Color(1, 2, 3))))
+            throw new RuntimeException("Inequality in colors when equality expected");
+        if (new Color(1, 2, 3).equals(new Color(3, 2, 1)))
+            throw new RuntimeException("Equality in colors when NO equality expected");
+
+        if (!(new Color(1, 2, 3, 4).equals(new Color(1, 2, 3, 4))))
+            throw new RuntimeException("Inequality in colors when equality expected");
+        if (new Color(1, 2, 3, 4).equals(new Color(4, 3, 2, 1)))
+            throw new RuntimeException("Equality in colors when NO equality expected");
+
+        c = Color.decode("0xffffff");
+        c = Color.getColor("65535");
+        c = Color.getColor("65535", Color.black);
+        c = Color.getColor("65535", 0xffffff);
+
+        int hsb_value = Color.HSBtoRGB(0.1f, 0.2f, 0.3f);
+        float[] rgb_value = Color.RGBtoHSB(1, 2, 3, null);
+
+        c = Color.getHSBColor(0.3f, 0.4f, 0.6f);
+        c = Color.getHSBColor(-0.3f, -0.4f, -0.6f);
+        c = Color.getHSBColor(30, 40, 60);
+
+        float[] comps;
+        comps = Color.black.getRGBComponents(null);
+        comps = Color.black.getRGBColorComponents(null);
+        comps = Color.black.getComponents(null);
+        comps = Color.black.getColorComponents(null);
+        comps = Color.black.getComponents(ColorSpace.getInstance(ColorSpace.CS_sRGB), null);
+        comps = Color.black.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_sRGB), null);
+
+        Color.black.getColorSpace();
+        Color.black.getTransparency();
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessButton.java b/jdk/test/java/awt/Component/Headless/HeadlessButton.java
new file mode 100644
index 00000000000..66bfc5d2d43
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessButton.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check whether Button constructors throw HeadlessException in
+ *          headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessButton
+ */
+
+public class HeadlessButton {
+
+    public static void main(String args[]) {
+        Button b;
+
+        boolean exceptions = false;
+        try {
+            b = new Button();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+
+        exceptions = false;
+        try {
+            b = new Button("Press me");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessCanvas.java b/jdk/test/java/awt/Component/Headless/HeadlessCanvas.java
new file mode 100644
index 00000000000..65d9701a642
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessCanvas.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check whether Canvas constructor does not throw exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCanvas
+ */
+
+public class HeadlessCanvas {
+    public static void main(String args[]) {
+        Canvas c = new Canvas();
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessCheckbox.java b/jdk/test/java/awt/Component/Headless/HeadlessCheckbox.java
new file mode 100644
index 00000000000..b83abc7203c
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessCheckbox.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Checkbox constructors trow HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCheckbox
+ */
+
+public class HeadlessCheckbox {
+    public static void main(String args[]) {
+        Checkbox b;
+
+        boolean exceptions = false;
+        try {
+            b = new Checkbox();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            b = new Checkbox("Hey, check it out!");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            b = new Checkbox("Hey, check it out!", true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            b = new Checkbox("Hey, check it out!", false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        CheckboxGroup cbg = new CheckboxGroup();
+
+        exceptions = false;
+        try {
+            b = new Checkbox("Hey, check it out!", true, cbg);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            b = new Checkbox("Hey, check it out!", false, cbg);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            b = new Checkbox("Hey, check it out!", cbg, true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            b = new Checkbox("Hey, check it out!", cbg, false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessChoice.java b/jdk/test/java/awt/Component/Headless/HeadlessChoice.java
new file mode 100644
index 00000000000..18733984314
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessChoice.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Choice constructor throws HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessChoice
+ */
+
+public class HeadlessChoice {
+
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        try {
+            Choice c = new Choice();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessComponent.java b/jdk/test/java/awt/Component/Headless/HeadlessComponent.java
new file mode 100644
index 00000000000..fb25da2b35e
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessComponent.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Component methods do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessComponent
+ */
+
+public class HeadlessComponent {
+    public static void main(String args[]) {
+        Component comp = new Component(){};
+        comp.addComponentListener(new ComponentAdapter() {});
+        comp.addFocusListener(new FocusAdapter(){});
+        comp.addHierarchyBoundsListener(new HierarchyBoundsAdapter(){});
+        comp.addHierarchyListener(e -> {});
+        comp.addInputMethodListener(new InputMethodListener() {
+            public void inputMethodTextChanged(InputMethodEvent event) {}
+            public void caretPositionChanged(InputMethodEvent event) {}
+        });
+        comp.addKeyListener(new KeyAdapter() {});
+        comp.addMouseListener(new MouseAdapter() {});
+        comp.addMouseMotionListener(new MouseMotionAdapter() {});
+        comp.addMouseWheelListener(e -> {});
+        comp.addPropertyChangeListener(e -> {});
+        comp.addNotify();
+        comp.getName();
+        comp.setName("goober");
+        comp.getParent();
+        comp.getPeer();
+        comp.getGraphicsConfiguration();
+        comp.getTreeLock();
+        comp.getToolkit();
+        comp.isValid();
+        comp.isDisplayable();
+        comp.isVisible();
+        comp.isShowing();
+        comp.isEnabled();
+        comp.setEnabled(false);
+        comp.setEnabled(true);
+        comp.enable();
+        comp.enable(false);
+        comp.enable(true);
+        comp.disable();
+        comp.isDoubleBuffered();
+        comp.enableInputMethods(false);
+        comp.enableInputMethods(true);
+        comp.setVisible(false);
+        comp.setVisible(true);
+        comp.show();
+        comp.show(false);
+        comp.show(true);
+        comp.hide();
+        comp.getForeground();
+        comp.setForeground(Color.red);
+        comp.isForegroundSet();
+        comp.getBackground();
+        comp.setBackground(Color.red);
+        comp.isBackgroundSet();
+        comp.getFont();
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int i = 8; i < 17; i++) {
+                Font f1 = new Font(font, Font.PLAIN, i);
+                Font f2 = new Font(font, Font.BOLD, i);
+                Font f3 = new Font(font, Font.ITALIC, i);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, i);
+
+                comp.setFont(f1);
+                comp.getFontMetrics(f1);
+                comp.setFont(f2);
+                comp.getFontMetrics(f2);
+                comp.setFont(f3);
+                comp.getFontMetrics(f3);
+                comp.setFont(f4);
+                comp.getFontMetrics(f4);
+            }
+        }
+        comp.isFontSet();
+
+        boolean exceptions = false;
+        try {
+            Container c = new Container();
+            c.add(comp);
+            comp.getLocale();
+        } catch (IllegalComponentStateException ex) {
+           exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        for (Locale locale : Locale.getAvailableLocales())
+            comp.setLocale(locale);
+
+        comp.getColorModel();
+        comp.getLocation();
+
+        exceptions = false;
+        try {
+            comp = new Component(){};
+            comp.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        comp.location();
+        comp.setLocation(1, 2);
+        comp.move(1, 2);
+        comp.setLocation(new Point(1, 2));
+        comp.getSize();
+        comp.size();
+        comp.setSize(1, 32);
+        comp.resize(1, 32);
+        comp.setSize(new Dimension(1, 32));
+        comp.resize(new Dimension(1, 32));
+        comp.getBounds();
+        comp.bounds();
+        comp.setBounds(10, 10, 10, 10);
+        comp.reshape(10, 10, 10, 10);
+        comp.setBounds(new Rectangle(10, 10, 10, 10));
+        comp.getX();
+        comp.getY();
+        comp.getWidth();
+        comp.getHeight();
+        comp.getBounds(new Rectangle(1, 1, 1, 1));
+        comp.getSize(new Dimension(1, 2));
+        comp.getLocation(new Point(1, 2));
+        comp.isOpaque();
+        comp.isLightweight();
+        comp.getPreferredSize();
+        comp.preferredSize();
+        comp.getMinimumSize();
+        comp.minimumSize();
+        comp.getMaximumSize();
+        comp.getAlignmentX();
+        comp.getAlignmentY();
+        comp.doLayout();
+        comp.layout();
+        comp.validate();
+        comp.invalidate();
+        comp.getGraphics();
+        Cursor c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+        comp.setCursor(c);
+        comp.getCursor();
+        comp.isCursorSet();
+        comp.contains(1, 2);
+        comp.inside(1, 2);
+        comp.contains(new Point(1, 2));
+        comp.getComponentAt(1, 2);
+        comp.locate(1, 2);
+        comp.getComponentAt(new Point(1, 2));
+        comp.isFocusTraversable();
+        comp.isFocusable();
+        comp.setFocusable(true);
+        comp.setFocusable(false);
+        comp.requestFocus();
+        comp.requestFocusInWindow();
+        comp.transferFocus();
+        comp.getFocusCycleRootAncestor();
+        comp.isFocusCycleRoot(new Container());
+        comp.nextFocus();
+        comp.transferFocusBackward();
+        comp.transferFocusUpCycle();
+        comp.hasFocus();
+        comp.isFocusOwner();
+        comp.toString();
+        comp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        comp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        comp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        comp.getComponentOrientation();
+        comp.getAccessibleContext();
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessContainer.java b/jdk/test/java/awt/Component/Headless/HeadlessContainer.java
new file mode 100644
index 00000000000..bb4b00d7f0c
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessContainer.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.util.*;
+
+/*
+ * @test
+ * @summary Check that Container methods do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessContainer
+ */
+
+public class HeadlessContainer {
+    public static void main(String args[]) {
+        Container lw = new java.awt.Container();
+        Component c1 = lw.add(new Component(){});
+        Component c2 = lw.add(new Component(){});
+        Component c3 = lw.add(new Component(){});
+
+        lw.getComponentCount();
+        lw.countComponents();
+        lw.getComponent(1);
+        lw.getComponent(2);
+        Component[] cs = lw.getComponents();
+        Insets ins = lw.getInsets();
+        ins = lw.insets();
+        lw.remove(1);
+        lw.remove((java.awt.Component) c2);
+        lw.removeAll();
+
+        lw.add(c1);
+        lw.add(c2);
+        lw.add(c3);
+        lw.getLayout();
+        lw.setLayout(new FlowLayout());
+        lw.doLayout();
+        lw.layout();
+        lw.invalidate();
+        lw.validate();
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int i = 8; i < 17; i++) {
+                Font f1 = new Font(font, Font.PLAIN, i);
+                Font f2 = new Font(font, Font.BOLD, i);
+                Font f3 = new Font(font, Font.ITALIC, i);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, i);
+
+                lw.setFont(f1);
+                lw.setFont(f2);
+                lw.setFont(f3);
+                lw.setFont(f4);
+            }
+        }
+        lw.getPreferredSize();
+        lw.preferredSize();
+        lw.getMinimumSize();
+        lw.minimumSize();
+        lw.getMaximumSize();
+        lw.getAlignmentX();
+        lw.getAlignmentY();
+        lw.getComponentAt(1, 2);
+        lw.locate(1, 2);
+        lw.getComponentAt(new Point(1, 2));
+        lw.isFocusCycleRoot(new Container());
+        lw.transferFocusBackward();
+        lw.getName();
+        lw.setName("goober");
+        lw.getName();
+        lw.getParent();
+        lw.getPeer();
+        lw.getGraphicsConfiguration();
+        lw.getTreeLock();
+        lw.getToolkit();
+        lw.isValid();
+        lw.isDisplayable();
+        lw.isVisible();
+        lw.isShowing();
+        lw.isEnabled();
+        lw.setEnabled(false);
+        lw.setEnabled(true);
+        lw.enable();
+        lw.enable(false);
+        lw.enable(true);
+        lw.disable();
+        lw.isDoubleBuffered();
+        lw.enableInputMethods(false);
+        lw.enableInputMethods(true);
+        lw.setVisible(false);
+        lw.setVisible(true);
+        lw.show();
+        lw.show(false);
+        lw.show(true);
+        lw.hide();
+        lw.getForeground();
+        lw.setForeground(Color.red);
+        lw.isForegroundSet();
+        lw.getBackground();
+        lw.setBackground(Color.red);
+        lw.isBackgroundSet();
+        lw.getFont();
+        lw.isFontSet();
+
+        boolean exceptions = false;
+        try {
+            Container c = new Container();
+            lw = new java.awt.Container();
+            c.add(lw);
+            lw.getLocale();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        for (Locale locale : Locale.getAvailableLocales())
+            lw.setLocale(locale);
+
+        lw.getColorModel();
+        lw.getLocation();
+
+        exceptions = false;
+        try {
+            lw.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        lw.location();
+        lw.setLocation(1, 2);
+        lw.move(1, 2);
+        lw.setLocation(new Point(1, 2));
+        lw.getSize();
+        lw.size();
+        lw.setSize(1, 32);
+        lw.resize(1, 32);
+        lw.setSize(new Dimension(1, 32));
+        lw.resize(new Dimension(1, 32));
+        lw.getBounds();
+        lw.bounds();
+        lw.setBounds(10, 10, 10, 10);
+        lw.reshape(10, 10, 10, 10);
+        lw.setBounds(new Rectangle(10, 10, 10, 10));
+        lw.getX();
+        lw.getY();
+        lw.getWidth();
+        lw.getHeight();
+        lw.getBounds(new Rectangle(1, 1, 1, 1));
+        lw.getSize(new Dimension(1, 2));
+        lw.getLocation(new Point(1, 2));
+        lw.isOpaque();
+        lw.isLightweight();
+        lw.getGraphics();
+
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                lw.getFontMetrics(f1);
+                lw.getFontMetrics(f2);
+                lw.getFontMetrics(f3);
+                lw.getFontMetrics(f4);
+            }
+        }
+
+        Cursor c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+        lw.setCursor(c);
+        lw.getCursor();
+        lw.isCursorSet();
+        lw.contains(1, 2);
+        lw.inside(1, 2);
+        lw.contains(new Point(1, 2));
+        lw.isFocusTraversable();
+        lw.isFocusable();
+        lw.setFocusable(true);
+        lw.setFocusable(false);
+        lw.requestFocus();
+        lw.requestFocusInWindow();
+        lw.transferFocus();
+        lw.getFocusCycleRootAncestor();
+        lw.nextFocus();
+        lw.transferFocusUpCycle();
+        lw.hasFocus();
+        lw.isFocusOwner();
+        lw.toString();
+        lw.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        lw.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        lw.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        lw.getComponentOrientation();
+        lw.getAccessibleContext();
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessDialog.java b/jdk/test/java/awt/Component/Headless/HeadlessDialog.java
new file mode 100644
index 00000000000..55b0525fdbb
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessDialog.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Dialog constructors throw expected HeadlessException
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDialog
+ */
+
+public class HeadlessDialog  {
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        Dialog d;
+
+        try {
+            d = new Dialog(new Frame("Hi there"));
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new Dialog(new Frame("Hi there"), true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new Dialog(new Frame("Hi there"), false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new Dialog(new Frame("Hi there"), "Dialog title");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new Dialog(new Frame("Hi there"), "Dialog title", true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new Dialog(new Frame("Hi there"), "Dialog title", false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessFileDialog.java b/jdk/test/java/awt/Component/Headless/HeadlessFileDialog.java
new file mode 100644
index 00000000000..7c39693d21d
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessFileDialog.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that FileDialog constructors throw HeadlessException
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFileDialog
+ */
+
+public class HeadlessFileDialog {
+    public static void main(String args[]) {
+        FileDialog d;
+        boolean exceptions = false;
+        try {
+            d = new FileDialog(new Frame("Hi there"));
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new FileDialog(new Frame("Hi there"), "Dialog title");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new FileDialog(new Frame("Hi there"), "Dialog title", FileDialog.LOAD);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            d = new FileDialog(new Frame("Hi there"), "Dialog title", FileDialog.SAVE);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessFrame.java b/jdk/test/java/awt/Component/Headless/HeadlessFrame.java
new file mode 100644
index 00000000000..f85ad57e792
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessFrame.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Font constructors and throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFrame
+ */
+
+public class HeadlessFrame {
+    public static void main(String args[]) {
+        Frame f;
+        boolean exceptions = false;
+
+        try {
+            f = new Frame();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            f = new Frame("Frame me peculiar");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessLabel.java b/jdk/test/java/awt/Component/Headless/HeadlessLabel.java
new file mode 100644
index 00000000000..1fcc1763126
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessLabel.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Label constructors do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessLabel
+ */
+
+public class HeadlessLabel {
+    public static void main(String args[]) {
+        Label l;
+
+        boolean exceptions = false;
+        try {
+            l = new Label();
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new Label("Label me blue");
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new Label("Label me blue", 200);
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessList.java b/jdk/test/java/awt/Component/Headless/HeadlessList.java
new file mode 100644
index 00000000000..652de8f4722
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessList.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that List constructors do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessList
+ */
+
+public class HeadlessList {
+    public static void main(String args[]) {
+        List l;
+
+        boolean exceptions = false;
+        try {
+            l = new List();
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new List(10);
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new List(1000);
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new List(10, true);
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new List(10, false);
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new List(1000, true);
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            l = new List(1000, false);
+        } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessPanel.java b/jdk/test/java/awt/Component/Headless/HeadlessPanel.java
new file mode 100644
index 00000000000..65b809c898d
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessPanel.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Panel constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPanel
+ */
+
+public class HeadlessPanel {
+    public static void main(String args[]) {
+        Panel p;
+        p = new Panel();
+        p = new Panel(new FlowLayout());
+        p.getAccessibleContext();
+        Component c1 = p.add(new Component(){});
+        Component c2 = p.add(new Component(){});
+        Component c3 = p.add(new Component(){});
+        p.getComponentCount();
+        p.countComponents();
+        p.getComponent(1);
+        p.getComponent(2);
+        Component[] cs = p.getComponents();
+        Insets ins = p.getInsets();
+        ins = p.insets();
+        p.remove(0);
+        p.remove((Component) c2);
+        p.removeAll();
+
+        p.add(c1);
+        p.add(c2);
+        p.add(c3);
+        p.getLayout();
+        p.setLayout(new FlowLayout());
+        p.doLayout();
+        p.layout();
+        p.invalidate();
+        p.validate();
+
+        p.getPreferredSize();
+        p.preferredSize();
+        p.getMinimumSize();
+        p.minimumSize();
+        p.getMaximumSize();
+        p.getAlignmentX();
+        p.getAlignmentY();
+        p.getComponentAt(1, 2);
+        p.locate(1, 2);
+        p.getComponentAt(new Point(1, 2));
+        p.isFocusCycleRoot(new Container());
+        p.transferFocusBackward();
+        p.setName("goober");
+        p.getName();
+        p.getParent();
+        p.getPeer();
+        p.getGraphicsConfiguration();
+        p.getTreeLock();
+        p.getToolkit();
+        p.isValid();
+        p.isDisplayable();
+        p.isVisible();
+        p.isShowing();
+        p.isEnabled();
+        p.setEnabled(false);
+        p.setEnabled(true);
+        p.enable();
+        p.enable(false);
+        p.enable(true);
+        p.disable();
+        p.isDoubleBuffered();
+        p.enableInputMethods(false);
+        p.enableInputMethods(true);
+        p.setVisible(false);
+        p.setVisible(true);
+        p.show();
+        p.show(false);
+        p.show(true);
+        p.hide();
+        p.getForeground();
+        p.setForeground(Color.red);
+        p.isForegroundSet();
+        p.getBackground();
+        p.setBackground(Color.red);
+        p.isBackgroundSet();
+        p.getFont();
+        p.isFontSet();
+        p.getColorModel();
+        p.getLocation();
+        p.location();
+        p.setLocation(1, 2);
+        p.move(1, 2);
+        p.setLocation(new Point(1, 2));
+        p.getSize();
+        p.size();
+        p.setSize(1, 32);
+        p.resize(1, 32);
+        p.setSize(new Dimension(1, 32));
+        p.resize(new Dimension(1, 32));
+        p.getBounds();
+        p.bounds();
+        p.setBounds(10, 10, 10, 10);
+        p.reshape(10, 10, 10, 10);
+        p.setBounds(new Rectangle(10, 10, 10, 10));
+        p.getX();
+        p.getY();
+        p.getWidth();
+        p.getHeight();
+        p.getBounds(new Rectangle(1, 1, 1, 1));
+        p.getSize(new Dimension(1, 2));
+        p.getLocation(new Point(1, 2));
+        p.isOpaque();
+        p.isLightweight();
+        p.getGraphics();
+
+
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                p.setFont(f1);
+                p.setFont(f2);
+                p.setFont(f3);
+                p.setFont(f4);
+            }
+        }
+
+        boolean exceptions = false;
+        try {
+            Container c = new Container();
+            p = new Panel();
+            c.add(p);
+            p.getLocale();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        for (Locale locale : Locale.getAvailableLocales())
+            p.setLocale(locale);
+
+        exceptions = false;
+        try {
+            p.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j
+                    < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                p.getFontMetrics(f1);
+                p.getFontMetrics(f2);
+                p.getFontMetrics(f3);
+                p.getFontMetrics(f4);
+            }
+        }
+
+        Cursor c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+        p.setCursor(c);
+        p.getCursor();
+        p.isCursorSet();
+        p.contains(1, 2);
+        p.inside(1, 2);
+        p.contains(new Point(1, 2));
+        p.isFocusTraversable();
+        p.isFocusable();
+        p.setFocusable(true);
+        p.setFocusable(false);
+        p.requestFocus();
+        p.requestFocusInWindow();
+        p.transferFocus();
+        p.getFocusCycleRootAncestor();
+        p.nextFocus();
+        p.transferFocusUpCycle();
+        p.hasFocus();
+        p.isFocusOwner();
+        p.toString();
+        p.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        p.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        p.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        p.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessScrollPane.java b/jdk/test/java/awt/Component/Headless/HeadlessScrollPane.java
new file mode 100644
index 00000000000..2ce741e3c16
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessScrollPane.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that ScrollPane constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessScrollPane
+ */
+
+public class HeadlessScrollPane {
+    public static void main(String args[]) {
+        ScrollPane s;
+        boolean exceptions = false;
+
+        try {
+            s = new ScrollPane();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            s = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            s = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            s = new ScrollPane(ScrollPane.SCROLLBARS_NEVER);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessScrollbar.java b/jdk/test/java/awt/Component/Headless/HeadlessScrollbar.java
new file mode 100644
index 00000000000..a7eb9eab7f2
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessScrollbar.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Scrollbar constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessScrollbar
+ */
+
+public class HeadlessScrollbar {
+
+    public static void main(String args[]) {
+        Scrollbar s;
+        boolean exceptions = false;
+
+        try {
+            s = new Scrollbar();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            s = new Scrollbar(Scrollbar.HORIZONTAL);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            s = new Scrollbar(Scrollbar.VERTICAL);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            s = new Scrollbar(Scrollbar.HORIZONTAL, 1, 10, 0, 100);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            s = new Scrollbar(Scrollbar.VERTICAL, 1, 10, 0, 100);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessTextArea.java b/jdk/test/java/awt/Component/Headless/HeadlessTextArea.java
new file mode 100644
index 00000000000..18fdd13bea5
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessTextArea.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that TextArea constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessTextArea
+ */
+
+public class HeadlessTextArea {
+    public static void main(String args[]) {
+        TextArea t;
+        boolean exceptions = false;
+
+        try {
+            t = new TextArea();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextArea("Hi there");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextArea(10, 100);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextArea("Hi there", 10, 100);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_BOTH);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_HORIZONTAL_ONLY);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_VERTICAL_ONLY);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_NONE);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessTextField.java b/jdk/test/java/awt/Component/Headless/HeadlessTextField.java
new file mode 100644
index 00000000000..2f57f53b8c6
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessTextField.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that TextField constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessTextField
+ */
+
+public class HeadlessTextField {
+    public static void main(String args[]) {
+        TextField t;
+        boolean exceptions = false;
+
+        try {
+            t = new TextField();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextField("Hi there");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        try {
+            t = new TextField(20);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextField(200);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        try {
+            t = new TextField("Hi there", 20);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            t = new TextField("Hi there", 200);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Component/Headless/HeadlessWindow.java b/jdk/test/java/awt/Component/Headless/HeadlessWindow.java
new file mode 100644
index 00000000000..cd123d05568
--- /dev/null
+++ b/jdk/test/java/awt/Component/Headless/HeadlessWindow.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Window constructor throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessWindow
+ */
+
+public class HeadlessWindow {
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        try {
+            Window b = new Window(new Frame("Hi there"));
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Cursor/HeadlessCursor.java b/jdk/test/java/awt/Cursor/HeadlessCursor.java
new file mode 100644
index 00000000000..ccb27179cc8
--- /dev/null
+++ b/jdk/test/java/awt/Cursor/HeadlessCursor.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Cursor constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCursor
+ */
+
+public class HeadlessCursor {
+    public static void main(String args[]) {
+        Cursor c;
+        c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.DEFAULT_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.E_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.HAND_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.N_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.NE_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.NW_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.S_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.SE_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.SW_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.TEXT_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.W_RESIZE_CURSOR);
+        c.getType();
+        c.getName();
+        c = new Cursor(Cursor.WAIT_CURSOR);
+        c.getType();
+        c.getName();
+
+        c = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
+        c = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
+        c = Cursor.getDefaultCursor();
+        c.getType();
+        c.getName();
+    }
+}
diff --git a/jdk/test/java/awt/EventQueue/HeadlessEventQueue.java b/jdk/test/java/awt/EventQueue/HeadlessEventQueue.java
new file mode 100644
index 00000000000..877b108e376
--- /dev/null
+++ b/jdk/test/java/awt/EventQueue/HeadlessEventQueue.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that EventQueue constructor does not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessEventQueue
+ */
+
+public class HeadlessEventQueue {
+    public static void main(String args[]) {
+        EventQueue eq = new EventQueue();
+    }
+}
diff --git a/jdk/test/java/awt/Focus/Headless/HeadlessContainerOrderFocusTraversalPolicy.java b/jdk/test/java/awt/Focus/Headless/HeadlessContainerOrderFocusTraversalPolicy.java
new file mode 100644
index 00000000000..4254e50fec5
--- /dev/null
+++ b/jdk/test/java/awt/Focus/Headless/HeadlessContainerOrderFocusTraversalPolicy.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that ContainerOrderFocusTraversalPolicy constructor and
+ *          methods do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessContainerOrderFocusTraversalPolicy
+ */
+
+public class HeadlessContainerOrderFocusTraversalPolicy {
+
+    public static void main(String args[]) {
+        ContainerOrderFocusTraversalPolicy cot = new ContainerOrderFocusTraversalPolicy();
+
+        Container c = new Container();
+        Component cb1;
+        Component cb2;
+        Component cb3;
+
+        c.setFocusCycleRoot(true);
+        c.setFocusTraversalPolicy(cot);
+        c.add(cb1 = new Component(){});
+        c.add(cb2 = new Component(){});
+        c.add(cb3 = new Component(){});
+
+        cot.getComponentAfter(c, cb1);
+        cot.getComponentAfter(c, cb2);
+        cot.getComponentAfter(c, cb3);
+
+        cot.getComponentBefore(c, cb1);
+        cot.getComponentBefore(c, cb2);
+        cot.getComponentBefore(c, cb3);
+
+        cot.getFirstComponent(c);
+
+        cot.getLastComponent(c);
+
+        cot.getDefaultComponent(c);
+        cot.setImplicitDownCycleTraversal(true);
+        cot.setImplicitDownCycleTraversal(false);
+        cot.getImplicitDownCycleTraversal();
+    }
+}
diff --git a/jdk/test/java/awt/Focus/Headless/HeadlessDefaultFocusTraversalPolicy.java b/jdk/test/java/awt/Focus/Headless/HeadlessDefaultFocusTraversalPolicy.java
new file mode 100644
index 00000000000..100212746b9
--- /dev/null
+++ b/jdk/test/java/awt/Focus/Headless/HeadlessDefaultFocusTraversalPolicy.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that DefaultFocusTraversalPolicy constructor and
+ *          methods do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultFocusTraversalPolicy
+ */
+
+public class HeadlessDefaultFocusTraversalPolicy  {
+    public static void main(String args[]) {
+        Container c = new Container();
+        Component cb1;
+        Component cb2;
+        Component cb3;
+
+        DefaultFocusTraversalPolicy cot = new DefaultFocusTraversalPolicy();
+        c.setFocusCycleRoot(true);
+        c.setFocusTraversalPolicy(cot);
+        c.add(cb1 = new Component(){});
+        c.add(cb2 = new Component(){});
+        c.add(cb3 = new Component(){});
+
+        cot.getComponentAfter(c, cb1);
+        cot.getComponentAfter(c, cb2);
+        cot.getComponentAfter(c, cb3);
+
+        cot.getComponentBefore(c, cb1);
+        cot.getComponentBefore(c, cb2);
+        cot.getComponentBefore(c, cb3);
+
+        cot.getFirstComponent(c);
+
+        cot.getLastComponent(c);
+
+        cot.getDefaultComponent(c);
+
+        cot.setImplicitDownCycleTraversal(true);
+
+        cot.setImplicitDownCycleTraversal(false);
+
+        cot.getImplicitDownCycleTraversal();
+    }
+}
diff --git a/jdk/test/java/awt/Focus/Headless/HeadlessDefaultKeyboardFocusManager.java b/jdk/test/java/awt/Focus/Headless/HeadlessDefaultKeyboardFocusManager.java
new file mode 100644
index 00000000000..637deea4404
--- /dev/null
+++ b/jdk/test/java/awt/Focus/Headless/HeadlessDefaultKeyboardFocusManager.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that DefaultKeyboardFocusManager constructor does not
+ *          throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultKeyboardFocusManager
+ */
+
+public class HeadlessDefaultKeyboardFocusManager {
+    public static void main(String args[]) {
+        DefaultKeyboardFocusManager dfk = new DefaultKeyboardFocusManager();
+    }
+}
diff --git a/jdk/test/java/awt/FontClass/HeadlessFont.java b/jdk/test/java/awt/FontClass/HeadlessFont.java
new file mode 100644
index 00000000000..e9eba8836e9
--- /dev/null
+++ b/jdk/test/java/awt/FontClass/HeadlessFont.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.font.TextAttribute;
+import java.awt.geom.AffineTransform;
+import java.text.AttributedCharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.HashMap;
+import java.util.Map;
+
+/*
+ * @test
+ * @summary Check that Font constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFont
+ */
+
+public class HeadlessFont {
+
+    public static void main(String args[]) {
+        HashMap attMap = new HashMap();
+        attMap.put(TextAttribute.FAMILY, "Helvetica Bold");
+        attMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_LIGHT);
+        attMap.put(TextAttribute.WIDTH, TextAttribute.WIDTH_REGULAR);
+        attMap.put(TextAttribute.SIZE, new Float(20));
+        attMap.put(TextAttribute.FOREGROUND, Color.white);
+        attMap.put(TextAttribute.BACKGROUND, Color.black);
+
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int i = 8; i < 17; i++) {
+                Font f1 = new Font(font, Font.PLAIN, i);
+                Font f2 = new Font(font, Font.BOLD, i);
+                Font f3 = new Font(font, Font.ITALIC, i);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, i);
+
+                FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(f1);
+                metrics = Toolkit.getDefaultToolkit().getFontMetrics(f2);
+                metrics = Toolkit.getDefaultToolkit().getFontMetrics(f3);
+                metrics = Toolkit.getDefaultToolkit().getFontMetrics(f4);
+
+                AffineTransform trans = f1.getTransform();
+                trans = f2.getTransform();
+                trans = f3.getTransform();
+                trans = f4.getTransform();
+
+                String str;
+                str = f1.getFamily();
+                str = f2.getFamily();
+                str = f3.getFamily();
+                str = f4.getFamily();
+
+                str = f1.getPSName();
+                str = f2.getPSName();
+                str = f3.getPSName();
+                str = f4.getPSName();
+
+                str = f1.getName();
+                str = f2.getName();
+                str = f3.getName();
+                str = f4.getName();
+
+                str = f1.getFontName();
+                str = f2.getFontName();
+                str = f3.getFontName();
+                str = f4.getFontName();
+
+                str = f1.toString();
+                str = f2.toString();
+                str = f3.toString();
+                str = f4.toString();
+
+                int s;
+                s = f1.getStyle();
+                s = f2.getStyle();
+                s = f3.getStyle();
+                s = f4.getStyle();
+
+                s = f1.getSize();
+                s = f2.getSize();
+                s = f3.getSize();
+                s = f4.getSize();
+
+                s = f1.hashCode();
+                s = f2.hashCode();
+                s = f3.hashCode();
+                s = f4.hashCode();
+
+                s = f1.getNumGlyphs();
+                s = f2.getNumGlyphs();
+                s = f3.getNumGlyphs();
+                s = f4.getNumGlyphs();
+
+                s = f1.getMissingGlyphCode();
+                s = f2.getMissingGlyphCode();
+                s = f3.getMissingGlyphCode();
+                s = f4.getMissingGlyphCode();
+
+                float f;
+                f = f1.getSize2D();
+                f = f2.getSize2D();
+                f = f3.getSize2D();
+                f = f4.getSize2D();
+
+
+                byte b;
+                b = f1.getBaselineFor('c');
+                b = f2.getBaselineFor('c');
+                b = f3.getBaselineFor('c');
+                b = f4.getBaselineFor('c');
+
+                Map m = f1.getAttributes();
+                m = f2.getAttributes();
+                m = f3.getAttributes();
+                m = f4.getAttributes();
+
+                AttributedCharacterIterator.Attribute[] a;
+                a = f1.getAvailableAttributes();
+                a = f2.getAvailableAttributes();
+                a = f3.getAvailableAttributes();
+                a = f4.getAvailableAttributes();
+
+
+                Font fnt;
+                fnt = f1.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+                fnt = f2.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+                fnt = f3.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+                fnt = f4.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+
+                fnt = f1.deriveFont(80f);
+                fnt = f2.deriveFont(80f);
+                fnt = f3.deriveFont(80f);
+                fnt = f4.deriveFont(80f);
+
+                fnt = f1.deriveFont(Font.BOLD | Font.ITALIC);
+                fnt = f2.deriveFont(Font.BOLD | Font.ITALIC);
+                fnt = f3.deriveFont(Font.BOLD | Font.ITALIC);
+                fnt = f4.deriveFont(Font.BOLD | Font.ITALIC);
+
+                fnt = f1.deriveFont(attMap);
+                fnt = f2.deriveFont(attMap);
+                fnt = f3.deriveFont(attMap);
+                fnt = f4.deriveFont(attMap);
+
+
+                if (!f1.isPlain())
+                    throw new RuntimeException("Plain font " + f1.getName() + " says it's not plain");
+                if (f2.isPlain())
+                    throw new RuntimeException("Bold font " + f1.getName() + " says it is plain");
+                if (f3.isPlain())
+                    throw new RuntimeException("Italic font " + f1.getName() + " says it is plain");
+                if (f4.isPlain())
+                    throw new RuntimeException("Bold|Italic font " + f1.getName() + " says it is plain");
+
+                if (f1.isBold())
+                    throw new RuntimeException("Plain font " + f1.getName() + " says it is bold");
+                if (!f2.isBold())
+                    throw new RuntimeException("Bold font " + f1.getName() + " says it's not bold");
+                if (f3.isBold())
+                    throw new RuntimeException("Italic font " + f1.getName() + " says it is bold");
+                if (!f4.isBold())
+                    throw new RuntimeException("Bold|Italic font " + f1.getName() + " says it's not bold");
+
+                if (f1.isItalic())
+                    throw new RuntimeException("Plain font " + f1.getName() + " says it is italic");
+                if (f2.isItalic())
+                    throw new RuntimeException("Bold font " + f1.getName() + " says it is italic");
+                if (!f3.isItalic())
+                    throw new RuntimeException("Italic font " + f1.getName() + " says it's not italic");
+                if (!f4.isItalic())
+                    throw new RuntimeException("Bold|Italic font " + f1.getName() + " says it's not italic");
+
+                f1.canDisplay('~');
+                f2.canDisplay('~');
+                f3.canDisplay('~');
+                f4.canDisplay('~');
+                f1.canDisplay('c');
+                f2.canDisplay('c');
+                f3.canDisplay('c');
+                f4.canDisplay('c');
+
+                f1.canDisplayUpTo("canDisplayUpTo");
+                f2.canDisplayUpTo("canDisplayUpTo");
+                f3.canDisplayUpTo("canDisplayUpTo");
+                f4.canDisplayUpTo("canDisplayUpTo");
+
+                str = "canDisplayUpTo";
+                f1.canDisplayUpTo(str.toCharArray(), 0, str.length());
+                f2.canDisplayUpTo(str.toCharArray(), 0, str.length());
+                f3.canDisplayUpTo(str.toCharArray(), 0, str.length());
+                f4.canDisplayUpTo(str.toCharArray(), 0, str.length());
+
+                f1.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+                f2.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+                f3.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+                f4.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+
+                f1.getItalicAngle();
+                f2.getItalicAngle();
+                f3.getItalicAngle();
+                f4.getItalicAngle();
+
+                f1.hasUniformLineMetrics();
+                f2.hasUniformLineMetrics();
+                f3.hasUniformLineMetrics();
+                f4.hasUniformLineMetrics();
+
+                f1.getPeer();
+                f2.getPeer();
+                f3.getPeer();
+                f4.getPeer();
+            }
+        }
+
+        Font f = new Font(attMap);
+        f = Font.getFont(attMap);
+        f = Font.decode(null);
+    }
+}
diff --git a/jdk/test/java/awt/GradientPaint/HeadlessGradientPaint.java b/jdk/test/java/awt/GradientPaint/HeadlessGradientPaint.java
new file mode 100644
index 00000000000..2f6faecf9c7
--- /dev/null
+++ b/jdk/test/java/awt/GradientPaint/HeadlessGradientPaint.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that GradientPaint that constructors and methods do not
+ *          throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGradientPaint
+ */
+
+public class HeadlessGradientPaint {
+    public static void main(String args[]) {
+        GradientPaint gp;
+        gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue);
+        gp = new GradientPaint(new Point(10, 10), Color.red, new Point(20, 20), Color.blue);
+        gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue, true);
+        gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue, false);
+        gp = new GradientPaint(new Point(10, 10), Color.red, new Point(20, 20), Color.blue, true);
+        gp = new GradientPaint(new Point(10, 10), Color.red, new Point(20, 20), Color.blue, false);
+
+        gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue, false);
+        gp.getPoint1();
+        gp.getColor1();
+        gp.getPoint2();
+        gp.getColor2();
+        gp.isCyclic();
+        gp.getTransparency();
+    }
+}
diff --git a/jdk/test/java/awt/Graphics2D/Headless/HeadlessPoint.java b/jdk/test/java/awt/Graphics2D/Headless/HeadlessPoint.java
new file mode 100644
index 00000000000..3fc74492c76
--- /dev/null
+++ b/jdk/test/java/awt/Graphics2D/Headless/HeadlessPoint.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Point constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPoint
+ */
+
+public class HeadlessPoint {
+    public static void main(String args[]) {
+        Point p;
+        p = new Point();
+        p = new Point(new Point(1, 2));
+        p = new Point(1, 2);
+        p.getX();
+        p.getY();
+        p.getLocation();
+        p.setLocation(new Point(3, 4));
+    }
+}
diff --git a/jdk/test/java/awt/Graphics2D/Headless/HeadlessPolygon.java b/jdk/test/java/awt/Graphics2D/Headless/HeadlessPolygon.java
new file mode 100644
index 00000000000..11138158d6f
--- /dev/null
+++ b/jdk/test/java/awt/Graphics2D/Headless/HeadlessPolygon.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Polygon;
+
+/*
+ * @test
+ * @summary Check that Polygon constructor does not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPolygon
+ */
+
+public class HeadlessPolygon {
+    public static void main(String args[]) {
+        new Polygon();
+    }
+}
diff --git a/jdk/test/java/awt/Graphics2D/Headless/HeadlessRectangle.java b/jdk/test/java/awt/Graphics2D/Headless/HeadlessRectangle.java
new file mode 100644
index 00000000000..b71972375e8
--- /dev/null
+++ b/jdk/test/java/awt/Graphics2D/Headless/HeadlessRectangle.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Rectangle constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessRectangle
+ */
+
+public class HeadlessRectangle {
+    public static void main(String args[]) {
+        Rectangle r;
+        r = new Rectangle();
+        r = new Rectangle(new Rectangle());
+        r = new Rectangle(100, 200);
+        r = new Rectangle(new Point(100, 200), new Dimension(300, 400));
+        r = new Rectangle(new Point(100, 200));
+        r = new Rectangle(new Dimension(300, 400));
+        r = new Rectangle(100, 200, 300, 400);
+        r.getX();
+        r.getY();
+        r.getWidth();
+        r.getHeight();
+        r.getBounds();
+        r.getBounds2D();
+        r.getLocation();
+        r.getSize();
+        r.contains(new Point(1, 2));
+        r.contains(1, 2);
+        r.contains(new Rectangle(1, 2, 3, 4));
+        r.contains(1, 2, 3, 4);
+        r.add(1, 2);
+        r.add(new Point(1, 2));
+        r.add(new Rectangle(1, 2, 3, 4));
+        r.grow(1, 2);
+        r.isEmpty();
+        r.toString();
+        r.hashCode();
+        r.getMinX();
+        r.getMinY();
+        r.getMaxX();
+        r.getMaxY();
+        r.getCenterX();
+        r.getCenterY();
+        r.getFrame();
+    }
+}
diff --git a/jdk/test/java/awt/GraphicsConfiguration/HeadlessGraphicsConfiguration.java b/jdk/test/java/awt/GraphicsConfiguration/HeadlessGraphicsConfiguration.java
new file mode 100644
index 00000000000..c1efe666921
--- /dev/null
+++ b/jdk/test/java/awt/GraphicsConfiguration/HeadlessGraphicsConfiguration.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+
+/*
+ * @test
+ * @summary Check that GraphicsConfiguration methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGraphicsConfiguration
+ */
+
+public class HeadlessGraphicsConfiguration {
+    public static void main(String args[]) {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+        GraphicsConfiguration gc = gd.getDeviceConfiguration();
+        GraphicsDevice gdev = gc.getDevice();
+        BufferedImage bi = gc.createCompatibleImage(100, 100);
+        bi = gc.createCompatibleImage(100, 100, Transparency.TRANSLUCENT);
+
+        ColorModel cm = gc.getColorModel();
+        cm = gc.getColorModel(Transparency.TRANSLUCENT);
+
+        AffineTransform at = gc.getDefaultTransform();
+        at = gc.getNormalizingTransform();
+
+        Rectangle r = gc.getBounds();
+    }
+}
diff --git a/jdk/test/java/awt/GraphicsDevice/HeadlessGraphicsDevice.java b/jdk/test/java/awt/GraphicsDevice/HeadlessGraphicsDevice.java
new file mode 100644
index 00000000000..3301f54ee05
--- /dev/null
+++ b/jdk/test/java/awt/GraphicsDevice/HeadlessGraphicsDevice.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check that GraphicsDevice methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGraphicsDevice
+ */
+
+public class HeadlessGraphicsDevice {
+    public static void main(String args[]) {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+        GraphicsConfiguration gc = gd.getDeviceConfiguration();
+        GraphicsDevice gdev = gc.getDevice();
+
+        for (GraphicsConfiguration gcl : gdev.getConfigurations())
+            gcl.toString();
+
+        gdev.getDefaultConfiguration().toString();
+        gdev.getIDstring();
+
+        if (gdev.getType() != GraphicsDevice.TYPE_IMAGE_BUFFER)
+            throw new RuntimeException("Created GraphicsDevice that should be IMAGE_BUFFER but it isn't");
+    }
+}
diff --git a/jdk/test/java/awt/GraphicsEnvironment/HeadlessGraphicsEnvironment.java b/jdk/test/java/awt/GraphicsEnvironment/HeadlessGraphicsEnvironment.java
new file mode 100644
index 00000000000..60e6ea230d1
--- /dev/null
+++ b/jdk/test/java/awt/GraphicsEnvironment/HeadlessGraphicsEnvironment.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check that GraphicsEnvironment methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGraphicsEnvironment
+ */
+
+public class HeadlessGraphicsEnvironment {
+    public static void main(String args[]) {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        if (!GraphicsEnvironment.isHeadless())
+            throw new RuntimeException("GraphicsEnvironment.isHeadless says it's not headless mode when it is");
+
+        boolean exceptions = false;
+        try {
+            GraphicsDevice[] gdl = ge.getScreenDevices();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when excepted");
+
+        exceptions = false;
+        try {
+            GraphicsDevice gdl = ge.getDefaultScreenDevice();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when excepted");
+
+        Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+
+        for (Font font : ge.getAllFonts()) {
+            for (float j = 8; j < 17; j++) {
+                Font f1 = font.deriveFont(Font.PLAIN, j);
+                Font f2 = font.deriveFont(Font.BOLD, j);
+                Font f3 = font.deriveFont(Font.ITALIC, j);
+                Font f4 = font.deriveFont(Font.BOLD | Font.ITALIC, j);
+
+                f1.hasUniformLineMetrics();
+                f2.hasUniformLineMetrics();
+                f3.hasUniformLineMetrics();
+                f4.hasUniformLineMetrics();
+            }
+        }
+
+        String[] fNames = ge.getAvailableFontFamilyNames();
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessAWTEventMulticaster.java b/jdk/test/java/awt/Headless/HeadlessAWTEventMulticaster.java
new file mode 100644
index 00000000000..8459c84cb0b
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessAWTEventMulticaster.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+
+/*
+ * @test
+ * @summary Check for AWTEventMulticaster working in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAWTEventMulticaster
+ */
+
+public class HeadlessAWTEventMulticaster {
+    class ComponentListenerImpl implements ComponentListener {
+        public boolean hidden = false;
+        public boolean moved = false;
+        public boolean resized = false;
+        public boolean shown = false;
+
+        public void componentHidden(ComponentEvent e) {
+            hidden = true;
+        }
+
+        public void componentMoved(ComponentEvent e) {
+            moved = true;
+        }
+
+        public void componentResized(ComponentEvent e) {
+            resized = true;
+        }
+
+        public void componentShown(ComponentEvent e) {
+            shown = true;
+        }
+    }
+
+    class ContainerListenerImpl implements ContainerListener {
+        public boolean removed = false;
+        public boolean added = false;
+
+        public void componentAdded(ContainerEvent e) {
+            added = true;
+        }
+
+        public void componentRemoved(ContainerEvent e) {
+            removed = true;
+        }
+    }
+
+    class FocusListenerImpl implements FocusListener {
+        public boolean gained = false;
+        public boolean lost = false;
+
+        public void focusGained(FocusEvent e) {
+            gained = true;
+        }
+
+        public void focusLost(FocusEvent e) {
+            lost = true;
+        }
+    }
+
+    class KeyListenerImpl implements KeyListener {
+        public boolean pressed = false;
+        public boolean released = false;
+        public boolean typed = false;
+
+        public void keyPressed(KeyEvent e) {
+            pressed = true;
+        }
+
+        public void keyReleased(KeyEvent e) {
+            released = true;
+        }
+
+        public void keyTyped(KeyEvent e) {
+            typed = true;
+        }
+    }
+
+    public static void main(String args[]) {
+        new HeadlessAWTEventMulticaster().doTest();
+    }
+
+    void doTest() {
+        ComponentListener compList;
+        ComponentListenerImpl compListImpl;
+
+        ContainerListener contList;
+        ContainerListenerImpl contListImpl;
+
+        FocusListener focList;
+        FocusListenerImpl focListImpl;
+
+        KeyListener keyList;
+        KeyListenerImpl keyListImpl;
+
+        Component component = new Component(){};
+
+        // Component resized
+        compListImpl = new ComponentListenerImpl();
+        compList = AWTEventMulticaster.add(compListImpl, null);
+        compList.componentResized(new ComponentEvent(component,
+                ComponentEvent.COMPONENT_RESIZED));
+        if (compListImpl.hidden || compListImpl.moved || compListImpl.shown) {
+            throw new RuntimeException("Wrong id delivered: hidden || moved || shown");
+        }
+        if (!compListImpl.resized) {
+            throw new RuntimeException("Expected id, resized, not delivered");
+        }
+
+        // Component moved
+        compListImpl = new ComponentListenerImpl();
+        compList = AWTEventMulticaster.add(compListImpl, null);
+        compList.componentMoved(new ComponentEvent(component,
+                ComponentEvent.COMPONENT_MOVED));
+        if (compListImpl.hidden || compListImpl.resized || compListImpl.shown) {
+            throw new RuntimeException("Wrong id delivered: hidden || resized || shown");
+        }
+        if (!compListImpl.moved) {
+            throw new RuntimeException("Expected id, moved, not delivered");
+        }
+
+        // Component shown
+        compListImpl = new ComponentListenerImpl();
+        compList = AWTEventMulticaster.add(compListImpl, null);
+        compList.componentShown(new ComponentEvent(component,
+                ComponentEvent.COMPONENT_SHOWN));
+        if (compListImpl.hidden || compListImpl.resized || compListImpl.moved) {
+            throw new RuntimeException("Wrong id delivered: hidden || resized || moved");
+        }
+        if (!compListImpl.shown) {
+            throw new RuntimeException("Expected id, shown, not delivered");
+        }
+
+        // Component hidden
+        compListImpl = new ComponentListenerImpl();
+        compList = AWTEventMulticaster.add(compListImpl, null);
+        compList.componentHidden(new ComponentEvent(component,
+                ComponentEvent.COMPONENT_HIDDEN));
+        if (compListImpl.shown || compListImpl.resized || compListImpl.moved) {
+            throw new RuntimeException("Wrong id delivered: shown || resized || moved");
+        }
+        if (!compListImpl.hidden) {
+            throw new RuntimeException("Expected id, hidden, not delivered");
+        }
+
+        // Component added
+        contListImpl = new ContainerListenerImpl();
+        contList = AWTEventMulticaster.add(contListImpl, null);
+        contList.componentAdded(new ContainerEvent(component,
+                ContainerEvent.COMPONENT_ADDED, component));
+        if (contListImpl.removed) {
+            throw new RuntimeException("Wrong id delivered: removed");
+        }
+        if (!contListImpl.added) {
+            throw new RuntimeException("Expected id, added, not delivered");
+        }
+
+        // Component removed
+        contListImpl = new ContainerListenerImpl();
+        contList = AWTEventMulticaster.add(contListImpl, null);
+        contList.componentRemoved(new ContainerEvent(component,
+                ContainerEvent.COMPONENT_REMOVED, component));
+        if (contListImpl.added) {
+            throw new RuntimeException("Wrong id delivered: added");
+        }
+        if (!contListImpl.removed) {
+            throw new RuntimeException("Expected id, removed, not delivered");
+        }
+
+        // Focus gained
+        focListImpl = new FocusListenerImpl();
+        focList = AWTEventMulticaster.add(focListImpl, null);
+        focList.focusGained(new FocusEvent(component, FocusEvent.FOCUS_GAINED));
+        if (focListImpl.lost) {
+            throw new RuntimeException("Wrong id delivered: lost");
+        }
+        if (!focListImpl.gained) {
+            throw new RuntimeException("Expected id, gained, not delivered");
+        }
+
+        // Focus lost
+        focListImpl = new FocusListenerImpl();
+        focList = AWTEventMulticaster.add(focListImpl, null);
+        focList.focusLost(new FocusEvent(component, FocusEvent.FOCUS_LOST));
+        if (focListImpl.gained) {
+            throw new RuntimeException("Wrong id delivered: gained");
+        }
+        if (!focListImpl.lost) {
+            throw new RuntimeException("Expected id, lost, not delivered");
+        }
+
+        // Key typed
+        keyListImpl = new KeyListenerImpl();
+        keyList = AWTEventMulticaster.add(keyListImpl, null);
+        keyList.keyTyped(new KeyEvent(component,
+                KeyEvent.KEY_TYPED, 0L, 0, 0));
+        if (keyListImpl.pressed || keyListImpl.released)
+            throw new RuntimeException("Wrong id delivered: pressed || released");
+
+        if (!keyListImpl.typed)
+            throw new RuntimeException("Expected id, typed, not delivered");
+
+        // Key pressed
+        keyListImpl = new KeyListenerImpl();
+        keyList = AWTEventMulticaster.add(keyListImpl, null);
+        keyList.keyPressed(new KeyEvent(component,
+                KeyEvent.KEY_PRESSED, 0L, 0, 0));
+        if (keyListImpl.typed || keyListImpl.released)
+            throw new RuntimeException("Wrong id delivered: typed || released");
+
+        if (!keyListImpl.pressed)
+            throw new RuntimeException("Expected id, pressed, not delivered");
+
+        // Key released
+        keyListImpl = new KeyListenerImpl();
+        keyList = AWTEventMulticaster.add(keyListImpl, null);
+        keyList.keyReleased(new KeyEvent(component,
+                KeyEvent.KEY_RELEASED, 0L, 0, 0));
+        if (keyListImpl.pressed || keyListImpl.typed)
+            throw new RuntimeException("Wrong id delivered: pressed || typed");
+
+        if (!keyListImpl.released)
+            throw new RuntimeException("Expected id, released, not delivered");
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessAWTException.java b/jdk/test/java/awt/Headless/HeadlessAWTException.java
new file mode 100644
index 00000000000..c6d9de30434
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessAWTException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that AWTException can be created in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAWTException
+ */
+
+public class HeadlessAWTException {
+
+    public static void main (String[] args) {
+        AWTException e = new AWTException("aa");
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessBasicStroke.java b/jdk/test/java/awt/Headless/HeadlessBasicStroke.java
new file mode 100644
index 00000000000..b3c479fbf9a
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessBasicStroke.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that BasicStroke constructors and get-methods do not
+ *          throw exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBasicStroke
+ */
+
+
+public class HeadlessBasicStroke {
+    public static void main (String[] args) {
+        BasicStroke bs;
+
+        // Constructors without exceptions
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT,
+                    BasicStroke.JOIN_BEVEL, 3, null, -1);
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 3,
+                    new float[]{(float) 2.0, (float) 3.0}, 0);
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 3,
+                    new float[]{(float) 2.0, (float) 3.0}, 1);
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, (float) 3);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 3);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, (float) 3);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 3);
+
+        bs = new BasicStroke(1, BasicStroke.JOIN_ROUND, BasicStroke.CAP_SQUARE, 3);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
+
+        bs = new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND);
+
+        bs = new BasicStroke(1, BasicStroke.JOIN_ROUND, BasicStroke.CAP_SQUARE);
+
+        bs = new BasicStroke((float) 0.1);
+
+        bs = new BasicStroke((float) 0.9);
+
+        bs = new BasicStroke(4);
+
+        bs = new BasicStroke(10);
+
+        bs = new BasicStroke(20);
+
+        bs = new BasicStroke(100);
+
+        bs = new BasicStroke();
+
+        // Constructors with exceptions
+        boolean exceptions = false;
+        try {
+            bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 0.2);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+        exceptions = false;
+        try {
+            bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 0.2);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+        exceptions = false;
+        try {
+            bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 0.2);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+        exceptions = false;
+        try {
+            bs = new BasicStroke(1, 5678, 92039, 3);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+        exceptions = false;
+        try {
+            bs = new BasicStroke(1, 5678, 92039);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+        exceptions = false;
+        try {
+            bs = new BasicStroke((float) -0.9);
+        } catch (IllegalArgumentException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+        // Create stroke shape
+        bs = new BasicStroke(20);
+        bs.createStrokedShape(new Rectangle(10, 10, 10, 10));
+
+        // Get-methods
+        bs = new BasicStroke(100);
+        bs.getLineWidth();
+        bs.getEndCap();
+        bs.getLineJoin();
+        bs.getMiterLimit();
+        bs.getDashArray();
+        bs.getDashPhase();
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessBorderLayout.java b/jdk/test/java/awt/Headless/HeadlessBorderLayout.java
new file mode 100644
index 00000000000..2a4d51ac3dc
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessBorderLayout.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check BorderLayout constructors and methods working in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBorderLayout
+ */
+
+public class HeadlessBorderLayout {
+    public static void main (String[] args) {
+        BorderLayout bl;
+        bl = new BorderLayout();
+        bl = new BorderLayout(10, 10);
+        bl.getHgap();
+        bl.setHgap(10);
+        bl.getVgap();
+        bl.setVgap(10);
+
+        bl = new BorderLayout();
+        bl.setVgap(10);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.AFTER_LAST_LINE);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.AFTER_LINE_ENDS);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.BEFORE_FIRST_LINE);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.BEFORE_LINE_BEGINS);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.PAGE_START);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.PAGE_END);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.LINE_START);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.LINE_END);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.CENTER);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.EAST);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.NORTH);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.SOUTH);
+        bl.addLayoutComponent(new Component(){}, BorderLayout.WEST);
+
+        Component cb = new Component(){};
+        bl.addLayoutComponent(cb, BorderLayout.WEST);
+        bl.removeLayoutComponent(cb);
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessCardLayout.java b/jdk/test/java/awt/Headless/HeadlessCardLayout.java
new file mode 100644
index 00000000000..7f6829d5cd4
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessCardLayout.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check whether CardLayout constructor and methods do not throw exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCardLayout
+ */
+
+public class HeadlessCardLayout {
+
+    public static void main(String args[]) {
+        CardLayout cl;
+        cl = new CardLayout();
+        cl = new CardLayout(10, 10);
+        cl.getHgap();
+        cl.setHgap(10);
+        cl.getVgap();
+        cl.setVgap(10);
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessCheckboxGroup.java b/jdk/test/java/awt/Headless/HeadlessCheckboxGroup.java
new file mode 100644
index 00000000000..818359a3ad4
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessCheckboxGroup.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that CheckboxGroup constructor and toString() method do not throw
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCheckboxGroup
+ */
+
+public class HeadlessCheckboxGroup {
+    public static void main(String args[]) {
+        CheckboxGroup cbg = new CheckboxGroup();
+        cbg.toString();
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessCheckboxMenuItem.java b/jdk/test/java/awt/Headless/HeadlessCheckboxMenuItem.java
new file mode 100644
index 00000000000..1ac9f2aeeb4
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessCheckboxMenuItem.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that CheckboxMenuItem constructors throw HeadlessException
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCheckboxMenuItem
+ */
+
+public class HeadlessCheckboxMenuItem {
+
+    public static void main(String args[]) {
+        CheckboxMenuItem c;
+
+        boolean exceptions = false;
+        try {
+            c = new CheckboxMenuItem();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            c = new CheckboxMenuItem("Choices...");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            c = new CheckboxMenuItem("Choices...", true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+        exceptions = false;
+        try {
+            c = new CheckboxMenuItem("Choices...", false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("Constructor did not throw HeadlessException");
+
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessComponentOrientation.java b/jdk/test/java/awt/Headless/HeadlessComponentOrientation.java
new file mode 100644
index 00000000000..6803b72f4a5
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessComponentOrientation.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that ComponentOrientation methods do not throw exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessComponentOrientation
+ */
+
+public class HeadlessComponentOrientation {
+    public static void main(String args[]) {
+        ComponentOrientation.LEFT_TO_RIGHT.isHorizontal();
+        ComponentOrientation.RIGHT_TO_LEFT.isHorizontal();
+        ComponentOrientation.UNKNOWN.isHorizontal();
+        ComponentOrientation.LEFT_TO_RIGHT.isLeftToRight();
+        ComponentOrientation.RIGHT_TO_LEFT.isLeftToRight();
+        ComponentOrientation.UNKNOWN.isLeftToRight();
+
+        for (Locale locale : Locale.getAvailableLocales())
+            ComponentOrientation.getOrientation(locale);
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessDimension.java b/jdk/test/java/awt/Headless/HeadlessDimension.java
new file mode 100644
index 00000000000..7170a0fdb60
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessDimension.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Dimension constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDimension
+ */
+
+public class HeadlessDimension {
+    public static void main(String args[]) {
+        Dimension d;
+        d = new Dimension();
+        d = new Dimension(new Dimension());
+
+        d = new Dimension(100, 100);
+        double f = d.getWidth();
+        f = d.getHeight();
+
+        d = new Dimension();
+        d.setSize(100.0, 100.0);
+        d.setSize(100, 100);
+
+        d = new Dimension(100, 100);
+        Dimension d2 = d.getSize();
+
+        d = new Dimension(100, 100);
+        d2 = new Dimension(200, 200);
+        d.setSize(d2);
+
+        new Dimension(100, 100).equals(new Dimension(200, 200));
+
+        d.hashCode();
+        d.toString();
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessFlowLayout.java b/jdk/test/java/awt/Headless/HeadlessFlowLayout.java
new file mode 100644
index 00000000000..cf5a9c16252
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessFlowLayout.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that FlowLayout constructor and method do not throw unexpected
+  *         exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFlowLayout
+ */
+
+public class HeadlessFlowLayout {
+
+    public static void main(String args[]) {
+        FlowLayout bs = new FlowLayout();
+        bs.getHgap();
+        bs.setHgap(10);
+        bs.getVgap();
+        bs.setVgap(10);
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessMediaTracker.java b/jdk/test/java/awt/Headless/HeadlessMediaTracker.java
new file mode 100644
index 00000000000..652990f9afe
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessMediaTracker.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that MediaTracker constructor does not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMediaTracker
+ */
+
+public class HeadlessMediaTracker {
+    public static void main(String args[]) {
+        new MediaTracker(new Component(){});
+    }
+}
diff --git a/jdk/test/java/awt/Headless/HeadlessPopupMenu.java b/jdk/test/java/awt/Headless/HeadlessPopupMenu.java
new file mode 100644
index 00000000000..a20bfe47666
--- /dev/null
+++ b/jdk/test/java/awt/Headless/HeadlessPopupMenu.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that PopupMenu constructors do not throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPopupMenu
+ */
+
+public class HeadlessPopupMenu {
+    public static void main(String args[]) {
+            PopupMenu pm;
+        boolean exceptions = false;
+        try {
+            pm = new PopupMenu();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            pm = new PopupMenu("Popup menu");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Insets/HeadlessInsets.java b/jdk/test/java/awt/Insets/HeadlessInsets.java
new file mode 100644
index 00000000000..b04ba11fae4
--- /dev/null
+++ b/jdk/test/java/awt/Insets/HeadlessInsets.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Insets constructor does not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessInsets
+ */
+
+public class HeadlessInsets {
+    public static void main(String args[]) {
+        new Insets(1, 2, 3, 4);
+    }
+}
diff --git a/jdk/test/java/awt/Menu/Headless/HeadlessMenu.java b/jdk/test/java/awt/Menu/Headless/HeadlessMenu.java
new file mode 100644
index 00000000000..6c51b8d66fe
--- /dev/null
+++ b/jdk/test/java/awt/Menu/Headless/HeadlessMenu.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that Menu constructors do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenu
+ */
+
+public class HeadlessMenu {
+    public static void main(String args[]) {
+        Menu m;
+        boolean exceptions = false;
+        try {
+            m = new Menu();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            m = new Menu("A Menu");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            m = new Menu("A Menu", false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            m = new Menu("A Menu", true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Menu/Headless/HeadlessMenuItem.java b/jdk/test/java/awt/Menu/Headless/HeadlessMenuItem.java
new file mode 100644
index 00000000000..3a3db2b2185
--- /dev/null
+++ b/jdk/test/java/awt/Menu/Headless/HeadlessMenuItem.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+/*
+ * @test
+ * @summary Check that MenuItem constructors do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuItem
+ */
+
+public class HeadlessMenuItem {
+
+    public static void main(String args[]) {
+        MenuItem mi;
+
+        boolean exceptions = false;
+        try {
+            mi = new MenuItem();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            mi = new MenuItem("Choose me");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            MenuShortcut ms = new MenuShortcut(KeyEvent.VK_A);
+            mi = new MenuItem("Choose me", ms);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Menu/Headless/HeadlessMenuShortcut.java b/jdk/test/java/awt/Menu/Headless/HeadlessMenuShortcut.java
new file mode 100644
index 00000000000..50de7b34bc3
--- /dev/null
+++ b/jdk/test/java/awt/Menu/Headless/HeadlessMenuShortcut.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.MenuShortcut;
+import java.awt.event.KeyEvent;
+
+/*
+ * @test
+ * @summary Check that MenuShortcut constructors do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuShortcut
+ */
+
+public class HeadlessMenuShortcut {
+    public static void main(String args[]) {
+        MenuShortcut ms;
+        ms = new MenuShortcut(KeyEvent.VK_A);
+        ms = new MenuShortcut(KeyEvent.VK_A, true);
+        ms = new MenuShortcut(KeyEvent.VK_A, false);
+    }
+}
diff --git a/jdk/test/java/awt/MenuBar/HeadlessMenuBar.java b/jdk/test/java/awt/MenuBar/HeadlessMenuBar.java
new file mode 100644
index 00000000000..3e2c659f659
--- /dev/null
+++ b/jdk/test/java/awt/MenuBar/HeadlessMenuBar.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that MenuBar constructor does not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuBar
+ */
+
+public class HeadlessMenuBar {
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        try {
+            MenuBar m = new MenuBar();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/Toolkit/Headless/HeadlessToolkit.java b/jdk/test/java/awt/Toolkit/Headless/HeadlessToolkit.java
new file mode 100644
index 00000000000..1f7ceeeea00
--- /dev/null
+++ b/jdk/test/java/awt/Toolkit/Headless/HeadlessToolkit.java
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.event.AWTEventListener;
+import java.awt.event.KeyEvent;
+import java.awt.im.InputMethodHighlight;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.MemoryImageSource;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+/*
+ * @test
+ * @summary Check that Toolkit methods do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessToolkit
+ */
+
+public class HeadlessToolkit {
+
+    class awtEventListener implements AWTEventListener {
+        public void eventDispatched(AWTEvent e) {
+        }
+    }
+
+    class propChangeListener implements PropertyChangeListener {
+        public void propertyChange(PropertyChangeEvent e) {
+        }
+    }
+
+    public static void main(String args[]) throws IOException {
+        new HeadlessToolkit().doTest();
+    }
+
+    void doTest() throws IOException {
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        String[] fl = tk.getFontList();
+        FontMetrics fm = tk.getFontMetrics(new Font(fl[0], Font.PLAIN, 10));
+        tk.sync();
+        tk.beep();
+
+        boolean exceptions = false;
+        try {
+            Dimension d = tk.getScreenSize();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            int res = tk.getScreenResolution();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+            Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+            GraphicsConfiguration gc = gd.getDeviceConfiguration();
+            Insets res = tk.getScreenInsets(gc);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            ColorModel cm = tk.getColorModel();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            int km = tk.getMenuShortcutKeyMask();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            boolean state = tk.getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            boolean state = tk.getLockingKeyState(KeyEvent.VK_NUM_LOCK);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            boolean state = tk.getLockingKeyState(KeyEvent.VK_KANA_LOCK);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            boolean state = tk.getLockingKeyState(KeyEvent.VK_SCROLL_LOCK);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_NUM_LOCK, true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_KANA_LOCK, true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_NUM_LOCK, false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_KANA_LOCK, false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            tk.setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            Dimension d = tk.getBestCursorSize(32, 32);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            int n = tk.getMaximumCursorColors();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        EventQueue eq = tk.getSystemEventQueue();
+        awtEventListener el = new awtEventListener();
+        tk.addAWTEventListener(el, 0xffffffff);
+        tk.removeAWTEventListener(el);
+
+        File[] images = new File[]{new File("image.png"), new File("image.jpg"), new File("image.gif")};
+        Image im;
+        for (File image : images) {
+            String path = image.getCanonicalPath();
+            ImageIO.write(new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB), path.substring(path.lastIndexOf('.')+1), image);
+
+            im = tk.getImage(image.getAbsolutePath());
+            im.flush();
+
+            FileInputStream fis = new FileInputStream(image);
+            byte[] b = new byte[(int) (image.length())];
+            fis.read(b);
+            fis.close();
+            im = tk.createImage(b);
+            im.flush();
+
+            im = tk.createImage(image.getAbsolutePath());
+            im.flush();
+
+        }
+
+        im = tk.getImage(new URL("http://openjdk.java.net/images/openjdk.png"));
+        im.flush();
+
+        im = tk.createImage(new URL("http://openjdk.java.net/images/openjdk.png"));
+        im.flush();
+
+        MemoryImageSource mis;
+        int pixels[] = new int[50 * 50];
+        int index = 0;
+        for (int y = 0; y < 50; y++) {
+            int red = (y * 255) / 49;
+            for (int x = 0; x < 50; x++) {
+                int blue = (x * 255) / 49;
+                pixels[index++] = (255 << 24) | (red << 16) | blue;
+            }
+        }
+        mis = new MemoryImageSource(50, 50, pixels, 0, 50);
+        im = tk.createImage(mis);
+        im.flush();
+
+
+        exceptions = false;
+        try {
+            Cursor cur = tk.createCustomCursor(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB), new Point(0, 0), "Stop");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            Cursor cur = tk.createCustomCursor(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB), new Point(0, 0), "Stop");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            InputMethodHighlight imh = new InputMethodHighlight(true, InputMethodHighlight.CONVERTED_TEXT);
+            Map m = tk.mapInputMethodHighlight(imh);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            Clipboard cl = tk.getSystemClipboard();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/java/awt/applet/Applet/HeadlessApplet.java b/jdk/test/java/awt/applet/Applet/HeadlessApplet.java
new file mode 100644
index 00000000000..c258e080a22
--- /dev/null
+++ b/jdk/test/java/awt/applet/Applet/HeadlessApplet.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.applet.Applet;
+import java.awt.HeadlessException;
+
+/*
+ * @test
+ * @summary Check HeadlessException occurrence when trying to create Applet
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessApplet
+ */
+
+public class HeadlessApplet {
+
+    public static void main(String args[]) {
+        boolean noExceptions = true;
+
+        try {
+            Applet a = new Applet();
+        } catch (HeadlessException e) {
+            noExceptions = false;
+        }
+
+        if (noExceptions) {
+            throw new RuntimeException("No HeadlessException occured when creating Applet in headless mode");
+        }
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/Headless/HeadlessClipboard.java b/jdk/test/java/awt/datatransfer/Headless/HeadlessClipboard.java
new file mode 100644
index 00000000000..6023618e6e3
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/Headless/HeadlessClipboard.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.Clipboard;
+
+/*
+ * @test
+ * @summary Check Clipboard constructor and getName() method do not throw
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessClipboard
+ */
+
+public class HeadlessClipboard {
+    public static void main(String args[]) {
+        Clipboard cb = new Clipboard("dummy");
+        cb.getName();
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/Headless/HeadlessDataFlavor.java b/jdk/test/java/awt/datatransfer/Headless/HeadlessDataFlavor.java
new file mode 100644
index 00000000000..0f2cb08a63d
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/Headless/HeadlessDataFlavor.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+
+/*
+ * @test
+ * @summary Check that DataFlavor constructors do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDataFlavor
+ */
+
+public class HeadlessDataFlavor {
+    public static void main(String args[]) throws Exception {
+        DataFlavor df;
+        df = new DataFlavor();
+        df = new DataFlavor("text/plain", "plain jane text");
+        df = new DataFlavor("text/html", "HTML text");
+        df = new DataFlavor("text/plain");
+        df = new DataFlavor("text/html");
+        df.toString();
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/Headless/HeadlessSystemFlavorMap.java b/jdk/test/java/awt/datatransfer/Headless/HeadlessSystemFlavorMap.java
new file mode 100644
index 00000000000..741d3f9c019
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/Headless/HeadlessSystemFlavorMap.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.FlavorMap;
+import java.awt.datatransfer.SystemFlavorMap;
+
+/*
+ * @test
+ * @summary Check that SystemFlavorMap constructor does not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSystemFlavorMap
+ */
+
+public class HeadlessSystemFlavorMap {
+    public static void main(String args[]) {
+        FlavorMap sfm = SystemFlavorMap.getDefaultFlavorMap();
+    }
+}
diff --git a/jdk/test/java/awt/im/Headless/HeadlessInputContext.java b/jdk/test/java/awt/im/Headless/HeadlessInputContext.java
new file mode 100644
index 00000000000..23e78c13551
--- /dev/null
+++ b/jdk/test/java/awt/im/Headless/HeadlessInputContext.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.im.InputContext;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that InputContext methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessInputContext
+ */
+
+public class HeadlessInputContext {
+    public static void main(String args[]) {
+        InputContext ic = InputContext.getInstance();
+
+        for (Locale locale : Locale.getAvailableLocales())
+            ic.selectInputMethod(locale);
+
+        ic.getLocale();
+    }
+}
diff --git a/jdk/test/java/awt/im/Headless/HeadlessInputMethodHighlight.java b/jdk/test/java/awt/im/Headless/HeadlessInputMethodHighlight.java
new file mode 100644
index 00000000000..96ab0069fbc
--- /dev/null
+++ b/jdk/test/java/awt/im/Headless/HeadlessInputMethodHighlight.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.im.InputMethodHighlight;
+
+/*
+ * @test
+ * @summary Check that InputMethodHighlight constructors do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessInputMethodHighlight
+ */
+
+public class HeadlessInputMethodHighlight {
+    public static void main(String args[]) {
+        InputMethodHighlight imh;
+        imh = new InputMethodHighlight(true, InputMethodHighlight.CONVERTED_TEXT);
+        imh = new InputMethodHighlight(false,InputMethodHighlight.CONVERTED_TEXT);
+        imh = new InputMethodHighlight(true, InputMethodHighlight.RAW_TEXT);
+        imh = new InputMethodHighlight(false,InputMethodHighlight.RAW_TEXT);
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessAffineTransformOp.java b/jdk/test/java/awt/image/Headless/HeadlessAffineTransformOp.java
new file mode 100644
index 00000000000..2ea9acc9380
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessAffineTransformOp.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.geom.AffineTransform;
+import java.awt.image.AffineTransformOp;
+
+/*
+ * @test
+ * @summary Check that AffineTransformOp constructors  and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAffineTransformOp
+ */
+
+public class HeadlessAffineTransformOp {
+    public static void main(String args[]) {
+        AffineTransformOp ato;
+
+        ato = new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR);
+        ato = new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
+        ato = new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR);
+        ato.getInterpolationType();
+        ato.getTransform();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessAreaAveragingScaleFilter.java b/jdk/test/java/awt/image/Headless/HeadlessAreaAveragingScaleFilter.java
new file mode 100644
index 00000000000..d4cc48060a1
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessAreaAveragingScaleFilter.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.AreaAveragingScaleFilter;
+
+/*
+ * @test
+ * @summary Check that AreaAveragingScaleFilter constructor and clone() method
+ *          do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAreaAveragingScaleFilter
+ */
+
+public class HeadlessAreaAveragingScaleFilter {
+    public static void main(String args[]) {
+        new AreaAveragingScaleFilter(100, 100).clone();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessBufferedImage.java b/jdk/test/java/awt/image/Headless/HeadlessBufferedImage.java
new file mode 100644
index 00000000000..a993e9535a7
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessBufferedImage.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check that BufferedImage constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBufferedImage
+ */
+
+public class HeadlessBufferedImage {
+
+    public static void main(String args[]) {
+        BufferedImage bi;
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_3BYTE_BGR);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_4BYTE_ABGR);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_BYTE_BINARY);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_BYTE_GRAY);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_BYTE_INDEXED);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_ARGB);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_ARGB_PRE);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_BGR);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_RGB);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_USHORT_565_RGB);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_USHORT_GRAY);
+        bi = new BufferedImage(300, 300, BufferedImage.TYPE_USHORT_555_RGB);
+        bi.getType();
+        bi.getColorModel();
+        bi.getRaster();
+        bi.getAlphaRaster();
+        bi.getRGB(1, 1);
+        bi.getWidth();
+        bi.getHeight();
+        bi.getSource();
+        bi.flush();
+        bi.getGraphics();
+        bi.createGraphics();
+        BufferedImage bi2 = bi.getSubimage(10, 10, 200, 200);
+        bi.isAlphaPremultiplied();
+        bi.coerceData(true);
+        bi.coerceData(false);
+        bi.toString();
+        bi.getSources();
+        bi.getPropertyNames();
+        bi.getMinX();
+        bi.getMinY();
+        bi.getSampleModel();
+        bi.getNumXTiles();
+        bi.getNumYTiles();
+        bi.getMinTileX();
+        bi.getMinTileY();
+        bi.getTileWidth();
+        bi.getTileHeight();
+        bi.getTileGridXOffset();
+        bi.getTileGridYOffset();
+        bi.getData();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessBufferedImageFilter.java b/jdk/test/java/awt/image/Headless/HeadlessBufferedImageFilter.java
new file mode 100644
index 00000000000..ea23c0df507
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessBufferedImageFilter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.*;
+import java.awt.geom.*;
+
+/*
+ * @test
+ * @summary Check that BufferedImageFilter constructor and clone() method do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBufferedImageFilter
+ */
+
+public class HeadlessBufferedImageFilter {
+    public static void main(String args[]) {
+        new BufferedImageFilter(new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR)).clone();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessColorModel.java b/jdk/test/java/awt/image/Headless/HeadlessColorModel.java
new file mode 100644
index 00000000000..d3d78e59a6b
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessColorModel.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.*;
+
+/*
+ * @test
+ * @summary Check that ColorModel methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessColorModel
+ */
+
+public class HeadlessColorModel {
+    public static void main(String args[]) {
+        ColorModel cm = new ColorModel(32) {
+            public int getAlpha(int pixel) { return 255; }
+            public int getBlue(int pixel) { return 255; }
+            public int getGreen(int pixel) { return 255; }
+            public int getRed(int pixel) { return 255; }
+        };
+
+        cm.hasAlpha();
+        cm.isAlphaPremultiplied();
+        cm.getTransferType();
+        cm.getPixelSize();
+        cm.getComponentSize();
+        cm.getComponentSize();
+        cm.getTransparency();
+        cm.getNumComponents();
+        cm.getNumColorComponents();
+        cm.getRed(20);
+        cm.getGreen(20);
+        cm.getBlue(20);
+        cm.getAlpha(20);
+        cm.getRGB(20);
+        cm.isAlphaPremultiplied();
+        cm.isAlphaPremultiplied();
+
+        cm = ColorModel.getRGBdefault();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessCropImageFilter.java b/jdk/test/java/awt/image/Headless/HeadlessCropImageFilter.java
new file mode 100644
index 00000000000..7d22f47c47d
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessCropImageFilter.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.CropImageFilter;
+
+/*
+ * @test
+ * @summary Check that CropImageFilter constructor and clone() method
+ *          do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCropImageFilter
+ */
+
+public class HeadlessCropImageFilter {
+    public static void main (String[] args) {
+        new CropImageFilter(20, 20, 40, 50).clone();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessImageFilter.java b/jdk/test/java/awt/image/Headless/HeadlessImageFilter.java
new file mode 100644
index 00000000000..16782c54285
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessImageFilter.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.ImageFilter;
+
+/*
+ * @test
+ * @summary Check that ImageFilter constructor and clone() method
+ *          do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessImageFilter
+ */
+
+public class HeadlessImageFilter {
+    public static void main(String args[]) {
+        new ImageFilter().clone();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessIndexColorModel.java b/jdk/test/java/awt/image/Headless/HeadlessIndexColorModel.java
new file mode 100644
index 00000000000..e197afab2b1
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessIndexColorModel.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.IndexColorModel;
+
+/*
+ * @test
+ * @summary Check that IndexColorModel constructor and methods
+ *          do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessIndexColorModel
+ */
+
+public class HeadlessIndexColorModel {
+    public static void main(String args[]) {
+        IndexColorModel cm =
+                new IndexColorModel(8, 1, new byte[]{(byte) 128}, new byte[]{(byte) 128}, new byte[]{(byte) 128});
+        cm.getTransparency();
+        cm.getComponentSize();
+        cm.isAlphaPremultiplied();
+        cm.hasAlpha();
+        cm.isAlphaPremultiplied();
+        cm.getTransferType();
+        cm.getPixelSize();
+        cm.getComponentSize();
+        cm.getNumComponents();
+        cm.getNumColorComponents();
+        cm.getRed(20);
+        cm.getGreen(20);
+        cm.getBlue(20);
+        cm.getAlpha(20);
+        cm.getRGB(20);
+        cm.isAlphaPremultiplied();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessRGBImageFilter.java b/jdk/test/java/awt/image/Headless/HeadlessRGBImageFilter.java
new file mode 100644
index 00000000000..41ce7ca44df
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessRGBImageFilter.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.RGBImageFilter;
+
+/*
+ * @test
+ * @summary Check that RGBImageFilter constructor and clone() method
+ *          do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessRGBImageFilter
+ */
+
+public class HeadlessRGBImageFilter {
+
+    public static void main(String args[]) {
+        new RGBImageFilter() {
+            public int filterRGB(int x, int y, int rgb) {
+                return 0;
+            }
+        }.clone();
+    }
+}
diff --git a/jdk/test/java/awt/image/Headless/HeadlessReplicateScaleFilter.java b/jdk/test/java/awt/image/Headless/HeadlessReplicateScaleFilter.java
new file mode 100644
index 00000000000..187553a2238
--- /dev/null
+++ b/jdk/test/java/awt/image/Headless/HeadlessReplicateScaleFilter.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.image.ReplicateScaleFilter;
+
+/*
+ * @test
+ * @summary Check that ReplicateScaleFilter constructor and clone() method
+ *          do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessReplicateScaleFilter
+ */
+
+public class HeadlessReplicateScaleFilter {
+    public static void main(String args[]) {
+        new ReplicateScaleFilter(100, 100).clone();
+    }
+}
diff --git a/jdk/test/java/awt/print/Headless/HeadlessBook.java b/jdk/test/java/awt/print/Headless/HeadlessBook.java
new file mode 100644
index 00000000000..fa73c0a91a1
--- /dev/null
+++ b/jdk/test/java/awt/print/Headless/HeadlessBook.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.print.Book;
+
+/*
+ * @test
+ * @summary Check that Book constructor and getNumberOfPages() method do not throw
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBook
+ */
+
+public class HeadlessBook {
+    public static void main(String args[]) {
+        new Book().getNumberOfPages();
+    }
+}
diff --git a/jdk/test/java/awt/print/Headless/HeadlessPageFormat.java b/jdk/test/java/awt/print/Headless/HeadlessPageFormat.java
new file mode 100644
index 00000000000..7210264d5f9
--- /dev/null
+++ b/jdk/test/java/awt/print/Headless/HeadlessPageFormat.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+
+/*
+ * @test
+ * @summary Check that PageFormat constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPageFormat
+ */
+
+public class HeadlessPageFormat {
+    public static void main(String args[]) {
+        PageFormat pf;
+        pf = (PageFormat) new PageFormat().clone();
+        pf.getWidth();
+        pf.getHeight();
+        pf.getImageableX();
+        pf.getImageableY();
+        pf.getImageableWidth();
+        pf.getImageableHeight();
+        pf.getPaper();
+        pf.setPaper(new Paper());
+        pf.setOrientation(PageFormat.PORTRAIT);
+        if (pf.getOrientation() != PageFormat.PORTRAIT)
+            throw new RuntimeException("Changing Orientation did not result in a change: PageFormat.PORTRAIT");
+
+        pf.setOrientation(PageFormat.LANDSCAPE);
+        if (pf.getOrientation() != PageFormat.LANDSCAPE)
+            throw new RuntimeException("Changing Orientation did not result in a change: PageFormat.LANDSCAPE");
+
+        pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+        if (pf.getOrientation() != PageFormat.REVERSE_LANDSCAPE)
+            throw new RuntimeException("Changing Orientation did not result in a change: PageFormat.REVERSE_LANDSCAPE");
+
+        pf.getOrientation();
+        pf.getMatrix();
+    }
+}
diff --git a/jdk/test/java/awt/print/Headless/HeadlessPaper.java b/jdk/test/java/awt/print/Headless/HeadlessPaper.java
new file mode 100644
index 00000000000..7fcb93a96b5
--- /dev/null
+++ b/jdk/test/java/awt/print/Headless/HeadlessPaper.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.print.Paper;
+
+/*
+ * @test
+ * @summary Check that Paper constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPaper
+ */
+
+public class HeadlessPaper {
+    public static void main(String args[]) {
+        Paper p;
+        p = (Paper) new Paper().clone();
+        p.getHeight();
+        p.setSize(200.0, 300.0);
+        p.getWidth();
+        p.setImageableArea(1.0, 1.0, 300.0, 400.0);
+        p.getImageableX();
+        p.getImageableY();
+        p.getImageableWidth();
+        p.getImageableHeight();
+    }
+}
diff --git a/jdk/test/java/awt/print/Headless/HeadlessPrinterJob.java b/jdk/test/java/awt/print/Headless/HeadlessPrinterJob.java
new file mode 100644
index 00000000000..ff7a22ec8a3
--- /dev/null
+++ b/jdk/test/java/awt/print/Headless/HeadlessPrinterJob.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.print.PrintService;
+import javax.print.attribute.PrintServiceAttributeSet;
+import java.awt.*;
+import java.awt.geom.Line2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.print.*;
+
+/*
+ * @test
+ * @summary Check that PrinterJob constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPrinterJob
+ */
+
+public class HeadlessPrinterJob {
+
+    class testPrintable implements Printable {
+
+        public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
+            Graphics2D g2 = (Graphics2D) graphics;
+
+            if (pageIndex >= 10) {
+                return Printable.NO_SUCH_PAGE;
+            }
+
+            int gridWidth = 400 / 6;
+            int gridHeight = 300 / 2;
+
+            int rowspacing = 5;
+            int columnspacing = 7;
+            int rectWidth = gridWidth - columnspacing;
+            int rectHeight = gridHeight - rowspacing;
+
+            Color fg3D = Color.lightGray;
+
+            g2.setPaint(fg3D);
+            g2.drawRect(80, 80, 400 - 1, 310);
+            g2.setPaint(Color.black);
+
+            int x = 85;
+            int y = 87;
+
+
+            // draw Line2D.Double
+            g2.draw(new Line2D.Double(x, y + rectHeight - 1, x + rectWidth, y));
+            x += gridWidth;
+
+            // draw Rectangle2D.Double
+            //g2.setStroke(stroke);
+            g2.draw(new Rectangle2D.Double(x, y, rectWidth, rectHeight));
+            x += gridWidth;
+
+            // draw  RoundRectangle2D.Double
+            //g2.setStroke(dashed);
+            g2.draw(new RoundRectangle2D.Double(x, y, rectWidth,
+                    rectHeight, 10, 10));
+            return Printable.PAGE_EXISTS;
+        }
+    }
+
+    class testPageable implements Pageable {
+
+        public int getNumberOfPages() {
+            return 10;
+        }
+
+        public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
+            PageFormat pf = null;
+            if (pageIndex >= 10) {
+                throw new IndexOutOfBoundsException("Wrong page#");
+            }
+            switch (pageIndex) {
+                case 0:
+                case 2:
+                case 4:
+                case 6:
+                case 8:
+                    pf = new PageFormat();
+                    pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+                    break;
+                case 1:
+                case 3:
+                case 5:
+                case 7:
+                case 9:
+                    pf = new PageFormat();
+                    pf.setOrientation(PageFormat.LANDSCAPE);
+                    break;
+            }
+            return pf;
+        }
+
+        public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
+            if (pageIndex >= 10) {
+                throw new IndexOutOfBoundsException("Wrong page#");
+            }
+            return new testPrintable();
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        new HeadlessPrinterJob().doTest();
+    }
+
+    void doTest() throws Exception {
+        PrinterJob pj = PrinterJob.getPrinterJob();
+        for (PrintService psl : pj.lookupPrintServices()) {
+            PrintServiceAttributeSet psas = psl.getAttributes();
+            pj.setPrintService(psl);
+        }
+        PrintService ps = pj.getPrintService();
+        pj.setPrintable(new testPrintable());
+
+        pj = PrinterJob.getPrinterJob();
+        PageFormat pf = new PageFormat();
+        pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+        pj.setPrintable(new testPrintable(), pf);
+        pj.setPageable(new testPageable());
+
+        boolean exceptions = false;
+        try {
+            pj.printDialog();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            pj = PrinterJob.getPrinterJob();
+            pf = new PageFormat();
+            pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+            pf = pj.pageDialog(pf);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        pf = new PageFormat();
+        pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+        pf = pj.defaultPage(pf);
+        pf = pj.defaultPage();
+
+        pf = new PageFormat();
+        pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+        pf = pj.validatePage(pf);
+        pj.setCopies(10);
+        pj.getCopies();
+        pj.getUserName();
+        pj.setJobName("no-job-name");
+        pj.getJobName();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessAbstractSpinnerModel.java b/jdk/test/javax/swing/Headless/HeadlessAbstractSpinnerModel.java
new file mode 100644
index 00000000000..74ca68ce4d3
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessAbstractSpinnerModel.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that AbstractSpinnerModel constructor and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAbstractSpinnerModel
+ */
+
+public class HeadlessAbstractSpinnerModel {
+    public static void main (String[] args){
+        AbstractSpinnerModel model = new AbstractSpinnerModel(){
+            public Object getValue() { return null; }
+            public void setValue(Object value) {}
+            public Object getNextValue() { return null; }
+            public Object getPreviousValue() { return null; }
+        };
+        model.getPreviousValue();
+        model.getNextValue();
+        model.setValue("next");
+        model.getValue();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessBox.java b/jdk/test/javax/swing/Headless/HeadlessBox.java
new file mode 100644
index 00000000000..ff3de6b83c3
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessBox.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Box constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBox
+ */
+
+public class HeadlessBox {
+
+    public static void main(String args[]) {
+        for (Box b : new Box[]{new Box(BoxLayout.X_AXIS), new Box(BoxLayout.Y_AXIS)}) {
+            b = Box.createHorizontalBox();
+            b = Box.createVerticalBox();
+            b = new Box(BoxLayout.Y_AXIS);
+            b.getAccessibleContext();
+            b.requestFocus();
+            b.requestFocusInWindow();
+            b.getPreferredSize();
+            b.getMaximumSize();
+            b.getMinimumSize();
+            b.contains(1, 2);
+            Component c1 = b.add(new Component() {
+            });
+            Component c2 = b.add(new Component() {
+            });
+            Component c3 = b.add(new Component() {
+            });
+            b.getComponentCount();
+            b.countComponents();
+            b.getComponent(1);
+            b.getComponent(2);
+            Component[] cs = b.getComponents();
+
+            boolean exceptions = false;
+            try {
+                b.setLayout(new BoxLayout(new Container(), BoxLayout.Y_AXIS));
+            } catch (AWTError e) {
+                exceptions = true;
+            }
+            if (!exceptions)
+                throw new RuntimeException("AWTError did not occur when expected");
+
+            exceptions = false;
+            try {
+                b.setLayout(new BoxLayout(new Container(), BoxLayout.X_AXIS));
+            } catch (AWTError e) {
+                exceptions = true;
+            }
+            if (!exceptions)
+                throw new RuntimeException("AWTError did not occur when expected");
+
+            b.getLayout();
+            b.invalidate();
+            b.validate();
+            b.revalidate();
+
+            Insets ins = b.getInsets();
+            b.getAlignmentY();
+            b.getAlignmentX();
+            b.getGraphics();
+            b.setVisible(false);
+            b.setVisible(true);
+            b.setEnabled(false);
+            b.setEnabled(true);
+            b.setForeground(Color.red);
+            b.setBackground(Color.red);
+
+            for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+                for (int j = 8; j < 17; j++) {
+                    Font f1 = new Font(font, Font.PLAIN, j);
+                    Font f2 = new Font(font, Font.BOLD, j);
+                    Font f3 = new Font(font, Font.ITALIC, j);
+                    Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                    b.setFont(f1);
+                    b.setFont(f2);
+                    b.setFont(f3);
+                    b.setFont(f4);
+
+                    b.getFontMetrics(f1);
+                    b.getFontMetrics(f2);
+                    b.getFontMetrics(f3);
+                    b.getFontMetrics(f4);
+
+                }
+            }
+
+            b.enable();
+            b.disable();
+            b.reshape(10, 10, 10, 10);
+            b.getBounds(new Rectangle(1, 1, 1, 1));
+            b.getSize(new Dimension(1, 2));
+            b.getSize(new Dimension(1, 2));
+            b.getLocation(new Point(1, 2));
+            b.getX();
+            b.getY();
+            b.getWidth();
+            b.getHeight();
+            b.isOpaque();
+            b.isValidateRoot();
+            b.isOptimizedDrawingEnabled();
+            b.isDoubleBuffered();
+
+            b.remove(0);
+            b.remove(c2);
+            b.removeAll();
+            b.layout();
+            b.preferredSize();
+            b.minimumSize();
+            b.getComponentAt(1, 2);
+            b.locate(1, 2);
+            b.getComponentAt(new Point(1, 2));
+            b.isFocusCycleRoot(new Container());
+            b.transferFocusBackward();
+            b.setName("goober");
+            b.getName();
+            b.getParent();
+            b.getPeer();
+            b.getGraphicsConfiguration();
+            b.getTreeLock();
+            b.getToolkit();
+            b.isValid();
+            b.isDisplayable();
+            b.isVisible();
+            b.isShowing();
+            b.isEnabled();
+            b.enable(false);
+            b.enable(true);
+            b.enableInputMethods(false);
+            b.enableInputMethods(true);
+            b.show();
+            b.show(false);
+            b.show(true);
+            b.hide();
+            b.getForeground();
+            b.isForegroundSet();
+            b.getBackground();
+            b.isBackgroundSet();
+            b.getFont();
+            b.isFontSet();
+            b.getLocale();
+            for (Locale locale : Locale.getAvailableLocales())
+                b.setLocale(locale);
+
+            b.getColorModel();
+            b.getLocation();
+
+            exceptions = false;
+            try {
+                b.getLocationOnScreen();
+            } catch (IllegalComponentStateException e) {
+                exceptions = true;
+            }
+            if (!exceptions)
+                throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+            b.location();
+            b.setLocation(1, 2);
+            b.move(1, 2);
+            b.setLocation(new Point(1, 2));
+            b.getSize();
+            b.size();
+            b.setSize(1, 32);
+            b.resize(1, 32);
+            b.setSize(new Dimension(1, 32));
+            b.resize(new Dimension(1, 32));
+            b.getBounds();
+            b.bounds();
+            b.setBounds(10, 10, 10, 10);
+            b.setBounds(new Rectangle(10, 10, 10, 10));
+            b.isLightweight();
+            b.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+            b.getCursor();
+            b.isCursorSet();
+            b.inside(1, 2);
+            b.contains(new Point(1, 2));
+            b.isFocusTraversable();
+            b.isFocusable();
+            b.setFocusable(true);
+            b.setFocusable(false);
+            b.transferFocus();
+            b.getFocusCycleRootAncestor();
+            b.nextFocus();
+            b.transferFocusUpCycle();
+            b.hasFocus();
+            b.isFocusOwner();
+            b.toString();
+            b.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+            b.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+            b.setComponentOrientation(ComponentOrientation.UNKNOWN);
+            b.getComponentOrientation();
+        }
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java b/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java
new file mode 100644
index 00000000000..970148f7c1b
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Box.Filler constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBox_Filler
+ */
+
+public class HeadlessBox_Filler {
+    public static void main(String args[]) {
+        Box.Filler bf = new Box.Filler(new Dimension(10, 10),
+                new Dimension(20, 20),
+                new Dimension(30, 30));
+        bf.getMinimumSize();
+        bf.getPreferredSize();
+        bf.getMaximumSize();
+        bf.getAccessibleContext();
+        bf.requestFocus();
+        bf.requestFocusInWindow();
+        bf.contains(1, 2);
+        Component c1 = bf.add(new Component(){});
+        Component c2 = bf.add(new Component(){});
+        Component c3 = bf.add(new Component(){});
+        Insets ins = bf.getInsets();
+        bf.getAlignmentY();
+        bf.getAlignmentX();
+        bf.getGraphics();
+        bf.setVisible(false);
+        bf.setVisible(true);
+        bf.setEnabled(false);
+        bf.setEnabled(true);
+        bf.setForeground(Color.red);
+        bf.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                bf.setFont(f1);
+                bf.setFont(f2);
+                bf.setFont(f3);
+                bf.setFont(f4);
+
+                bf.getFontMetrics(f1);
+                bf.getFontMetrics(f2);
+                bf.getFontMetrics(f3);
+                bf.getFontMetrics(f4);
+            }
+        }
+        bf.enable();
+        bf.disable();
+        bf.reshape(10, 10, 10, 10);
+        bf.getBounds(new Rectangle(1, 1, 1, 1));
+        bf.getSize(new Dimension(1, 2));
+        bf.getLocation(new Point(1, 2));
+        bf.getX();
+        bf.getY();
+        bf.getWidth();
+        bf.getHeight();
+        bf.isOpaque();
+        bf.isValidateRoot();
+        bf.isOptimizedDrawingEnabled();
+        bf.isDoubleBuffered();
+        bf.getComponentCount();
+        bf.countComponents();
+        bf.getComponent(1);
+        bf.getComponent(2);
+        Component[] cs = bf.getComponents();
+        bf.getLayout();
+        bf.setLayout(new FlowLayout());
+        bf.doLayout();
+        bf.layout();
+        bf.invalidate();
+        bf.validate();
+        bf.preferredSize();
+        bf.remove(0);
+        bf.remove(c2);
+        bf.removeAll();
+        bf.minimumSize();
+        bf.getComponentAt(1, 2);
+        bf.locate(1, 2);
+        bf.getComponentAt(new Point(1, 2));
+        bf.isFocusCycleRoot(new Container());
+        bf.transferFocusBackward();
+        bf.setName("goober");
+        bf.getName();
+        bf.getParent();
+        bf.getPeer();
+        bf.getGraphicsConfiguration();
+        bf.getTreeLock();
+        bf.getToolkit();
+        bf.isValid();
+        bf.isDisplayable();
+        bf.isVisible();
+        bf.isShowing();
+        bf.isEnabled();
+        bf.enable(false);
+        bf.enable(true);
+        bf.enableInputMethods(false);
+        bf.enableInputMethods(true);
+        bf.show();
+        bf.show(false);
+        bf.show(true);
+        bf.hide();
+        bf.getForeground();
+        bf.isForegroundSet();
+        bf.getBackground();
+        bf.isBackgroundSet();
+        bf.getFont();
+        bf.isFontSet();
+
+        Container c = new Container();
+        c.add(bf);
+        bf.getLocale();
+
+        for (Locale locale : Locale.getAvailableLocales())
+            bf.setLocale(locale);
+
+        bf.getColorModel();
+        bf.getLocation();
+
+        boolean exceptions = false;
+        try {
+            bf.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        bf.setLocation(1, 2);
+        bf.move(1, 2);
+        bf.setLocation(new Point(1, 2));
+        bf.getSize();
+        bf.size();
+        bf.setSize(1, 32);
+        bf.resize(1, 32);
+        bf.setSize(new Dimension(1, 32));
+        bf.resize(new Dimension(1, 32));
+        bf.getBounds();
+        bf.bounds();
+        bf.setBounds(10, 10, 10, 10);
+        bf.setBounds(new Rectangle(10, 10, 10, 10));
+        bf.isLightweight();
+        bf.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        bf.getCursor();
+        bf.isCursorSet();
+        bf.inside(1, 2);
+        bf.contains(new Point(1, 2));
+        bf.isFocusTraversable();
+        bf.isFocusable();
+        bf.setFocusable(true);
+        bf.setFocusable(false);
+        bf.transferFocus();
+        bf.getFocusCycleRootAncestor();
+        bf.nextFocus();
+        bf.transferFocusUpCycle();
+        bf.hasFocus();
+        bf.isFocusOwner();
+        bf.toString();
+        bf.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        bf.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        bf.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        bf.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java b/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java
new file mode 100644
index 00000000000..43494535241
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that CellRendererPane constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCellRendererPane
+ */
+
+public class HeadlessCellRendererPane {
+    public static void main(String args[]) {
+        CellRendererPane crp = new CellRendererPane();
+        Component c1 = crp.add(new Component(){});
+        Component c2 = crp.add(new Component(){});
+        Component c3 = crp.add(new Component(){});
+        crp.setLayout(new FlowLayout());
+        crp.invalidate();
+        crp.getAccessibleContext();
+        crp.getComponentCount();
+        crp.countComponents();
+        crp.getComponent(1);
+        crp.getComponent(2);
+        Component[] cs = crp.getComponents();
+        Insets ins = crp.getInsets();
+        ins = crp.insets();
+        crp.getLayout();
+        crp.setLayout(new FlowLayout());
+        crp.setLayout(new FlowLayout());
+        crp.doLayout();
+        crp.layout();
+        crp.invalidate();
+        crp.validate();
+        crp.remove(0);
+        crp.remove((Component) c2);
+        crp.removeAll();
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                crp.setFont(f1);
+                crp.setFont(f2);
+                crp.setFont(f3);
+                crp.setFont(f4);
+
+                crp.getFontMetrics(f1);
+                crp.getFontMetrics(f2);
+                crp.getFontMetrics(f3);
+                crp.getFontMetrics(f4);
+            }
+        }
+        crp.getPreferredSize();
+        crp.preferredSize();
+        crp.getMinimumSize();
+        crp.minimumSize();
+        crp.getMaximumSize();
+        crp.getAlignmentX();
+        crp.getAlignmentY();
+        crp.getComponentAt(1, 2);
+        crp.locate(1, 2);
+        crp.getComponentAt(new Point(1, 2));
+        crp.isFocusCycleRoot(new Container());
+        crp.transferFocusBackward();
+        crp.setName("goober");
+        crp.getName();
+        crp.getParent();
+        crp.getPeer();
+        crp.getGraphicsConfiguration();
+        crp.getTreeLock();
+        crp.getToolkit();
+        crp.isValid();
+        crp.isDisplayable();
+        crp.isVisible();
+        crp.isShowing();
+        crp.isEnabled();
+        crp.setEnabled(false);
+        crp.setEnabled(true);
+        crp.enable();
+        crp.enable(false);
+        crp.enable(true);
+        crp.disable();
+        crp.isDoubleBuffered();
+        crp.enableInputMethods(false);
+        crp.enableInputMethods(true);
+        crp.setVisible(false);
+        crp.setVisible(true);
+        crp.show();
+        crp.show(false);
+        crp.show(true);
+        crp.hide();
+        crp.getForeground();
+        crp.setForeground(Color.red);
+        crp.isForegroundSet();
+        crp.getBackground();
+        crp.setBackground(Color.red);
+        crp.isBackgroundSet();
+        crp.getFont();
+        crp.isFontSet();
+
+        boolean exceptions = false;
+        try {
+            Container c = new Container();
+            c.add(crp);
+            crp.getLocale();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        for (Locale locale : Locale.getAvailableLocales())
+            crp.setLocale(locale);
+
+        crp.getColorModel();
+        crp.getLocation();
+
+        exceptions = false;
+        try {
+            crp.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        crp.location();
+        crp.setLocation(1, 2);
+        crp.move(1, 2);
+        crp.setLocation(new Point(1, 2));
+        crp.getSize();
+        crp.size();
+        crp.setSize(1, 32);
+        crp.resize(1, 32);
+        crp.setSize(new Dimension(1, 32));
+        crp.resize(new Dimension(1, 32));
+        crp.getBounds();
+        crp.bounds();
+        crp.setBounds(10, 10, 10, 10);
+        crp.reshape(10, 10, 10, 10);
+        crp.setBounds(new Rectangle(10, 10, 10, 10));
+        crp.getX();
+        crp.getY();
+        crp.getWidth();
+        crp.getHeight();
+        crp.getBounds(new Rectangle(1, 1, 1, 1));
+        crp.getSize(new Dimension(1, 2));
+        crp.getLocation(new Point(1, 2));
+        crp.isOpaque();
+        crp.isLightweight();
+        crp.getGraphics();
+        crp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        crp.getCursor();
+        crp.isCursorSet();
+        crp.contains(1, 2);
+        crp.inside(1, 2);
+        crp.contains(new Point(1, 2));
+        crp.isFocusTraversable();
+        crp.isFocusable();
+        crp.setFocusable(true);
+        crp.setFocusable(false);
+        crp.requestFocus();
+        crp.requestFocusInWindow();
+        crp.transferFocus();
+        crp.getFocusCycleRootAncestor();
+        crp.nextFocus();
+        crp.transferFocusUpCycle();
+        crp.hasFocus();
+        crp.isFocusOwner();
+        crp.toString();
+        crp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        crp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        crp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        crp.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java
new file mode 100644
index 00000000000..efac418a393
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that DefaultListCellRenderer constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultListCellRenderer
+ */
+
+public class HeadlessDefaultListCellRenderer {
+    public static void main(String args[]) {
+        DefaultListCellRenderer dcr = new DefaultListCellRenderer();
+        Component c1 = dcr.add(new Component(){});
+        Component c2 = dcr.add(new Component(){});
+        Component c3 = dcr.add(new Component(){});
+        dcr.setLayout(new FlowLayout());
+        dcr.invalidate();
+        dcr.validate();
+        dcr.getAccessibleContext();
+        dcr.requestFocus();
+        dcr.requestFocusInWindow();
+        dcr.getPreferredSize();
+        dcr.getMaximumSize();
+        dcr.getMinimumSize();
+        dcr.contains(1, 2);
+        Insets ins = dcr.getInsets();
+        dcr.getAlignmentY();
+        dcr.getAlignmentX();
+        dcr.getGraphics();
+        dcr.setVisible(false);
+        dcr.setVisible(true);
+        dcr.setEnabled(false);
+        dcr.setEnabled(true);
+        dcr.setForeground(Color.red);
+        dcr.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                dcr.setFont(f1);
+                dcr.setFont(f2);
+                dcr.setFont(f3);
+                dcr.setFont(f4);
+
+                dcr.getFontMetrics(f1);
+                dcr.getFontMetrics(f2);
+                dcr.getFontMetrics(f3);
+                dcr.getFontMetrics(f4);
+            }
+        }
+        dcr.enable();
+        dcr.disable();
+        dcr.reshape(10, 10, 10, 10);
+        dcr.getBounds(new Rectangle(1, 1, 1, 1));
+        dcr.getSize(new Dimension(1, 2));
+        dcr.getLocation(new Point(1, 2));
+        dcr.getX();
+        dcr.getY();
+        dcr.getWidth();
+        dcr.getHeight();
+        dcr.isOpaque();
+        dcr.isValidateRoot();
+        dcr.isOptimizedDrawingEnabled();
+        dcr.isDoubleBuffered();
+        dcr.getComponentCount();
+        dcr.countComponents();
+        dcr.getComponent(1);
+        dcr.getComponent(2);
+        Component[] cs = dcr.getComponents();
+        ins = dcr.insets();
+        dcr.remove(0);
+        dcr.remove((java.awt.Component) c2);
+        dcr.removeAll();
+        dcr.getLayout();
+        dcr.setLayout(new FlowLayout());
+        dcr.doLayout();
+        dcr.layout();
+        dcr.invalidate();
+        dcr.validate();
+        dcr.revalidate();
+        dcr.preferredSize();
+        dcr.minimumSize();
+        dcr.getComponentAt(1, 2);
+        dcr.locate(1, 2);
+        dcr.getComponentAt(new Point(1, 2));
+        dcr.isFocusCycleRoot(new Container());
+        dcr.transferFocusBackward();
+        dcr.setName("goober");
+        dcr.getName();
+        dcr.getParent();
+        dcr.getPeer();
+        dcr.getGraphicsConfiguration();
+        dcr.getTreeLock();
+        dcr.getToolkit();
+        dcr.isValid();
+        dcr.isDisplayable();
+        dcr.isVisible();
+        dcr.isShowing();
+        dcr.isEnabled();
+        dcr.enable(false);
+        dcr.enable(true);
+        dcr.enableInputMethods(false);
+        dcr.enableInputMethods(true);
+        dcr.show();
+        dcr.show(false);
+        dcr.show(true);
+        dcr.hide();
+        dcr.getForeground();
+        dcr.isForegroundSet();
+        dcr.getBackground();
+        dcr.isBackgroundSet();
+        dcr.getFont();
+        dcr.isFontSet();
+
+        Container c = new Container();
+        c.add(dcr);
+        dcr.getLocale();
+
+        for (Locale locale : Locale.getAvailableLocales())
+            dcr.setLocale(locale);
+
+        dcr.getColorModel();
+        dcr.getLocation();
+
+        boolean exceptions = false;
+        try {
+            dcr.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        dcr.location();
+        dcr.setLocation(1, 2);
+        dcr.move(1, 2);
+        dcr.setLocation(new Point(1, 2));
+        dcr.getSize();
+        dcr.size();
+        dcr.setSize(1, 32);
+        dcr.resize(1, 32);
+        dcr.setSize(new Dimension(1, 32));
+        dcr.resize(new Dimension(1, 32));
+        dcr.getBounds();
+        dcr.bounds();
+        dcr.setBounds(10, 10, 10, 10);
+        dcr.setBounds(new Rectangle(10, 10, 10, 10));
+        dcr.isLightweight();
+        dcr.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        dcr.getCursor();
+        dcr.isCursorSet();
+        dcr.inside(1, 2);
+        dcr.contains(new Point(1, 2));
+        dcr.isFocusTraversable();
+        dcr.isFocusable();
+        dcr.setFocusable(true);
+        dcr.setFocusable(false);
+        dcr.transferFocus();
+        dcr.getFocusCycleRootAncestor();
+        dcr.nextFocus();
+        dcr.transferFocusUpCycle();
+        dcr.hasFocus();
+        dcr.isFocusOwner();
+        dcr.toString();
+        dcr.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        dcr.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        dcr.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        dcr.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java
new file mode 100644
index 00000000000..457a1b0a9a6
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that DefaultListCellRenderer.UIResource constructors and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultListCellRenderer_UIResource
+ */
+
+public class HeadlessDefaultListCellRenderer_UIResource {
+    public static void main(String args[]) {
+        DefaultListCellRenderer.UIResource dcr = new DefaultListCellRenderer.UIResource();
+        Component c1 = dcr.add(new Component(){});
+        Component c2 = dcr.add(new Component(){});
+        Component c3 = dcr.add(new Component(){});
+        dcr.setLayout(new FlowLayout());
+        dcr.invalidate();
+        dcr.validate();
+        dcr.getAccessibleContext();
+        dcr.requestFocus();
+        dcr.requestFocusInWindow();
+        dcr.getPreferredSize();
+        dcr.getMaximumSize();
+        dcr.getMinimumSize();
+        dcr.contains(1, 2);
+        Insets ins = dcr.getInsets();
+        dcr.getAlignmentY();
+        dcr.getAlignmentX();
+        dcr.getGraphics();
+        dcr.setVisible(false);
+        dcr.setVisible(true);
+        dcr.setEnabled(false);
+        dcr.setEnabled(true);
+        dcr.setForeground(Color.red);
+        dcr.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                dcr.setFont(f1);
+                dcr.setFont(f2);
+                dcr.setFont(f3);
+                dcr.setFont(f4);
+
+                dcr.getFontMetrics(f1);
+                dcr.getFontMetrics(f2);
+                dcr.getFontMetrics(f3);
+                dcr.getFontMetrics(f4);
+            }
+        }
+        dcr.enable();
+        dcr.disable();
+        dcr.reshape(10, 10, 10, 10);
+        dcr.getBounds(new Rectangle(1, 1, 1, 1));
+        dcr.getSize(new Dimension(1, 2));
+        dcr.getLocation(new Point(1, 2));
+        dcr.getX();
+        dcr.getY();
+        dcr.getWidth();
+        dcr.getHeight();
+        dcr.isOpaque();
+        dcr.isValidateRoot();
+        dcr.isOptimizedDrawingEnabled();
+        dcr.isDoubleBuffered();
+        dcr.getComponentCount();
+        dcr.countComponents();
+        dcr.getComponent(1);
+        dcr.getComponent(2);
+        Component[] cs = dcr.getComponents();
+        ins = dcr.insets();
+        dcr.remove(0);
+        dcr.remove((java.awt.Component) c2);
+        dcr.removeAll();
+        dcr.getLayout();
+        dcr.setLayout(new FlowLayout());
+        dcr.doLayout();
+        dcr.layout();
+        dcr.invalidate();
+        dcr.validate();
+        dcr.revalidate();
+        dcr.preferredSize();
+        dcr.minimumSize();
+        dcr.getComponentAt(1, 2);
+        dcr.locate(1, 2);
+        dcr.getComponentAt(new Point(1, 2));
+        dcr.isFocusCycleRoot(new Container());
+        dcr.transferFocusBackward();
+        dcr.setName("goober");
+        dcr.getName();
+        dcr.getParent();
+        dcr.getPeer();
+        dcr.getGraphicsConfiguration();
+        dcr.getTreeLock();
+        dcr.getToolkit();
+        dcr.isValid();
+        dcr.isDisplayable();
+        dcr.isVisible();
+        dcr.isShowing();
+        dcr.isEnabled();
+        dcr.enable(false);
+        dcr.enable(true);
+        dcr.enableInputMethods(false);
+        dcr.enableInputMethods(true);
+        dcr.show();
+        dcr.show(false);
+        dcr.show(true);
+        dcr.hide();
+        dcr.getForeground();
+        dcr.isForegroundSet();
+        dcr.getBackground();
+        dcr.isBackgroundSet();
+        dcr.getFont();
+        dcr.isFontSet();
+
+        Container c = new Container();
+        c.add(dcr);
+        dcr.getLocale();
+
+        for (Locale locale : Locale.getAvailableLocales())
+            dcr.setLocale(locale);
+
+        dcr.getColorModel();
+        dcr.getLocation();
+
+        boolean exceptions = false;
+        try {
+            dcr.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        dcr.location();
+        dcr.setLocation(1, 2);
+        dcr.move(1, 2);
+        dcr.setLocation(new Point(1, 2));
+        dcr.getSize();
+        dcr.size();
+        dcr.setSize(1, 32);
+        dcr.resize(1, 32);
+        dcr.setSize(new Dimension(1, 32));
+        dcr.resize(new Dimension(1, 32));
+        dcr.getBounds();
+        dcr.bounds();
+        dcr.setBounds(10, 10, 10, 10);
+        dcr.setBounds(new Rectangle(10, 10, 10, 10));
+        dcr.isLightweight();
+        dcr.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        dcr.getCursor();
+        dcr.isCursorSet();
+        dcr.inside(1, 2);
+        dcr.contains(new Point(1, 2));
+        dcr.isFocusTraversable();
+        dcr.isFocusable();
+        dcr.setFocusable(true);
+        dcr.setFocusable(false);
+        dcr.transferFocus();
+        dcr.getFocusCycleRootAncestor();
+        dcr.nextFocus();
+        dcr.transferFocusUpCycle();
+        dcr.hasFocus();
+        dcr.isFocusOwner();
+        dcr.toString();
+        dcr.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        dcr.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        dcr.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        dcr.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessGrayFilter.java b/jdk/test/javax/swing/Headless/HeadlessGrayFilter.java
new file mode 100644
index 00000000000..07320b9bbf0
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessGrayFilter.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that GrayFilter constructor and clone() method do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGrayFilter
+ */
+
+public class HeadlessGrayFilter {
+    public static void main(String args[]) {
+         new GrayFilter(true, 60).clone();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJApplet.java b/jdk/test/javax/swing/Headless/HeadlessJApplet.java
new file mode 100644
index 00000000000..e0ac858ac09
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJApplet.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.JApplet;
+import java.awt.HeadlessException;
+
+/*
+ * @test
+ * @summary Check that JApplet constructor throws HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJApplet
+ */
+
+public class HeadlessJApplet {
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        try {
+            new JApplet();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJButton.java b/jdk/test/javax/swing/Headless/HeadlessJButton.java
new file mode 100644
index 00000000000..7f80803f247
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJButton.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JButton constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJButton
+ */
+
+public class HeadlessJButton {
+    public static void main(String args[]) {
+        JButton b = new JButton();
+        b = new JButton("Press me");
+        b.getAccessibleContext();
+        b.isFocusTraversable();
+        b.setEnabled(false);
+        b.setEnabled(true);
+        b.requestFocus();
+        b.requestFocusInWindow();
+        b.getPreferredSize();
+        b.getMaximumSize();
+        b.getMinimumSize();
+        b.contains(1, 2);
+        Component c1 = b.add(new Component(){});
+        Component c2 = b.add(new Component(){});
+        Component c3 = b.add(new Component(){});
+        Insets ins = b.getInsets();
+        b.getAlignmentY();
+        b.getAlignmentX();
+        b.getGraphics();
+        b.setVisible(false);
+        b.setVisible(true);
+        b.setForeground(Color.red);
+        b.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                b.setFont(f1);
+                b.setFont(f2);
+                b.setFont(f3);
+                b.setFont(f4);
+
+                b.getFontMetrics(f1);
+                b.getFontMetrics(f2);
+                b.getFontMetrics(f3);
+                b.getFontMetrics(f4);
+            }
+        }
+        b.enable();
+        b.disable();
+        b.reshape(10, 10, 10, 10);
+        b.getBounds(new Rectangle(1, 1, 1, 1));
+        b.getSize(new Dimension(1, 2));
+        b.getLocation(new Point(1, 2));
+        b.getX();
+        b.getY();
+        b.getWidth();
+        b.getHeight();
+        b.isOpaque();
+        b.isValidateRoot();
+        b.isOptimizedDrawingEnabled();
+        b.isDoubleBuffered();
+        b.getComponentCount();
+        b.countComponents();
+        b.getComponent(1);
+        b.getComponent(2);
+        Component[] cs = b.getComponents();
+        b.getLayout();
+        b.setLayout(new FlowLayout());
+        b.doLayout();
+        b.layout();
+        b.invalidate();
+        b.validate();
+        b.remove(0);
+        b.remove(c2);
+        b.removeAll();
+        b.preferredSize();
+        b.minimumSize();
+        b.getComponentAt(1, 2);
+        b.locate(1, 2);
+        b.getComponentAt(new Point(1, 2));
+        b.isFocusCycleRoot(new Container());
+        b.transferFocusBackward();
+        b.setName("goober");
+        b.getName();
+        b.getParent();
+        b.getPeer();
+        b.getGraphicsConfiguration();
+        b.getTreeLock();
+        b.getToolkit();
+        b.isValid();
+        b.isDisplayable();
+        b.isVisible();
+        b.isShowing();
+        b.isEnabled();
+        b.enable(false);
+        b.enable(true);
+        b.enableInputMethods(false);
+        b.enableInputMethods(true);
+        b.show();
+        b.show(false);
+        b.show(true);
+        b.hide();
+        b.getForeground();
+        b.isForegroundSet();
+        b.getBackground();
+        b.isBackgroundSet();
+        b.getFont();
+        b.isFontSet();
+        Container c = new Container();
+        c.add(b);
+        b.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            b.setLocale(locale);
+
+        b.getColorModel();
+        b.getLocation();
+
+        boolean exceptions = false;
+        try {
+            b.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        b.location();
+        b.setLocation(1, 2);
+        b.move(1, 2);
+        b.setLocation(new Point(1, 2));
+        b.getSize();
+        b.size();
+        b.setSize(1, 32);
+        b.resize(1, 32);
+        b.setSize(new Dimension(1, 32));
+        b.resize(new Dimension(1, 32));
+        b.getBounds();
+        b.bounds();
+        b.setBounds(10, 10, 10, 10);
+        b.setBounds(new Rectangle(10, 10, 10, 10));
+        b.isLightweight();
+        b.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        b.getCursor();
+        b.isCursorSet();
+        b.inside(1, 2);
+        b.contains(new Point(1, 2));
+        b.isFocusable();
+        b.setFocusable(true);
+        b.setFocusable(false);
+        b.transferFocus();
+        b.getFocusCycleRootAncestor();
+        b.nextFocus();
+        b.transferFocusUpCycle();
+        b.hasFocus();
+        b.isFocusOwner();
+        b.toString();
+        b.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        b.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        b.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        b.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java b/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java
new file mode 100644
index 00000000000..9fd98563682
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JCheckBox constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJCheckBox
+ */
+
+public class HeadlessJCheckBox {
+    public static void main(String args[]) {
+        JCheckBox ch;
+        ch = new JCheckBox();
+        ch = new JCheckBox("Press me");
+        ch = new JCheckBox("Press me", true);
+        ch = new JCheckBox("Press me", false);
+        ch.getAccessibleContext();
+        ch.isFocusTraversable();
+        ch.setEnabled(false);
+        ch.setEnabled(true);
+        ch.requestFocus();
+        ch.requestFocusInWindow();
+        ch.getPreferredSize();
+        ch.getMaximumSize();
+        ch.getMinimumSize();
+        ch.contains(1, 2);
+        Component c1 = ch.add(new Component(){});
+        Component c2 = ch.add(new Component(){});
+        Component c3 = ch.add(new Component(){});
+        Insets ins = ch.getInsets();
+        ch.getAlignmentY();
+        ch.getAlignmentX();
+        ch.getGraphics();
+        ch.setVisible(false);
+        ch.setVisible(true);
+        ch.setForeground(Color.red);
+        ch.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                ch.setFont(f1);
+                ch.setFont(f2);
+                ch.setFont(f3);
+                ch.setFont(f4);
+
+                ch.getFontMetrics(f1);
+                ch.getFontMetrics(f2);
+                ch.getFontMetrics(f3);
+                ch.getFontMetrics(f4);
+            }
+        }
+        ch.enable();
+        ch.disable();
+        ch.reshape(10, 10, 10, 10);
+        ch.getBounds(new Rectangle(1, 1, 1, 1));
+        ch.getSize(new Dimension(1, 2));
+        ch.getLocation(new Point(1, 2));
+        ch.getX();
+        ch.getY();
+        ch.getWidth();
+        ch.getHeight();
+        ch.isOpaque();
+        ch.isValidateRoot();
+        ch.isOptimizedDrawingEnabled();
+        ch.isDoubleBuffered();
+        ch.getComponentCount();
+        ch.countComponents();
+        ch.getComponent(1);
+        ch.getComponent(2);
+        Component[] cs = ch.getComponents();
+        ch.getLayout();
+        ch.setLayout(new FlowLayout());
+        ch.doLayout();
+        ch.layout();
+        ch.invalidate();
+        ch.validate();
+        ch.remove(0);
+        ch.remove(c2);
+        ch.removeAll();
+        ch.preferredSize();
+        ch.minimumSize();
+        ch.getComponentAt(1, 2);
+        ch.locate(1, 2);
+        ch.getComponentAt(new Point(1, 2));
+        ch.isFocusCycleRoot(new Container());
+        ch.transferFocusBackward();
+        ch.setName("goober");
+        ch.getName();
+        ch.getParent();
+        ch.getPeer();
+        ch.getGraphicsConfiguration();
+        ch.getTreeLock();
+        ch.getToolkit();
+        ch.isValid();
+        ch.isDisplayable();
+        ch.isVisible();
+        ch.isShowing();
+        ch.isEnabled();
+        ch.enable(false);
+        ch.enable(true);
+        ch.enableInputMethods(false);
+        ch.enableInputMethods(true);
+        ch.show();
+        ch.show(false);
+        ch.show(true);
+        ch.hide();
+        ch.getForeground();
+        ch.isForegroundSet();
+        ch.getBackground();
+        ch.isBackgroundSet();
+        ch.getFont();
+        ch.isFontSet();
+        Container c = new Container();
+        c.add(ch);
+        ch.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            ch.setLocale(locale);
+
+        ch.getColorModel();
+        ch.getLocation();
+
+        boolean exceptions = false;
+        try {
+            ch.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        ch.location();
+        ch.setLocation(1, 2);
+        ch.move(1, 2);
+        ch.setLocation(new Point(1, 2));
+        ch.getSize();
+        ch.size();
+        ch.setSize(1, 32);
+        ch.resize(1, 32);
+        ch.setSize(new Dimension(1, 32));
+        ch.resize(new Dimension(1, 32));
+        ch.getBounds();
+        ch.bounds();
+        ch.setBounds(10, 10, 10, 10);
+        ch.setBounds(new Rectangle(10, 10, 10, 10));
+        ch.isLightweight();
+        ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        ch.getCursor();
+        ch.isCursorSet();
+        ch.inside(1, 2);
+        ch.contains(new Point(1, 2));
+        ch.isFocusable();
+        ch.setFocusable(true);
+        ch.setFocusable(false);
+        ch.transferFocus();
+        ch.getFocusCycleRootAncestor();
+        ch.nextFocus();
+        ch.transferFocusUpCycle();
+        ch.hasFocus();
+        ch.isFocusOwner();
+        ch.toString();
+        ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        ch.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java b/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java
new file mode 100644
index 00000000000..80673aae532
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JCheckBoxMenuItem constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJCheckBoxMenuItem
+ */
+
+public class HeadlessJCheckBoxMenuItem {
+    public static void main(String args[]) {
+        JCheckBoxMenuItem ch;
+        ch = new JCheckBoxMenuItem();
+        ch.getAccessibleContext();
+        ch.isFocusTraversable();
+        ch.setEnabled(false);
+        ch.setEnabled(true);
+        ch.requestFocus();
+        ch.requestFocusInWindow();
+        ch.getPreferredSize();
+        ch.getMaximumSize();
+        ch.getMinimumSize();
+        ch.contains(1, 2);
+        Component c1 = ch.add(new Component(){});
+        Component c2 = ch.add(new Component(){});
+        Component c3 = ch.add(new Component(){});
+        Insets ins = ch.getInsets();
+        ch.getAlignmentY();
+        ch.getAlignmentX();
+        ch.getGraphics();
+        ch.setVisible(false);
+        ch.setVisible(true);
+        ch.setForeground(Color.red);
+        ch.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                ch.setFont(f1);
+                ch.setFont(f2);
+                ch.setFont(f3);
+                ch.setFont(f4);
+
+                ch.getFontMetrics(f1);
+                ch.getFontMetrics(f2);
+                ch.getFontMetrics(f3);
+                ch.getFontMetrics(f4);
+            }
+        }
+        ch.enable();
+        ch.disable();
+        ch.reshape(10, 10, 10, 10);
+        ch.getBounds(new Rectangle(1, 1, 1, 1));
+        ch.getSize(new Dimension(1, 2));
+        ch.getLocation(new Point(1, 2));
+        ch.getX();
+        ch.getY();
+        ch.getWidth();
+        ch.getHeight();
+        ch.isOpaque();
+        ch.isValidateRoot();
+        ch.isOptimizedDrawingEnabled();
+        ch.isDoubleBuffered();
+        ch.getComponentCount();
+        ch.countComponents();
+        ch.getComponent(1);
+        ch.getComponent(2);
+        Component[] cs = ch.getComponents();
+        ch.getLayout();
+        ch.setLayout(new FlowLayout());
+        ch.doLayout();
+        ch.layout();
+        ch.invalidate();
+        ch.validate();
+        ch.remove(0);
+        ch.remove(c2);
+        ch.removeAll();
+        ch.preferredSize();
+        ch.minimumSize();
+        ch.getComponentAt(1, 2);
+        ch.locate(1, 2);
+        ch.getComponentAt(new Point(1, 2));
+        ch.isFocusCycleRoot(new Container());
+        ch.transferFocusBackward();
+        ch.setName("goober");
+        ch.getName();
+        ch.getParent();
+        ch.getPeer();
+        ch.getGraphicsConfiguration();
+        ch.getTreeLock();
+        ch.getToolkit();
+        ch.isValid();
+        ch.isDisplayable();
+        ch.isVisible();
+        ch.isShowing();
+        ch.isEnabled();
+        ch.enable(false);
+        ch.enable(true);
+        ch.enableInputMethods(false);
+        ch.enableInputMethods(true);
+        ch.show();
+        ch.show(false);
+        ch.show(true);
+        ch.hide();
+        ch.getForeground();
+        ch.isForegroundSet();
+        ch.getBackground();
+        ch.isBackgroundSet();
+        ch.getFont();
+        ch.isFontSet();
+        Container c = new Container();
+        c.add(ch);
+        ch.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            ch.setLocale(locale);
+
+        ch.getColorModel();
+        ch.getLocation();
+
+        boolean exceptions = false;
+        try {
+            ch.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        ch.location();
+        ch.setLocation(1, 2);
+        ch.move(1, 2);
+        ch.setLocation(new Point(1, 2));
+        ch.getSize();
+        ch.size();
+        ch.setSize(1, 32);
+        ch.resize(1, 32);
+        ch.setSize(new Dimension(1, 32));
+        ch.resize(new Dimension(1, 32));
+        ch.getBounds();
+        ch.bounds();
+        ch.setBounds(10, 10, 10, 10);
+        ch.setBounds(new Rectangle(10, 10, 10, 10));
+        ch.isLightweight();
+        ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        ch.getCursor();
+        ch.isCursorSet();
+        ch.inside(1, 2);
+        ch.contains(new Point(1, 2));
+        ch.isFocusable();
+        ch.setFocusable(true);
+        ch.setFocusable(false);
+        ch.transferFocus();
+        ch.getFocusCycleRootAncestor();
+        ch.nextFocus();
+        ch.transferFocusUpCycle();
+        ch.hasFocus();
+        ch.isFocusOwner();
+        ch.toString();
+        ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        ch.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java b/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java
new file mode 100644
index 00000000000..a78383c2800
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JColorChooser constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJColorChooser
+ */
+
+public class HeadlessJColorChooser {
+    public static void main(String args[]) {
+        JColorChooser cc;
+        cc = new JColorChooser();
+        cc.getAccessibleContext();
+        cc.isFocusTraversable();
+        cc.setEnabled(false);
+        cc.setEnabled(true);
+        cc.requestFocus();
+        cc.requestFocusInWindow();
+        cc.getPreferredSize();
+        cc.getMaximumSize();
+        cc.getMinimumSize();
+        cc.contains(1, 2);
+        Component c1 = cc.add(new Component(){});
+        Component c2 = cc.add(new Component(){});
+        Component c3 = cc.add(new Component(){});
+        Insets ins = cc.getInsets();
+        cc.getAlignmentY();
+        cc.getAlignmentX();
+        cc.getGraphics();
+        cc.setVisible(false);
+        cc.setVisible(true);
+        cc.setForeground(Color.red);
+        cc.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                cc.setFont(f1);
+                cc.setFont(f2);
+                cc.setFont(f3);
+                cc.setFont(f4);
+
+                cc.getFontMetrics(f1);
+                cc.getFontMetrics(f2);
+                cc.getFontMetrics(f3);
+                cc.getFontMetrics(f4);
+            }
+        }
+        cc.enable();
+        cc.disable();
+        cc.reshape(10, 10, 10, 10);
+        cc.getBounds(new Rectangle(1, 1, 1, 1));
+        cc.getSize(new Dimension(1, 2));
+        cc.getLocation(new Point(1, 2));
+        cc.getX();
+        cc.getY();
+        cc.getWidth();
+        cc.getHeight();
+        cc.isOpaque();
+        cc.isValidateRoot();
+        cc.isOptimizedDrawingEnabled();
+        cc.isDoubleBuffered();
+        cc.getComponentCount();
+        cc.countComponents();
+        cc.getComponent(1);
+        cc.getComponent(2);
+        Component[] cs = cc.getComponents();
+        cc.getLayout();
+        cc.setLayout(new FlowLayout());
+        cc.doLayout();
+        cc.layout();
+        cc.invalidate();
+        cc.validate();
+        cc.remove(0);
+        cc.remove(c2);
+        cc.removeAll();
+        cc.preferredSize();
+        cc.minimumSize();
+        cc.getComponentAt(1, 2);
+        cc.locate(1, 2);
+        cc.getComponentAt(new Point(1, 2));
+        cc.isFocusCycleRoot(new Container());
+        cc.transferFocusBackward();
+        cc.setName("goober");
+        cc.getName();
+        cc.getParent();
+        cc.getPeer();
+        cc.getGraphicsConfiguration();
+        cc.getTreeLock();
+        cc.getToolkit();
+        cc.isValid();
+        cc.isDisplayable();
+        cc.isVisible();
+        cc.isShowing();
+        cc.isEnabled();
+        cc.enable(false);
+        cc.enable(true);
+        cc.enableInputMethods(false);
+        cc.enableInputMethods(true);
+        cc.show();
+        cc.show(false);
+        cc.show(true);
+        cc.hide();
+        cc.getForeground();
+        cc.isForegroundSet();
+        cc.getBackground();
+        cc.isBackgroundSet();
+        cc.getFont();
+        cc.isFontSet();
+        Container c = new Container();
+        c.add(cc);
+        cc.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            cc.setLocale(locale);
+
+        cc.getColorModel();
+        cc.getLocation();
+
+        boolean exceptions = false;
+        try {
+            cc.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        cc.location();
+        cc.setLocation(1, 2);
+        cc.move(1, 2);
+        cc.setLocation(new Point(1, 2));
+        cc.getSize();
+        cc.size();
+        cc.setSize(1, 32);
+        cc.resize(1, 32);
+        cc.setSize(new Dimension(1, 32));
+        cc.resize(new Dimension(1, 32));
+        cc.getBounds();
+        cc.bounds();
+        cc.setBounds(10, 10, 10, 10);
+        cc.setBounds(new Rectangle(10, 10, 10, 10));
+        cc.isLightweight();
+        cc.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        cc.getCursor();
+        cc.isCursorSet();
+        cc.inside(1, 2);
+        cc.contains(new Point(1, 2));
+        cc.isFocusable();
+        cc.setFocusable(true);
+        cc.setFocusable(false);
+        cc.transferFocus();
+        cc.getFocusCycleRootAncestor();
+        cc.nextFocus();
+        cc.transferFocusUpCycle();
+        cc.hasFocus();
+        cc.isFocusOwner();
+        cc.toString();
+        cc.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        cc.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        cc.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        cc.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJComboBox.java b/jdk/test/javax/swing/Headless/HeadlessJComboBox.java
new file mode 100644
index 00000000000..b5160543db2
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJComboBox.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JComboBox constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJComboBox
+ */
+
+public class HeadlessJComboBox {
+    public static void main(String args[]) {
+        JComboBox ch;
+        ch = new JComboBox();
+        ch.getAccessibleContext();
+        ch.isFocusTraversable();
+        ch.setEnabled(false);
+        ch.setEnabled(true);
+        ch.requestFocus();
+        ch.requestFocusInWindow();
+        ch.getPreferredSize();
+        ch.getMaximumSize();
+        ch.getMinimumSize();
+        ch.contains(1, 2);
+        Component c1 = ch.add(new Component(){});
+        Component c2 = ch.add(new Component(){});
+        Component c3 = ch.add(new Component(){});
+        Insets ins = ch.getInsets();
+        ch.getAlignmentY();
+        ch.getAlignmentX();
+        ch.getGraphics();
+        ch.setVisible(false);
+        ch.setVisible(true);
+        ch.setForeground(Color.red);
+        ch.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                ch.setFont(f1);
+                ch.setFont(f2);
+                ch.setFont(f3);
+                ch.setFont(f4);
+
+                ch.getFontMetrics(f1);
+                ch.getFontMetrics(f2);
+                ch.getFontMetrics(f3);
+                ch.getFontMetrics(f4);
+            }
+        }
+        ch.enable();
+        ch.disable();
+        ch.reshape(10, 10, 10, 10);
+        ch.getBounds(new Rectangle(1, 1, 1, 1));
+        ch.getSize(new Dimension(1, 2));
+        ch.getLocation(new Point(1, 2));
+        ch.getX();
+        ch.getY();
+        ch.getWidth();
+        ch.getHeight();
+        ch.isOpaque();
+        ch.isValidateRoot();
+        ch.isOptimizedDrawingEnabled();
+        ch.isDoubleBuffered();
+        ch.getComponentCount();
+        ch.countComponents();
+        ch.getComponent(1);
+        ch.getComponent(2);
+        Component[] cs = ch.getComponents();
+        ch.getLayout();
+        ch.setLayout(new FlowLayout());
+        ch.doLayout();
+        ch.layout();
+        ch.invalidate();
+        ch.validate();
+        ch.remove(0);
+        ch.remove(c2);
+        ch.removeAll();
+        ch.preferredSize();
+        ch.minimumSize();
+        ch.getComponentAt(1, 2);
+        ch.locate(1, 2);
+        ch.getComponentAt(new Point(1, 2));
+        ch.isFocusCycleRoot(new Container());
+        ch.transferFocusBackward();
+        ch.setName("goober");
+        ch.getName();
+        ch.getParent();
+        ch.getPeer();
+        ch.getGraphicsConfiguration();
+        ch.getTreeLock();
+        ch.getToolkit();
+        ch.isValid();
+        ch.isDisplayable();
+        ch.isVisible();
+        ch.isShowing();
+        ch.isEnabled();
+        ch.enable(false);
+        ch.enable(true);
+        ch.enableInputMethods(false);
+        ch.enableInputMethods(true);
+        ch.show();
+        ch.show(false);
+        ch.show(true);
+        ch.hide();
+        ch.getForeground();
+        ch.isForegroundSet();
+        ch.getBackground();
+        ch.isBackgroundSet();
+        ch.getFont();
+        ch.isFontSet();
+        Container c = new Container();
+        c.add(ch);
+        ch.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            ch.setLocale(locale);
+
+        ch.getColorModel();
+        ch.getLocation();
+
+        boolean exceptions = false;
+        try {
+            ch.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        ch.location();
+        ch.setLocation(1, 2);
+        ch.move(1, 2);
+        ch.setLocation(new Point(1, 2));
+        ch.getSize();
+        ch.size();
+        ch.setSize(1, 32);
+        ch.resize(1, 32);
+        ch.setSize(new Dimension(1, 32));
+        ch.resize(new Dimension(1, 32));
+        ch.getBounds();
+        ch.bounds();
+        ch.setBounds(10, 10, 10, 10);
+        ch.setBounds(new Rectangle(10, 10, 10, 10));
+        ch.isLightweight();
+        ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        ch.getCursor();
+        ch.isCursorSet();
+        ch.inside(1, 2);
+        ch.contains(new Point(1, 2));
+        ch.isFocusable();
+        ch.setFocusable(true);
+        ch.setFocusable(false);
+        ch.transferFocus();
+        ch.getFocusCycleRootAncestor();
+        ch.nextFocus();
+        ch.transferFocusUpCycle();
+        ch.hasFocus();
+        ch.isFocusOwner();
+        ch.toString();
+        ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        ch.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJComponent.java b/jdk/test/javax/swing/Headless/HeadlessJComponent.java
new file mode 100644
index 00000000000..80c10818a31
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJComponent.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JComponent constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJComponent
+ */
+
+public class HeadlessJComponent {
+    public static void main(String args[]) {
+        JComponent ch = new JComponent(){};
+        ch.getAccessibleContext();
+        ch.isFocusTraversable();
+        ch.setEnabled(false);
+        ch.setEnabled(true);
+        ch.requestFocus();
+        ch.requestFocusInWindow();
+        ch.getPreferredSize();
+        ch.getMaximumSize();
+        ch.getMinimumSize();
+        ch.contains(1, 2);
+        Component c1 = ch.add(new Component(){});
+        Component c2 = ch.add(new Component(){});
+        Component c3 = ch.add(new Component(){});
+        Insets ins = ch.getInsets();
+        ch.getAlignmentY();
+        ch.getAlignmentX();
+        ch.getGraphics();
+        ch.setVisible(false);
+        ch.setVisible(true);
+        ch.setForeground(Color.red);
+        ch.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                ch.setFont(f1);
+                ch.setFont(f2);
+                ch.setFont(f3);
+                ch.setFont(f4);
+
+                ch.getFontMetrics(f1);
+                ch.getFontMetrics(f2);
+                ch.getFontMetrics(f3);
+                ch.getFontMetrics(f4);
+            }
+        }
+        ch.enable();
+        ch.disable();
+        ch.reshape(10, 10, 10, 10);
+        ch.getBounds(new Rectangle(1, 1, 1, 1));
+        ch.getSize(new Dimension(1, 2));
+        ch.getLocation(new Point(1, 2));
+        ch.getX();
+        ch.getY();
+        ch.getWidth();
+        ch.getHeight();
+        ch.isOpaque();
+        ch.isValidateRoot();
+        ch.isOptimizedDrawingEnabled();
+        ch.isDoubleBuffered();
+        ch.getComponentCount();
+        ch.countComponents();
+        ch.getComponent(1);
+        ch.getComponent(2);
+        Component[] cs = ch.getComponents();
+        ch.getLayout();
+        ch.setLayout(new FlowLayout());
+        ch.doLayout();
+        ch.layout();
+        ch.invalidate();
+        ch.validate();
+        ch.remove(0);
+        ch.remove(c2);
+        ch.removeAll();
+        ch.preferredSize();
+        ch.minimumSize();
+        ch.getComponentAt(1, 2);
+        ch.locate(1, 2);
+        ch.getComponentAt(new Point(1, 2));
+        ch.isFocusCycleRoot(new Container());
+        ch.transferFocusBackward();
+        ch.setName("goober");
+        ch.getName();
+        ch.getParent();
+        ch.getPeer();
+        ch.getGraphicsConfiguration();
+        ch.getTreeLock();
+        ch.getToolkit();
+        ch.isValid();
+        ch.isDisplayable();
+        ch.isVisible();
+        ch.isShowing();
+        ch.isEnabled();
+        ch.enable(false);
+        ch.enable(true);
+        ch.enableInputMethods(false);
+        ch.enableInputMethods(true);
+        ch.show();
+        ch.show(false);
+        ch.show(true);
+        ch.hide();
+        ch.getForeground();
+        ch.isForegroundSet();
+        ch.getBackground();
+        ch.isBackgroundSet();
+        ch.getFont();
+        ch.isFontSet();
+        Container c = new Container();
+        c.add(ch);
+        ch.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            ch.setLocale(locale);
+
+        ch.getColorModel();
+        ch.getLocation();
+
+        boolean exceptions = false;
+        try {
+            ch.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        ch.location();
+        ch.setLocation(1, 2);
+        ch.move(1, 2);
+        ch.setLocation(new Point(1, 2));
+        ch.getSize();
+        ch.size();
+        ch.setSize(1, 32);
+        ch.resize(1, 32);
+        ch.setSize(new Dimension(1, 32));
+        ch.resize(new Dimension(1, 32));
+        ch.getBounds();
+        ch.bounds();
+        ch.setBounds(10, 10, 10, 10);
+        ch.setBounds(new Rectangle(10, 10, 10, 10));
+        ch.isLightweight();
+        ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        ch.getCursor();
+        ch.isCursorSet();
+        ch.inside(1, 2);
+        ch.contains(new Point(1, 2));
+        ch.isFocusable();
+        ch.setFocusable(true);
+        ch.setFocusable(false);
+        ch.transferFocus();
+        ch.getFocusCycleRootAncestor();
+        ch.nextFocus();
+        ch.transferFocusUpCycle();
+        ch.hasFocus();
+        ch.isFocusOwner();
+        ch.toString();
+        ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        ch.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java b/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java
new file mode 100644
index 00000000000..2a1d231e3f2
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JDesktopPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJDesktopPane
+ */
+
+public class HeadlessJDesktopPane {
+    public static void main(String args[]) {
+        JComponent ch = new JComponent(){};
+        ch.getAccessibleContext();
+        ch.isFocusTraversable();
+        ch.setEnabled(false);
+        ch.setEnabled(true);
+        ch.requestFocus();
+        ch.requestFocusInWindow();
+        ch.getPreferredSize();
+        ch.getMaximumSize();
+        ch.getMinimumSize();
+        ch.contains(1, 2);
+        Component c1 = ch.add(new Component(){});
+        Component c2 = ch.add(new Component(){});
+        Component c3 = ch.add(new Component(){});
+        Insets ins = ch.getInsets();
+        ch.getAlignmentY();
+        ch.getAlignmentX();
+        ch.getGraphics();
+        ch.setVisible(false);
+        ch.setVisible(true);
+        ch.setForeground(Color.red);
+        ch.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                ch.setFont(f1);
+                ch.setFont(f2);
+                ch.setFont(f3);
+                ch.setFont(f4);
+
+                ch.getFontMetrics(f1);
+                ch.getFontMetrics(f2);
+                ch.getFontMetrics(f3);
+                ch.getFontMetrics(f4);
+            }
+        }
+        ch.enable();
+        ch.disable();
+        ch.reshape(10, 10, 10, 10);
+        ch.getBounds(new Rectangle(1, 1, 1, 1));
+        ch.getSize(new Dimension(1, 2));
+        ch.getLocation(new Point(1, 2));
+        ch.getX();
+        ch.getY();
+        ch.getWidth();
+        ch.getHeight();
+        ch.isOpaque();
+        ch.isValidateRoot();
+        ch.isOptimizedDrawingEnabled();
+        ch.isDoubleBuffered();
+        ch.getComponentCount();
+        ch.countComponents();
+        ch.getComponent(1);
+        ch.getComponent(2);
+        Component[] cs = ch.getComponents();
+        ch.getLayout();
+        ch.setLayout(new FlowLayout());
+        ch.doLayout();
+        ch.layout();
+        ch.invalidate();
+        ch.validate();
+        ch.remove(0);
+        ch.remove(c2);
+        ch.removeAll();
+        ch.preferredSize();
+        ch.minimumSize();
+        ch.getComponentAt(1, 2);
+        ch.locate(1, 2);
+        ch.getComponentAt(new Point(1, 2));
+        ch.isFocusCycleRoot(new Container());
+        ch.transferFocusBackward();
+        ch.setName("goober");
+        ch.getName();
+        ch.getParent();
+        ch.getPeer();
+        ch.getGraphicsConfiguration();
+        ch.getTreeLock();
+        ch.getToolkit();
+        ch.isValid();
+        ch.isDisplayable();
+        ch.isVisible();
+        ch.isShowing();
+        ch.isEnabled();
+        ch.enable(false);
+        ch.enable(true);
+        ch.enableInputMethods(false);
+        ch.enableInputMethods(true);
+        ch.show();
+        ch.show(false);
+        ch.show(true);
+        ch.hide();
+        ch.getForeground();
+        ch.isForegroundSet();
+        ch.getBackground();
+        ch.isBackgroundSet();
+        ch.getFont();
+        ch.isFontSet();
+        Container c = new Container();
+        c.add(ch);
+        ch.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            ch.setLocale(locale);
+
+        ch.getColorModel();
+        ch.getLocation();
+
+        boolean exceptions = false;
+        try {
+            ch.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        ch.location();
+        ch.setLocation(1, 2);
+        ch.move(1, 2);
+        ch.setLocation(new Point(1, 2));
+        ch.getSize();
+        ch.size();
+        ch.setSize(1, 32);
+        ch.resize(1, 32);
+        ch.setSize(new Dimension(1, 32));
+        ch.resize(new Dimension(1, 32));
+        ch.getBounds();
+        ch.bounds();
+        ch.setBounds(10, 10, 10, 10);
+        ch.setBounds(new Rectangle(10, 10, 10, 10));
+        ch.isLightweight();
+        ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        ch.getCursor();
+        ch.isCursorSet();
+        ch.inside(1, 2);
+        ch.contains(new Point(1, 2));
+        ch.isFocusable();
+        ch.setFocusable(true);
+        ch.setFocusable(false);
+        ch.transferFocus();
+        ch.getFocusCycleRootAncestor();
+        ch.nextFocus();
+        ch.transferFocusUpCycle();
+        ch.hasFocus();
+        ch.isFocusOwner();
+        ch.toString();
+        ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        ch.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJDialog.java b/jdk/test/javax/swing/Headless/HeadlessJDialog.java
new file mode 100644
index 00000000000..f5c174ead60
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJDialog.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that JDialog constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJDialog
+ */
+
+public class HeadlessJDialog {
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        JDialog b;
+
+        try {
+            b = new JDialog();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            b = new JDialog(new Frame("Frame title"));
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            b = new JDialog(new Frame("Frame title"), true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            b = new JDialog(new Frame("Frame title"), false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            b = new JDialog(new Frame("Frame title"), "Dialog title");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            b = new JDialog(new Frame("Frame title"), "Dialog title", true);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            b = new JDialog(new Frame("Frame title"), "Dialog title", false);
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java b/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java
new file mode 100644
index 00000000000..1b408b38e4f
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JEditorPane constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJEditorPane
+ */
+
+public class HeadlessJEditorPane {
+    public static void main(String args[]) {
+        JEditorPane b;
+        b = new JEditorPane("text/plain", "The Text");
+        b = new JEditorPane("unknown/unknown", "The Text");
+        b = new JEditorPane();
+        b.getAccessibleContext();
+        b.isFocusTraversable();
+        b.setEnabled(false);
+        b.setEnabled(true);
+        b.requestFocus();
+        b.requestFocusInWindow();
+        b.getPreferredSize();
+        b.getMaximumSize();
+        b.getMinimumSize();
+        b.contains(1, 2);
+        Component c1 = b.add(new Component(){});
+        Component c2 = b.add(new Component(){});
+        Component c3 = b.add(new Component(){});
+        Insets ins = b.getInsets();
+        b.getAlignmentY();
+        b.getAlignmentX();
+        b.getGraphics();
+        b.setVisible(false);
+        b.setVisible(true);
+        b.setForeground(Color.red);
+        b.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                b.setFont(f1);
+                b.setFont(f2);
+                b.setFont(f3);
+                b.setFont(f4);
+
+                b.getFontMetrics(f1);
+                b.getFontMetrics(f2);
+                b.getFontMetrics(f3);
+                b.getFontMetrics(f4);
+            }
+        }
+        b.enable();
+        b.disable();
+        b.reshape(10, 10, 10, 10);
+        b.getBounds(new Rectangle(1, 1, 1, 1));
+        b.getSize(new Dimension(1, 2));
+        b.getLocation(new Point(1, 2));
+        b.getX();
+        b.getY();
+        b.getWidth();
+        b.getHeight();
+        b.isOpaque();
+        b.isValidateRoot();
+        b.isOptimizedDrawingEnabled();
+        b.isDoubleBuffered();
+        b.getComponentCount();
+        b.countComponents();
+        b.getComponent(1);
+        b.getComponent(2);
+        Component[] cs = b.getComponents();
+        b.getLayout();
+        b.setLayout(new FlowLayout());
+        b.doLayout();
+        b.layout();
+        b.invalidate();
+        b.validate();
+        b.remove(0);
+        b.remove(c2);
+        b.removeAll();
+        b.preferredSize();
+        b.minimumSize();
+        b.getComponentAt(1, 2);
+        b.locate(1, 2);
+        b.getComponentAt(new Point(1, 2));
+        b.isFocusCycleRoot(new Container());
+        b.transferFocusBackward();
+        b.setName("goober");
+        b.getName();
+        b.getParent();
+        b.getPeer();
+        b.getGraphicsConfiguration();
+        b.getTreeLock();
+        b.getToolkit();
+        b.isValid();
+        b.isDisplayable();
+        b.isVisible();
+        b.isShowing();
+        b.isEnabled();
+        b.enable(false);
+        b.enable(true);
+        b.enableInputMethods(false);
+        b.enableInputMethods(true);
+        b.show();
+        b.show(false);
+        b.show(true);
+        b.hide();
+        b.getForeground();
+        b.isForegroundSet();
+        b.getBackground();
+        b.isBackgroundSet();
+        b.getFont();
+        b.isFontSet();
+        Container c = new Container();
+        c.add(b);
+        b.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            b.setLocale(locale);
+
+        b.getColorModel();
+        b.getLocation();
+
+        boolean exceptions = false;
+        try {
+            b.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        b.location();
+        b.setLocation(1, 2);
+        b.move(1, 2);
+        b.setLocation(new Point(1, 2));
+        b.getSize();
+        b.size();
+        b.setSize(1, 32);
+        b.resize(1, 32);
+        b.setSize(new Dimension(1, 32));
+        b.resize(new Dimension(1, 32));
+        b.getBounds();
+        b.bounds();
+        b.setBounds(10, 10, 10, 10);
+        b.setBounds(new Rectangle(10, 10, 10, 10));
+        b.isLightweight();
+        b.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        b.getCursor();
+        b.isCursorSet();
+        b.inside(1, 2);
+        b.contains(new Point(1, 2));
+        b.isFocusable();
+        b.setFocusable(true);
+        b.setFocusable(false);
+        b.transferFocus();
+        b.getFocusCycleRootAncestor();
+        b.nextFocus();
+        b.transferFocusUpCycle();
+        b.hasFocus();
+        b.isFocusOwner();
+        b.toString();
+        b.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        b.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        b.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        b.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java b/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java
new file mode 100644
index 00000000000..7acac2baf27
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JFileChooser constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJFileChooser
+ */
+
+public class HeadlessJFileChooser {
+    public static void main(String args[]) {
+        JFileChooser ch = new JFileChooser();
+        ch.getAccessibleContext();
+        ch.isFocusTraversable();
+        ch.setEnabled(false);
+        ch.setEnabled(true);
+        ch.requestFocus();
+        ch.requestFocusInWindow();
+        ch.getPreferredSize();
+        ch.getMaximumSize();
+        ch.getMinimumSize();
+        ch.contains(1, 2);
+        Component c1 = ch.add(new Component(){});
+        Component c2 = ch.add(new Component(){});
+        Component c3 = ch.add(new Component(){});
+        Insets ins = ch.getInsets();
+        ch.getAlignmentY();
+        ch.getAlignmentX();
+        ch.getGraphics();
+        ch.setVisible(false);
+        ch.setVisible(true);
+        ch.setForeground(Color.red);
+        ch.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                ch.setFont(f1);
+                ch.setFont(f2);
+                ch.setFont(f3);
+                ch.setFont(f4);
+
+                ch.getFontMetrics(f1);
+                ch.getFontMetrics(f2);
+                ch.getFontMetrics(f3);
+                ch.getFontMetrics(f4);
+            }
+        }
+        ch.enable();
+        ch.disable();
+        ch.reshape(10, 10, 10, 10);
+        ch.getBounds(new Rectangle(1, 1, 1, 1));
+        ch.getSize(new Dimension(1, 2));
+        ch.getLocation(new Point(1, 2));
+        ch.getX();
+        ch.getY();
+        ch.getWidth();
+        ch.getHeight();
+        ch.isOpaque();
+        ch.isValidateRoot();
+        ch.isOptimizedDrawingEnabled();
+        ch.isDoubleBuffered();
+        ch.getComponentCount();
+        ch.countComponents();
+        ch.getComponent(1);
+        ch.getComponent(2);
+        Component[] cs = ch.getComponents();
+        ch.getLayout();
+        ch.setLayout(new FlowLayout());
+        ch.doLayout();
+        ch.layout();
+        ch.invalidate();
+        ch.validate();
+        ch.remove(0);
+        ch.remove(c2);
+        ch.removeAll();
+        ch.preferredSize();
+        ch.minimumSize();
+        ch.getComponentAt(1, 2);
+        ch.locate(1, 2);
+        ch.getComponentAt(new Point(1, 2));
+        ch.isFocusCycleRoot(new Container());
+        ch.transferFocusBackward();
+        ch.setName("goober");
+        ch.getName();
+        ch.getParent();
+        ch.getPeer();
+        ch.getGraphicsConfiguration();
+        ch.getTreeLock();
+        ch.getToolkit();
+        ch.isValid();
+        ch.isDisplayable();
+        ch.isVisible();
+        ch.isShowing();
+        ch.isEnabled();
+        ch.enable(false);
+        ch.enable(true);
+        ch.enableInputMethods(false);
+        ch.enableInputMethods(true);
+        ch.show();
+        ch.show(false);
+        ch.show(true);
+        ch.hide();
+        ch.getForeground();
+        ch.isForegroundSet();
+        ch.getBackground();
+        ch.isBackgroundSet();
+        ch.getFont();
+        ch.isFontSet();
+        Container c = new Container();
+        c.add(ch);
+        ch.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            ch.setLocale(locale);
+
+        ch.getColorModel();
+        ch.getLocation();
+
+        boolean exceptions = false;
+        try {
+            ch.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        ch.location();
+        ch.setLocation(1, 2);
+        ch.move(1, 2);
+        ch.setLocation(new Point(1, 2));
+        ch.getSize();
+        ch.size();
+        ch.setSize(1, 32);
+        ch.resize(1, 32);
+        ch.setSize(new Dimension(1, 32));
+        ch.resize(new Dimension(1, 32));
+        ch.getBounds();
+        ch.bounds();
+        ch.setBounds(10, 10, 10, 10);
+        ch.setBounds(new Rectangle(10, 10, 10, 10));
+        ch.isLightweight();
+        ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        ch.getCursor();
+        ch.isCursorSet();
+        ch.inside(1, 2);
+        ch.contains(new Point(1, 2));
+        ch.isFocusable();
+        ch.setFocusable(true);
+        ch.setFocusable(false);
+        ch.transferFocus();
+        ch.getFocusCycleRootAncestor();
+        ch.nextFocus();
+        ch.transferFocusUpCycle();
+        ch.hasFocus();
+        ch.isFocusOwner();
+        ch.toString();
+        ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        ch.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJFormattedTextField.java b/jdk/test/javax/swing/Headless/HeadlessJFormattedTextField.java
new file mode 100644
index 00000000000..21049a76d37
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJFormattedTextField.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that JFormattedTextField constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJFormattedTextField
+ */
+
+public class HeadlessJFormattedTextField {
+    public static void main(String args[]) {
+        JTextField f = new JTextField("field");
+        f.selectAll();
+        f.getSelectionStart();
+        f.getSelectionEnd();
+        f.selectAll();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJFrame.java b/jdk/test/javax/swing/Headless/HeadlessJFrame.java
new file mode 100644
index 00000000000..b1a077459d8
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJFrame.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.JFrame;
+import java.awt.HeadlessException;
+
+/*
+ * @test
+ * @summary Check that JFrame constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJFrame
+ */
+
+public class HeadlessJFrame {
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        try {
+            JFrame b = new JFrame();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            JFrame b = new JFrame("Swingin' in the window");
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java
new file mode 100644
index 00000000000..f642b1a8ccd
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
+import javax.swing.plaf.basic.BasicInternalFrameUI;
+import java.awt.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JInternalFrame constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJInternalFrame
+ */
+
+public class HeadlessJInternalFrame {
+    public static void main(String args[]) {
+        JInternalFrame intf = new JInternalFrame("TEST");
+        intf.setUI(new BasicInternalFrameUI(intf) {
+            protected JComponent createNorthPane(JInternalFrame w) {
+                titlePane = new BasicInternalFrameTitlePane(w) {
+                    protected PropertyChangeListener createPropertyChangeListener() {
+                        return new BasicInternalFrameTitlePane.PropertyChangeHandler() {
+                            int countUI = 0;
+
+                            public void propertyChange(PropertyChangeEvent evt) {
+                                if (evt.getPropertyName().equals("UI"))
+                                    countUI++;
+                                else if (countUI > 1)
+                                    throw new RuntimeException("Test failed. Listener not removed!");
+                            }
+                        };
+                    }
+                };
+                return titlePane;
+            }
+        });
+        intf.setUI(null);
+        intf.getAccessibleContext();
+        intf.isFocusTraversable();
+        intf.setEnabled(false);
+        intf.setEnabled(true);
+        intf.requestFocus();
+        intf.requestFocusInWindow();
+        intf.getPreferredSize();
+        intf.getMaximumSize();
+        intf.getMinimumSize();
+        intf.contains(1, 2);
+        Component c1 = intf.add(new Component(){});
+        Component c2 = intf.add(new Component(){});
+        Component c3 = intf.add(new Component(){});
+        Insets ins = intf.getInsets();
+        intf.getAlignmentY();
+        intf.getAlignmentX();
+        intf.getGraphics();
+        intf.setVisible(false);
+        intf.setVisible(true);
+        intf.setForeground(Color.red);
+        intf.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                intf.setFont(f1);
+                intf.setFont(f2);
+                intf.setFont(f3);
+                intf.setFont(f4);
+
+                intf.getFontMetrics(f1);
+                intf.getFontMetrics(f2);
+                intf.getFontMetrics(f3);
+                intf.getFontMetrics(f4);
+            }
+        }
+        intf.enable();
+        intf.disable();
+        intf.reshape(10, 10, 10, 10);
+        intf.getBounds(new Rectangle(1, 1, 1, 1));
+        intf.getSize(new Dimension(1, 2));
+        intf.getLocation(new Point(1, 2));
+        intf.getX();
+        intf.getY();
+        intf.getWidth();
+        intf.getHeight();
+        intf.isOpaque();
+        intf.isValidateRoot();
+        intf.isOptimizedDrawingEnabled();
+        intf.isDoubleBuffered();
+        intf.getComponentCount();
+        intf.countComponents();
+        intf.getComponent(0);
+        Component[] cs = intf.getComponents();
+        intf.getLayout();
+        intf.setLayout(new FlowLayout());
+        intf.doLayout();
+        intf.layout();
+        intf.invalidate();
+        intf.validate();
+        intf.remove(0);
+        intf.remove(c2);
+        intf.removeAll();
+        intf.preferredSize();
+        intf.minimumSize();
+        intf.getComponentAt(1, 2);
+        intf.locate(1, 2);
+        intf.getComponentAt(new Point(1, 2));
+        intf.isFocusCycleRoot(new Container());
+        intf.transferFocusBackward();
+        intf.setName("goober");
+        intf.getName();
+        intf.getParent();
+        intf.getPeer();
+        intf.getGraphicsConfiguration();
+        intf.getTreeLock();
+        intf.getToolkit();
+        intf.isValid();
+        intf.isDisplayable();
+        intf.isVisible();
+        intf.isShowing();
+        intf.isEnabled();
+        intf.enable(false);
+        intf.enable(true);
+        intf.enableInputMethods(false);
+        intf.enableInputMethods(true);
+        intf.show();
+        intf.show(false);
+        intf.show(true);
+        intf.hide();
+        intf.getForeground();
+        intf.isForegroundSet();
+        intf.getBackground();
+        intf.isBackgroundSet();
+        intf.getFont();
+        intf.isFontSet();
+        Container c = new Container();
+        c.add(intf);
+        intf.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            intf.setLocale(locale);
+
+        intf.getColorModel();
+        intf.getLocation();
+
+        boolean exceptions = false;
+        try {
+            intf.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        intf.location();
+        intf.setLocation(1, 2);
+        intf.move(1, 2);
+        intf.setLocation(new Point(1, 2));
+        intf.getSize();
+        intf.size();
+        intf.setSize(1, 32);
+        intf.resize(1, 32);
+        intf.setSize(new Dimension(1, 32));
+        intf.resize(new Dimension(1, 32));
+        intf.getBounds();
+        intf.bounds();
+        intf.setBounds(10, 10, 10, 10);
+        intf.setBounds(new Rectangle(10, 10, 10, 10));
+        intf.isLightweight();
+        intf.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        intf.getCursor();
+        intf.isCursorSet();
+        intf.inside(1, 2);
+        intf.contains(new Point(1, 2));
+        intf.isFocusable();
+        intf.setFocusable(true);
+        intf.setFocusable(false);
+        intf.transferFocus();
+        intf.getFocusCycleRootAncestor();
+        intf.nextFocus();
+        intf.transferFocusUpCycle();
+        intf.hasFocus();
+        intf.isFocusOwner();
+        intf.toString();
+        intf.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        intf.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        intf.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        intf.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java
new file mode 100644
index 00000000000..e6c1cf4e2e8
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JInternalFrame.JDesktopIcon constructor and methods do not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJInternalFrame_JDesktopIcon
+ */
+
+public class HeadlessJInternalFrame_JDesktopIcon {
+    public static void main(String args[]) {
+        JInternalFrame.JDesktopIcon jdi = new JInternalFrame.JDesktopIcon(new JInternalFrame());
+        jdi.getAccessibleContext();
+        jdi.isFocusTraversable();
+        jdi.setEnabled(false);
+        jdi.setEnabled(true);
+        jdi.requestFocus();
+        jdi.requestFocusInWindow();
+        jdi.getPreferredSize();
+        jdi.getMaximumSize();
+        jdi.getMinimumSize();
+        jdi.contains(1, 2);
+        Component c1 = jdi.add(new Component(){});
+        Component c2 = jdi.add(new Component(){});
+        Component c3 = jdi.add(new Component(){});
+        Insets ins = jdi.getInsets();
+        jdi.getAlignmentY();
+        jdi.getAlignmentX();
+        jdi.getGraphics();
+        jdi.setVisible(false);
+        jdi.setVisible(true);
+        jdi.setForeground(Color.red);
+        jdi.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                jdi.setFont(f1);
+                jdi.setFont(f2);
+                jdi.setFont(f3);
+                jdi.setFont(f4);
+
+                jdi.getFontMetrics(f1);
+                jdi.getFontMetrics(f2);
+                jdi.getFontMetrics(f3);
+                jdi.getFontMetrics(f4);
+            }
+        }
+        jdi.enable();
+        jdi.disable();
+        jdi.reshape(10, 10, 10, 10);
+        jdi.getBounds(new Rectangle(1, 1, 1, 1));
+        jdi.getSize(new Dimension(1, 2));
+        jdi.getLocation(new Point(1, 2));
+        jdi.getX();
+        jdi.getY();
+        jdi.getWidth();
+        jdi.getHeight();
+        jdi.isOpaque();
+        jdi.isValidateRoot();
+        jdi.isOptimizedDrawingEnabled();
+        jdi.isDoubleBuffered();
+        jdi.getComponentCount();
+        jdi.countComponents();
+        jdi.getComponent(1);
+        jdi.getComponent(2);
+        Component[] cs = jdi.getComponents();
+        jdi.getLayout();
+        jdi.setLayout(new FlowLayout());
+        jdi.doLayout();
+        jdi.layout();
+        jdi.invalidate();
+        jdi.validate();
+        jdi.remove(0);
+        jdi.remove(c2);
+        jdi.removeAll();
+        jdi.preferredSize();
+        jdi.minimumSize();
+        jdi.getComponentAt(1, 2);
+        jdi.locate(1, 2);
+        jdi.getComponentAt(new Point(1, 2));
+        jdi.isFocusCycleRoot(new Container());
+        jdi.transferFocusBackward();
+        jdi.setName("goober");
+        jdi.getName();
+        jdi.getParent();
+        jdi.getPeer();
+        jdi.getGraphicsConfiguration();
+        jdi.getTreeLock();
+        jdi.getToolkit();
+        jdi.isValid();
+        jdi.isDisplayable();
+        jdi.isVisible();
+        jdi.isShowing();
+        jdi.isEnabled();
+        jdi.enable(false);
+        jdi.enable(true);
+        jdi.enableInputMethods(false);
+        jdi.enableInputMethods(true);
+        jdi.show();
+        jdi.show(false);
+        jdi.show(true);
+        jdi.hide();
+        jdi.getForeground();
+        jdi.isForegroundSet();
+        jdi.getBackground();
+        jdi.isBackgroundSet();
+        jdi.getFont();
+        jdi.isFontSet();
+        Container c = new Container();
+        c.add(jdi);
+        jdi.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            jdi.setLocale(locale);
+
+        jdi.getColorModel();
+        jdi.getLocation();
+
+        boolean exceptions = false;
+        try {
+            jdi.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        jdi.location();
+        jdi.setLocation(1, 2);
+        jdi.move(1, 2);
+        jdi.setLocation(new Point(1, 2));
+        jdi.getSize();
+        jdi.size();
+        jdi.setSize(1, 32);
+        jdi.resize(1, 32);
+        jdi.setSize(new Dimension(1, 32));
+        jdi.resize(new Dimension(1, 32));
+        jdi.getBounds();
+        jdi.bounds();
+        jdi.setBounds(10, 10, 10, 10);
+        jdi.setBounds(new Rectangle(10, 10, 10, 10));
+        jdi.isLightweight();
+        jdi.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        jdi.getCursor();
+        jdi.isCursorSet();
+        jdi.inside(1, 2);
+        jdi.contains(new Point(1, 2));
+        jdi.isFocusable();
+        jdi.setFocusable(true);
+        jdi.setFocusable(false);
+        jdi.transferFocus();
+        jdi.getFocusCycleRootAncestor();
+        jdi.nextFocus();
+        jdi.transferFocusUpCycle();
+        jdi.hasFocus();
+        jdi.isFocusOwner();
+        jdi.toString();
+        jdi.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        jdi.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        jdi.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        jdi.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJLabel.java b/jdk/test/javax/swing/Headless/HeadlessJLabel.java
new file mode 100644
index 00000000000..a61c1fb672c
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJLabel.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JLabel constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJLabel
+ */
+
+public class HeadlessJLabel {
+    public static void main(String args[]) {
+        JLabel l = new JLabel("<html><body><bold>Foo</bold></body></html>");
+        l.getAccessibleContext();
+        l.isFocusTraversable();
+        l.setEnabled(false);
+        l.setEnabled(true);
+        l.requestFocus();
+        l.requestFocusInWindow();
+        l.getPreferredSize();
+        l.getMaximumSize();
+        l.getMinimumSize();
+        l.contains(1, 2);
+        Component c1 = l.add(new Component(){});
+        Component c2 = l.add(new Component(){});
+        Component c3 = l.add(new Component(){});
+        Insets ins = l.getInsets();
+        l.getAlignmentY();
+        l.getAlignmentX();
+        l.getGraphics();
+        l.setVisible(false);
+        l.setVisible(true);
+        l.setForeground(Color.red);
+        l.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                l.setFont(f1);
+                l.setFont(f2);
+                l.setFont(f3);
+                l.setFont(f4);
+
+                l.getFontMetrics(f1);
+                l.getFontMetrics(f2);
+                l.getFontMetrics(f3);
+                l.getFontMetrics(f4);
+            }
+        }
+        l.enable();
+        l.disable();
+        l.reshape(10, 10, 10, 10);
+        l.getBounds(new Rectangle(1, 1, 1, 1));
+        l.getSize(new Dimension(1, 2));
+        l.getLocation(new Point(1, 2));
+        l.getX();
+        l.getY();
+        l.getWidth();
+        l.getHeight();
+        l.isOpaque();
+        l.isValidateRoot();
+        l.isOptimizedDrawingEnabled();
+        l.isDoubleBuffered();
+        l.getComponentCount();
+        l.countComponents();
+        l.getComponent(1);
+        l.getComponent(2);
+        Component[] cs = l.getComponents();
+        l.getLayout();
+        l.setLayout(new FlowLayout());
+        l.doLayout();
+        l.layout();
+        l.invalidate();
+        l.validate();
+        l.remove(0);
+        l.remove(c2);
+        l.removeAll();
+        l.preferredSize();
+        l.minimumSize();
+        l.getComponentAt(1, 2);
+        l.locate(1, 2);
+        l.getComponentAt(new Point(1, 2));
+        l.isFocusCycleRoot(new Container());
+        l.transferFocusBackward();
+        l.setName("goober");
+        l.getName();
+        l.getParent();
+        l.getPeer();
+        l.getGraphicsConfiguration();
+        l.getTreeLock();
+        l.getToolkit();
+        l.isValid();
+        l.isDisplayable();
+        l.isVisible();
+        l.isShowing();
+        l.isEnabled();
+        l.enable(false);
+        l.enable(true);
+        l.enableInputMethods(false);
+        l.enableInputMethods(true);
+        l.show();
+        l.show(false);
+        l.show(true);
+        l.hide();
+        l.getForeground();
+        l.isForegroundSet();
+        l.getBackground();
+        l.isBackgroundSet();
+        l.getFont();
+        l.isFontSet();
+        Container c = new Container();
+        c.add(l);
+        l.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            l.setLocale(locale);
+
+        l.getColorModel();
+        l.getLocation();
+
+        boolean exceptions = false;
+        try {
+            l.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        l.location();
+        l.setLocation(1, 2);
+        l.move(1, 2);
+        l.setLocation(new Point(1, 2));
+        l.getSize();
+        l.size();
+        l.setSize(1, 32);
+        l.resize(1, 32);
+        l.setSize(new Dimension(1, 32));
+        l.resize(new Dimension(1, 32));
+        l.getBounds();
+        l.bounds();
+        l.setBounds(10, 10, 10, 10);
+        l.setBounds(new Rectangle(10, 10, 10, 10));
+        l.isLightweight();
+        l.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        l.getCursor();
+        l.isCursorSet();
+        l.inside(1, 2);
+        l.contains(new Point(1, 2));
+        l.isFocusable();
+        l.setFocusable(true);
+        l.setFocusable(false);
+        l.transferFocus();
+        l.getFocusCycleRootAncestor();
+        l.nextFocus();
+        l.transferFocusUpCycle();
+        l.hasFocus();
+        l.isFocusOwner();
+        l.toString();
+        l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        l.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        l.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        l.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java b/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java
new file mode 100644
index 00000000000..ce23c2e3f71
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JLayeredPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJLayeredPane
+ */
+
+public class HeadlessJLayeredPane {
+    public static void main(String args[]) {
+        JLayeredPane lp = new JLayeredPane();
+        lp.getAccessibleContext();
+        lp.isFocusTraversable();
+        lp.setEnabled(false);
+        lp.setEnabled(true);
+        lp.requestFocus();
+        lp.requestFocusInWindow();
+        lp.getPreferredSize();
+        lp.getMaximumSize();
+        lp.getMinimumSize();
+        lp.contains(1, 2);
+        Component c1 = lp.add(new Component(){});
+        Component c2 = lp.add(new Component(){});
+        Component c3 = lp.add(new Component(){});
+        Insets ins = lp.getInsets();
+        lp.getAlignmentY();
+        lp.getAlignmentX();
+        lp.getGraphics();
+        lp.setVisible(false);
+        lp.setVisible(true);
+        lp.setForeground(Color.red);
+        lp.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                lp.setFont(f1);
+                lp.setFont(f2);
+                lp.setFont(f3);
+                lp.setFont(f4);
+
+                lp.getFontMetrics(f1);
+                lp.getFontMetrics(f2);
+                lp.getFontMetrics(f3);
+                lp.getFontMetrics(f4);
+            }
+        }
+        lp.enable();
+        lp.disable();
+        lp.reshape(10, 10, 10, 10);
+        lp.getBounds(new Rectangle(1, 1, 1, 1));
+        lp.getSize(new Dimension(1, 2));
+        lp.getLocation(new Point(1, 2));
+        lp.getX();
+        lp.getY();
+        lp.getWidth();
+        lp.getHeight();
+        lp.isOpaque();
+        lp.isValidateRoot();
+        lp.isOptimizedDrawingEnabled();
+        lp.isDoubleBuffered();
+        lp.getComponentCount();
+        lp.countComponents();
+        lp.getComponent(1);
+        lp.getComponent(2);
+        Component[] cs = lp.getComponents();
+        lp.getLayout();
+        lp.setLayout(new FlowLayout());
+        lp.doLayout();
+        lp.layout();
+        lp.invalidate();
+        lp.validate();
+        lp.remove(0);
+        lp.remove(c2);
+        lp.removeAll();
+        lp.preferredSize();
+        lp.minimumSize();
+        lp.getComponentAt(1, 2);
+        lp.locate(1, 2);
+        lp.getComponentAt(new Point(1, 2));
+        lp.isFocusCycleRoot(new Container());
+        lp.transferFocusBackward();
+        lp.setName("goober");
+        lp.getName();
+        lp.getParent();
+        lp.getPeer();
+        lp.getGraphicsConfiguration();
+        lp.getTreeLock();
+        lp.getToolkit();
+        lp.isValid();
+        lp.isDisplayable();
+        lp.isVisible();
+        lp.isShowing();
+        lp.isEnabled();
+        lp.enable(false);
+        lp.enable(true);
+        lp.enableInputMethods(false);
+        lp.enableInputMethods(true);
+        lp.show();
+        lp.show(false);
+        lp.show(true);
+        lp.hide();
+        lp.getForeground();
+        lp.isForegroundSet();
+        lp.getBackground();
+        lp.isBackgroundSet();
+        lp.getFont();
+        lp.isFontSet();
+        Container c = new Container();
+        c.add(lp);
+        lp.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            lp.setLocale(locale);
+
+        lp.getColorModel();
+        lp.getLocation();
+
+        boolean exceptions = false;
+        try {
+            lp.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        lp.location();
+        lp.setLocation(1, 2);
+        lp.move(1, 2);
+        lp.setLocation(new Point(1, 2));
+        lp.getSize();
+        lp.size();
+        lp.setSize(1, 32);
+        lp.resize(1, 32);
+        lp.setSize(new Dimension(1, 32));
+        lp.resize(new Dimension(1, 32));
+        lp.getBounds();
+        lp.bounds();
+        lp.setBounds(10, 10, 10, 10);
+        lp.setBounds(new Rectangle(10, 10, 10, 10));
+        lp.isLightweight();
+        lp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        lp.getCursor();
+        lp.isCursorSet();
+        lp.inside(1, 2);
+        lp.contains(new Point(1, 2));
+        lp.isFocusable();
+        lp.setFocusable(true);
+        lp.setFocusable(false);
+        lp.transferFocus();
+        lp.getFocusCycleRootAncestor();
+        lp.nextFocus();
+        lp.transferFocusUpCycle();
+        lp.hasFocus();
+        lp.isFocusOwner();
+        lp.toString();
+        lp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        lp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        lp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        lp.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJList.java b/jdk/test/javax/swing/Headless/HeadlessJList.java
new file mode 100644
index 00000000000..762d34f4576
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJList.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JList constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJList
+ */
+
+public class HeadlessJList {
+    public static void main(String args[]) {
+        JList l = new JList();
+        l.getAccessibleContext();
+        l.isFocusTraversable();
+        l.setEnabled(false);
+        l.setEnabled(true);
+        l.requestFocus();
+        l.requestFocusInWindow();
+        l.getPreferredSize();
+        l.getMaximumSize();
+        l.getMinimumSize();
+        l.contains(1, 2);
+        Component c1 = l.add(new Component(){});
+        Component c2 = l.add(new Component(){});
+        Component c3 = l.add(new Component(){});
+        Insets ins = l.getInsets();
+        l.getAlignmentY();
+        l.getAlignmentX();
+        l.getGraphics();
+        l.setVisible(false);
+        l.setVisible(true);
+        l.setForeground(Color.red);
+        l.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                l.setFont(f1);
+                l.setFont(f2);
+                l.setFont(f3);
+                l.setFont(f4);
+
+                l.getFontMetrics(f1);
+                l.getFontMetrics(f2);
+                l.getFontMetrics(f3);
+                l.getFontMetrics(f4);
+            }
+        }
+        l.enable();
+        l.disable();
+        l.reshape(10, 10, 10, 10);
+        l.getBounds(new Rectangle(1, 1, 1, 1));
+        l.getSize(new Dimension(1, 2));
+        l.getLocation(new Point(1, 2));
+        l.getX();
+        l.getY();
+        l.getWidth();
+        l.getHeight();
+        l.isOpaque();
+        l.isValidateRoot();
+        l.isOptimizedDrawingEnabled();
+        l.isDoubleBuffered();
+        l.getComponentCount();
+        l.countComponents();
+        l.getComponent(1);
+        l.getComponent(2);
+        Component[] cs = l.getComponents();
+        l.getLayout();
+        l.setLayout(new FlowLayout());
+        l.doLayout();
+        l.layout();
+        l.invalidate();
+        l.validate();
+        l.remove(0);
+        l.remove(c2);
+        l.removeAll();
+        l.preferredSize();
+        l.minimumSize();
+        l.getComponentAt(1, 2);
+        l.locate(1, 2);
+        l.getComponentAt(new Point(1, 2));
+        l.isFocusCycleRoot(new Container());
+        l.transferFocusBackward();
+        l.setName("goober");
+        l.getName();
+        l.getParent();
+        l.getPeer();
+        l.getGraphicsConfiguration();
+        l.getTreeLock();
+        l.getToolkit();
+        l.isValid();
+        l.isDisplayable();
+        l.isVisible();
+        l.isShowing();
+        l.isEnabled();
+        l.enable(false);
+        l.enable(true);
+        l.enableInputMethods(false);
+        l.enableInputMethods(true);
+        l.show();
+        l.show(false);
+        l.show(true);
+        l.hide();
+        l.getForeground();
+        l.isForegroundSet();
+        l.getBackground();
+        l.isBackgroundSet();
+        l.getFont();
+        l.isFontSet();
+        Container c = new Container();
+        c.add(l);
+        l.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            l.setLocale(locale);
+
+        l.getColorModel();
+        l.getLocation();
+
+        boolean exceptions = false;
+        try {
+            l.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        l.location();
+        l.setLocation(1, 2);
+        l.move(1, 2);
+        l.setLocation(new Point(1, 2));
+        l.getSize();
+        l.size();
+        l.setSize(1, 32);
+        l.resize(1, 32);
+        l.setSize(new Dimension(1, 32));
+        l.resize(new Dimension(1, 32));
+        l.getBounds();
+        l.bounds();
+        l.setBounds(10, 10, 10, 10);
+        l.setBounds(new Rectangle(10, 10, 10, 10));
+        l.isLightweight();
+        l.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        l.getCursor();
+        l.isCursorSet();
+        l.inside(1, 2);
+        l.contains(new Point(1, 2));
+        l.isFocusable();
+        l.setFocusable(true);
+        l.setFocusable(false);
+        l.transferFocus();
+        l.getFocusCycleRootAncestor();
+        l.nextFocus();
+        l.transferFocusUpCycle();
+        l.hasFocus();
+        l.isFocusOwner();
+        l.toString();
+        l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        l.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        l.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        l.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJMenu.java b/jdk/test/javax/swing/Headless/HeadlessJMenu.java
new file mode 100644
index 00000000000..482fca9f74b
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJMenu.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JMenu constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJMenu
+ */
+
+public class HeadlessJMenu {
+    public static void main(String args[]) {
+        JMenu m = new JMenu();
+        m.getAccessibleContext();
+        m.isFocusTraversable();
+        m.setEnabled(false);
+        m.setEnabled(true);
+        m.requestFocus();
+        m.requestFocusInWindow();
+        m.getPreferredSize();
+        m.getMaximumSize();
+        m.getMinimumSize();
+        m.contains(1, 2);
+        Component c1 = m.add(new Component(){});
+        Component c2 = m.add(new Component(){});
+        Component c3 = m.add(new Component(){});
+        Insets ins = m.getInsets();
+        m.getAlignmentY();
+        m.getAlignmentX();
+        m.getGraphics();
+        m.setVisible(false);
+        m.setVisible(true);
+        m.setForeground(Color.red);
+        m.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                m.setFont(f1);
+                m.setFont(f2);
+                m.setFont(f3);
+                m.setFont(f4);
+
+                m.getFontMetrics(f1);
+                m.getFontMetrics(f2);
+                m.getFontMetrics(f3);
+                m.getFontMetrics(f4);
+            }
+        }
+        m.enable();
+        m.disable();
+        m.reshape(10, 10, 10, 10);
+        m.getBounds(new Rectangle(1, 1, 1, 1));
+        m.getSize(new Dimension(1, 2));
+        m.getLocation(new Point(1, 2));
+        m.getX();
+        m.getY();
+        m.getWidth();
+        m.getHeight();
+        m.isOpaque();
+        m.isValidateRoot();
+        m.isOptimizedDrawingEnabled();
+        m.isDoubleBuffered();
+        m.getComponentCount();
+        m.countComponents();
+        Component[] cs = m.getComponents();
+        m.getLayout();
+        m.setLayout(new FlowLayout());
+        m.doLayout();
+        m.layout();
+        m.invalidate();
+        m.validate();
+        m.remove(0);
+        m.remove(c2);
+        m.removeAll();
+        m.preferredSize();
+        m.minimumSize();
+        m.getComponentAt(1, 2);
+        m.locate(1, 2);
+        m.getComponentAt(new Point(1, 2));
+        m.isFocusCycleRoot(new Container());
+        m.transferFocusBackward();
+        m.setName("goober");
+        m.getName();
+        m.getParent();
+        m.getPeer();
+        m.getGraphicsConfiguration();
+        m.getTreeLock();
+        m.getToolkit();
+        m.isValid();
+        m.isDisplayable();
+        m.isVisible();
+        m.isShowing();
+        m.isEnabled();
+        m.enable(false);
+        m.enable(true);
+        m.enableInputMethods(false);
+        m.enableInputMethods(true);
+        m.show();
+        m.show(false);
+        m.show(true);
+        m.hide();
+        m.getForeground();
+        m.isForegroundSet();
+        m.getBackground();
+        m.isBackgroundSet();
+        m.getFont();
+        m.isFontSet();
+        Container c = new Container();
+        c.add(m);
+        m.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            m.setLocale(locale);
+
+        m.getColorModel();
+        m.getLocation();
+
+        boolean exceptions = false;
+        try {
+            m.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        m.location();
+        m.setLocation(1, 2);
+        m.move(1, 2);
+        m.setLocation(new Point(1, 2));
+        m.getSize();
+        m.size();
+        m.setSize(1, 32);
+        m.resize(1, 32);
+        m.setSize(new Dimension(1, 32));
+        m.resize(new Dimension(1, 32));
+        m.getBounds();
+        m.bounds();
+        m.setBounds(10, 10, 10, 10);
+        m.setBounds(new Rectangle(10, 10, 10, 10));
+        m.isLightweight();
+        m.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        m.getCursor();
+        m.isCursorSet();
+        m.inside(1, 2);
+        m.contains(new Point(1, 2));
+        m.isFocusable();
+        m.setFocusable(true);
+        m.setFocusable(false);
+        m.transferFocus();
+        m.getFocusCycleRootAncestor();
+        m.nextFocus();
+        m.transferFocusUpCycle();
+        m.hasFocus();
+        m.isFocusOwner();
+        m.toString();
+        m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        m.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        m.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java b/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java
new file mode 100644
index 00000000000..a8880295644
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JMenuBar constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJMenuBar
+ */
+
+public class HeadlessJMenuBar {
+    public static void main(String args[]) {
+        JMenuBar mb = new JMenuBar();
+        mb.getAccessibleContext();
+        mb.isFocusTraversable();
+        mb.setEnabled(false);
+        mb.setEnabled(true);
+        mb.requestFocus();
+        mb.requestFocusInWindow();
+        mb.getPreferredSize();
+        mb.getMaximumSize();
+        mb.getMinimumSize();
+        mb.contains(1, 2);
+        Component c1 = mb.add(new Component(){});
+        Component c2 = mb.add(new Component(){});
+        Component c3 = mb.add(new Component(){});
+        Insets ins = mb.getInsets();
+        mb.getAlignmentY();
+        mb.getAlignmentX();
+        mb.getGraphics();
+        mb.setVisible(false);
+        mb.setVisible(true);
+        mb.setForeground(Color.red);
+        mb.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                mb.setFont(f1);
+                mb.setFont(f2);
+                mb.setFont(f3);
+                mb.setFont(f4);
+
+                mb.getFontMetrics(f1);
+                mb.getFontMetrics(f2);
+                mb.getFontMetrics(f3);
+                mb.getFontMetrics(f4);
+            }
+        }
+        mb.enable();
+        mb.disable();
+        mb.reshape(10, 10, 10, 10);
+        mb.getBounds(new Rectangle(1, 1, 1, 1));
+        mb.getSize(new Dimension(1, 2));
+        mb.getLocation(new Point(1, 2));
+        mb.getX();
+        mb.getY();
+        mb.getWidth();
+        mb.getHeight();
+        mb.isOpaque();
+        mb.isValidateRoot();
+        mb.isOptimizedDrawingEnabled();
+        mb.isDoubleBuffered();
+        mb.getComponentCount();
+        mb.countComponents();
+        mb.getComponent(1);
+        mb.getComponent(2);
+        Component[] cs = mb.getComponents();
+        mb.getLayout();
+        mb.setLayout(new FlowLayout());
+        mb.doLayout();
+        mb.layout();
+        mb.invalidate();
+        mb.validate();
+        mb.remove(0);
+        mb.remove(c2);
+        mb.removeAll();
+        mb.preferredSize();
+        mb.minimumSize();
+        mb.getComponentAt(1, 2);
+        mb.locate(1, 2);
+        mb.getComponentAt(new Point(1, 2));
+        mb.isFocusCycleRoot(new Container());
+        mb.transferFocusBackward();
+        mb.setName("goober");
+        mb.getName();
+        mb.getParent();
+        mb.getPeer();
+        mb.getGraphicsConfiguration();
+        mb.getTreeLock();
+        mb.getToolkit();
+        mb.isValid();
+        mb.isDisplayable();
+        mb.isVisible();
+        mb.isShowing();
+        mb.isEnabled();
+        mb.enable(false);
+        mb.enable(true);
+        mb.enableInputMethods(false);
+        mb.enableInputMethods(true);
+        mb.show();
+        mb.show(false);
+        mb.show(true);
+        mb.hide();
+        mb.getForeground();
+        mb.isForegroundSet();
+        mb.getBackground();
+        mb.isBackgroundSet();
+        mb.getFont();
+        mb.isFontSet();
+        Container c = new Container();
+        c.add(mb);
+        mb.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            mb.setLocale(locale);
+
+        mb.getColorModel();
+        mb.getLocation();
+
+        boolean exceptions = false;
+        try {
+            mb.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        mb.location();
+        mb.setLocation(1, 2);
+        mb.move(1, 2);
+        mb.setLocation(new Point(1, 2));
+        mb.getSize();
+        mb.size();
+        mb.setSize(1, 32);
+        mb.resize(1, 32);
+        mb.setSize(new Dimension(1, 32));
+        mb.resize(new Dimension(1, 32));
+        mb.getBounds();
+        mb.bounds();
+        mb.setBounds(10, 10, 10, 10);
+        mb.setBounds(new Rectangle(10, 10, 10, 10));
+        mb.isLightweight();
+        mb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        mb.getCursor();
+        mb.isCursorSet();
+        mb.inside(1, 2);
+        mb.contains(new Point(1, 2));
+        mb.isFocusable();
+        mb.setFocusable(true);
+        mb.setFocusable(false);
+        mb.transferFocus();
+        mb.getFocusCycleRootAncestor();
+        mb.nextFocus();
+        mb.transferFocusUpCycle();
+        mb.hasFocus();
+        mb.isFocusOwner();
+        mb.toString();
+        mb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        mb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        mb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        mb.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java b/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java
new file mode 100644
index 00000000000..67355904e94
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JMenuItem constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJMenuItem
+ */
+
+public class HeadlessJMenuItem {
+    public static void main(String args[]) {
+        JMenuItem mi = new JMenuItem();
+        mi.getAccessibleContext();
+        mi.isFocusTraversable();
+        mi.setEnabled(false);
+        mi.setEnabled(true);
+        mi.requestFocus();
+        mi.requestFocusInWindow();
+        mi.getPreferredSize();
+        mi.getMaximumSize();
+        mi.getMinimumSize();
+        mi.contains(1, 2);
+        Component c1 = mi.add(new Component(){});
+        Component c2 = mi.add(new Component(){});
+        Component c3 = mi.add(new Component(){});
+        Insets ins = mi.getInsets();
+        mi.getAlignmentY();
+        mi.getAlignmentX();
+        mi.getGraphics();
+        mi.setVisible(false);
+        mi.setVisible(true);
+        mi.setForeground(Color.red);
+        mi.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                mi.setFont(f1);
+                mi.setFont(f2);
+                mi.setFont(f3);
+                mi.setFont(f4);
+
+                mi.getFontMetrics(f1);
+                mi.getFontMetrics(f2);
+                mi.getFontMetrics(f3);
+                mi.getFontMetrics(f4);
+            }
+        }
+        mi.enable();
+        mi.disable();
+        mi.reshape(10, 10, 10, 10);
+        mi.getBounds(new Rectangle(1, 1, 1, 1));
+        mi.getSize(new Dimension(1, 2));
+        mi.getLocation(new Point(1, 2));
+        mi.getX();
+        mi.getY();
+        mi.getWidth();
+        mi.getHeight();
+        mi.isOpaque();
+        mi.isValidateRoot();
+        mi.isOptimizedDrawingEnabled();
+        mi.isDoubleBuffered();
+        mi.getComponentCount();
+        mi.countComponents();
+        mi.getComponent(1);
+        mi.getComponent(2);
+        Component[] cs = mi.getComponents();
+        mi.getLayout();
+        mi.setLayout(new FlowLayout());
+        mi.doLayout();
+        mi.layout();
+        mi.invalidate();
+        mi.validate();
+        mi.remove(0);
+        mi.remove(c2);
+        mi.removeAll();
+        mi.preferredSize();
+        mi.minimumSize();
+        mi.getComponentAt(1, 2);
+        mi.locate(1, 2);
+        mi.getComponentAt(new Point(1, 2));
+        mi.isFocusCycleRoot(new Container());
+        mi.transferFocusBackward();
+        mi.setName("goober");
+        mi.getName();
+        mi.getParent();
+        mi.getPeer();
+        mi.getGraphicsConfiguration();
+        mi.getTreeLock();
+        mi.getToolkit();
+        mi.isValid();
+        mi.isDisplayable();
+        mi.isVisible();
+        mi.isShowing();
+        mi.isEnabled();
+        mi.enable(false);
+        mi.enable(true);
+        mi.enableInputMethods(false);
+        mi.enableInputMethods(true);
+        mi.show();
+        mi.show(false);
+        mi.show(true);
+        mi.hide();
+        mi.getForeground();
+        mi.isForegroundSet();
+        mi.getBackground();
+        mi.isBackgroundSet();
+        mi.getFont();
+        mi.isFontSet();
+        Container c = new Container();
+        c.add(mi);
+        mi.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            mi.setLocale(locale);
+
+        mi.getColorModel();
+        mi.getLocation();
+
+        boolean exceptions = false;
+        try {
+            mi.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        mi.location();
+        mi.setLocation(1, 2);
+        mi.move(1, 2);
+        mi.setLocation(new Point(1, 2));
+        mi.getSize();
+        mi.size();
+        mi.setSize(1, 32);
+        mi.resize(1, 32);
+        mi.setSize(new Dimension(1, 32));
+        mi.resize(new Dimension(1, 32));
+        mi.getBounds();
+        mi.bounds();
+        mi.setBounds(10, 10, 10, 10);
+        mi.setBounds(new Rectangle(10, 10, 10, 10));
+        mi.isLightweight();
+        mi.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        mi.getCursor();
+        mi.isCursorSet();
+        mi.inside(1, 2);
+        mi.contains(new Point(1, 2));
+        mi.isFocusable();
+        mi.setFocusable(true);
+        mi.setFocusable(false);
+        mi.transferFocus();
+        mi.getFocusCycleRootAncestor();
+        mi.nextFocus();
+        mi.transferFocusUpCycle();
+        mi.hasFocus();
+        mi.isFocusOwner();
+        mi.toString();
+        mi.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        mi.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        mi.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        mi.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java b/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java
new file mode 100644
index 00000000000..35731e3f23d
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JOptionPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJOptionPane
+ */
+
+public class HeadlessJOptionPane {
+    public static void main(String args[]) {
+        JOptionPane op = new JOptionPane();
+        op.getAccessibleContext();
+        op.isFocusTraversable();
+        op.setEnabled(false);
+        op.setEnabled(true);
+        op.requestFocus();
+        op.requestFocusInWindow();
+        op.getPreferredSize();
+        op.getMaximumSize();
+        op.getMinimumSize();
+        op.contains(1, 2);
+        Component c1 = op.add(new Component(){});
+        Component c2 = op.add(new Component(){});
+        Component c3 = op.add(new Component(){});
+        Insets ins = op.getInsets();
+        op.getAlignmentY();
+        op.getAlignmentX();
+        op.getGraphics();
+        op.setVisible(false);
+        op.setVisible(true);
+        op.setForeground(Color.red);
+        op.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                op.setFont(f1);
+                op.setFont(f2);
+                op.setFont(f3);
+                op.setFont(f4);
+
+                op.getFontMetrics(f1);
+                op.getFontMetrics(f2);
+                op.getFontMetrics(f3);
+                op.getFontMetrics(f4);
+            }
+        }
+        op.enable();
+        op.disable();
+        op.reshape(10, 10, 10, 10);
+        op.getBounds(new Rectangle(1, 1, 1, 1));
+        op.getSize(new Dimension(1, 2));
+        op.getLocation(new Point(1, 2));
+        op.getX();
+        op.getY();
+        op.getWidth();
+        op.getHeight();
+        op.isOpaque();
+        op.isValidateRoot();
+        op.isOptimizedDrawingEnabled();
+        op.isDoubleBuffered();
+        op.getComponentCount();
+        op.countComponents();
+        op.getComponent(1);
+        op.getComponent(2);
+        Component[] cs = op.getComponents();
+        op.getLayout();
+        op.setLayout(new FlowLayout());
+        op.doLayout();
+        op.layout();
+        op.invalidate();
+        op.validate();
+        op.remove(0);
+        op.remove(c2);
+        op.removeAll();
+        op.preferredSize();
+        op.minimumSize();
+        op.getComponentAt(1, 2);
+        op.locate(1, 2);
+        op.getComponentAt(new Point(1, 2));
+        op.isFocusCycleRoot(new Container());
+        op.transferFocusBackward();
+        op.setName("goober");
+        op.getName();
+        op.getParent();
+        op.getPeer();
+        op.getGraphicsConfiguration();
+        op.getTreeLock();
+        op.getToolkit();
+        op.isValid();
+        op.isDisplayable();
+        op.isVisible();
+        op.isShowing();
+        op.isEnabled();
+        op.enable(false);
+        op.enable(true);
+        op.enableInputMethods(false);
+        op.enableInputMethods(true);
+        op.show();
+        op.show(false);
+        op.show(true);
+        op.hide();
+        op.getForeground();
+        op.isForegroundSet();
+        op.getBackground();
+        op.isBackgroundSet();
+        op.getFont();
+        op.isFontSet();
+        Container c = new Container();
+        c.add(op);
+        op.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            op.setLocale(locale);
+
+        op.getColorModel();
+        op.getLocation();
+
+        boolean exceptions = false;
+        try {
+            op.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        op.location();
+        op.setLocation(1, 2);
+        op.move(1, 2);
+        op.setLocation(new Point(1, 2));
+        op.getSize();
+        op.size();
+        op.setSize(1, 32);
+        op.resize(1, 32);
+        op.setSize(new Dimension(1, 32));
+        op.resize(new Dimension(1, 32));
+        op.getBounds();
+        op.bounds();
+        op.setBounds(10, 10, 10, 10);
+        op.setBounds(new Rectangle(10, 10, 10, 10));
+        op.isLightweight();
+        op.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        op.getCursor();
+        op.isCursorSet();
+        op.inside(1, 2);
+        op.contains(new Point(1, 2));
+        op.isFocusable();
+        op.setFocusable(true);
+        op.setFocusable(false);
+        op.transferFocus();
+        op.getFocusCycleRootAncestor();
+        op.nextFocus();
+        op.transferFocusUpCycle();
+        op.hasFocus();
+        op.isFocusOwner();
+        op.toString();
+        op.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        op.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        op.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        op.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJPanel.java b/jdk/test/javax/swing/Headless/HeadlessJPanel.java
new file mode 100644
index 00000000000..7447f487262
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJPanel.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JPanel constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPanel
+ */
+
+public class HeadlessJPanel {
+    public static void main(String args[]) {
+        JPanel p = new JPanel();
+        p.getAccessibleContext();
+        p.isFocusTraversable();
+        p.setEnabled(false);
+        p.setEnabled(true);
+        p.requestFocus();
+        p.requestFocusInWindow();
+        p.getPreferredSize();
+        p.getMaximumSize();
+        p.getMinimumSize();
+        p.contains(1, 2);
+        Component c1 = p.add(new Component(){});
+        Component c2 = p.add(new Component(){});
+        Component c3 = p.add(new Component(){});
+        Insets ins = p.getInsets();
+        p.getAlignmentY();
+        p.getAlignmentX();
+        p.getGraphics();
+        p.setVisible(false);
+        p.setVisible(true);
+        p.setForeground(Color.red);
+        p.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                p.setFont(f1);
+                p.setFont(f2);
+                p.setFont(f3);
+                p.setFont(f4);
+
+                p.getFontMetrics(f1);
+                p.getFontMetrics(f2);
+                p.getFontMetrics(f3);
+                p.getFontMetrics(f4);
+            }
+        }
+        p.enable();
+        p.disable();
+        p.reshape(10, 10, 10, 10);
+        p.getBounds(new Rectangle(1, 1, 1, 1));
+        p.getSize(new Dimension(1, 2));
+        p.getLocation(new Point(1, 2));
+        p.getX();
+        p.getY();
+        p.getWidth();
+        p.getHeight();
+        p.isOpaque();
+        p.isValidateRoot();
+        p.isOptimizedDrawingEnabled();
+        p.isDoubleBuffered();
+        p.getComponentCount();
+        p.countComponents();
+        p.getComponent(1);
+        p.getComponent(2);
+        Component[] cs = p.getComponents();
+        p.getLayout();
+        p.setLayout(new FlowLayout());
+        p.doLayout();
+        p.layout();
+        p.invalidate();
+        p.validate();
+        p.remove(0);
+        p.remove(c2);
+        p.removeAll();
+        p.preferredSize();
+        p.minimumSize();
+        p.getComponentAt(1, 2);
+        p.locate(1, 2);
+        p.getComponentAt(new Point(1, 2));
+        p.isFocusCycleRoot(new Container());
+        p.transferFocusBackward();
+        p.setName("goober");
+        p.getName();
+        p.getParent();
+        p.getPeer();
+        p.getGraphicsConfiguration();
+        p.getTreeLock();
+        p.getToolkit();
+        p.isValid();
+        p.isDisplayable();
+        p.isVisible();
+        p.isShowing();
+        p.isEnabled();
+        p.enable(false);
+        p.enable(true);
+        p.enableInputMethods(false);
+        p.enableInputMethods(true);
+        p.show();
+        p.show(false);
+        p.show(true);
+        p.hide();
+        p.getForeground();
+        p.isForegroundSet();
+        p.getBackground();
+        p.isBackgroundSet();
+        p.getFont();
+        p.isFontSet();
+        Container c = new Container();
+        c.add(p);
+        p.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            p.setLocale(locale);
+
+        p.getColorModel();
+        p.getLocation();
+
+        boolean exceptions = false;
+        try {
+            p.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        p.location();
+        p.setLocation(1, 2);
+        p.move(1, 2);
+        p.setLocation(new Point(1, 2));
+        p.getSize();
+        p.size();
+        p.setSize(1, 32);
+        p.resize(1, 32);
+        p.setSize(new Dimension(1, 32));
+        p.resize(new Dimension(1, 32));
+        p.getBounds();
+        p.bounds();
+        p.setBounds(10, 10, 10, 10);
+        p.setBounds(new Rectangle(10, 10, 10, 10));
+        p.isLightweight();
+        p.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        p.getCursor();
+        p.isCursorSet();
+        p.inside(1, 2);
+        p.contains(new Point(1, 2));
+        p.isFocusable();
+        p.setFocusable(true);
+        p.setFocusable(false);
+        p.transferFocus();
+        p.getFocusCycleRootAncestor();
+        p.nextFocus();
+        p.transferFocusUpCycle();
+        p.hasFocus();
+        p.isFocusOwner();
+        p.toString();
+        p.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        p.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        p.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        p.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJPasswordField.java b/jdk/test/javax/swing/Headless/HeadlessJPasswordField.java
new file mode 100644
index 00000000000..20a8ae9e95b
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJPasswordField.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that JPasswordField constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPasswordField
+ */
+
+public class HeadlessJPasswordField {
+    public static void main(String args[]) {
+        JPasswordField f = new JPasswordField("field");
+        f.selectAll();
+        f.getSelectionStart();
+        f.getSelectionEnd();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java
new file mode 100644
index 00000000000..2337faaf426
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JPopupMenu constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPopupMenu
+ */
+
+public class HeadlessJPopupMenu {
+    public static void main(String args[]) {
+        JMenu m = new JMenu();
+        m.getAccessibleContext();
+        m.isFocusTraversable();
+        m.setEnabled(false);
+        m.setEnabled(true);
+        m.requestFocus();
+        m.requestFocusInWindow();
+        m.getPreferredSize();
+        m.getMaximumSize();
+        m.getMinimumSize();
+        m.contains(1, 2);
+        Component c1 = m.add(new Component(){});
+        Component c2 = m.add(new Component(){});
+        Component c3 = m.add(new Component(){});
+        Insets ins = m.getInsets();
+        m.getAlignmentY();
+        m.getAlignmentX();
+        m.getGraphics();
+        m.setVisible(false);
+        m.setVisible(true);
+        m.setForeground(Color.red);
+        m.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                m.setFont(f1);
+                m.setFont(f2);
+                m.setFont(f3);
+                m.setFont(f4);
+
+                m.getFontMetrics(f1);
+                m.getFontMetrics(f2);
+                m.getFontMetrics(f3);
+                m.getFontMetrics(f4);
+            }
+        }
+        m.enable();
+        m.disable();
+        m.reshape(10, 10, 10, 10);
+        m.getBounds(new Rectangle(1, 1, 1, 1));
+        m.getSize(new Dimension(1, 2));
+        m.getLocation(new Point(1, 2));
+        m.getX();
+        m.getY();
+        m.getWidth();
+        m.getHeight();
+        m.isOpaque();
+        m.isValidateRoot();
+        m.isOptimizedDrawingEnabled();
+        m.isDoubleBuffered();
+        m.getComponentCount();
+        m.countComponents();
+        Component[] cs = m.getComponents();
+        m.getLayout();
+        m.setLayout(new FlowLayout());
+        m.doLayout();
+        m.layout();
+        m.invalidate();
+        m.validate();
+        m.remove(0);
+        m.remove(c2);
+        m.removeAll();
+        m.preferredSize();
+        m.minimumSize();
+        m.getComponentAt(1, 2);
+        m.locate(1, 2);
+        m.getComponentAt(new Point(1, 2));
+        m.isFocusCycleRoot(new Container());
+        m.transferFocusBackward();
+        m.setName("goober");
+        m.getName();
+        m.getParent();
+        m.getPeer();
+        m.getGraphicsConfiguration();
+        m.getTreeLock();
+        m.getToolkit();
+        m.isValid();
+        m.isDisplayable();
+        m.isVisible();
+        m.isShowing();
+        m.isEnabled();
+        m.enable(false);
+        m.enable(true);
+        m.enableInputMethods(false);
+        m.enableInputMethods(true);
+        m.show();
+        m.show(false);
+        m.show(true);
+        m.hide();
+        m.getForeground();
+        m.isForegroundSet();
+        m.getBackground();
+        m.isBackgroundSet();
+        m.getFont();
+        m.isFontSet();
+        Container c = new Container();
+        c.add(m);
+        m.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            m.setLocale(locale);
+
+        m.getColorModel();
+        m.getLocation();
+
+        boolean exceptions = false;
+        try {
+            m.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        m.location();
+        m.setLocation(1, 2);
+        m.move(1, 2);
+        m.setLocation(new Point(1, 2));
+        m.getSize();
+        m.size();
+        m.setSize(1, 32);
+        m.resize(1, 32);
+        m.setSize(new Dimension(1, 32));
+        m.resize(new Dimension(1, 32));
+        m.getBounds();
+        m.bounds();
+        m.setBounds(10, 10, 10, 10);
+        m.setBounds(new Rectangle(10, 10, 10, 10));
+        m.isLightweight();
+        m.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        m.getCursor();
+        m.isCursorSet();
+        m.inside(1, 2);
+        m.contains(new Point(1, 2));
+        m.isFocusable();
+        m.setFocusable(true);
+        m.setFocusable(false);
+        m.transferFocus();
+        m.getFocusCycleRootAncestor();
+        m.nextFocus();
+        m.transferFocusUpCycle();
+        m.hasFocus();
+        m.isFocusOwner();
+        m.toString();
+        m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        m.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        m.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java
new file mode 100644
index 00000000000..c3f102e9365
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JPopupMenu.Separator constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPopupMenu_Separator
+ */
+
+public class HeadlessJPopupMenu_Separator {
+    public static void main(String args[]) {
+        JPopupMenu.Separator s = new JPopupMenu.Separator();
+        s.getAccessibleContext();
+        s.isFocusTraversable();
+        s.setEnabled(false);
+        s.setEnabled(true);
+        s.requestFocus();
+        s.requestFocusInWindow();
+        s.getPreferredSize();
+        s.getMaximumSize();
+        s.getMinimumSize();
+        s.contains(1, 2);
+        Component c1 = s.add(new Component(){});
+        Component c2 = s.add(new Component(){});
+        Component c3 = s.add(new Component(){});
+        Insets ins = s.getInsets();
+        s.getAlignmentY();
+        s.getAlignmentX();
+        s.getGraphics();
+        s.setVisible(false);
+        s.setVisible(true);
+        s.setForeground(Color.red);
+        s.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                s.setFont(f1);
+                s.setFont(f2);
+                s.setFont(f3);
+                s.setFont(f4);
+
+                s.getFontMetrics(f1);
+                s.getFontMetrics(f2);
+                s.getFontMetrics(f3);
+                s.getFontMetrics(f4);
+            }
+        }
+        s.enable();
+        s.disable();
+        s.reshape(10, 10, 10, 10);
+        s.getBounds(new Rectangle(1, 1, 1, 1));
+        s.getSize(new Dimension(1, 2));
+        s.getLocation(new Point(1, 2));
+        s.getX();
+        s.getY();
+        s.getWidth();
+        s.getHeight();
+        s.isOpaque();
+        s.isValidateRoot();
+        s.isOptimizedDrawingEnabled();
+        s.isDoubleBuffered();
+        s.getComponentCount();
+        s.countComponents();
+        s.getComponent(1);
+        s.getComponent(2);
+        Component[] cs = s.getComponents();
+        s.getLayout();
+        s.setLayout(new FlowLayout());
+        s.doLayout();
+        s.layout();
+        s.invalidate();
+        s.validate();
+        s.remove(0);
+        s.remove(c2);
+        s.removeAll();
+        s.preferredSize();
+        s.minimumSize();
+        s.getComponentAt(1, 2);
+        s.locate(1, 2);
+        s.getComponentAt(new Point(1, 2));
+        s.isFocusCycleRoot(new Container());
+        s.transferFocusBackward();
+        s.setName("goober");
+        s.getName();
+        s.getParent();
+        s.getPeer();
+        s.getGraphicsConfiguration();
+        s.getTreeLock();
+        s.getToolkit();
+        s.isValid();
+        s.isDisplayable();
+        s.isVisible();
+        s.isShowing();
+        s.isEnabled();
+        s.enable(false);
+        s.enable(true);
+        s.enableInputMethods(false);
+        s.enableInputMethods(true);
+        s.show();
+        s.show(false);
+        s.show(true);
+        s.hide();
+        s.getForeground();
+        s.isForegroundSet();
+        s.getBackground();
+        s.isBackgroundSet();
+        s.getFont();
+        s.isFontSet();
+        Container c = new Container();
+        c.add(s);
+        s.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            s.setLocale(locale);
+
+        s.getColorModel();
+        s.getLocation();
+
+        boolean exceptions = false;
+        try {
+            s.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        s.location();
+        s.setLocation(1, 2);
+        s.move(1, 2);
+        s.setLocation(new Point(1, 2));
+        s.getSize();
+        s.size();
+        s.setSize(1, 32);
+        s.resize(1, 32);
+        s.setSize(new Dimension(1, 32));
+        s.resize(new Dimension(1, 32));
+        s.getBounds();
+        s.bounds();
+        s.setBounds(10, 10, 10, 10);
+        s.setBounds(new Rectangle(10, 10, 10, 10));
+        s.isLightweight();
+        s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        s.getCursor();
+        s.isCursorSet();
+        s.inside(1, 2);
+        s.contains(new Point(1, 2));
+        s.isFocusable();
+        s.setFocusable(true);
+        s.setFocusable(false);
+        s.transferFocus();
+        s.getFocusCycleRootAncestor();
+        s.nextFocus();
+        s.transferFocusUpCycle();
+        s.hasFocus();
+        s.isFocusOwner();
+        s.toString();
+        s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        s.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java b/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java
new file mode 100644
index 00000000000..fddeb935583
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JProgressBar constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJProgressBar
+ */
+
+public class HeadlessJProgressBar {
+    public static void main(String args[]) {
+        JProgressBar pb = new JProgressBar();
+        pb.getAccessibleContext();
+        pb.isFocusTraversable();
+        pb.setEnabled(false);
+        pb.setEnabled(true);
+        pb.requestFocus();
+        pb.requestFocusInWindow();
+        pb.getPreferredSize();
+        pb.getMaximumSize();
+        pb.getMinimumSize();
+        pb.contains(1, 2);
+        Component c1 = pb.add(new Component(){});
+        Component c2 = pb.add(new Component(){});
+        Component c3 = pb.add(new Component(){});
+        Insets ins = pb.getInsets();
+        pb.getAlignmentY();
+        pb.getAlignmentX();
+        pb.getGraphics();
+        pb.setVisible(false);
+        pb.setVisible(true);
+        pb.setForeground(Color.red);
+        pb.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                pb.setFont(f1);
+                pb.setFont(f2);
+                pb.setFont(f3);
+                pb.setFont(f4);
+
+                pb.getFontMetrics(f1);
+                pb.getFontMetrics(f2);
+                pb.getFontMetrics(f3);
+                pb.getFontMetrics(f4);
+            }
+        }
+        pb.enable();
+        pb.disable();
+        pb.reshape(10, 10, 10, 10);
+        pb.getBounds(new Rectangle(1, 1, 1, 1));
+        pb.getSize(new Dimension(1, 2));
+        pb.getLocation(new Point(1, 2));
+        pb.getX();
+        pb.getY();
+        pb.getWidth();
+        pb.getHeight();
+        pb.isOpaque();
+        pb.isValidateRoot();
+        pb.isOptimizedDrawingEnabled();
+        pb.isDoubleBuffered();
+        pb.getComponentCount();
+        pb.countComponents();
+        pb.getComponent(1);
+        pb.getComponent(2);
+        Component[] cs = pb.getComponents();
+        pb.getLayout();
+        pb.setLayout(new FlowLayout());
+        pb.doLayout();
+        pb.layout();
+        pb.invalidate();
+        pb.validate();
+        pb.remove(0);
+        pb.remove(c2);
+        pb.removeAll();
+        pb.preferredSize();
+        pb.minimumSize();
+        pb.getComponentAt(1, 2);
+        pb.locate(1, 2);
+        pb.getComponentAt(new Point(1, 2));
+        pb.isFocusCycleRoot(new Container());
+        pb.transferFocusBackward();
+        pb.setName("goober");
+        pb.getName();
+        pb.getParent();
+        pb.getPeer();
+        pb.getGraphicsConfiguration();
+        pb.getTreeLock();
+        pb.getToolkit();
+        pb.isValid();
+        pb.isDisplayable();
+        pb.isVisible();
+        pb.isShowing();
+        pb.isEnabled();
+        pb.enable(false);
+        pb.enable(true);
+        pb.enableInputMethods(false);
+        pb.enableInputMethods(true);
+        pb.show();
+        pb.show(false);
+        pb.show(true);
+        pb.hide();
+        pb.getForeground();
+        pb.isForegroundSet();
+        pb.getBackground();
+        pb.isBackgroundSet();
+        pb.getFont();
+        pb.isFontSet();
+        Container c = new Container();
+        c.add(pb);
+        pb.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            pb.setLocale(locale);
+
+        pb.getColorModel();
+        pb.getLocation();
+
+        boolean exceptions = false;
+        try {
+            pb.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        pb.location();
+        pb.setLocation(1, 2);
+        pb.move(1, 2);
+        pb.setLocation(new Point(1, 2));
+        pb.getSize();
+        pb.size();
+        pb.setSize(1, 32);
+        pb.resize(1, 32);
+        pb.setSize(new Dimension(1, 32));
+        pb.resize(new Dimension(1, 32));
+        pb.getBounds();
+        pb.bounds();
+        pb.setBounds(10, 10, 10, 10);
+        pb.setBounds(new Rectangle(10, 10, 10, 10));
+        pb.isLightweight();
+        pb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        pb.getCursor();
+        pb.isCursorSet();
+        pb.inside(1, 2);
+        pb.contains(new Point(1, 2));
+        pb.isFocusable();
+        pb.setFocusable(true);
+        pb.setFocusable(false);
+        pb.transferFocus();
+        pb.getFocusCycleRootAncestor();
+        pb.nextFocus();
+        pb.transferFocusUpCycle();
+        pb.hasFocus();
+        pb.isFocusOwner();
+        pb.toString();
+        pb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        pb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        pb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        pb.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java b/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java
new file mode 100644
index 00000000000..1c00ffe353b
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JRadioButton constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJRadioButton
+ */
+
+public class HeadlessJRadioButton {
+    public static void main(String args[]) {
+        JRadioButton rb = new JRadioButton();
+        rb.getAccessibleContext();
+        rb.isFocusTraversable();
+        rb.setEnabled(false);
+        rb.setEnabled(true);
+        rb.requestFocus();
+        rb.requestFocusInWindow();
+        rb.getPreferredSize();
+        rb.getMaximumSize();
+        rb.getMinimumSize();
+        rb.contains(1, 2);
+        Component c1 = rb.add(new Component(){});
+        Component c2 = rb.add(new Component(){});
+        Component c3 = rb.add(new Component(){});
+        Insets ins = rb.getInsets();
+        rb.getAlignmentY();
+        rb.getAlignmentX();
+        rb.getGraphics();
+        rb.setVisible(false);
+        rb.setVisible(true);
+        rb.setForeground(Color.red);
+        rb.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                rb.setFont(f1);
+                rb.setFont(f2);
+                rb.setFont(f3);
+                rb.setFont(f4);
+
+                rb.getFontMetrics(f1);
+                rb.getFontMetrics(f2);
+                rb.getFontMetrics(f3);
+                rb.getFontMetrics(f4);
+            }
+        }
+        rb.enable();
+        rb.disable();
+        rb.reshape(10, 10, 10, 10);
+        rb.getBounds(new Rectangle(1, 1, 1, 1));
+        rb.getSize(new Dimension(1, 2));
+        rb.getLocation(new Point(1, 2));
+        rb.getX();
+        rb.getY();
+        rb.getWidth();
+        rb.getHeight();
+        rb.isOpaque();
+        rb.isValidateRoot();
+        rb.isOptimizedDrawingEnabled();
+        rb.isDoubleBuffered();
+        rb.getComponentCount();
+        rb.countComponents();
+        rb.getComponent(1);
+        rb.getComponent(2);
+        Component[] cs = rb.getComponents();
+        rb.getLayout();
+        rb.setLayout(new FlowLayout());
+        rb.doLayout();
+        rb.layout();
+        rb.invalidate();
+        rb.validate();
+        rb.remove(0);
+        rb.remove(c2);
+        rb.removeAll();
+        rb.preferredSize();
+        rb.minimumSize();
+        rb.getComponentAt(1, 2);
+        rb.locate(1, 2);
+        rb.getComponentAt(new Point(1, 2));
+        rb.isFocusCycleRoot(new Container());
+        rb.transferFocusBackward();
+        rb.setName("goober");
+        rb.getName();
+        rb.getParent();
+        rb.getPeer();
+        rb.getGraphicsConfiguration();
+        rb.getTreeLock();
+        rb.getToolkit();
+        rb.isValid();
+        rb.isDisplayable();
+        rb.isVisible();
+        rb.isShowing();
+        rb.isEnabled();
+        rb.enable(false);
+        rb.enable(true);
+        rb.enableInputMethods(false);
+        rb.enableInputMethods(true);
+        rb.show();
+        rb.show(false);
+        rb.show(true);
+        rb.hide();
+        rb.getForeground();
+        rb.isForegroundSet();
+        rb.getBackground();
+        rb.isBackgroundSet();
+        rb.getFont();
+        rb.isFontSet();
+        Container c = new Container();
+        c.add(rb);
+        rb.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            rb.setLocale(locale);
+
+        rb.getColorModel();
+        rb.getLocation();
+
+        boolean exceptions = false;
+        try {
+            rb.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        rb.location();
+        rb.setLocation(1, 2);
+        rb.move(1, 2);
+        rb.setLocation(new Point(1, 2));
+        rb.getSize();
+        rb.size();
+        rb.setSize(1, 32);
+        rb.resize(1, 32);
+        rb.setSize(new Dimension(1, 32));
+        rb.resize(new Dimension(1, 32));
+        rb.getBounds();
+        rb.bounds();
+        rb.setBounds(10, 10, 10, 10);
+        rb.setBounds(new Rectangle(10, 10, 10, 10));
+        rb.isLightweight();
+        rb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        rb.getCursor();
+        rb.isCursorSet();
+        rb.inside(1, 2);
+        rb.contains(new Point(1, 2));
+        rb.isFocusable();
+        rb.setFocusable(true);
+        rb.setFocusable(false);
+        rb.transferFocus();
+        rb.getFocusCycleRootAncestor();
+        rb.nextFocus();
+        rb.transferFocusUpCycle();
+        rb.hasFocus();
+        rb.isFocusOwner();
+        rb.toString();
+        rb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        rb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        rb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        rb.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java b/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java
new file mode 100644
index 00000000000..b6727cdf76e
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JRadioButtonMenuItem constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJRadioButtonMenuItem
+ */
+
+public class HeadlessJRadioButtonMenuItem {
+    public static void main(String args[]) {
+        JRadioButtonMenuItem i = new JRadioButtonMenuItem();
+        i.getAccessibleContext();
+        i.isFocusTraversable();
+        i.setEnabled(false);
+        i.setEnabled(true);
+        i.requestFocus();
+        i.requestFocusInWindow();
+        i.getPreferredSize();
+        i.getMaximumSize();
+        i.getMinimumSize();
+        i.contains(1, 2);
+        Component c1 = i.add(new Component(){});
+        Component c2 = i.add(new Component(){});
+        Component c3 = i.add(new Component(){});
+        Insets ins = i.getInsets();
+        i.getAlignmentY();
+        i.getAlignmentX();
+        i.getGraphics();
+        i.setVisible(false);
+        i.setVisible(true);
+        i.setForeground(Color.red);
+        i.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                i.setFont(f1);
+                i.setFont(f2);
+                i.setFont(f3);
+                i.setFont(f4);
+
+                i.getFontMetrics(f1);
+                i.getFontMetrics(f2);
+                i.getFontMetrics(f3);
+                i.getFontMetrics(f4);
+            }
+        }
+        i.enable();
+        i.disable();
+        i.reshape(10, 10, 10, 10);
+        i.getBounds(new Rectangle(1, 1, 1, 1));
+        i.getSize(new Dimension(1, 2));
+        i.getLocation(new Point(1, 2));
+        i.getX();
+        i.getY();
+        i.getWidth();
+        i.getHeight();
+        i.isOpaque();
+        i.isValidateRoot();
+        i.isOptimizedDrawingEnabled();
+        i.isDoubleBuffered();
+        i.getComponentCount();
+        i.countComponents();
+        i.getComponent(1);
+        i.getComponent(2);
+        Component[] cs = i.getComponents();
+        i.getLayout();
+        i.setLayout(new FlowLayout());
+        i.doLayout();
+        i.layout();
+        i.invalidate();
+        i.validate();
+        i.remove(0);
+        i.remove(c2);
+        i.removeAll();
+        i.preferredSize();
+        i.minimumSize();
+        i.getComponentAt(1, 2);
+        i.locate(1, 2);
+        i.getComponentAt(new Point(1, 2));
+        i.isFocusCycleRoot(new Container());
+        i.transferFocusBackward();
+        i.setName("goober");
+        i.getName();
+        i.getParent();
+        i.getPeer();
+        i.getGraphicsConfiguration();
+        i.getTreeLock();
+        i.getToolkit();
+        i.isValid();
+        i.isDisplayable();
+        i.isVisible();
+        i.isShowing();
+        i.isEnabled();
+        i.enable(false);
+        i.enable(true);
+        i.enableInputMethods(false);
+        i.enableInputMethods(true);
+        i.show();
+        i.show(false);
+        i.show(true);
+        i.hide();
+        i.getForeground();
+        i.isForegroundSet();
+        i.getBackground();
+        i.isBackgroundSet();
+        i.getFont();
+        i.isFontSet();
+        Container c = new Container();
+        c.add(i);
+        i.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            i.setLocale(locale);
+
+        i.getColorModel();
+        i.getLocation();
+
+        boolean exceptions = false;
+        try {
+            i.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        i.location();
+        i.setLocation(1, 2);
+        i.move(1, 2);
+        i.setLocation(new Point(1, 2));
+        i.getSize();
+        i.size();
+        i.setSize(1, 32);
+        i.resize(1, 32);
+        i.setSize(new Dimension(1, 32));
+        i.resize(new Dimension(1, 32));
+        i.getBounds();
+        i.bounds();
+        i.setBounds(10, 10, 10, 10);
+        i.setBounds(new Rectangle(10, 10, 10, 10));
+        i.isLightweight();
+        i.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        i.getCursor();
+        i.isCursorSet();
+        i.inside(1, 2);
+        i.contains(new Point(1, 2));
+        i.isFocusable();
+        i.setFocusable(true);
+        i.setFocusable(false);
+        i.transferFocus();
+        i.getFocusCycleRootAncestor();
+        i.nextFocus();
+        i.transferFocusUpCycle();
+        i.hasFocus();
+        i.isFocusOwner();
+        i.toString();
+        i.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        i.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        i.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        i.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJRootPane.java b/jdk/test/javax/swing/Headless/HeadlessJRootPane.java
new file mode 100644
index 00000000000..b69f0d373fc
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJRootPane.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JRootPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJRootPane
+ */
+
+public class HeadlessJRootPane {
+    public static void main(String args[]) {
+        JRootPane rp = new JRootPane();
+        rp.getAccessibleContext();
+        rp.isFocusTraversable();
+        rp.setEnabled(false);
+        rp.setEnabled(true);
+        rp.requestFocus();
+        rp.requestFocusInWindow();
+        rp.getPreferredSize();
+        rp.getMaximumSize();
+        rp.getMinimumSize();
+        rp.contains(1, 2);
+        Component c1 = rp.add(new Component(){});
+        Component c2 = rp.add(new Component(){});
+        Component c3 = rp.add(new Component(){});
+        Insets ins = rp.getInsets();
+        rp.getAlignmentY();
+        rp.getAlignmentX();
+        rp.getGraphics();
+        rp.setVisible(false);
+        rp.setVisible(true);
+        rp.setForeground(Color.red);
+        rp.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                rp.setFont(f1);
+                rp.setFont(f2);
+                rp.setFont(f3);
+                rp.setFont(f4);
+
+                rp.getFontMetrics(f1);
+                rp.getFontMetrics(f2);
+                rp.getFontMetrics(f3);
+                rp.getFontMetrics(f4);
+            }
+        }
+        rp.enable();
+        rp.disable();
+        rp.reshape(10, 10, 10, 10);
+        rp.getBounds(new Rectangle(1, 1, 1, 1));
+        rp.getSize(new Dimension(1, 2));
+        rp.getLocation(new Point(1, 2));
+        rp.getX();
+        rp.getY();
+        rp.getWidth();
+        rp.getHeight();
+        rp.isOpaque();
+        rp.isValidateRoot();
+        rp.isOptimizedDrawingEnabled();
+        rp.isDoubleBuffered();
+        rp.getComponentCount();
+        rp.countComponents();
+        rp.getComponent(1);
+        rp.getComponent(2);
+        Component[] cs = rp.getComponents();
+        rp.getLayout();
+        rp.setLayout(new FlowLayout());
+        rp.doLayout();
+        rp.layout();
+        rp.invalidate();
+        rp.validate();
+        rp.remove(0);
+        rp.remove(c2);
+        rp.removeAll();
+        rp.preferredSize();
+        rp.minimumSize();
+        rp.getComponentAt(1, 2);
+        rp.locate(1, 2);
+        rp.getComponentAt(new Point(1, 2));
+        rp.isFocusCycleRoot(new Container());
+        rp.transferFocusBackward();
+        rp.setName("goober");
+        rp.getName();
+        rp.getParent();
+        rp.getPeer();
+        rp.getGraphicsConfiguration();
+        rp.getTreeLock();
+        rp.getToolkit();
+        rp.isValid();
+        rp.isDisplayable();
+        rp.isVisible();
+        rp.isShowing();
+        rp.isEnabled();
+        rp.enable(false);
+        rp.enable(true);
+        rp.enableInputMethods(false);
+        rp.enableInputMethods(true);
+        rp.show();
+        rp.show(false);
+        rp.show(true);
+        rp.hide();
+        rp.getForeground();
+        rp.isForegroundSet();
+        rp.getBackground();
+        rp.isBackgroundSet();
+        rp.getFont();
+        rp.isFontSet();
+        Container c = new Container();
+        c.add(rp);
+        rp.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            rp.setLocale(locale);
+
+        rp.getColorModel();
+        rp.getLocation();
+
+        boolean exceptions = false;
+        try {
+            rp.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        rp.location();
+        rp.setLocation(1, 2);
+        rp.move(1, 2);
+        rp.setLocation(new Point(1, 2));
+        rp.getSize();
+        rp.size();
+        rp.setSize(1, 32);
+        rp.resize(1, 32);
+        rp.setSize(new Dimension(1, 32));
+        rp.resize(new Dimension(1, 32));
+        rp.getBounds();
+        rp.bounds();
+        rp.setBounds(10, 10, 10, 10);
+        rp.setBounds(new Rectangle(10, 10, 10, 10));
+        rp.isLightweight();
+        rp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        rp.getCursor();
+        rp.isCursorSet();
+        rp.inside(1, 2);
+        rp.contains(new Point(1, 2));
+        rp.isFocusable();
+        rp.setFocusable(true);
+        rp.setFocusable(false);
+        rp.transferFocus();
+        rp.getFocusCycleRootAncestor();
+        rp.nextFocus();
+        rp.transferFocusUpCycle();
+        rp.hasFocus();
+        rp.isFocusOwner();
+        rp.toString();
+        rp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        rp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        rp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        rp.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java b/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java
new file mode 100644
index 00000000000..4241bc9b47b
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JScrollBar constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJScrollBar
+ */
+
+public class HeadlessJScrollBar {
+    public static void main(String args[]) {
+        JScrollBar sb = new JScrollBar();
+        sb.getAccessibleContext();
+        sb.isFocusTraversable();
+        sb.setEnabled(false);
+        sb.setEnabled(true);
+        sb.requestFocus();
+        sb.requestFocusInWindow();
+        sb.getPreferredSize();
+        sb.getMaximumSize();
+        sb.getMinimumSize();
+        sb.contains(1, 2);
+        Component c1 = sb.add(new Component(){});
+        Component c2 = sb.add(new Component(){});
+        Component c3 = sb.add(new Component(){});
+        Insets ins = sb.getInsets();
+        sb.getAlignmentY();
+        sb.getAlignmentX();
+        sb.getGraphics();
+        sb.setVisible(false);
+        sb.setVisible(true);
+        sb.setForeground(Color.red);
+        sb.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                sb.setFont(f1);
+                sb.setFont(f2);
+                sb.setFont(f3);
+                sb.setFont(f4);
+
+                sb.getFontMetrics(f1);
+                sb.getFontMetrics(f2);
+                sb.getFontMetrics(f3);
+                sb.getFontMetrics(f4);
+            }
+        }
+        sb.enable();
+        sb.disable();
+        sb.reshape(10, 10, 10, 10);
+        sb.getBounds(new Rectangle(1, 1, 1, 1));
+        sb.getSize(new Dimension(1, 2));
+        sb.getLocation(new Point(1, 2));
+        sb.getX();
+        sb.getY();
+        sb.getWidth();
+        sb.getHeight();
+        sb.isOpaque();
+        sb.isValidateRoot();
+        sb.isOptimizedDrawingEnabled();
+        sb.isDoubleBuffered();
+        sb.getComponentCount();
+        sb.countComponents();
+        sb.getComponent(1);
+        sb.getComponent(2);
+        Component[] cs = sb.getComponents();
+        sb.getLayout();
+        sb.setLayout(new FlowLayout());
+        sb.doLayout();
+        sb.layout();
+        sb.invalidate();
+        sb.validate();
+        sb.remove(0);
+        sb.remove(c2);
+        sb.removeAll();
+        sb.preferredSize();
+        sb.minimumSize();
+        sb.getComponentAt(1, 2);
+        sb.locate(1, 2);
+        sb.getComponentAt(new Point(1, 2));
+        sb.isFocusCycleRoot(new Container());
+        sb.transferFocusBackward();
+        sb.setName("goober");
+        sb.getName();
+        sb.getParent();
+        sb.getPeer();
+        sb.getGraphicsConfiguration();
+        sb.getTreeLock();
+        sb.getToolkit();
+        sb.isValid();
+        sb.isDisplayable();
+        sb.isVisible();
+        sb.isShowing();
+        sb.isEnabled();
+        sb.enable(false);
+        sb.enable(true);
+        sb.enableInputMethods(false);
+        sb.enableInputMethods(true);
+        sb.show();
+        sb.show(false);
+        sb.show(true);
+        sb.hide();
+        sb.getForeground();
+        sb.isForegroundSet();
+        sb.getBackground();
+        sb.isBackgroundSet();
+        sb.getFont();
+        sb.isFontSet();
+        Container c = new Container();
+        c.add(sb);
+        sb.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            sb.setLocale(locale);
+
+        sb.getColorModel();
+        sb.getLocation();
+
+        boolean exceptions = false;
+        try {
+            sb.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        sb.location();
+        sb.setLocation(1, 2);
+        sb.move(1, 2);
+        sb.setLocation(new Point(1, 2));
+        sb.getSize();
+        sb.size();
+        sb.setSize(1, 32);
+        sb.resize(1, 32);
+        sb.setSize(new Dimension(1, 32));
+        sb.resize(new Dimension(1, 32));
+        sb.getBounds();
+        sb.bounds();
+        sb.setBounds(10, 10, 10, 10);
+        sb.setBounds(new Rectangle(10, 10, 10, 10));
+        sb.isLightweight();
+        sb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        sb.getCursor();
+        sb.isCursorSet();
+        sb.inside(1, 2);
+        sb.contains(new Point(1, 2));
+        sb.isFocusable();
+        sb.setFocusable(true);
+        sb.setFocusable(false);
+        sb.transferFocus();
+        sb.getFocusCycleRootAncestor();
+        sb.nextFocus();
+        sb.transferFocusUpCycle();
+        sb.hasFocus();
+        sb.isFocusOwner();
+        sb.toString();
+        sb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        sb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        sb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        sb.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java b/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java
new file mode 100644
index 00000000000..a14c1d820cc
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JScrollPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJScrollPane
+ */
+
+public class HeadlessJScrollPane {
+    public static void main(String args[]) {
+        JScrollPane sp = new JScrollPane();
+        sp.getAccessibleContext();
+        sp.isFocusTraversable();
+        sp.setEnabled(false);
+        sp.setEnabled(true);
+        sp.requestFocus();
+        sp.requestFocusInWindow();
+        sp.getPreferredSize();
+        sp.getMaximumSize();
+        sp.getMinimumSize();
+        sp.contains(1, 2);
+        Component c1 = sp.add(new Component(){});
+        Component c2 = sp.add(new Component(){});
+        Component c3 = sp.add(new Component(){});
+        Insets ins = sp.getInsets();
+        sp.getAlignmentY();
+        sp.getAlignmentX();
+        sp.getGraphics();
+        sp.setVisible(false);
+        sp.setVisible(true);
+        sp.setForeground(Color.red);
+        sp.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                sp.setFont(f1);
+                sp.setFont(f2);
+                sp.setFont(f3);
+                sp.setFont(f4);
+
+                sp.getFontMetrics(f1);
+                sp.getFontMetrics(f2);
+                sp.getFontMetrics(f3);
+                sp.getFontMetrics(f4);
+            }
+        }
+        sp.enable();
+        sp.disable();
+        sp.reshape(10, 10, 10, 10);
+        sp.getBounds(new Rectangle(1, 1, 1, 1));
+        sp.getSize(new Dimension(1, 2));
+        sp.getLocation(new Point(1, 2));
+        sp.getX();
+        sp.getY();
+        sp.getWidth();
+        sp.getHeight();
+        sp.isOpaque();
+        sp.isValidateRoot();
+        sp.isOptimizedDrawingEnabled();
+        sp.isDoubleBuffered();
+        sp.getComponentCount();
+        sp.countComponents();
+        sp.getComponent(1);
+        sp.getComponent(2);
+        Component[] cs = sp.getComponents();
+        sp.getLayout();
+        sp.setLayout(new ScrollPaneLayout());
+        sp.doLayout();
+        sp.layout();
+        sp.invalidate();
+        sp.validate();
+        sp.remove(0);
+        sp.remove(c2);
+        sp.removeAll();
+        sp.preferredSize();
+        sp.minimumSize();
+        sp.getComponentAt(1, 2);
+        sp.locate(1, 2);
+        sp.getComponentAt(new Point(1, 2));
+        sp.isFocusCycleRoot(new Container());
+        sp.transferFocusBackward();
+        sp.setName("goober");
+        sp.getName();
+        sp.getParent();
+        sp.getPeer();
+        sp.getGraphicsConfiguration();
+        sp.getTreeLock();
+        sp.getToolkit();
+        sp.isValid();
+        sp.isDisplayable();
+        sp.isVisible();
+        sp.isShowing();
+        sp.isEnabled();
+        sp.enable(false);
+        sp.enable(true);
+        sp.enableInputMethods(false);
+        sp.enableInputMethods(true);
+        sp.show();
+        sp.show(false);
+        sp.show(true);
+        sp.hide();
+        sp.getForeground();
+        sp.isForegroundSet();
+        sp.getBackground();
+        sp.isBackgroundSet();
+        sp.getFont();
+        sp.isFontSet();
+        Container c = new Container();
+        c.add(sp);
+        sp.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            sp.setLocale(locale);
+
+        sp.getColorModel();
+        sp.getLocation();
+
+        boolean exceptions = false;
+        try {
+            sp.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        sp.location();
+        sp.setLocation(1, 2);
+        sp.move(1, 2);
+        sp.setLocation(new Point(1, 2));
+        sp.getSize();
+        sp.size();
+        sp.setSize(1, 32);
+        sp.resize(1, 32);
+        sp.setSize(new Dimension(1, 32));
+        sp.resize(new Dimension(1, 32));
+        sp.getBounds();
+        sp.bounds();
+        sp.setBounds(10, 10, 10, 10);
+        sp.setBounds(new Rectangle(10, 10, 10, 10));
+        sp.isLightweight();
+        sp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        sp.getCursor();
+        sp.isCursorSet();
+        sp.inside(1, 2);
+        sp.contains(new Point(1, 2));
+        sp.isFocusable();
+        sp.setFocusable(true);
+        sp.setFocusable(false);
+        sp.transferFocus();
+        sp.getFocusCycleRootAncestor();
+        sp.nextFocus();
+        sp.transferFocusUpCycle();
+        sp.hasFocus();
+        sp.isFocusOwner();
+        sp.toString();
+        sp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        sp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        sp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        sp.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJSeparator.java b/jdk/test/javax/swing/Headless/HeadlessJSeparator.java
new file mode 100644
index 00000000000..51d7fc67d26
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJSeparator.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSeparator constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSeparator
+ */
+
+public class HeadlessJSeparator {
+    public static void main(String args[]) {
+        JSeparator sp = new JSeparator();
+        sp.getAccessibleContext();
+        sp.isFocusTraversable();
+        sp.setEnabled(false);
+        sp.setEnabled(true);
+        sp.requestFocus();
+        sp.requestFocusInWindow();
+        sp.getPreferredSize();
+        sp.getMaximumSize();
+        sp.getMinimumSize();
+        sp.contains(1, 2);
+        Component c1 = sp.add(new Component(){});
+        Component c2 = sp.add(new Component(){});
+        Component c3 = sp.add(new Component(){});
+        Insets ins = sp.getInsets();
+        sp.getAlignmentY();
+        sp.getAlignmentX();
+        sp.getGraphics();
+        sp.setVisible(false);
+        sp.setVisible(true);
+        sp.setForeground(Color.red);
+        sp.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                sp.setFont(f1);
+                sp.setFont(f2);
+                sp.setFont(f3);
+                sp.setFont(f4);
+
+                sp.getFontMetrics(f1);
+                sp.getFontMetrics(f2);
+                sp.getFontMetrics(f3);
+                sp.getFontMetrics(f4);
+            }
+        }
+        sp.enable();
+        sp.disable();
+        sp.reshape(10, 10, 10, 10);
+        sp.getBounds(new Rectangle(1, 1, 1, 1));
+        sp.getSize(new Dimension(1, 2));
+        sp.getLocation(new Point(1, 2));
+        sp.getX();
+        sp.getY();
+        sp.getWidth();
+        sp.getHeight();
+        sp.isOpaque();
+        sp.isValidateRoot();
+        sp.isOptimizedDrawingEnabled();
+        sp.isDoubleBuffered();
+        sp.getComponentCount();
+        sp.countComponents();
+        sp.getComponent(1);
+        sp.getComponent(2);
+        Component[] cs = sp.getComponents();
+        sp.getLayout();
+        sp.setLayout(new FlowLayout());
+        sp.doLayout();
+        sp.layout();
+        sp.invalidate();
+        sp.validate();
+        sp.remove(0);
+        sp.remove(c2);
+        sp.removeAll();
+        sp.preferredSize();
+        sp.minimumSize();
+        sp.getComponentAt(1, 2);
+        sp.locate(1, 2);
+        sp.getComponentAt(new Point(1, 2));
+        sp.isFocusCycleRoot(new Container());
+        sp.transferFocusBackward();
+        sp.setName("goober");
+        sp.getName();
+        sp.getParent();
+        sp.getPeer();
+        sp.getGraphicsConfiguration();
+        sp.getTreeLock();
+        sp.getToolkit();
+        sp.isValid();
+        sp.isDisplayable();
+        sp.isVisible();
+        sp.isShowing();
+        sp.isEnabled();
+        sp.enable(false);
+        sp.enable(true);
+        sp.enableInputMethods(false);
+        sp.enableInputMethods(true);
+        sp.show();
+        sp.show(false);
+        sp.show(true);
+        sp.hide();
+        sp.getForeground();
+        sp.isForegroundSet();
+        sp.getBackground();
+        sp.isBackgroundSet();
+        sp.getFont();
+        sp.isFontSet();
+        Container c = new Container();
+        c.add(sp);
+        sp.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            sp.setLocale(locale);
+
+        sp.getColorModel();
+        sp.getLocation();
+
+        boolean exceptions = false;
+        try {
+            sp.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        sp.location();
+        sp.setLocation(1, 2);
+        sp.move(1, 2);
+        sp.setLocation(new Point(1, 2));
+        sp.getSize();
+        sp.size();
+        sp.setSize(1, 32);
+        sp.resize(1, 32);
+        sp.setSize(new Dimension(1, 32));
+        sp.resize(new Dimension(1, 32));
+        sp.getBounds();
+        sp.bounds();
+        sp.setBounds(10, 10, 10, 10);
+        sp.setBounds(new Rectangle(10, 10, 10, 10));
+        sp.isLightweight();
+        sp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        sp.getCursor();
+        sp.isCursorSet();
+        sp.inside(1, 2);
+        sp.contains(new Point(1, 2));
+        sp.isFocusable();
+        sp.setFocusable(true);
+        sp.setFocusable(false);
+        sp.transferFocus();
+        sp.getFocusCycleRootAncestor();
+        sp.nextFocus();
+        sp.transferFocusUpCycle();
+        sp.hasFocus();
+        sp.isFocusOwner();
+        sp.toString();
+        sp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        sp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        sp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        sp.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJSlider.java b/jdk/test/javax/swing/Headless/HeadlessJSlider.java
new file mode 100644
index 00000000000..ce9e3c6f23b
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJSlider.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSlider constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSlider
+ */
+
+public class HeadlessJSlider {
+    public static void main(String args[]) {
+        JSlider s = new JSlider();
+        s.getAccessibleContext();
+        s.isFocusTraversable();
+        s.setEnabled(false);
+        s.setEnabled(true);
+        s.requestFocus();
+        s.requestFocusInWindow();
+        s.getPreferredSize();
+        s.getMaximumSize();
+        s.getMinimumSize();
+        s.contains(1, 2);
+        Component c1 = s.add(new Component(){});
+        Component c2 = s.add(new Component(){});
+        Component c3 = s.add(new Component(){});
+        Insets ins = s.getInsets();
+        s.getAlignmentY();
+        s.getAlignmentX();
+        s.getGraphics();
+        s.setVisible(false);
+        s.setVisible(true);
+        s.setForeground(Color.red);
+        s.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                s.setFont(f1);
+                s.setFont(f2);
+                s.setFont(f3);
+                s.setFont(f4);
+
+                s.getFontMetrics(f1);
+                s.getFontMetrics(f2);
+                s.getFontMetrics(f3);
+                s.getFontMetrics(f4);
+            }
+        }
+        s.enable();
+        s.disable();
+        s.reshape(10, 10, 10, 10);
+        s.getBounds(new Rectangle(1, 1, 1, 1));
+        s.getSize(new Dimension(1, 2));
+        s.getLocation(new Point(1, 2));
+        s.getX();
+        s.getY();
+        s.getWidth();
+        s.getHeight();
+        s.isOpaque();
+        s.isValidateRoot();
+        s.isOptimizedDrawingEnabled();
+        s.isDoubleBuffered();
+        s.getComponentCount();
+        s.countComponents();
+        s.getComponent(1);
+        s.getComponent(2);
+        Component[] cs = s.getComponents();
+        s.getLayout();
+        s.setLayout(new FlowLayout());
+        s.doLayout();
+        s.layout();
+        s.invalidate();
+        s.validate();
+        s.remove(0);
+        s.remove(c2);
+        s.removeAll();
+        s.preferredSize();
+        s.minimumSize();
+        s.getComponentAt(1, 2);
+        s.locate(1, 2);
+        s.getComponentAt(new Point(1, 2));
+        s.isFocusCycleRoot(new Container());
+        s.transferFocusBackward();
+        s.setName("goober");
+        s.getName();
+        s.getParent();
+        s.getPeer();
+        s.getGraphicsConfiguration();
+        s.getTreeLock();
+        s.getToolkit();
+        s.isValid();
+        s.isDisplayable();
+        s.isVisible();
+        s.isShowing();
+        s.isEnabled();
+        s.enable(false);
+        s.enable(true);
+        s.enableInputMethods(false);
+        s.enableInputMethods(true);
+        s.show();
+        s.show(false);
+        s.show(true);
+        s.hide();
+        s.getForeground();
+        s.isForegroundSet();
+        s.getBackground();
+        s.isBackgroundSet();
+        s.getFont();
+        s.isFontSet();
+        Container c = new Container();
+        c.add(s);
+        s.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            s.setLocale(locale);
+
+        s.getColorModel();
+        s.getLocation();
+
+        boolean exceptions = false;
+        try {
+            s.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        s.location();
+        s.setLocation(1, 2);
+        s.move(1, 2);
+        s.setLocation(new Point(1, 2));
+        s.getSize();
+        s.size();
+        s.setSize(1, 32);
+        s.resize(1, 32);
+        s.setSize(new Dimension(1, 32));
+        s.resize(new Dimension(1, 32));
+        s.getBounds();
+        s.bounds();
+        s.setBounds(10, 10, 10, 10);
+        s.setBounds(new Rectangle(10, 10, 10, 10));
+        s.isLightweight();
+        s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        s.getCursor();
+        s.isCursorSet();
+        s.inside(1, 2);
+        s.contains(new Point(1, 2));
+        s.isFocusable();
+        s.setFocusable(true);
+        s.setFocusable(false);
+        s.transferFocus();
+        s.getFocusCycleRootAncestor();
+        s.nextFocus();
+        s.transferFocusUpCycle();
+        s.hasFocus();
+        s.isFocusOwner();
+        s.toString();
+        s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        s.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJSpinner.java b/jdk/test/javax/swing/Headless/HeadlessJSpinner.java
new file mode 100644
index 00000000000..071913e615e
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJSpinner.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSpinner constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSpinner
+ */
+
+public class HeadlessJSpinner {
+    public static void main(String args[]) {
+        JSpinner s = new JSpinner();
+        s.getAccessibleContext();
+        s.isFocusTraversable();
+        s.setEnabled(false);
+        s.setEnabled(true);
+        s.requestFocus();
+        s.requestFocusInWindow();
+        s.getPreferredSize();
+        s.getMaximumSize();
+        s.getMinimumSize();
+        s.contains(1, 2);
+        Component c1 = s.add(new Component(){});
+        Component c2 = s.add(new Component(){});
+        Component c3 = s.add(new Component(){});
+        Insets ins = s.getInsets();
+        s.getAlignmentY();
+        s.getAlignmentX();
+        s.getGraphics();
+        s.setVisible(false);
+        s.setVisible(true);
+        s.setForeground(Color.red);
+        s.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                s.setFont(f1);
+                s.setFont(f2);
+                s.setFont(f3);
+                s.setFont(f4);
+
+                s.getFontMetrics(f1);
+                s.getFontMetrics(f2);
+                s.getFontMetrics(f3);
+                s.getFontMetrics(f4);
+            }
+        }
+        s.enable();
+        s.disable();
+        s.reshape(10, 10, 10, 10);
+        s.getBounds(new Rectangle(1, 1, 1, 1));
+        s.getSize(new Dimension(1, 2));
+        s.getLocation(new Point(1, 2));
+        s.getX();
+        s.getY();
+        s.getWidth();
+        s.getHeight();
+        s.isOpaque();
+        s.isValidateRoot();
+        s.isOptimizedDrawingEnabled();
+        s.isDoubleBuffered();
+        s.getComponentCount();
+        s.countComponents();
+        s.getComponent(1);
+        s.getComponent(2);
+        Component[] cs = s.getComponents();
+        s.getLayout();
+        s.setLayout(new FlowLayout());
+        s.doLayout();
+        s.layout();
+        s.invalidate();
+        s.validate();
+        s.remove(0);
+        s.remove(c2);
+        s.removeAll();
+        s.preferredSize();
+        s.minimumSize();
+        s.getComponentAt(1, 2);
+        s.locate(1, 2);
+        s.getComponentAt(new Point(1, 2));
+        s.isFocusCycleRoot(new Container());
+        s.transferFocusBackward();
+        s.setName("goober");
+        s.getName();
+        s.getParent();
+        s.getPeer();
+        s.getGraphicsConfiguration();
+        s.getTreeLock();
+        s.getToolkit();
+        s.isValid();
+        s.isDisplayable();
+        s.isVisible();
+        s.isShowing();
+        s.isEnabled();
+        s.enable(false);
+        s.enable(true);
+        s.enableInputMethods(false);
+        s.enableInputMethods(true);
+        s.show();
+        s.show(false);
+        s.show(true);
+        s.hide();
+        s.getForeground();
+        s.isForegroundSet();
+        s.getBackground();
+        s.isBackgroundSet();
+        s.getFont();
+        s.isFontSet();
+        Container c = new Container();
+        c.add(s);
+        s.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            s.setLocale(locale);
+
+        s.getColorModel();
+        s.getLocation();
+
+        boolean exceptions = false;
+        try {
+            s.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        s.location();
+        s.setLocation(1, 2);
+        s.move(1, 2);
+        s.setLocation(new Point(1, 2));
+        s.getSize();
+        s.size();
+        s.setSize(1, 32);
+        s.resize(1, 32);
+        s.setSize(new Dimension(1, 32));
+        s.resize(new Dimension(1, 32));
+        s.getBounds();
+        s.bounds();
+        s.setBounds(10, 10, 10, 10);
+        s.setBounds(new Rectangle(10, 10, 10, 10));
+        s.isLightweight();
+        s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        s.getCursor();
+        s.isCursorSet();
+        s.inside(1, 2);
+        s.contains(new Point(1, 2));
+        s.isFocusable();
+        s.setFocusable(true);
+        s.setFocusable(false);
+        s.transferFocus();
+        s.getFocusCycleRootAncestor();
+        s.nextFocus();
+        s.transferFocusUpCycle();
+        s.hasFocus();
+        s.isFocusOwner();
+        s.toString();
+        s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        s.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java b/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java
new file mode 100644
index 00000000000..9988df8c366
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSplitPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSplitPane
+ */
+
+public class HeadlessJSplitPane {
+    public static void main(String args[]) {
+        JSplitPane s = new JSplitPane();
+        s.getAccessibleContext();
+        s.isFocusTraversable();
+        s.setEnabled(false);
+        s.setEnabled(true);
+        s.requestFocus();
+        s.requestFocusInWindow();
+        s.getPreferredSize();
+        s.getMaximumSize();
+        s.getMinimumSize();
+        s.contains(1, 2);
+        Insets ins = s.getInsets();
+        s.getAlignmentY();
+        s.getAlignmentX();
+        s.getGraphics();
+        s.setVisible(false);
+        s.setVisible(true);
+        s.setForeground(Color.red);
+        s.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                s.setFont(f1);
+                s.setFont(f2);
+                s.setFont(f3);
+                s.setFont(f4);
+
+                s.getFontMetrics(f1);
+                s.getFontMetrics(f2);
+                s.getFontMetrics(f3);
+                s.getFontMetrics(f4);
+            }
+        }
+        s.enable();
+        s.disable();
+        s.reshape(10, 10, 10, 10);
+        s.getBounds(new Rectangle(1, 1, 1, 1));
+        s.getSize(new Dimension(1, 2));
+        s.getLocation(new Point(1, 2));
+        s.getX();
+        s.getY();
+        s.getWidth();
+        s.getHeight();
+        s.isOpaque();
+        s.isValidateRoot();
+        s.isOptimizedDrawingEnabled();
+        s.isDoubleBuffered();
+        s.getComponentCount();
+        s.countComponents();
+        s.getComponent(1);
+        s.getComponent(2);
+        Component[] cs = s.getComponents();
+        s.getLayout();
+        s.setLayout(new FlowLayout());
+        s.doLayout();
+        s.layout();
+        s.invalidate();
+        s.validate();
+        s.preferredSize();
+        s.minimumSize();
+        s.getComponentAt(1, 2);
+        s.locate(1, 2);
+        s.getComponentAt(new Point(1, 2));
+        s.isFocusCycleRoot(new Container());
+        s.transferFocusBackward();
+        s.setName("goober");
+        s.getName();
+        s.getParent();
+        s.getPeer();
+        s.getGraphicsConfiguration();
+        s.getTreeLock();
+        s.getToolkit();
+        s.isValid();
+        s.isDisplayable();
+        s.isVisible();
+        s.isShowing();
+        s.isEnabled();
+        s.enable(false);
+        s.enable(true);
+        s.enableInputMethods(false);
+        s.enableInputMethods(true);
+        s.show();
+        s.show(false);
+        s.show(true);
+        s.hide();
+        s.getForeground();
+        s.isForegroundSet();
+        s.getBackground();
+        s.isBackgroundSet();
+        s.getFont();
+        s.isFontSet();
+        Container c = new Container();
+        c.add(s);
+        s.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            s.setLocale(locale);
+
+        s.getColorModel();
+        s.getLocation();
+
+        boolean exceptions = false;
+        try {
+            s.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        s.location();
+        s.setLocation(1, 2);
+        s.move(1, 2);
+        s.setLocation(new Point(1, 2));
+        s.getSize();
+        s.size();
+        s.setSize(1, 32);
+        s.resize(1, 32);
+        s.setSize(new Dimension(1, 32));
+        s.resize(new Dimension(1, 32));
+        s.getBounds();
+        s.bounds();
+        s.setBounds(10, 10, 10, 10);
+        s.setBounds(new Rectangle(10, 10, 10, 10));
+        s.isLightweight();
+        s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        s.getCursor();
+        s.isCursorSet();
+        s.inside(1, 2);
+        s.contains(new Point(1, 2));
+        s.isFocusable();
+        s.setFocusable(true);
+        s.setFocusable(false);
+        s.transferFocus();
+        s.getFocusCycleRootAncestor();
+        s.nextFocus();
+        s.transferFocusUpCycle();
+        s.hasFocus();
+        s.isFocusOwner();
+        s.toString();
+        s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        s.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java b/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java
new file mode 100644
index 00000000000..12b11619726
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTabbedPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTabbedPane
+ */
+
+public class HeadlessJTabbedPane {
+    public static void main(String args[]) {
+        JTabbedPane s = new JTabbedPane();
+        s.getAccessibleContext();
+        s.isFocusTraversable();
+        s.setEnabled(false);
+        s.setEnabled(true);
+        s.requestFocus();
+        s.requestFocusInWindow();
+        s.getPreferredSize();
+        s.getMaximumSize();
+        s.getMinimumSize();
+        s.contains(1, 2);
+        Component c1 = s.add(new Component(){});
+        Component c2 = s.add(new Component(){});
+        Component c3 = s.add(new Component(){});
+        Insets ins = s.getInsets();
+        s.getAlignmentY();
+        s.getAlignmentX();
+        s.getGraphics();
+        s.setVisible(false);
+        s.setVisible(true);
+        s.setForeground(Color.red);
+        s.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                s.setFont(f1);
+                s.setFont(f2);
+                s.setFont(f3);
+                s.setFont(f4);
+
+                s.getFontMetrics(f1);
+                s.getFontMetrics(f2);
+                s.getFontMetrics(f3);
+                s.getFontMetrics(f4);
+            }
+        }
+        s.enable();
+        s.disable();
+        s.reshape(10, 10, 10, 10);
+        s.getBounds(new Rectangle(1, 1, 1, 1));
+        s.getSize(new Dimension(1, 2));
+        s.getLocation(new Point(1, 2));
+        s.getX();
+        s.getY();
+        s.getWidth();
+        s.getHeight();
+        s.isOpaque();
+        s.isValidateRoot();
+        s.isOptimizedDrawingEnabled();
+        s.isDoubleBuffered();
+        s.getComponentCount();
+        s.countComponents();
+        s.getComponent(1);
+        s.getComponent(2);
+        Component[] cs = s.getComponents();
+        s.getLayout();
+        s.setLayout(new FlowLayout());
+        s.doLayout();
+        s.layout();
+        s.invalidate();
+        s.validate();
+        s.remove(0);
+        s.remove(c2);
+        s.removeAll();
+        s.preferredSize();
+        s.minimumSize();
+        s.getComponentAt(1, 2);
+        s.locate(1, 2);
+        s.getComponentAt(new Point(1, 2));
+        s.isFocusCycleRoot(new Container());
+        s.transferFocusBackward();
+        s.setName("goober");
+        s.getName();
+        s.getParent();
+        s.getPeer();
+        s.getGraphicsConfiguration();
+        s.getTreeLock();
+        s.getToolkit();
+        s.isValid();
+        s.isDisplayable();
+        s.isVisible();
+        s.isShowing();
+        s.isEnabled();
+        s.enable(false);
+        s.enable(true);
+        s.enableInputMethods(false);
+        s.enableInputMethods(true);
+        s.show();
+        s.show(false);
+        s.show(true);
+        s.hide();
+        s.getForeground();
+        s.isForegroundSet();
+        s.getBackground();
+        s.isBackgroundSet();
+        s.getFont();
+        s.isFontSet();
+        Container c = new Container();
+        c.add(s);
+        s.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            s.setLocale(locale);
+
+        s.getColorModel();
+        s.getLocation();
+
+        boolean exceptions = false;
+        try {
+            s.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        s.location();
+        s.setLocation(1, 2);
+        s.move(1, 2);
+        s.setLocation(new Point(1, 2));
+        s.getSize();
+        s.size();
+        s.setSize(1, 32);
+        s.resize(1, 32);
+        s.setSize(new Dimension(1, 32));
+        s.resize(new Dimension(1, 32));
+        s.getBounds();
+        s.bounds();
+        s.setBounds(10, 10, 10, 10);
+        s.setBounds(new Rectangle(10, 10, 10, 10));
+        s.isLightweight();
+        s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        s.getCursor();
+        s.isCursorSet();
+        s.inside(1, 2);
+        s.contains(new Point(1, 2));
+        s.isFocusable();
+        s.setFocusable(true);
+        s.setFocusable(false);
+        s.transferFocus();
+        s.getFocusCycleRootAncestor();
+        s.nextFocus();
+        s.transferFocusUpCycle();
+        s.hasFocus();
+        s.isFocusOwner();
+        s.toString();
+        s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        s.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJTable.java b/jdk/test/javax/swing/Headless/HeadlessJTable.java
new file mode 100644
index 00000000000..3c6ce45ef40
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJTable.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTable constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTable
+ */
+
+public class HeadlessJTable {
+    public static void main(String args[]) {
+        JTable t;
+        t = new JTable();
+        final Object[][] data = {
+                {"cell_1_1", "cell_1_2", "cell_1_3"},
+                {"cell_2_1", "cell_2_2", "cell_2_3"},
+                {"cell_3_1", "cell_3_2", "cell_3_3"},
+                {"cell_4_1", "cell_4_2", "cell_4_3"},
+        };
+
+        TableModel dataModel = new AbstractTableModel() {
+            public int getColumnCount() { return 3; }
+            public int getRowCount() { return data.length;}
+            public Object getValueAt(int row, int col) {return data[row][col];}
+        };
+        t = new JTable(dataModel);
+
+        t.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+        t.getAutoResizeMode();
+        t.getColumnModel().getColumn(1).setMinWidth(5);
+        t.getTableHeader().setReorderingAllowed(false);
+        t.getTableHeader().setResizingAllowed(false);
+
+        t.getAccessibleContext();
+        t.isFocusTraversable();
+        t.setEnabled(false);
+        t.setEnabled(true);
+        t.requestFocus();
+        t.requestFocusInWindow();
+        t.getPreferredSize();
+        t.getMaximumSize();
+        t.getMinimumSize();
+        t.contains(1, 2);
+        Component c1 = t.add(new Component(){});
+        Component c2 = t.add(new Component(){});
+        Component c3 = t.add(new Component(){});
+        Insets ins = t.getInsets();
+        t.getAlignmentY();
+        t.getAlignmentX();
+        t.getGraphics();
+        t.setVisible(false);
+        t.setVisible(true);
+        t.setForeground(Color.red);
+        t.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                t.setFont(f1);
+                t.setFont(f2);
+                t.setFont(f3);
+                t.setFont(f4);
+
+                t.getFontMetrics(f1);
+                t.getFontMetrics(f2);
+                t.getFontMetrics(f3);
+                t.getFontMetrics(f4);
+            }
+        }
+        t.enable();
+        t.disable();
+        t.reshape(10, 10, 10, 10);
+        t.getBounds(new Rectangle(1, 1, 1, 1));
+        t.getSize(new Dimension(1, 2));
+        t.getLocation(new Point(1, 2));
+        t.getX();
+        t.getY();
+        t.getWidth();
+        t.getHeight();
+        t.isOpaque();
+        t.isValidateRoot();
+        t.isOptimizedDrawingEnabled();
+        t.isDoubleBuffered();
+        t.getComponentCount();
+        t.countComponents();
+        t.getComponent(1);
+        t.getComponent(2);
+        Component[] cs = t.getComponents();
+        t.getLayout();
+        t.setLayout(new FlowLayout());
+        t.doLayout();
+        t.layout();
+        t.invalidate();
+        t.validate();
+        t.remove(0);
+        t.remove(c2);
+        t.removeAll();
+        t.preferredSize();
+        t.minimumSize();
+        t.getComponentAt(1, 2);
+        t.locate(1, 2);
+        t.getComponentAt(new Point(1, 2));
+        t.isFocusCycleRoot(new Container());
+        t.transferFocusBackward();
+        t.setName("goober");
+        t.getName();
+        t.getParent();
+        t.getPeer();
+        t.getGraphicsConfiguration();
+        t.getTreeLock();
+        t.getToolkit();
+        t.isValid();
+        t.isDisplayable();
+        t.isVisible();
+        t.isShowing();
+        t.isEnabled();
+        t.enable(false);
+        t.enable(true);
+        t.enableInputMethods(false);
+        t.enableInputMethods(true);
+        t.show();
+        t.show(false);
+        t.show(true);
+        t.hide();
+        t.getForeground();
+        t.isForegroundSet();
+        t.getBackground();
+        t.isBackgroundSet();
+        t.getFont();
+        t.isFontSet();
+        Container c = new Container();
+        c.add(t);
+        t.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            t.setLocale(locale);
+
+        t.getColorModel();
+        t.getLocation();
+
+        boolean exceptions = false;
+        try {
+            t.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        t.location();
+        t.setLocation(1, 2);
+        t.move(1, 2);
+        t.setLocation(new Point(1, 2));
+        t.getSize();
+        t.size();
+        t.setSize(1, 32);
+        t.resize(1, 32);
+        t.setSize(new Dimension(1, 32));
+        t.resize(new Dimension(1, 32));
+        t.getBounds();
+        t.bounds();
+        t.setBounds(10, 10, 10, 10);
+        t.setBounds(new Rectangle(10, 10, 10, 10));
+        t.isLightweight();
+        t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        t.getCursor();
+        t.isCursorSet();
+        t.inside(1, 2);
+        t.contains(new Point(1, 2));
+        t.isFocusable();
+        t.setFocusable(true);
+        t.setFocusable(false);
+        t.transferFocus();
+        t.getFocusCycleRootAncestor();
+        t.nextFocus();
+        t.transferFocusUpCycle();
+        t.hasFocus();
+        t.isFocusOwner();
+        t.toString();
+        t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        t.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJTextArea.java b/jdk/test/javax/swing/Headless/HeadlessJTextArea.java
new file mode 100644
index 00000000000..d7a00d500be
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJTextArea.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTextArea constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTextArea
+ */
+
+public class HeadlessJTextArea {
+    public static void main(String args[]) {
+        JTextArea t = new JTextArea();
+        t.selectAll();
+        t.getSelectionStart();
+        t.getSelectionEnd();
+
+        t.getAccessibleContext();
+        t.isFocusTraversable();
+        t.setEnabled(false);
+        t.setEnabled(true);
+        t.requestFocus();
+        t.requestFocusInWindow();
+        t.getPreferredSize();
+        t.getMaximumSize();
+        t.getMinimumSize();
+        t.contains(1, 2);
+        Component c1 = t.add(new Component(){});
+        Component c2 = t.add(new Component(){});
+        Component c3 = t.add(new Component(){});
+        Insets ins = t.getInsets();
+        t.getAlignmentY();
+        t.getAlignmentX();
+        t.getGraphics();
+        t.setVisible(false);
+        t.setVisible(true);
+        t.setForeground(Color.red);
+        t.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                t.setFont(f1);
+                t.setFont(f2);
+                t.setFont(f3);
+                t.setFont(f4);
+
+                t.getFontMetrics(f1);
+                t.getFontMetrics(f2);
+                t.getFontMetrics(f3);
+                t.getFontMetrics(f4);
+            }
+        }
+        t.enable();
+        t.disable();
+        t.reshape(10, 10, 10, 10);
+        t.getBounds(new Rectangle(1, 1, 1, 1));
+        t.getSize(new Dimension(1, 2));
+        t.getLocation(new Point(1, 2));
+        t.getX();
+        t.getY();
+        t.getWidth();
+        t.getHeight();
+        t.isOpaque();
+        t.isValidateRoot();
+        t.isOptimizedDrawingEnabled();
+        t.isDoubleBuffered();
+        t.getComponentCount();
+        t.countComponents();
+        t.getComponent(1);
+        t.getComponent(2);
+        Component[] cs = t.getComponents();
+        t.getLayout();
+        t.setLayout(new FlowLayout());
+        t.doLayout();
+        t.layout();
+        t.invalidate();
+        t.validate();
+        t.remove(0);
+        t.remove(c2);
+        t.removeAll();
+        t.preferredSize();
+        t.minimumSize();
+        t.getComponentAt(1, 2);
+        t.locate(1, 2);
+        t.getComponentAt(new Point(1, 2));
+        t.isFocusCycleRoot(new Container());
+        t.transferFocusBackward();
+        t.setName("goober");
+        t.getName();
+        t.getParent();
+        t.getPeer();
+        t.getGraphicsConfiguration();
+        t.getTreeLock();
+        t.getToolkit();
+        t.isValid();
+        t.isDisplayable();
+        t.isVisible();
+        t.isShowing();
+        t.isEnabled();
+        t.enable(false);
+        t.enable(true);
+        t.enableInputMethods(false);
+        t.enableInputMethods(true);
+        t.show();
+        t.show(false);
+        t.show(true);
+        t.hide();
+        t.getForeground();
+        t.isForegroundSet();
+        t.getBackground();
+        t.isBackgroundSet();
+        t.getFont();
+        t.isFontSet();
+        Container c = new Container();
+        c.add(t);
+        t.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            t.setLocale(locale);
+
+        t.getColorModel();
+        t.getLocation();
+
+        boolean exceptions = false;
+        try {
+            t.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        t.location();
+        t.setLocation(1, 2);
+        t.move(1, 2);
+        t.setLocation(new Point(1, 2));
+        t.getSize();
+        t.size();
+        t.setSize(1, 32);
+        t.resize(1, 32);
+        t.setSize(new Dimension(1, 32));
+        t.resize(new Dimension(1, 32));
+        t.getBounds();
+        t.bounds();
+        t.setBounds(10, 10, 10, 10);
+        t.setBounds(new Rectangle(10, 10, 10, 10));
+        t.isLightweight();
+        t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        t.getCursor();
+        t.isCursorSet();
+        t.inside(1, 2);
+        t.contains(new Point(1, 2));
+        t.isFocusable();
+        t.setFocusable(true);
+        t.setFocusable(false);
+        t.transferFocus();
+        t.getFocusCycleRootAncestor();
+        t.nextFocus();
+        t.transferFocusUpCycle();
+        t.hasFocus();
+        t.isFocusOwner();
+        t.toString();
+        t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        t.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJTextField.java b/jdk/test/javax/swing/Headless/HeadlessJTextField.java
new file mode 100644
index 00000000000..c6b0c9bdcf2
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJTextField.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTextField constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTextField
+ */
+
+public class HeadlessJTextField {
+    public static void main(String args[]) {
+        JTextField t = new JTextField();
+        t.selectAll();
+        t.getSelectionStart();
+        t.getSelectionEnd();
+
+        t.getAccessibleContext();
+        t.isFocusTraversable();
+        t.setEnabled(false);
+        t.setEnabled(true);
+        t.requestFocus();
+        t.requestFocusInWindow();
+        t.getPreferredSize();
+        t.getMaximumSize();
+        t.getMinimumSize();
+        t.contains(1, 2);
+        Component c1 = t.add(new Component(){});
+        Component c2 = t.add(new Component(){});
+        Component c3 = t.add(new Component(){});
+        Insets ins = t.getInsets();
+        t.getAlignmentY();
+        t.getAlignmentX();
+        t.getGraphics();
+        t.setVisible(false);
+        t.setVisible(true);
+        t.setForeground(Color.red);
+        t.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                t.setFont(f1);
+                t.setFont(f2);
+                t.setFont(f3);
+                t.setFont(f4);
+
+                t.getFontMetrics(f1);
+                t.getFontMetrics(f2);
+                t.getFontMetrics(f3);
+                t.getFontMetrics(f4);
+            }
+        }
+        t.enable();
+        t.disable();
+        t.reshape(10, 10, 10, 10);
+        t.getBounds(new Rectangle(1, 1, 1, 1));
+        t.getSize(new Dimension(1, 2));
+        t.getLocation(new Point(1, 2));
+        t.getX();
+        t.getY();
+        t.getWidth();
+        t.getHeight();
+        t.isOpaque();
+        t.isValidateRoot();
+        t.isOptimizedDrawingEnabled();
+        t.isDoubleBuffered();
+        t.getComponentCount();
+        t.countComponents();
+        t.getComponent(1);
+        t.getComponent(2);
+        Component[] cs = t.getComponents();
+        t.getLayout();
+        t.setLayout(new FlowLayout());
+        t.doLayout();
+        t.layout();
+        t.invalidate();
+        t.validate();
+        t.remove(0);
+        t.remove(c2);
+        t.removeAll();
+        t.preferredSize();
+        t.minimumSize();
+        t.getComponentAt(1, 2);
+        t.locate(1, 2);
+        t.getComponentAt(new Point(1, 2));
+        t.isFocusCycleRoot(new Container());
+        t.transferFocusBackward();
+        t.setName("goober");
+        t.getName();
+        t.getParent();
+        t.getPeer();
+        t.getGraphicsConfiguration();
+        t.getTreeLock();
+        t.getToolkit();
+        t.isValid();
+        t.isDisplayable();
+        t.isVisible();
+        t.isShowing();
+        t.isEnabled();
+        t.enable(false);
+        t.enable(true);
+        t.enableInputMethods(false);
+        t.enableInputMethods(true);
+        t.show();
+        t.show(false);
+        t.show(true);
+        t.hide();
+        t.getForeground();
+        t.isForegroundSet();
+        t.getBackground();
+        t.isBackgroundSet();
+        t.getFont();
+        t.isFontSet();
+        Container c = new Container();
+        c.add(t);
+        t.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            t.setLocale(locale);
+
+        t.getColorModel();
+        t.getLocation();
+
+        boolean exceptions = false;
+        try {
+            t.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        t.location();
+        t.setLocation(1, 2);
+        t.move(1, 2);
+        t.setLocation(new Point(1, 2));
+        t.getSize();
+        t.size();
+        t.setSize(1, 32);
+        t.resize(1, 32);
+        t.setSize(new Dimension(1, 32));
+        t.resize(new Dimension(1, 32));
+        t.getBounds();
+        t.bounds();
+        t.setBounds(10, 10, 10, 10);
+        t.setBounds(new Rectangle(10, 10, 10, 10));
+        t.isLightweight();
+        t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        t.getCursor();
+        t.isCursorSet();
+        t.inside(1, 2);
+        t.contains(new Point(1, 2));
+        t.isFocusable();
+        t.setFocusable(true);
+        t.setFocusable(false);
+        t.transferFocus();
+        t.getFocusCycleRootAncestor();
+        t.nextFocus();
+        t.transferFocusUpCycle();
+        t.hasFocus();
+        t.isFocusOwner();
+        t.toString();
+        t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        t.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJTextPane.java b/jdk/test/javax/swing/Headless/HeadlessJTextPane.java
new file mode 100644
index 00000000000..6838c1dd148
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJTextPane.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that JTextPane constructor and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTextPane
+ */
+
+public class HeadlessJTextPane {
+
+    public static void main(String args[]) {
+        JTextPane tp;
+        tp = new JTextPane();
+        tp.getEditorKit();
+        tp.setContentType("text/html");
+        tp.getContentType();
+        tp.setText("Merry Parrot");
+        tp.getText();
+        tp.getDocument();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java b/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java
new file mode 100644
index 00000000000..df92ca4ec04
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToggleButton constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToggleButton
+ */
+
+public class HeadlessJToggleButton {
+    public static void main(String args[]) {
+        JToggleButton tb = new JToggleButton();
+        tb.getAccessibleContext();
+        tb.isFocusTraversable();
+        tb.setEnabled(false);
+        tb.setEnabled(true);
+        tb.requestFocus();
+        tb.requestFocusInWindow();
+        tb.getPreferredSize();
+        tb.getMaximumSize();
+        tb.getMinimumSize();
+        tb.contains(1, 2);
+        Component c1 = tb.add(new Component(){});
+        Component c2 = tb.add(new Component(){});
+        Component c3 = tb.add(new Component(){});
+        Insets ins = tb.getInsets();
+        tb.getAlignmentY();
+        tb.getAlignmentX();
+        tb.getGraphics();
+        tb.setVisible(false);
+        tb.setVisible(true);
+        tb.setForeground(Color.red);
+        tb.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                tb.setFont(f1);
+                tb.setFont(f2);
+                tb.setFont(f3);
+                tb.setFont(f4);
+
+                tb.getFontMetrics(f1);
+                tb.getFontMetrics(f2);
+                tb.getFontMetrics(f3);
+                tb.getFontMetrics(f4);
+            }
+        }
+        tb.enable();
+        tb.disable();
+        tb.reshape(10, 10, 10, 10);
+        tb.getBounds(new Rectangle(1, 1, 1, 1));
+        tb.getSize(new Dimension(1, 2));
+        tb.getLocation(new Point(1, 2));
+        tb.getX();
+        tb.getY();
+        tb.getWidth();
+        tb.getHeight();
+        tb.isOpaque();
+        tb.isValidateRoot();
+        tb.isOptimizedDrawingEnabled();
+        tb.isDoubleBuffered();
+        tb.getComponentCount();
+        tb.countComponents();
+        tb.getComponent(1);
+        tb.getComponent(2);
+        Component[] cs = tb.getComponents();
+        tb.getLayout();
+        tb.setLayout(new FlowLayout());
+        tb.doLayout();
+        tb.layout();
+        tb.invalidate();
+        tb.validate();
+        tb.remove(0);
+        tb.remove(c2);
+        tb.removeAll();
+        tb.preferredSize();
+        tb.minimumSize();
+        tb.getComponentAt(1, 2);
+        tb.locate(1, 2);
+        tb.getComponentAt(new Point(1, 2));
+        tb.isFocusCycleRoot(new Container());
+        tb.transferFocusBackward();
+        tb.setName("goober");
+        tb.getName();
+        tb.getParent();
+        tb.getPeer();
+        tb.getGraphicsConfiguration();
+        tb.getTreeLock();
+        tb.getToolkit();
+        tb.isValid();
+        tb.isDisplayable();
+        tb.isVisible();
+        tb.isShowing();
+        tb.isEnabled();
+        tb.enable(false);
+        tb.enable(true);
+        tb.enableInputMethods(false);
+        tb.enableInputMethods(true);
+        tb.show();
+        tb.show(false);
+        tb.show(true);
+        tb.hide();
+        tb.getForeground();
+        tb.isForegroundSet();
+        tb.getBackground();
+        tb.isBackgroundSet();
+        tb.getFont();
+        tb.isFontSet();
+        Container c = new Container();
+        c.add(tb);
+        tb.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            tb.setLocale(locale);
+
+        tb.getColorModel();
+        tb.getLocation();
+
+        boolean exceptions = false;
+        try {
+            tb.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        tb.location();
+        tb.setLocation(1, 2);
+        tb.move(1, 2);
+        tb.setLocation(new Point(1, 2));
+        tb.getSize();
+        tb.size();
+        tb.setSize(1, 32);
+        tb.resize(1, 32);
+        tb.setSize(new Dimension(1, 32));
+        tb.resize(new Dimension(1, 32));
+        tb.getBounds();
+        tb.bounds();
+        tb.setBounds(10, 10, 10, 10);
+        tb.setBounds(new Rectangle(10, 10, 10, 10));
+        tb.isLightweight();
+        tb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        tb.getCursor();
+        tb.isCursorSet();
+        tb.inside(1, 2);
+        tb.contains(new Point(1, 2));
+        tb.isFocusable();
+        tb.setFocusable(true);
+        tb.setFocusable(false);
+        tb.transferFocus();
+        tb.getFocusCycleRootAncestor();
+        tb.nextFocus();
+        tb.transferFocusUpCycle();
+        tb.hasFocus();
+        tb.isFocusOwner();
+        tb.toString();
+        tb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        tb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        tb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        tb.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJToolBar.java b/jdk/test/javax/swing/Headless/HeadlessJToolBar.java
new file mode 100644
index 00000000000..bbd9d8f5b0a
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJToolBar.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToolBar constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToolBar
+ */
+
+public class HeadlessJToolBar {
+    public static void main(String args[]) {
+        JToolBar tb = new JToolBar();
+        tb.getAccessibleContext();
+        tb.isFocusTraversable();
+        tb.setEnabled(false);
+        tb.setEnabled(true);
+        tb.requestFocus();
+        tb.requestFocusInWindow();
+        tb.getPreferredSize();
+        tb.getMaximumSize();
+        tb.getMinimumSize();
+        tb.contains(1, 2);
+        Component c1 = tb.add(new Component(){});
+        Component c2 = tb.add(new Component(){});
+        Component c3 = tb.add(new Component(){});
+        Insets ins = tb.getInsets();
+        tb.getAlignmentY();
+        tb.getAlignmentX();
+        tb.getGraphics();
+        tb.setVisible(false);
+        tb.setVisible(true);
+        tb.setForeground(Color.red);
+        tb.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                tb.setFont(f1);
+                tb.setFont(f2);
+                tb.setFont(f3);
+                tb.setFont(f4);
+
+                tb.getFontMetrics(f1);
+                tb.getFontMetrics(f2);
+                tb.getFontMetrics(f3);
+                tb.getFontMetrics(f4);
+            }
+        }
+        tb.enable();
+        tb.disable();
+        tb.reshape(10, 10, 10, 10);
+        tb.getBounds(new Rectangle(1, 1, 1, 1));
+        tb.getSize(new Dimension(1, 2));
+        tb.getLocation(new Point(1, 2));
+        tb.getX();
+        tb.getY();
+        tb.getWidth();
+        tb.getHeight();
+        tb.isOpaque();
+        tb.isValidateRoot();
+        tb.isOptimizedDrawingEnabled();
+        tb.isDoubleBuffered();
+        tb.getComponentCount();
+        tb.countComponents();
+        tb.getComponent(1);
+        tb.getComponent(2);
+        Component[] cs = tb.getComponents();
+        tb.getLayout();
+        tb.setLayout(new FlowLayout());
+        tb.doLayout();
+        tb.layout();
+        tb.invalidate();
+        tb.validate();
+        tb.remove(0);
+        tb.remove(c2);
+        tb.removeAll();
+        tb.preferredSize();
+        tb.minimumSize();
+        tb.getComponentAt(1, 2);
+        tb.locate(1, 2);
+        tb.getComponentAt(new Point(1, 2));
+        tb.isFocusCycleRoot(new Container());
+        tb.transferFocusBackward();
+        tb.setName("goober");
+        tb.getName();
+        tb.getParent();
+        tb.getPeer();
+        tb.getGraphicsConfiguration();
+        tb.getTreeLock();
+        tb.getToolkit();
+        tb.isValid();
+        tb.isDisplayable();
+        tb.isVisible();
+        tb.isShowing();
+        tb.isEnabled();
+        tb.enable(false);
+        tb.enable(true);
+        tb.enableInputMethods(false);
+        tb.enableInputMethods(true);
+        tb.show();
+        tb.show(false);
+        tb.show(true);
+        tb.hide();
+        tb.getForeground();
+        tb.isForegroundSet();
+        tb.getBackground();
+        tb.isBackgroundSet();
+        tb.getFont();
+        tb.isFontSet();
+        Container c = new Container();
+        c.add(tb);
+        tb.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            tb.setLocale(locale);
+
+        tb.getColorModel();
+        tb.getLocation();
+
+        boolean exceptions = false;
+        try {
+            tb.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        tb.location();
+        tb.setLocation(1, 2);
+        tb.move(1, 2);
+        tb.setLocation(new Point(1, 2));
+        tb.getSize();
+        tb.size();
+        tb.setSize(1, 32);
+        tb.resize(1, 32);
+        tb.setSize(new Dimension(1, 32));
+        tb.resize(new Dimension(1, 32));
+        tb.getBounds();
+        tb.bounds();
+        tb.setBounds(10, 10, 10, 10);
+        tb.setBounds(new Rectangle(10, 10, 10, 10));
+        tb.isLightweight();
+        tb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        tb.getCursor();
+        tb.isCursorSet();
+        tb.inside(1, 2);
+        tb.contains(new Point(1, 2));
+        tb.isFocusable();
+        tb.setFocusable(true);
+        tb.setFocusable(false);
+        tb.transferFocus();
+        tb.getFocusCycleRootAncestor();
+        tb.nextFocus();
+        tb.transferFocusUpCycle();
+        tb.hasFocus();
+        tb.isFocusOwner();
+        tb.toString();
+        tb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        tb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        tb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        tb.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java b/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java
new file mode 100644
index 00000000000..3a1788b83fa
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToolBar.Separator constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToolBar_Separator
+ */
+
+public class HeadlessJToolBar_Separator {
+    public static void main(String args[]) {
+        JToolBar.Separator s = new JToolBar.Separator();
+        s.getAccessibleContext();
+        s.isFocusTraversable();
+        s.setEnabled(false);
+        s.setEnabled(true);
+        s.requestFocus();
+        s.requestFocusInWindow();
+        s.getPreferredSize();
+        s.getMaximumSize();
+        s.getMinimumSize();
+        s.contains(1, 2);
+        Component c1 = s.add(new Component(){});
+        Component c2 = s.add(new Component(){});
+        Component c3 = s.add(new Component(){});
+        Insets ins = s.getInsets();
+        s.getAlignmentY();
+        s.getAlignmentX();
+        s.getGraphics();
+        s.setVisible(false);
+        s.setVisible(true);
+        s.setForeground(Color.red);
+        s.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                s.setFont(f1);
+                s.setFont(f2);
+                s.setFont(f3);
+                s.setFont(f4);
+
+                s.getFontMetrics(f1);
+                s.getFontMetrics(f2);
+                s.getFontMetrics(f3);
+                s.getFontMetrics(f4);
+            }
+        }
+        s.enable();
+        s.disable();
+        s.reshape(10, 10, 10, 10);
+        s.getBounds(new Rectangle(1, 1, 1, 1));
+        s.getSize(new Dimension(1, 2));
+        s.getLocation(new Point(1, 2));
+        s.getX();
+        s.getY();
+        s.getWidth();
+        s.getHeight();
+        s.isOpaque();
+        s.isValidateRoot();
+        s.isOptimizedDrawingEnabled();
+        s.isDoubleBuffered();
+        s.getComponentCount();
+        s.countComponents();
+        s.getComponent(1);
+        s.getComponent(2);
+        Component[] cs = s.getComponents();
+        s.getLayout();
+        s.setLayout(new FlowLayout());
+        s.doLayout();
+        s.layout();
+        s.invalidate();
+        s.validate();
+        s.remove(0);
+        s.remove(c2);
+        s.removeAll();
+        s.preferredSize();
+        s.minimumSize();
+        s.getComponentAt(1, 2);
+        s.locate(1, 2);
+        s.getComponentAt(new Point(1, 2));
+        s.isFocusCycleRoot(new Container());
+        s.transferFocusBackward();
+        s.setName("goober");
+        s.getName();
+        s.getParent();
+        s.getPeer();
+        s.getGraphicsConfiguration();
+        s.getTreeLock();
+        s.getToolkit();
+        s.isValid();
+        s.isDisplayable();
+        s.isVisible();
+        s.isShowing();
+        s.isEnabled();
+        s.enable(false);
+        s.enable(true);
+        s.enableInputMethods(false);
+        s.enableInputMethods(true);
+        s.show();
+        s.show(false);
+        s.show(true);
+        s.hide();
+        s.getForeground();
+        s.isForegroundSet();
+        s.getBackground();
+        s.isBackgroundSet();
+        s.getFont();
+        s.isFontSet();
+        Container c = new Container();
+        c.add(s);
+        s.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            s.setLocale(locale);
+
+        s.getColorModel();
+        s.getLocation();
+
+        boolean exceptions = false;
+        try {
+            s.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        s.location();
+        s.setLocation(1, 2);
+        s.move(1, 2);
+        s.setLocation(new Point(1, 2));
+        s.getSize();
+        s.size();
+        s.setSize(1, 32);
+        s.resize(1, 32);
+        s.setSize(new Dimension(1, 32));
+        s.resize(new Dimension(1, 32));
+        s.getBounds();
+        s.bounds();
+        s.setBounds(10, 10, 10, 10);
+        s.setBounds(new Rectangle(10, 10, 10, 10));
+        s.isLightweight();
+        s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        s.getCursor();
+        s.isCursorSet();
+        s.inside(1, 2);
+        s.contains(new Point(1, 2));
+        s.isFocusable();
+        s.setFocusable(true);
+        s.setFocusable(false);
+        s.transferFocus();
+        s.getFocusCycleRootAncestor();
+        s.nextFocus();
+        s.transferFocusUpCycle();
+        s.hasFocus();
+        s.isFocusOwner();
+        s.toString();
+        s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        s.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJToolTip.java b/jdk/test/javax/swing/Headless/HeadlessJToolTip.java
new file mode 100644
index 00000000000..1241ad6ee0c
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJToolTip.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToolTip constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToolTip
+ */
+
+public class HeadlessJToolTip {
+    public static void main(String args[]) {
+        JToolTip tt = new JToolTip();
+        tt.getAccessibleContext();
+        tt.isFocusTraversable();
+        tt.setEnabled(false);
+        tt.setEnabled(true);
+        tt.requestFocus();
+        tt.requestFocusInWindow();
+        tt.getPreferredSize();
+        tt.getMaximumSize();
+        tt.getMinimumSize();
+        tt.contains(1, 2);
+        Component c1 = tt.add(new Component(){});
+        Component c2 = tt.add(new Component(){});
+        Component c3 = tt.add(new Component(){});
+        Insets ins = tt.getInsets();
+        tt.getAlignmentY();
+        tt.getAlignmentX();
+        tt.getGraphics();
+        tt.setVisible(false);
+        tt.setVisible(true);
+        tt.setForeground(Color.red);
+        tt.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                tt.setFont(f1);
+                tt.setFont(f2);
+                tt.setFont(f3);
+                tt.setFont(f4);
+
+                tt.getFontMetrics(f1);
+                tt.getFontMetrics(f2);
+                tt.getFontMetrics(f3);
+                tt.getFontMetrics(f4);
+            }
+        }
+        tt.enable();
+        tt.disable();
+        tt.reshape(10, 10, 10, 10);
+        tt.getBounds(new Rectangle(1, 1, 1, 1));
+        tt.getSize(new Dimension(1, 2));
+        tt.getLocation(new Point(1, 2));
+        tt.getX();
+        tt.getY();
+        tt.getWidth();
+        tt.getHeight();
+        tt.isOpaque();
+        tt.isValidateRoot();
+        tt.isOptimizedDrawingEnabled();
+        tt.isDoubleBuffered();
+        tt.getComponentCount();
+        tt.countComponents();
+        tt.getComponent(1);
+        tt.getComponent(2);
+        Component[] cs = tt.getComponents();
+        tt.getLayout();
+        tt.setLayout(new FlowLayout());
+        tt.doLayout();
+        tt.layout();
+        tt.invalidate();
+        tt.validate();
+        tt.remove(0);
+        tt.remove(c2);
+        tt.removeAll();
+        tt.preferredSize();
+        tt.minimumSize();
+        tt.getComponentAt(1, 2);
+        tt.locate(1, 2);
+        tt.getComponentAt(new Point(1, 2));
+        tt.isFocusCycleRoot(new Container());
+        tt.transferFocusBackward();
+        tt.setName("goober");
+        tt.getName();
+        tt.getParent();
+        tt.getPeer();
+        tt.getGraphicsConfiguration();
+        tt.getTreeLock();
+        tt.getToolkit();
+        tt.isValid();
+        tt.isDisplayable();
+        tt.isVisible();
+        tt.isShowing();
+        tt.isEnabled();
+        tt.enable(false);
+        tt.enable(true);
+        tt.enableInputMethods(false);
+        tt.enableInputMethods(true);
+        tt.show();
+        tt.show(false);
+        tt.show(true);
+        tt.hide();
+        tt.getForeground();
+        tt.isForegroundSet();
+        tt.getBackground();
+        tt.isBackgroundSet();
+        tt.getFont();
+        tt.isFontSet();
+        Container c = new Container();
+        c.add(tt);
+        tt.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            tt.setLocale(locale);
+
+        tt.getColorModel();
+        tt.getLocation();
+
+        boolean exceptions = false;
+        try {
+            tt.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        tt.location();
+        tt.setLocation(1, 2);
+        tt.move(1, 2);
+        tt.setLocation(new Point(1, 2));
+        tt.getSize();
+        tt.size();
+        tt.setSize(1, 32);
+        tt.resize(1, 32);
+        tt.setSize(new Dimension(1, 32));
+        tt.resize(new Dimension(1, 32));
+        tt.getBounds();
+        tt.bounds();
+        tt.setBounds(10, 10, 10, 10);
+        tt.setBounds(new Rectangle(10, 10, 10, 10));
+        tt.isLightweight();
+        tt.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        tt.getCursor();
+        tt.isCursorSet();
+        tt.inside(1, 2);
+        tt.contains(new Point(1, 2));
+        tt.isFocusable();
+        tt.setFocusable(true);
+        tt.setFocusable(false);
+        tt.transferFocus();
+        tt.getFocusCycleRootAncestor();
+        tt.nextFocus();
+        tt.transferFocusUpCycle();
+        tt.hasFocus();
+        tt.isFocusOwner();
+        tt.toString();
+        tt.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        tt.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        tt.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        tt.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJTree.java b/jdk/test/javax/swing/Headless/HeadlessJTree.java
new file mode 100644
index 00000000000..ba762dfa862
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJTree.java
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTree constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTree
+ */
+
+public class HeadlessJTree {
+    public static void main(String args[]) {
+        JTree t;
+
+        DefaultMutableTreeNode root = new DefaultMutableTreeNode("JTree");
+        DefaultMutableTreeNode parent;
+
+        parent = new DefaultMutableTreeNode("colors");
+        root.add(parent);
+        parent.add(new DefaultMutableTreeNode("blue"));
+        parent.add(new DefaultMutableTreeNode("violet"));
+        parent.add(new DefaultMutableTreeNode("red"));
+        parent.add(new DefaultMutableTreeNode("yellow"));
+
+        parent = new DefaultMutableTreeNode("sports");
+        root.add(parent);
+        parent.add(new DefaultMutableTreeNode("basketball"));
+        parent.add(new DefaultMutableTreeNode("soccer"));
+        parent.add(new DefaultMutableTreeNode("football"));
+        parent.add(new DefaultMutableTreeNode("hockey"));
+
+        parent = new DefaultMutableTreeNode("food");
+        root.add(parent);
+        parent.add(new DefaultMutableTreeNode("hot dogs"));
+        parent.add(new DefaultMutableTreeNode("pizza"));
+        parent.add(new DefaultMutableTreeNode("ravioli"));
+        parent.add(new DefaultMutableTreeNode("bananas"));
+
+        t = new JTree(root);
+        t = new JTree(new DefaultTreeModel(root));
+        t.setCellRenderer(new DefaultTreeCellRenderer() {
+            public Component getTreeCellRendererComponent(
+                    JTree tree, Object value, boolean selected, boolean expanded,
+                    boolean leaf, int row, boolean hasFocus) {
+                return super.getTreeCellRendererComponent(
+                        tree, value, selected, expanded,
+                        leaf, row, hasFocus);
+            }
+        });
+        t.getCellRenderer();
+
+        t.getAccessibleContext();
+        t.isFocusTraversable();
+        t.setEnabled(false);
+        t.setEnabled(true);
+        t.requestFocus();
+        t.requestFocusInWindow();
+        t.getPreferredSize();
+        t.getMaximumSize();
+        t.getMinimumSize();
+        t.contains(1, 2);
+        Component c1 = t.add(new Component(){});
+        Component c2 = t.add(new Component(){});
+        Component c3 = t.add(new Component(){});
+        Insets ins = t.getInsets();
+        t.getAlignmentY();
+        t.getAlignmentX();
+        t.getGraphics();
+        t.setVisible(false);
+        t.setVisible(true);
+        t.setForeground(Color.red);
+        t.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                t.setFont(f1);
+                t.setFont(f2);
+                t.setFont(f3);
+                t.setFont(f4);
+
+                t.getFontMetrics(f1);
+                t.getFontMetrics(f2);
+                t.getFontMetrics(f3);
+                t.getFontMetrics(f4);
+            }
+        }
+        t.enable();
+        t.disable();
+        t.reshape(10, 10, 10, 10);
+        t.getBounds(new Rectangle(1, 1, 1, 1));
+        t.getSize(new Dimension(1, 2));
+        t.getLocation(new Point(1, 2));
+        t.getX();
+        t.getY();
+        t.getWidth();
+        t.getHeight();
+        t.isOpaque();
+        t.isValidateRoot();
+        t.isOptimizedDrawingEnabled();
+        t.isDoubleBuffered();
+        t.getComponentCount();
+        t.countComponents();
+        t.getComponent(1);
+        t.getComponent(2);
+        Component[] cs = t.getComponents();
+        t.getLayout();
+        t.setLayout(new FlowLayout());
+        t.doLayout();
+        t.layout();
+        t.invalidate();
+        t.validate();
+        t.remove(0);
+        t.remove(c2);
+        t.removeAll();
+        t.preferredSize();
+        t.minimumSize();
+        t.getComponentAt(1, 2);
+        t.locate(1, 2);
+        t.getComponentAt(new Point(1, 2));
+        t.isFocusCycleRoot(new Container());
+        t.transferFocusBackward();
+        t.setName("goober");
+        t.getName();
+        t.getParent();
+        t.getPeer();
+        t.getGraphicsConfiguration();
+        t.getTreeLock();
+        t.getToolkit();
+        t.isValid();
+        t.isDisplayable();
+        t.isVisible();
+        t.isShowing();
+        t.isEnabled();
+        t.enable(false);
+        t.enable(true);
+        t.enableInputMethods(false);
+        t.enableInputMethods(true);
+        t.show();
+        t.show(false);
+        t.show(true);
+        t.hide();
+        t.getForeground();
+        t.isForegroundSet();
+        t.getBackground();
+        t.isBackgroundSet();
+        t.getFont();
+        t.isFontSet();
+        Container c = new Container();
+        c.add(t);
+        t.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            t.setLocale(locale);
+
+        t.getColorModel();
+        t.getLocation();
+
+        boolean exceptions = false;
+        try {
+            t.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        t.location();
+        t.setLocation(1, 2);
+        t.move(1, 2);
+        t.setLocation(new Point(1, 2));
+        t.getSize();
+        t.size();
+        t.setSize(1, 32);
+        t.resize(1, 32);
+        t.setSize(new Dimension(1, 32));
+        t.resize(new Dimension(1, 32));
+        t.getBounds();
+        t.bounds();
+        t.setBounds(10, 10, 10, 10);
+        t.setBounds(new Rectangle(10, 10, 10, 10));
+        t.isLightweight();
+        t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        t.getCursor();
+        t.isCursorSet();
+        t.inside(1, 2);
+        t.contains(new Point(1, 2));
+        t.isFocusable();
+        t.setFocusable(true);
+        t.setFocusable(false);
+        t.transferFocus();
+        t.getFocusCycleRootAncestor();
+        t.nextFocus();
+        t.transferFocusUpCycle();
+        t.hasFocus();
+        t.isFocusOwner();
+        t.toString();
+        t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        t.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJViewport.java b/jdk/test/javax/swing/Headless/HeadlessJViewport.java
new file mode 100644
index 00000000000..5f315f67026
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJViewport.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JViewport constructors and methods do not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJViewport
+ */
+
+public class HeadlessJViewport {
+    public static void main(String args[]) {
+        JViewport v = new JViewport();
+        v.getUI();
+        v.getUIClassID();
+        v.setUI(null);
+        v.updateUI();
+
+        JComponent view = new JPanel();
+        view.setMinimumSize(new Dimension(123, 456));
+        v.setView(view);
+
+        v.getAccessibleContext();
+        v.isFocusTraversable();
+        v.setEnabled(false);
+        v.setEnabled(true);
+        v.requestFocus();
+        v.requestFocusInWindow();
+        v.getPreferredSize();
+        v.getMaximumSize();
+        v.getMinimumSize();
+        v.contains(1, 2);
+        Component c1 = v.add(new Component(){});
+        Component c2 = v.add(new Component(){});
+        Component c3 = v.add(new Component(){});
+        Insets ins = v.getInsets();
+        v.getAlignmentY();
+        v.getAlignmentX();
+        v.getGraphics();
+        v.setVisible(false);
+        v.setVisible(true);
+        v.setForeground(Color.red);
+        v.setBackground(Color.red);
+        for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+            for (int j = 8; j < 17; j++) {
+                Font f1 = new Font(font, Font.PLAIN, j);
+                Font f2 = new Font(font, Font.BOLD, j);
+                Font f3 = new Font(font, Font.ITALIC, j);
+                Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+                v.setFont(f1);
+                v.setFont(f2);
+                v.setFont(f3);
+                v.setFont(f4);
+
+                v.getFontMetrics(f1);
+                v.getFontMetrics(f2);
+                v.getFontMetrics(f3);
+                v.getFontMetrics(f4);
+            }
+        }
+        v.enable();
+        v.disable();
+        v.reshape(10, 10, 10, 10);
+        v.getBounds(new Rectangle(1, 1, 1, 1));
+        v.getSize(new Dimension(1, 2));
+        v.getLocation(new Point(1, 2));
+        v.getX();
+        v.getY();
+        v.getWidth();
+        v.getHeight();
+        v.isOpaque();
+        v.isValidateRoot();
+        v.isOptimizedDrawingEnabled();
+        v.isDoubleBuffered();
+        v.getComponentCount();
+        v.countComponents();
+        v.getComponent(0);
+        Component[] cs = v.getComponents();
+        v.getLayout();
+        v.setLayout(new FlowLayout());
+        v.doLayout();
+        v.layout();
+        v.invalidate();
+        v.validate();
+        v.remove(0);
+        v.remove(c2);
+        v.removeAll();
+        v.preferredSize();
+        v.minimumSize();
+        v.getComponentAt(1, 2);
+        v.locate(1, 2);
+        v.getComponentAt(new Point(1, 2));
+        v.isFocusCycleRoot(new Container());
+        v.transferFocusBackward();
+        v.setName("goober");
+        v.getName();
+        v.getParent();
+        v.getPeer();
+        v.getGraphicsConfiguration();
+        v.getTreeLock();
+        v.getToolkit();
+        v.isValid();
+        v.isDisplayable();
+        v.isVisible();
+        v.isShowing();
+        v.isEnabled();
+        v.enable(false);
+        v.enable(true);
+        v.enableInputMethods(false);
+        v.enableInputMethods(true);
+        v.show();
+        v.show(false);
+        v.show(true);
+        v.hide();
+        v.getForeground();
+        v.isForegroundSet();
+        v.getBackground();
+        v.isBackgroundSet();
+        v.getFont();
+        v.isFontSet();
+        Container c = new Container();
+        c.add(v);
+        v.getLocale();
+        for (Locale locale : Locale.getAvailableLocales())
+            v.setLocale(locale);
+
+        v.getColorModel();
+        v.getLocation();
+
+        boolean exceptions = false;
+        try {
+            v.getLocationOnScreen();
+        } catch (IllegalComponentStateException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+        v.location();
+        v.setLocation(1, 2);
+        v.move(1, 2);
+        v.setLocation(new Point(1, 2));
+        v.getSize();
+        v.size();
+        v.setSize(1, 32);
+        v.resize(1, 32);
+        v.setSize(new Dimension(1, 32));
+        v.resize(new Dimension(1, 32));
+        v.getBounds();
+        v.bounds();
+        v.setBounds(10, 10, 10, 10);
+        v.setBounds(new Rectangle(10, 10, 10, 10));
+        v.isLightweight();
+        v.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+        v.getCursor();
+        v.isCursorSet();
+        v.inside(1, 2);
+        v.contains(new Point(1, 2));
+        v.isFocusable();
+        v.setFocusable(true);
+        v.setFocusable(false);
+        v.transferFocus();
+        v.getFocusCycleRootAncestor();
+        v.nextFocus();
+        v.transferFocusUpCycle();
+        v.hasFocus();
+        v.isFocusOwner();
+        v.toString();
+        v.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        v.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        v.setComponentOrientation(ComponentOrientation.UNKNOWN);
+        v.getComponentOrientation();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessJWindow.java b/jdk/test/javax/swing/Headless/HeadlessJWindow.java
new file mode 100644
index 00000000000..c809032217c
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessJWindow.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that JWindow constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJWindow
+ */
+
+public class HeadlessJWindow {
+    public static void main(String args[]) {
+        boolean exceptions = false;
+        JWindow w;
+
+        try {
+            w = new JWindow();
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+        exceptions = false;
+        try {
+            w = new JWindow(new Frame("Frame title"));
+        } catch (HeadlessException e) {
+            exceptions = true;
+        }
+        if (!exceptions)
+            throw new RuntimeException("HeadlessException did not occur when expected");
+
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessLookAndFeel.java b/jdk/test/javax/swing/Headless/HeadlessLookAndFeel.java
new file mode 100644
index 00000000000..d4922e40ad6
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessLookAndFeel.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+/*
+ * @test
+ * @summary Check that MetalLookAndFeel constructor does not throw unexpected
+ *          exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessLookAndFeel
+ */
+
+public class HeadlessLookAndFeel {
+    public static void main(String args[]) {
+        new MetalLookAndFeel();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessMenuSelectionManager.java b/jdk/test/javax/swing/Headless/HeadlessMenuSelectionManager.java
new file mode 100644
index 00000000000..4bd59f33e18
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessMenuSelectionManager.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that MenuSelectionManager constructor and defaultManager() method do not
+ *          throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuSelectionManager
+ */
+
+public class HeadlessMenuSelectionManager {
+    public static void main(String args[]) {
+        MenuSelectionManager msm = new MenuSelectionManager();
+        msm = MenuSelectionManager.defaultManager();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessOverlayLayout.java b/jdk/test/javax/swing/Headless/HeadlessOverlayLayout.java
new file mode 100644
index 00000000000..911ee12700f
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessOverlayLayout.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that OverlayLayout constructor does not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessOverlayLayout
+ */
+
+public class HeadlessOverlayLayout {
+    public static void main(String args[]) {
+        OverlayLayout msm = new OverlayLayout(new Container());
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessPopupFactory.java b/jdk/test/javax/swing/Headless/HeadlessPopupFactory.java
new file mode 100644
index 00000000000..eb2110d5b5e
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessPopupFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that PopupFactory.getSharedInstance() method does not throw
+ *          unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPopupFactory
+ */
+
+public class HeadlessPopupFactory {
+    public static void main(String args[]) {
+        PopupFactory msm = PopupFactory.getSharedInstance();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessScrollPaneLayout.java b/jdk/test/javax/swing/Headless/HeadlessScrollPaneLayout.java
new file mode 100644
index 00000000000..63a97100d6c
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessScrollPaneLayout.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that ScrollPaneLayout constructor does not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessScrollPaneLayout
+ */
+
+public class HeadlessScrollPaneLayout {
+    public static void main(String args[]) {
+        ScrollPaneLayout msm = new ScrollPaneLayout();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessSizeRequirements.java b/jdk/test/javax/swing/Headless/HeadlessSizeRequirements.java
new file mode 100644
index 00000000000..4d877764f55
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessSizeRequirements.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that SizeRequirements constructors do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSizeRequirements
+ */
+
+public class HeadlessSizeRequirements {
+    public static void main(String args[]) {
+        SizeRequirements sr;
+        sr = new SizeRequirements();
+        sr = new SizeRequirements(20, 20, 20, (float) 1.0);
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessSizeSequence.java b/jdk/test/javax/swing/Headless/HeadlessSizeSequence.java
new file mode 100644
index 00000000000..aa2cd90203b
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessSizeSequence.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that SizeSequence constructors do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSizeSequence
+ */
+
+public class HeadlessSizeSequence {
+    public static void main(String args[]) {
+        SizeSequence ss;
+        ss = new SizeSequence();
+        ss = new SizeSequence(10);
+        ss = new SizeSequence(10, 10);
+        ss = new SizeSequence(new int[]{1, 2, 3, 4, 5, 6, 76, 9});
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessSpinnerListModel.java b/jdk/test/javax/swing/Headless/HeadlessSpinnerListModel.java
new file mode 100644
index 00000000000..53882f30da3
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessSpinnerListModel.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.util.LinkedList;
+
+/*
+ * @test
+ * @summary Check that SpinnerListModel constructors and methods do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSpinnerListModel
+ */
+
+public class HeadlessSpinnerListModel {
+    public static void main(String args[]) {
+        LinkedList list = new LinkedList();
+        list.add("prev");
+        list.add("this");
+        list.add("next");
+        SpinnerListModel m;
+        m = new SpinnerListModel(list);
+        m = new SpinnerListModel(new String[]{"prev", "this", "next"});
+        m.getList();
+        m.setList(list);
+        m.setValue("next");
+        m.getNextValue();
+        m.getPreviousValue();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessSpinnerNumberModel.java b/jdk/test/javax/swing/Headless/HeadlessSpinnerNumberModel.java
new file mode 100644
index 00000000000..23e7f2d9460
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessSpinnerNumberModel.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that SpinnerNumberModel constructor and methods do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSpinnerNumberModel
+ */
+
+public class HeadlessSpinnerNumberModel {
+    public static void main(String args[]) {
+        SpinnerNumberModel model = new SpinnerNumberModel();
+        model.setValue(5);
+        model.getValue();
+        model.getPreviousValue();
+        model.getNextValue();
+    }
+}
diff --git a/jdk/test/javax/swing/Headless/HeadlessTimer.java b/jdk/test/javax/swing/Headless/HeadlessTimer.java
new file mode 100644
index 00000000000..1a4db754408
--- /dev/null
+++ b/jdk/test/javax/swing/Headless/HeadlessTimer.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/*
+ * @test
+ * @summary Check that Timer constructors do not throw unexpected exceptions
+ *          in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessTimer
+ */
+
+public class HeadlessTimer {
+    public static void main(String args[]) {
+        Timer t = new Timer(100, null);
+    }
+}
-- 
GitLab


From 07289a2d98e61d4a621a0b3150886f5941b2d13d Mon Sep 17 00:00:00 2001
From: Alexander Stepanov <alexander.v.stepanov@oracle.com>
Date: Fri, 20 Jun 2014 19:03:57 +0400
Subject: [PATCH 123/192] 8046445: Fix doclint warnings for
 javax.swing.plaf.multi

Reviewed-by: alexsch
---
 .../classes/javax/swing/plaf/multi/MultiButtonUI.java    | 7 ++++++-
 .../javax/swing/plaf/multi/MultiColorChooserUI.java      | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiComboBoxUI.java  | 7 ++++++-
 .../javax/swing/plaf/multi/MultiDesktopIconUI.java       | 7 ++++++-
 .../javax/swing/plaf/multi/MultiDesktopPaneUI.java       | 7 ++++++-
 .../javax/swing/plaf/multi/MultiFileChooserUI.java       | 7 ++++++-
 .../javax/swing/plaf/multi/MultiInternalFrameUI.java     | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiLabelUI.java     | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiListUI.java      | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiMenuBarUI.java   | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiMenuItemUI.java  | 7 ++++++-
 .../javax/swing/plaf/multi/MultiOptionPaneUI.java        | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiPanelUI.java     | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiPopupMenuUI.java | 7 ++++++-
 .../javax/swing/plaf/multi/MultiProgressBarUI.java       | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiRootPaneUI.java  | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiScrollBarUI.java | 7 ++++++-
 .../javax/swing/plaf/multi/MultiScrollPaneUI.java        | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiSeparatorUI.java | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiSliderUI.java    | 9 +++++++--
 .../classes/javax/swing/plaf/multi/MultiSpinnerUI.java   | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiSplitPaneUI.java | 7 ++++++-
 .../javax/swing/plaf/multi/MultiTabbedPaneUI.java        | 7 ++++++-
 .../javax/swing/plaf/multi/MultiTableHeaderUI.java       | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiTableUI.java     | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiTextUI.java      | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiToolBarUI.java   | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiToolTipUI.java   | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiTreeUI.java      | 7 ++++++-
 .../classes/javax/swing/plaf/multi/MultiViewportUI.java  | 7 ++++++-
 30 files changed, 181 insertions(+), 31 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiButtonUI.java
index 77fbf3129ac..e8b81e25ec2 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiButtonUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiButtonUI extends ButtonUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiButtonUI extends ButtonUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiButtonUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java
index bd15686032e..8881abbc8ba 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -57,6 +57,8 @@ public class MultiColorChooserUI extends ColorChooserUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiColorChooserUI extends ColorChooserUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiColorChooserUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java
index 4008fd02c74..ee3cc9848a6 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -58,6 +58,8 @@ public class MultiComboBoxUI extends ComboBoxUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -138,6 +140,9 @@ public class MultiComboBoxUI extends ComboBoxUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiComboBoxUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java
index ba78eb789b1..a41a72931a1 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiDesktopIconUI extends DesktopIconUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiDesktopIconUI extends DesktopIconUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiDesktopIconUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java
index 53569defea5..7f99cfad12d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiDesktopPaneUI extends DesktopPaneUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiDesktopPaneUI extends DesktopPaneUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiDesktopPaneUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java
index b76a6a8ae6b..b2ce34e1b6d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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,6 +62,8 @@ public class MultiFileChooserUI extends FileChooserUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -181,6 +183,9 @@ public class MultiFileChooserUI extends FileChooserUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiFileChooserUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java
index dd4509c550a..9b9085522ea 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiInternalFrameUI extends InternalFrameUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiInternalFrameUI extends InternalFrameUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiInternalFrameUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiLabelUI.java
index 222b2218563..844cc6d7969 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiLabelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiLabelUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiLabelUI extends LabelUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiLabelUI extends LabelUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiLabelUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiListUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiListUI.java
index 48a05ac2df5..aa541be2cfd 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiListUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiListUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -60,6 +60,8 @@ public class MultiListUI extends ListUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -146,6 +148,9 @@ public class MultiListUI extends ListUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiListUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java
index b15797ef518..70596af4a4f 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiMenuBarUI extends MenuBarUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiMenuBarUI extends MenuBarUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiMenuBarUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java
index e4c27e6878e..0b9458e4513 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -58,6 +58,8 @@ public class MultiMenuItemUI extends MenuItemUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -103,6 +105,9 @@ public class MultiMenuItemUI extends MenuItemUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiMenuItemUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java
index 630b328c048..4e5408f5f04 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -58,6 +58,8 @@ public class MultiOptionPaneUI extends OptionPaneUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -123,6 +125,9 @@ public class MultiOptionPaneUI extends OptionPaneUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiOptionPaneUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiPanelUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiPanelUI.java
index 4bdbe43b968..27799d9657a 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiPanelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiPanelUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -57,6 +57,8 @@ public class MultiPanelUI extends PanelUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiPanelUI extends PanelUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiPanelUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java
index 59002ea1566..d4c13051a91 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -60,6 +60,8 @@ public class MultiPopupMenuUI extends PopupMenuUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -133,6 +135,9 @@ public class MultiPopupMenuUI extends PopupMenuUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiPopupMenuUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java
index fd39d724a2b..6a1d01ec16b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiProgressBarUI extends ProgressBarUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiProgressBarUI extends ProgressBarUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiProgressBarUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java
index 601f21129d0..46e60d7e319 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -58,6 +58,8 @@ public class MultiRootPaneUI extends RootPaneUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -99,6 +101,9 @@ public class MultiRootPaneUI extends RootPaneUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiRootPaneUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java
index b372df70913..a7d5381435a 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiScrollBarUI extends ScrollBarUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiScrollBarUI extends ScrollBarUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiScrollBarUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java
index 1894a6309c0..f7b7c44289a 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiScrollPaneUI extends ScrollPaneUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiScrollPaneUI extends ScrollPaneUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiScrollPaneUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java
index 29f6a7fae26..d67cc0407a0 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiSeparatorUI extends SeparatorUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiSeparatorUI extends SeparatorUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiSeparatorUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSliderUI.java
index 8bc53ee81c1..65da1c18358 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSliderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSliderUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiSliderUI extends SliderUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -96,8 +98,11 @@ public class MultiSliderUI extends SliderUI {
 
     /**
      * Returns a multiplexing UI instance if any of the auxiliary
-     * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
+     * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiSliderUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java
index be2c9c0a277..2c0ce087dc9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -58,6 +58,8 @@ public class MultiSpinnerUI extends SpinnerUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -99,6 +101,9 @@ public class MultiSpinnerUI extends SpinnerUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiSpinnerUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java
index 5b637f723f3..6c0eb44f3e7 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -58,6 +58,8 @@ public class MultiSplitPaneUI extends SplitPaneUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -171,6 +173,9 @@ public class MultiSplitPaneUI extends SplitPaneUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiSplitPaneUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java
index 9624ccba1ce..c14f29125e2 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -59,6 +59,8 @@ public class MultiTabbedPaneUI extends TabbedPaneUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -145,6 +147,9 @@ public class MultiTabbedPaneUI extends TabbedPaneUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiTabbedPaneUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java
index 9b1695168a7..417e5dcbcef 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiTableHeaderUI extends TableHeaderUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiTableHeaderUI extends TableHeaderUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiTableHeaderUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableUI.java
index a281626617e..7a059e33b13 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiTableUI extends TableUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiTableUI extends TableUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiTableUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTextUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTextUI.java
index 7c704a5971e..30dae8fdb69 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTextUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTextUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -65,6 +65,8 @@ public class MultiTextUI extends TextUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -248,6 +250,9 @@ public class MultiTextUI extends TextUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiTextUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java
index 1922c2679d4..172524e9c94 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiToolBarUI extends ToolBarUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiToolBarUI extends ToolBarUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiToolBarUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java
index c2848af6858..e6062120733 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -57,6 +57,8 @@ public class MultiToolTipUI extends ToolTipUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiToolTipUI extends ToolTipUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiToolTipUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTreeUI.java
index 8cc13957303..0828ded9e03 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTreeUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTreeUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -60,6 +60,8 @@ public class MultiTreeUI extends TreeUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -239,6 +241,9 @@ public class MultiTreeUI extends TreeUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiTreeUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/MultiViewportUI.java b/jdk/src/share/classes/javax/swing/plaf/multi/MultiViewportUI.java
index 7f6c162b72b..fff9e2eaa0f 100644
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiViewportUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiViewportUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -57,6 +57,8 @@ public class MultiViewportUI extends ViewportUI {
      * Returns the list of UIs associated with this multiplexing UI.  This
      * allows processing of the UIs by an application aware of multiplexing
      * UIs on components.
+     *
+     * @return an array of the UI delegates
      */
     public ComponentUI[] getUIs() {
         return MultiLookAndFeel.uisToArray(uis);
@@ -98,6 +100,9 @@ public class MultiViewportUI extends ViewportUI {
      * Returns a multiplexing UI instance if any of the auxiliary
      * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
      * UI object obtained from the default <code>LookAndFeel</code>.
+     *
+     * @param  a the component to create the UI for
+     * @return the UI delegate created
      */
     public static ComponentUI createUI(JComponent a) {
         ComponentUI mui = new MultiViewportUI();
-- 
GitLab


From 6c8c5619ed339b06d5755e461ebe4043a887da6c Mon Sep 17 00:00:00 2001
From: Kumar Srinivasan <ksrini@openjdk.org>
Date: Fri, 20 Jun 2014 10:10:27 -0700
Subject: [PATCH 124/192] 8044866: Fix raw and unchecked lint warnings in asm

Reviewed-by: darcy
---
 .../jdk/internal/org/objectweb/asm/tree/InsnList.java  |  1 +
 .../internal/org/objectweb/asm/tree/MethodNode.java    |  1 +
 .../org/objectweb/asm/tree/analysis/Analyzer.java      |  1 +
 .../org/objectweb/asm/tree/analysis/Frame.java         |  1 +
 .../classes/jdk/internal/org/objectweb/asm/version.txt | 10 +++++-----
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
index 7acfff532f5..8dec6eda0bd 100644
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
@@ -550,6 +550,7 @@ public class InsnList {
     }
 
     // this class is not generified because it will create bridges
+    @SuppressWarnings("rawtypes")
     private final class InsnListIterator implements ListIterator {
 
         AbstractInsnNode next;
diff --git a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
index bb01f7a7a3d..1561442761a 100644
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/MethodNode.java
@@ -399,6 +399,7 @@ public class MethodNode extends MethodVisitor {
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public AnnotationVisitor visitParameterAnnotation(final int parameter,
             final String desc, final boolean visible) {
         AnnotationNode an = new AnnotationNode(desc);
diff --git a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
index 8f987532efd..b8d6fdaa1e0 100644
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
@@ -131,6 +131,7 @@ public class Analyzer<V extends Value> implements Opcodes {
      * @throws AnalyzerException
      *             if a problem occurs during the analysis.
      */
+    @SuppressWarnings("unchecked")
     public Frame<V>[] analyze(final String owner, final MethodNode m)
             throws AnalyzerException {
         if ((m.access & (ACC_ABSTRACT | ACC_NATIVE)) != 0) {
diff --git a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
index cbb5f86f534..4ba309d0cbf 100644
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Frame.java
@@ -112,6 +112,7 @@ public class Frame<V extends Value> {
      * @param nStack
      *            the maximum stack size of the frame.
      */
+    @SuppressWarnings("unchecked")
     public Frame(final int nLocals, final int nStack) {
         this.values = (V[]) new Value[nLocals + nStack];
         this.locals = nLocals;
diff --git a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/version.txt b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
index b1d916092e5..d93a6c4b4fd 100644
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
@@ -1,12 +1,12 @@
 Path: .
-Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-05-27
+Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-06-19
 URL: file:///svnroot/asm/trunk/asm
 Repository Root: file:///svnroot/asm
 Repository UUID: 271bd773-ee82-43a6-9b2b-1890ed8ce7f9
-Revision: 1748
+Revision: 1750
 Node Kind: directory
 Schedule: normal
-Last Changed Author: ebruneton
-Last Changed Rev: 1747
-Last Changed Date: 2014-05-24 10:22:13 +0200 (Sat, 24 May 2014)
+Last Changed Author: forax
+Last Changed Rev: 1750
+Last Changed Date: 2014-06-06 00:31:02 +0200 (Fri, 06 Jun 2014)
 
-- 
GitLab


From b5769155b4bf453d65c43921dbcae4d115f17df7 Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Fri, 20 Jun 2014 12:37:08 -0700
Subject: [PATCH 125/192] 8042098: Test sun/java2d/AcceleratedXORModeTest.java
 fails on Windows

Reviewed-by: jgodinez
---
 jdk/test/sun/java2d/AcceleratedXORModeTest.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/jdk/test/sun/java2d/AcceleratedXORModeTest.java b/jdk/test/sun/java2d/AcceleratedXORModeTest.java
index e255cc39d48..edde80ebeeb 100644
--- a/jdk/test/sun/java2d/AcceleratedXORModeTest.java
+++ b/jdk/test/sun/java2d/AcceleratedXORModeTest.java
@@ -23,7 +23,7 @@
 
 /*
 * @test
-* @bug     8024343
+* @bug     8024343 8042098
 * @summary Test verifies that accelerated pipelines
 *          correctly draws primitives in XOR mode.
 * @run main/othervm -Dsun.java2d.xrender=True AcceleratedXORModeTest
@@ -128,6 +128,7 @@ public class AcceleratedXORModeTest {
 
     void test() {
         createVImg();
+        BufferedImage bi = null;
         do {
             int valCode = vImg.validate(getDefaultGC());
             if (valCode == VolatileImage.IMAGE_INCOMPATIBLE) {
@@ -135,9 +136,11 @@ public class AcceleratedXORModeTest {
             }
             Graphics2D g = vImg.createGraphics();
             draw(g);
-            BufferedImage bi = vImg.getSnapshot();
+            bi = vImg.getSnapshot();
+        } while (vImg.contentsLost());
+        if (bi != null) {
             test(bi);
             write(bi);
-        } while (vImg.contentsLost());
+        }
     }
 }
-- 
GitLab


From 1211cc5dbc6375f060d3925d8b57957a1f456181 Mon Sep 17 00:00:00 2001
From: Mandy Chung <mchung@openjdk.org>
Date: Fri, 20 Jun 2014 13:35:56 -0700
Subject: [PATCH 126/192] 8044063: Remove com.sun.java.browser.* from jdk repo

Reviewed-by: darcy, alanb
---
 make/Javadoc.gmk              | 2 +-
 make/common/NON_CORE_PKGS.gmk | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk
index aebdb21a8b2..bd683578746 100644
--- a/make/Javadoc.gmk
+++ b/make/Javadoc.gmk
@@ -527,7 +527,7 @@ DOMAPI_WINDOWTITLE := Common DOM API
 DOMAPI_HEADER := <strong>Common DOM API</strong>
 DOMAPI_BOTTOM := $(call CommonTrademarkBottom,$(DOMAPI_FIRST_COPYRIGHT_YEAR))
 DOMAPI_GROUPNAME := Packages
-DOMAPI_REGEXP := com.sun.java.browser.dom:org.w3c.dom*
+DOMAPI_REGEXP := org.w3c.dom*
 # DOMAPI_PKGS is located in NON_CORE_PKGS.gmk
 
 # The index.html, options, and packages files
diff --git a/make/common/NON_CORE_PKGS.gmk b/make/common/NON_CORE_PKGS.gmk
index 601f5f81f23..ed93fa9e30e 100644
--- a/make/common/NON_CORE_PKGS.gmk
+++ b/make/common/NON_CORE_PKGS.gmk
@@ -33,8 +33,7 @@
 # team when determining which APIs to extract javadoc
 # comments from.
 
-DOMAPI_PKGS = com.sun.java.browser.dom \
-    org.w3c.dom \
+DOMAPI_PKGS = org.w3c.dom \
     org.w3c.dom.bootstrap \
     org.w3c.dom.ls \
     org.w3c.dom.ranges \
-- 
GitLab


From e4db9235e4f6d22ec0a983c4fee4779d2c576efa Mon Sep 17 00:00:00 2001
From: Mandy Chung <mchung@openjdk.org>
Date: Fri, 20 Jun 2014 13:36:03 -0700
Subject: [PATCH 127/192] 8044063: Remove com.sun.java.browser.* from jdk repo

Reviewed-by: darcy, alanb
---
 .../java/browser/dom/DOMAccessException.java  |  90 ---------------
 .../com/sun/java/browser/dom/DOMAccessor.java |  40 -------
 .../com/sun/java/browser/dom/DOMAction.java   |  42 -------
 .../com/sun/java/browser/dom/DOMService.java  | 107 ------------------
 .../java/browser/dom/DOMServiceProvider.java  |  60 ----------
 .../browser/dom/DOMUnsupportedException.java  |  89 ---------------
 .../com/sun/java/browser/net/ProxyInfo.java   |  36 ------
 .../sun/java/browser/net/ProxyService.java    |  61 ----------
 .../browser/net/ProxyServiceProvider.java     |  36 ------
 9 files changed, 561 deletions(-)
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessException.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessor.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/dom/DOMAction.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/dom/DOMService.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/dom/DOMServiceProvider.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/dom/DOMUnsupportedException.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/net/ProxyInfo.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/net/ProxyService.java
 delete mode 100644 jdk/src/share/classes/com/sun/java/browser/net/ProxyServiceProvider.java

diff --git a/jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessException.java b/jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessException.java
deleted file mode 100644
index 77307d834f5..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessException.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2000, 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.dom;
-
-@SuppressWarnings("serial") // JDK implementation class
-public class DOMAccessException extends Exception
-{
-    /**
-     * Constructs a new DOMAccessException with no detail message.
-     */
-    public DOMAccessException()
-    {
-        this(null, null);
-    }
-
-
-    /**
-     * Constructs a new DOMAccessException with the given detail message.
-     *
-     * @param msg Detail message.
-     */
-    public DOMAccessException(String msg)
-    {
-        this(null, msg);
-    }
-
-    /**
-     * Constructs a new DOMAccessException with the given exception as a root clause.
-     *
-     * @param e Exception.
-     */
-    public DOMAccessException(Exception e)
-    {
-        this(e, null);
-    }
-
-    /**
-     * Constructs a new DOMAccessException with the given exception as a root clause and the given detail message.
-     *
-     * @param e Exception.
-     * @param msg Detail message.
-     */
-    public DOMAccessException(Exception e, String msg)
-    {
-        this.ex = e;
-        this.msg = msg;
-    }
-
-    /**
-     * Returns the detail message of the error or null if there is no detail message.
-     */
-    public String getMessage()
-    {
-        return msg;
-    }
-
-    /**
-     * Returns the root cause of the error or null if there is none.
-     */
-    public Throwable getCause()
-    {
-        return ex;
-    }
-
-    private Throwable ex;
-    private String msg;
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessor.java b/jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessor.java
deleted file mode 100644
index 6435be4e705..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/dom/DOMAccessor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.dom;
-
-
-public interface DOMAccessor
-{
-    /**
-     * Returns the Document object of the DOM.
-     */
-    public org.w3c.dom.Document getDocument(Object obj) throws org.w3c.dom.DOMException;
-
-    /**
-     * Returns a DOMImplementation object.
-     */
-    public org.w3c.dom.DOMImplementation getDOMImplementation();
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/dom/DOMAction.java b/jdk/src/share/classes/com/sun/java/browser/dom/DOMAction.java
deleted file mode 100644
index 8e8e4e420c1..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/dom/DOMAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.dom;
-
-
-public interface DOMAction
-{
-    /**
-     * When an object implementing interface DOMAction is passed
-     * to DOMService.invokeAndWait() or DOMService.invokeLater(),
-     * run method is called in the DOM access dispatch thread.
-     *
-     * accessor is used for the DOMAction to access the entry point of
-     * the browser's DOM, if necessary.
-     *
-     * @param accessor DOMAccessor
-     */
-    public Object run(DOMAccessor accessor);
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/dom/DOMService.java b/jdk/src/share/classes/com/sun/java/browser/dom/DOMService.java
deleted file mode 100644
index 9a418cf5edc..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/dom/DOMService.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2000, 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.dom;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-public abstract class DOMService
-{
-    /**
-     * Returns new instance of a DOMService. The implementation
-     * of the DOMService returns depends on the setting of the
-     * com.sun.java.browser.dom.DOMServiceProvider property or,
-     * if the property is not set, a platform specific default.
-     *
-     * Throws DOMUnsupportedException if the DOMService is not
-     * available to the obj.
-     *
-     * @param obj Object to leverage the DOMService
-     */
-    public static DOMService getService(Object obj)
-                  throws DOMUnsupportedException
-    {
-        try
-        {
-            String provider = AccessController.doPrivileged(
-                (PrivilegedAction<String>) () ->
-                    System.getProperty("com.sun.java.browser.dom.DOMServiceProvider"));
-
-            Class clazz = Class.forName("sun.plugin.dom.DOMService");
-
-            return (DOMService) clazz.newInstance();
-        }
-        catch (Throwable e)
-        {
-            throw new DOMUnsupportedException(e.toString());
-        }
-    }
-
-    /**
-     * An empty constructor is provided. Implementations of this
-     * abstract class must provide a public no-argument constructor
-     * in order for the static getService() method to work correctly.
-     * Application programmers should not be able to directly
-     * construct implementation subclasses of this abstract subclass.
-     */
-    public DOMService()
-    {
-    }
-
-    /**
-     * Causes action.run() to be executed synchronously on the
-     * DOM action dispatching thread. This call will block until all
-     * pending DOM actions have been processed and (then)
-     * action.run() returns. This method should be used when an
-     * application thread needs to access the browser's DOM.
-     * It should not be called from the DOMActionDispatchThread.
-     *
-     * Note that if the DOMAction.run() method throws an uncaught
-     * exception (on the DOM action dispatching thread),  it's caught
-     * and re-thrown, as an DOMAccessException, on the caller's thread.
-     *
-     * If the DOMAction.run() method throws any DOM security related
-     * exception (on the DOM action dispatching thread), it's caught
-     * and re-thrown, as an DOMSecurityException, on the caller's thread.
-     *
-     * @param action DOMAction.
-     */
-    public abstract Object invokeAndWait(DOMAction action) throws DOMAccessException;
-
-    /**
-     * Causes action.run() to be executed asynchronously on the
-     * DOM action dispatching thread. This method should be used
-     * when an application thread needs to access the browser's
-     * DOM. It should not be called from the DOMActionDispatchThread.
-     *
-     * Note that if the DOMAction.run() method throws an uncaught
-     * exception (on the DOM action dispatching thread),  it will not be
-     * caught and re-thrown on the caller's thread.
-     *
-     * @param action DOMAction.
-     */
-    public abstract void invokeLater(DOMAction action);
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/dom/DOMServiceProvider.java b/jdk/src/share/classes/com/sun/java/browser/dom/DOMServiceProvider.java
deleted file mode 100644
index 8cd7aa1e3a8..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/dom/DOMServiceProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2000, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.dom;
-
-public abstract class DOMServiceProvider
-{
-    /**
-     * An empty constructor is provided. Implementations should
-     * provide a public constructor so that the DOMService
-     * can instantiate instances of the implementation class.
-     * Application programmers should not be able to directly
-     * construct implementation subclasses of this abstract subclass.
-     * The only way an application should be able to obtain a
-     * reference to a DOMServiceProvider implementation
-     * instance is by using the appropriate methods of the
-     * DOMService.
-     */
-    public DOMServiceProvider()
-    {
-    }
-
-    /**
-     * Returns true if the DOMService can determine the association
-     * between the obj and the underlying DOM in the browser.
-     */
-    public abstract boolean canHandle(Object obj);
-
-    /**
-     * Returns the Document object of the DOM.
-     */
-    public abstract org.w3c.dom.Document getDocument(Object obj) throws DOMUnsupportedException;
-
-    /**
-     * Returns the DOMImplemenation object of the DOM.
-     */
-    public abstract org.w3c.dom.DOMImplementation getDOMImplementation();
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/dom/DOMUnsupportedException.java b/jdk/src/share/classes/com/sun/java/browser/dom/DOMUnsupportedException.java
deleted file mode 100644
index 2796339f39a..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/dom/DOMUnsupportedException.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2000, 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.dom;
-
-@SuppressWarnings("serial") // JDK implementation class
-public class DOMUnsupportedException extends Exception
-{
-    /**
-     * Constructs a new DOMUnsupportedException with no detail message.
-     */
-    public DOMUnsupportedException()
-    {
-        this(null, null);
-    }
-
-    /**
-     * Constructs a new DOMUnsupportedException with the given detail message.
-     *
-     * @param msg Detail message.
-     */
-    public DOMUnsupportedException(String msg)
-    {
-        this(null, msg);
-    }
-
-    /**
-     * Constructs a new DOMUnsupportedException with the given exception as a root clause.
-     *
-     * @param e Exception.
-     */
-    public DOMUnsupportedException(Exception e)
-    {
-        this(e, null);
-    }
-
-    /**
-     * Constructs a new DOMUnsupportedException with the given exception as a root clause and the given detail message.
-     *
-     * @param e Exception.
-     * @param msg Detail message.
-     */
-    public DOMUnsupportedException(Exception e, String msg)
-    {
-        this.ex = e;
-        this.msg = msg;
-    }
-
-    /**
-     * Returns the detail message of the error or null if there is no detail message.
-     */
-    public String getMessage()
-    {
-        return msg;
-    }
-
-    /**
-     * Returns the root cause of the error or null if there is none.
-     */
-    public Throwable getCause()
-    {
-        return ex;
-    }
-
-    private Throwable ex;
-    private String msg;
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/net/ProxyInfo.java b/jdk/src/share/classes/com/sun/java/browser/net/ProxyInfo.java
deleted file mode 100644
index f966e813591..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/net/ProxyInfo.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2001, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.net;
-
-/**
- *
- * @author  Zhengyu Gu
- */
-public interface ProxyInfo {
-    public String   getHost();
-    public int      getPort();
-    public boolean  isSocks();
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/net/ProxyService.java b/jdk/src/share/classes/com/sun/java/browser/net/ProxyService.java
deleted file mode 100644
index b4960905fda..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/net/ProxyService.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2001, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.net;
-
-import java.net.URL;
-import java.io.IOException;
-
-/**
- *
- * @author  Zhengyu Gu
- */
-public class ProxyService extends Object {
-    private static ProxyServiceProvider provider = null;
-
-
-    public static void setProvider(ProxyServiceProvider p)
-    throws IOException {
-        if(null == provider)
-            provider = p;
-        else
-            throw new IOException("Proxy service provider has already been set.");
-    }
-
-
-    /**
-     *  <p>The function returns proxy information of the specified URL.</p>
-     *  @param url URL
-     *  @return returns proxy information. If there is not proxy, returns null
-     *  @since 1.4
-     */
-    public static ProxyInfo[] getProxyInfo(URL url)
-    throws IOException {
-        if(null == provider)
-            throw new IOException("Proxy service provider is not yet set");
-
-        return provider.getProxyInfo(url);
-    }
-}
diff --git a/jdk/src/share/classes/com/sun/java/browser/net/ProxyServiceProvider.java b/jdk/src/share/classes/com/sun/java/browser/net/ProxyServiceProvider.java
deleted file mode 100644
index df4513a34a0..00000000000
--- a/jdk/src/share/classes/com/sun/java/browser/net/ProxyServiceProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2001, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.java.browser.net;
-
-import java.net.URL;
-
-/**
- *
- * @author  Zhengyu Gu
- */
-public interface ProxyServiceProvider {
-    public ProxyInfo[] getProxyInfo(URL url);
-}
-- 
GitLab


From 0b95f7c7a256fcc6e855070e510d3a8ec0d5e89a Mon Sep 17 00:00:00 2001
From: Steven Sides <steve.sides@oracle.com>
Date: Mon, 23 Jun 2014 10:57:22 +0400
Subject: [PATCH 128/192] 8040901: fix doclint block tag issues in swing event
 classes

Reviewed-by: alexsch
---
 .../javax/swing/event/AncestorEvent.java      |  8 +-
 .../javax/swing/event/AncestorListener.java   | 11 ++-
 .../javax/swing/event/CellEditorListener.java | 14 +++-
 .../javax/swing/event/EventListenerList.java  | 18 +++-
 .../javax/swing/event/HyperlinkEvent.java     |  2 +
 .../swing/event/InternalFrameListener.java    | 23 ++++-
 .../javax/swing/event/ListSelectionEvent.java |  1 +
 .../javax/swing/event/MenuKeyListener.java    |  8 +-
 .../javax/swing/event/PopupMenuEvent.java     |  4 +-
 .../javax/swing/event/PopupMenuListener.java  |  8 +-
 .../swing/event/TableColumnModelEvent.java    | 12 ++-
 .../swing/event/TableColumnModelListener.java | 28 +++++--
 .../javax/swing/event/TableModelEvent.java    | 84 +++++++++++++------
 .../javax/swing/event/TableModelListener.java |  5 +-
 .../javax/swing/event/TreeExpansionEvent.java |  4 +-
 .../swing/event/TreeExpansionListener.java    | 16 ++--
 .../javax/swing/event/TreeModelListener.java  | 43 +++++-----
 .../javax/swing/event/TreeSelectionEvent.java | 33 ++++++--
 .../swing/event/TreeWillExpandListener.java   | 10 ++-
 .../swing/event/UndoableEditListener.java     |  4 +-
 .../javax/swing/tree/ExpandVetoException.java |  2 +-
 21 files changed, 256 insertions(+), 82 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/event/AncestorEvent.java b/jdk/src/share/classes/javax/swing/event/AncestorEvent.java
index a113ebe4c0b..d6f7ab08c28 100644
--- a/jdk/src/share/classes/javax/swing/event/AncestorEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/AncestorEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -81,6 +81,8 @@ public class AncestorEvent extends AWTEvent {
 
     /**
      * Returns the ancestor that the event actually occurred on.
+     *
+     * @return the {@code Container} object specifying the ancestor component
      */
     public Container getAncestor() {
         return ancestor;
@@ -90,6 +92,8 @@ public class AncestorEvent extends AWTEvent {
      * Returns the parent of the ancestor the event actually occurred on.
      * This is most interesting in an ANCESTOR_REMOVED event, as
      * the ancestor may no longer be in the component hierarchy.
+     *
+     * @return the {@code Container} object specifying the ancestor's parent
      */
     public Container getAncestorParent() {
         return ancestorParent;
@@ -97,6 +101,8 @@ public class AncestorEvent extends AWTEvent {
 
     /**
      * Returns the component that the listener was added to.
+     *
+     * @return the {@code JComponent} on which the event occurred
      */
     public JComponent getComponent() {
         return (JComponent)getSource();
diff --git a/jdk/src/share/classes/javax/swing/event/AncestorListener.java b/jdk/src/share/classes/javax/swing/event/AncestorListener.java
index d0b07bdbfea..30dd3cfc4f1 100644
--- a/jdk/src/share/classes/javax/swing/event/AncestorListener.java
+++ b/jdk/src/share/classes/javax/swing/event/AncestorListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -48,6 +48,9 @@ public interface AncestorListener extends EventListener {
      * if the source has actually become visible.  For this to be true
      * all its parents must be visible and it must be in a hierarchy
      * rooted at a Window
+     *
+     * @param event an {@code AncestorEvent} signifying a change in an
+     *              ancestor-component's display-status
      */
     public void ancestorAdded(AncestorEvent event);
 
@@ -58,11 +61,17 @@ public interface AncestorListener extends EventListener {
      * if the source has actually become invisible.  For this to be true
      * at least one of its parents must by invisible or it is not in
      * a hierarchy rooted at a Window
+     *
+     * @param event an {@code AncestorEvent} signifying a change in an
+     *              ancestor-component's display-status
      */
     public void ancestorRemoved(AncestorEvent event);
 
     /**
      * Called when either the source or one of its ancestors is moved.
+     *
+     * @param event an {@code AncestorEvent} signifying a change in an
+     *              ancestor-component's display-status
      */
     public void ancestorMoved(AncestorEvent event);
 
diff --git a/jdk/src/share/classes/javax/swing/event/CellEditorListener.java b/jdk/src/share/classes/javax/swing/event/CellEditorListener.java
index fabeca11f62..817e6ea2441 100644
--- a/jdk/src/share/classes/javax/swing/event/CellEditorListener.java
+++ b/jdk/src/share/classes/javax/swing/event/CellEditorListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -37,9 +37,17 @@ import java.util.EventListener;
 
 public interface CellEditorListener extends java.util.EventListener {
 
-    /** This tells the listeners the editor has ended editing */
+    /**
+     * This tells the listeners the editor has ended editing
+     *
+     * @param e the {@code ChangeEvent} containing the source of the event
+     */
     public void editingStopped(ChangeEvent e);
 
-    /** This tells the listeners the editor has canceled editing */
+    /**
+     * This tells the listeners the editor has canceled editing
+     *
+     * @param e the {@code ChangeEvent} containing the source of the event
+     */
     public void editingCanceled(ChangeEvent e);
 }
diff --git a/jdk/src/share/classes/javax/swing/event/EventListenerList.java b/jdk/src/share/classes/javax/swing/event/EventListenerList.java
index 9e145daa251..ccde0bfef76 100644
--- a/jdk/src/share/classes/javax/swing/event/EventListenerList.java
+++ b/jdk/src/share/classes/javax/swing/event/EventListenerList.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -120,6 +120,8 @@ public class EventListenerList implements Serializable {
      * any such manipulation is necessary, it should be done
      * on a copy of the array returned rather than the array
      * itself.
+     *
+     * @return array of ListenerType-listener pairs
      */
     public Object[] getListenerList() {
         return listenerList;
@@ -127,6 +129,9 @@ public class EventListenerList implements Serializable {
 
     /**
      * Return an array of all the listeners of the given type.
+     *
+     * @param <T> the type of {@code EventListener} to search for
+     * @param t the type of {@code EventListener} classes to be returned
      * @return all of the listeners of the specified type.
      * @exception  ClassCastException if the supplied class
      *          is not assignable to EventListener
@@ -148,6 +153,8 @@ public class EventListenerList implements Serializable {
 
     /**
      * Returns the total number of listeners for this listener list.
+     *
+     * @return an integer count of total number of listeners
      */
     public int getListenerCount() {
         return listenerList.length/2;
@@ -156,6 +163,9 @@ public class EventListenerList implements Serializable {
     /**
      * Returns the total number of listeners of the supplied type
      * for this listener list.
+     *
+     * @param t the type of listeners to count
+     * @return the number of listeners of type {@code t}
      */
     public int getListenerCount(Class<?> t) {
         Object[] lList = listenerList;
@@ -173,7 +183,9 @@ public class EventListenerList implements Serializable {
 
     /**
      * Adds the listener as a listener of the specified type.
-     * @param t the type of the listener to be added
+     *
+     * @param <T> the type of {@code EventListener} to add
+     * @param t the type of the {@code EventListener} class to add
      * @param l the listener to be added
      */
     public synchronized <T extends EventListener> void add(Class<T> t, T l) {
@@ -206,6 +218,8 @@ public class EventListenerList implements Serializable {
 
     /**
      * Removes the listener as a listener of the specified type.
+     *
+     * @param <T> the type of {@code EventListener}
      * @param t the type of the listener to be removed
      * @param l the listener to be removed
      */
diff --git a/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java b/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java
index 848910188e9..bcd7ea60063 100644
--- a/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java
@@ -142,6 +142,8 @@ public class HyperlinkEvent extends EventObject {
      * This may be useful if a URL can't be formed
      * from the description, in which case the associated
      * URL would be null.
+     *
+     * @return the description of this link as a {@code String}
      */
     public String getDescription() {
         return desc;
diff --git a/jdk/src/share/classes/javax/swing/event/InternalFrameListener.java b/jdk/src/share/classes/javax/swing/event/InternalFrameListener.java
index 151c4978630..433f20e6227 100644
--- a/jdk/src/share/classes/javax/swing/event/InternalFrameListener.java
+++ b/jdk/src/share/classes/javax/swing/event/InternalFrameListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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,6 +42,9 @@ import java.util.EventListener;
 public interface InternalFrameListener extends EventListener {
     /**
      * Invoked when a internal frame has been opened.
+     *
+     * @param e an {@code InternalFrameEvent} with information about the
+     *          {@code JInteralFrame} that originated the event
      * @see javax.swing.JInternalFrame#show
      */
     public void internalFrameOpened(InternalFrameEvent e);
@@ -49,36 +52,54 @@ public interface InternalFrameListener extends EventListener {
     /**
      * Invoked when an internal frame is in the process of being closed.
      * The close operation can be overridden at this point.
+     *
+     * @param e an {@code InternalFrameEvent} with information about the
+     *          {@code JInteralFrame} that originated the event
      * @see javax.swing.JInternalFrame#setDefaultCloseOperation
      */
     public void internalFrameClosing(InternalFrameEvent e);
 
     /**
      * Invoked when an internal frame has been closed.
+     *
+     * @param e an {@code InternalFrameEvent} with information about the
+     *          {@code JInteralFrame} that originated the event
      * @see javax.swing.JInternalFrame#setClosed
      */
     public void internalFrameClosed(InternalFrameEvent e);
 
     /**
      * Invoked when an internal frame is iconified.
+     *
+     * @param e an {@code InternalFrameEvent} with information about the
+     *          {@code JInteralFrame} that originated the event
      * @see javax.swing.JInternalFrame#setIcon
      */
     public void internalFrameIconified(InternalFrameEvent e);
 
     /**
      * Invoked when an internal frame is de-iconified.
+     *
+     * @param e an {@code InternalFrameEvent} with information about the
+     *          {@code JInteralFrame} that originated the event
      * @see javax.swing.JInternalFrame#setIcon
      */
     public void internalFrameDeiconified(InternalFrameEvent e);
 
     /**
      * Invoked when an internal frame is activated.
+     *
+     * @param e an {@code InternalFrameEvent} with information about the
+     *          {@code JInteralFrame} that originated the event
      * @see javax.swing.JInternalFrame#setSelected
      */
     public void internalFrameActivated(InternalFrameEvent e);
 
     /**
      * Invoked when an internal frame is de-activated.
+     *
+     * @param e an {@code InternalFrameEvent} with information about the
+     *          {@code JInteralFrame} that originated the event
      * @see javax.swing.JInternalFrame#setSelected
      */
     public void internalFrameDeactivated(InternalFrameEvent e);
diff --git a/jdk/src/share/classes/javax/swing/event/ListSelectionEvent.java b/jdk/src/share/classes/javax/swing/event/ListSelectionEvent.java
index a5128f1e47c..735b5797088 100644
--- a/jdk/src/share/classes/javax/swing/event/ListSelectionEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/ListSelectionEvent.java
@@ -63,6 +63,7 @@ public class ListSelectionEvent extends EventObject
      * {@code lastIndex}. The selection of at least one index within the range will
      * have changed.
      *
+     * @param source the {@code Object} on which the event initially occurred
      * @param firstIndex the first index in the range, &lt;= lastIndex
      * @param lastIndex the last index in the range, &gt;= firstIndex
      * @param isAdjusting whether or not this is one in a series of
diff --git a/jdk/src/share/classes/javax/swing/event/MenuKeyListener.java b/jdk/src/share/classes/javax/swing/event/MenuKeyListener.java
index 7caaf2a609f..3abcced7815 100644
--- a/jdk/src/share/classes/javax/swing/event/MenuKeyListener.java
+++ b/jdk/src/share/classes/javax/swing/event/MenuKeyListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -37,16 +37,22 @@ public interface MenuKeyListener extends EventListener {
     /**
      * Invoked when a key has been typed.
      * This event occurs when a key press is followed by a key release.
+     *
+     * @param e a {@code MenuKeyEvent}
      */
     void menuKeyTyped(MenuKeyEvent e);
 
     /**
      * Invoked when a key has been pressed.
+     *
+     * @param e a {@code MenuKeyEvent}
      */
     void menuKeyPressed(MenuKeyEvent e);
 
     /**
      * Invoked when a key has been released.
+     *
+     * @param e a {@code MenuKeyEvent}
      */
     void menuKeyReleased(MenuKeyEvent e);
 }
diff --git a/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java b/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java
index 0668371939f..4431dcc0642 100644
--- a/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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,7 @@ package javax.swing.event;
 import java.util.EventObject;
 
 /**
- * PopupMenuEvent only contains the source of the event which is the JPoupMenu
+ * PopupMenuEvent only contains the source of the event which is the JPopupMenu
  * sending the event
  * <p>
  * <strong>Warning:</strong>
diff --git a/jdk/src/share/classes/javax/swing/event/PopupMenuListener.java b/jdk/src/share/classes/javax/swing/event/PopupMenuListener.java
index 4f8b5223664..6f498733f27 100644
--- a/jdk/src/share/classes/javax/swing/event/PopupMenuListener.java
+++ b/jdk/src/share/classes/javax/swing/event/PopupMenuListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -35,17 +35,23 @@ public interface PopupMenuListener extends EventListener {
 
     /**
      *  This method is called before the popup menu becomes visible
+     *
+     * @param e a {@code PopupMenuEvent} containing the source of the event
      */
     void popupMenuWillBecomeVisible(PopupMenuEvent e);
 
     /**
      * This method is called before the popup menu becomes invisible
      * Note that a JPopupMenu can become invisible any time
+     *
+     * @param e a {@code PopupMenuEvent} containing the source of the event
      */
     void popupMenuWillBecomeInvisible(PopupMenuEvent e);
 
     /**
      * This method is called when the popup menu is canceled
+     *
+     * @param e a {@code PopupMenuEvent} containing the source of the event
      */
     void popupMenuCanceled(PopupMenuEvent e);
 }
diff --git a/jdk/src/share/classes/javax/swing/event/TableColumnModelEvent.java b/jdk/src/share/classes/javax/swing/event/TableColumnModelEvent.java
index 1958ded5e39..7293238671b 100644
--- a/jdk/src/share/classes/javax/swing/event/TableColumnModelEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/TableColumnModelEvent.java
@@ -83,9 +83,17 @@ public class TableColumnModelEvent extends java.util.EventObject
 // Querying Methods
 //
 
-    /** Returns the fromIndex.  Valid for removed or moved events */
+    /**
+     * Returns the fromIndex.  Valid for removed or moved events
+     *
+     * @return int value for index from which the column was moved or removed
+     */
     public int getFromIndex() { return fromIndex; };
 
-    /** Returns the toIndex.  Valid for add and moved events */
+    /**
+     * Returns the toIndex.  Valid for add and moved events
+     *
+     * @return int value of column's new index
+     */
     public int getToIndex() { return toIndex; };
 }
diff --git a/jdk/src/share/classes/javax/swing/event/TableColumnModelListener.java b/jdk/src/share/classes/javax/swing/event/TableColumnModelListener.java
index ccd6e5dd88d..deabfe7e8ba 100644
--- a/jdk/src/share/classes/javax/swing/event/TableColumnModelListener.java
+++ b/jdk/src/share/classes/javax/swing/event/TableColumnModelListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -39,21 +39,39 @@ import java.util.EventListener;
 
 public interface TableColumnModelListener extends java.util.EventListener
 {
-    /** Tells listeners that a column was added to the model. */
+    /**
+     * Tells listeners that a column was added to the model.
+     *
+     * @param e a {@code TableColumnModelEvent}
+     */
     public void columnAdded(TableColumnModelEvent e);
 
-    /** Tells listeners that a column was removed from the model. */
+    /**
+     * Tells listeners that a column was removed from the model.
+     *
+     * @param e a {@code TableColumnModelEvent}
+     */
     public void columnRemoved(TableColumnModelEvent e);
 
-    /** Tells listeners that a column was repositioned. */
+    /**
+     * Tells listeners that a column was repositioned.
+     *
+     * @param e a {@code TableColumnModelEvent}
+     */
     public void columnMoved(TableColumnModelEvent e);
 
-    /** Tells listeners that a column was moved due to a margin change. */
+    /**
+     * Tells listeners that a column was moved due to a margin change.
+     *
+     * @param e a {@code ChangeEvent}
+     */
     public void columnMarginChanged(ChangeEvent e);
 
     /**
      * Tells listeners that the selection model of the
      * TableColumnModel changed.
+     *
+     * @param e a {@code ListSelectionEvent}
      */
     public void columnSelectionChanged(ListSelectionEvent e);
 }
diff --git a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java
index 0247f992a4d..bf6555c4aac 100644
--- a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java
@@ -95,13 +95,15 @@ public class TableModelEvent extends java.util.EventObject
 //
 
     /**
-     *  All row data in the table has changed, listeners should discard any state
-     *  that was based on the rows and requery the <code>TableModel</code>
-     *  to get the new row count and all the appropriate values.
-     *  The <code>JTable</code> will repaint the entire visible region on
-     *  receiving this event, querying the model for the cell values that are visible.
-     *  The structure of the table ie, the column names, types and order
-     *  have not changed.
+     * All row data in the table has changed, listeners should discard any state
+     * that was based on the rows and requery the <code>TableModel</code>
+     * to get the new row count and all the appropriate values.
+     * The <code>JTable</code> will repaint the entire visible region on
+     * receiving this event, querying the model for the cell values that are visible.
+     * The structure of the table ie, the column names, types and order
+     * have not changed.
+     *
+     * @param source the {@code TableModel} affected by this event
      */
     public TableModelEvent(TableModel source) {
         // Use Integer.MAX_VALUE instead of getRowCount() in case rows were deleted.
@@ -109,21 +111,28 @@ public class TableModelEvent extends java.util.EventObject
     }
 
     /**
-     *  This row of data has been updated.
-     *  To denote the arrival of a completely new table with a different structure
-     *  use <code>HEADER_ROW</code> as the value for the <code>row</code>.
-     *  When the <code>JTable</code> receives this event and its
-     *  <code>autoCreateColumnsFromModel</code>
-     *  flag is set it discards any TableColumns that it had and reallocates
-     *  default ones in the order they appear in the model. This is the
-     *  same as calling <code>setModel(TableModel)</code> on the <code>JTable</code>.
+     * This row of data has been updated.
+     * To denote the arrival of a completely new table with a different structure
+     * use <code>HEADER_ROW</code> as the value for the <code>row</code>.
+     * When the <code>JTable</code> receives this event and its
+     * <code>autoCreateColumnsFromModel</code>
+     * flag is set it discards any TableColumns that it had and reallocates
+     * default ones in the order they appear in the model. This is the
+     * same as calling <code>setModel(TableModel)</code> on the <code>JTable</code>.
+     *
+     * @param source the {@code TableModel} affected by this event
+     * @param row the row which has been updated
      */
     public TableModelEvent(TableModel source, int row) {
         this(source, row, row, ALL_COLUMNS, UPDATE);
     }
 
     /**
-     *  The data in rows [<I>firstRow</I>, <I>lastRow</I>] have been updated.
+     * The data in rows [<I>firstRow</I>, <I>lastRow</I>] have been updated.
+     *
+     * @param source the {@code TableModel} affected by this event
+     * @param firstRow the first row affected by this event
+     * @param lastRow  the last row affected by this event
      */
     public TableModelEvent(TableModel source, int firstRow, int lastRow) {
         this(source, firstRow, lastRow, ALL_COLUMNS, UPDATE);
@@ -132,18 +141,32 @@ public class TableModelEvent extends java.util.EventObject
     /**
      *  The cells in column <I>column</I> in the range
      *  [<I>firstRow</I>, <I>lastRow</I>] have been updated.
+     *
+     * @param source the {@code TableModel} affected by this event
+     * @param firstRow the first row affected by this event
+     * @param lastRow  the last row affected by this event
+     * @param column the column index of cells changed; {@code ALL_COLUMNS}
+     *        signifies all cells in the specified range of rows are changed.
      */
     public TableModelEvent(TableModel source, int firstRow, int lastRow, int column) {
         this(source, firstRow, lastRow, column, UPDATE);
     }
 
     /**
-     *  The cells from (firstRow, column) to (lastRow, column) have been changed.
-     *  The <I>column</I> refers to the column index of the cell in the model's
-     *  co-ordinate system. When <I>column</I> is ALL_COLUMNS, all cells in the
-     *  specified range of rows are considered changed.
-     *  <p>
-     *  The <I>type</I> should be one of: INSERT, UPDATE and DELETE.
+     * The cells from (firstRow, column) to (lastRow, column) have been changed.
+     * The <I>column</I> refers to the column index of the cell in the model's
+     * co-ordinate system. When <I>column</I> is ALL_COLUMNS, all cells in the
+     * specified range of rows are considered changed.
+     * <p>
+     * The <I>type</I> should be one of: INSERT, UPDATE and DELETE.
+     *
+     * @param source the {@code TableModel} affected by this event
+     * @param firstRow the first row affected by this event
+     * @param lastRow  the last row affected by this event
+     * @param column the column index of cells changed; {@code ALL_COLUMNS}
+     *        signifies all cells in the specified range of rows are changed.
+     * @param type the type of change signified by this even, @code INSERT},
+     *        {@code DELETE } or {@code UPDATE}
      */
     public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type) {
         super(source);
@@ -157,23 +180,36 @@ public class TableModelEvent extends java.util.EventObject
 // Querying Methods
 //
 
-   /** Returns the first row that changed.  HEADER_ROW means the meta data,
+    /**
+     * Returns the first row that changed.  HEADER_ROW means the meta data,
      * ie. names, types and order of the columns.
+     *
+     * @return an integer signifying the first row changed
      */
     public int getFirstRow() { return firstRow; };
 
-    /** Returns the last row that changed. */
+    /**
+     * Returns the last row that changed.
+     *
+     * @return an integer signifying the last row changed
+     */
     public int getLastRow() { return lastRow; };
 
     /**
      *  Returns the column for the event.  If the return
      *  value is ALL_COLUMNS; it means every column in the specified
      *  rows changed.
+     *
+     * @return an integer signifying which column is affected by this event
      */
     public int getColumn() { return column; };
 
     /**
      *  Returns the type of event - one of: INSERT, UPDATE and DELETE.
+     *
+     * @return the type of change to a table model, an {@code INSERT} or
+     *         {@code DELETE } of row(s) or column(s) or {@code UPDATE}
+     *         to data
      */
     public int getType() { return type; }
 }
diff --git a/jdk/src/share/classes/javax/swing/event/TableModelListener.java b/jdk/src/share/classes/javax/swing/event/TableModelListener.java
index 9dce6700238..e32c2ef84f5 100644
--- a/jdk/src/share/classes/javax/swing/event/TableModelListener.java
+++ b/jdk/src/share/classes/javax/swing/event/TableModelListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -40,6 +40,9 @@ public interface TableModelListener extends java.util.EventListener
     /**
      * This fine grain notification tells listeners the exact range
      * of cells, rows, or columns that changed.
+     *
+     * @param e a {@code TableModelEvent} to notify listener that a table model
+     *          has changed
      */
     public void tableChanged(TableModelEvent e);
 }
diff --git a/jdk/src/share/classes/javax/swing/event/TreeExpansionEvent.java b/jdk/src/share/classes/javax/swing/event/TreeExpansionEvent.java
index 1e70200b2e7..7f8f37a1d5d 100644
--- a/jdk/src/share/classes/javax/swing/event/TreeExpansionEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/TreeExpansionEvent.java
@@ -54,7 +54,7 @@ public class TreeExpansionEvent extends EventObject
     /**
       * Path to the value this event represents.
       */
-    protected TreePath              path;
+    protected TreePath path;
 
     /**
      * Constructs a TreeExpansionEvent object.
@@ -71,6 +71,8 @@ public class TreeExpansionEvent extends EventObject
 
     /**
       * Returns the path to the value that has been expanded/collapsed.
+      *
+      * @return this event's {@code TreePath} object
       */
     public TreePath getPath() { return path; }
 }
diff --git a/jdk/src/share/classes/javax/swing/event/TreeExpansionListener.java b/jdk/src/share/classes/javax/swing/event/TreeExpansionListener.java
index 915dcf942f9..a71ac4045c0 100644
--- a/jdk/src/share/classes/javax/swing/event/TreeExpansionListener.java
+++ b/jdk/src/share/classes/javax/swing/event/TreeExpansionListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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,12 +41,18 @@ import java.util.EventListener;
 public interface TreeExpansionListener extends EventListener
 {
     /**
-      * Called whenever an item in the tree has been expanded.
-      */
+     * Called whenever an item in the tree has been expanded.
+     *
+     * @param event a {@code TreeExpansionEvent} containing a {@code TreePath}
+     *              object for the expanded node
+     */
     public void treeExpanded(TreeExpansionEvent event);
 
     /**
-      * Called whenever an item in the tree has been collapsed.
-      */
+     * Called whenever an item in the tree has been collapsed.
+     *
+     * @param event a {@code TreeExpansionEvent} containing a {@code TreePath}
+     *              object for the collapsed node
+     */
     public void treeCollapsed(TreeExpansionEvent event);
 }
diff --git a/jdk/src/share/classes/javax/swing/event/TreeModelListener.java b/jdk/src/share/classes/javax/swing/event/TreeModelListener.java
index d89c2a39ef0..22712810fda 100644
--- a/jdk/src/share/classes/javax/swing/event/TreeModelListener.java
+++ b/jdk/src/share/classes/javax/swing/event/TreeModelListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -46,25 +46,26 @@ public interface TreeModelListener extends EventListener {
      * altered their children arrays, but other attributes have
      * changed and may affect presentation. Example: the name of a
      * file has changed, but it is in the same location in the file
-     * system.</p>
+     * system.
+     *
      * <p>To indicate the root has changed, childIndices and children
-     * will be null. </p>
+     * will be null.
+     *
+     * <p>Use {@code e.getPath()} to get the parent of the changed node(s).
+     * {@code e.getChildIndices()} returns the index(es) of the changed node(s).
      *
-     * <p>Use <code>e.getPath()</code>
-     * to get the parent of the changed node(s).
-     * <code>e.getChildIndices()</code>
-     * returns the index(es) of the changed node(s).</p>
+     * @param e a {@code TreeModelEvent} describing changes to a tree model
      */
     void treeNodesChanged(TreeModelEvent e);
 
     /**
      * <p>Invoked after nodes have been inserted into the tree.</p>
      *
-     * <p>Use <code>e.getPath()</code>
-     * to get the parent of the new node(s).
-     * <code>e.getChildIndices()</code>
-     * returns the index(es) of the new node(s)
-     * in ascending order.</p>
+     * <p>Use {@code e.getPath()} to get the parent of the new node(s).
+     * {@code e.getChildIndices()} returns the index(es) of the new node(s)
+     * in ascending order.
+     *
+     * @param e a {@code TreeModelEvent} describing changes to a tree model
      */
     void treeNodesInserted(TreeModelEvent e);
 
@@ -74,11 +75,11 @@ public interface TreeModelListener extends EventListener {
      * invoked once for the root of the removed subtree, not once for
      * each individual set of siblings removed.</p>
      *
-     * <p>Use <code>e.getPath()</code>
-     * to get the former parent of the deleted node(s).
-     * <code>e.getChildIndices()</code>
-     * returns, in ascending order, the index(es)
-     * the node(s) had before being deleted.</p>
+     * <p>Use {@code e.getPath()} to get the former parent of the deleted
+     * node(s). {@code e.getChildIndices()} returns, in ascending order, the
+     * index(es) the node(s) had before being deleted.
+     *
+     * @param e a {@code TreeModelEvent} describing changes to a tree model
      */
     void treeNodesRemoved(TreeModelEvent e);
 
@@ -88,10 +89,10 @@ public interface TreeModelListener extends EventListener {
      * one and the first element does not identify the current root node
      * the first element should become the new root of the tree.
      *
-     * <p>Use <code>e.getPath()</code>
-     * to get the path to the node.
-     * <code>e.getChildIndices()</code>
-     * returns null.</p>
+     * <p>Use {@code e.getPath()} to get the path to the node.
+     * {@code e.getChildIndices()} returns null.
+     *
+     * @param e a {@code TreeModelEvent} describing changes to a tree model
      */
     void treeStructureChanged(TreeModelEvent e);
 
diff --git a/jdk/src/share/classes/javax/swing/event/TreeSelectionEvent.java b/jdk/src/share/classes/javax/swing/event/TreeSelectionEvent.java
index 792ce190509..32de1e9f517 100644
--- a/jdk/src/share/classes/javax/swing/event/TreeSelectionEvent.java
+++ b/jdk/src/share/classes/javax/swing/event/TreeSelectionEvent.java
@@ -62,12 +62,16 @@ public class TreeSelectionEvent extends EventObject
     protected TreePath        newLeadSelectionPath;
 
     /**
-      * Represents a change in the selection of a TreeSelectionModel.
-      * paths identifies the paths that have been either added or
+      * Represents a change in the selection of a {@code TreeSelectionModel}.
+      * {@code paths} identifies the paths that have been either added or
       * removed from the selection.
       *
       * @param source source of event
       * @param paths the paths that have changed in the selection
+      * @param areNew a {@code boolean} array indicating whether the paths in
+      *               {@code paths} are new to the selection
+      * @param oldLeadSelectionPath the previous lead selection path
+      * @param newLeadSelectionPath the new lead selection path
       */
     public TreeSelectionEvent(Object source, TreePath[] paths,
                               boolean[] areNew, TreePath oldLeadSelectionPath,
@@ -81,14 +85,16 @@ public class TreeSelectionEvent extends EventObject
     }
 
     /**
-      * Represents a change in the selection of a TreeSelectionModel.
-      * path identifies the path that have been either added or
+      * Represents a change in the selection of a {@code TreeSelectionModel}.
+      * {@code path} identifies the path that has been either added or
       * removed from the selection.
       *
       * @param source source of event
       * @param path the path that has changed in the selection
       * @param isNew whether or not the path is new to the selection, false
-      * means path was removed from the selection.
+      *              means path was removed from the selection.
+      * @param oldLeadSelectionPath the previous lead selection path
+      * @param newLeadSelectionPath the new lead selection path
       */
     public TreeSelectionEvent(Object source, TreePath path, boolean isNew,
                               TreePath oldLeadSelectionPath,
@@ -104,8 +110,9 @@ public class TreeSelectionEvent extends EventObject
     }
 
     /**
-      * Returns the paths that have been added or removed from the
-      * selection.
+      * Returns the paths that have been added or removed from the selection.
+      *
+      * @return copy of the array of {@code TreePath} obects for this event.
       */
     public TreePath[] getPaths()
     {
@@ -120,6 +127,8 @@ public class TreeSelectionEvent extends EventObject
 
     /**
       * Returns the first path element.
+      *
+      * @return the first {@code TreePath} element represented by this event
       */
     public TreePath getPath()
     {
@@ -187,6 +196,8 @@ public class TreeSelectionEvent extends EventObject
 
     /**
      * Returns the path that was previously the lead path.
+     *
+     * @return a {@code TreePath} containing the old lead selection path
      */
     public TreePath getOldLeadSelectionPath() {
         return oldLeadSelectionPath;
@@ -194,6 +205,8 @@ public class TreeSelectionEvent extends EventObject
 
     /**
      * Returns the current lead path.
+     *
+     * @return a {@code TreePath} containing the new lead selection path
      */
     public TreePath getNewLeadSelectionPath() {
         return newLeadSelectionPath;
@@ -201,10 +214,14 @@ public class TreeSelectionEvent extends EventObject
 
     /**
      * Returns a copy of the receiver, but with the source being newSource.
+     *
+     * @param newSource source of event
+     * @return an {@code Object} which is a copy of this event with the source
+     *         being the {@code newSource} provided
      */
     public Object cloneWithSource(Object newSource) {
       // Fix for IE bug - crashing
-      return new TreeSelectionEvent(newSource, paths,areNew,
+      return new TreeSelectionEvent(newSource, paths, areNew,
                                     oldLeadSelectionPath,
                                     newLeadSelectionPath);
     }
diff --git a/jdk/src/share/classes/javax/swing/event/TreeWillExpandListener.java b/jdk/src/share/classes/javax/swing/event/TreeWillExpandListener.java
index 6fd170c862a..ad5691220ef 100644
--- a/jdk/src/share/classes/javax/swing/event/TreeWillExpandListener.java
+++ b/jdk/src/share/classes/javax/swing/event/TreeWillExpandListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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,11 +41,19 @@ import javax.swing.tree.ExpandVetoException;
 public interface TreeWillExpandListener extends EventListener {
     /**
      * Invoked whenever a node in the tree is about to be expanded.
+     *
+     * @param event a {@code TreeExpansionEvent} containing a {@code TreePath}
+     *              object for the node
+     * @throws ExpandVetoException to signify expansion has been canceled
      */
     public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException;
 
     /**
      * Invoked whenever a node in the tree is about to be collapsed.
+     *
+     * @param event a {@code TreeExpansionEvent} containing a {@code TreePath}
+     *              object for the node
+     * @throws ExpandVetoException to signify collapse has been canceled
      */
     public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException;
 }
diff --git a/jdk/src/share/classes/javax/swing/event/UndoableEditListener.java b/jdk/src/share/classes/javax/swing/event/UndoableEditListener.java
index ba95d93b980..9db6991eb1b 100644
--- a/jdk/src/share/classes/javax/swing/event/UndoableEditListener.java
+++ b/jdk/src/share/classes/javax/swing/event/UndoableEditListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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,8 @@ public interface UndoableEditListener extends java.util.EventListener {
 
     /**
      * An undoable edit happened
+     *
+     * @param e an {@code UndoableEditEvent} object
      */
     void undoableEditHappened(UndoableEditEvent e);
 }
diff --git a/jdk/src/share/classes/javax/swing/tree/ExpandVetoException.java b/jdk/src/share/classes/javax/swing/tree/ExpandVetoException.java
index 9fd6addb446..b35214771a0 100644
--- a/jdk/src/share/classes/javax/swing/tree/ExpandVetoException.java
+++ b/jdk/src/share/classes/javax/swing/tree/ExpandVetoException.java
@@ -28,7 +28,7 @@ package javax.swing.tree;
 import javax.swing.event.TreeExpansionEvent;
 
 /**
- * Exception used to stop and expand/collapse from happening.
+ * Exception used to stop an expand/collapse from happening.
  * See <a
  href="http://docs.oracle.com/javase/tutorial/uiswing/events/treewillexpandlistener.html">How to Write a Tree-Will-Expand Listener</a>
  * in <em>The Java Tutorial</em>
-- 
GitLab


From 7aa808a993ed1d666d4abe759dc33376fcd95edb Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Mon, 23 Jun 2014 10:59:33 +0200
Subject: [PATCH 129/192] 8046905: apply on apply is broken

Reviewed-by: hannesw, lagergren
---
 .../internal/runtime/ScriptFunction.java      | 78 +++++++++++++++-
 .../internal/runtime/ScriptObject.java        | 28 +++---
 nashorn/test/script/basic/JDK-8046905.js      | 91 +++++++++++++++++++
 .../test/script/basic/JDK-8046905.js.EXPECTED | 41 +++++++++
 nashorn/test/script/basic/JDK-8047057.js      |  2 +-
 5 files changed, 224 insertions(+), 16 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8046905.js
 create mode 100644 nashorn/test/script/basic/JDK-8046905.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
index 0d2fcd00a75..ca98f4047b1 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
@@ -35,6 +35,7 @@ import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.SwitchPoint;
+import java.util.Collections;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
@@ -593,6 +594,12 @@ public abstract class ScriptFunction extends ScriptObject {
     private GuardedInvocation createApplyOrCallCall(final boolean isApply, final CallSiteDescriptor desc, final LinkRequest request, final Object[] args) {
         final MethodType descType = desc.getMethodType();
         final int paramCount = descType.parameterCount();
+        if(descType.parameterType(paramCount - 1).isArray()) {
+            // This is vararg invocation of apply or call. This can normally only happen when we do a recursive
+            // invocation of createApplyOrCallCall (because we're doing apply-of-apply). In this case, create delegate
+            // linkage by unpacking the vararg invocation and use pairArguments to introduce the necessary spreader.
+            return createVarArgApplyOrCallCall(isApply, desc, request, args);
+        }
 
         final boolean passesThis = paramCount > 2;
         final boolean passesArgs = paramCount > 3;
@@ -647,6 +654,7 @@ public abstract class ScriptFunction extends ScriptObject {
                     System.arraycopy(args, 3, tmp, 0, tmp.length);
                     appliedArgs[2] = NativeFunction.toApplyArgs(tmp);
                 } else {
+                    assert !isApply;
                     System.arraycopy(args, 3, appliedArgs, 2, args.length - 3);
                 }
             } else if (isFailedApplyToCall) {
@@ -705,8 +713,7 @@ public abstract class ScriptFunction extends ScriptObject {
         }
         final MethodType guardType = guard.type();
 
-        // Original function guard will expect the invoked function in parameter position 0, but we're passing it in
-        // position 1.
+        // We need to account for the dropped (apply|call) function argument.
         guard = MH.dropArguments(guard, 0, descType.parameterType(0));
         // Take the "isApplyFunction" guard, and bind it to this function.
         MethodHandle applyFnGuard = MH.insertArguments(IS_APPLY_FUNCTION, 2, this);
@@ -718,7 +725,72 @@ public abstract class ScriptFunction extends ScriptObject {
         return appliedInvocation.replaceMethods(inv, guard);
     }
 
-     private static MethodHandle bindImplicitThis(final Object fn, final MethodHandle mh) {
+    /*
+     * This method is used for linking nested apply. Specialized apply and call linking will create a variable arity
+     * call site for an apply call; when createApplyOrCallCall sees a linking request for apply or call with
+     * Nashorn-style variable arity call site (last argument type is Object[]) it'll delegate to this method.
+     * This method converts the link request from a vararg to a non-vararg one (unpacks the array), then delegates back
+     * to createApplyOrCallCall (with which it is thus mutually recursive), and adds appropriate argument spreaders to
+     * invocation and the guard of whatever createApplyOrCallCall returned to adapt it back into a variable arity
+     * invocation. It basically reduces the problem of vararg call site linking of apply and call back to the (already
+     * solved by createApplyOrCallCall) non-vararg call site linking.
+     */
+    private GuardedInvocation createVarArgApplyOrCallCall(final boolean isApply, final CallSiteDescriptor desc,
+            final LinkRequest request, final Object[] args) {
+        final MethodType descType = desc.getMethodType();
+        final int paramCount = descType.parameterCount();
+        final Object[] varArgs = (Object[])args[paramCount - 1];
+        // -1 'cause we're not passing the vararg array itself
+        final int copiedArgCount = args.length - 1;
+        int varArgCount = varArgs.length;
+
+        // Spread arguments for the delegate createApplyOrCallCall invocation.
+        final Object[] spreadArgs = new Object[copiedArgCount + varArgCount];
+        System.arraycopy(args, 0, spreadArgs, 0, copiedArgCount);
+        System.arraycopy(varArgs, 0, spreadArgs, copiedArgCount, varArgCount);
+
+        // Spread call site descriptor for the delegate createApplyOrCallCall invocation. We drop vararg array and
+        // replace it with a list of Object.class.
+        final MethodType spreadType = descType.dropParameterTypes(paramCount - 1, paramCount).appendParameterTypes(
+                Collections.<Class<?>>nCopies(varArgCount, Object.class));
+        final CallSiteDescriptor spreadDesc = desc.changeMethodType(spreadType);
+
+        // Delegate back to createApplyOrCallCall with the spread (that is, reverted to non-vararg) request/
+        final LinkRequest spreadRequest = request.replaceArguments(spreadDesc, spreadArgs);
+        final GuardedInvocation spreadInvocation = createApplyOrCallCall(isApply, spreadDesc, spreadRequest, spreadArgs);
+
+        // Add spreader combinators to returned invocation and guard.
+        return spreadInvocation.replaceMethods(
+                // Use standard ScriptObject.pairArguments on the invocation
+                pairArguments(spreadInvocation.getInvocation(), descType),
+                // Use our specialized spreadGuardArguments on the guard (see below).
+                spreadGuardArguments(spreadInvocation.getGuard(), descType));
+    }
+
+    private static MethodHandle spreadGuardArguments(final MethodHandle guard, final MethodType descType) {
+        final MethodType guardType = guard.type();
+        final int guardParamCount = guardType.parameterCount();
+        final int descParamCount = descType.parameterCount();
+        final int spreadCount = guardParamCount - descParamCount + 1;
+        if (spreadCount <= 0) {
+            // Guard doesn't dip into the varargs
+            return guard;
+        }
+
+        final MethodHandle arrayConvertingGuard;
+        // If the last parameter type of the guard is an array, then it is already itself a guard for a vararg apply
+        // invocation. We must filter the last argument with toApplyArgs otherwise deeper levels of nesting will fail
+        // with ClassCastException of NativeArray to Object[].
+        if(guardType.parameterType(guardParamCount - 1).isArray()) {
+            arrayConvertingGuard = MH.filterArguments(guard, guardParamCount - 1, NativeFunction.TO_APPLY_ARGS);
+        } else {
+            arrayConvertingGuard = guard;
+        }
+
+        return ScriptObject.adaptHandleToVarArgCallSite(arrayConvertingGuard, descParamCount);
+    }
+
+    private static MethodHandle bindImplicitThis(final Object fn, final MethodHandle mh) {
          final MethodHandle bound;
          if(fn instanceof ScriptFunction && ((ScriptFunction)fn).needsWrappedThis()) {
              bound = MH.filterArguments(mh, 1, SCRIPTFUNCTION_GLOBALFILTER);
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
index 1e095d45905..90003b38f67 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -2499,18 +2499,7 @@ public abstract class ScriptObject implements PropertyAccess {
         }
 
         if (isCallerVarArg) {
-            final int spreadArgs = parameterCount - callCount + 1;
-            return MH.filterArguments(
-                MH.asSpreader(
-                    methodHandle,
-                    Object[].class,
-                    spreadArgs),
-                callCount - 1,
-                MH.insertArguments(
-                    TRUNCATINGFILTER,
-                    0,
-                    spreadArgs)
-                );
+            return adaptHandleToVarArgCallSite(methodHandle, callCount);
         }
 
         if (callCount < parameterCount) {
@@ -2541,6 +2530,21 @@ public abstract class ScriptObject implements PropertyAccess {
         return methodHandle;
     }
 
+    static MethodHandle adaptHandleToVarArgCallSite(final MethodHandle mh, final int callSiteParamCount) {
+        final int spreadArgs = mh.type().parameterCount() - callSiteParamCount + 1;
+        return MH.filterArguments(
+            MH.asSpreader(
+            mh,
+            Object[].class,
+            spreadArgs),
+            callSiteParamCount - 1,
+            MH.insertArguments(
+                TRUNCATINGFILTER,
+                0,
+                spreadArgs)
+            );
+    }
+
     @SuppressWarnings("unused")
     private static Object[] truncatingFilter(final int n, final Object[] array) {
         final int length = array == null ? 0 : array.length;
diff --git a/nashorn/test/script/basic/JDK-8046905.js b/nashorn/test/script/basic/JDK-8046905.js
new file mode 100644
index 00000000000..231e2a1d803
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8046905.js
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8046905: apply on apply is broken
+ *
+ * @test
+ * @run
+ */
+
+var apply = Function.prototype.apply;
+var call = Function.prototype.call;
+var sort = Array.prototype.sort;
+var join = Array.prototype.join;
+
+// Running three times so that we test an already linked call site too:
+// i==0: linking initially with assumed optimistic returned type int.
+// i==1: linking after deoptimization with returned type Object.
+// i==2: re-running code linked in previous iteration. This will 
+//       properly exercise the guards too.
+print("1 level of apply")
+for(i = 0; i < 3; ++i) {
+    print(sort.apply([4,3,2,1]))
+}
+print("2 levels of apply")
+for(i = 0; i < 3; ++i) {
+    print(apply.apply(sort,[[4,3,2,1]]))
+}
+print("3 levels of apply")
+for(i = 0; i < 3; ++i) {
+    print(apply.apply(apply,[sort,[[4,3,2,1]]]))
+}
+print("4 levels of apply")
+for(i = 0; i < 3; ++i) {
+    print(apply.apply(apply,[apply,[sort,[[4,3,2,1]]]]))
+}
+print("5 levels of apply")
+for(i = 0; i < 3; ++i) {
+    print(apply.apply(apply,[apply,[apply,[sort,[[4,3,2,1]]]]]))
+}
+print("Many levels of apply!")
+for(i = 0; i < 3; ++i) {
+    print(apply.apply(apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[apply,[sort,[[4,3,2,1]]]]]]]]]]]]]]]]]]]]]]))
+}
+
+print("different invocations that'll trigger relinking")
+var invocation = [sort,[[4,3,2,1]]];
+for(i = 0; i < 4; ++i) {
+    print(apply.apply(apply,[apply,invocation]))
+    // First change after i==1, so it relinks an otherwise stable linkage
+    if(i == 1) {
+	invocation = [sort,[[8,7,6,5]]];
+    } else if(i == 2) {
+        invocation = [join,[[8,7,6,5],["-"]]];
+    }
+}
+
+print("Many levels of call!")
+for(i = 0; i < 3; ++i) {
+    print(call.call(call,call,call,call,call,call,call,call,call,call,call,call,call,call,call,call,call,call,call,call,sort,[4,3,2,1]))
+}
+
+print("call apply call apply call... a lot");
+for(i = 0; i < 3; ++i) {
+    print(apply.call(call, apply, [call, apply, [call, apply, [call, apply, [call, apply, [call, apply, [sort, [4,3,2,1]]]]]]]))
+}
+
+print("apply call apply call apply... a lot");
+for(i = 0; i < 3; ++i) {
+    print(call.apply(apply, [call, apply, [call, apply, [call, apply, [call, apply, [call, apply, [call, apply, [call, sort, [[4,3,2,1]]]]]]]]]))
+}
diff --git a/nashorn/test/script/basic/JDK-8046905.js.EXPECTED b/nashorn/test/script/basic/JDK-8046905.js.EXPECTED
new file mode 100644
index 00000000000..0cee6789f61
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8046905.js.EXPECTED
@@ -0,0 +1,41 @@
+1 level of apply
+1,2,3,4
+1,2,3,4
+1,2,3,4
+2 levels of apply
+1,2,3,4
+1,2,3,4
+1,2,3,4
+3 levels of apply
+1,2,3,4
+1,2,3,4
+1,2,3,4
+4 levels of apply
+1,2,3,4
+1,2,3,4
+1,2,3,4
+5 levels of apply
+1,2,3,4
+1,2,3,4
+1,2,3,4
+Many levels of apply!
+1,2,3,4
+1,2,3,4
+1,2,3,4
+different invocations that'll trigger relinking
+1,2,3,4
+1,2,3,4
+5,6,7,8
+8-7-6-5
+Many levels of call!
+1,2,3,4
+1,2,3,4
+1,2,3,4
+call apply call apply call... a lot
+1,2,3,4
+1,2,3,4
+1,2,3,4
+apply call apply call apply... a lot
+1,2,3,4
+1,2,3,4
+1,2,3,4
diff --git a/nashorn/test/script/basic/JDK-8047057.js b/nashorn/test/script/basic/JDK-8047057.js
index 3ce588bfe6f..84183f19059 100644
--- a/nashorn/test/script/basic/JDK-8047057.js
+++ b/nashorn/test/script/basic/JDK-8047057.js
@@ -67,7 +67,7 @@ makeFuncExpectError("eval(\"x4\", x3);", ReferenceError);
 makeFuncAndCall("with({5.0000000000000000000000: String()}){(false); }");
 makeFuncAndCall("try { var x = undefined, x = 5.0000000000000000000000; } catch(x) { x = undefined; }");
 makeFuncAndCall("(function (x){ x %= this}(false))");
-// makeFuncAndCall("eval.apply.apply(function(){ eval('') })");
+makeFuncAndCall("eval.apply.apply(function(){ eval('') })");
 makeFuncAndCall("(false % !this) && 0");
 makeFuncAndCall("with({8: 'fafafa'.replace()}){ }");
 makeFuncAndCall("(function (x) '' )(true)");
-- 
GitLab


From 578fc51475948e2b868838f2c70eedcfde51c003 Mon Sep 17 00:00:00 2001
From: Staffan Larsen <sla@openjdk.org>
Date: Mon, 23 Jun 2014 15:51:41 +0200
Subject: [PATCH 130/192] 8044772: TempDirTest.java still times out with -Xcomp

Reviewed-by: dholmes
---
 jdk/test/ProblemList.txt                       |  3 ---
 jdk/test/com/sun/tools/attach/RunnerUtil.java  |  7 +++++++
 jdk/test/com/sun/tools/attach/TempDirTest.java | 18 +++++++++++++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 76b82763472..a8d232a71a2 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -298,7 +298,4 @@ sun/tools/jstatd/TestJstatdServer.java                          generic-all
 # 8046355
 sun/tools/jstatd/TestJstatdExternalRegistry.java                generic-all
 
-# 8046352
-com/sun/tools/attach/TempDirTest.java                           generic-all
-
 ############################################################################
diff --git a/jdk/test/com/sun/tools/attach/RunnerUtil.java b/jdk/test/com/sun/tools/attach/RunnerUtil.java
index 3555a299a31..0fd27894170 100644
--- a/jdk/test/com/sun/tools/attach/RunnerUtil.java
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java
@@ -139,12 +139,19 @@ public class RunnerUtil {
         String content = null;
 
         // Read file or wait for it to be created.
+        long startTime = System.currentTimeMillis();
+        long lastWarningTime = 0;
         while (true) {
             content = readFile(file);
             if (content != null && content.indexOf("done") >= 0) {
                 break;
             }
             Thread.sleep(100);
+            long elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
+            if (elapsedTime > lastWarningTime) {
+                lastWarningTime = elapsedTime;
+                System.out.println("Waited " + elapsedTime + " seconds for file.");
+            }
         }
 
         ProcessInfo info = new ProcessInfo();
diff --git a/jdk/test/com/sun/tools/attach/TempDirTest.java b/jdk/test/com/sun/tools/attach/TempDirTest.java
index 9f0beb698e2..ee240018175 100644
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java
@@ -39,13 +39,22 @@ import jdk.testlibrary.ProcessThread;
  * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
  * @library /lib/testlibrary
  * @run build jdk.testlibrary.* Application Shutdown RunnerUtil
- * @run main TempDirTest
+ * @run main/timeout=200 TempDirTest
+ */
+
+/*
+ * This test runs with an extra long timeout since it takes a really long time with -Xcomp
+ * when starting many processes.
  */
 
 public class TempDirTest {
 
+    private static long startTime;
+
     public static void main(String args[]) throws Throwable {
 
+        startTime = System.currentTimeMillis();
+
         Path clientTmpDir = Files.createTempDirectory("TempDirTest-client");
         clientTmpDir.toFile().deleteOnExit();
         Path targetTmpDir = Files.createTempDirectory("TempDirTest-target");
@@ -76,6 +85,9 @@ public class TempDirTest {
         System.out.print(" target: " + (targetTmpDir == null ? "no" : "yes"));
         System.out.println(" ###");
 
+        long elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
+        System.out.println("Started after " + elapsedTime + "s");
+
         final String pidFile = "TempDirTest.Application.pid-" + counter++;
         ProcessThread processThread = null;
         RunnerUtil.ProcessInfo info = null;
@@ -95,6 +107,10 @@ public class TempDirTest {
             // Make sure the Application process is stopped.
             RunnerUtil.stopApplication(info.shutdownPort, processThread);
         }
+
+        elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
+        System.out.println("Completed after " + elapsedTime + "s");
+
     }
 
     /**
-- 
GitLab


From 50aff94d038e24f6f2789e440384ed677214be59 Mon Sep 17 00:00:00 2001
From: Alexander Zuev <kizune@openjdk.org>
Date: Mon, 23 Jun 2014 18:09:35 +0400
Subject: [PATCH 131/192] 8046337: Test
 closed/tools/pack200/MemoryAllocatorTest.java fails on windows-i586

Reviewed-by: ksrini
---
 jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
index a6e511c5447..8dc2634987f 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
@@ -435,7 +435,7 @@ uLong jar::get_dostime(int modtime) {
   struct tm* s = gmtime_r(&t, &sbuf);
   if (s == NULL) {
     fprintf(u->errstrm, "Error: gmtime failure, invalid input archive\n");
-    exit(2);
+    exit(-1);
   }
   modtime_cache = modtime;
   dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,
-- 
GitLab


From 90b667d86525815976d58be88ea5e0fa74cacac5 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Mon, 23 Jun 2014 21:23:53 +0530
Subject: [PATCH 132/192] 8047728: (function(x){var o={x:0}; with(o){delete x}
 return o.x})() evaluates to 0 instead of undefined

Reviewed-by: jlaskey, hannesw, attila
---
 nashorn/bin/jjsdebug.sh                       | 25 +++++++++
 nashorn/make/nbproject/ide-targets.xml        |  2 +-
 .../internal/codegen/AssignSymbols.java       |  2 +-
 .../codegen/LocalVariableTypesCalculator.java |  6 ++-
 nashorn/test/script/basic/JDK-8047728.js      | 54 +++++++++++++++++++
 5 files changed, 86 insertions(+), 3 deletions(-)
 create mode 100644 nashorn/bin/jjsdebug.sh
 create mode 100644 nashorn/test/script/basic/JDK-8047728.js

diff --git a/nashorn/bin/jjsdebug.sh b/nashorn/bin/jjsdebug.sh
new file mode 100644
index 00000000000..509700c39bf
--- /dev/null
+++ b/nashorn/bin/jjsdebug.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (c) 2014, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+$JAVA_HOME/bin/jjs -J-Djava.ext.dirs=`dirname $0`/../dist -J-agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=y $*
diff --git a/nashorn/make/nbproject/ide-targets.xml b/nashorn/make/nbproject/ide-targets.xml
index a592cff6a07..d1e8135f101 100644
--- a/nashorn/make/nbproject/ide-targets.xml
+++ b/nashorn/make/nbproject/ide-targets.xml
@@ -34,7 +34,7 @@
 	    <jvmarg line="-Dnashorn.optimistic"/>
             <jvmarg line="${ext.class.path}"/> 
             <jvmarg line="${run.test.jvmargs}"/>
-            <arg value="../make/str.js"/>
+            <arg value="../samples/test.js"/>
             <jvmarg value="-Xdebug"/>
             <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
         </java>
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java b/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java
index 4a817fae3db..65e65c785a1 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java
@@ -702,7 +702,7 @@ final class AssignSymbols extends NodeOperatorVisitor<LexicalContext> implements
             // If this is a declared variable or a function parameter, delete always fails (except for globals).
             final String name = ident.getName();
             final Symbol symbol = ident.getSymbol();
-            final boolean failDelete = strictMode || symbol.isParam() || (symbol.isVar() && !symbol.isProgramLevel());
+            final boolean failDelete = strictMode || (!symbol.isScope() && (symbol.isParam() || (symbol.isVar() && !symbol.isProgramLevel())));
 
             if (failDelete && symbol.isThis()) {
                 return LiteralNode.newInstance(unaryNode, true).accept(this);
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 7112a53eb76..5ffe4b7f66b 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -583,7 +583,11 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
             }
         }
         setCompilerConstantAsObject(functionNode, CompilerConstants.THIS);
-        if(functionNode.needsParentScope()) {
+
+        // NOTE: coarse-grained. If we wanted to solve it completely precisely,
+        // we'd also need to push/pop its type when handling WithNode (so that
+        // it can go back to undefined after a 'with' block.
+        if(functionNode.hasScopeBlock() || functionNode.needsParentScope()) {
             setCompilerConstantAsObject(functionNode, CompilerConstants.SCOPE);
         }
         if(functionNode.needsCallee()) {
diff --git a/nashorn/test/script/basic/JDK-8047728.js b/nashorn/test/script/basic/JDK-8047728.js
new file mode 100644
index 00000000000..ba36ccd5058
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047728.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047728: (function(x){var o={x:0}; with(o){delete x} return o.x})() evaluates to 0 instead of undefined
+ *
+ * @test
+ * @run
+ */
+
+function func(x) {
+    var o = {x:0}; 
+    with(o){
+       delete x;
+    }
+    return o.x
+}
+
+if (typeof func() != 'undefined') {
+    fail("expected undefined from 'func' call");
+}
+
+function func2() {
+    var x;
+    var o = {x:0}; 
+    with(o){
+       delete x;
+    }
+    return o.x
+}
+
+if (typeof func2() != 'undefined') {
+    fail("expected undefined from 'func2' call");
+}
-- 
GitLab


From 3ad3dd1d894c690a425e04c2499ecb6618e2c625 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Mon, 23 Jun 2014 18:32:11 +0200
Subject: [PATCH 133/192] 8046201: Avoid repeated flattening of nested
 ConsStrings

Reviewed-by: lagergren, attila
---
 .../nashorn/internal/runtime/ConsString.java  |  43 ++++--
 .../internal/runtime/ConsStringTest.java      | 135 ++++++++++++++++++
 2 files changed, 166 insertions(+), 12 deletions(-)
 create mode 100644 nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java

diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java b/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java
index 8f764f4bdda..41e2c49e938 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java
@@ -36,8 +36,12 @@ import java.util.Deque;
 public final class ConsString implements CharSequence {
 
     private CharSequence left, right;
-    final private int length;
-    private boolean flat = false;
+    private final int length;
+    private volatile int state = STATE_NEW;
+
+    private final static int STATE_NEW       =  0;
+    private final static int STATE_THRESHOLD =  2;
+    private final static int STATE_FLATTENED = -1;
 
     /**
      * Constructor
@@ -57,7 +61,7 @@ public final class ConsString implements CharSequence {
 
     @Override
     public String toString() {
-        return (String) flattened();
+        return (String) flattened(true);
     }
 
     @Override
@@ -67,22 +71,31 @@ public final class ConsString implements CharSequence {
 
     @Override
     public char charAt(final int index) {
-        return flattened().charAt(index);
+        return flattened(true).charAt(index);
     }
 
     @Override
     public CharSequence subSequence(final int start, final int end) {
-        return flattened().subSequence(start, end);
+        return flattened(true).subSequence(start, end);
+    }
+
+    /**
+     * Returns the components of this ConsString as a {@code CharSequence} array with two elements.
+     * The elements will be either {@code Strings} or other {@code ConsStrings}.
+     * @return CharSequence array of length 2
+     */
+    public synchronized CharSequence[] getComponents() {
+        return new CharSequence[] { left, right };
     }
 
-    private CharSequence flattened() {
-        if (!flat) {
-            flatten();
+    private CharSequence flattened(boolean flattenNested) {
+        if (state != STATE_FLATTENED) {
+            flatten(flattenNested);
         }
         return left;
     }
 
-    private void flatten() {
+    private synchronized void flatten(boolean flattenNested) {
         // We use iterative traversal as recursion may exceed the stack size limit.
         final char[] chars = new char[length];
         int pos = length;
@@ -97,8 +110,14 @@ public final class ConsString implements CharSequence {
         do {
             if (cs instanceof ConsString) {
                 final ConsString cons = (ConsString) cs;
-                stack.addFirst(cons.left);
-                cs = cons.right;
+                // Count the times a cons-string is traversed as part of other cons-strings being flattened.
+                // If it crosses a threshold we flatten the nested cons-string internally.
+                if (cons.state == STATE_FLATTENED || (flattenNested && ++cons.state >= STATE_THRESHOLD)) {
+                    cs = cons.flattened(false);
+                } else {
+                    stack.addFirst(cons.left);
+                    cs = cons.right;
+                }
             } else {
                 final String str = (String) cs;
                 pos -= str.length();
@@ -109,7 +128,7 @@ public final class ConsString implements CharSequence {
 
         left = new String(chars);
         right = "";
-        flat = true;
+        state = STATE_FLATTENED;
     }
 
 }
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java
new file mode 100644
index 00000000000..9a10ab6d042
--- /dev/null
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for JSType methods.
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.ConsStringTest
+ */
+public class ConsStringTest {
+
+    /**
+     * Test toString conversion
+     */
+    @Test
+    public void testConsStringToString() {
+        final ConsString cs1 = new ConsString("b", "c");
+        final ConsString cs2 = new ConsString("d", "e");
+        final ConsString cs3 = new ConsString(cs1, cs2);
+        final ConsString cs4 = new ConsString(cs3, "f");
+        final ConsString cs5 = new ConsString("a", cs4);
+        assertEquals(cs5.toString(), "abcdef");
+        assertEquals(cs4.toString(), "bcdef");
+        assertEquals(cs3.toString(), "bcde");
+        assertEquals(cs2.toString(), "de");
+        assertEquals(cs1.toString(), "bc");
+        // ConsStrings should be flattened now
+        assertEquals(cs1.getComponents()[0], "bc");
+        assertEquals(cs1.getComponents()[1], "");
+        assertEquals(cs2.getComponents()[0], "de");
+        assertEquals(cs2.getComponents()[1], "");
+        assertEquals(cs3.getComponents()[0], "bcde");
+        assertEquals(cs3.getComponents()[1], "");
+        assertEquals(cs4.getComponents()[0], "bcdef");
+        assertEquals(cs4.getComponents()[1], "");
+        assertEquals(cs5.getComponents()[0], "abcdef");
+        assertEquals(cs5.getComponents()[1], "");
+    }
+
+    /**
+     * Test charAt
+     */
+    @Test
+    public void testConsStringCharAt() {
+        final ConsString cs1 = new ConsString("b", "c");
+        final ConsString cs2 = new ConsString("d", "e");
+        final ConsString cs3 = new ConsString(cs1, cs2);
+        final ConsString cs4 = new ConsString(cs3, "f");
+        final ConsString cs5 = new ConsString("a", cs4);
+        assertEquals(cs1.charAt(1), 'c');
+        assertEquals(cs2.charAt(0), 'd');
+        assertEquals(cs3.charAt(3), 'e');
+        assertEquals(cs4.charAt(1), 'c');
+        assertEquals(cs5.charAt(2), 'c');
+        // ConsStrings should be flattened now
+        assertEquals(cs1.getComponents()[0], "bc");
+        assertEquals(cs1.getComponents()[1], "");
+        assertEquals(cs2.getComponents()[0], "de");
+        assertEquals(cs2.getComponents()[1], "");
+        assertEquals(cs3.getComponents()[0], "bcde");
+        assertEquals(cs3.getComponents()[1], "");
+        assertEquals(cs4.getComponents()[0], "bcdef");
+        assertEquals(cs4.getComponents()[1], "");
+        assertEquals(cs5.getComponents()[0], "abcdef");
+        assertEquals(cs5.getComponents()[1], "");
+    }
+
+
+    /**
+     * Test flattening of top-level and internal ConsStrings
+     */
+    @Test
+    public void testConsStringFlattening() {
+        final ConsString cs1 = new ConsString("b", "c");
+        final ConsString cs2 = new ConsString("d", "e");
+        final ConsString cs3 = new ConsString(cs1, cs2);
+        final ConsString cs4 = new ConsString(cs3, "f");
+
+        final ConsString cs5 = new ConsString("a", cs4);
+        // top-level ConsString should not yet be flattened
+        assert(cs5.getComponents()[0] == "a");
+        assert(cs5.getComponents()[1] == cs4);
+        assertEquals(cs5.toString(), "abcdef");
+        // top-level ConsString should be flattened
+        assertEquals(cs5.getComponents()[0], "abcdef");
+        assertEquals(cs5.getComponents()[1], "");
+        // internal ConsString should not yet be flattened after first traversal
+        assertEquals(cs4.getComponents()[0], cs3);
+        assertEquals(cs4.getComponents()[1], "f");
+
+        final ConsString cs6 = new ConsString("a", cs4);
+        // top-level ConsString should not yet be flattened
+        assertEquals(cs6.getComponents()[0], "a");
+        assertEquals(cs6.getComponents()[1], cs4);
+        assertEquals(cs6.toString(), "abcdef");
+        // top-level ConsString should be flattened
+        assertEquals(cs6.getComponents()[0], "abcdef");
+        assertEquals(cs6.getComponents()[1], "");
+        // internal ConsString should have been flattened after second traversal
+        assertEquals(cs4.getComponents()[0], "bcdef");
+        assertEquals(cs4.getComponents()[1], "");
+    }
+}
-- 
GitLab


From 61ad72b44a1a4d8fc5ad53790e67037f9d5e3750 Mon Sep 17 00:00:00 2001
From: Joe Wang <joehw@openjdk.org>
Date: Mon, 23 Jun 2014 10:40:20 -0700
Subject: [PATCH 134/192] 5077522: Duration.compare incorrect for some values

Reviewed-by: lancea, dfuchs
---
 .../datatype/5077522/DurationComparison.java  | 200 ++++++++++++++++++
 1 file changed, 200 insertions(+)
 create mode 100644 jdk/test/javax/xml/jaxp/datatype/5077522/DurationComparison.java

diff --git a/jdk/test/javax/xml/jaxp/datatype/5077522/DurationComparison.java b/jdk/test/javax/xml/jaxp/datatype/5077522/DurationComparison.java
new file mode 100644
index 00000000000..0eac2de0122
--- /dev/null
+++ b/jdk/test/javax/xml/jaxp/datatype/5077522/DurationComparison.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 5077522
+ * @summary test INDETERMINATE relations
+ * @run main DurationComparison
+ */
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeConstants;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+
+/**
+ *
+ * This is a JCK failure. The implementation fails with a list of
+ * INDETERMINATE comparisons
+ *
+ *
+ * @author Joe Wang <huizhe.wang@oracle.com>
+ */
+public class DurationComparison {
+    static String errMsg;
+    int passed = 0, failed = 0;
+
+    public static void main(String[] args) {
+        DurationComparison test = new DurationComparison();
+        test.testCompareWithInderterminateRelation();
+        test.testVerifyOtherRelations();
+        test.tearDown();
+    }
+
+    /**
+     * See JDK-5077522, Duration.compare returns equal for INDETERMINATE
+     * comparisons
+     */
+    public void testCompareWithInderterminateRelation() {
+
+        final String [][] partialOrder = { // partialOrder
+           {"P1Y", "<>", "P365D"},
+           {"P1Y", "<>", "P366D"},
+           {"P1M", "<>", "P28D"},
+           {"P1M", "<>", "P29D"},
+           {"P1M", "<>", "P30D"},
+           {"P1M", "<>", "P31D"},
+           {"P5M", "<>", "P150D"},
+           {"P5M", "<>", "P151D"},
+           {"P5M", "<>", "P152D"},
+           {"P5M", "<>", "P153D"},
+           {"PT2419200S", "<>", "P1M"},
+           {"PT2678400S", "<>", "P1M"},
+           {"PT31536000S", "<>", "P1Y"},
+           {"PT31622400S", "<>", "P1Y"},
+           {"PT525600M", "<>", "P1Y"},
+           {"PT527040M", "<>", "P1Y"},
+           {"PT8760H", "<>", "P1Y"},
+           {"PT8784H", "<>", "P1Y"},
+           {"P365D", "<>", "P1Y"},
+        };
+
+        DatatypeFactory df = null;
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException ex) {
+            ex.printStackTrace();
+            fail(ex.toString());
+        }
+
+        for (int valueIndex = 0; valueIndex < partialOrder.length; ++valueIndex) {
+            Duration duration1 = df.newDuration(partialOrder[valueIndex][0]);
+            Duration duration2 = df.newDuration(partialOrder[valueIndex][2]);
+            int cmp = duration1.compare(duration2);
+            int expected = ">".equals(partialOrder[valueIndex][1])
+                     ? DatatypeConstants.GREATER
+                     : "<".equals(partialOrder[valueIndex][1])
+                     ? DatatypeConstants.LESSER
+                     : "==".equals(partialOrder[valueIndex][1])
+                     ? DatatypeConstants.EQUAL
+                     : DatatypeConstants.INDETERMINATE;
+
+            if (expected != cmp) {
+                fail("returned " + cmp2str(cmp)
+                    + " for durations \'" + duration1 + "\' and "
+                    + duration2 + "\', but expected " + cmp2str(expected));
+            } else {
+                success("Comparing " + duration1 + " and " + duration2 +
+                        ": INDETERMINATE");
+            }
+        }
+    }
+
+    /**
+     * Verify cases around the INDETERMINATE relations
+     */
+    public void testVerifyOtherRelations() {
+
+        final String [][] partialOrder = { // partialOrder
+           {"P1Y", ">", "P364D"},
+           {"P1Y", "<", "P367D"},
+           {"P1Y2D", ">", "P366D"},
+           {"P1M", ">", "P27D"},
+           {"P1M", "<", "P32D"},
+           {"P1M", "<", "P31DT1H"},
+           {"P5M", ">", "P149D"},
+           {"P5M", "<", "P154D"},
+           {"P5M", "<", "P153DT1H"},
+           {"PT2419199S", "<", "P1M"},  //PT2419200S -> P28D
+           {"PT2678401S", ">", "P1M"},  //PT2678400S -> P31D
+           {"PT31535999S", "<", "P1Y"}, //PT31536000S -> P365D
+           {"PT31622401S", ">", "P1Y"}, //PT31622400S -> P366D
+           {"PT525599M59S", "<", "P1Y"},  //PT525600M -> P365D
+           {"PT527040M1S", ">", "P1Y"},  //PT527040M -> P366D
+           {"PT8759H59M59S", "<", "P1Y"},    //PT8760H -> P365D
+           {"PT8784H1S", ">", "P1Y"},    //PT8784H -> P366D
+        };
+
+        DatatypeFactory df = null;
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException ex) {
+            ex.printStackTrace();
+            fail(ex.toString());
+        }
+
+        for (int valueIndex = 0; valueIndex < partialOrder.length; ++valueIndex) {
+            Duration duration1 = df.newDuration(partialOrder[valueIndex][0]);
+            Duration duration2 = df.newDuration(partialOrder[valueIndex][2]);
+            int cmp = duration1.compare(duration2);
+            int expected = ">".equals(partialOrder[valueIndex][1])
+                     ? DatatypeConstants.GREATER
+                     : "<".equals(partialOrder[valueIndex][1])
+                     ? DatatypeConstants.LESSER
+                     : "==".equals(partialOrder[valueIndex][1])
+                     ? DatatypeConstants.EQUAL
+                     : DatatypeConstants.INDETERMINATE;
+
+            if (expected != cmp) {
+                fail("returned " + cmp2str(cmp)
+                    + " for durations \'" + duration1 + "\' and "
+                    + duration2 + "\', but expected " + cmp2str(expected));
+            } else {
+                success("Comparing " + duration1 + " and " + duration2 +
+                        ": expected: " + cmp2str(expected) +
+                        " actual: " + cmp2str(cmp));
+            }
+        }
+    }
+    public static String cmp2str(int cmp) {
+        return cmp == DatatypeConstants.LESSER ? "LESSER"
+             : cmp == DatatypeConstants.GREATER ? "GREATER"
+             : cmp == DatatypeConstants.EQUAL ? "EQUAL"
+             : cmp == DatatypeConstants.INDETERMINATE ? "INDETERMINATE"
+             : "UNDEFINED";
+    }
+
+    public void tearDown() {
+
+        System.out.println("\nNumber of tests passed: " + passed);
+        System.out.println("Number of tests failed: " + failed + "\n");
+
+        if (errMsg != null ) {
+            throw new RuntimeException(errMsg);
+        }
+    }
+    void fail(String msg) {
+        if (errMsg == null) {
+            errMsg = msg;
+        } else {
+            errMsg = errMsg + "\n" + msg;
+        }
+        failed++;
+    }
+
+    void success(String msg) {
+        passed++;
+        System.out.println(msg);
+    }
+
+}
-- 
GitLab


From 22b836a06a8321f2ac7ab8e805ff4d441ec605a5 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Mon, 23 Jun 2014 22:15:09 +0400
Subject: [PATCH 135/192] 8047798: Remove EventQueueDelegate

Reviewed-by: anthony, art
---
 .../com/sun/java/swing/SwingUtilities3.java   |  86 ----------
 .../classes/java/awt/EventDispatchThread.java |  16 +-
 .../classes/sun/awt/EventQueueDelegate.java   |  71 --------
 .../awt/EventQueue/6638195/bug6638195.java    | 160 ------------------
 4 files changed, 1 insertion(+), 332 deletions(-)
 delete mode 100644 jdk/src/share/classes/sun/awt/EventQueueDelegate.java
 delete mode 100644 jdk/test/java/awt/EventQueue/6638195/bug6638195.java

diff --git a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
index b50fb2ae1b2..6b2891aa517 100644
--- a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
+++ b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
@@ -25,17 +25,13 @@
 
 package com.sun.java.swing;
 
-import sun.awt.EventQueueDelegate;
 import sun.awt.AppContext;
 import sun.awt.SunToolkit;
 
 import java.util.Collections;
 import java.util.Map;
 import java.util.WeakHashMap;
-import java.util.concurrent.Callable;
 import java.applet.Applet;
-import java.awt.AWTEvent;
-import java.awt.EventQueue;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Window;
@@ -137,86 +133,4 @@ public class SwingUtilities3 {
         }
         return delegate;
     }
-
-    /*
-     * We use maps to avoid reflection. Hopefully it should perform better
-     * this way.
-     */
-    public static void setEventQueueDelegate(
-            Map<String, Map<String, Object>> map) {
-        EventQueueDelegate.setDelegate(new EventQueueDelegateFromMap(map));
-    }
-
-    private static class EventQueueDelegateFromMap
-    implements EventQueueDelegate.Delegate {
-        private final AWTEvent[] afterDispatchEventArgument;
-        private final Object[] afterDispatchHandleArgument;
-        private final Callable<Void> afterDispatchCallable;
-
-        private final AWTEvent[] beforeDispatchEventArgument;
-        private final Callable<Object> beforeDispatchCallable;
-
-        private final EventQueue[] getNextEventEventQueueArgument;
-        private final Callable<AWTEvent> getNextEventCallable;
-
-        @SuppressWarnings("unchecked")
-        public EventQueueDelegateFromMap(Map<String, Map<String, Object>> objectMap) {
-            Map<String, Object> methodMap = objectMap.get("afterDispatch");
-            afterDispatchEventArgument = (AWTEvent[]) methodMap.get("event");
-            afterDispatchHandleArgument = (Object[]) methodMap.get("handle");
-            afterDispatchCallable = (Callable<Void>) methodMap.get("method");
-
-            methodMap = objectMap.get("beforeDispatch");
-            beforeDispatchEventArgument = (AWTEvent[]) methodMap.get("event");
-            beforeDispatchCallable = (Callable<Object>) methodMap.get("method");
-
-            methodMap = objectMap.get("getNextEvent");
-            getNextEventEventQueueArgument =
-                (EventQueue[]) methodMap.get("eventQueue");
-            getNextEventCallable = (Callable<AWTEvent>) methodMap.get("method");
-        }
-
-        @Override
-        public void afterDispatch(AWTEvent event, Object handle) throws InterruptedException {
-            afterDispatchEventArgument[0] = event;
-            afterDispatchHandleArgument[0] = handle;
-            try {
-                afterDispatchCallable.call();
-            } catch (InterruptedException e) {
-                throw e;
-            } catch (RuntimeException e) {
-                throw e;
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        @Override
-        public Object beforeDispatch(AWTEvent event) throws InterruptedException {
-            beforeDispatchEventArgument[0] = event;
-            try {
-                return beforeDispatchCallable.call();
-            } catch (InterruptedException e) {
-                throw e;
-            } catch (RuntimeException e) {
-                throw e;
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        @Override
-        public AWTEvent getNextEvent(EventQueue eventQueue) throws InterruptedException {
-            getNextEventEventQueueArgument[0] = eventQueue;
-            try {
-                return getNextEventCallable.call();
-            } catch (InterruptedException e) {
-                throw e;
-            } catch (RuntimeException e) {
-                throw e;
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
 }
diff --git a/jdk/src/share/classes/java/awt/EventDispatchThread.java b/jdk/src/share/classes/java/awt/EventDispatchThread.java
index 51344658c7e..962039c8374 100644
--- a/jdk/src/share/classes/java/awt/EventDispatchThread.java
+++ b/jdk/src/share/classes/java/awt/EventDispatchThread.java
@@ -33,7 +33,6 @@ import java.util.ArrayList;
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.dnd.SunDragSourceContextPeer;
-import sun.awt.EventQueueDelegate;
 
 /**
  * EventDispatchThread is a package-private AWT class which takes
@@ -158,17 +157,11 @@ class EventDispatchThread extends Thread {
         boolean eventOK = false;
         try {
             EventQueue eq = null;
-            EventQueueDelegate.Delegate delegate = null;
             do {
                 // EventQueue may change during the dispatching
                 eq = getEventQueue();
-                delegate = EventQueueDelegate.getDelegate();
 
-                if (delegate != null && id == ANY_EVENT) {
-                    event = delegate.getNextEvent(eq);
-                } else {
-                    event = (id == ANY_EVENT) ? eq.getNextEvent() : eq.getNextEvent(id);
-                }
+                event = (id == ANY_EVENT) ? eq.getNextEvent() : eq.getNextEvent(id);
 
                 eventOK = true;
                 synchronized (eventFilters) {
@@ -194,14 +187,7 @@ class EventDispatchThread extends Thread {
                 eventLog.finest("Dispatching: " + event);
             }
 
-            Object handle = null;
-            if (delegate != null) {
-                handle = delegate.beforeDispatch(event);
-            }
             eq.dispatchEvent(event);
-            if (delegate != null) {
-                delegate.afterDispatch(event, handle);
-            }
         }
         catch (ThreadDeath death) {
             doDispatch = false;
diff --git a/jdk/src/share/classes/sun/awt/EventQueueDelegate.java b/jdk/src/share/classes/sun/awt/EventQueueDelegate.java
deleted file mode 100644
index 3a1b5b3889f..00000000000
--- a/jdk/src/share/classes/sun/awt/EventQueueDelegate.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2008, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.AWTEvent;
-import java.awt.EventQueue;
-
-
-public class EventQueueDelegate {
-    private static final Object EVENT_QUEUE_DELEGATE_KEY =
-        new StringBuilder("EventQueueDelegate.Delegate");
-
-    public static void setDelegate(Delegate delegate) {
-        AppContext.getAppContext().put(EVENT_QUEUE_DELEGATE_KEY, delegate);
-    }
-    public static Delegate getDelegate() {
-        return
-          (Delegate) AppContext.getAppContext().get(EVENT_QUEUE_DELEGATE_KEY);
-    }
-    public interface Delegate {
-        /**
-         * This method allows for changing {@code EventQueue} events order.
-         *
-         * @param eventQueue current {@code EventQueue}
-         * @return next {@code event} for the {@code EventDispatchThread}
-         */
-
-        public AWTEvent getNextEvent(EventQueue eventQueue) throws InterruptedException;
-
-        /**
-         * Notifies delegate before EventQueue.dispatch method.
-         *
-         * Note: this method may mutate the event
-         *
-         * @param event  to be dispatched by {@code dispatch} method
-         * @return handle to be passed to {@code afterDispatch} method
-         */
-        public Object beforeDispatch(AWTEvent event) throws InterruptedException;
-
-        /**
-         * Notifies delegate after EventQueue.dispatch method.
-         *
-         * @param event {@code event} dispatched by the {@code dispatch} method
-         * @param handle object which came from {@code beforeDispatch} method
-         */
-        public void afterDispatch(AWTEvent event, Object handle) throws InterruptedException;
-    }
-}
diff --git a/jdk/test/java/awt/EventQueue/6638195/bug6638195.java b/jdk/test/java/awt/EventQueue/6638195/bug6638195.java
deleted file mode 100644
index 70cebb946d7..00000000000
--- a/jdk/test/java/awt/EventQueue/6638195/bug6638195.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- *
- * @bug 6638195 6844297
- * @author Igor Kushnirskiy
- * @summary tests if EventQueueDelegate.Delegate is invoked.
- */
-
-import sun.awt.EventQueueDelegate;
-import com.sun.java.swing.SwingUtilities3;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.awt.*;
-
-public class bug6638195 {
-    public static void main(String[] args) throws Exception {
-        MyEventQueueDelegate delegate = new MyEventQueueDelegate();
-        EventQueueDelegate.setDelegate(delegate);
-        runTest(delegate);
-
-        delegate = new MyEventQueueDelegate();
-        SwingUtilities3.setEventQueueDelegate(getObjectMap(delegate));
-        runTest(delegate);
-    }
-
-    private static void runTest(MyEventQueueDelegate delegate) throws Exception {
-        // We need an empty runnable here, so the next event is
-        // processed with a new EventQueueDelegate. See 6844297
-        // for details
-        EventQueue.invokeLater(
-            new Runnable() {
-                public void run() {
-                }
-            });
-        // The following event is expected to be processed by
-        // the EventQueueDelegate instance
-        EventQueue.invokeLater(
-            new Runnable() {
-                public void run() {
-                }
-            });
-        // Finally, proceed on the main thread
-        final CountDownLatch latch = new CountDownLatch(1);
-        EventQueue.invokeLater(
-            new Runnable() {
-                public void run() {
-                    latch.countDown();
-                }
-            });
-        latch.await();
-        if (!delegate.allInvoked()) {
-            throw new RuntimeException("failed");
-        }
-    }
-
-    static Map<String, Map<String, Object>> getObjectMap(
-          final EventQueueDelegate.Delegate delegate) {
-        Map<String, Map<String, Object>> objectMap =
-            new HashMap<String, Map<String, Object>>();
-        Map<String, Object> methodMap;
-
-        final AWTEvent[] afterDispatchEventArgument = new AWTEvent[1];
-        final Object[] afterDispatchHandleArgument = new Object[1];
-        Callable<Void> afterDispatchCallable =
-            new Callable<Void>() {
-                public Void call() {
-                    try {
-                        delegate.afterDispatch(afterDispatchEventArgument[0],
-                                afterDispatchHandleArgument[0]);
-                    }
-                    catch (InterruptedException e) {
-                        throw new RuntimeException("afterDispatch interrupted", e);
-                    }
-                    return null;
-                }
-            };
-        methodMap = new HashMap<String, Object>();
-        methodMap.put("event", afterDispatchEventArgument);
-        methodMap.put("handle", afterDispatchHandleArgument);
-        methodMap.put("method", afterDispatchCallable);
-        objectMap.put("afterDispatch", methodMap);
-
-        final AWTEvent[] beforeDispatchEventArgument = new AWTEvent[1];
-        Callable<Object> beforeDispatchCallable =
-            new Callable<Object>() {
-                public Object call() {
-                    try {
-                        return delegate.beforeDispatch(
-                                beforeDispatchEventArgument[0]);
-                    }
-                    catch (InterruptedException e) {
-                        throw new RuntimeException("beforeDispatch interrupted", e);
-                    }
-                }
-            };
-        methodMap = new HashMap<String, Object>();
-        methodMap.put("event", beforeDispatchEventArgument);
-        methodMap.put("method", beforeDispatchCallable);
-        objectMap.put("beforeDispatch", methodMap);
-
-        final EventQueue[] getNextEventEventQueueArgument = new EventQueue[1];
-        Callable<AWTEvent> getNextEventCallable =
-            new Callable<AWTEvent>() {
-                public AWTEvent call() throws Exception {
-                    return delegate.getNextEvent(
-                        getNextEventEventQueueArgument[0]);
-                }
-            };
-        methodMap = new HashMap<String, Object>();
-        methodMap.put("eventQueue", getNextEventEventQueueArgument);
-        methodMap.put("method", getNextEventCallable);
-        objectMap.put("getNextEvent", methodMap);
-
-        return objectMap;
-    }
-
-    static class MyEventQueueDelegate implements EventQueueDelegate.Delegate {
-        private volatile boolean getNextEventInvoked = false;
-        private volatile boolean beforeDispatchInvoked = false;
-        private volatile boolean afterDispatchInvoked = false;
-        public AWTEvent getNextEvent(EventQueue eventQueue)
-              throws InterruptedException {
-            getNextEventInvoked = true;
-            return eventQueue.getNextEvent();
-        }
-        public Object beforeDispatch(AWTEvent event) {
-            beforeDispatchInvoked = true;
-            return null;
-        }
-        public void afterDispatch(AWTEvent event, Object handle) {
-            afterDispatchInvoked = true;
-        }
-        private boolean allInvoked() {
-            return getNextEventInvoked && beforeDispatchInvoked && afterDispatchInvoked;
-        }
-    }
-}
-- 
GitLab


From 565ab8b571328449b3683f408d6cf5a66196ae8e Mon Sep 17 00:00:00 2001
From: Xueming Shen <sherman@openjdk.org>
Date: Mon, 23 Jun 2014 12:12:30 -0700
Subject: [PATCH 136/192] 8042369: Remove duplicated java.time classes in
 build.tools.tzdb

Removed duplicated classes in builder

Reviewed-by: rriggs
---
 .../classes/build/tools/tzdb/ChronoField.java | 180 ----
 .../build/tools/tzdb/DateTimeException.java   |  98 --
 .../classes/build/tools/tzdb/LocalDate.java   | 363 --------
 .../build/tools/tzdb/LocalDateTime.java       | 427 ---------
 .../classes/build/tools/tzdb/LocalTime.java   | 388 --------
 .../build/tools/tzdb/TimeDefinition.java      | 117 ---
 .../tools/tzdb/TzdbZoneRulesCompiler.java     | 495 +---------
 .../tools/tzdb/TzdbZoneRulesProvider.java     | 843 ++++++++++++++++++
 .../src/classes/build/tools/tzdb/Utils.java   | 176 ----
 .../classes/build/tools/tzdb/ZoneOffset.java  | 474 ----------
 .../tools/tzdb/ZoneOffsetTransition.java      | 290 ------
 .../tools/tzdb/ZoneOffsetTransitionRule.java  | 223 -----
 .../classes/build/tools/tzdb/ZoneRules.java   |  24 +-
 .../build/tools/tzdb/ZoneRulesBuilder.java    | 743 ---------------
 14 files changed, 891 insertions(+), 3950 deletions(-)
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/ChronoField.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/DateTimeException.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/LocalDate.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/LocalDateTime.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/LocalTime.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/TimeDefinition.java
 create mode 100644 jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/Utils.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/ZoneOffset.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransition.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransitionRule.java
 delete mode 100644 jdk/make/src/classes/build/tools/tzdb/ZoneRulesBuilder.java

diff --git a/jdk/make/src/classes/build/tools/tzdb/ChronoField.java b/jdk/make/src/classes/build/tools/tzdb/ChronoField.java
deleted file mode 100644
index 7ce34bbfae2..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/ChronoField.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package build.tools.tzdb;
-
-/**
- * A standard set of date/time fields.
- *
- * @since 1.8
- */
-enum ChronoField {
-
-    /**
-     * The second-of-minute.
-     * <p>
-     * This counts the second within the minute, from 0 to 59.
-     * This field has the same meaning for all calendar systems.
-     */
-    SECOND_OF_MINUTE("SecondOfMinute", 0, 59),
-
-    /**
-     * The second-of-day.
-     * <p>
-     * This counts the second within the day, from 0 to (24 * 60 * 60) - 1.
-     * This field has the same meaning for all calendar systems.
-     */
-    SECOND_OF_DAY("SecondOfDay", 0, 86400 - 1),
-
-    /**
-     * The minute-of-hour.
-     * <p>
-     * This counts the minute within the hour, from 0 to 59.
-     * This field has the same meaning for all calendar systems.
-     */
-    MINUTE_OF_HOUR("MinuteOfHour", 0, 59),
-
-    /**
-     * The hour-of-day.
-     * <p>
-     * This counts the hour within the day, from 0 to 23.
-     * This is the hour that would be observed on a standard 24-hour digital clock.
-     * This field has the same meaning for all calendar systems.
-     */
-    HOUR_OF_DAY("HourOfDay", 0, 23),
-
-
-    /**
-     * The day-of-month.
-     * <p>
-     * This represents the concept of the day within the month.
-     * In the default ISO calendar system, this has values from 1 to 31 in most months.
-     * April, June, September, November have days from 1 to 30, while February has days
-     * from 1 to 28, or 29 in a leap year.
-     * <p>
-     * Non-ISO calendar systems should implement this field using the most recognized
-     * day-of-month values for users of the calendar system.
-     * Normally, this is a count of days from 1 to the length of the month.
-     */
-    DAY_OF_MONTH("DayOfMonth", 1, 31),
-
-    /**
-     * The month-of-year, such as March.
-     * <p>
-     * This represents the concept of the month within the year.
-     * In the default ISO calendar system, this has values from January (1) to December (12).
-     * <p>
-     * Non-ISO calendar systems should implement this field using the most recognized
-     * month-of-year values for users of the calendar system.
-     * Normally, this is a count of months starting from 1.
-     */
-    MONTH_OF_YEAR("MonthOfYear", 1, 12),
-
-    /**
-     * The proleptic year, such as 2012.
-     * <p>
-     * This represents the concept of the year, counting sequentially and using negative numbers.
-     * The proleptic year is not interpreted in terms of the era.
-     * See {@link #YEAR_OF_ERA} for an example showing the mapping from proleptic year to year-of-era.
-     * <p>
-     * The standard mental model for a date is based on three concepts - year, month and day.
-     * These map onto the {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields.
-     * Note that there is no reference to eras.
-     * The full model for a date requires four concepts - era, year, month and day. These map onto
-     * the {@code ERA}, {@code YEAR_OF_ERA}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} fields.
-     * Whether this field or {@code YEAR_OF_ERA} is used depends on which mental model is being used.
-     * See {@link ChronoLocalDate} for more discussion on this topic.
-     * <p>
-     * Non-ISO calendar systems should implement this field as follows.
-     * If the calendar system has only two eras, before and after a fixed date, then the
-     * proleptic-year value must be the same as the year-of-era value for the later era,
-     * and increasingly negative for the earlier era.
-     * If the calendar system has more than two eras, then the proleptic-year value may be
-     * defined with any appropriate value, although defining it to be the same as ISO may be
-     * the best option.
-     */
-    YEAR("Year", -999_999_999, 999_999_999);
-
-    private final String name;
-    private final int min;
-    private final int max;
-
-    private ChronoField(String name, int min, int max) {
-        this.name = name;
-        this.min= min;
-        this.max= max;
-    }
-
-    /**
-     * Checks that the specified value is valid for this field.
-     * <p>
-     *
-     * @param value  the value to check
-     * @return the value that was passed in
-     */
-    public int checkValidValue(int value) {
-        if (value >= min && value <= max) {
-            return value;
-        }
-        throw new DateTimeException("Invalid value for " + name + " value: " + value);
-    }
-
-    public String toString() {
-        return name;
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/DateTimeException.java b/jdk/make/src/classes/build/tools/tzdb/DateTimeException.java
deleted file mode 100644
index 2b7674df3ff..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/DateTimeException.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-/**
- * Exception used to indicate a problem while calculating a date-time.
- * <p>
- * This exception is used to indicate problems with creating, querying
- * and manipulating date-time objects.
- *
- * @since 1.8
- */
-class DateTimeException extends RuntimeException {
-
-    /**
-     * Serialization version.
-     */
-    private static final long serialVersionUID = -1632418723876261839L;
-
-    /**
-     * Constructs a new date-time exception with the specified message.
-     *
-     * @param message  the message to use for this exception, may be null
-     */
-    public DateTimeException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new date-time exception with the specified message and cause.
-     *
-     * @param message  the message to use for this exception, may be null
-     * @param cause  the cause of the exception, may be null
-     */
-    public DateTimeException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/LocalDate.java b/jdk/make/src/classes/build/tools/tzdb/LocalDate.java
deleted file mode 100644
index fedab6d3156..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/LocalDate.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import static build.tools.tzdb.Utils.*;
-import static build.tools.tzdb.LocalTime.SECONDS_PER_DAY;
-import static build.tools.tzdb.ChronoField.DAY_OF_MONTH;
-import static build.tools.tzdb.ChronoField.MONTH_OF_YEAR;
-import static build.tools.tzdb.ChronoField.YEAR;
-
-import java.util.Objects;
-
-/**
- * A date without a time-zone in the ISO-8601 calendar system,
- * such as {@code 2007-12-03}.
- *
- * @since 1.8
- */
-final class LocalDate {
-
-    /**
-     * The minimum supported {@code LocalDate}, '-999999999-01-01'.
-     * This could be used by an application as a "far past" date.
-     */
-    public static final LocalDate MIN = new LocalDate(YEAR_MIN_VALUE, 1, 1);
-    /**
-     * The maximum supported {@code LocalDate}, '+999999999-12-31'.
-     * This could be used by an application as a "far future" date.
-     */
-    public static final LocalDate MAX = new LocalDate(YEAR_MAX_VALUE, 12, 31);
-
-    /**
-     * The number of days in a 400 year cycle.
-     */
-    private static final int DAYS_PER_CYCLE = 146097;
-    /**
-     * The number of days from year zero to year 1970.
-     * There are five 400 year cycles from year zero to 2000.
-     * There are 7 leap years from 1970 to 2000.
-     */
-    static final long DAYS_0000_TO_1970 = (DAYS_PER_CYCLE * 5L) - (30L * 365L + 7L);
-
-    /**
-     * The year.
-     */
-    private final int year;
-    /**
-     * The month-of-year.
-     */
-    private final short month;
-    /**
-     * The day-of-month.
-     */
-    private final short day;
-
-    /**
-     * Obtains an instance of {@code LocalDate} from a year, month and day.
-     * <p>
-     * The day must be valid for the year and month, otherwise an exception will be thrown.
-     *
-     * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
-     * @param month  the month-of-year to represent, from 1 (January) to 12 (December)
-     * @param dayOfMonth  the day-of-month to represent, from 1 to 31
-     * @return the local date, not null
-     * @throws DateTimeException if the value of any field is out of range
-     * @throws DateTimeException if the day-of-month is invalid for the month-year
-     */
-    public static LocalDate of(int year, int month, int dayOfMonth) {
-        YEAR.checkValidValue(year);
-        MONTH_OF_YEAR.checkValidValue(month);
-        DAY_OF_MONTH.checkValidValue(dayOfMonth);
-        if (dayOfMonth > 28 && dayOfMonth > lengthOfMonth(month, isLeapYear(year))) {
-            if (dayOfMonth == 29) {
-                throw new DateTimeException("Invalid date 'February 29' as '" + year + "' is not a leap year");
-            } else {
-                throw new DateTimeException("Invalid date '" + month + " " + dayOfMonth + "'");
-            }
-        }
-        return new LocalDate(year, month, dayOfMonth);
-    }
-
-    /**
-     * Constructor, previously validated.
-     *
-     * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
-     * @param month  the month-of-year to represent, not null
-     * @param dayOfMonth  the day-of-month to represent, valid for year-month, from 1 to 31
-     */
-    private LocalDate(int year, int month, int dayOfMonth) {
-        this.year = year;
-        this.month = (short) month;
-        this.day = (short) dayOfMonth;
-    }
-
-    /**
-     * Gets the year field.
-     * <p>
-     * This method returns the primitive {@code int} value for the year.
-     * <p>
-     * The year returned by this method is proleptic as per {@code get(YEAR)}.
-     * To obtain the year-of-era, use {@code get(YEAR_OF_ERA}.
-     *
-     * @return the year, from MIN_YEAR to MAX_YEAR
-     */
-    public int getYear() {
-        return year;
-    }
-
-    /**
-     * Gets the month-of-year field as an int from 1 to 12.
-     *
-     * @return the month-of-year
-     */
-    public int getMonth() {
-        return month;
-    }
-
-    /**
-     * Gets the day-of-month field.
-     * <p>
-     * This method returns the primitive {@code int} value for the day-of-month.
-     *
-     * @return the day-of-month, from 1 to 31
-     */
-    public int getDayOfMonth() {
-        return day;
-    }
-
-    /**
-     * Gets the day-of-week field, which is an int from 1 to 7.
-     *
-     * @return the day-of-week
-     */
-    public int getDayOfWeek() {
-        return (int)floorMod(toEpochDay() + 3, 7) + 1;
-    }
-
-    /**
-     * Returns a copy of this {@code LocalDate} with the specified number of days added.
-     * <p>
-     * This method adds the specified amount to the days field incrementing the
-     * month and year fields as necessary to ensure the result remains valid.
-     * The result is only invalid if the maximum/minimum year is exceeded.
-     * <p>
-     * For example, 2008-12-31 plus one day would result in 2009-01-01.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param daysToAdd  the days to add, may be negative
-     * @return a {@code LocalDate} based on this date with the days added, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    public LocalDate plusDays(long daysToAdd) {
-        if (daysToAdd == 0) {
-            return this;
-        }
-        long mjDay = addExact(toEpochDay(), daysToAdd);
-        return LocalDate.ofEpochDay(mjDay);
-    }
-
-    /**
-     * Returns a copy of this {@code LocalDate} with the specified number of days subtracted.
-     * <p>
-     * This method subtracts the specified amount from the days field decrementing the
-     * month and year fields as necessary to ensure the result remains valid.
-     * The result is only invalid if the maximum/minimum year is exceeded.
-     * <p>
-     * For example, 2009-01-01 minus one day would result in 2008-12-31.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param daysToSubtract  the days to subtract, may be negative
-     * @return a {@code LocalDate} based on this date with the days subtracted, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    public LocalDate minusDays(long daysToSubtract) {
-        return (daysToSubtract == Long.MIN_VALUE ? plusDays(Long.MAX_VALUE).plusDays(1) : plusDays(-daysToSubtract));
-    }
-
-    /**
-     * Obtains an instance of {@code LocalDate} from the epoch day count.
-     * <p>
-     * The Epoch Day count is a simple incrementing count of days
-     * where day 0 is 1970-01-01. Negative numbers represent earlier days.
-     *
-     * @param epochDay  the Epoch Day to convert, based on the epoch 1970-01-01
-     * @return the local date, not null
-     * @throws DateTimeException if the epoch days exceeds the supported date range
-     */
-    public static LocalDate ofEpochDay(long epochDay) {
-        long zeroDay = epochDay + DAYS_0000_TO_1970;
-        // find the march-based year
-        zeroDay -= 60;  // adjust to 0000-03-01 so leap day is at end of four year cycle
-        long adjust = 0;
-        if (zeroDay < 0) {
-            // adjust negative years to positive for calculation
-            long adjustCycles = (zeroDay + 1) / DAYS_PER_CYCLE - 1;
-            adjust = adjustCycles * 400;
-            zeroDay += -adjustCycles * DAYS_PER_CYCLE;
-        }
-        long yearEst = (400 * zeroDay + 591) / DAYS_PER_CYCLE;
-        long doyEst = zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
-        if (doyEst < 0) {
-            // fix estimate
-            yearEst--;
-            doyEst = zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
-        }
-        yearEst += adjust;  // reset any negative year
-        int marchDoy0 = (int) doyEst;
-
-        // convert march-based values back to january-based
-        int marchMonth0 = (marchDoy0 * 5 + 2) / 153;
-        int month = (marchMonth0 + 2) % 12 + 1;
-        int dom = marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
-        yearEst += marchMonth0 / 10;
-
-        // check year now we are certain it is correct
-        int year = YEAR.checkValidValue((int)yearEst);
-        return new LocalDate(year, month, dom);
-    }
-
-    public long toEpochDay() {
-        long y = year;
-        long m = month;
-        long total = 0;
-        total += 365 * y;
-        if (y >= 0) {
-            total += (y + 3) / 4 - (y + 99) / 100 + (y + 399) / 400;
-        } else {
-            total -= y / -4 - y / -100 + y / -400;
-        }
-        total += ((367 * m - 362) / 12);
-        total += day - 1;
-        if (m > 2) {
-            total--;
-            if (isLeapYear(year) == false) {
-                total--;
-            }
-        }
-        return total - DAYS_0000_TO_1970;
-    }
-
-    /**
-     * Compares this date to another date.
-     * <p>
-     * The comparison is primarily based on the date, from earliest to latest.
-     * It is "consistent with equals", as defined by {@link Comparable}.
-     * <p>
-     * If all the dates being compared are instances of {@code LocalDate},
-     * then the comparison will be entirely based on the date.
-     * If some dates being compared are in different chronologies, then the
-     * chronology is also considered, see {@link java.time.temporal.ChronoLocalDate#compareTo}.
-     *
-     * @param other  the other date to compare to, not null
-     * @return the comparator value, negative if less, positive if greater
-     */
-    public int compareTo(LocalDate otherDate) {
-        int cmp = (year - otherDate.year);
-        if (cmp == 0) {
-            cmp = (month - otherDate.month);
-            if (cmp == 0) {
-                cmp = (day - otherDate.day);
-            }
-        }
-        return cmp;
-    }
-
-    /**
-     * Checks if this date is equal to another date.
-     * <p>
-     * Compares this {@code LocalDate} with another ensuring that the date is the same.
-     * <p>
-     * Only objects of type {@code LocalDate} are compared, other types return false.
-     * To compare the dates of two {@code TemporalAccessor} instances, including dates
-     * in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator.
-     *
-     * @param obj  the object to check, null returns false
-     * @return true if this is equal to the other date
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof LocalDate) {
-            return compareTo((LocalDate) obj) == 0;
-        }
-        return false;
-    }
-
-    /**
-     * A hash code for this date.
-     *
-     * @return a suitable hash code
-     */
-    @Override
-    public int hashCode() {
-        int yearValue = year;
-        int monthValue = month;
-        int dayValue = day;
-        return (yearValue & 0xFFFFF800) ^ ((yearValue << 11) + (monthValue << 6) + (dayValue));
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/LocalDateTime.java b/jdk/make/src/classes/build/tools/tzdb/LocalDateTime.java
deleted file mode 100644
index ced37b72613..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/LocalDateTime.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import static build.tools.tzdb.Utils.*;
-import static build.tools.tzdb.LocalTime.HOURS_PER_DAY;
-import static build.tools.tzdb.LocalTime.MICROS_PER_DAY;
-import static build.tools.tzdb.LocalTime.MILLIS_PER_DAY;
-import static build.tools.tzdb.LocalTime.MINUTES_PER_DAY;
-import static build.tools.tzdb.LocalTime.SECONDS_PER_DAY;
-import static build.tools.tzdb.LocalTime.SECONDS_PER_MINUTE;
-import static build.tools.tzdb.LocalTime.SECONDS_PER_HOUR;
-
-import java.util.Objects;
-
-/**
- * A date-time without a time-zone in the ISO-8601 calendar system,
- * such as {@code 2007-12-03T10:15:30}.
- *
- * @since 1.8
- */
-final class LocalDateTime {
-
-    /**
-     * The minimum supported {@code LocalDateTime}, '-999999999-01-01T00:00:00'.
-     * This is the local date-time of midnight at the start of the minimum date.
-     * This combines {@link LocalDate#MIN} and {@link LocalTime#MIN}.
-     * This could be used by an application as a "far past" date-time.
-     */
-    public static final LocalDateTime MIN = LocalDateTime.of(LocalDate.MIN, LocalTime.MIN);
-    /**
-     * The maximum supported {@code LocalDateTime}, '+999999999-12-31T23:59:59.999999999'.
-     * This is the local date-time just before midnight at the end of the maximum date.
-     * This combines {@link LocalDate#MAX} and {@link LocalTime#MAX}.
-     * This could be used by an application as a "far future" date-time.
-     */
-    public static final LocalDateTime MAX = LocalDateTime.of(LocalDate.MAX, LocalTime.MAX);
-
-    /**
-     * The date part.
-     */
-    private final LocalDate date;
-    /**
-     * The time part.
-     */
-    private final LocalTime time;
-
-    /**
-     * Obtains an instance of {@code LocalDateTime} from year, month,
-     * day, hour and minute, setting the second and nanosecond to zero.
-     * <p>
-     * The day must be valid for the year and month, otherwise an exception will be thrown.
-     * The second and nanosecond fields will be set to zero.
-     *
-     * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
-     * @param month  the month-of-year to represent, from 1 (January) to 12 (December)
-     * @param dayOfMonth  the day-of-month to represent, from 1 to 31
-     * @param hour  the hour-of-day to represent, from 0 to 23
-     * @param minute  the minute-of-hour to represent, from 0 to 59
-     * @return the local date-time, not null
-     * @throws DateTimeException if the value of any field is out of range
-     * @throws DateTimeException if the day-of-month is invalid for the month-year
-     */
-    public static LocalDateTime of(int year, int month, int dayOfMonth, int hour, int minute) {
-        LocalDate date = LocalDate.of(year, month, dayOfMonth);
-        LocalTime time = LocalTime.of(hour, minute);
-        return new LocalDateTime(date, time);
-    }
-
-    /**
-     * Obtains an instance of {@code LocalDateTime} from a date and time.
-     *
-     * @param date  the local date, not null
-     * @param time  the local time, not null
-     * @return the local date-time, not null
-     */
-    public static LocalDateTime of(LocalDate date, LocalTime time) {
-        Objects.requireNonNull(date, "date");
-        Objects.requireNonNull(time, "time");
-        return new LocalDateTime(date, time);
-    }
-
-    /**
-     * Obtains an instance of {@code LocalDateTime} using seconds from the
-     * epoch of 1970-01-01T00:00:00Z.
-     * <p>
-     * This allows the {@link ChronoField#INSTANT_SECONDS epoch-second} field
-     * to be converted to a local date-time. This is primarily intended for
-     * low-level conversions rather than general application usage.
-     *
-     * @param epochSecond  the number of seconds from the epoch of 1970-01-01T00:00:00Z
-     * @param nanoOfSecond  the nanosecond within the second, from 0 to 999,999,999
-     * @param offset  the zone offset, not null
-     * @return the local date-time, not null
-     * @throws DateTimeException if the result exceeds the supported range
-     */
-    public static LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset) {
-        Objects.requireNonNull(offset, "offset");
-        long localSecond = epochSecond + offset.getTotalSeconds();  // overflow caught later
-        long localEpochDay = floorDiv(localSecond, SECONDS_PER_DAY);
-        int secsOfDay = (int)floorMod(localSecond, SECONDS_PER_DAY);
-        LocalDate date = LocalDate.ofEpochDay(localEpochDay);
-        LocalTime time = LocalTime.ofSecondOfDay(secsOfDay);  // ignore nano
-        return new LocalDateTime(date, time);
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param date  the date part of the date-time, validated not null
-     * @param time  the time part of the date-time, validated not null
-     */
-    private LocalDateTime(LocalDate date, LocalTime time) {
-        this.date = date;
-        this.time = time;
-    }
-
-    /**
-     * Returns a copy of this date-time with the new date and time, checking
-     * to see if a new object is in fact required.
-     *
-     * @param newDate  the date of the new date-time, not null
-     * @param newTime  the time of the new date-time, not null
-     * @return the date-time, not null
-     */
-    private LocalDateTime with(LocalDate newDate, LocalTime newTime) {
-        if (date == newDate && time == newTime) {
-            return this;
-        }
-        return new LocalDateTime(newDate, newTime);
-    }
-
-    /**
-     * Gets the {@code LocalDate} part of this date-time.
-     * <p>
-     * This returns a {@code LocalDate} with the same year, month and day
-     * as this date-time.
-     *
-     * @return the date part of this date-time, not null
-     */
-    public LocalDate getDate() {
-        return date;
-    }
-
-    /**
-     * Gets the year field.
-     * <p>
-     * This method returns the primitive {@code int} value for the year.
-     * <p>
-     * The year returned by this method is proleptic as per {@code get(YEAR)}.
-     * To obtain the year-of-era, use {@code get(YEAR_OF_ERA}.
-     *
-     * @return the year, from MIN_YEAR to MAX_YEAR
-     */
-    public int getYear() {
-        return date.getYear();
-    }
-
-    /**
-     * Gets the month-of-year field as an int from 1 to 12.
-     *
-     * @return the month-of-year
-     */
-    public int getMonth() {
-        return date.getMonth();
-    }
-
-    /**
-     * Gets the day-of-month field.
-     * <p>
-     * This method returns the primitive {@code int} value for the day-of-month.
-     *
-     * @return the day-of-month, from 1 to 31
-     */
-    public int getDayOfMonth() {
-        return date.getDayOfMonth();
-    }
-
-    /**
-     * Gets the day-of-week field, which is an integer from 1 to 7.
-     *
-     * @return the day-of-week, from 1 to 7
-     */
-    public int getDayOfWeek() {
-        return date.getDayOfWeek();
-    }
-
-    /**
-     * Gets the {@code LocalTime} part of this date-time.
-     * <p>
-     * This returns a {@code LocalTime} with the same hour, minute, second and
-     * nanosecond as this date-time.
-     *
-     * @return the time part of this date-time, not null
-     */
-    public LocalTime getTime() {
-        return time;
-    }
-
-    /**
-     * Gets the hour-of-day field.
-     *
-     * @return the hour-of-day, from 0 to 23
-     */
-    public int getHour() {
-        return time.getHour();
-    }
-
-    /**
-     * Gets the minute-of-hour field.
-     *
-     * @return the minute-of-hour, from 0 to 59
-     */
-    public int getMinute() {
-        return time.getMinute();
-    }
-
-    /**
-     * Gets the second-of-minute field.
-     *
-     * @return the second-of-minute, from 0 to 59
-     */
-    public int getSecond() {
-        return time.getSecond();
-    }
-
-    /**
-     * Converts this date-time to the number of seconds from the epoch
-     * of 1970-01-01T00:00:00Z.
-     * <p>
-     * This combines this local date-time and the specified offset to calculate the
-     * epoch-second value, which is the number of elapsed seconds from 1970-01-01T00:00:00Z.
-     * Instants on the time-line after the epoch are positive, earlier are negative.
-     * <p>
-     * This default implementation calculates from the epoch-day of the date and the
-     * second-of-day of the time.
-     *
-     * @param offset  the offset to use for the conversion, not null
-     * @return the number of seconds from the epoch of 1970-01-01T00:00:00Z
-     */
-    public long toEpochSecond(ZoneOffset offset) {
-        Objects.requireNonNull(offset, "offset");
-        long epochDay = getDate().toEpochDay();
-        long secs = epochDay * 86400 + getTime().toSecondOfDay();
-        secs -= offset.getTotalSeconds();
-        return secs;
-    }
-
-    /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in days added.
-     * <p>
-     * This method adds the specified amount to the days field incrementing the
-     * month and year fields as necessary to ensure the result remains valid.
-     * The result is only invalid if the maximum/minimum year is exceeded.
-     * <p>
-     * For example, 2008-12-31 plus one day would result in 2009-01-01.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param days  the days to add, may be negative
-     * @return a {@code LocalDateTime} based on this date-time with the days added, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    public LocalDateTime plusDays(long days) {
-        LocalDate newDate = date.plusDays(days);
-        return with(newDate, time);
-    }
-
-    /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in seconds added.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param seconds  the seconds to add, may be negative
-     * @return a {@code LocalDateTime} based on this date-time with the seconds added, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    public LocalDateTime plusSeconds(long seconds) {
-        return plusWithOverflow(date, 0, 0, seconds, 1);
-    }
-
-    /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period added.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param newDate  the new date to base the calculation on, not null
-     * @param hours  the hours to add, may be negative
-     * @param minutes the minutes to add, may be negative
-     * @param seconds the seconds to add, may be negative
-     * @param nanos the nanos to add, may be negative
-     * @param sign  the sign to determine add or subtract
-     * @return the combined result, not null
-     */
-    private LocalDateTime plusWithOverflow(LocalDate newDate, long hours, long minutes, long seconds, int sign) {
-        if ((hours | minutes | seconds) == 0) {
-            return with(newDate, time);
-        }
-        long totDays = seconds / SECONDS_PER_DAY +                //   max/24*60*60
-                       minutes / MINUTES_PER_DAY +                //   max/24*60
-                       hours / HOURS_PER_DAY;                     //   max/24
-        totDays *= sign;                                          // total max*0.4237...
-        long totSecs = (seconds % SECONDS_PER_DAY) +
-                       (minutes % MINUTES_PER_DAY) * SECONDS_PER_MINUTE +
-                       (hours % HOURS_PER_DAY) * SECONDS_PER_HOUR;
-        long curSoD = time.toSecondOfDay();
-        totSecs = totSecs * sign + curSoD;                    // total 432000000000000
-        totDays += floorDiv(totSecs, SECONDS_PER_DAY);
-
-        int newSoD = (int)floorMod(totSecs, SECONDS_PER_DAY);
-        LocalTime newTime = (newSoD == curSoD ? time : LocalTime.ofSecondOfDay(newSoD));
-        return with(newDate.plusDays(totDays), newTime);
-    }
-
-    /**
-     * Compares this date-time to another date-time.
-     * <p>
-     * The comparison is primarily based on the date-time, from earliest to latest.
-     * It is "consistent with equals", as defined by {@link Comparable}.
-     * <p>
-     * If all the date-times being compared are instances of {@code LocalDateTime},
-     * then the comparison will be entirely based on the date-time.
-     * If some dates being compared are in different chronologies, then the
-     * chronology is also considered, see {@link ChronoLocalDateTime#compareTo}.
-     *
-     * @param other  the other date-time to compare to, not null
-     * @return the comparator value, negative if less, positive if greater
-     */
-    public int compareTo(LocalDateTime other) {
-        int cmp = date.compareTo(other.getDate());
-        if (cmp == 0) {
-            cmp = time.compareTo(other.getTime());
-        }
-        return cmp;
-    }
-
-    /**
-     * Checks if this date-time is equal to another date-time.
-     * <p>
-     * Compares this {@code LocalDateTime} with another ensuring that the date-time is the same.
-     * Only objects of type {@code LocalDateTime} are compared, other types return false.
-     *
-     * @param obj  the object to check, null returns false
-     * @return true if this is equal to the other date-time
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof LocalDateTime) {
-            LocalDateTime other = (LocalDateTime) obj;
-            return date.equals(other.date) && time.equals(other.time);
-        }
-        return false;
-    }
-
-    /**
-     * A hash code for this date-time.
-     *
-     * @return a suitable hash code
-     */
-    @Override
-    public int hashCode() {
-        return date.hashCode() ^ time.hashCode();
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/LocalTime.java b/jdk/make/src/classes/build/tools/tzdb/LocalTime.java
deleted file mode 100644
index 0fc31868944..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/LocalTime.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import static build.tools.tzdb.ChronoField.HOUR_OF_DAY;
-import static build.tools.tzdb.ChronoField.MINUTE_OF_HOUR;
-import static build.tools.tzdb.ChronoField.SECOND_OF_MINUTE;
-import static build.tools.tzdb.ChronoField.SECOND_OF_DAY;
-
-import java.util.Objects;
-
-/**
- * A time without time-zone in the ISO-8601 calendar system,
- * such as {@code 10:15:30}.
- *
- */
-final class LocalTime {
-
-    /**
-     * The minimum supported {@code LocalTime}, '00:00'.
-     * This is the time of midnight at the start of the day.
-     */
-    public static final LocalTime MIN;
-    /**
-     * The minimum supported {@code LocalTime}, '23:59:59.999999999'.
-     * This is the time just before midnight at the end of the day.
-     */
-    public static final LocalTime MAX;
-    /**
-     * The time of midnight at the start of the day, '00:00'.
-     */
-    public static final LocalTime MIDNIGHT;
-    /**
-     * The time of noon in the middle of the day, '12:00'.
-     */
-    public static final LocalTime NOON;
-    /**
-     * Constants for the local time of each hour.
-     */
-    private static final LocalTime[] HOURS = new LocalTime[24];
-    static {
-        for (int i = 0; i < HOURS.length; i++) {
-            HOURS[i] = new LocalTime(i, 0, 0);
-        }
-        MIDNIGHT = HOURS[0];
-        NOON = HOURS[12];
-        MIN = HOURS[0];
-        MAX = new LocalTime(23, 59, 59);
-    }
-
-    /**
-     * Hours per day.
-     */
-    static final int HOURS_PER_DAY = 24;
-    /**
-     * Minutes per hour.
-     */
-    static final int MINUTES_PER_HOUR = 60;
-    /**
-     * Minutes per day.
-     */
-    static final int MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
-    /**
-     * Seconds per minute.
-     */
-    static final int SECONDS_PER_MINUTE = 60;
-    /**
-     * Seconds per hour.
-     */
-    static final int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
-    /**
-     * Seconds per day.
-     */
-    static final int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
-    /**
-     * Milliseconds per day.
-     */
-    static final long MILLIS_PER_DAY = SECONDS_PER_DAY * 1000L;
-    /**
-     * Microseconds per day.
-     */
-    static final long MICROS_PER_DAY = SECONDS_PER_DAY * 1000_000L;
-
-    /**
-     * The hour.
-     */
-    private final byte hour;
-    /**
-     * The minute.
-     */
-    private final byte minute;
-    /**
-     * The second.
-     */
-    private final byte second;
-
-    /**
-     * Obtains an instance of {@code LocalTime} from an hour and minute.
-     * <p>
-     * The second and nanosecond fields will be set to zero by this factory method.
-     * <p>
-     * This factory may return a cached value, but applications must not rely on this.
-     *
-     * @param hour  the hour-of-day to represent, from 0 to 23
-     * @param minute  the minute-of-hour to represent, from 0 to 59
-     * @return the local time, not null
-     * @throws DateTimeException if the value of any field is out of range
-     */
-    public static LocalTime of(int hour, int minute) {
-        HOUR_OF_DAY.checkValidValue(hour);
-        if (minute == 0) {
-            return HOURS[hour];  // for performance
-        }
-        MINUTE_OF_HOUR.checkValidValue(minute);
-        return new LocalTime(hour, minute, 0);
-    }
-
-    /**
-     * Obtains an instance of {@code LocalTime} from an hour, minute and second.
-     * <p>
-     * The nanosecond field will be set to zero by this factory method.
-     * <p>
-     * This factory may return a cached value, but applications must not rely on this.
-     *
-     * @param hour  the hour-of-day to represent, from 0 to 23
-     * @param minute  the minute-of-hour to represent, from 0 to 59
-     * @param second  the second-of-minute to represent, from 0 to 59
-     * @return the local time, not null
-     * @throws DateTimeException if the value of any field is out of range
-     */
-    public static LocalTime of(int hour, int minute, int second) {
-        HOUR_OF_DAY.checkValidValue(hour);
-        if ((minute | second) == 0) {
-            return HOURS[hour];  // for performance
-        }
-        MINUTE_OF_HOUR.checkValidValue(minute);
-        SECOND_OF_MINUTE.checkValidValue(second);
-        return new LocalTime(hour, minute, second);
-    }
-
-    /**
-     * Obtains an instance of {@code LocalTime} from a second-of-day value.
-     * <p>
-     * This factory may return a cached value, but applications must not rely on this.
-     *
-     * @param secondOfDay  the second-of-day, from {@code 0} to {@code 24 * 60 * 60 - 1}
-     * @return the local time, not null
-     * @throws DateTimeException if the second-of-day value is invalid
-     */
-    public static LocalTime ofSecondOfDay(int secondOfDay) {
-        SECOND_OF_DAY.checkValidValue(secondOfDay);
-        int hours = secondOfDay / SECONDS_PER_HOUR;
-        secondOfDay -= hours * SECONDS_PER_HOUR;
-        int minutes = secondOfDay / SECONDS_PER_MINUTE;
-        secondOfDay -= minutes * SECONDS_PER_MINUTE;
-        return create(hours, minutes, secondOfDay);
-    }
-
-
-    /**
-     * Creates a local time from the hour, minute, second and nanosecond fields.
-     * <p>
-     * This factory may return a cached value, but applications must not rely on this.
-     *
-     * @param hour  the hour-of-day to represent, validated from 0 to 23
-     * @param minute  the minute-of-hour to represent, validated from 0 to 59
-     * @param second  the second-of-minute to represent, validated from 0 to 59
-     * @return the local time, not null
-     */
-    private static LocalTime create(int hour, int minute, int second) {
-        if ((minute | second) == 0) {
-            return HOURS[hour];
-        }
-        return new LocalTime(hour, minute, second);
-    }
-
-    /**
-     * Constructor, previously validated.
-     *
-     * @param hour  the hour-of-day to represent, validated from 0 to 23
-     * @param minute  the minute-of-hour to represent, validated from 0 to 59
-     * @param second  the second-of-minute to represent, validated from 0 to 59
-     */
-    private LocalTime(int hour, int minute, int second) {
-        this.hour = (byte) hour;
-        this.minute = (byte) minute;
-        this.second = (byte) second;
-    }
-
-    /**
-     * Gets the hour-of-day field.
-     *
-     * @return the hour-of-day, from 0 to 23
-     */
-    public int getHour() {
-        return hour;
-    }
-
-    /**
-     * Gets the minute-of-hour field.
-     *
-     * @return the minute-of-hour, from 0 to 59
-     */
-    public int getMinute() {
-        return minute;
-    }
-
-    /**
-     * Gets the second-of-minute field.
-     *
-     * @return the second-of-minute, from 0 to 59
-     */
-    public int getSecond() {
-        return second;
-    }
-
-    /**
-     * Returns a copy of this {@code LocalTime} with the specified period in seconds added.
-     * <p>
-     * This adds the specified number of seconds to this time, returning a new time.
-     * The calculation wraps around midnight.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param secondstoAdd  the seconds to add, may be negative
-     * @return a {@code LocalTime} based on this time with the seconds added, not null
-     */
-    public LocalTime plusSeconds(long secondstoAdd) {
-        if (secondstoAdd == 0) {
-            return this;
-        }
-        int sofd = hour * SECONDS_PER_HOUR +
-                    minute * SECONDS_PER_MINUTE + second;
-        int newSofd = ((int) (secondstoAdd % SECONDS_PER_DAY) + sofd + SECONDS_PER_DAY) % SECONDS_PER_DAY;
-        if (sofd == newSofd) {
-            return this;
-        }
-        int newHour = newSofd / SECONDS_PER_HOUR;
-        int newMinute = (newSofd / SECONDS_PER_MINUTE) % MINUTES_PER_HOUR;
-        int newSecond = newSofd % SECONDS_PER_MINUTE;
-        return create(newHour, newMinute, newSecond);
-    }
-
-    /**
-     * Returns a copy of this {@code LocalTime} with the specified period in seconds subtracted.
-     * <p>
-     * This subtracts the specified number of seconds from this time, returning a new time.
-     * The calculation wraps around midnight.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param secondsToSubtract  the seconds to subtract, may be negative
-     * @return a {@code LocalTime} based on this time with the seconds subtracted, not null
-     */
-    public LocalTime minusSeconds(long secondsToSubtract) {
-        return plusSeconds(-(secondsToSubtract % SECONDS_PER_DAY));
-    }
-
-    /**
-     * Extracts the time as seconds of day,
-     * from {@code 0} to {@code 24 * 60 * 60 - 1}.
-     *
-     * @return the second-of-day equivalent to this time
-     */
-    public int toSecondOfDay() {
-        int total = hour * SECONDS_PER_HOUR;
-        total += minute * SECONDS_PER_MINUTE;
-        total += second;
-        return total;
-    }
-
-     /**
-     * Compares this {@code LocalTime} to another time.
-     * <p>
-     * The comparison is based on the time-line position of the local times within a day.
-     * It is "consistent with equals", as defined by {@link Comparable}.
-     *
-     * @param other  the other time to compare to, not null
-     * @return the comparator value, negative if less, positive if greater
-     * @throws NullPointerException if {@code other} is null
-     */
-    public int compareTo(LocalTime other) {
-        int cmp = Integer.compare(hour, other.hour);
-        if (cmp == 0) {
-            cmp = Integer.compare(minute, other.minute);
-            if (cmp == 0) {
-                cmp = Integer.compare(second, other.second);
-             }
-        }
-        return cmp;
-    }
-
-    /**
-     * Checks if this time is equal to another time.
-     * <p>
-     * The comparison is based on the time-line position of the time within a day.
-     * <p>
-     * Only objects of type {@code LocalTime} are compared, other types return false.
-     * To compare the date of two {@code TemporalAccessor} instances, use
-     * {@link ChronoField#NANO_OF_DAY} as a comparator.
-     *
-     * @param obj  the object to check, null returns false
-     * @return true if this is equal to the other time
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof LocalTime) {
-            LocalTime other = (LocalTime) obj;
-            return hour == other.hour && minute == other.minute &&
-                    second == other.second;
-        }
-        return false;
-    }
-
-    /**
-     * A hash code for this time.
-     *
-     * @return a suitable hash code
-     */
-    @Override
-    public int hashCode() {
-        long sod = toSecondOfDay();
-        return (int) (sod ^ (sod >>> 32));
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/TimeDefinition.java b/jdk/make/src/classes/build/tools/tzdb/TimeDefinition.java
deleted file mode 100644
index 8a5853db3d7..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/TimeDefinition.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import java.util.Objects;
-
-/**
- * A definition of the way a local time can be converted to the actual
- * transition date-time.
- * <p>
- * Time zone rules are expressed in one of three ways:
- * <p><ul>
- * <li>Relative to UTC</li>
- * <li>Relative to the standard offset in force</li>
- * <li>Relative to the wall offset (what you would see on a clock on the wall)</li>
- * </ul><p>
- */
-public enum TimeDefinition {
-    /** The local date-time is expressed in terms of the UTC offset. */
-    UTC,
-    /** The local date-time is expressed in terms of the wall offset. */
-    WALL,
-    /** The local date-time is expressed in terms of the standard offset. */
-    STANDARD;
-
-    /**
-     * Converts the specified local date-time to the local date-time actually
-     * seen on a wall clock.
-     * <p>
-     * This method converts using the type of this enum.
-     * The output is defined relative to the 'before' offset of the transition.
-     * <p>
-     * The UTC type uses the UTC offset.
-     * The STANDARD type uses the standard offset.
-     * The WALL type returns the input date-time.
-     * The result is intended for use with the wall-offset.
-     *
-     * @param dateTime  the local date-time, not null
-     * @param standardOffset  the standard offset, not null
-     * @param wallOffset  the wall offset, not null
-     * @return the date-time relative to the wall/before offset, not null
-     */
-    public LocalDateTime createDateTime(LocalDateTime dateTime, ZoneOffset standardOffset, ZoneOffset wallOffset) {
-        switch (this) {
-            case UTC: {
-                int difference = wallOffset.getTotalSeconds() - ZoneOffset.UTC.getTotalSeconds();
-                return dateTime.plusSeconds(difference);
-            }
-            case STANDARD: {
-                int difference = wallOffset.getTotalSeconds() - standardOffset.getTotalSeconds();
-                return dateTime.plusSeconds(difference);
-            }
-            default:  // WALL
-                return dateTime;
-        }
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java
index 9f1204ca7fe..8cbdd0d44ff 100644
--- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java
@@ -56,8 +56,6 @@
  */
 package build.tools.tzdb;
 
-import static build.tools.tzdb.Utils.*;
-
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.nio.charset.StandardCharsets;
@@ -179,15 +177,41 @@ public final class TzdbZoneRulesCompiler {
                 System.exit(1);
                 System.err.println("Source directory does not contain file: VERSION");
             }
+
+            // load source files
             printVerbose("Compiling TZDB version " + version);
-            // parse source files
-            for (Path file : srcFiles) {
-                printVerbose("Parsing file: " + file);
-                parseFile(file);
-            }
+            TzdbZoneRulesProvider provider = new TzdbZoneRulesProvider(srcFiles);
+
             // build zone rules
             printVerbose("Building rules");
-            buildZoneRules();
+
+            // Build the rules, zones and links into real zones.
+            SortedMap<String, ZoneRules> builtZones = new TreeMap<>();
+
+            // build zones
+            for (String zoneId : provider.getZoneIds()) {
+                printVerbose("Building zone " + zoneId);
+                builtZones.put(zoneId, provider.getZoneRules(zoneId));
+            }
+
+            // build aliases
+            Map<String, String> links = provider.getAliasMap();
+            for (String aliasId : links.keySet()) {
+                String realId = links.get(aliasId);
+                printVerbose("Linking alias " + aliasId + " to " + realId);
+                ZoneRules realRules = builtZones.get(realId);
+                if (realRules == null) {
+                    realId = links.get(realId);  // try again (handle alias liked to alias)
+                    printVerbose("Relinking alias " + aliasId + " to " + realId);
+                    realRules = builtZones.get(realId);
+                    if (realRules == null) {
+                        throw new IllegalArgumentException("Alias '" + aliasId + "' links to invalid zone '" + realId);
+                    }
+                    links.put(aliasId, realId);
+                }
+                builtZones.put(aliasId, realRules);
+            }
+
             // output to file
             printVerbose("Outputting tzdb file: " + dstFile);
             outputFile(dstFile, version, builtZones, links);
@@ -269,361 +293,13 @@ public final class TzdbZoneRulesCompiler {
         }
     }
 
-    private static final Pattern YEAR = Pattern.compile("(?i)(?<min>min)|(?<max>max)|(?<only>only)|(?<year>[0-9]+)");
-    private static final Pattern MONTH = Pattern.compile("(?i)(jan)|(feb)|(mar)|(apr)|(may)|(jun)|(jul)|(aug)|(sep)|(oct)|(nov)|(dec)");
-    private static final Matcher DOW = Pattern.compile("(?i)(mon)|(tue)|(wed)|(thu)|(fri)|(sat)|(sun)").matcher("");
-    private static final Matcher TIME = Pattern.compile("(?<neg>-)?+(?<hour>[0-9]{1,2})(:(?<minute>[0-5][0-9]))?+(:(?<second>[0-5][0-9]))?+").matcher("");
-
-    /** The TZDB rules. */
-    private final Map<String, List<TZDBRule>> rules = new HashMap<>();
-
-    /** The TZDB zones. */
-    private final Map<String, List<TZDBZone>> zones = new HashMap<>();
-
-    /** The TZDB links. */
-    private final Map<String, String> links = new HashMap<>();
-
-    /** The built zones. */
-    private final SortedMap<String, ZoneRules> builtZones = new TreeMap<>();
-
     /** Whether to output verbose messages. */
     private boolean verbose;
 
     /**
      * private contructor
      */
-    private TzdbZoneRulesCompiler() {
-    }
-
-    /**
-     * Parses a source file.
-     *
-     * @param file  the file being read, not null
-     * @throws Exception if an error occurs
-     */
-    private void parseFile(Path file) throws Exception {
-        int lineNumber = 1;
-        String line = null;
-        try {
-            List<String> lines = Files.readAllLines(file, StandardCharsets.ISO_8859_1);
-            List<TZDBZone> openZone = null;
-            for (; lineNumber < lines.size(); lineNumber++) {
-                line = lines.get(lineNumber);
-                int index = line.indexOf('#');  // remove comments (doesn't handle # in quotes)
-                if (index >= 0) {
-                    line = line.substring(0, index);
-                }
-                if (line.trim().length() == 0) {  // ignore blank lines
-                    continue;
-                }
-                Scanner s = new Scanner(line);
-                if (openZone != null && Character.isWhitespace(line.charAt(0)) && s.hasNext()) {
-                    if (parseZoneLine(s, openZone)) {
-                        openZone = null;
-                    }
-                } else {
-                    if (s.hasNext()) {
-                        String first = s.next();
-                        if (first.equals("Zone")) {
-                            openZone = new ArrayList<>();
-                            try {
-                                zones.put(s.next(), openZone);
-                                if (parseZoneLine(s, openZone)) {
-                                    openZone = null;
-                                }
-                            } catch (NoSuchElementException x) {
-                                printVerbose("Invalid Zone line in file: " + file + ", line: " + line);
-                                throw new IllegalArgumentException("Invalid Zone line");
-                            }
-                        } else {
-                            openZone = null;
-                            if (first.equals("Rule")) {
-                                try {
-                                    parseRuleLine(s);
-                                } catch (NoSuchElementException x) {
-                                    printVerbose("Invalid Rule line in file: " + file + ", line: " + line);
-                                    throw new IllegalArgumentException("Invalid Rule line");
-                                }
-                            } else if (first.equals("Link")) {
-                                try {
-                                    String realId = s.next();
-                                    String aliasId = s.next();
-                                    links.put(aliasId, realId);
-                                } catch (NoSuchElementException x) {
-                                    printVerbose("Invalid Link line in file: " + file + ", line: " + line);
-                                    throw new IllegalArgumentException("Invalid Link line");
-                                }
-
-                            } else {
-                                throw new IllegalArgumentException("Unknown line");
-                            }
-                        }
-                    }
-                }
-            }
-        } catch (Exception ex) {
-            throw new Exception("Failed while parsing file '" + file + "' on line " + lineNumber + " '" + line + "'", ex);
-        }
-    }
-
-    /**
-     * Parses a Rule line.
-     *
-     * @param s  the line scanner, not null
-     */
-    private void parseRuleLine(Scanner s) {
-        TZDBRule rule = new TZDBRule();
-        String name = s.next();
-        if (rules.containsKey(name) == false) {
-            rules.put(name, new ArrayList<TZDBRule>());
-        }
-        rules.get(name).add(rule);
-        rule.startYear = parseYear(s, 0);
-        rule.endYear = parseYear(s, rule.startYear);
-        if (rule.startYear > rule.endYear) {
-            throw new IllegalArgumentException("Year order invalid: " + rule.startYear + " > " + rule.endYear);
-        }
-        parseOptional(s.next());  // type is unused
-        parseMonthDayTime(s, rule);
-        rule.savingsAmount = parsePeriod(s.next());
-        rule.text = parseOptional(s.next());
-    }
-
-    /**
-     * Parses a Zone line.
-     *
-     * @param s  the line scanner, not null
-     * @return true if the zone is complete
-     */
-    private boolean parseZoneLine(Scanner s, List<TZDBZone> zoneList) {
-        TZDBZone zone = new TZDBZone();
-        zoneList.add(zone);
-        zone.standardOffset = parseOffset(s.next());
-        String savingsRule = parseOptional(s.next());
-        if (savingsRule == null) {
-            zone.fixedSavingsSecs = 0;
-            zone.savingsRule = null;
-        } else {
-            try {
-                zone.fixedSavingsSecs = parsePeriod(savingsRule);
-                zone.savingsRule = null;
-            } catch (Exception ex) {
-                zone.fixedSavingsSecs = null;
-                zone.savingsRule = savingsRule;
-            }
-        }
-        zone.text = s.next();
-        if (s.hasNext()) {
-            zone.year = Integer.parseInt(s.next());
-            if (s.hasNext()) {
-                parseMonthDayTime(s, zone);
-            }
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * Parses a Rule line.
-     *
-     * @param s  the line scanner, not null
-     * @param mdt  the object to parse into, not null
-     */
-    private void parseMonthDayTime(Scanner s, TZDBMonthDayTime mdt) {
-        mdt.month = parseMonth(s);
-        if (s.hasNext()) {
-            String dayRule = s.next();
-            if (dayRule.startsWith("last")) {
-                mdt.dayOfMonth = -1;
-                mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(4));
-                mdt.adjustForwards = false;
-            } else {
-                int index = dayRule.indexOf(">=");
-                if (index > 0) {
-                    mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(0, index));
-                    dayRule = dayRule.substring(index + 2);
-                } else {
-                    index = dayRule.indexOf("<=");
-                    if (index > 0) {
-                        mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(0, index));
-                        mdt.adjustForwards = false;
-                        dayRule = dayRule.substring(index + 2);
-                    }
-                }
-                mdt.dayOfMonth = Integer.parseInt(dayRule);
-            }
-            if (s.hasNext()) {
-                String timeStr = s.next();
-                int secsOfDay = parseSecs(timeStr);
-                if (secsOfDay == 86400) {
-                    mdt.endOfDay = true;
-                    secsOfDay = 0;
-                }
-                LocalTime time = LocalTime.ofSecondOfDay(secsOfDay);
-                mdt.time = time;
-                mdt.timeDefinition = parseTimeDefinition(timeStr.charAt(timeStr.length() - 1));
-            }
-        }
-    }
-
-    private int parseYear(Scanner s, int defaultYear) {
-        if (s.hasNext(YEAR)) {
-            s.next(YEAR);
-            MatchResult mr = s.match();
-            if (mr.group(1) != null) {
-                return 1900;  // systemv has min
-            } else if (mr.group(2) != null) {
-                return YEAR_MAX_VALUE;
-            } else if (mr.group(3) != null) {
-                return defaultYear;
-            }
-            return Integer.parseInt(mr.group(4));
-            /*
-            if (mr.group("min") != null) {
-                //return YEAR_MIN_VALUE;
-                return 1900;  // systemv has min
-            } else if (mr.group("max") != null) {
-                return YEAR_MAX_VALUE;
-            } else if (mr.group("only") != null) {
-                return defaultYear;
-            }
-            return Integer.parseInt(mr.group("year"));
-            */
-        }
-        throw new IllegalArgumentException("Unknown year: " + s.next());
-    }
-
-    private int parseMonth(Scanner s) {
-        if (s.hasNext(MONTH)) {
-            s.next(MONTH);
-            for (int moy = 1; moy < 13; moy++) {
-                if (s.match().group(moy) != null) {
-                    return moy;
-                }
-            }
-        }
-        throw new IllegalArgumentException("Unknown month: " + s.next());
-    }
-
-    private int parseDayOfWeek(String str) {
-        if (DOW.reset(str).matches()) {
-            for (int dow = 1; dow < 8; dow++) {
-                if (DOW.group(dow) != null) {
-                    return dow;
-                }
-            }
-        }
-        throw new IllegalArgumentException("Unknown day-of-week: " + str);
-    }
-
-    private String parseOptional(String str) {
-        return str.equals("-") ? null : str;
-    }
-
-    private int parseSecs(String str) {
-        if (str.equals("-")) {
-            return 0;
-        }
-        try {
-            if (TIME.reset(str).find()) {
-                int secs = Integer.parseInt(TIME.group("hour")) * 60 * 60;
-                if (TIME.group("minute") != null) {
-                    secs += Integer.parseInt(TIME.group("minute")) * 60;
-                }
-                if (TIME.group("second") != null) {
-                    secs += Integer.parseInt(TIME.group("second"));
-                }
-                if (TIME.group("neg") != null) {
-                    secs = -secs;
-                }
-                return secs;
-            }
-        } catch (NumberFormatException x) {}
-        throw new IllegalArgumentException(str);
-    }
-
-    private ZoneOffset parseOffset(String str) {
-        int secs = parseSecs(str);
-        return ZoneOffset.ofTotalSeconds(secs);
-    }
-
-    private int parsePeriod(String str) {
-        return parseSecs(str);
-    }
-
-    private TimeDefinition parseTimeDefinition(char c) {
-        switch (c) {
-            case 's':
-            case 'S':
-                // standard time
-                return TimeDefinition.STANDARD;
-            case 'u':
-            case 'U':
-            case 'g':
-            case 'G':
-            case 'z':
-            case 'Z':
-                // UTC
-                return TimeDefinition.UTC;
-            case 'w':
-            case 'W':
-            default:
-                // wall time
-                return TimeDefinition.WALL;
-        }
-    }
-
-    /**
-     * Build the rules, zones and links into real zones.
-     *
-     * @throws Exception if an error occurs
-     */
-    private void buildZoneRules() throws Exception {
-        // build zones
-        for (String zoneId : zones.keySet()) {
-            printVerbose("Building zone " + zoneId);
-            List<TZDBZone> tzdbZones = zones.get(zoneId);
-            ZoneRulesBuilder bld = new ZoneRulesBuilder();
-            for (TZDBZone tzdbZone : tzdbZones) {
-                bld = tzdbZone.addToBuilder(bld, rules);
-            }
-            builtZones.put(zoneId, bld.toRules(zoneId));
-        }
-
-        // build aliases
-        for (String aliasId : links.keySet()) {
-            String realId = links.get(aliasId);
-            printVerbose("Linking alias " + aliasId + " to " + realId);
-            ZoneRules realRules = builtZones.get(realId);
-            if (realRules == null) {
-                realId = links.get(realId);  // try again (handle alias liked to alias)
-                printVerbose("Relinking alias " + aliasId + " to " + realId);
-                realRules = builtZones.get(realId);
-                if (realRules == null) {
-                    throw new IllegalArgumentException("Alias '" + aliasId + "' links to invalid zone '" + realId);
-                }
-                links.put(aliasId, realId);
-            }
-            builtZones.put(aliasId, realRules);
-        }
-        // remove UTC and GMT
-        // builtZones.remove("UTC");
-        // builtZones.remove("GMT");
-        // builtZones.remove("GMT0");
-        builtZones.remove("GMT+0");
-        builtZones.remove("GMT-0");
-        links.remove("GMT+0");
-        links.remove("GMT-0");
-        // remove ROC, which is not supported in j.u.tz
-        builtZones.remove("ROC");
-        links.remove("ROC");
-        // remove EST, HST and MST. They are supported via
-        // the short-id mapping
-        builtZones.remove("EST");
-        builtZones.remove("HST");
-        builtZones.remove("MST");
-    }
+    private TzdbZoneRulesCompiler() {}
 
     /**
      * Prints a verbose message.
@@ -635,109 +311,4 @@ public final class TzdbZoneRulesCompiler {
             System.out.println(message);
         }
     }
-
-    /**
-     * Class representing a month-day-time in the TZDB file.
-     */
-    abstract class TZDBMonthDayTime {
-        /** The month of the cutover. */
-        int month = 1;
-        /** The day-of-month of the cutover. */
-        int dayOfMonth = 1;
-        /** Whether to adjust forwards. */
-        boolean adjustForwards = true;
-        /** The day-of-week of the cutover. */
-        int dayOfWeek = -1;
-        /** The time of the cutover. */
-        LocalTime time = LocalTime.MIDNIGHT;
-        /** Whether this is midnight end of day. */
-        boolean endOfDay;
-        /** The time of the cutover. */
-        TimeDefinition timeDefinition = TimeDefinition.WALL;
-        void adjustToFowards(int year) {
-            if (adjustForwards == false && dayOfMonth > 0) {
-                LocalDate adjustedDate = LocalDate.of(year, month, dayOfMonth).minusDays(6);
-                dayOfMonth = adjustedDate.getDayOfMonth();
-                month = adjustedDate.getMonth();
-                adjustForwards = true;
-            }
-        }
-    }
-
-    /**
-     * Class representing a rule line in the TZDB file.
-     */
-    final class TZDBRule extends TZDBMonthDayTime {
-        /** The start year. */
-        int startYear;
-        /** The end year. */
-        int endYear;
-        /** The amount of savings. */
-        int savingsAmount;
-        /** The text name of the zone. */
-        String text;
-
-        void addToBuilder(ZoneRulesBuilder bld) {
-            adjustToFowards(2004);  // irrelevant, treat as leap year
-            bld.addRuleToWindow(startYear, endYear, month, dayOfMonth, dayOfWeek, time, endOfDay, timeDefinition, savingsAmount);
-        }
-    }
-
-    /**
-     * Class representing a linked set of zone lines in the TZDB file.
-     */
-    final class TZDBZone extends TZDBMonthDayTime {
-        /** The standard offset. */
-        ZoneOffset standardOffset;
-        /** The fixed savings amount. */
-        Integer fixedSavingsSecs;
-        /** The savings rule. */
-        String savingsRule;
-        /** The text name of the zone. */
-        String text;
-        /** The year of the cutover. */
-        int year = YEAR_MAX_VALUE;
-
-        ZoneRulesBuilder addToBuilder(ZoneRulesBuilder bld, Map<String, List<TZDBRule>> rules) {
-            if (year != YEAR_MAX_VALUE) {
-                bld.addWindow(standardOffset, toDateTime(year), timeDefinition);
-            } else {
-                bld.addWindowForever(standardOffset);
-            }
-            if (fixedSavingsSecs != null) {
-                bld.setFixedSavingsToWindow(fixedSavingsSecs);
-            } else {
-                List<TZDBRule> tzdbRules = rules.get(savingsRule);
-                if (tzdbRules == null) {
-                    throw new IllegalArgumentException("Rule not found: " + savingsRule);
-                }
-                for (TZDBRule tzdbRule : tzdbRules) {
-                    tzdbRule.addToBuilder(bld);
-                }
-            }
-            return bld;
-        }
-
-        private LocalDateTime toDateTime(int year) {
-            adjustToFowards(year);
-            LocalDate date;
-            if (dayOfMonth == -1) {
-                dayOfMonth = lengthOfMonth(month, isLeapYear(year));
-                date = LocalDate.of(year, month, dayOfMonth);
-                if (dayOfWeek != -1) {
-                    date = previousOrSame(date, dayOfWeek);
-                }
-            } else {
-                date = LocalDate.of(year, month, dayOfMonth);
-                if (dayOfWeek != -1) {
-                    date = nextOrSame(date, dayOfWeek);
-                }
-            }
-            LocalDateTime ldt = LocalDateTime.of(date, time);
-            if (endOfDay) {
-                ldt = ldt.plusDays(1);
-            }
-            return ldt;
-        }
-    }
 }
diff --git a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
new file mode 100644
index 00000000000..220de9276c7
--- /dev/null
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
@@ -0,0 +1,843 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package build.tools.tzdb;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.NavigableMap;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+import java.time.*;
+import java.time.Year;
+import java.time.chrono.IsoChronology;
+import java.time.temporal.TemporalAdjusters;
+import java.time.zone.ZoneOffsetTransition;
+import java.time.zone.ZoneOffsetTransitionRule;
+import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;
+import java.time.zone.ZoneRulesException;
+
+/**
+ * Compile and build time-zone rules from IANA timezone data
+ *
+ * @author Xueming Shen
+ * @author Stephen Colebourne
+ * @author Michael Nascimento Santos
+ *
+ * @since   1.9
+ */
+
+class TzdbZoneRulesProvider {
+
+    /**
+     * Creates an instance.
+     *
+     * @throws ZoneRulesException if unable to load
+     */
+    public TzdbZoneRulesProvider(List<Path> files) {
+        try {
+             load(files);
+        } catch (Exception ex) {
+            throw new ZoneRulesException("Unable to load TZDB time-zone rules", ex);
+        }
+    }
+
+    public Set<String> getZoneIds() {
+        return new TreeSet(regionIds);
+    }
+
+    public Map<String, String> getAliasMap() {
+        return links;
+    }
+
+    public ZoneRules getZoneRules(String zoneId) {
+        Object obj = zones.get(zoneId);
+        if (obj == null) {
+            String zoneId0 = zoneId;
+            if (links.containsKey(zoneId)) {
+                zoneId = links.get(zoneId);
+                obj = zones.get(zoneId);
+            }
+            if (obj == null) {
+                throw new ZoneRulesException("Unknown time-zone ID: " + zoneId0);
+            }
+        }
+        if (obj instanceof ZoneRules) {
+            return (ZoneRules)obj;
+        }
+        try {
+            ZoneRules zrules = buildRules(zoneId, (List<ZoneLine>)obj);
+            zones.put(zoneId, zrules);
+            return zrules;
+        } catch (Exception ex) {
+            throw new ZoneRulesException(
+                "Invalid binary time-zone data: TZDB:" + zoneId, ex);
+        }
+    }
+
+    //////////////////////////////////////////////////////////////////////
+
+    /**
+     * All the regions that are available.
+     */
+    private List<String> regionIds = new ArrayList<>(600);
+
+    /**
+     * Zone region to rules mapping
+     */
+    private final Map<String, Object> zones = new ConcurrentHashMap<>();
+
+    /**
+     * compatibility list
+     */
+    private static HashSet<String> excludedZones;
+    static {
+        // (1) exclude EST, HST and MST. They are supported
+        //     via the short-id mapping
+        // (2) remove UTC and GMT
+        // (3) remove ROC, which is not supported in j.u.tz
+        excludedZones = new HashSet<>(10);
+        excludedZones.add("EST");
+        excludedZones.add("HST");
+        excludedZones.add("MST");
+        excludedZones.add("GMT+0");
+        excludedZones.add("GMT-0");
+        excludedZones.add("ROC");
+    }
+
+    private Map<String, String> links = new HashMap<>(150);
+    private Map<String, List<RuleLine>> rules = new HashMap<>(500);
+
+    private void load(List<Path> files) throws IOException {
+
+        for (Path file : files) {
+            List<ZoneLine> openZone = null;
+            try {
+                for (String line : Files.readAllLines(file, StandardCharsets.ISO_8859_1)) {
+                    if (line.length() == 0 || line.charAt(0) == '#') {
+                        continue;
+                    }
+                    //StringIterator itr = new StringIterator(line);
+                    String[] tokens = split(line);
+                    if (openZone != null &&               // continuing zone line
+                        Character.isWhitespace(line.charAt(0)) &&
+                        tokens.length > 0) {
+                        ZoneLine zLine = new ZoneLine();
+                        openZone.add(zLine);
+                        if (zLine.parse(tokens, 0)) {
+                            openZone = null;
+                        }
+                        continue;
+                    }
+                    if (line.startsWith("Zone")) {        // parse Zone line
+                        String name = tokens[1];
+                        if (excludedZones.contains(name)){
+                            continue;
+                        }
+                        if (zones.containsKey(name)) {
+                            throw new IllegalArgumentException(
+                                "Duplicated zone name in file: " + name +
+                                ", line: [" + line + "]");
+                        }
+                        openZone = new ArrayList<>(10);
+                        zones.put(name, openZone);
+                        regionIds.add(name);
+                        ZoneLine zLine = new ZoneLine();
+                        openZone.add(zLine);
+                        if (zLine.parse(tokens, 2)) {
+                            openZone = null;
+                        }
+                    } else if (line.startsWith("Rule")) { // parse Rule line
+                        String name = tokens[1];
+                        if (!rules.containsKey(name)) {
+                            rules.put(name, new ArrayList<RuleLine>(10));
+                        }
+                        rules.get(name).add(new RuleLine().parse(tokens));
+                    } else if (line.startsWith("Link")) { // parse link line
+                        if (tokens.length >= 3) {
+                            String realId = tokens[1];
+                            String aliasId = tokens[2];
+                            if (excludedZones.contains(aliasId)){
+                                continue;
+                            }
+                            links.put(aliasId, realId);
+                            regionIds.add(aliasId);
+                        } else {
+                            throw new IllegalArgumentException(
+                                "Invalid Link line in file" +
+                                file + ", line: [" + line + "]");
+                        }
+                    } else {
+                        // skip unknown line
+                    }
+                }
+
+            } catch (Exception ex) {
+                throw new RuntimeException("Failed while processing file [" + file +
+                                           "]", ex);
+            }
+        }
+    }
+
+    private String[] split(String str) {
+        int off = 0;
+        int end = str.length();
+        ArrayList<String> list = new ArrayList<>(10);
+        while (off < end) {
+            char c = str.charAt(off);
+            if (c == '\t' || c == ' ') {
+                off++;
+                continue;
+            }
+            if (c == '#') {    // comment
+                break;
+            }
+            int start = off;
+            while (off < end) {
+                c = str.charAt(off);
+                if (c == ' ' || c == '\t') {
+                    break;
+                }
+                off++;
+            }
+            if (start != off) {
+                list.add(str.substring(start, off));
+            }
+        }
+        return list.toArray(new String[list.size()]);
+    }
+
+    /**
+     * Class representing a month-day-time in the TZDB file.
+     */
+    private static abstract class MonthDayTime {
+        /** The month of the cutover. */
+        Month month = Month.JANUARY;
+
+        /** The day-of-month of the cutover. */
+        int dayOfMonth = 1;
+
+        /** Whether to adjust forwards. */
+        boolean adjustForwards = true;
+
+        /** The day-of-week of the cutover. */
+        DayOfWeek dayOfWeek;
+
+        /** The time of the cutover, in second of day */
+        int secsOfDay = 0;
+
+        /** Whether this is midnight end of day. */
+        boolean endOfDay;
+        /** The time of the cutover. */
+
+        TimeDefinition timeDefinition = TimeDefinition.WALL;
+
+        void adjustToForwards(int year) {
+            if (adjustForwards == false && dayOfMonth > 0) {
+                // weekDay<=monthDay case, don't have it in tzdb data for now
+                LocalDate adjustedDate = LocalDate.of(year, month, dayOfMonth).minusDays(6);
+                dayOfMonth = adjustedDate.getDayOfMonth();
+                month = adjustedDate.getMonth();
+                adjustForwards = true;
+            }
+        }
+
+        LocalDateTime toDateTime(int year) {
+            LocalDate date;
+            if (dayOfMonth < 0) {
+                int monthLen = month.length(IsoChronology.INSTANCE.isLeapYear(year));
+                date = LocalDate.of(year, month, monthLen + 1 + dayOfMonth);
+                if (dayOfWeek != null) {
+                    date = date.with(TemporalAdjusters.previousOrSame(dayOfWeek));
+                }
+            } else {
+                date = LocalDate.of(year, month, dayOfMonth);
+                if (dayOfWeek != null) {
+                    date = date.with(TemporalAdjusters.nextOrSame(dayOfWeek));
+                }
+            }
+            if (endOfDay) {
+                date = date.plusDays(1);
+            }
+            return LocalDateTime.of(date, LocalTime.ofSecondOfDay(secsOfDay));
+        }
+
+        /**
+         * Parses the MonthDaytime segment of a tzdb line.
+         */
+        private void parse(String[] tokens, int off) {
+            month = parseMonth(tokens[off++]);
+            if (off < tokens.length) {
+                String dayRule = tokens[off++];
+                if (dayRule.startsWith("last")) {
+                    dayOfMonth = -1;
+                    dayOfWeek = parseDayOfWeek(dayRule.substring(4));
+                    adjustForwards = false;
+                } else {
+                    int index = dayRule.indexOf(">=");
+                    if (index > 0) {
+                        dayOfWeek = parseDayOfWeek(dayRule.substring(0, index));
+                        dayRule = dayRule.substring(index + 2);
+                    } else {
+                        index = dayRule.indexOf("<=");
+                        if (index > 0) {
+                            dayOfWeek = parseDayOfWeek(dayRule.substring(0, index));
+                            adjustForwards = false;
+                            dayRule = dayRule.substring(index + 2);
+                        }
+                    }
+                    dayOfMonth = Integer.parseInt(dayRule);
+                    if (dayOfMonth < -28 || dayOfMonth > 31 || dayOfMonth == 0) {
+                       throw new IllegalArgumentException(
+                          "Day of month indicator must be between -28 and 31 inclusive excluding zero");
+                    }
+                }
+                if (off < tokens.length) {
+                    String timeStr = tokens[off++];
+                    secsOfDay = parseSecs(timeStr);
+                    if (secsOfDay == 86400) {
+                        // time must be midnight when end of day flag is true
+                        endOfDay = true;
+                        secsOfDay = 0;
+                    }
+                    timeDefinition = parseTimeDefinition(timeStr.charAt(timeStr.length() - 1));
+                }
+            }
+        }
+
+        int parseYear(String year, int defaultYear) {
+            switch (year.toLowerCase()) {
+            case "min":  return 1900;
+            case "max":  return Year.MAX_VALUE;
+            case "only": return defaultYear;
+            }
+            return Integer.parseInt(year);
+        }
+
+        Month parseMonth(String mon) {
+            switch (mon) {
+            case "Jan": return Month.JANUARY;
+            case "Feb": return Month.FEBRUARY;
+            case "Mar": return Month.MARCH;
+            case "Apr": return Month.APRIL;
+            case "May": return Month.MAY;
+            case "Jun": return Month.JUNE;
+            case "Jul": return Month.JULY;
+            case "Aug": return Month.AUGUST;
+            case "Sep": return Month.SEPTEMBER;
+            case "Oct": return Month.OCTOBER;
+            case "Nov": return Month.NOVEMBER;
+            case "Dec": return Month.DECEMBER;
+            }
+            throw new IllegalArgumentException("Unknown month: " + mon);
+        }
+
+        DayOfWeek parseDayOfWeek(String dow) {
+            switch (dow) {
+            case "Mon": return DayOfWeek.MONDAY;
+            case "Tue": return DayOfWeek.TUESDAY;
+            case "Wed": return DayOfWeek.WEDNESDAY;
+            case "Thu": return DayOfWeek.THURSDAY;
+            case "Fri": return DayOfWeek.FRIDAY;
+            case "Sat": return DayOfWeek.SATURDAY;
+            case "Sun": return DayOfWeek.SUNDAY;
+            }
+            throw new IllegalArgumentException("Unknown day-of-week: " + dow);
+        }
+
+        String parseOptional(String str) {
+            return str.equals("-") ? null : str;
+        }
+
+        static final boolean isDigit(char c) {
+            return c >= '0' && c <= '9';
+        }
+
+        private int parseSecs(String time) {
+            if (time.equals("-")) {
+                return 0;
+            }
+            // faster hack
+            int secs = 0;
+            int sign = 1;
+            int off = 0;
+            int len = time.length();
+            if (off < len && time.charAt(off) == '-') {
+                sign = -1;
+                off++;
+            }
+            char c0, c1;
+            if (off < len && isDigit(c0 = time.charAt(off++))) {
+                int hour = c0 - '0';
+                if (off < len && isDigit(c1 = time.charAt(off))) {
+                    hour = hour * 10 + c1 - '0';
+                    off++;
+                }
+                secs = hour * 60 * 60;
+                if (off < len && time.charAt(off++) == ':') {
+                    if (off + 1 < len &&
+                        isDigit(c0 = time.charAt(off++)) &&
+                        isDigit(c1 = time.charAt(off++))) {
+                        // minutes
+                        secs += ((c0 - '0') * 10 + c1 - '0') * 60;
+                        if (off < len && time.charAt(off++) == ':') {
+                            if (off + 1 < len &&
+                                isDigit(c0 = time.charAt(off++)) &&
+                                isDigit(c1 = time.charAt(off++))) {
+                                // seconds
+                                secs += ((c0 - '0') * 10 + c1 - '0');
+                            }
+                        }
+                    }
+
+                }
+                return secs * sign;
+            }
+            throw new IllegalArgumentException("[" + time + "]");
+        }
+
+        int parseOffset(String str) {
+            int secs = parseSecs(str);
+            if (Math.abs(secs) > 18 * 60 * 60) {
+                throw new IllegalArgumentException(
+                    "Zone offset not in valid range: -18:00 to +18:00");
+            }
+            return secs;
+        }
+
+        int parsePeriod(String str) {
+            return parseSecs(str);
+        }
+
+        TimeDefinition parseTimeDefinition(char c) {
+            switch (c) {
+            case 's':
+            case 'S':
+                // standard time
+                return TimeDefinition.STANDARD;
+            case 'u':
+            case 'U':
+            case 'g':
+            case 'G':
+            case 'z':
+            case 'Z':
+                // UTC
+                return TimeDefinition.UTC;
+            case 'w':
+            case 'W':
+            default:
+                // wall time
+                return TimeDefinition.WALL;
+            }
+        }
+    }
+
+    /**
+     * Class representing a rule line in the TZDB file.
+     */
+    private static class RuleLine extends MonthDayTime {
+        /** The start year. */
+        int startYear;
+
+        /** The end year. */
+        int endYear;
+
+        /** The amount of savings, in seconds. */
+        int savingsAmount;
+
+        /** The text name of the zone. */
+        String text;
+
+        /**
+         * Converts this to a transition rule.
+         *
+         * @param standardOffset  the active standard offset, not null
+         * @param savingsBeforeSecs  the active savings before the transition in seconds
+         * @return the transition, not null
+        */
+        ZoneOffsetTransitionRule toTransitionRule(ZoneOffset stdOffset, int savingsBefore) {
+            // rule shared by different zones, so don't change it
+            Month month = this.month;
+            int dayOfMonth = this.dayOfMonth;
+            DayOfWeek dayOfWeek = this.dayOfWeek;
+            boolean endOfDay = this.endOfDay;
+
+            // optimize stored format
+            if (dayOfMonth < 0) {
+                if (month != Month.FEBRUARY) {    // not Month.FEBRUARY
+                    dayOfMonth = month.maxLength() - 6;
+                }
+            }
+            if (endOfDay && dayOfMonth > 0 &&
+                (dayOfMonth == 28 && month == Month.FEBRUARY) == false) {
+                LocalDate date = LocalDate.of(2004, month, dayOfMonth).plusDays(1);  // leap-year
+                month = date.getMonth();
+                dayOfMonth = date.getDayOfMonth();
+                if (dayOfWeek != null) {
+                    dayOfWeek = dayOfWeek.plus(1);
+                }
+                endOfDay = false;
+            }
+            // build rule
+            return ZoneOffsetTransitionRule.of(
+                    //month, dayOfMonth, dayOfWeek, time, endOfDay, timeDefinition,
+                    month, dayOfMonth, dayOfWeek,
+                    LocalTime.ofSecondOfDay(secsOfDay), endOfDay, timeDefinition,
+                    stdOffset,
+                    ZoneOffset.ofTotalSeconds(stdOffset.getTotalSeconds() + savingsBefore),
+                    ZoneOffset.ofTotalSeconds(stdOffset.getTotalSeconds() + savingsAmount));
+        }
+
+        RuleLine parse(String[] tokens) {
+            startYear = parseYear(tokens[2], 0);
+            endYear = parseYear(tokens[3], startYear);
+            if (startYear > endYear) {
+                throw new IllegalArgumentException(
+                    "Invalid <Rule> line/Year order invalid:" + startYear + " > " + endYear);
+            }
+            //parseOptional(s.next());  // type is unused
+            super.parse(tokens, 5);     // monthdaytime parsing
+            savingsAmount = parsePeriod(tokens[8]);
+            //rule.text = parseOptional(s.next());
+            return this;
+        }
+    }
+
+    /**
+     * Class representing a linked set of zone lines in the TZDB file.
+     */
+    private static class ZoneLine extends MonthDayTime {
+        /** The standard offset. */
+        int stdOffsetSecs;
+
+        /** The fixed savings amount. */
+        int fixedSavingsSecs = 0;
+
+        /** The savings rule. */
+        String savingsRule;
+
+        /** The text name of the zone. */
+        String text;
+
+        /** The cutover year */
+        int year = Year.MAX_VALUE;
+
+        /** The cutover date time */
+        LocalDateTime ldt;
+
+        /** The cutover date/time in epoch seconds/UTC */
+        long ldtSecs = Long.MIN_VALUE;
+
+        LocalDateTime toDateTime() {
+            if (ldt == null) {
+                ldt = toDateTime(year);
+            }
+            return ldt;
+        }
+
+        /**
+         * Creates the date-time epoch second in the wall offset for the local
+         * date-time at the end of the window.
+         *
+         * @param savingsSecs  the amount of savings in use in seconds
+         * @return the created date-time epoch second in the wall offset, not null
+         */
+        long toDateTimeEpochSecond(int savingsSecs) {
+            if (ldtSecs == Long.MIN_VALUE) {
+                ldtSecs = toDateTime().toEpochSecond(ZoneOffset.UTC);
+            }
+            switch(timeDefinition) {
+            case UTC:      return ldtSecs;
+            case STANDARD: return ldtSecs - stdOffsetSecs;
+            default:       return ldtSecs - (stdOffsetSecs + savingsSecs); // WALL
+            }
+        }
+
+        boolean parse(String[] tokens, int off) {
+            stdOffsetSecs = parseOffset(tokens[off++]);
+            savingsRule = parseOptional(tokens[off++]);
+            if (savingsRule != null && savingsRule.length() > 0 &&
+                (savingsRule.charAt(0) == '-' || isDigit(savingsRule.charAt(0)))) {
+                try {
+                    fixedSavingsSecs = parsePeriod(savingsRule);
+                    savingsRule = null;
+                } catch (Exception ex) {
+                    fixedSavingsSecs = 0;
+                }
+            }
+            text = tokens[off++];
+            if (off < tokens.length) {
+                year = Integer.parseInt(tokens[off++]);
+                if (off < tokens.length) {
+                    super.parse(tokens, off);  // MonthDayTime
+                }
+                return false;
+            } else {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * Class representing a rule line in the TZDB file for a particular year.
+     */
+    private static class TransRule implements Comparable<TransRule>
+    {
+        private int year;
+        private RuleLine rule;
+
+        /** The trans date/time */
+        private LocalDateTime ldt;
+
+        /** The trans date/time in epoch seconds (assume UTC) */
+        long ldtSecs;
+
+        TransRule(int year, RuleLine rule) {
+            this.year = year;
+            this.rule = rule;
+            this.ldt = rule.toDateTime(year);
+            this.ldtSecs = ldt.toEpochSecond(ZoneOffset.UTC);
+        }
+
+        ZoneOffsetTransition toTransition(ZoneOffset standardOffset, int savingsBeforeSecs) {
+            // copy of code in ZoneOffsetTransitionRule to avoid infinite loop
+            ZoneOffset wallOffset = ZoneOffset.ofTotalSeconds(
+                standardOffset.getTotalSeconds() + savingsBeforeSecs);
+            ZoneOffset offsetAfter = ZoneOffset.ofTotalSeconds(
+                standardOffset.getTotalSeconds() + rule.savingsAmount);
+            LocalDateTime dt = rule.timeDefinition
+                                   .createDateTime(ldt, standardOffset, wallOffset);
+            return ZoneOffsetTransition.of(dt, wallOffset, offsetAfter);
+        }
+
+        long toEpochSecond(ZoneOffset stdOffset, int savingsBeforeSecs) {
+            switch(rule.timeDefinition) {
+            case UTC:      return ldtSecs;
+            case STANDARD: return ldtSecs - stdOffset.getTotalSeconds();
+            default:       return ldtSecs - (stdOffset.getTotalSeconds() + savingsBeforeSecs); // WALL
+            }
+        }
+
+        /**
+         * Tests if this a real transition with the active savings in seconds
+         *
+         * @param savingsBefore the active savings in seconds
+         * @return true, if savings changes
+         */
+        boolean isTransition(int savingsBefore) {
+            return rule.savingsAmount != savingsBefore;
+        }
+
+        public int compareTo(TransRule other) {
+            return (ldtSecs < other.ldtSecs)? -1 : ((ldtSecs == other.ldtSecs) ? 0 : 1);
+        }
+    }
+
+    private ZoneRules buildRules(String zoneId, List<ZoneLine> zones) {
+        if (zones.isEmpty()) {
+            throw new IllegalStateException("No available zone window");
+        }
+        final List<ZoneOffsetTransition> standardTransitionList = new ArrayList<>(4);
+        final List<ZoneOffsetTransition> transitionList = new ArrayList<>(256);
+        final List<ZoneOffsetTransitionRule> lastTransitionRuleList = new ArrayList<>(2);
+
+        final ZoneLine zone0 = zones.get(0);
+        // initialize the standard offset, wallOffset and savings for loop
+
+        //ZoneOffset stdOffset = zone0.standardOffset;
+        ZoneOffset stdOffset = ZoneOffset.ofTotalSeconds(zone0.stdOffsetSecs);
+
+        int savings = zone0.fixedSavingsSecs;
+        ZoneOffset wallOffset = ZoneOffset.ofTotalSeconds(stdOffset.getTotalSeconds() + savings);
+
+        // start ldt of each zone window
+        LocalDateTime zoneStart = LocalDateTime.MIN;
+
+        // first stanard offset
+        ZoneOffset firstStdOffset = stdOffset;
+        // first wall offset
+        ZoneOffset firstWallOffset = wallOffset;
+
+        for (ZoneLine zone : zones) {
+            // check if standard offset changed, update it if yes
+            ZoneOffset stdOffsetPrev = stdOffset;  // for effectiveSavings check
+            if (zone.stdOffsetSecs != stdOffset.getTotalSeconds()) {
+                ZoneOffset stdOffsetNew = ZoneOffset.ofTotalSeconds(zone.stdOffsetSecs);
+                standardTransitionList.add(
+                    ZoneOffsetTransition.of(
+                        LocalDateTime.ofEpochSecond(zoneStart.toEpochSecond(wallOffset),
+                                                    0,
+                                                    stdOffset),
+                        stdOffset,
+                        stdOffsetNew));
+                stdOffset = stdOffsetNew;
+            }
+
+            LocalDateTime zoneEnd;
+            if (zone.year == Year.MAX_VALUE) {
+                zoneEnd = LocalDateTime.MAX;
+            } else {
+                zoneEnd = zone.toDateTime();
+            }
+            if (zoneEnd.compareTo(zoneStart) < 0) {
+                throw new IllegalStateException("Windows must be in date-time order: " +
+                        zoneEnd + " < " + zoneStart);
+            }
+            // calculate effective savings at the start of the window
+            List<TransRule> trules = null;
+            List<TransRule> lastRules = null;
+
+            int effectiveSavings = zone.fixedSavingsSecs;
+            if (zone.savingsRule != null) {
+                List<RuleLine> tzdbRules = rules.get(zone.savingsRule);
+                if (tzdbRules == null) {
+                   throw new IllegalArgumentException("<Rule> not found: " +
+                                                       zone.savingsRule);
+                }
+                trules = new ArrayList<>(256);
+                lastRules = new ArrayList<>(2);
+                int lastRulesStartYear = Year.MIN_VALUE;
+
+                // merge the rules to transitions
+                for (RuleLine rule : tzdbRules) {
+                    if (rule.startYear > zoneEnd.getYear()) {
+                        // rules will not be used for this zone entry
+                        continue;
+                    }
+                    rule.adjustToForwards(2004);  // irrelevant, treat as leap year
+
+                    int startYear = rule.startYear;
+                    int endYear = rule.endYear;
+                    if (zoneEnd.equals(LocalDateTime.MAX)) {
+                        if (endYear == Year.MAX_VALUE) {
+                            endYear = startYear;
+                            lastRules.add(new TransRule(endYear, rule));
+                            lastRulesStartYear = Math.max(startYear, lastRulesStartYear);
+                        }
+                    } else {
+                        if (endYear == Year.MAX_VALUE) {
+                            //endYear = zoneEnd.getYear();
+                            endYear = zone.year;
+                        }
+                    }
+                    int year = startYear;
+                    while (year <= endYear) {
+                        trules.add(new TransRule(year, rule));
+                        year++;
+                    }
+                }
+
+                // last rules, fill the gap years between different last rules
+                if (zoneEnd.equals(LocalDateTime.MAX)) {
+                    lastRulesStartYear = Math.max(lastRulesStartYear, zoneStart.getYear()) + 1;
+                    for (TransRule rule : lastRules) {
+                        if (rule.year <= lastRulesStartYear) {
+                            int year = rule.year;
+                            while (year <= lastRulesStartYear) {
+                                trules.add(new TransRule(year, rule.rule));
+                                year++;
+                            }
+                            rule.year = lastRulesStartYear;
+                            rule.ldt = rule.rule.toDateTime(year);
+                            rule.ldtSecs = rule.ldt.toEpochSecond(ZoneOffset.UTC);
+                        }
+                    }
+                    Collections.sort(lastRules);
+                }
+                // sort the merged rules
+                Collections.sort(trules);
+
+                effectiveSavings = 0;
+                for (TransRule rule : trules) {
+                    if (rule.toEpochSecond(stdOffsetPrev, savings) >
+                        zoneStart.toEpochSecond(wallOffset)) {
+                        // previous savings amount found, which could be the
+                        // savings amount at the instant that the window starts
+                        // (hence isAfter)
+                        break;
+                    }
+                    effectiveSavings = rule.rule.savingsAmount;
+                }
+            }
+            // check if the start of the window represents a transition
+            ZoneOffset effectiveWallOffset =
+                ZoneOffset.ofTotalSeconds(stdOffset.getTotalSeconds() + effectiveSavings);
+
+            if (!wallOffset.equals(effectiveWallOffset)) {
+                transitionList.add(ZoneOffsetTransition.of(zoneStart,
+                                                           wallOffset,
+                                                           effectiveWallOffset));
+            }
+            savings = effectiveSavings;
+            // apply rules within the window
+            if (trules != null) {
+                long zoneStartEpochSecs = zoneStart.toEpochSecond(wallOffset);
+                for (TransRule trule : trules) {
+                    if (trule.isTransition(savings)) {
+                        long epochSecs = trule.toEpochSecond(stdOffset, savings);
+                        if (epochSecs < zoneStartEpochSecs ||
+                            epochSecs >= zone.toDateTimeEpochSecond(savings)) {
+                            continue;
+                        }
+                        transitionList.add(trule.toTransition(stdOffset, savings));
+                        savings = trule.rule.savingsAmount;
+                    }
+                }
+            }
+            if (lastRules != null) {
+                for (TransRule trule : lastRules) {
+                    lastTransitionRuleList.add(trule.rule.toTransitionRule(stdOffset, savings));
+                    savings = trule.rule.savingsAmount;
+                }
+            }
+
+            // finally we can calculate the true end of the window, passing it to the next window
+            wallOffset = ZoneOffset.ofTotalSeconds(stdOffset.getTotalSeconds() + savings);
+            zoneStart = LocalDateTime.ofEpochSecond(zone.toDateTimeEpochSecond(savings),
+                                                    0,
+                                                    wallOffset);
+        }
+        return new ZoneRules(firstStdOffset,
+                             firstWallOffset,
+                             standardTransitionList,
+                             transitionList,
+                             lastTransitionRuleList);
+    }
+
+}
diff --git a/jdk/make/src/classes/build/tools/tzdb/Utils.java b/jdk/make/src/classes/build/tools/tzdb/Utils.java
deleted file mode 100644
index d129dd3bc7f..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/Utils.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import java.util.Objects;
-
-class Utils {
-
-    // Returns the largest (closest to positive infinity)
-    public static long floorDiv(long x, long y) {
-        long r = x / y;
-        // if the signs are different and modulo not zero, round down
-        if ((x ^ y) < 0 && (r * y != x)) {
-            r--;
-        }
-        return r;
-    }
-
-    // Returns the floor modulus of the {@code long} arguments.
-    public static long floorMod(long x, long y) {
-        return x - floorDiv(x, y) * y;
-    }
-
-    // Returns the sum of its arguments,
-    public static long addExact(long x, long y) {
-        long r = x + y;
-        // HD 2-12 Overflow iff both arguments have the opposite sign of the result
-        if (((x ^ r) & (y ^ r)) < 0) {
-            throw new ArithmeticException("long overflow");
-        }
-        return r;
-    }
-
-    // Year
-
-    // Returns true if the specified year is a leap year.
-    public static boolean isLeapYear(int year) {
-        return ((year & 3) == 0) && ((year % 100) != 0 || (year % 400) == 0);
-    }
-
-    // The minimum supported year, '-999,999,999'.
-    public static final int YEAR_MIN_VALUE = -999_999_999;
-
-    // The maximum supported year, '+999,999,999'.
-    public static final int YEAR_MAX_VALUE = 999_999_999;
-
-
-    // Gets the length of the specified month in days.
-    public static int lengthOfMonth(int month, boolean leapYear) {
-        switch (month) {
-            case 2:        //FEBRUARY:
-                return (leapYear ? 29 : 28);
-            case 4:        //APRIL:
-            case 6:        //JUNE:
-            case 9:        //SEPTEMBER:
-            case 11:       //NOVEMBER:
-                return 30;
-            default:
-                return 31;
-        }
-    }
-
-    // Gets the maximum length of the specified month in days.
-    public static int maxLengthOfMonth(int month) {
-        switch (month) {
-            case 2:           //FEBRUARY:
-                return 29;
-            case 4:           //APRIL:
-            case 6:           //JUNE:
-            case 9:           //SEPTEMBER:
-            case 11:          //NOVEMBER:
-                return 30;
-            default:
-                return 31;
-        }
-    }
-
-    // DayOfWeek
-
-    // Returns the day-of-week that is the specified number of days after
-    // this one, from 1 to 7 for Monday to Sunday.
-    public static int plusDayOfWeek(int dow, long days) {
-        int amount = (int) (days % 7);
-        return (dow - 1 + (amount + 7)) % 7 + 1;
-    }
-
-    // Returns the day-of-week that is the specified number of days before
-    // this one, from 1 to 7 for Monday to Sunday.
-    public static int minusDayOfWeek(int dow, long days) {
-        return plusDayOfWeek(dow, -(days % 7));
-    }
-
-    // Adjusts the date to the first occurrence of the specified day-of-week
-    // before the date being adjusted unless it is already on that day in
-    // which case the same object is returned.
-    public static LocalDate previousOrSame(LocalDate date, int dayOfWeek) {
-        return adjust(date, dayOfWeek, 1);
-    }
-
-    // Adjusts the date to the first occurrence of the specified day-of-week
-    // after the date being adjusted unless it is already on that day in
-    // which case the same object is returned.
-    public static LocalDate nextOrSame(LocalDate date, int dayOfWeek) {
-        return adjust(date, dayOfWeek, 0);
-    }
-
-    // Implementation of next, previous or current day-of-week.
-    // @param relative  whether the current date is a valid answer
-    private static final LocalDate adjust(LocalDate date, int dow, int relative) {
-        int calDow = date.getDayOfWeek();
-        if (relative < 2 && calDow == dow) {
-            return date;
-        }
-        if ((relative & 1) == 0) {
-            int daysDiff = calDow - dow;
-            return date.plusDays(daysDiff >= 0 ? 7 - daysDiff : -daysDiff);
-        } else {
-            int daysDiff = dow - calDow;
-            return date.minusDays(daysDiff >= 0 ? 7 - daysDiff : -daysDiff);
-        }
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/ZoneOffset.java b/jdk/make/src/classes/build/tools/tzdb/ZoneOffset.java
deleted file mode 100644
index 4f95fb3dd59..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/ZoneOffset.java
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * A time-zone offset from Greenwich/UTC, such as {@code +02:00}.
- * <p>
- * A time-zone offset is the period of time that a time-zone differs from Greenwich/UTC.
- * This is usually a fixed number of hours and minutes.
- *
- * @since 1.8
- */
-final class ZoneOffset implements Comparable<ZoneOffset> {
-
-    /** Cache of time-zone offset by offset in seconds. */
-    private static final ConcurrentMap<Integer, ZoneOffset> SECONDS_CACHE = new ConcurrentHashMap<>(16, 0.75f, 4);
-    /** Cache of time-zone offset by ID. */
-    private static final ConcurrentMap<String, ZoneOffset> ID_CACHE = new ConcurrentHashMap<>(16, 0.75f, 4);
-
-    /**
-     * The number of seconds per hour.
-     */
-    private static final int SECONDS_PER_HOUR = 60 * 60;
-    /**
-     * The number of seconds per minute.
-     */
-    private static final int SECONDS_PER_MINUTE = 60;
-    /**
-     * The number of minutes per hour.
-     */
-    private static final int MINUTES_PER_HOUR = 60;
-    /**
-     * The abs maximum seconds.
-     */
-    private static final int MAX_SECONDS = 18 * SECONDS_PER_HOUR;
-    /**
-     * Serialization version.
-     */
-    private static final long serialVersionUID = 2357656521762053153L;
-
-    /**
-     * The time-zone offset for UTC, with an ID of 'Z'.
-     */
-    public static final ZoneOffset UTC = ZoneOffset.ofTotalSeconds(0);
-    /**
-     * Constant for the maximum supported offset.
-     */
-    public static final ZoneOffset MIN = ZoneOffset.ofTotalSeconds(-MAX_SECONDS);
-    /**
-     * Constant for the maximum supported offset.
-     */
-    public static final ZoneOffset MAX = ZoneOffset.ofTotalSeconds(MAX_SECONDS);
-
-    /**
-     * The total offset in seconds.
-     */
-    private final int totalSeconds;
-    /**
-     * The string form of the time-zone offset.
-     */
-    private final transient String id;
-
-    //-----------------------------------------------------------------------
-    /**
-     * Obtains an instance of {@code ZoneOffset} using the ID.
-     * <p>
-     * This method parses the string ID of a {@code ZoneOffset} to
-     * return an instance. The parsing accepts all the formats generated by
-     * {@link #getId()}, plus some additional formats:
-     * <p><ul>
-     * <li>{@code Z} - for UTC
-     * <li>{@code +h}
-     * <li>{@code +hh}
-     * <li>{@code +hh:mm}
-     * <li>{@code -hh:mm}
-     * <li>{@code +hhmm}
-     * <li>{@code -hhmm}
-     * <li>{@code +hh:mm:ss}
-     * <li>{@code -hh:mm:ss}
-     * <li>{@code +hhmmss}
-     * <li>{@code -hhmmss}
-     * </ul><p>
-     * Note that &plusmn; means either the plus or minus symbol.
-     * <p>
-     * The ID of the returned offset will be normalized to one of the formats
-     * described by {@link #getId()}.
-     * <p>
-     * The maximum supported range is from +18:00 to -18:00 inclusive.
-     *
-     * @param offsetId  the offset ID, not null
-     * @return the zone-offset, not null
-     * @throws DateTimeException if the offset ID is invalid
-     */
-    @SuppressWarnings("fallthrough")
-    public static ZoneOffset of(String offsetId) {
-        Objects.requireNonNull(offsetId, "offsetId");
-        // "Z" is always in the cache
-        ZoneOffset offset = ID_CACHE.get(offsetId);
-        if (offset != null) {
-            return offset;
-        }
-
-        // parse - +h, +hh, +hhmm, +hh:mm, +hhmmss, +hh:mm:ss
-        final int hours, minutes, seconds;
-        switch (offsetId.length()) {
-            case 2:
-                offsetId = offsetId.charAt(0) + "0" + offsetId.charAt(1);  // fallthru
-            case 3:
-                hours = parseNumber(offsetId, 1, false);
-                minutes = 0;
-                seconds = 0;
-                break;
-            case 5:
-                hours = parseNumber(offsetId, 1, false);
-                minutes = parseNumber(offsetId, 3, false);
-                seconds = 0;
-                break;
-            case 6:
-                hours = parseNumber(offsetId, 1, false);
-                minutes = parseNumber(offsetId, 4, true);
-                seconds = 0;
-                break;
-            case 7:
-                hours = parseNumber(offsetId, 1, false);
-                minutes = parseNumber(offsetId, 3, false);
-                seconds = parseNumber(offsetId, 5, false);
-                break;
-            case 9:
-                hours = parseNumber(offsetId, 1, false);
-                minutes = parseNumber(offsetId, 4, true);
-                seconds = parseNumber(offsetId, 7, true);
-                break;
-            default:
-                throw new DateTimeException("Zone offset ID '" + offsetId + "' is invalid");
-        }
-        char first = offsetId.charAt(0);
-        if (first != '+' && first != '-') {
-            throw new DateTimeException("Zone offset ID '" + offsetId + "' is invalid: Plus/minus not found when expected");
-        }
-        if (first == '-') {
-            return ofHoursMinutesSeconds(-hours, -minutes, -seconds);
-        } else {
-            return ofHoursMinutesSeconds(hours, minutes, seconds);
-        }
-    }
-
-    /**
-     * Parse a two digit zero-prefixed number.
-     *
-     * @param offsetId  the offset ID, not null
-     * @param pos  the position to parse, valid
-     * @param precededByColon  should this number be prefixed by a precededByColon
-     * @return the parsed number, from 0 to 99
-     */
-    private static int parseNumber(CharSequence offsetId, int pos, boolean precededByColon) {
-        if (precededByColon && offsetId.charAt(pos - 1) != ':') {
-            throw new DateTimeException("Zone offset ID '" + offsetId + "' is invalid: Colon not found when expected");
-        }
-        char ch1 = offsetId.charAt(pos);
-        char ch2 = offsetId.charAt(pos + 1);
-        if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
-            throw new DateTimeException("Zone offset ID '" + offsetId + "' is invalid: Non numeric characters found");
-        }
-        return (ch1 - 48) * 10 + (ch2 - 48);
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Obtains an instance of {@code ZoneOffset} using an offset in hours.
-     *
-     * @param hours  the time-zone offset in hours, from -18 to +18
-     * @return the zone-offset, not null
-     * @throws DateTimeException if the offset is not in the required range
-     */
-    public static ZoneOffset ofHours(int hours) {
-        return ofHoursMinutesSeconds(hours, 0, 0);
-    }
-
-    /**
-     * Obtains an instance of {@code ZoneOffset} using an offset in
-     * hours and minutes.
-     * <p>
-     * The sign of the hours and minutes components must match.
-     * Thus, if the hours is negative, the minutes must be negative or zero.
-     * If the hours is zero, the minutes may be positive, negative or zero.
-     *
-     * @param hours  the time-zone offset in hours, from -18 to +18
-     * @param minutes  the time-zone offset in minutes, from 0 to &plusmn;59, sign matches hours
-     * @return the zone-offset, not null
-     * @throws DateTimeException if the offset is not in the required range
-     */
-    public static ZoneOffset ofHoursMinutes(int hours, int minutes) {
-        return ofHoursMinutesSeconds(hours, minutes, 0);
-    }
-
-    /**
-     * Obtains an instance of {@code ZoneOffset} using an offset in
-     * hours, minutes and seconds.
-     * <p>
-     * The sign of the hours, minutes and seconds components must match.
-     * Thus, if the hours is negative, the minutes and seconds must be negative or zero.
-     *
-     * @param hours  the time-zone offset in hours, from -18 to +18
-     * @param minutes  the time-zone offset in minutes, from 0 to &plusmn;59, sign matches hours and seconds
-     * @param seconds  the time-zone offset in seconds, from 0 to &plusmn;59, sign matches hours and minutes
-     * @return the zone-offset, not null
-     * @throws DateTimeException if the offset is not in the required range
-     */
-    public static ZoneOffset ofHoursMinutesSeconds(int hours, int minutes, int seconds) {
-        validate(hours, minutes, seconds);
-        int totalSeconds = totalSeconds(hours, minutes, seconds);
-        return ofTotalSeconds(totalSeconds);
-    }
-
-    /**
-     * Validates the offset fields.
-     *
-     * @param hours  the time-zone offset in hours, from -18 to +18
-     * @param minutes  the time-zone offset in minutes, from 0 to &plusmn;59
-     * @param seconds  the time-zone offset in seconds, from 0 to &plusmn;59
-     * @throws DateTimeException if the offset is not in the required range
-     */
-    private static void validate(int hours, int minutes, int seconds) {
-        if (hours < -18 || hours > 18) {
-            throw new DateTimeException("Zone offset hours not in valid range: value " + hours +
-                    " is not in the range -18 to 18");
-        }
-        if (hours > 0) {
-            if (minutes < 0 || seconds < 0) {
-                throw new DateTimeException("Zone offset minutes and seconds must be positive because hours is positive");
-            }
-        } else if (hours < 0) {
-            if (minutes > 0 || seconds > 0) {
-                throw new DateTimeException("Zone offset minutes and seconds must be negative because hours is negative");
-            }
-        } else if ((minutes > 0 && seconds < 0) || (minutes < 0 && seconds > 0)) {
-            throw new DateTimeException("Zone offset minutes and seconds must have the same sign");
-        }
-        if (Math.abs(minutes) > 59) {
-            throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " +
-                    Math.abs(minutes) + " is not in the range 0 to 59");
-        }
-        if (Math.abs(seconds) > 59) {
-            throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " +
-                    Math.abs(seconds) + " is not in the range 0 to 59");
-        }
-        if (Math.abs(hours) == 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
-            throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
-        }
-    }
-
-    /**
-     * Calculates the total offset in seconds.
-     *
-     * @param hours  the time-zone offset in hours, from -18 to +18
-     * @param minutes  the time-zone offset in minutes, from 0 to &plusmn;59, sign matches hours and seconds
-     * @param seconds  the time-zone offset in seconds, from 0 to &plusmn;59, sign matches hours and minutes
-     * @return the total in seconds
-     */
-    private static int totalSeconds(int hours, int minutes, int seconds) {
-        return hours * SECONDS_PER_HOUR + minutes * SECONDS_PER_MINUTE + seconds;
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Obtains an instance of {@code ZoneOffset} specifying the total offset in seconds
-     * <p>
-     * The offset must be in the range {@code -18:00} to {@code +18:00}, which corresponds to -64800 to +64800.
-     *
-     * @param totalSeconds  the total time-zone offset in seconds, from -64800 to +64800
-     * @return the ZoneOffset, not null
-     * @throws DateTimeException if the offset is not in the required range
-     */
-    public static ZoneOffset ofTotalSeconds(int totalSeconds) {
-        if (Math.abs(totalSeconds) > MAX_SECONDS) {
-            throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
-        }
-        if (totalSeconds % (15 * SECONDS_PER_MINUTE) == 0) {
-            Integer totalSecs = totalSeconds;
-            ZoneOffset result = SECONDS_CACHE.get(totalSecs);
-            if (result == null) {
-                result = new ZoneOffset(totalSeconds);
-                SECONDS_CACHE.putIfAbsent(totalSecs, result);
-                result = SECONDS_CACHE.get(totalSecs);
-                ID_CACHE.putIfAbsent(result.getId(), result);
-            }
-            return result;
-        } else {
-            return new ZoneOffset(totalSeconds);
-        }
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param totalSeconds  the total time-zone offset in seconds, from -64800 to +64800
-     */
-    private ZoneOffset(int totalSeconds) {
-        super();
-        this.totalSeconds = totalSeconds;
-        id = buildId(totalSeconds);
-    }
-
-    private static String buildId(int totalSeconds) {
-        if (totalSeconds == 0) {
-            return "Z";
-        } else {
-            int absTotalSeconds = Math.abs(totalSeconds);
-            StringBuilder buf = new StringBuilder();
-            int absHours = absTotalSeconds / SECONDS_PER_HOUR;
-            int absMinutes = (absTotalSeconds / SECONDS_PER_MINUTE) % MINUTES_PER_HOUR;
-            buf.append(totalSeconds < 0 ? "-" : "+")
-                .append(absHours < 10 ? "0" : "").append(absHours)
-                .append(absMinutes < 10 ? ":0" : ":").append(absMinutes);
-            int absSeconds = absTotalSeconds % SECONDS_PER_MINUTE;
-            if (absSeconds != 0) {
-                buf.append(absSeconds < 10 ? ":0" : ":").append(absSeconds);
-            }
-            return buf.toString();
-        }
-    }
-
-    /**
-     * Gets the total zone offset in seconds.
-     * <p>
-     * This is the primary way to access the offset amount.
-     * It returns the total of the hours, minutes and seconds fields as a
-     * single offset that can be added to a time.
-     *
-     * @return the total zone offset amount in seconds
-     */
-    public int getTotalSeconds() {
-        return totalSeconds;
-    }
-
-    /**
-     * Gets the normalized zone offset ID.
-     * <p>
-     * The ID is minor variation to the standard ISO-8601 formatted string
-     * for the offset. There are three formats:
-     * <p><ul>
-     * <li>{@code Z} - for UTC (ISO-8601)
-     * <li>{@code +hh:mm} or {@code -hh:mm} - if the seconds are zero (ISO-8601)
-     * <li>{@code +hh:mm:ss} or {@code -hh:mm:ss} - if the seconds are non-zero (not ISO-8601)
-     * </ul><p>
-     *
-     * @return the zone offset ID, not null
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * Compares this offset to another offset in descending order.
-     * <p>
-     * The offsets are compared in the order that they occur for the same time
-     * of day around the world. Thus, an offset of {@code +10:00} comes before an
-     * offset of {@code +09:00} and so on down to {@code -18:00}.
-     * <p>
-     * The comparison is "consistent with equals", as defined by {@link Comparable}.
-     *
-     * @param other  the other date to compare to, not null
-     * @return the comparator value, negative if less, postive if greater
-     * @throws NullPointerException if {@code other} is null
-     */
-    @Override
-    public int compareTo(ZoneOffset other) {
-        return other.totalSeconds - totalSeconds;
-    }
-
-    /**
-     * Checks if this offset is equal to another offset.
-     * <p>
-     * The comparison is based on the amount of the offset in seconds.
-     * This is equivalent to a comparison by ID.
-     *
-     * @param obj  the object to check, null returns false
-     * @return true if this is equal to the other offset
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-           return true;
-        }
-        if (obj instanceof ZoneOffset) {
-            return totalSeconds == ((ZoneOffset) obj).totalSeconds;
-        }
-        return false;
-    }
-
-    /**
-     * A hash code for this offset.
-     *
-     * @return a suitable hash code
-     */
-    @Override
-    public int hashCode() {
-        return totalSeconds;
-    }
-
-    /**
-     * Outputs this offset as a {@code String}, using the normalized ID.
-     *
-     * @return a string representation of this offset, not null
-     */
-    @Override
-    public String toString() {
-        return id;
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransition.java b/jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransition.java
deleted file mode 100644
index 167b5f112de..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransition.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * A transition between two offsets caused by a discontinuity in the local time-line.
- *
- * @since 1.8
- */
-final class ZoneOffsetTransition implements Comparable<ZoneOffsetTransition> {
-
-    /**
-     * The local transition date-time at the transition.
-     */
-    private final LocalDateTime transition;
-    /**
-     * The offset before transition.
-     */
-    private final ZoneOffset offsetBefore;
-    /**
-     * The offset after transition.
-     */
-    private final ZoneOffset offsetAfter;
-
-    /**
-     * Creates an instance defining a transition between two offsets.
-     *
-     * @param transition  the transition date-time with the offset before the transition, not null
-     * @param offsetBefore  the offset before the transition, not null
-     * @param offsetAfter  the offset at and after the transition, not null
-     */
-    ZoneOffsetTransition(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter) {
-        Objects.requireNonNull(transition, "transition");
-        Objects.requireNonNull(offsetBefore, "offsetBefore");
-        Objects.requireNonNull(offsetAfter, "offsetAfter");
-        if (offsetBefore.equals(offsetAfter)) {
-            throw new IllegalArgumentException("Offsets must not be equal");
-        }
-        this.transition = transition;
-        this.offsetBefore = offsetBefore;
-        this.offsetAfter = offsetAfter;
-    }
-
-    /**
-     * Creates an instance from epoch-second and offsets.
-     *
-     * @param epochSecond  the transition epoch-second
-     * @param offsetBefore  the offset before the transition, not null
-     * @param offsetAfter  the offset at and after the transition, not null
-     */
-    ZoneOffsetTransition(long epochSecond, ZoneOffset offsetBefore, ZoneOffset offsetAfter) {
-        this.transition = LocalDateTime.ofEpochSecond(epochSecond, 0, offsetBefore);
-        this.offsetBefore = offsetBefore;
-        this.offsetAfter = offsetAfter;
-    }
-
-    /**
-     * Gets the transition instant as an epoch second.
-     *
-     * @return the transition epoch second
-     */
-    public long toEpochSecond() {
-        return transition.toEpochSecond(offsetBefore);
-    }
-
-    /**
-     * Gets the local transition date-time, as would be expressed with the 'before' offset.
-     * <p>
-     * This is the date-time where the discontinuity begins expressed with the 'before' offset.
-     * At this instant, the 'after' offset is actually used, therefore the combination of this
-     * date-time and the 'before' offset will never occur.
-     * <p>
-     * The combination of the 'before' date-time and offset represents the same instant
-     * as the 'after' date-time and offset.
-     *
-     * @return the transition date-time expressed with the before offset, not null
-     */
-    public LocalDateTime getDateTimeBefore() {
-        return transition;
-    }
-
-    /**
-     * Gets the local transition date-time, as would be expressed with the 'after' offset.
-     * <p>
-     * This is the first date-time after the discontinuity, when the new offset applies.
-     * <p>
-     * The combination of the 'before' date-time and offset represents the same instant
-     * as the 'after' date-time and offset.
-     *
-     * @return the transition date-time expressed with the after offset, not null
-     */
-    public LocalDateTime getDateTimeAfter() {
-        return transition.plusSeconds(getDurationSeconds());
-    }
-
-    /**
-     * Gets the offset before the transition.
-     * <p>
-     * This is the offset in use before the instant of the transition.
-     *
-     * @return the offset before the transition, not null
-     */
-    public ZoneOffset getOffsetBefore() {
-        return offsetBefore;
-    }
-
-    /**
-     * Gets the offset after the transition.
-     * <p>
-     * This is the offset in use on and after the instant of the transition.
-     *
-     * @return the offset after the transition, not null
-     */
-    public ZoneOffset getOffsetAfter() {
-        return offsetAfter;
-    }
-
-    /**
-     * Gets the duration of the transition in seconds.
-     *
-     * @return the duration in seconds
-     */
-    private int getDurationSeconds() {
-        return getOffsetAfter().getTotalSeconds() - getOffsetBefore().getTotalSeconds();
-    }
-
-    /**
-     * Does this transition represent a gap in the local time-line.
-     * <p>
-     * Gaps occur where there are local date-times that simply do not not exist.
-     * An example would be when the offset changes from {@code +01:00} to {@code +02:00}.
-     * This might be described as 'the clocks will move forward one hour tonight at 1am'.
-     *
-     * @return true if this transition is a gap, false if it is an overlap
-     */
-    public boolean isGap() {
-        return getOffsetAfter().getTotalSeconds() > getOffsetBefore().getTotalSeconds();
-    }
-
-    /**
-     * Does this transition represent a gap in the local time-line.
-     * <p>
-     * Overlaps occur where there are local date-times that exist twice.
-     * An example would be when the offset changes from {@code +02:00} to {@code +01:00}.
-     * This might be described as 'the clocks will move back one hour tonight at 2am'.
-     *
-     * @return true if this transition is an overlap, false if it is a gap
-     */
-    public boolean isOverlap() {
-        return getOffsetAfter().getTotalSeconds() < getOffsetBefore().getTotalSeconds();
-    }
-
-    /**
-     * Checks if the specified offset is valid during this transition.
-     * <p>
-     * This checks to see if the given offset will be valid at some point in the transition.
-     * A gap will always return false.
-     * An overlap will return true if the offset is either the before or after offset.
-     *
-     * @param offset  the offset to check, null returns false
-     * @return true if the offset is valid during the transition
-     */
-    public boolean isValidOffset(ZoneOffset offset) {
-        return isGap() ? false : (getOffsetBefore().equals(offset) || getOffsetAfter().equals(offset));
-    }
-
-    /**
-     * Gets the valid offsets during this transition.
-     * <p>
-     * A gap will return an empty list, while an overlap will return both offsets.
-     *
-     * @return the list of valid offsets
-     */
-    List<ZoneOffset> getValidOffsets() {
-        if (isGap()) {
-            return Collections.emptyList();
-        }
-        return Arrays.asList(getOffsetBefore(), getOffsetAfter());
-    }
-
-    /**
-     * Compares this transition to another based on the transition instant.
-     * <p>
-     * This compares the instants of each transition.
-     * The offsets are ignored, making this order inconsistent with equals.
-     *
-     * @param transition  the transition to compare to, not null
-     * @return the comparator value, negative if less, positive if greater
-     */
-    @Override
-    public int compareTo(ZoneOffsetTransition transition) {
-        return Long.compare(this.toEpochSecond(), transition.toEpochSecond());
-    }
-
-    /**
-     * Checks if this object equals another.
-     * <p>
-     * The entire state of the object is compared.
-     *
-     * @param other  the other object to compare to, null returns false
-     * @return true if equal
-     */
-    @Override
-    public boolean equals(Object other) {
-        if (other == this) {
-            return true;
-        }
-        if (other instanceof ZoneOffsetTransition) {
-            ZoneOffsetTransition d = (ZoneOffsetTransition) other;
-            return transition.equals(d.transition) &&
-                offsetBefore.equals(d.offsetBefore) && offsetAfter.equals(d.offsetAfter);
-        }
-        return false;
-    }
-
-    /**
-     * Returns a suitable hash code.
-     *
-     * @return the hash code
-     */
-    @Override
-    public int hashCode() {
-        return transition.hashCode() ^ offsetBefore.hashCode() ^ Integer.rotateLeft(offsetAfter.hashCode(), 16);
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransitionRule.java b/jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransitionRule.java
deleted file mode 100644
index 783499c2163..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/ZoneOffsetTransitionRule.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import static build.tools.tzdb.Utils.*;
-import java.util.Objects;
-
-/**
- * A rule expressing how to create a transition.
- * <p>
- * This class allows rules for identifying future transitions to be expressed.
- * A rule might be written in many forms:
- * <p><ul>
- * <li>the 16th March
- * <li>the Sunday on or after the 16th March
- * <li>the Sunday on or before the 16th March
- * <li>the last Sunday in February
- * </ul><p>
- * These different rule types can be expressed and queried.
- *
- * <h3>Specification for implementors</h3>
- * This class is immutable and thread-safe.
- *
- * @since 1.8
- */
-final class ZoneOffsetTransitionRule {
-
-    /**
-     * The month of the month-day of the first day of the cutover week.
-     * The actual date will be adjusted by the dowChange field.
-     */
-    final int month;
-    /**
-     * The day-of-month of the month-day of the cutover week.
-     * If positive, it is the start of the week where the cutover can occur.
-     * If negative, it represents the end of the week where cutover can occur.
-     * The value is the number of days from the end of the month, such that
-     * {@code -1} is the last day of the month, {@code -2} is the second
-     * to last day, and so on.
-     */
-    final byte dom;
-    /**
-     * The cutover day-of-week, -1 to retain the day-of-month.
-     */
-    final int dow;
-    /**
-     * The cutover time in the 'before' offset.
-     */
-    final LocalTime time;
-    /**
-     * Whether the cutover time is midnight at the end of day.
-     */
-    final boolean timeEndOfDay;
-    /**
-     * The definition of how the local time should be interpreted.
-     */
-    final TimeDefinition timeDefinition;
-    /**
-     * The standard offset at the cutover.
-     */
-    final ZoneOffset standardOffset;
-    /**
-     * The offset before the cutover.
-     */
-    final ZoneOffset offsetBefore;
-    /**
-     * The offset after the cutover.
-     */
-    final ZoneOffset offsetAfter;
-
-    /**
-     * Creates an instance defining the yearly rule to create transitions between two offsets.
-     *
-     * @param month  the month of the month-day of the first day of the cutover week, from 1 to 12
-     * @param dayOfMonthIndicator  the day of the month-day of the cutover week, positive if the week is that
-     *  day or later, negative if the week is that day or earlier, counting from the last day of the month,
-     *  from -28 to 31 excluding 0
-     * @param dayOfWeek  the required day-of-week, -1 if the month-day should not be changed
-     * @param time  the cutover time in the 'before' offset, not null
-     * @param timeEndOfDay  whether the time is midnight at the end of day
-     * @param timeDefnition  how to interpret the cutover
-     * @param standardOffset  the standard offset in force at the cutover, not null
-     * @param offsetBefore  the offset before the cutover, not null
-     * @param offsetAfter  the offset after the cutover, not null
-     * @throws IllegalArgumentException if the day of month indicator is invalid
-     * @throws IllegalArgumentException if the end of day flag is true when the time is not midnight
-     */
-    ZoneOffsetTransitionRule(
-            int month,
-            int dayOfMonthIndicator,
-            int dayOfWeek,
-            LocalTime time,
-            boolean timeEndOfDay,
-            TimeDefinition timeDefnition,
-            ZoneOffset standardOffset,
-            ZoneOffset offsetBefore,
-            ZoneOffset offsetAfter) {
-        Objects.requireNonNull(time, "time");
-        Objects.requireNonNull(timeDefnition, "timeDefnition");
-        Objects.requireNonNull(standardOffset, "standardOffset");
-        Objects.requireNonNull(offsetBefore, "offsetBefore");
-        Objects.requireNonNull(offsetAfter, "offsetAfter");
-        if (month < 1 || month > 12) {
-            throw new IllegalArgumentException("month must be between 1 and 12");
-        }
-        if (dayOfMonthIndicator < -28 || dayOfMonthIndicator > 31 || dayOfMonthIndicator == 0) {
-            throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero");
-        }
-        if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) {
-            throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
-        }
-        this.month = month;
-        this.dom = (byte) dayOfMonthIndicator;
-        this.dow = dayOfWeek;
-        this.time = time;
-        this.timeEndOfDay = timeEndOfDay;
-        this.timeDefinition = timeDefnition;
-        this.standardOffset = standardOffset;
-        this.offsetBefore = offsetBefore;
-        this.offsetAfter = offsetAfter;
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Checks if this object equals another.
-     * <p>
-     * The entire state of the object is compared.
-     *
-     * @param otherRule  the other object to compare to, null returns false
-     * @return true if equal
-     */
-    @Override
-    public boolean equals(Object otherRule) {
-        if (otherRule == this) {
-            return true;
-        }
-        if (otherRule instanceof ZoneOffsetTransitionRule) {
-            ZoneOffsetTransitionRule other = (ZoneOffsetTransitionRule) otherRule;
-            return month == other.month && dom == other.dom && dow == other.dow &&
-                timeDefinition == other.timeDefinition &&
-                time.equals(other.time) &&
-                timeEndOfDay == other.timeEndOfDay &&
-                standardOffset.equals(other.standardOffset) &&
-                offsetBefore.equals(other.offsetBefore) &&
-                offsetAfter.equals(other.offsetAfter);
-        }
-        return false;
-    }
-
-    /**
-     * Returns a suitable hash code.
-     *
-     * @return the hash code
-     */
-    @Override
-    public int hashCode() {
-        int hash = ((time.toSecondOfDay() + (timeEndOfDay ? 1 : 0)) << 15) +
-                (month << 11) + ((dom + 32) << 5) +
-                ((dow == -1 ? 8 : dow) << 2) + (timeDefinition.ordinal());
-        return hash ^ standardOffset.hashCode() ^
-                offsetBefore.hashCode() ^ offsetAfter.hashCode();
-    }
-
-}
diff --git a/jdk/make/src/classes/build/tools/tzdb/ZoneRules.java b/jdk/make/src/classes/build/tools/tzdb/ZoneRules.java
index 22c3be80c02..4d01d3ac5b6 100644
--- a/jdk/make/src/classes/build/tools/tzdb/ZoneRules.java
+++ b/jdk/make/src/classes/build/tools/tzdb/ZoneRules.java
@@ -64,6 +64,12 @@ package build.tools.tzdb;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.ObjectOutput;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneOffset;
+import java.time.zone.ZoneOffsetTransition;
+import java.time.zone.ZoneOffsetTransitionRule;
+import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.List;
@@ -224,15 +230,15 @@ final class ZoneRules {
      * @throws IOException if an error occurs
      */
     static void writeRule(ZoneOffsetTransitionRule rule, DataOutput out) throws IOException {
-        int month = rule.month;
-        byte dom = rule.dom;
-        int dow = rule.dow;
-        LocalTime time = rule.time;
-        boolean timeEndOfDay = rule.timeEndOfDay;
-        TimeDefinition timeDefinition = rule.timeDefinition;
-        ZoneOffset standardOffset = rule.standardOffset;
-        ZoneOffset offsetBefore = rule.offsetBefore;
-        ZoneOffset offsetAfter = rule.offsetAfter;
+        int month = rule.getMonth().getValue();
+        byte dom = (byte)rule.getDayOfMonthIndicator();
+        int dow = rule.getDayOfWeek().getValue();
+        LocalTime time = rule.getLocalTime();
+        boolean timeEndOfDay = rule.isMidnightEndOfDay();
+        TimeDefinition timeDefinition = rule.getTimeDefinition();
+        ZoneOffset standardOffset = rule.getStandardOffset();
+        ZoneOffset offsetBefore = rule.getOffsetBefore();
+        ZoneOffset offsetAfter = rule.getOffsetAfter();
 
         int timeSecs = (timeEndOfDay ? 86400 : time.toSecondOfDay());
         int stdOffset = standardOffset.getTotalSeconds();
diff --git a/jdk/make/src/classes/build/tools/tzdb/ZoneRulesBuilder.java b/jdk/make/src/classes/build/tools/tzdb/ZoneRulesBuilder.java
deleted file mode 100644
index f4a437dc074..00000000000
--- a/jdk/make/src/classes/build/tools/tzdb/ZoneRulesBuilder.java
+++ /dev/null
@@ -1,743 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package build.tools.tzdb;
-
-import static build.tools.tzdb.Utils.*;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * A mutable builder used to create all the rules for a historic time-zone.
- * <p>
- * The rules of a time-zone describe how the offset changes over time.
- * The rules are created by building windows on the time-line within which
- * the different rules apply. The rules may be one of two kinds:
- * <p><ul>
- * <li>Fixed savings - A single fixed amount of savings from the standard offset will apply.</li>
- * <li>Rules - A set of one or more rules describe how daylight savings changes during the window.</li>
- * </ul><p>
- *
- * <h4>Implementation notes</h4>
- * This class is a mutable builder used to create zone instances.
- * It must only be used from a single thread.
- * The created instances are immutable and thread-safe.
- *
- * @since 1.8
- */
-public class ZoneRulesBuilder {
-
-    /**
-     * The list of windows.
-     */
-    private List<TZWindow> windowList = new ArrayList<>();
-
-    //-----------------------------------------------------------------------
-    /**
-     * Constructs an instance of the builder that can be used to create zone rules.
-     * <p>
-     * The builder is used by adding one or more windows representing portions
-     * of the time-line. The standard offset from UTC/Greenwich will be constant
-     * within a window, although two adjacent windows can have the same standard offset.
-     * <p>
-     * Within each window, there can either be a
-     * {@link #setFixedSavingsToWindow fixed savings amount} or a
-     * {@link #addRuleToWindow list of rules}.
-     */
-    public ZoneRulesBuilder() {
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Adds a window to the builder that can be used to filter a set of rules.
-     * <p>
-     * This method defines and adds a window to the zone where the standard offset is specified.
-     * The window limits the effect of subsequent additions of transition rules
-     * or fixed savings. If neither rules or fixed savings are added to the window
-     * then the window will default to no savings.
-     * <p>
-     * Each window must be added sequentially, as the start instant of the window
-     * is derived from the until instant of the previous window.
-     *
-     * @param standardOffset  the standard offset, not null
-     * @param until  the date-time that the offset applies until, not null
-     * @param untilDefinition  the time type for the until date-time, not null
-     * @return this, for chaining
-     * @throws IllegalStateException if the window order is invalid
-     */
-    public ZoneRulesBuilder addWindow(
-            ZoneOffset standardOffset,
-            LocalDateTime until,
-            TimeDefinition untilDefinition) {
-        Objects.requireNonNull(standardOffset, "standardOffset");
-        Objects.requireNonNull(until, "until");
-        Objects.requireNonNull(untilDefinition, "untilDefinition");
-        TZWindow window = new TZWindow(standardOffset, until, untilDefinition);
-        if (windowList.size() > 0) {
-            TZWindow previous = windowList.get(windowList.size() - 1);
-            window.validateWindowOrder(previous);
-        }
-        windowList.add(window);
-        return this;
-    }
-
-    /**
-     * Adds a window that applies until the end of time to the builder that can be
-     * used to filter a set of rules.
-     * <p>
-     * This method defines and adds a window to the zone where the standard offset is specified.
-     * The window limits the effect of subsequent additions of transition rules
-     * or fixed savings. If neither rules or fixed savings are added to the window
-     * then the window will default to no savings.
-     * <p>
-     * This must be added after all other windows.
-     * No more windows can be added after this one.
-     *
-     * @param standardOffset  the standard offset, not null
-     * @return this, for chaining
-     * @throws IllegalStateException if a forever window has already been added
-     */
-    public ZoneRulesBuilder addWindowForever(ZoneOffset standardOffset) {
-        return addWindow(standardOffset, LocalDateTime.MAX, TimeDefinition.WALL);
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Sets the previously added window to have fixed savings.
-     * <p>
-     * Setting a window to have fixed savings simply means that a single daylight
-     * savings amount applies throughout the window. The window could be small,
-     * such as a single summer, or large, such as a multi-year daylight savings.
-     * <p>
-     * A window can either have fixed savings or rules but not both.
-     *
-     * @param fixedSavingAmountSecs  the amount of saving to use for the whole window, not null
-     * @return this, for chaining
-     * @throws IllegalStateException if no window has yet been added
-     * @throws IllegalStateException if the window already has rules
-     */
-    public ZoneRulesBuilder setFixedSavingsToWindow(int fixedSavingAmountSecs) {
-        if (windowList.isEmpty()) {
-            throw new IllegalStateException("Must add a window before setting the fixed savings");
-        }
-        TZWindow window = windowList.get(windowList.size() - 1);
-        window.setFixedSavings(fixedSavingAmountSecs);
-        return this;
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Adds a single transition rule to the current window.
-     * <p>
-     * This adds a rule such that the offset, expressed as a daylight savings amount,
-     * changes at the specified date-time.
-     *
-     * @param transitionDateTime  the date-time that the transition occurs as defined by timeDefintion, not null
-     * @param timeDefinition  the definition of how to convert local to actual time, not null
-     * @param savingAmountSecs  the amount of saving from the standard offset after the transition in seconds
-     * @return this, for chaining
-     * @throws IllegalStateException if no window has yet been added
-     * @throws IllegalStateException if the window already has fixed savings
-     * @throws IllegalStateException if the window has reached the maximum capacity of 2000 rules
-     */
-    public ZoneRulesBuilder addRuleToWindow(
-            LocalDateTime transitionDateTime,
-            TimeDefinition timeDefinition,
-            int savingAmountSecs) {
-        Objects.requireNonNull(transitionDateTime, "transitionDateTime");
-        return addRuleToWindow(
-                transitionDateTime.getYear(), transitionDateTime.getYear(),
-                transitionDateTime.getMonth(), transitionDateTime.getDayOfMonth(),
-                -1, transitionDateTime.getTime(), false, timeDefinition, savingAmountSecs);
-    }
-
-    /**
-     * Adds a single transition rule to the current window.
-     * <p>
-     * This adds a rule such that the offset, expressed as a daylight savings amount,
-     * changes at the specified date-time.
-     *
-     * @param year  the year of the transition, from MIN_YEAR to MAX_YEAR
-     * @param month  the month of the transition, not null
-     * @param dayOfMonthIndicator  the day-of-month of the transition, adjusted by dayOfWeek,
-     *   from 1 to 31 adjusted later, or -1 to -28 adjusted earlier from the last day of the month
-     * @param time  the time that the transition occurs as defined by timeDefintion, not null
-     * @param timeEndOfDay  whether midnight is at the end of day
-     * @param timeDefinition  the definition of how to convert local to actual time, not null
-     * @param savingAmountSecs  the amount of saving from the standard offset after the transition in seconds
-     * @return this, for chaining
-     * @throws DateTimeException if a date-time field is out of range
-     * @throws IllegalStateException if no window has yet been added
-     * @throws IllegalStateException if the window already has fixed savings
-     * @throws IllegalStateException if the window has reached the maximum capacity of 2000 rules
-     */
-    public ZoneRulesBuilder addRuleToWindow(
-            int year,
-            int month,
-            int dayOfMonthIndicator,
-            LocalTime time,
-            boolean timeEndOfDay,
-            TimeDefinition timeDefinition,
-            int savingAmountSecs) {
-        return addRuleToWindow(year, year, month, dayOfMonthIndicator, -1, time, timeEndOfDay, timeDefinition, savingAmountSecs);
-    }
-
-    /**
-     * Adds a multi-year transition rule to the current window.
-     * <p>
-     * This adds a rule such that the offset, expressed as a daylight savings amount,
-     * changes at the specified date-time for each year in the range.
-     *
-     * @param startYear  the start year of the rule, from MIN_YEAR to MAX_YEAR
-     * @param endYear  the end year of the rule, from MIN_YEAR to MAX_YEAR
-     * @param month  the month of the transition, from 1 to 12
-     * @param dayOfMonthIndicator  the day-of-month of the transition, adjusted by dayOfWeek,
-     *   from 1 to 31 adjusted later, or -1 to -28 adjusted earlier from the last day of the month
-     * @param dayOfWeek  the day-of-week to adjust to, -1 if day-of-month should not be adjusted
-     * @param time  the time that the transition occurs as defined by timeDefintion, not null
-     * @param timeEndOfDay  whether midnight is at the end of day
-     * @param timeDefinition  the definition of how to convert local to actual time, not null
-     * @param savingAmountSecs  the amount of saving from the standard offset after the transition in seconds
-     * @return this, for chaining
-     * @throws DateTimeException if a date-time field is out of range
-     * @throws IllegalArgumentException if the day of month indicator is invalid
-     * @throws IllegalArgumentException if the end of day midnight flag does not match the time
-     * @throws IllegalStateException if no window has yet been added
-     * @throws IllegalStateException if the window already has fixed savings
-     * @throws IllegalStateException if the window has reached the maximum capacity of 2000 rules
-     */
-    public ZoneRulesBuilder addRuleToWindow(
-            int startYear,
-            int endYear,
-            int month,
-            int dayOfMonthIndicator,
-            int dayOfWeek,
-            LocalTime time,
-            boolean timeEndOfDay,
-            TimeDefinition timeDefinition,
-            int savingAmountSecs) {
-        Objects.requireNonNull(time, "time");
-        Objects.requireNonNull(timeDefinition, "timeDefinition");
-        if (dayOfMonthIndicator < -28 || dayOfMonthIndicator > 31 || dayOfMonthIndicator == 0) {
-            throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero");
-        }
-        if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) {
-            throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
-        }
-        if (windowList.isEmpty()) {
-            throw new IllegalStateException("Must add a window before adding a rule");
-        }
-        TZWindow window = windowList.get(windowList.size() - 1);
-        window.addRule(startYear, endYear, month, dayOfMonthIndicator, dayOfWeek, time, timeEndOfDay, timeDefinition, savingAmountSecs);
-        return this;
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Completes the build converting the builder to a set of time-zone rules.
-     * <p>
-     * Calling this method alters the state of the builder.
-     * Further rules should not be added to this builder once this method is called.
-     *
-     * @param zoneId  the time-zone ID, not null
-     * @return the zone rules, not null
-     * @throws IllegalStateException if no windows have been added
-     * @throws IllegalStateException if there is only one rule defined as being forever for any given window
-     */
-    public ZoneRules toRules(String zoneId) {
-        Objects.requireNonNull(zoneId, "zoneId");
-        if (windowList.isEmpty()) {
-            throw new IllegalStateException("No windows have been added to the builder");
-        }
-
-        final List<ZoneOffsetTransition> standardTransitionList = new ArrayList<>(4);
-        final List<ZoneOffsetTransition> transitionList = new ArrayList<>(256);
-        final List<ZoneOffsetTransitionRule> lastTransitionRuleList = new ArrayList<>(2);
-
-        // initialize the standard offset calculation
-        final TZWindow firstWindow = windowList.get(0);
-        ZoneOffset loopStandardOffset = firstWindow.standardOffset;
-        int loopSavings = 0;
-        if (firstWindow.fixedSavingAmountSecs != null) {
-            loopSavings = firstWindow.fixedSavingAmountSecs;
-        }
-        final ZoneOffset firstWallOffset = ZoneOffset.ofTotalSeconds(loopStandardOffset.getTotalSeconds() + loopSavings);
-        LocalDateTime loopWindowStart = LocalDateTime.of(YEAR_MIN_VALUE, 1, 1, 0, 0);
-        ZoneOffset loopWindowOffset = firstWallOffset;
-
-        // build the windows and rules to interesting data
-        for (TZWindow window : windowList) {
-            // tidy the state
-            window.tidy(loopWindowStart.getYear());
-
-            // calculate effective savings at the start of the window
-            Integer effectiveSavings = window.fixedSavingAmountSecs;
-            if (effectiveSavings == null) {
-                // apply rules from this window together with the standard offset and
-                // savings from the last window to find the savings amount applicable
-                // at start of this window
-                effectiveSavings = 0;
-                for (TZRule rule : window.ruleList) {
-                    if (rule.toEpochSecond(loopStandardOffset, loopSavings) > loopWindowStart.toEpochSecond(loopWindowOffset)) {
-                        // previous savings amount found, which could be the savings amount at
-                        // the instant that the window starts (hence isAfter)
-                        break;
-                    }
-                    effectiveSavings = rule.savingAmountSecs;
-                }
-            }
-
-            // check if standard offset changed, and update it
-            if (loopStandardOffset.equals(window.standardOffset) == false) {
-                standardTransitionList.add(
-                    new ZoneOffsetTransition(
-                        LocalDateTime.ofEpochSecond(loopWindowStart.toEpochSecond(loopWindowOffset), 0, loopStandardOffset),
-                        loopStandardOffset, window.standardOffset));
-                loopStandardOffset = window.standardOffset;
-            }
-
-            // check if the start of the window represents a transition
-            ZoneOffset effectiveWallOffset = ZoneOffset.ofTotalSeconds(loopStandardOffset.getTotalSeconds() + effectiveSavings);
-            if (loopWindowOffset.equals(effectiveWallOffset) == false) {
-                transitionList.add(new ZoneOffsetTransition(loopWindowStart, loopWindowOffset, effectiveWallOffset));
-            }
-            loopSavings = effectiveSavings;
-
-            // apply rules within the window
-            for (TZRule rule : window.ruleList) {
-                if (rule.isTransition(loopSavings)) {
-                    ZoneOffsetTransition trans = rule.toTransition(loopStandardOffset, loopSavings);
-                    if (trans.toEpochSecond() < loopWindowStart.toEpochSecond(loopWindowOffset) == false &&
-                        trans.toEpochSecond() < window.createDateTimeEpochSecond(loopSavings)) {
-                        transitionList.add(trans);
-                        loopSavings = rule.savingAmountSecs;
-                    }
-                }
-            }
-
-            // calculate last rules
-            for (TZRule lastRule : window.lastRuleList) {
-                lastTransitionRuleList.add(lastRule.toTransitionRule(loopStandardOffset, loopSavings));
-                loopSavings = lastRule.savingAmountSecs;
-            }
-
-            // finally we can calculate the true end of the window, passing it to the next window
-            loopWindowOffset = window.createWallOffset(loopSavings);
-            loopWindowStart = LocalDateTime.ofEpochSecond(
-                    window.createDateTimeEpochSecond(loopSavings), 0, loopWindowOffset);
-        }
-
-        return new ZoneRules(
-                firstWindow.standardOffset, firstWallOffset, standardTransitionList,
-                transitionList, lastTransitionRuleList);
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * A definition of a window in the time-line.
-     * The window will have one standard offset and will either have a
-     * fixed DST savings or a set of rules.
-     */
-    class TZWindow {
-        /** The standard offset during the window, not null. */
-        private final ZoneOffset standardOffset;
-        /** The end local time, not null. */
-        private final LocalDateTime windowEnd;
-        /** The type of the end time, not null. */
-        private final TimeDefinition timeDefinition;
-
-        /** The fixed amount of the saving to be applied during this window. */
-        private Integer fixedSavingAmountSecs;
-        /** The rules for the current window. */
-        private List<TZRule> ruleList = new ArrayList<>();
-        /** The latest year that the last year starts at. */
-        private int maxLastRuleStartYear = YEAR_MIN_VALUE;
-        /** The last rules. */
-        private List<TZRule> lastRuleList = new ArrayList<>();
-
-        /**
-         * Constructor.
-         *
-         * @param standardOffset  the standard offset applicable during the window, not null
-         * @param windowEnd  the end of the window, relative to the time definition, null if forever
-         * @param timeDefinition  the time definition for calculating the true end, not null
-         */
-        TZWindow(
-                ZoneOffset standardOffset,
-                LocalDateTime windowEnd,
-                TimeDefinition timeDefinition) {
-            super();
-            this.windowEnd = windowEnd;
-            this.timeDefinition = timeDefinition;
-            this.standardOffset = standardOffset;
-        }
-
-        /**
-         * Sets the fixed savings amount for the window.
-         *
-         * @param fixedSavingAmount  the amount of daylight saving to apply throughout the window, may be null
-         * @throws IllegalStateException if the window already has rules
-         */
-        void setFixedSavings(int fixedSavingAmount) {
-            if (ruleList.size() > 0 || lastRuleList.size() > 0) {
-                throw new IllegalStateException("Window has DST rules, so cannot have fixed savings");
-            }
-            this.fixedSavingAmountSecs = fixedSavingAmount;
-        }
-
-        /**
-         * Adds a rule to the current window.
-         *
-         * @param startYear  the start year of the rule, from MIN_YEAR to MAX_YEAR
-         * @param endYear  the end year of the rule, from MIN_YEAR to MAX_YEAR
-         * @param month  the month of the transition, not null
-         * @param dayOfMonthIndicator  the day-of-month of the transition, adjusted by dayOfWeek,
-         *   from 1 to 31 adjusted later, or -1 to -28 adjusted earlier from the last day of the month
-         * @param dayOfWeek  the day-of-week to adjust to, null if day-of-month should not be adjusted
-         * @param time  the time that the transition occurs as defined by timeDefintion, not null
-         * @param timeEndOfDay  whether midnight is at the end of day
-         * @param timeDefinition  the definition of how to convert local to actual time, not null
-         * @param savingAmountSecs  the amount of saving from the standard offset in seconds
-         * @throws IllegalStateException if the window already has fixed savings
-         * @throws IllegalStateException if the window has reached the maximum capacity of 2000 rules
-         */
-        void addRule(
-                int startYear,
-                int endYear,
-                int month,
-                int dayOfMonthIndicator,
-                int dayOfWeek,
-                LocalTime time,
-                boolean timeEndOfDay,
-                TimeDefinition timeDefinition,
-                int savingAmountSecs) {
-
-            if (fixedSavingAmountSecs != null) {
-                throw new IllegalStateException("Window has a fixed DST saving, so cannot have DST rules");
-            }
-            if (ruleList.size() >= 2000) {
-                throw new IllegalStateException("Window has reached the maximum number of allowed rules");
-            }
-            boolean lastRule = false;
-            if (endYear == YEAR_MAX_VALUE) {
-                lastRule = true;
-                endYear = startYear;
-            }
-            int year = startYear;
-            while (year <= endYear) {
-                TZRule rule = new TZRule(year, month, dayOfMonthIndicator, dayOfWeek, time, timeEndOfDay, timeDefinition, savingAmountSecs);
-                if (lastRule) {
-                    lastRuleList.add(rule);
-                    maxLastRuleStartYear = Math.max(startYear, maxLastRuleStartYear);
-                } else {
-                    ruleList.add(rule);
-                }
-                year++;
-            }
-        }
-
-        /**
-         * Validates that this window is after the previous one.
-         *
-         * @param previous  the previous window, not null
-         * @throws IllegalStateException if the window order is invalid
-         */
-        void validateWindowOrder(TZWindow previous) {
-            if (windowEnd.compareTo(previous.windowEnd) < 0) {
-                throw new IllegalStateException("Windows must be added in date-time order: " +
-                        windowEnd + " < " + previous.windowEnd);
-            }
-        }
-
-        /**
-         * Adds rules to make the last rules all start from the same year.
-         * Also add one more year to avoid weird case where penultimate year has odd offset.
-         *
-         * @param windowStartYear  the window start year
-         * @throws IllegalStateException if there is only one rule defined as being forever
-         */
-        void tidy(int windowStartYear) {
-            if (lastRuleList.size() == 1) {
-                throw new IllegalStateException("Cannot have only one rule defined as being forever");
-            }
-
-            // handle last rules
-            if (windowEnd.equals(LocalDateTime.MAX)) {
-                // setup at least one real rule, which closes off other windows nicely
-                maxLastRuleStartYear = Math.max(maxLastRuleStartYear, windowStartYear) + 1;
-                for (TZRule lastRule : lastRuleList) {
-                    addRule(lastRule.year, maxLastRuleStartYear, lastRule.month, lastRule.dayOfMonthIndicator,
-                        lastRule.dayOfWeek, lastRule.time, lastRule.timeEndOfDay, lastRule.timeDefinition, lastRule.savingAmountSecs);
-                    lastRule.year = maxLastRuleStartYear + 1;
-                }
-                if (maxLastRuleStartYear == YEAR_MAX_VALUE) {
-                    lastRuleList.clear();
-                } else {
-                    maxLastRuleStartYear++;
-                }
-            } else {
-                // convert all within the endYear limit
-                int endYear = windowEnd.getYear();
-                for (TZRule lastRule : lastRuleList) {
-                    addRule(lastRule.year, endYear + 1, lastRule.month, lastRule.dayOfMonthIndicator,
-                        lastRule.dayOfWeek, lastRule.time, lastRule.timeEndOfDay, lastRule.timeDefinition, lastRule.savingAmountSecs);
-                }
-                lastRuleList.clear();
-                maxLastRuleStartYear = YEAR_MAX_VALUE;
-            }
-
-            // ensure lists are sorted
-            Collections.sort(ruleList);
-            Collections.sort(lastRuleList);
-
-            // default fixed savings to zero
-            if (ruleList.size() == 0 && fixedSavingAmountSecs == null) {
-                fixedSavingAmountSecs = 0;
-            }
-        }
-
-        /**
-         * Checks if the window is empty.
-         *
-         * @return true if the window is only a standard offset
-         */
-        boolean isSingleWindowStandardOffset() {
-            return windowEnd.equals(LocalDateTime.MAX) && timeDefinition == TimeDefinition.WALL &&
-                    fixedSavingAmountSecs == null && lastRuleList.isEmpty() && ruleList.isEmpty();
-        }
-
-        /**
-         * Creates the wall offset for the local date-time at the end of the window.
-         *
-         * @param savingsSecs  the amount of savings in use in seconds
-         * @return the created date-time epoch second in the wall offset, not null
-         */
-        ZoneOffset createWallOffset(int savingsSecs) {
-            return ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingsSecs);
-        }
-
-        /**
-         * Creates the offset date-time for the local date-time at the end of the window.
-         *
-         * @param savingsSecs  the amount of savings in use in seconds
-         * @return the created date-time epoch second in the wall offset, not null
-         */
-        long createDateTimeEpochSecond(int savingsSecs) {
-            ZoneOffset wallOffset = createWallOffset(savingsSecs);
-            LocalDateTime ldt = timeDefinition.createDateTime(windowEnd, standardOffset, wallOffset);
-            return ldt.toEpochSecond(wallOffset);
-        }
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * A definition of the way a local time can be converted to an offset time.
-     */
-    class TZRule implements Comparable<TZRule> {
-        private int year;
-        private int month;
-        private int dayOfMonthIndicator;
-        private int dayOfWeek;
-        private LocalTime time;
-        private boolean timeEndOfDay; // Whether the local time is end of day.
-        private TimeDefinition timeDefinition; // The type of the time.
-        private int savingAmountSecs; // The amount of the saving to be applied after this point.
-
-        /**
-         * Constructor.
-         *
-         * @param year  the year
-         * @param month  the month, value from 1 to 12
-         * @param dayOfMonthIndicator  the day-of-month of the transition, adjusted by dayOfWeek,
-         *   from 1 to 31 adjusted later, or -1 to -28 adjusted earlier from the last day of the month
-         * @param dayOfWeek  the day-of-week, -1 if day-of-month is exact
-         * @param time  the time, not null
-         * @param timeEndOfDay  whether midnight is at the end of day
-         * @param timeDefinition  the time definition, not null
-         * @param savingAfterSecs  the savings amount in seconds
-         */
-        TZRule(int year, int month, int dayOfMonthIndicator,
-                int dayOfWeek, LocalTime time, boolean timeEndOfDay,
-                TimeDefinition timeDefinition, int savingAfterSecs) {
-            this.year = year;
-            this.month = month;
-            this.dayOfMonthIndicator = dayOfMonthIndicator;
-            this.dayOfWeek = dayOfWeek;
-            this.time = time;
-            this.timeEndOfDay = timeEndOfDay;
-            this.timeDefinition = timeDefinition;
-            this.savingAmountSecs = savingAfterSecs;
-        }
-
-        /**
-         * Converts this to a transition.
-         *
-         * @param standardOffset  the active standard offset, not null
-         * @param savingsBeforeSecs  the active savings in seconds
-         * @return the transition, not null
-         */
-        ZoneOffsetTransition toTransition(ZoneOffset standardOffset, int savingsBeforeSecs) {
-            // copy of code in ZoneOffsetTransitionRule to avoid infinite loop
-            LocalDate date = toLocalDate();
-            LocalDateTime ldt = LocalDateTime.of(date, time);
-            ZoneOffset wallOffset = ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingsBeforeSecs);
-            LocalDateTime dt = timeDefinition.createDateTime(ldt, standardOffset, wallOffset);
-            ZoneOffset offsetAfter = ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingAmountSecs);
-            return new ZoneOffsetTransition(dt, wallOffset, offsetAfter);
-        }
-
-        /**
-         * Returns the apoch second of this rules with the specified
-         * active standard offset and active savings
-         *
-         * @param standardOffset  the active standard offset, not null
-         * @param savingsBeforeSecs  the active savings in seconds
-         * @return the transition epoch second
-         */
-        long toEpochSecond(ZoneOffset standardOffset, int savingsBeforeSecs) {
-            LocalDateTime ldt = LocalDateTime.of(toLocalDate(), time);
-            ZoneOffset wallOffset = ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingsBeforeSecs);
-            return timeDefinition.createDateTime(ldt, standardOffset, wallOffset)
-                                 .toEpochSecond(wallOffset);
-        }
-
-        /**
-         * Tests if this a real transition with the active savings in seconds
-         *
-         * @param savingsBeforeSecs  the active savings in seconds
-         * @return true, if savings in seconds changes
-         */
-        boolean isTransition(int savingsBeforeSecs) {
-            return savingAmountSecs != savingsBeforeSecs;
-        }
-
-        /**
-         * Converts this to a transition rule.
-         *
-         * @param standardOffset  the active standard offset, not null
-         * @param savingsBeforeSecs  the active savings before the transition in seconds
-         * @return the transition, not null
-         */
-        ZoneOffsetTransitionRule toTransitionRule(ZoneOffset standardOffset, int savingsBeforeSecs) {
-            // optimize stored format
-            if (dayOfMonthIndicator < 0) {
-                if (month != 2) {    // not Month.FEBRUARY
-                    dayOfMonthIndicator = maxLengthOfMonth(month) - 6;
-                }
-            }
-            if (timeEndOfDay && dayOfMonthIndicator > 0 &&
-                (dayOfMonthIndicator == 28 && month == 2) == false) {
-                LocalDate date = LocalDate.of(2004, month, dayOfMonthIndicator).plusDays(1);  // leap-year
-                month = date.getMonth();
-                dayOfMonthIndicator = date.getDayOfMonth();
-                if (dayOfWeek != -1) {
-                    dayOfWeek = plusDayOfWeek(dayOfWeek, 1);
-                }
-                timeEndOfDay = false;
-            }
-            // build rule
-            return new ZoneOffsetTransitionRule(
-                    month, dayOfMonthIndicator, dayOfWeek, time, timeEndOfDay, timeDefinition,
-                    standardOffset,
-                    ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingsBeforeSecs),
-                    ZoneOffset.ofTotalSeconds(standardOffset.getTotalSeconds() + savingAmountSecs));
-        }
-
-        public int compareTo(TZRule other) {
-            int cmp = year - other.year;
-            cmp = (cmp == 0 ? month - other.month : cmp);
-            if (cmp == 0) {
-                // convert to date to handle dow/domIndicator/timeEndOfDay
-                LocalDate thisDate = toLocalDate();
-                LocalDate otherDate = other.toLocalDate();
-                cmp = thisDate.compareTo(otherDate);
-            }
-            cmp = (cmp == 0 ? time.compareTo(other.time) : cmp);
-            return cmp;
-        }
-
-        private LocalDate toLocalDate() {
-            LocalDate date;
-            if (dayOfMonthIndicator < 0) {
-                int monthLen = lengthOfMonth(month, isLeapYear(year));
-                date = LocalDate.of(year, month, monthLen + 1 + dayOfMonthIndicator);
-                if (dayOfWeek != -1) {
-                    date = previousOrSame(date, dayOfWeek);
-                }
-            } else {
-                date = LocalDate.of(year, month, dayOfMonthIndicator);
-                if (dayOfWeek != -1) {
-                    date = nextOrSame(date, dayOfWeek);
-                }
-            }
-            if (timeEndOfDay) {
-                date = date.plusDays(1);
-            }
-            return date;
-        }
-    }
-
-}
-- 
GitLab


From 8233313cb40b84953200071efec938cb5310d0c3 Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Mon, 23 Jun 2014 12:48:16 -0700
Subject: [PATCH 137/192] 8043509: java.awt.Font gets initialized with the
 wrong font name for some Locales

Reviewed-by: bae, jgodinez
---
 .../share/classes/sun/font/TrueTypeFont.java  | 181 +++++++++++++++++-
 .../FontNames/TrueTypeFontLocaleNameTest.java |  74 +++++++
 2 files changed, 247 insertions(+), 8 deletions(-)
 create mode 100644 jdk/test/java/awt/font/FontNames/TrueTypeFontLocaleNameTest.java

diff --git a/jdk/src/share/classes/sun/font/TrueTypeFont.java b/jdk/src/share/classes/sun/font/TrueTypeFont.java
index b7e0e8843ee..e2a88df6e86 100644
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java
@@ -39,10 +39,14 @@ import java.nio.IntBuffer;
 import java.nio.ShortBuffer;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
+import java.util.List;
 import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+
 import sun.java2d.Disposer;
 import sun.java2d.DisposerRecord;
 
@@ -1129,6 +1133,8 @@ public class TrueTypeFont extends FileFont {
 
             nameLocale = sun.awt.SunToolkit.getStartupLocale();
             short nameLocaleID = getLCIDFromLocale(nameLocale);
+            languageCompatibleLCIDs =
+                getLanguageCompatibleLCIDsFromLocale(nameLocale);
 
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
@@ -1145,18 +1151,21 @@ public class TrueTypeFont extends FileFont {
                 switch (nameID) {
 
                 case FAMILY_NAME_ID:
-
+                    boolean compatible = false;
                     if (familyName == null || langID == ENGLISH_LOCALE_ID ||
-                        langID == nameLocaleID)
+                        langID == nameLocaleID ||
+                        (localeFamilyName == null &&
+                         (compatible = isLanguageCompatible(langID))))
                     {
                         buffer.position(namePtr);
                         buffer.get(name, 0, nameLen);
                         tmpName = makeString(name, nameLen, encodingID);
-
                         if (familyName == null || langID == ENGLISH_LOCALE_ID){
                             familyName = tmpName;
                         }
-                        if (langID == nameLocaleID) {
+                        if (langID == nameLocaleID ||
+                            (localeFamilyName == null && compatible))
+                        {
                             localeFamilyName = tmpName;
                         }
                     }
@@ -1175,9 +1184,11 @@ public class TrueTypeFont extends FileFont {
                     break;
 
                 case FULL_NAME_ID:
-
+                    compatible = false;
                     if (fullName == null || langID == ENGLISH_LOCALE_ID ||
-                        langID == nameLocaleID)
+                        langID == nameLocaleID ||
+                        (localeFullName == null &&
+                         (compatible = isLanguageCompatible(langID))))
                     {
                         buffer.position(namePtr);
                         buffer.get(name, 0, nameLen);
@@ -1186,7 +1197,9 @@ public class TrueTypeFont extends FileFont {
                         if (fullName == null || langID == ENGLISH_LOCALE_ID) {
                             fullName = tmpName;
                         }
-                        if (langID == nameLocaleID) {
+                        if (langID == nameLocaleID ||
+                            (localeFullName == null && compatible))
+                        {
                             localeFullName = tmpName;
                         }
                     }
@@ -1697,4 +1710,156 @@ public class TrueTypeFont extends FileFont {
         return "** TrueType Font: Family="+familyName+ " Name="+fullName+
             " style="+style+" fileName="+getPublicFileName();
     }
+
+
+    private static Map<String, short[]> lcidLanguageCompatibilityMap;
+    private static final short[] EMPTY_COMPATIBLE_LCIDS = new short[0];
+
+    // the language compatible LCIDs for this font's nameLocale
+    private short[] languageCompatibleLCIDs;
+
+    /*
+     * Returns true if the given lcid's language is compatible
+     * to the language of the startup Locale. I.e. if
+     * startupLocale.getLanguage().equals(lcidLocale.getLanguage()) would
+     * return true.
+     */
+    private boolean isLanguageCompatible(short lcid){
+        for (short s : languageCompatibleLCIDs) {
+            if (s == lcid) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /*
+     * Returns an array of all the language compatible LCIDs for the
+     * given Locale. This array is later used to find compatible
+     * locales.
+     */
+    private static short[] getLanguageCompatibleLCIDsFromLocale(Locale locale) {
+        if (lcidLanguageCompatibilityMap == null) {
+            createLCIDMap();
+            createLCIDLanguageCompatibilityMap();
+        }
+        String language = locale.getLanguage();
+        short[] result = lcidLanguageCompatibilityMap.get(language);
+        return result == null ? EMPTY_COMPATIBLE_LCIDS : result;
+    }
+
+//     private static void prtLine(String s) {
+//        System.out.println(s);
+//     }
+
+//     /*
+//      * Initializes the map from Locale keys (e.g. "en_BZ" or "de")
+//      * to language compatible LCIDs.
+//      * This map could be statically created based on the fixed known set
+//      * added to lcidMap.
+//      */
+//     private static void createLCIDLanguageCompatibilityMap() {
+//         if (lcidLanguageCompatibilityMap != null) {
+//             return;
+//         }
+//         HashMap<String, List<Short>> result = new HashMap<>();
+//         for (Entry<String, Short> e : lcidMap.entrySet()) {
+//             String language = e.getKey();
+//             int index = language.indexOf('_');
+//             if (index != -1) {
+//                 language = language.substring(0, index);
+//             }
+//             List<Short> list = result.get(language);
+//             if (list == null) {
+//                 list = new ArrayList<>();
+//                 result.put(language, list);
+//             }
+//             if (index == -1) {
+//                 list.add(0, e.getValue());
+//             } else{
+//                 list.add(e.getValue());
+//             }
+//         }
+//         Map<String, short[]> compMap = new HashMap<>();
+//         for (Entry<String, List<Short>> e : result.entrySet()) {
+//             if (e.getValue().size() > 1) {
+//                 List<Short> list = e.getValue();
+//                 short[] shorts = new short[list.size()];
+//                 for (int i = 0; i < shorts.length; i++) {
+//                     shorts[i] = list.get(i);
+//                 }
+//                 compMap.put(e.getKey(), shorts);
+//             }
+//         }
+
+//         /* Now dump code to init the map to System.out */
+//         prtLine("    private static void createLCIDLanguageCompatibilityMap() {");
+//         prtLine("");
+
+//         prtLine("        Map<String, short[]> map = new HashMap<>();");
+//         prtLine("");
+//         prtLine("        short[] sarr;");
+//         for (Entry<String, short[]> e : compMap.entrySet()) {
+//             String lang = e.getKey();
+//             short[] ids = e.getValue();
+//             StringBuilder sb = new StringBuilder("sarr = new short[] { ");
+//             for (int i = 0; i < ids.length; i++) {
+//                 sb.append(ids[i]+", ");
+//             }
+//             sb.append("}");
+//             prtLine("        " + sb + ";");
+//             prtLine("        map.put(\"" + lang + "\", sarr);");
+//         }
+//         prtLine("");
+//         prtLine("        lcidLanguageCompatibilityMap = map;");
+//         prtLine("    }");
+//         /* done dumping map */
+
+//         lcidLanguageCompatibilityMap = compMap;
+//     }
+
+    private static void createLCIDLanguageCompatibilityMap() {
+
+        Map<String, short[]> map = new HashMap<>();
+
+        short[] sarr;
+        sarr = new short[] { 1031, 3079, 5127, 2055, 4103, };
+        map.put("de", sarr);
+        sarr = new short[] { 1044, 2068, };
+        map.put("no", sarr);
+        sarr = new short[] { 1049, 2073, };
+        map.put("ru", sarr);
+        sarr = new short[] { 1053, 2077, };
+        map.put("sv", sarr);
+        sarr = new short[] { 1046, 2070, };
+        map.put("pt", sarr);
+        sarr = new short[] { 1131, 3179, 2155, };
+        map.put("qu", sarr);
+        sarr = new short[] { 1086, 2110, };
+        map.put("ms", sarr);
+        sarr = new short[] { 11273, 3081, 12297, 8201, 10249, 4105, 13321, 6153, 7177, 5129, 2057, };
+        map.put("en", sarr);
+        sarr = new short[] { 1050, 4122, };
+        map.put("hr", sarr);
+        sarr = new short[] { 1040, 2064, };
+        map.put("it", sarr);
+        sarr = new short[] { 1036, 5132, 6156, 2060, 3084, 4108, };
+        map.put("fr", sarr);
+        sarr = new short[] { 1034, 12298, 14346, 2058, 8202, 19466, 17418, 9226, 13322, 5130, 7178, 11274, 16394, 4106, 10250, 6154, 18442, 20490, 15370, };
+        map.put("es", sarr);
+        sarr = new short[] { 1028, 3076, 5124, 4100, 2052, };
+        map.put("zh", sarr);
+        sarr = new short[] { 1025, 8193, 16385, 9217, 2049, 14337, 15361, 11265, 13313, 10241, 7169, 12289, 4097, 5121, 6145, 3073, };
+        map.put("ar", sarr);
+        sarr = new short[] { 1083, 3131, 2107, };
+        map.put("se", sarr);
+        sarr = new short[] { 1048, 2072, };
+        map.put("ro", sarr);
+        sarr = new short[] { 1043, 2067, };
+        map.put("nl", sarr);
+        sarr = new short[] { 7194, 3098, };
+        map.put("sr", sarr);
+
+        lcidLanguageCompatibilityMap = map;
+    }
 }
diff --git a/jdk/test/java/awt/font/FontNames/TrueTypeFontLocaleNameTest.java b/jdk/test/java/awt/font/FontNames/TrueTypeFontLocaleNameTest.java
new file mode 100644
index 00000000000..5e4d71d2eaa
--- /dev/null
+++ b/jdk/test/java/awt/font/FontNames/TrueTypeFontLocaleNameTest.java
@@ -0,0 +1,74 @@
+
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043509
+ * @summary Test locale famlly falls back to same language before English
+ * @run main/othervm TrueTypeFontLocaleNameTest
+ */
+
+import java.awt.Font;
+import java.util.Locale;
+
+public class TrueTypeFontLocaleNameTest {
+
+    public static void main(String[] args) {
+
+        String os = System.getProperty("os.name", "");
+        if (!os.toLowerCase().startsWith("win")) {
+            return;
+        }
+        System.setProperty("user.language", "de");
+        System.setProperty("user.country", "AT");
+        Locale de_atLocale = new Locale("de", "AT");
+        Locale.setDefault(de_atLocale);
+
+        String family = "Verdana";
+        Font font = new Font(family, Font.BOLD, 12);
+        if (!font.getFamily(Locale.ENGLISH).equals(family)) {
+            System.out.println(family + " not found - skipping test.");
+            return;
+        }
+
+        String atFontName = font.getFontName();
+        Locale deGELocale = new Locale("de", "GE");
+        String deFontName = font.getFontName(deGELocale);
+        System.out.println("Austrian font name: " + atFontName);
+        System.out.println("German font name: " + deFontName);
+
+        String deLangFullName = "Verdana Fett";
+        // We expect "Fett" for "Bold" when the language is German.
+        // This font does have that so these should both be equal and
+        // say "Verdana Fett"
+        if (!deFontName.equals(atFontName)) {
+            throw new RuntimeException("Font names differ " +
+                                       deFontName + " " + atFontName);
+        }
+        if (!deLangFullName.equals(deFontName)) {
+            throw new RuntimeException("Font name is not " + deLangFullName +
+                                       " instead got " + deFontName);
+        }
+    }
+}
-- 
GitLab


From 3761efd83563792605eac2bd8ddfd6dba0f3fc15 Mon Sep 17 00:00:00 2001
From: Mikael Vidstedt <mikael@openjdk.org>
Date: Mon, 23 Jun 2014 14:08:45 -0700
Subject: [PATCH 138/192] 8047763: Recognize sparc64 as a sparc platform

Reviewed-by: dholmes
---
 common/autoconf/generated-configure.sh | 6 +++---
 common/autoconf/platform.m4            | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 1a4ad9aef7c..2ec5ac45fb8 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -4311,7 +4311,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1403110135
+DATE_WHEN_GENERATED=1403557683
 
 ###############################################################################
 #
@@ -13610,7 +13610,7 @@ test -n "$target_alias" &&
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
       ;;
-    sparcv9)
+    sparcv9|sparc64)
       VAR_CPU=sparcv9
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=64
@@ -13741,7 +13741,7 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; }
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
       ;;
-    sparcv9)
+    sparcv9|sparc64)
       VAR_CPU=sparcv9
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=64
diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4
index 1f06f0ce7d5..54838a3e72c 100644
--- a/common/autoconf/platform.m4
+++ b/common/autoconf/platform.m4
@@ -84,7 +84,7 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
       VAR_CPU_BITS=32
       VAR_CPU_ENDIAN=big
       ;;
-    sparcv9)
+    sparcv9|sparc64)
       VAR_CPU=sparcv9
       VAR_CPU_ARCH=sparc
       VAR_CPU_BITS=64
-- 
GitLab


From fca14b0d55e9abd4217ee4190caa82829e1f3880 Mon Sep 17 00:00:00 2001
From: Alexander Zvegintsev <azvegint@openjdk.org>
Date: Tue, 24 Jun 2014 10:36:35 +0400
Subject: [PATCH 139/192] 8042094: Test
 javax/swing/JFileChooser/7036025/bug7036025.java fails with
 java.lang.NullPointerException on Windows x86

Reviewed-by: ahgross, art, pchelko, mschoene
---
 jdk/src/share/classes/sun/awt/shell/ShellFolder.java  | 11 ++++++-----
 .../sun/awt/shell/Win32ShellFolderManager2.java       |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
index 3795e146f2a..04b57c9d74f 100644
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
@@ -33,8 +33,6 @@ import java.io.FileNotFoundException;
 import java.util.*;
 import java.util.concurrent.Callable;
 
-import sun.reflect.misc.ReflectUtil;
-
 /**
  * @author Michael Martak
  * @since 1.4
@@ -201,16 +199,19 @@ public abstract class ShellFolder extends File {
 
     // Static
 
-    private static ShellFolderManager shellFolderManager;
+    private static final ShellFolderManager shellFolderManager;
 
-    private static Invoker invoker;
+    private static final Invoker invoker;
 
     static {
         String managerClassName = (String)Toolkit.getDefaultToolkit().
                                       getDesktopProperty("Shell.shellFolderManager");
         Class<?> managerClass = null;
         try {
-            managerClass = ReflectUtil.forName(managerClassName);
+            managerClass = Class.forName(managerClassName, false, null);
+            if (!ShellFolderManager.class.isAssignableFrom(managerClass)) {
+                managerClass = null;
+            }
         // swallow the exceptions below and use default shell folder
         } catch(ClassNotFoundException e) {
         } catch(NullPointerException e) {
diff --git a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
index 426a0eb77ff..6c1f4a9a89c 100644
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
@@ -51,7 +51,7 @@ import sun.awt.util.ThreadGroupUtils;
  * @since 1.4
  */
 
-public class Win32ShellFolderManager2 extends ShellFolderManager {
+final class Win32ShellFolderManager2 extends ShellFolderManager {
 
     static {
         // Load library here
-- 
GitLab


From 02990e046b624d7b842abfecc7077ec641ac44ca Mon Sep 17 00:00:00 2001
From: Andrei Eremeev <andrei.eremeev@oracle.com>
Date: Tue, 24 Jun 2014 12:27:37 +0400
Subject: [PATCH 140/192] 7112454: TEST_BUG:
 java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.html
 failed

Reviewed-by: anthony, pchelko
---
 .../PopdownGeneratesMouseEvents.html          |  45 ++++++
 .../PopdownGeneratesMouseEvents.java          | 138 ++++++++++++++++++
 2 files changed, 183 insertions(+)
 create mode 100644 jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.html
 create mode 100644 jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.java

diff --git a/jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.html b/jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.html
new file mode 100644
index 00000000000..4e79bf76a53
--- /dev/null
+++ b/jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.html
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2011, 2014, 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
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+<html>
+<!--
+  @test
+  @bug 6200670
+  @summary MouseMoved events are triggered by Choice when mouse is moved outside the component, XToolkit
+  @library ../../regtesthelpers/
+  @author andrei.dmitriev area=choice
+  @build Util
+  @run applet PopdownGeneratesMouseEvents.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>PopdownGeneratesMouseEvents<br>Bug ID: 6200670 </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="PopdownGeneratesMouseEvents.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
diff --git a/jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.java b/jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.java
new file mode 100644
index 00000000000..c2d93bd053d
--- /dev/null
+++ b/jdk/test/java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2011, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 6200670
+  @summary MouseMoved events are triggered by Choice when mouse is moved outside the component, XToolkit
+  @library ../../regtesthelpers/
+  @author andrei.dmitriev area=choice
+  @build Util
+  @run applet PopdownGeneratesMouseEvents.html
+*/
+
+import test.java.awt.regtesthelpers.Util;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+public class PopdownGeneratesMouseEvents extends Applet {
+    private volatile Robot robot;
+    private final Choice choice1 = new Choice();
+
+    private volatile MouseMotionHandler mmh;
+
+    public void init() {
+        for (int i = 1; i < 10; i++) {
+            choice1.add("item-0" + i);
+        }
+        choice1.setForeground(Color.RED);
+        choice1.setBackground(Color.RED);
+        mmh = new MouseMotionHandler();
+        choice1.addMouseMotionListener(mmh);
+        Button b1 = new Button("FirstButton");
+        Button b2 = new Button("SecondButton");
+        add(b1);
+        add(choice1);
+        add(b2);
+        setLayout (new FlowLayout());
+    }
+
+    public void start() {
+        setSize(300, 200);
+        setVisible(true);
+        validate();
+        String toolkit = Toolkit.getDefaultToolkit().getClass().getName();
+
+        /*
+         * Choice should not generate MouseEvents outside of Choice
+         * Test for XAWT only.
+         */
+        try{
+            robot = new Robot();
+            robot.setAutoWaitForIdle(true);
+            robot.setAutoDelay(50);
+
+            if (toolkit.equals("sun.awt.X11.XToolkit")) {
+                testMouseMoveOutside();
+            } else {
+                System.out.println("This test is for XToolkit only. Now using "
+                                        + toolkit + ". Automatically passed.");
+                return;
+            }
+        } catch (Throwable e) {
+            throw new RuntimeException("Test failed. Exception thrown: " + e);
+        }
+        System.out.println("Passed : Choice should not generate MouseEvents outside of Choice.");
+    }
+
+    private void testMouseMoveOutside() {
+        waitForIdle();
+        Point pt = choice1.getLocationOnScreen();
+        robot.mouseMove(pt.x + choice1.getWidth() / 2, pt.y + choice1.getHeight() / 2);
+        waitForIdle();
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        waitForIdle();
+
+        Color color = robot.getPixelColor(pt.x + choice1.getWidth() / 2,
+                                          pt.y + 3 * choice1.getHeight());
+        if (!color.equals(Color.RED)) {
+            throw new RuntimeException("Choice wasn't opened with LEFTMOUSE button");
+        }
+
+        pt = getLocationOnScreen();
+        robot.mouseMove(pt.x + getWidth() * 2, pt.y + getHeight() * 2);
+        mmh.testStarted = true;
+
+        int x0 = pt.x + getWidth() * 3 / 2;
+        int y0 = pt.y + getHeight() * 3 / 2;
+        int x1 = pt.x + getWidth() * 2;
+        int y1 = pt.y + getHeight() * 2;
+
+        Util.mouseMove(robot, new Point(x0, y0), new Point(x1, y0));
+        Util.mouseMove(robot, new Point(x1, y0), new Point(x1, y1));
+
+        waitForIdle();
+        //close opened choice
+        robot.keyPress(KeyEvent.VK_ESCAPE);
+        robot.keyRelease(KeyEvent.VK_ESCAPE);
+    }
+
+    private void waitForIdle() {
+        Util.waitForIdle(robot);
+        robot.delay(500);
+    }
+}
+
+class MouseMotionHandler extends MouseMotionAdapter {
+    public volatile boolean testStarted;
+    public void mouseMoved(MouseEvent ke) {
+        if (testStarted) {
+            throw new RuntimeException("Test failed: Choice generated MouseMove events while moving mouse outside of Choice");
+        }
+    }
+    public void mouseDragged(MouseEvent ke) {
+    }
+}
-- 
GitLab


From 566786aba609c21e2e08d90c11fe8ef55eb544d3 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Tue, 24 Jun 2014 19:43:44 +0530
Subject: [PATCH 141/192] 8047959: bindings created for declarations in eval
 code are not mutable

Reviewed-by: jlaskey, attila
---
 .../internal/codegen/CodeGenerator.java       | 12 ++++
 .../internal/codegen/FieldObjectCreator.java  |  6 +-
 .../codegen/LocalVariableTypesCalculator.java |  2 +-
 .../nashorn/internal/codegen/MapCreator.java  | 22 ++++---
 .../jdk/nashorn/internal/objects/Global.java  |  2 +-
 .../jdk/nashorn/internal/runtime/Context.java | 21 ++++++-
 .../jdk/nashorn/internal/runtime/Source.java  | 61 ++++++++++++++++---
 nashorn/test/script/basic/JDK-8047959.js      | 59 ++++++++++++++++++
 .../test/script/basic/JDK-8047959.js.EXPECTED | 15 +++++
 9 files changed, 179 insertions(+), 21 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8047959.js
 create mode 100644 nashorn/test/script/basic/JDK-8047959.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index 984440f39bf..110e1109d4a 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -211,6 +211,9 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
      *  by reflection in class installation */
     private final Compiler compiler;
 
+    /** Is the current code submitted by 'eval' call? */
+    private final boolean evalCode;
+
     /** Call site flags given to the code generator to be used for all generated call sites */
     private final int callSiteFlags;
 
@@ -265,6 +268,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
     CodeGenerator(final Compiler compiler, final int[] continuationEntryPoints) {
         super(new CodeGeneratorLexicalContext());
         this.compiler                = compiler;
+        this.evalCode                = compiler.getSource().isEvalCode();
         this.continuationEntryPoints = continuationEntryPoints;
         this.callSiteFlags           = compiler.getScriptEnvironment()._callsite_flags;
         this.log                     = initLogger(compiler.getContext());
@@ -290,6 +294,14 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
         return lc.getCurrentFunction().isStrict() ? callSiteFlags | CALLSITE_STRICT : callSiteFlags;
     }
 
+    /**
+     * Are we generating code for 'eval' code?
+     * @return true if currently compiled code is 'eval' code.
+     */
+    boolean isEvalCode() {
+        return evalCode;
+    }
+
     /**
      * Load an identity node
      *
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java b/nashorn/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java
index 7e461088747..86dcd772db3 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java
@@ -62,6 +62,8 @@ public abstract class FieldObjectCreator<T> extends ObjectCreator<T> {
 
     /** call site flags to be used for invocations */
     private final int callSiteFlags;
+    /** are we creating this field object from 'eval' code? */
+    private final boolean evalCode;
 
     /**
      * Constructor
@@ -88,7 +90,7 @@ public abstract class FieldObjectCreator<T> extends ObjectCreator<T> {
     FieldObjectCreator(final CodeGenerator codegen, final List<MapTuple<T>> tuples, final boolean isScope, final boolean hasArguments) {
         super(codegen, tuples, isScope, hasArguments);
         this.callSiteFlags = codegen.getCallSiteFlags();
-
+        this.evalCode = codegen.isEvalCode();
         countFields();
         findClass();
     }
@@ -153,7 +155,7 @@ public abstract class FieldObjectCreator<T> extends ObjectCreator<T> {
     @Override
     protected PropertyMap makeMap() {
         assert propertyMap == null : "property map already initialized";
-        propertyMap = newMapCreator(fieldObjectClass).makeFieldMap(hasArguments(), fieldCount, paddedFieldCount);
+        propertyMap = newMapCreator(fieldObjectClass).makeFieldMap(hasArguments(), fieldCount, paddedFieldCount, evalCode);
         return propertyMap;
     }
 
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 5ffe4b7f66b..c372d952c0a 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -584,7 +584,7 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
         }
         setCompilerConstantAsObject(functionNode, CompilerConstants.THIS);
 
-        // NOTE: coarse-grained. If we wanted to solve it completely precisely,
+        // TODO: coarse-grained. If we wanted to solve it completely precisely,
         // we'd also need to push/pop its type when handling WithNode (so that
         // it can go back to undefined after a 'with' block.
         if(functionNode.hasScopeBlock() || functionNode.needsParentScope()) {
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java b/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java
index 8e7cfa3fd78..d4800f8a892 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java
@@ -63,13 +63,13 @@ public class MapCreator<T> {
     /**
      * Constructs a property map based on a set of fields.
      *
-     * @param hasArguments does the created object have an "arguments" property
+     * @param hasArguments  does the created object have an "arguments" property
      * @param fieldCount    Number of fields in use.
-     * @param fieldMaximum Number of fields available.
-     *
+     * @param fieldMaximum  Number of fields available.
+     * @param evalCode      is this property map created for 'eval' code?
      * @return New map populated with accessor properties.
      */
-    PropertyMap makeFieldMap(final boolean hasArguments, final int fieldCount, final int fieldMaximum) {
+    PropertyMap makeFieldMap(final boolean hasArguments, final int fieldCount, final int fieldMaximum, final boolean evalCode) {
         final List<Property> properties = new ArrayList<>();
         assert tuples != null;
 
@@ -79,7 +79,7 @@ public class MapCreator<T> {
             final Class<?> initialType = tuple.getValueType();
 
             if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
-                final int      flags    = getPropertyFlags(symbol, hasArguments);
+                final int      flags    = getPropertyFlags(symbol, hasArguments, evalCode);
                 final Property property = new AccessorProperty(
                         key,
                         flags,
@@ -104,7 +104,7 @@ public class MapCreator<T> {
 
             //TODO initial type is object here no matter what. Is that right?
             if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
-                final int flags = getPropertyFlags(symbol, hasArguments);
+                final int flags = getPropertyFlags(symbol, hasArguments, false);
                 properties.add(
                         new SpillProperty(
                                 key,
@@ -124,7 +124,7 @@ public class MapCreator<T> {
      *
      * @return flags to use for fields
      */
-    static int getPropertyFlags(final Symbol symbol, final boolean hasArguments) {
+    static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode) {
         int flags = 0;
 
         if (symbol.isParam()) {
@@ -135,7 +135,13 @@ public class MapCreator<T> {
             flags |= Property.HAS_ARGUMENTS;
         }
 
-        if (symbol.isScope()) {
+        // See ECMA 5.1 10.5 Declaration Binding Instantiation.
+        // Step 2  If code is eval code, then let configurableBindings
+        // be true else let configurableBindings be false.
+        // We have to make vars, functions declared in 'eval' code
+        // configurable. But vars, functions from any other code is
+        // not configurable.
+        if (symbol.isScope() && !evalCode) {
             flags |= Property.NOT_CONFIGURABLE;
         }
 
diff --git a/nashorn/src/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk/nashorn/internal/objects/Global.java
index 469466fe93d..4e2ba68a603 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java
@@ -883,7 +883,7 @@ public final class Global extends ScriptObject implements Scope {
         final Global global = Global.instance();
         final ScriptObject scope = self instanceof ScriptObject ? (ScriptObject)self : global;
 
-        return global.getContext().eval(scope, str.toString(), callThis, location, Boolean.TRUE.equals(strict));
+        return global.getContext().eval(scope, str.toString(), callThis, location, Boolean.TRUE.equals(strict), true);
     }
 
     /**
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk/nashorn/internal/runtime/Context.java
index d521598986a..aae43b11818 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java
@@ -560,12 +560,29 @@ public final class Context {
      * @param callThis     "this" to be passed to the evaluated code
      * @param location     location of the eval call
      * @param strict       is this {@code eval} call from a strict mode code?
+     * @return the return value of the {@code eval}
+     */
+    public Object eval(final ScriptObject initialScope, final String string,
+            final Object callThis, final Object location, final boolean strict) {
+        return eval(initialScope, string, callThis, location, strict, false);
+    }
+
+    /**
+     * Entry point for {@code eval}
+     *
+     * @param initialScope The scope of this eval call
+     * @param string       Evaluated code as a String
+     * @param callThis     "this" to be passed to the evaluated code
+     * @param location     location of the eval call
+     * @param strict       is this {@code eval} call from a strict mode code?
+     * @param evalCall     is this called from "eval" builtin?
      *
      * @return the return value of the {@code eval}
      */
-    public Object eval(final ScriptObject initialScope, final String string, final Object callThis, final Object location, final boolean strict) {
+    public Object eval(final ScriptObject initialScope, final String string,
+            final Object callThis, final Object location, final boolean strict, final boolean evalCall) {
         final String  file       = location == UNDEFINED || location == null ? "<eval>" : location.toString();
-        final Source  source     = sourceFor(file, string);
+        final Source  source     = sourceFor(file, string, evalCall);
         final boolean directEval = location != UNDEFINED; // is this direct 'eval' call or indirectly invoked eval?
         final Global  global = Context.getGlobal();
         ScriptObject scope = initialScope;
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Source.java b/nashorn/src/jdk/nashorn/internal/runtime/Source.java
index b9f6fd0dba4..d64bbfa26e6 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java
@@ -142,29 +142,34 @@ public final class Source implements Loggable {
         long lastModified();
 
         char[] array();
+
+        boolean isEvalCode();
     }
 
     private static class RawData implements Data {
         private final char[] array;
+        private final boolean evalCode;
         private int hash;
 
-        private RawData(final char[] array) {
+        private RawData(final char[] array, final boolean evalCode) {
             this.array = Objects.requireNonNull(array);
+            this.evalCode = evalCode;
         }
 
-        private RawData(final String source) {
+        private RawData(final String source, final boolean evalCode) {
             this.array = Objects.requireNonNull(source).toCharArray();
+            this.evalCode = evalCode;
         }
 
         private RawData(final Reader reader) throws IOException {
-            this(readFully(reader));
+            this(readFully(reader), false);
         }
 
         @Override
         public int hashCode() {
             int h = hash;
             if (h == 0) {
-                h = hash = Arrays.hashCode(array);
+                h = hash = Arrays.hashCode(array) ^ (evalCode? 1 : 0);
             }
             return h;
         }
@@ -175,7 +180,8 @@ public final class Source implements Loggable {
                 return true;
             }
             if (obj instanceof RawData) {
-                return Arrays.equals(array, ((RawData)obj).array);
+                final RawData other = (RawData)obj;
+                return Arrays.equals(array, other.array) && evalCode == other.evalCode;
             }
             return false;
         }
@@ -206,6 +212,10 @@ public final class Source implements Loggable {
         }
 
 
+        @Override
+        public boolean isEvalCode() {
+            return evalCode;
+        }
     }
 
     private static class URLData implements Data {
@@ -287,6 +297,11 @@ public final class Source implements Loggable {
             return array;
         }
 
+        @Override
+        public boolean isEvalCode() {
+            return false;
+        }
+
         boolean isDeferred() {
             return array == null;
         }
@@ -368,6 +383,18 @@ public final class Source implements Loggable {
         return data.array();
     }
 
+    /**
+     * Returns a Source instance
+     *
+     * @param name    source name
+     * @param content contents as char array
+     * @param isEval does this represent code from 'eval' call?
+     * @return source instance
+     */
+    public static Source sourceFor(final String name, final char[] content, final boolean isEval) {
+        return new Source(name, baseName(name), new RawData(content, isEval));
+    }
+
     /**
      * Returns a Source instance
      *
@@ -377,7 +404,7 @@ public final class Source implements Loggable {
      * @return source instance
      */
     public static Source sourceFor(final String name, final char[] content) {
-        return new Source(name, baseName(name), new RawData(content));
+        return sourceFor(name, content, false);
     }
 
     /**
@@ -385,11 +412,22 @@ public final class Source implements Loggable {
      *
      * @param name    source name
      * @param content contents as string
+     * @param isEval does this represent code from 'eval' call?
+     * @return source instance
+     */
+    public static Source sourceFor(final String name, final String content, final boolean isEval) {
+        return new Source(name, baseName(name), new RawData(content, isEval));
+    }
+
+    /**
+     * Returns a Source instance
      *
+     * @param name    source name
+     * @param content contents as string
      * @return source instance
      */
     public static Source sourceFor(final String name, final String content) {
-        return new Source(name, baseName(name), new RawData(content));
+        return sourceFor(name, content, false);
     }
 
     /**
@@ -554,6 +592,15 @@ public final class Source implements Loggable {
         return data.url();
     }
 
+    /**
+     * Returns whether this source was submitted via 'eval' call or not.
+     *
+     * @return true if this source represents code submitted via 'eval'
+     */
+    public boolean isEvalCode() {
+        return data.isEvalCode();
+    }
+
     /**
      * Find the beginning of the line containing position.
      * @param position Index to offending token.
diff --git a/nashorn/test/script/basic/JDK-8047959.js b/nashorn/test/script/basic/JDK-8047959.js
new file mode 100644
index 00000000000..9ad1c8d1a22
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047959.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047959: bindings created for declarations in eval code are not mutable
+ *
+ * @test
+ * @run
+ */
+
+eval("var x=10;");
+print('delete x? ' + delete x);
+print('typeof x = ' + typeof x);
+
+eval("function f() {}");
+print('delete f? ' + delete f);
+print('typeof f = ' + typeof f);
+
+var foo = 223;
+print('delete foo? ' + delete foo);
+print('typeof foo = ' + typeof foo);
+
+function func() {}
+print('delete func? ' + delete func);
+print('typeof func = ' + typeof func);
+
+eval("var foo = 33;");
+print("delete foo? " + delete foo);
+print("typeof foo? " + typeof foo);
+print("foo = " + foo);
+
+var x = "global"; 
+(function(){
+    eval("var x='local'");
+    print("x in function = "+ x);
+    print("delete x? = " + delete x);
+    print("x after delete = " + x);
+})();
+print("x = " + x); 
diff --git a/nashorn/test/script/basic/JDK-8047959.js.EXPECTED b/nashorn/test/script/basic/JDK-8047959.js.EXPECTED
new file mode 100644
index 00000000000..935f1002dfb
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047959.js.EXPECTED
@@ -0,0 +1,15 @@
+delete x? false
+typeof x = number
+delete f? true
+typeof f = undefined
+delete foo? false
+typeof foo = number
+delete func? false
+typeof func = function
+delete foo? false
+typeof foo? number
+foo = 33
+x in function = local
+delete x? = true
+x after delete = global
+x = global
-- 
GitLab


From d983b0b09c1717c2f7dc39a0b5e9903b712b6172 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Tue, 24 Jun 2014 19:29:41 +0200
Subject: [PATCH 142/192] 8048009: Type info caching accidentally defeated

Reviewed-by: hannesw, jlaskey
---
 .../nashorn/internal/codegen/Compiler.java    | 10 ++--------
 .../codegen/OptimisticTypesPersistence.java   | 20 +++++++++----------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
index 32888b0c2b0..f5281ba9d56 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
@@ -45,7 +45,6 @@ import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -122,11 +121,7 @@ public final class Compiler implements Loggable {
      * that using whatever was at program point 17 as an int failed.
      */
     private final Map<Integer, Type> invalidatedProgramPoints;
-    /**
-     * The snapshot of invalidatedProgramPoints before the compilation. Used to compare it to invalidatedProgramPoints,
-     * and if the two are equal, not write the type information to a file.
-     */
-    private final Map<Integer, Type> invalidatedProgramPointsOnEntry;
+
     /**
      * Descriptor of the location where we write the type information after compilation.
      */
@@ -381,7 +376,6 @@ public final class Compiler implements Loggable {
         this.firstCompileUnitName     = firstCompileUnitName();
         this.strict                   = isStrict;
 
-        this.invalidatedProgramPointsOnEntry = typeInformationFile == null ? null : new HashMap<>(this.invalidatedProgramPoints);
         this.optimistic = env._optimistic_types;
     }
 
@@ -537,7 +531,7 @@ public final class Compiler implements Loggable {
             time += (env.isTimingEnabled() ? phase.getEndTime() - phase.getStartTime() : 0L);
         }
 
-        if(typeInformationFile != null && !phases.isRestOfCompilation() && !Objects.equals(invalidatedProgramPoints, invalidatedProgramPointsOnEntry)) {
+        if(typeInformationFile != null && !phases.isRestOfCompilation()) {
             OptimisticTypesPersistence.store(typeInformationFile, invalidatedProgramPoints);
         }
 
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
index 317a3cf4f60..b90fa026ddb 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
@@ -136,11 +136,7 @@ public final class OptimisticTypesPersistence {
                         }
                         dout.flush();
                     } catch(final Exception e) {
-                        final long now = System.currentTimeMillis();
-                        if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
-                            getLogger().warning("Failed to write " + file, e);
-                            lastReportedError = now;
-                        }
+                        reportError("write", file, e);
                     }
                 }
                 return null;
@@ -190,17 +186,21 @@ public final class OptimisticTypesPersistence {
                         }
                     }
                 } catch (final Exception e) {
-                    final long now = System.currentTimeMillis();
-                    if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
-                        getLogger().warning("Failed to read " + file, e);
-                        lastReportedError = now;
-                    }
+                    reportError("read", file, e);
                     return null;
                 }
             }
         });
     }
 
+    private static void reportError(final String msg, final File file, final Exception e) {
+        final long now = System.currentTimeMillis();
+        if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
+            getLogger().warning(String.format("Failed to %s %s", msg, file), e);
+            lastReportedError = now;
+        }
+    }
+
     private static File createCacheDir() {
         if(Options.getBooleanProperty("nashorn.typeInfo.disabled")) {
             return null;
-- 
GitLab


From 90e98e48a18365afedd06a9d6bdc952165c8ada1 Mon Sep 17 00:00:00 2001
From: Mike Duigou <mduigou@openjdk.org>
Date: Tue, 24 Jun 2014 15:21:47 -0700
Subject: [PATCH 143/192] 8047925: Add mercurial version checks to
 get_source.sh

Reviewed-by: tbell, mikael
---
 get_source.sh | 47 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/get_source.sh b/get_source.sh
index f83a3766c12..21bafe05609 100644
--- a/get_source.sh
+++ b/get_source.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2014, 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,9 +25,48 @@
 # questions.
 #
 
-# Get clones of all nested repositories
-sh ./common/bin/hgforest.sh clone "$@" || exit 1
+# Version check
+
+# required
+reqdmajor=1
+reqdminor=5
+reqdrev=0
+
+# requested
+rqstmajor=2
+rqstminor=6
+rqstrev=3
+
+# installed
+hgwhere="`which hg 2> /dev/null | grep -v '^no hg in '`"
+if [ "x$hgwhere" = "x" ]; then
+  echo "ERROR: Could not locate Mercurial command" >&2
+  exit 126
+fi
+
+hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \(.*\))\$@\1@p'`"
+if [ "x${hgversion}" = "x" ] ; then
+  echo "ERROR: Could not determine Mercurial version" >&2
+  exit 126
+fi
+
+hgmajor="`echo $hgversion | cut -f 1 -d .`"
+hgminor="`echo $hgversion | cut -f 2 -d .`"
+hgrev="`echo $hgversion.0 | cut -f 3 -d .`" # rev is omitted for minor and major releases
+
+# Require
+if [ $hgmajor -lt $reqdmajor -o \( $hgmajor -eq $reqdmajor -a $hgminor -lt $reqdminor \) -o \( $hgmajor -eq $reqdmajor -a $hgminor -eq $reqdminor -a $hgrev -lt $reqdrev \) ] ; then
+  echo "ERROR: Mercurial version $reqdmajor.$reqdminor.$reqdrev or later is required. $hgwhere is version $hgversion" >&2
+  exit 126
+fi
+
+# Request
+if [ $hgmajor -lt $rqstmajor -o \( $hgmajor -eq $rqstmajor -a $hgminor -lt $rqstminor \) -o \( $hgmajor -eq $rqstmajor -a $hgminor -eq $rqstminor -a $hgrev -lt $rqstrev \) ] ; then
+  echo "WARNING: Mercurial version $rqstmajor.$rqstminor.$rqstrev or later is recommended. $hgwhere is version $hgversion" >&2
+fi
+
+# Get clones of all absent nested repositories (harmless if already exist)
+sh ./common/bin/hgforest.sh clone "$@" || exit $?
 
 # Update all existing repositories to the latest sources
 sh ./common/bin/hgforest.sh pull -u
-
-- 
GitLab


From 40c9be9c9e3f233ec18616981fed5cec5215d4b4 Mon Sep 17 00:00:00 2001
From: Mikael Vidstedt <mikael@openjdk.org>
Date: Tue, 24 Jun 2014 20:29:52 -0700
Subject: [PATCH 144/192] 8047740: Add hotspot testset to jprt.properties

Reviewed-by: dholmes
---
 make/jprt.properties | 525 ++++++++++++++++++++++++++++++++++---------
 1 file changed, 416 insertions(+), 109 deletions(-)

diff --git a/make/jprt.properties b/make/jprt.properties
index 6e79202c37a..3a10135c56e 100644
--- a/make/jprt.properties
+++ b/make/jprt.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, 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,151 +23,458 @@
 # questions.
 #
 
-# Properties for jprt
+##############
+#
+# Global settings
+#
 
-# Locked down to jdk9
+# The current release name
 jprt.tools.default.release=jdk9
 
-# Unix toolkit to use for building on windows
-jprt.windows.jdk8.build.unix.toolkit=cygwin
+# Check if this is the equivalent of a hotspot push job
+# Interpret -testset hotspot to mean exactly that
+my.is.hotspot.job.hotspot=true
+my.is.hotspot.job=${my.is.hotspot.job.${jprt.test.set}}
+
+# Disable syncing the source after builds and tests are done
+jprt.sync.push=${my.is.hotspot.job ? false : true}
+
+# Directories to be excluded from the source bundles
+jprt.bundle.exclude.src.dirs=build dist webrev
+
+# Use configure when building
+jprt.build.use.configure=true
+
+# Set make target to use for different build flavors
+jprt.build.flavor.debugOpen.target=jprt_bundle
+jprt.build.flavor.fastdebug.target=jprt_bundle
+jprt.build.flavor.product.target=jprt_bundle
+jprt.build.flavor.productOpen.target=jprt_bundle
+
+# Use these configure args to define debug level
+jprt.debug.build.configure.args=--with-debug-level=slowdebug
+jprt.fastdebug.build.configure.args=--with-debug-level=fastdebug
+jprt.product.build.configure.args=--with-debug-level=release
+jprt.debugOpen.build.configure.args=${jprt.debug.build.configure.args} --enable-openjdk-only
+jprt.fastdebugOpen.build.configure.args=${jprt.fastdebug.build.configure.args} --enable-openjdk-only
+jprt.productOpen.build.configure.args=${jprt.product.build.configure.args} --enable-openjdk-only
+
+# Select build flavors and build targets
+jprt.build.flavors=${my.is.hotspot.job ? ${my.build.flavors.hotspot} : ${my.build.flavors.default}}
+jprt.build.targets=${my.is.hotspot.job ? ${my.build.targets.hotspot} : ${my.build.targets.default}}
+
+# Select test targets - jprt default for jprt.test.set is "default"
+jprt.test.targets=${my.test.targets.${jprt.test.set}}
+jprt.make.rule.test.targets=${my.make.rule.test.targets.${jprt.test.set}}
+
+# 7155453: Work-around to prevent popups on OSX from blocking test completion
+# but the work-around is added to all platforms to be consistent
+jprt.jbb.options=-Djava.awt.headless=true
+
+########
+#
+# Build options (generic)
+#
+
+# Configure args common to all builds
+# Also allows for additional, testset specific configure arguments to be set
+jprt.build.configure.args=						\
+    --with-boot-jdk=$ALT_BOOTDIR					\
+    --with-jobs=$ALT_PARALLEL_COMPILE_JOBS				\
+    ${my.additional.build.configure.args.${jprt.test.set}}
+
+# i586 is often cross-compiled from 64-bit machines, so need to set target bits explicitly
+jprt.i586.build.configure.args=						\
+    --with-target-bits=32
+
+# i586 platforms have both client and server, but to allow for overriding the exact configuration
+# on a per-build flavor basis the value is set for the individual build flavors
+my.i586.default.build.configure.args=					\
+    --with-jvm-variants=client,server
+jprt.i586.debug.build.configure.args=					\
+    ${my.i586.default.build.configure.args}				\
+    ${jprt.debug.build.configure.args}
+jprt.i586.fastdebug.build.configure.args=				\
+    ${my.i586.default.build.configure.args}				\
+    ${jprt.fastdebug.build.configure.args}
+jprt.i586.product.build.configure.args=					\
+    ${my.i586.default.build.configure.args}				\
+    ${jprt.product.build.configure.args}
+jprt.i586.debugOpen.build.configure.args=				\
+    ${my.i586.default.build.configure.args}				\
+    ${jprt.debugOpen.build.configure.args}
+jprt.i586.fastdebugOpen.build.configure.args=				\
+    ${my.i586.default.build.configure.args}				\
+    ${jprt.fastdebugOpen.build.configure.args}
+jprt.i586.productOpen.build.configure.args=				\
+    ${my.i586.default.build.configure.args}				\
+    ${jprt.productOpen.build.configure.args}
+
+########
+#
+# Build targets and options (default/jdk)
+#
 
-# The different build flavors we want, we override here so we just get these 2
-jprt.build.flavors=product,fastdebug
+# The default build flavors
+my.build.flavors.default=fastdebug,product
 
 # Standard list of jprt build targets for this source tree
-jprt.build.targets= 						\
-    solaris_sparcv9_5.11-{product|fastdebug}, 			\
-    solaris_x64_5.11-{product|fastdebug}, 			\
-    linux_i586_2.6-{product|fastdebug}, 			\
-    linux_x64_2.6-{product|fastdebug}, 				\
-    macosx_x64_10.7-{product|fastdebug}, 			\
-    windows_i586_6.1-{product|fastdebug}, 			\
+my.build.targets.default=						\
+    solaris_sparcv9_5.11-{product|fastdebug},				\
+    solaris_x64_5.11-{product|fastdebug},				\
+    linux_i586_2.6-{product|fastdebug},					\
+    linux_x64_2.6-{product|fastdebug},					\
+    macosx_x64_10.7-{product|fastdebug},				\
+    windows_i586_6.1-{product|fastdebug},				\
     windows_x64_6.1-{product|fastdebug}
 
-# User can select the test set with jprt submit "-testset name" option
-jprt.my.test.set=${jprt.test.set}
-
 # Test target list (no fastdebug & limited c2 testing)
-jprt.my.test.target.set= \
-    solaris_sparcv9_5.11-product-c2-TESTNAME, 			\
-    solaris_x64_5.11-product-c2-TESTNAME, 			\
-    linux_i586_2.6-product-{c1|c2}-TESTNAME, 			\
-    linux_x64_2.6-product-c2-TESTNAME, 				\
-    macosx_x64_10.7-product-c2-TESTNAME, 			\
-    windows_i586_6.1-product-c1-TESTNAME, 			\
+my.test.target.set=							\
+    solaris_sparcv9_5.11-product-c2-TESTNAME,				\
+    solaris_x64_5.11-product-c2-TESTNAME,				\
+    linux_i586_2.6-product-{c1|c2}-TESTNAME,				\
+    linux_x64_2.6-product-c2-TESTNAME,					\
+    macosx_x64_10.7-product-c2-TESTNAME,				\
+    windows_i586_6.1-product-c1-TESTNAME,				\
     windows_x64_6.1-product-c2-TESTNAME
 
 # Default vm test targets (testset=default)
-jprt.vm.default.test.targets=              			\
-    ${jprt.my.test.target.set:TESTNAME=jvm98},			\
-    ${jprt.my.test.target.set:TESTNAME=scimark}
+my.test.targets.default=						\
+    ${my.test.target.set:TESTNAME=jvm98},				\
+    ${my.test.target.set:TESTNAME=scimark}
 
 # Default jdk test targets (testset=default)
-jprt.make.rule.default.test.targets=				\
-    ${jprt.my.test.target.set:TESTNAME=langtools_jtreg},        \
-    ${jprt.my.test.target.set:TESTNAME=jdk_lang},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_math},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_util}
+my.make.rule.test.targets.default=					\
+    ${my.test.target.set:TESTNAME=langtools_jtreg},			\
+    ${my.test.target.set:TESTNAME=jdk_lang},				\
+    ${my.test.target.set:TESTNAME=jdk_math},				\
+    ${my.test.target.set:TESTNAME=jdk_util}
     
-
 # Default vm test targets (testset=core)
-jprt.vm.core.test.targets=
+my.test.targets.core=
 
 # Core jdk test targets (testset=core)
-jprt.make.rule.core.test.targets=                               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_lang},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_math},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_util},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_io},			\
-    ${jprt.my.test.target.set:TESTNAME=jdk_net},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_nio},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_security1},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_security2},          \
-    ${jprt.my.test.target.set:TESTNAME=jdk_security3},          \
-    ${jprt.my.test.target.set:TESTNAME=jdk_rmi},                \
-    ${jprt.my.test.target.set:TESTNAME=jdk_text},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_time},               \
-    ${jprt.my.test.target.set:TESTNAME=jdk_other},              \
-    ${jprt.my.test.target.set:TESTNAME=core_tools}
+my.make.rule.test.targets.core=						\
+    ${my.test.target.set:TESTNAME=jdk_lang},				\
+    ${my.test.target.set:TESTNAME=jdk_math},				\
+    ${my.test.target.set:TESTNAME=jdk_util},				\
+    ${my.test.target.set:TESTNAME=jdk_io},				\
+    ${my.test.target.set:TESTNAME=jdk_net},				\
+    ${my.test.target.set:TESTNAME=jdk_nio},				\
+    ${my.test.target.set:TESTNAME=jdk_security1},			\
+    ${my.test.target.set:TESTNAME=jdk_security2},			\
+    ${my.test.target.set:TESTNAME=jdk_security3},			\
+    ${my.test.target.set:TESTNAME=jdk_rmi},				\
+    ${my.test.target.set:TESTNAME=jdk_text},				\
+    ${my.test.target.set:TESTNAME=jdk_time},				\
+    ${my.test.target.set:TESTNAME=jdk_other},				\
+    ${my.test.target.set:TESTNAME=core_tools}
 
 # Svc vm test targets (testset=svc)
-jprt.vm.svc.test.targets=
+my.test.targets.svc=
 
 # Core jdk test targets (testset=svc)
-jprt.make.rule.svc.test.targets=                                \
-    ${jprt.my.test.target.set:TESTNAME=jdk_management},         \
-    ${jprt.my.test.target.set:TESTNAME=jdk_instrument},         \
-    ${jprt.my.test.target.set:TESTNAME=jdk_jmx},                \
-    ${jprt.my.test.target.set:TESTNAME=jdk_jdi},                \
-    ${jprt.my.test.target.set:TESTNAME=jdk_jfr},                \
-    ${jprt.my.test.target.set:TESTNAME=svc_tools}
+my.make.rule.test.targets.svc=						\
+    ${my.test.target.set:TESTNAME=jdk_management},			\
+    ${my.test.target.set:TESTNAME=jdk_instrument},			\
+    ${my.test.target.set:TESTNAME=jdk_jmx},				\
+    ${my.test.target.set:TESTNAME=jdk_jdi},				\
+    ${my.test.target.set:TESTNAME=jdk_jfr},				\
+    ${my.test.target.set:TESTNAME=svc_tools}
 
 # All vm test targets (testset=all)
-jprt.vm.all.test.targets=    					\
-    ${jprt.vm.default.test.targets}, 				\
-    ${jprt.my.test.target.set:TESTNAME=runThese},		\
-    ${jprt.my.test.target.set:TESTNAME=jbb_default}
+my.test.targets.all=							\
+    ${my.test.targets.default},						\
+    ${my.test.target.set:TESTNAME=runThese},				\
+    ${my.test.target.set:TESTNAME=jbb_default}
 
 # All jdk test targets (testset=all)
-jprt.make.rule.all.test.targets=    				\
-    ${jprt.make.rule.core.test.targets}, 			\
-    ${jprt.make.rule.svc.test.targets},                         \
-    ${jprt.my.test.target.set:TESTNAME=jdk_awt},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_beans1},             \
-    ${jprt.my.test.target.set:TESTNAME=jdk_beans2},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_beans3},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_sound},		\
-    ${jprt.my.test.target.set:TESTNAME=jdk_swing}
+my.make.rule.test.targets.all=						\
+    ${my.make.rule.test.targets.core},					\
+    ${my.make.rule.test.targets.svc},					\
+    ${my.test.target.set:TESTNAME=jdk_awt},				\
+    ${my.test.target.set:TESTNAME=jdk_beans1},				\
+    ${my.test.target.set:TESTNAME=jdk_beans2},				\
+    ${my.test.target.set:TESTNAME=jdk_beans3},				\
+    ${my.test.target.set:TESTNAME=jdk_sound},				\
+    ${my.test.target.set:TESTNAME=jdk_swing}
 
 # PIT vm test targets (testset=pit)
-jprt.vm.pit.test.targets=                                       \
-   ${jprt.vm.all.test.targets}
+my.test.targets.pit=							\
+   ${my.test.targets.all}
 
 # PIT jdk test targets (testset=pit)
-jprt.make.rule.pit.test.targets=                                \
-    ${jprt.my.test.target.set:TESTNAME=langtools_jtreg},        \
-    ${jprt.make.rule.core.test.targets},                        \
-    ${jprt.make.rule.svc.test.targets}
+my.make.rule.test.targets.pit=						\
+    ${my.test.target.set:TESTNAME=langtools_jtreg},			\
+    ${my.make.rule.test.targets.core},					\
+    ${my.make.rule.test.targets.svc}
 
 # JCK test targets in test/Makefile (no windows)
-jprt.my.jck.test.target.set=					\
-    solaris_sparcv9_5.11-product-c2-JCK7TESTRULE, 		\
-    solaris_x64_5.11-product-c2-JCK7TESTRULE, 			\
-    linux_i586_2.6-product-c1-JCK7TESTRULE, 			\
+my.test.target.set.jck=							\
+    solaris_sparcv9_5.11-product-c2-JCK7TESTRULE,			\
+    solaris_x64_5.11-product-c2-JCK7TESTRULE,				\
+    linux_i586_2.6-product-c1-JCK7TESTRULE,				\
     linux_x64_2.6-product-c2-JCK7TESTRULE
 
-# JCK testset targets (e.g. jprt submit -testset jck ... )
-jprt.make.rule.jck.test.targets=				\
-    ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7devtools},   \
-    ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7runtime},    \
-    ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler}
+# JCK testset targets
+my.make.rule.test.targets.jck=						\
+    ${my.test.target.set.jck:JCK7TESTRULE=jck7devtools},		\
+    ${my.test.target.set.jck:JCK7TESTRULE=jck7runtime},			\
+    ${my.test.target.set.jck:JCK7TESTRULE=jck7compiler}
 
-# Select list to use (allow for testset to be empty too)
-jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets}
-jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets}
-jprt.vm..test.targets=${jprt.vm.default.test.targets}
-jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
 
-# Directories to be excluded from the source bundles
-jprt.bundle.exclude.src.dirs=build dist webrev
+#############
+#
+# Hotspot related settings (testset=hotspot)
+#
 
-# Instruct jprt to use configure when building
-jprt.build.use.configure=true
-jprt.build.flavor.product.target=jprt_bundle
-jprt.build.flavor.fastdebug.target=jprt_bundle
-jprt.build.flavor.debug.target=jprt_bundle
+# The hotspot build flavors
+my.build.flavors.hotspot=						\
+    debugOpen,fastdebug,product,productOpen,				\
+    ${my.additional.build.flavors.hotspot}
 
-# Add these configure args to all builds
-jprt.build.configure.args= \
-    --with-boot-jdk=$ALT_BOOTDIR \
-    --with-jobs=$ALT_PARALLEL_COMPILE_JOBS
+# Platforms built for hotspot push jobs
+my.build.targets.hotspot=						\
+    solaris_sparcv9_5.11-{product|fastdebug|optimized},			\
+    solaris_x64_5.11-{product|fastdebug},				\
+    linux_i586_2.6-{product|fastdebug},					\
+    linux_x64_2.6-{product|fastdebug|optimized},			\
+    macosx_x64_10.7-{product|fastdebug},				\
+    windows_i586_6.1-{product|fastdebug},				\
+    windows_x64_6.1-{product|fastdebug|optimized},			\
+    solaris_x64_5.11-{debugOpen},					\
+    linux_x64_2.6-{productOpen},					\
+    ${my.additional.build.targets.hotspot}
 
-# Add these configure args to 32 bit builds
-jprt.i586.build.configure.args= \
-    --with-target-bits=32 \
-    --with-jvm-variants=client,server
+# Tests to run on the various platforms for hotspot push jobs
+my.test.targets.hotspot.solaris.sparcv9=				\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98,			\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98_nontiered,	\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-scimark,		\
+    solaris_sparcv9_5.11-product-c2-runThese,				\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_SerialGC,	\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_ParallelGC,	\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_ParNewGC,	\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_CMS,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_G1,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_ParOldGC,	\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_SerialGC,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_ParallelGC,	\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_ParNewGC,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_CMS,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_G1,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_ParOldGC,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_default_nontiered,	\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_SerialGC,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_ParallelGC,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_CMS,		\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_G1,			\
+    solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_ParOldGC
 
-# Use these configure args to define debug level.
-jprt.product.build.configure.args=--with-debug-level=release
-jprt.fastdebug.build.configure.args=--with-debug-level=fastdebug
-jprt.debug.build.configure.args=--with-debug-level=slowdebug
+my.test.targets.hotspot.solaris.x64=					\
+    solaris_x64_5.11-{product|fastdebug}-c2-jvm98,			\
+    solaris_x64_5.11-{product|fastdebug}-c2-jvm98_nontiered,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-scimark,			\
+    solaris_x64_5.11-product-c2-runThese,				\
+    solaris_x64_5.11-product-c2-runThese_Xcomp,				\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_SerialGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_ParallelGC,	\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_ParNewGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_CMS,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_G1,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_SerialGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_ParallelGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_ParNewGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_CMS,			\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_G1,			\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_ParOldGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-jbb_default_nontiered,	\
+    solaris_x64_5.11-{product|fastdebug}-c2-jbb_SerialGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-jbb_ParallelGC,		\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_CMS,			\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_G1,			\
+    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_ParOldGC
+
+my.test.targets.hotspot.linux.i586=					\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-jvm98,			\
+    linux_i586_2.6-{product|fastdebug}-c2-jvm98_nontiered,		\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-scimark,			\
+    linux_i586_2.6-product-c1-runThese_Xcomp,				\
+    linux_i586_2.6-fastdebug-c1-runThese_Xshare,			\
+    linux_i586_2.6-fastdebug-c2-runThese_Xcomp,				\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC,	\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC,	\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_ParNewGC,	\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_G1,		\
+    linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_ParOldGC,	\
+    linux_i586_2.6-product-{c1|c2}-GCOld_SerialGC,			\
+    linux_i586_2.6-product-{c1|c2}-GCOld_ParallelGC,			\
+    linux_i586_2.6-product-{c1|c2}-GCOld_ParNewGC,			\
+    linux_i586_2.6-product-{c1|c2}-GCOld_CMS,				\
+    linux_i586_2.6-product-{c1|c2}-GCOld_G1,				\
+    linux_i586_2.6-product-{c1|c2}-GCOld_ParOldGC,			\
+    linux_i586_2.6-{product|fastdebug}-c1-jbb_SerialGC,			\
+    linux_i586_2.6-{product|fastdebug}-c2-jbb_default_nontiered,	\
+    linux_i586_2.6-{product|fastdebug}-c1-jbb_ParallelGC,		\
+    linux_i586_2.6-{product|fastdebug}-c1-jbb_CMS,			\
+    linux_i586_2.6-{product|fastdebug}-c1-jbb_G1,			\
+    linux_i586_2.6-{product|fastdebug}-c1-jbb_ParOldGC
+
+my.test.targets.hotspot.linux.x64=					\
+    linux_x64_2.6-{product|fastdebug}-c2-jvm98,				\
+    linux_x64_2.6-{product|fastdebug}-c2-jvm98_nontiered,		\
+    linux_x64_2.6-{product|fastdebug}-c2-scimark,			\
+    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_SerialGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_ParallelGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_ParNewGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_CMS,			\
+    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_G1,			\
+    linux_x64_2.6-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-GCOld_SerialGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-GCOld_ParallelGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-GCOld_ParNewGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-GCOld_CMS,			\
+    linux_x64_2.6-{product|fastdebug}-c2-GCOld_G1,			\
+    linux_x64_2.6-{product|fastdebug}-c2-GCOld_ParOldGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-jbb_default_nontiered,		\
+    linux_x64_2.6-{product|fastdebug}-c2-jbb_ParallelGC,		\
+    linux_x64_2.6-{product|fastdebug}-c2-jbb_G1,			\
+    linux_x64_2.6-{product|fastdebug}-c2-jbb_ParOldGC
+
+my.test.targets.hotspot.macosx.x64=					\
+    macosx_x64_10.7-{product|fastdebug}-c2-jvm98,			\
+    macosx_x64_10.7-{product|fastdebug}-c2-jvm98_nontiered,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-scimark,			\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_SerialGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_ParallelGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_ParNewGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_CMS,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_G1,			\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_SerialGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_ParallelGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_ParNewGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_CMS,			\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_G1,			\
+    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_ParOldGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-jbb_default_nontiered,	\
+    macosx_x64_10.7-{product|fastdebug}-c2-jbb_ParallelGC,		\
+    macosx_x64_10.7-{product|fastdebug}-c2-jbb_G1,			\
+    macosx_x64_10.7-{product|fastdebug}-c2-jbb_ParOldGC
+
+my.test.targets.hotspot.windows.i586=					\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-jvm98,			\
+    windows_i586_6.1-{product|fastdebug}-c2-jvm98_nontiered,		\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-scimark,		\
+    windows_i586_6.1-product-{c1|c2}-runThese,				\
+    windows_i586_6.1-product-{c1|c2}-runThese_Xcomp,			\
+    windows_i586_6.1-fastdebug-c1-runThese_Xshare,			\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC,	\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC,	\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_ParNewGC,	\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_G1,		\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_ParOldGC,	\
+    windows_i586_6.1-product-{c1|c2}-GCOld_SerialGC,			\
+    windows_i586_6.1-product-{c1|c2}-GCOld_ParallelGC,			\
+    windows_i586_6.1-product-{c1|c2}-GCOld_ParNewGC,			\
+    windows_i586_6.1-product-{c1|c2}-GCOld_CMS,				\
+    windows_i586_6.1-product-{c1|c2}-GCOld_G1,				\
+    windows_i586_6.1-product-{c1|c2}-GCOld_ParOldGC,			\
+    windows_i586_6.1-{product|fastdebug}-{c1|c2}-jbb_default,		\
+    windows_i586_6.1-{product|fastdebug}-c2-jbb_default_nontiered,	\
+    windows_i586_6.1-product-{c1|c2}-jbb_ParallelGC,			\
+    windows_i586_6.1-product-{c1|c2}-jbb_CMS,				\
+    windows_i586_6.1-product-{c1|c2}-jbb_G1,				\
+    windows_i586_6.1-product-{c1|c2}-jbb_ParOldGC
+
+my.test.targets.hotspot.windows.x64=					\
+    windows_x64_6.1-{product|fastdebug}-c2-jvm98,			\
+    windows_x64_6.1-{product|fastdebug}-c2-jvm98_nontiered,		\
+    windows_x64_6.1-{product|fastdebug}-c2-scimark,			\
+    windows_x64_6.1-product-c2-runThese,				\
+    windows_x64_6.1-product-c2-runThese_Xcomp,				\
+    windows_x64_6.1-{product|fastdebug}-c2-GCBasher_SerialGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCBasher_ParallelGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCBasher_ParNewGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCBasher_CMS,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCBasher_G1,			\
+    windows_x64_6.1-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCOld_SerialGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCOld_ParallelGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCOld_ParNewGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-GCOld_CMS,			\
+    windows_x64_6.1-{product|fastdebug}-c2-GCOld_G1,			\
+    windows_x64_6.1-{product|fastdebug}-c2-GCOld_ParOldGC,		\
+    windows_x64_6.1-{product|fastdebug}-c2-jbb_default,			\
+    windows_x64_6.1-{product|fastdebug}-c2-jbb_default_nontiered,	\
+    windows_x64_6.1-product-c2-jbb_CMS,					\
+    windows_x64_6.1-product-c2-jbb_ParallelGC,				\
+    windows_x64_6.1-product-c2-jbb_G1,					\
+    windows_x64_6.1-product-c2-jbb_ParOldGC
+
+# Some basic "smoke" tests for OpenJDK builds
+my.test.targets.hotspot.open=						\
+    solaris_x64_5.11-{productOpen|fastdebugOpen}-c2-jvm98,		\
+    linux_x64_2.6-{productOpen|fastdebugOpen}-c2-jvm98
+
+# The complete list of test targets for jprt
+my.test.targets.hotspot=						\
+  ${my.test.targets.hotspot.open},					\
+  ${my.test.targets.hotspot.solaris.sparcv9},				\
+  ${my.test.targets.hotspot.solaris.x64},				\
+  ${my.test.targets.hotspot.linux.i586},				\
+  ${my.test.targets.hotspot.linux.x64},					\
+  ${my.test.targets.hotspot.macosx.x64},				\
+  ${my.test.targets.hotspot.windows.i586},				\
+  ${my.test.targets.hotspot.windows.x64},				\
+  ${my.test.targets.hotspot.solaris.sparcv9},				\
+  ${my.test.targets.hotspot.solaris.x64},				\
+  ${my.test.targets.hotspot.linux.x64},					\
+  ${my.test.targets.hotspot.windows.i586},				\
+  ${my.test.targets.hotspot.windows.x64},				\
+  ${my.additional.test.targets.hotspot}
+
+
+# Make file based test targets
+
+my.make.rule.test.targets.hotspot.clienttests=				\
+  linux_i586_2.6-*-c1-hotspot_clienttest,				\
+  windows_i586_6.1-*-c1-hotspot_clienttest
+
+my.make.rule.test.targets.hotspot.servertests=				\
+  solaris_sparcv9_5.11-*-c2-hotspot_servertest,				\
+  solaris_x64_5.11-*-c2-hotspot_servertest,				\
+  linux_i586_2.6-*-c2-hotspot_servertest,				\
+  linux_x64_2.6-*-c2-hotspot_servertest,				\
+  macosx_x64_10.7-*-c2-hotspot_servertest,				\
+  windows_i586_6.1-*-c2-hotspot_servertest,				\
+  windows_x64_6.1-*-c2-hotspot_servertest
+
+my.make.rule.test.targets.hotspot.internalvmtests=			\
+  solaris_sparcv9_5.11-fastdebug-c2-hotspot_internalvmtests,		\
+  solaris_x64_5.11-fastdebug-c2-hotspot_internalvmtests,		\
+  linux_i586_2.6-fastdebug-c2-hotspot_internalvmtests,			\
+  linux_x64_2.6-fastdebug-c2-hotspot_internalvmtests,			\
+  macosx_x64_10.7-fastdebug-c2-hotspot_internalvmtests,			\
+  windows_i586_6.1-fastdebug-c2-hotspot_internalvmtests,		\
+  windows_x64_6.1-fastdebug-c2-hotspot_internalvmtests
+
+my.make.rule.test.targets.hotspot.wbapitests=				\
+  solaris_sparcv9_5.11-{product|fastdebug}-c2-hotspot_wbapitest,	\
+  solaris_x64_5.11-{product|fastdebug}-c2-hotspot_wbapitest,		\
+  linux_i586_2.6-{product|fastdebug}-c2-hotspot_wbapitest,		\
+  linux_x64_2.6-{product|fastdebug}-c2-hotspot_wbapitest,		\
+  windows_i586_6.1-{product|fastdebug}-c2-hotspot_wbapitest,		\
+  windows_x64_6.1-{product|fastdebug}-c2-hotspot_wbapitest,		\
+  linux_i586_2.6-{product|fastdebug}-c1-hotspot_wbapitest,		\
+  windows_i586_6.1-{product|fastdebug}-c1-hotspot_wbapitest
+
+my.make.rule.test.targets.hotspot=					\
+  ${my.make.rule.test.targets.hotspot.clienttests},			\
+  ${my.make.rule.test.targets.hotspot.servertests},			\
+  ${my.make.rule.test.targets.hotspot.internalvmtests},			\
+  ${my.make.rule.test.targets.hotspot.wbapitests},			\
+  ${my.additional.make.rule.test.targets.hotspot}
-- 
GitLab


From dee1364e7ce0abd7f6aa62e522262c09cc70b86a Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Wed, 25 Jun 2014 17:08:47 +0530
Subject: [PATCH 145/192] 8048071: eval within 'with' statement does not use
 correct scope if with scope expression has a copy of eval

Reviewed-by: hannesw, jlaskey
---
 .../internal/codegen/CodeGenerator.java       | 23 ++++-
 .../jdk/nashorn/internal/ir/IdentNode.java    | 11 +++
 nashorn/test/script/basic/JDK-8048071.js      | 85 +++++++++++++++++++
 .../test/script/basic/JDK-8048071.js.EXPECTED | 11 +++
 4 files changed, 126 insertions(+), 4 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8048071.js
 create mode 100644 nashorn/test/script/basic/JDK-8048071.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index 110e1109d4a..de971ab0308 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -1290,13 +1290,26 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
                     int argsCount;
                     @Override
                     void loadStack() {
-                        loadExpressionAsObject(ident); // Type.OBJECT as foo() makes no sense if foo == 3
-                        method.dup();
+                        /**
+                         * We want to load 'eval' to check if it is indeed global builtin eval.
+                         * If this eval call is inside a 'with' statement, dyn:getMethod|getProp|getElem
+                         * would be generated if ident is a "isFunction". But, that would result in a
+                         * bound function from WithObject. We don't want that as bound function as that
+                         * won't be detected as builtin eval. So, we make ident as "not a function" which
+                         * results in "dyn:getProp|getElem|getMethod" being generated and so WithObject
+                         * would return unbounded eval function.
+                         *
+                         * Example:
+                         *
+                         *  var global = this;
+                         *  function func() {
+                         *      with({ eval: global.eval) { eval("var x = 10;") }
+                         *  }
+                         */
+                        loadExpressionAsObject(ident.setIsNotFunction()); // Type.OBJECT as foo() makes no sense if foo == 3
                         globalIsEval();
                         method.ifeq(is_not_eval);
 
-                        // We don't need ScriptFunction object for 'eval'
-                        method.pop();
                         // Load up self (scope).
                         method.loadCompilerConstant(SCOPE);
                         final CallNode.EvalArgs evalArgs = callNode.getEvalArgs();
@@ -1316,6 +1329,8 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
                         method._goto(invoke_direct_eval);
 
                         method.label(is_not_eval);
+                        // load this time but with dyn:getMethod|getProp|getElem
+                        loadExpressionAsObject(ident); // Type.OBJECT as foo() makes no sense if foo == 3
                         // This is some scope 'eval' or global eval replaced by user
                         // but not the built-in ECMAScript 'eval' function call
                         method.loadNull();
diff --git a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java
index e33b8d024b4..652c5860f72 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java
@@ -280,6 +280,17 @@ public final class IdentNode extends Expression implements PropertyKey, Function
         return new IdentNode(this, name, type, flags | FUNCTION, programPoint, conversion);
     }
 
+    /**
+     * Mark this node as not being the callee operand of a {@link CallNode}.
+     * @return an ident node identical to this one in all aspects except with its function flag unset.
+     */
+    public IdentNode setIsNotFunction() {
+        if (! isFunction()) {
+            return this;
+        }
+        return new IdentNode(this, name, type, flags & ~FUNCTION, programPoint, conversion);
+    }
+
     @Override
     public int getProgramPoint() {
         return programPoint;
diff --git a/nashorn/test/script/basic/JDK-8048071.js b/nashorn/test/script/basic/JDK-8048071.js
new file mode 100644
index 00000000000..aec0c7c18ac
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048071.js
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8048071: eval within 'with' statement does not use correct scope if with scope expression has a copy of eval
+ *
+ * @test
+ * @run
+ */
+
+function func() {
+   var x = 1;
+   with ({ eval: this.eval }) {
+      eval("var x = 23");
+   }
+
+   return x;
+}
+
+print(func());
+print("typeof x? " + typeof x);
+
+print((function(global){
+    var x = 1;
+    with(global) {
+        eval("eval('var x=0')");
+    }
+    return x;
+})(this));
+print("typeof x? " + typeof x);
+
+print((function(global){
+   var x = 1;
+   with({eval:  global.eval}) {
+       eval("eval('var x=0')");
+   }
+   return x;
+})(this));
+print("typeof x? " + typeof x);
+
+// not-builtin eval cases
+
+(function () {
+   function eval(str) {
+      print("local eval called: " + str);
+      print(this);
+   }
+
+   with({}) {
+     eval("hello");
+   }
+})();
+
+(function () {
+   with({
+    eval:function(str) {
+       print("with's eval called: " + str);
+       print("this = " + this);
+       print("this.foo = " + this.foo);
+    },
+    foo: 42
+   }) {
+     eval("hello")
+   }
+})();
diff --git a/nashorn/test/script/basic/JDK-8048071.js.EXPECTED b/nashorn/test/script/basic/JDK-8048071.js.EXPECTED
new file mode 100644
index 00000000000..5234bb1a53f
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048071.js.EXPECTED
@@ -0,0 +1,11 @@
+23
+typeof x? undefined
+0
+typeof x? undefined
+0
+typeof x? undefined
+local eval called: hello
+[object global]
+with's eval called: hello
+this = [object Object]
+this.foo = 42
-- 
GitLab


From ccb4ecb33990460130f54976d7d6934d74d85fea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Wed, 25 Jun 2014 14:36:24 +0200
Subject: [PATCH 146/192] 8048079: Persistent code store is broken after
 optimistic types merge

Reviewed-by: sundar, jlaskey, attila
---
 .../internal/codegen/CompilationPhase.java    |  8 +--
 .../jdk/nashorn/internal/runtime/Context.java | 16 ++---
 .../RecompilableScriptFunctionData.java       | 70 +++----------------
 nashorn/test/script/basic/JDK-8048079_1.js    | 35 ++++++++++
 .../script/basic/JDK-8048079_1.js.EXPECTED    |  3 +
 nashorn/test/script/basic/JDK-8048079_2.js    | 35 ++++++++++
 .../script/basic/JDK-8048079_2.js.EXPECTED    |  3 +
 .../runtime/CodeStoreAndPathTest.java         |  2 +-
 8 files changed, 96 insertions(+), 76 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8048079_1.js
 create mode 100644 nashorn/test/script/basic/JDK-8048079_1.js.EXPECTED
 create mode 100644 nashorn/test/script/basic/JDK-8048079_2.js
 create mode 100644 nashorn/test/script/basic/JDK-8048079_2.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
index 85b805060cc..8b3819266f4 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java
@@ -502,7 +502,7 @@ enum CompilationPhase {
             Class<?> rootClass = null;
             long length = 0L;
 
-            final CodeInstaller<?> codeInstaller = compiler.getCodeInstaller();
+            final CodeInstaller<ScriptEnvironment> codeInstaller = compiler.getCodeInstaller();
 
             final Map<String, byte[]> bytecode = compiler.getBytecode();
 
@@ -527,12 +527,10 @@ enum CompilationPhase {
             final Object[] constants = compiler.getConstantData().toArray();
             codeInstaller.initialize(installedClasses.values(), compiler.getSource(), constants);
 
-            // index recompilable script function datas in the constant pool
-            final Map<RecompilableScriptFunctionData, RecompilableScriptFunctionData> rfns = new IdentityHashMap<>();
+            // initialize transient fields on recompilable script function data
             for (final Object constant: constants) {
                 if (constant instanceof RecompilableScriptFunctionData) {
-                    final RecompilableScriptFunctionData rfn = (RecompilableScriptFunctionData)constant;
-                    rfns.put(rfn, rfn);
+                    ((RecompilableScriptFunctionData)constant).initTransients(compiler.getSource(), codeInstaller);
                 }
             }
 
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk/nashorn/internal/runtime/Context.java
index aae43b11818..a70f80d43d9 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java
@@ -444,15 +444,11 @@ public final class Context {
         }
 
         if (env._persistent_cache) {
-            if (env._lazy_compilation || env._optimistic_types) {
-                getErr().println("Can not use persistent class caching with lazy compilation or optimistic compilation.");
-            } else {
-                try {
-                    final String cacheDir = Options.getStringProperty("nashorn.persistent.code.cache", "nashorn_code_cache");
-                    codeStore = new CodeStore(cacheDir);
-                } catch (final IOException e) {
-                    throw new RuntimeException("Error initializing code cache", e);
-                }
+            try {
+                final String cacheDir = Options.getStringProperty("nashorn.persistent.code.cache", "nashorn_code_cache");
+                codeStore = new CodeStore(cacheDir);
+            } catch (final IOException e) {
+                throw new RuntimeException("Error initializing code cache", e);
             }
         }
 
@@ -1179,7 +1175,7 @@ public final class Context {
 
         for (final Object constant : constants) {
             if (constant instanceof RecompilableScriptFunctionData) {
-                ((RecompilableScriptFunctionData) constant).setCodeAndSource(installedClasses, source);
+                ((RecompilableScriptFunctionData) constant).initTransients(source, installer);
             }
         }
 
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
index b2c0ed6b57f..fc14707730b 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java
@@ -28,7 +28,6 @@ package jdk.nashorn.internal.runtime;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.io.IOException;
-import java.io.Serializable;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -56,7 +55,6 @@ import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.logging.DebugLogger;
 import jdk.nashorn.internal.runtime.logging.Loggable;
 import jdk.nashorn.internal.runtime.logging.Logger;
-import jdk.nashorn.internal.scripts.JS;
 
 /**
  * This is a subclass that represents a script function that may be regenerated,
@@ -85,9 +83,6 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
     /** Source from which FunctionNode was parsed. */
     private transient Source source;
 
-    /** Allows us to retrieve the method handle for this function once the code is compiled */
-    private MethodLocator methodLocator;
-
     /** Token of this function within the source. */
     private final long token;
 
@@ -239,15 +234,18 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
     }
 
     /**
-     * Setter for code and source
+     * Initialize transient fields on deserialized instances
      *
-     * @param code   map of code, class name to class
      * @param source source
+     * @param installer code installer
      */
-    public void setCodeAndSource(final Map<String, Class<?>> code, final Source source) {
-        this.source = source;
-        if (methodLocator != null) {
-            methodLocator.setClass(code.get(methodLocator.getClassName()));
+    public void initTransients(final Source source, final CodeInstaller<ScriptEnvironment> installer) {
+        if (this.source == null && this.installer == null) {
+            this.source = source;
+            this.installer = installer;
+        } else if (this.source != source || this.installer != installer) {
+            // Existing values must be same as those passed as parameters
+            throw new IllegalArgumentException();
         }
     }
 
@@ -529,7 +527,6 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
             throw new IllegalStateException(functionNode.getName() + " id=" + functionNode.getId());
         }
         addCode(functionNode);
-        methodLocator = new MethodLocator(functionNode);
     }
 
     private CompiledFunction addCode(final MethodHandle target, final Map<Integer, Type> invalidatedProgramPoints, final int fnFlags) {
@@ -592,12 +589,7 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
         synchronized (code) {
             CompiledFunction existingBest = super.getBest(callSiteType, runtimeScope);
             if (existingBest == null) {
-                if(code.isEmpty() && methodLocator != null) {
-                    // This is a deserialized object, reconnect from method handle
-                    existingBest = addCode(methodLocator.getMethodHandle(), null, methodLocator.getFunctionFlags());
-                } else {
-                    existingBest = addCode(compileTypeSpecialization(callSiteType, runtimeScope), callSiteType);
-                }
+                existingBest = addCode(compileTypeSpecialization(callSiteType, runtimeScope), callSiteType);
             }
 
             assert existingBest != null;
@@ -709,48 +701,6 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp
         return true;
     }
 
-    /**
-     * Helper class that allows us to retrieve the method handle for this function once it has been generated.
-     */
-    private static class MethodLocator implements Serializable {
-        private transient Class<?> clazz;
-        private final String className;
-        private final String methodName;
-        private final MethodType methodType;
-        private final int functionFlags;
-
-        private static final long serialVersionUID = -5420835725902966692L;
-
-        MethodLocator(final FunctionNode functionNode) {
-            this.className  = functionNode.getCompileUnit().getUnitClassName();
-            this.methodName = functionNode.getName();
-            this.methodType = new FunctionSignature(functionNode).getMethodType();
-            this.functionFlags = functionNode.getFlags();
-
-            assert className != null;
-            assert methodName != null;
-        }
-
-        void setClass(final Class<?> clazz) {
-            if (!JS.class.isAssignableFrom(clazz)) {
-                throw new IllegalArgumentException();
-            }
-            this.clazz = clazz;
-        }
-
-        String getClassName() {
-            return className;
-        }
-
-        MethodHandle getMethodHandle() {
-            return MH.findStatic(LOOKUP, clazz, methodName, methodType);
-        }
-
-        int getFunctionFlags() {
-            return functionFlags;
-        }
-    }
-
     private void readObject(final java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         createLogger();
diff --git a/nashorn/test/script/basic/JDK-8048079_1.js b/nashorn/test/script/basic/JDK-8048079_1.js
new file mode 100644
index 00000000000..fcd21219e02
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048079_1.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8048079: Persistent code store is broken after optimistic types merge
+ *
+ * @test
+ * @run
+ * @option -pcc
+ * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @fork
+ */
+
+load(__DIR__ + 'prototype.js');
+load(__DIR__ + 'yui.js');
diff --git a/nashorn/test/script/basic/JDK-8048079_1.js.EXPECTED b/nashorn/test/script/basic/JDK-8048079_1.js.EXPECTED
new file mode 100644
index 00000000000..371f63a54d5
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048079_1.js.EXPECTED
@@ -0,0 +1,3 @@
+parsed and compiled ok prototype.js
+parsed and compiled ok yui-min.js
+parsed and compiled ok yui.js
diff --git a/nashorn/test/script/basic/JDK-8048079_2.js b/nashorn/test/script/basic/JDK-8048079_2.js
new file mode 100644
index 00000000000..fcd21219e02
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048079_2.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8048079: Persistent code store is broken after optimistic types merge
+ *
+ * @test
+ * @run
+ * @option -pcc
+ * @option -Dnashorn.persistent.code.cache=build/nashorn_code_cache
+ * @fork
+ */
+
+load(__DIR__ + 'prototype.js');
+load(__DIR__ + 'yui.js');
diff --git a/nashorn/test/script/basic/JDK-8048079_2.js.EXPECTED b/nashorn/test/script/basic/JDK-8048079_2.js.EXPECTED
new file mode 100644
index 00000000000..371f63a54d5
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048079_2.js.EXPECTED
@@ -0,0 +1,3 @@
+parsed and compiled ok prototype.js
+parsed and compiled ok yui-min.js
+parsed and compiled ok yui.js
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java
index f6b72d3cd15..b7999dfc4de 100644
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java
@@ -96,7 +96,7 @@ public class CodeStoreAndPathTest {
     final String codeCache = "build/nashorn_code_cache";
     final String oldUserDir = System.getProperty("user.dir");
 
-    private static final String[] ENGINE_OPTIONS = new String[]{"--persistent-code-cache", "--optimistic-types=false", "--lazy-compilation=false"};
+    private static final String[] ENGINE_OPTIONS = new String[]{"--persistent-code-cache"};
 
     public void checkCompiledScripts(final DirectoryStream<Path> stream, int numberOfScripts) throws IOException {
         for (final Path file : stream) {
-- 
GitLab


From 9dde0bfa35258bbc04ad2a3f81d4a6259fb41582 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 26 Jun 2014 13:12:32 +0200
Subject: [PATCH 147/192] 8047357: More precise synthetic return + unreachable
 throw

Reviewed-by: lagergren, sundar
---
 .../internal/codegen/AssignSymbols.java       |  8 ++--
 .../internal/codegen/CodeGenerator.java       |  2 +-
 .../codegen/LocalVariableTypesCalculator.java | 46 ++++++++++++++++++-
 .../jdk/nashorn/internal/codegen/Lower.java   | 25 ----------
 .../src/jdk/nashorn/internal/ir/Block.java    |  7 ++-
 .../src/jdk/nashorn/internal/ir/CaseNode.java |  7 ++-
 .../internal/ir/ExpressionStatement.java      |  5 --
 .../jdk/nashorn/internal/ir/IdentNode.java    |  4 +-
 nashorn/src/jdk/nashorn/internal/ir/Node.java | 28 -----------
 .../jdk/nashorn/internal/ir/Statement.java    | 30 +++++++++++-
 .../src/jdk/nashorn/internal/ir/Terminal.java | 37 +++++++++++++++
 .../nashorn/internal/ir/debug/ASTWriter.java  |  6 ++-
 .../internal/ir/debug/PrintVisitor.java       | 10 ++--
 nashorn/test/script/basic/JDK-8047057.js      |  4 +-
 nashorn/test/script/basic/JDK-8047357.js      | 32 +++++++++++++
 .../test/script/basic/JDK-8047357.js.EXPECTED |  2 +
 16 files changed, 173 insertions(+), 80 deletions(-)
 create mode 100644 nashorn/src/jdk/nashorn/internal/ir/Terminal.java
 create mode 100644 nashorn/test/script/basic/JDK-8047357.js
 create mode 100644 nashorn/test/script/basic/JDK-8047357.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java b/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java
index 65e65c785a1..0659e3f5c3e 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/AssignSymbols.java
@@ -209,7 +209,7 @@ final class AssignSymbols extends NodeOperatorVisitor<LexicalContext> implements
                     if (varNode.isFunctionDeclaration()) {
                         symbol.setIsFunctionDeclaration();
                     }
-                    return varNode.setName((IdentNode)ident.setSymbol(symbol));
+                    return varNode.setName(ident.setSymbol(symbol));
                 }
                 return varNode;
             }
@@ -217,7 +217,7 @@ final class AssignSymbols extends NodeOperatorVisitor<LexicalContext> implements
     }
 
     private IdentNode compilerConstantIdentifier(final CompilerConstants cc) {
-        return (IdentNode)createImplicitIdentifier(cc.symbolName()).setSymbol(lc.getCurrentFunction().compilerConstant(cc));
+        return createImplicitIdentifier(cc.symbolName()).setSymbol(lc.getCurrentFunction().compilerConstant(cc));
     }
 
     /**
@@ -263,7 +263,7 @@ final class AssignSymbols extends NodeOperatorVisitor<LexicalContext> implements
         final Symbol nameSymbol = fn.getBody().getExistingSymbol(name.getName());
         assert nameSymbol != null;
 
-        return (VarNode)synthVar.setName((IdentNode)name.setSymbol(nameSymbol)).accept(this);
+        return (VarNode)synthVar.setName(name.setSymbol(nameSymbol)).accept(this);
     }
 
     private FunctionNode createSyntheticInitializers(final FunctionNode functionNode) {
@@ -522,7 +522,7 @@ final class AssignSymbols extends NodeOperatorVisitor<LexicalContext> implements
             final Symbol paramSymbol = body.getExistingSymbol(param.getName());
             assert paramSymbol != null;
             assert paramSymbol.isParam() : paramSymbol + " " + paramSymbol.getFlags();
-            newParams.add((IdentNode)param.setSymbol(paramSymbol));
+            newParams.add(param.setSymbol(paramSymbol));
 
             // parameters should not be slots for a function that uses variable arity signature
             if (isVarArg) {
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index de971ab0308..bfb9851c0f3 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -1097,7 +1097,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
 
         closeBlockVariables(block);
         lc.releaseSlots();
-        assert !method.isReachable() || lc.getUsedSlotCount() == method.getFirstTemp();
+        assert !method.isReachable() || (lc.isFunctionBody() ? 0 : lc.getUsedSlotCount()) == method.getFirstTemp();
 
         return block;
     }
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index c372d952c0a..9a6bcef259d 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -25,10 +25,12 @@
 
 package jdk.nashorn.internal.codegen;
 
+import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
 import static jdk.nashorn.internal.ir.Expression.isAlwaysFalse;
 import static jdk.nashorn.internal.ir.Expression.isAlwaysTrue;
 
 import java.util.ArrayDeque;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Deque;
 import java.util.HashSet;
@@ -39,7 +41,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.function.Function;
-
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BaseNode;
@@ -72,6 +73,7 @@ import jdk.nashorn.internal.ir.ReturnNode;
 import jdk.nashorn.internal.ir.RuntimeNode;
 import jdk.nashorn.internal.ir.RuntimeNode.Request;
 import jdk.nashorn.internal.ir.SplitNode;
+import jdk.nashorn.internal.ir.Statement;
 import jdk.nashorn.internal.ir.SwitchNode;
 import jdk.nashorn.internal.ir.Symbol;
 import jdk.nashorn.internal.ir.TernaryNode;
@@ -356,6 +358,8 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
     private boolean reachable = true;
     // Return type of the function
     private Type returnType = Type.UNKNOWN;
+    // Synthetic return node that we must insert at the end of the function if it's end is reachable.
+    private ReturnNode syntheticReturn;
 
     // Topmost current split node (if any)
     private SplitNode topSplit;
@@ -845,6 +849,10 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
 
     @Override
     public boolean enterThrowNode(final ThrowNode throwNode) {
+        if(!reachable) {
+            return false;
+        }
+
         throwNode.getExpression().accept(this);
         jumpToCatchBlock(throwNode);
         doesNotContinueSequentially();
@@ -1031,6 +1039,15 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
     @Override
     public Node leaveBlock(final Block block) {
         if(lc.isFunctionBody()) {
+            if(reachable) {
+                // reachable==true means we can reach the end of the function without an explicit return statement. We
+                // need to insert a synthetic one then. This logic used to be in Lower.leaveBlock(), but Lower's
+                // reachability analysis (through Terminal.isTerminal() flags) is not precise enough so
+                // Lower$BlockLexicalContext.afterSetStatements will sometimes think the control flow terminates even
+                // when it didn't. Example: function() { switch((z)) { default: {break; } throw x; } }.
+                createSyntheticReturn(block);
+                assert !reachable;
+            }
             // We must calculate the return type here (and not in leaveFunctionNode) as it can affect the liveness of
             // the :return symbol and thus affect conversion type liveness calculations for it.
             calculateReturnType();
@@ -1089,6 +1106,23 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
             retSymbol.setNeedsSlot(true);
         }
     }
+
+    private void createSyntheticReturn(final Block body) {
+        final FunctionNode functionNode = lc.getCurrentFunction();
+        final long token = functionNode.getToken();
+        final int finish = functionNode.getFinish();
+        final List<Statement> statements = body.getStatements();
+        final int lineNumber = statements.isEmpty() ? functionNode.getLineNumber() : statements.get(statements.size() - 1).getLineNumber();
+        final IdentNode returnExpr;
+        if(functionNode.isProgram()) {
+            returnExpr = new IdentNode(token, finish, RETURN.symbolName()).setSymbol(getCompilerConstantSymbol(functionNode, RETURN));
+        } else {
+            returnExpr = null;
+        }
+        syntheticReturn = new ReturnNode(lineNumber, token, finish, returnExpr);
+        syntheticReturn.accept(this);
+    }
+
     /**
      * Leave a breakable node. If there's a join point associated with its break label (meaning there was at least one
      * break statement to the end of the node), insert the join point into the flow.
@@ -1177,6 +1211,16 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
                 return node;
             }
 
+            @Override
+            public Node leaveBlock(final Block block) {
+                if(inOuterFunction && syntheticReturn != null && lc.isFunctionBody()) {
+                    final ArrayList<Statement> stmts = new ArrayList<>(block.getStatements());
+                    stmts.add((ReturnNode)syntheticReturn.accept(this));
+                    return block.setStatements(lc, stmts);
+                }
+                return super.leaveBlock(block);
+            }
+
             @Override
             public Node leaveFunctionNode(final FunctionNode nestedFunctionNode) {
                 inOuterFunction = true;
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java
index 3da0f778712..352270d05dd 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java
@@ -75,7 +75,6 @@ import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.CodeInstaller;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.JSType;
-import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.logging.DebugLogger;
 import jdk.nashorn.internal.runtime.logging.Loggable;
@@ -159,30 +158,6 @@ final class Lower extends NodeOperatorVisitor<BlockLexicalContext> implements Lo
         return context.getLogger(this.getClass());
     }
 
-    @Override
-    public Node leaveBlock(final Block block) {
-        //now we have committed the entire statement list to the block, but we need to truncate
-        //whatever is after the last terminal. block append won't append past it
-
-
-        if (lc.isFunctionBody()) {
-            final FunctionNode currentFunction = lc.getCurrentFunction();
-            final boolean isProgram = currentFunction.isProgram();
-            final Statement last = lc.getLastStatement();
-            final ReturnNode returnNode = new ReturnNode(
-                last == null ? currentFunction.getLineNumber() : last.getLineNumber(), //TODO?
-                currentFunction.getToken(),
-                currentFunction.getFinish(),
-                isProgram ?
-                    compilerConstant(RETURN) :
-                    LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED));
-
-            returnNode.accept(this);
-        }
-
-        return block;
-    }
-
     @Override
     public boolean enterBreakNode(final BreakNode breakNode) {
         addStatement(breakNode);
diff --git a/nashorn/src/jdk/nashorn/internal/ir/Block.java b/nashorn/src/jdk/nashorn/internal/ir/Block.java
index d8a84b6ef47..9d4356db6e7 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/Block.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/Block.java
@@ -41,7 +41,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
  * IR representation for a list of statements.
  */
 @Immutable
-public class Block extends Node implements BreakableNode, Flags<Block> {
+public class Block extends Node implements BreakableNode, Terminal, Flags<Block> {
     /** List of statements */
     protected final List<Statement> statements;
 
@@ -231,6 +231,11 @@ public class Block extends Node implements BreakableNode, Flags<Block> {
         return flags;
     }
 
+    /**
+     * Is this a terminal block, i.e. does it end control flow like ending with a throw or return?
+     *
+     * @return true if this node statement is terminal
+     */
     @Override
     public boolean isTerminal() {
         return getFlag(IS_TERMINAL);
diff --git a/nashorn/src/jdk/nashorn/internal/ir/CaseNode.java b/nashorn/src/jdk/nashorn/internal/ir/CaseNode.java
index 1c4cf3279c1..aae6d71f03d 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/CaseNode.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/CaseNode.java
@@ -36,7 +36,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
  * Case nodes are not BreakableNodes, but the SwitchNode is
  */
 @Immutable
-public final class CaseNode extends Node implements JoinPredecessor, Labels {
+public final class CaseNode extends Node implements JoinPredecessor, Labels, Terminal {
     /** Test expression. */
     private final Expression test;
 
@@ -77,6 +77,11 @@ public final class CaseNode extends Node implements JoinPredecessor, Labels {
         this.conversion = conversion;
     }
 
+    /**
+     * Is this a terminal case node, i.e. does it end control flow like having a throw or return?
+     *
+     * @return true if this node statement is terminal
+     */
     @Override
     public boolean isTerminal() {
         return body.isTerminal();
diff --git a/nashorn/src/jdk/nashorn/internal/ir/ExpressionStatement.java b/nashorn/src/jdk/nashorn/internal/ir/ExpressionStatement.java
index e4e15788f7c..45870ff0920 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/ExpressionStatement.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/ExpressionStatement.java
@@ -56,11 +56,6 @@ public final class ExpressionStatement extends Statement {
         this.expression = expression;
     }
 
-    @Override
-    public boolean isTerminal() {
-        return expression.isTerminal();
-    }
-
     @Override
     public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
         if (visitor.enterExpressionStatement(this)) {
diff --git a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java
index 652c5860f72..3d4d7348979 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java
@@ -110,7 +110,7 @@ public final class IdentNode extends Expression implements PropertyKey, Function
      * @return a temporary identifier for the symbol.
      */
     public static IdentNode createInternalIdentifier(final Symbol symbol) {
-        return (IdentNode)new IdentNode(Token.toDesc(TokenType.IDENT, 0, 0), 0, symbol.getName()).setSymbol(symbol);
+        return new IdentNode(Token.toDesc(TokenType.IDENT, 0, 0), 0, symbol.getName()).setSymbol(symbol);
     }
 
     @Override
@@ -180,7 +180,7 @@ public final class IdentNode extends Expression implements PropertyKey, Function
      * @param symbol the symbol
      * @return new node
      */
-    public Expression setSymbol(final Symbol symbol) {
+    public IdentNode setSymbol(final Symbol symbol) {
         if (this.symbol == symbol) {
             return this;
         }
diff --git a/nashorn/src/jdk/nashorn/internal/ir/Node.java b/nashorn/src/jdk/nashorn/internal/ir/Node.java
index 4b290c3c2dd..191d702ab64 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/Node.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/Node.java
@@ -143,15 +143,6 @@ public abstract class Node implements Cloneable {
      */
     public abstract void toString(final StringBuilder sb, final boolean printType);
 
-    /**
-     * Check if this node has terminal flags, i.e. ends or breaks control flow
-     *
-     * @return true if terminal
-     */
-    public boolean hasTerminalFlags() {
-        return isTerminal() || hasGoto();
-    }
-
     /**
      * Get the finish position for this node in the source string
      * @return finish
@@ -168,15 +159,6 @@ public abstract class Node implements Cloneable {
         this.finish = finish;
     }
 
-    /**
-     * Check if this function repositions control flow with goto like
-     * semantics, for example {@link BreakNode} or a {@link ForNode} with no test
-     * @return true if node has goto semantics
-     */
-    public boolean hasGoto() {
-        return false;
-    }
-
     /**
      * Get start position for node
      * @return start position
@@ -249,16 +231,6 @@ public abstract class Node implements Cloneable {
         return token;
     }
 
-    /**
-     * Is this a terminal Node, i.e. does it end control flow like a throw or return
-     * expression does?
-     *
-     * @return true if this node is terminal
-     */
-    public boolean isTerminal() {
-        return false;
-    }
-
     //on change, we have to replace the entire list, that's we can't simple do ListIterator.set
     static <T extends Node> List<T> accept(final NodeVisitor<? extends LexicalContext> visitor, final Class<T> clazz, final List<T> list) {
         boolean changed = false;
diff --git a/nashorn/src/jdk/nashorn/internal/ir/Statement.java b/nashorn/src/jdk/nashorn/internal/ir/Statement.java
index 6b171cb9597..b436f71fb0a 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/Statement.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/Statement.java
@@ -30,7 +30,7 @@ package jdk.nashorn.internal.ir;
  * made up of statements. The only node subclass that needs to keep token and
  * location information is the Statement
  */
-public abstract class Statement extends Node {
+public abstract class Statement extends Node implements Terminal {
 
     private final int lineNumber;
 
@@ -77,4 +77,32 @@ public abstract class Statement extends Node {
         return lineNumber;
     }
 
+    /**
+     * Is this a terminal statement, i.e. does it end control flow like a throw or return?
+     *
+     * @return true if this node statement is terminal
+     */
+    @Override
+    public boolean isTerminal() {
+        return false;
+    }
+
+    /**
+     * Check if this statement repositions control flow with goto like
+     * semantics, for example {@link BreakNode} or a {@link ForNode} with no test
+     * @return true if statement has goto semantics
+     */
+    public boolean hasGoto() {
+        return false;
+    }
+
+    /**
+     * Check if this statement has terminal flags, i.e. ends or breaks control flow
+     *
+     * @return true if has terminal flags
+     */
+    public final boolean hasTerminalFlags() {
+        return isTerminal() || hasGoto();
+    }
 }
+
diff --git a/nashorn/src/jdk/nashorn/internal/ir/Terminal.java b/nashorn/src/jdk/nashorn/internal/ir/Terminal.java
new file mode 100644
index 00000000000..3f5c25bc0f6
--- /dev/null
+++ b/nashorn/src/jdk/nashorn/internal/ir/Terminal.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.ir;
+
+/**
+ * Interface for AST nodes that can have a flag determining if they can terminate function control flow.
+ */
+public interface Terminal {
+    /**
+     * Returns true if this AST node is (or contains) a statement that terminates function control flow.
+     * @return true if this AST node is (or contains) a statement that terminates function control flow.
+     */
+    public boolean isTerminal();
+}
diff --git a/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java b/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java
index 87f3c6c50dd..52e3c0e025f 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java
@@ -38,7 +38,9 @@ import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.Expression;
 import jdk.nashorn.internal.ir.IdentNode;
 import jdk.nashorn.internal.ir.Node;
+import jdk.nashorn.internal.ir.Statement;
 import jdk.nashorn.internal.ir.Symbol;
+import jdk.nashorn.internal.ir.Terminal;
 import jdk.nashorn.internal.ir.TernaryNode;
 import jdk.nashorn.internal.ir.annotations.Ignore;
 import jdk.nashorn.internal.ir.annotations.Reference;
@@ -144,11 +146,11 @@ public final class ASTWriter {
 
         String status = "";
 
-        if (node.isTerminal()) {
+        if (node instanceof Terminal && ((Terminal)node).isTerminal()) {
             status += " Terminal";
         }
 
-        if (node.hasGoto()) {
+        if (node instanceof Statement && ((Statement)node).hasGoto()) {
             status += " Goto ";
         }
 
diff --git a/nashorn/src/jdk/nashorn/internal/ir/debug/PrintVisitor.java b/nashorn/src/jdk/nashorn/internal/ir/debug/PrintVisitor.java
index df903513b9c..52e9b66311e 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/PrintVisitor.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/PrintVisitor.java
@@ -182,9 +182,9 @@ public final class PrintVisitor extends NodeVisitor<LexicalContext> {
 
         final List<Statement> statements = block.getStatements();
 
-        for (final Node statement : statements) {
-            if (printLineNumbers && (statement instanceof Statement)) {
-                final int lineNumber = ((Statement)statement).getLineNumber();
+        for (final Statement statement : statements) {
+            if (printLineNumbers) {
+                final int lineNumber = statement.getLineNumber();
                 sb.append('\n');
                 if (lineNumber != lastLineNumber) {
                     indent();
@@ -196,10 +196,6 @@ public final class PrintVisitor extends NodeVisitor<LexicalContext> {
 
             statement.accept(this);
 
-            if (statement instanceof FunctionNode) {
-                continue;
-            }
-
             int  lastIndex = sb.length() - 1;
             char lastChar  = sb.charAt(lastIndex);
             while (Character.isWhitespace(lastChar) && lastIndex >= 0) {
diff --git a/nashorn/test/script/basic/JDK-8047057.js b/nashorn/test/script/basic/JDK-8047057.js
index 84183f19059..f13e36e4941 100644
--- a/nashorn/test/script/basic/JDK-8047057.js
+++ b/nashorn/test/script/basic/JDK-8047057.js
@@ -45,8 +45,8 @@ function makeFuncExpectError(code, ErrorType) {
     }
 }
 
-// makeFuncAndCall("switch(0) { default: {break;} return }");
-// makeFuncAndCall("L: { { break L; } return; }");
+makeFuncAndCall("switch(0) { default: {break;} return }");
+makeFuncAndCall("L: { { break L; } return; }");
 makeFuncAndCall("L: { while(0) break L; return; }");
 makeFuncExpectError("L: {while(0) break L; return [](); }", TypeError);
 // makeFuncAndCall("do with({}) break ; while(0);");
diff --git a/nashorn/test/script/basic/JDK-8047357.js b/nashorn/test/script/basic/JDK-8047357.js
new file mode 100644
index 00000000000..20e2bb4f020
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047357.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047357: More precise synthetic return + unreachable throw
+ *
+ * @test
+ * @run
+ */
+
+print((function() { switch(0) { default: {var x; break ; } throw x; } })());
+print((function() { switch(0) { default: {break;} return; } })());
diff --git a/nashorn/test/script/basic/JDK-8047357.js.EXPECTED b/nashorn/test/script/basic/JDK-8047357.js.EXPECTED
new file mode 100644
index 00000000000..d4f80bf8362
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047357.js.EXPECTED
@@ -0,0 +1,2 @@
+undefined
+undefined
-- 
GitLab


From 3168df50f587c1ff71942d7e8c08cc83250bfbfc Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 26 Jun 2014 15:36:15 +0200
Subject: [PATCH 148/192] 8047371: local variable declaration in TypeEvaluator
 should use ScriptObject.addOwnProperty instead of .set

Reviewed-by: jlaskey, lagergren
---
 .../internal/codegen/TypeEvaluator.java       | 10 ++++--
 nashorn/test/script/basic/JDK-8047371.js      | 32 +++++++++++++++++++
 .../test/script/basic/JDK-8047371.js.EXPECTED |  1 +
 3 files changed, 40 insertions(+), 3 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8047371.js
 create mode 100644 nashorn/test/script/basic/JDK-8047371.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/TypeEvaluator.java b/nashorn/src/jdk/nashorn/internal/codegen/TypeEvaluator.java
index 97dbb90c789..2c90a3eb846 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/TypeEvaluator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/TypeEvaluator.java
@@ -25,6 +25,10 @@
 
 package jdk.nashorn.internal.codegen;
 
+import static jdk.nashorn.internal.runtime.Property.NOT_CONFIGURABLE;
+import static jdk.nashorn.internal.runtime.Property.NOT_ENUMERABLE;
+import static jdk.nashorn.internal.runtime.Property.NOT_WRITABLE;
+
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.Expression;
@@ -43,8 +47,8 @@ import jdk.nashorn.internal.runtime.ScriptRuntime;
  * Used during recompilation.
  */
 final class TypeEvaluator {
-    final Compiler compiler;
-    final ScriptObject runtimeScope;
+    private final Compiler compiler;
+    private final ScriptObject runtimeScope;
 
     TypeEvaluator(final Compiler compiler, final ScriptObject runtimeScope) {
         this.compiler = compiler;
@@ -123,7 +127,7 @@ final class TypeEvaluator {
                     " scope="+runtimeScope;
 
         if (runtimeScope.findProperty(symbolName, false) == null) {
-            runtimeScope.set(symbolName, ScriptRuntime.UNDEFINED, true);
+            runtimeScope.addOwnProperty(symbolName, NOT_WRITABLE | NOT_ENUMERABLE | NOT_CONFIGURABLE, ScriptRuntime.UNDEFINED);
         }
     }
 
diff --git a/nashorn/test/script/basic/JDK-8047371.js b/nashorn/test/script/basic/JDK-8047371.js
new file mode 100644
index 00000000000..fb380c7806f
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047371.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047371: local variable declaration in TypeEvaluator should use ScriptObject.addOwnProperty instead of .set
+ *
+ * @test
+ * @run
+ */
+
+print((function(){ var a=1; with({ get a() { return false } }) return a })());
+
diff --git a/nashorn/test/script/basic/JDK-8047371.js.EXPECTED b/nashorn/test/script/basic/JDK-8047371.js.EXPECTED
new file mode 100644
index 00000000000..c508d5366f7
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047371.js.EXPECTED
@@ -0,0 +1 @@
+false
-- 
GitLab


From 8f69a3e4a8e708a2ac44e012ef3300ead4a4860a Mon Sep 17 00:00:00 2001
From: Marcus Lagergren <lagergren@openjdk.org>
Date: Fri, 27 Jun 2014 10:47:44 +0200
Subject: [PATCH 149/192] 8048505: ScriptingFunctions.readFully couldn't handle
 file names represented as ConsStrings

Reviewed-by: sundar, hannesw
---
 .../internal/runtime/ScriptingFunctions.java  |  4 +-
 nashorn/test/script/basic/JDK-8048505.js      | 52 +++++++++++++++++++
 .../test/script/basic/JDK-8048505.js.EXPECTED |  7 +++
 3 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8048505.js
 create mode 100644 nashorn/test/script/basic/JDK-8048505.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java
index 78747acb64f..2113b79c22e 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java
@@ -107,8 +107,8 @@ public final class ScriptingFunctions {
 
         if (file instanceof File) {
             f = (File)file;
-        } else if (file instanceof String) {
-            f = new java.io.File((String)file);
+        } else if (file instanceof String || file instanceof ConsString) {
+            f = new java.io.File(((CharSequence)file).toString());
         }
 
         if (f == null || !f.isFile()) {
diff --git a/nashorn/test/script/basic/JDK-8048505.js b/nashorn/test/script/basic/JDK-8048505.js
new file mode 100644
index 00000000000..4ee8fe16bbd
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048505.js
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Read fully parameter test
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var str = __FILE__;
+var first = readFully(str);
+print(typeof str);
+
+var str2 = __FILE__.substring(0,5);
+var str3 = __FILE__.substring(5);
+print(typeof str2);
+print(typeof str3);
+
+var cons = str2 + str3;
+print(typeof cons);
+
+var second = readFully(cons);
+
+var f = new java.io.File(str);
+print(typeof f);
+var third = readFully(f);
+
+print(first.length() == second.length());
+print(first.length() == third.length());
+
diff --git a/nashorn/test/script/basic/JDK-8048505.js.EXPECTED b/nashorn/test/script/basic/JDK-8048505.js.EXPECTED
new file mode 100644
index 00000000000..ed5daae86f7
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048505.js.EXPECTED
@@ -0,0 +1,7 @@
+string
+string
+string
+string
+object
+true
+true
-- 
GitLab


From 4b428d5833b11be7a465635d30dd588b3dc906ce Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Fri, 27 Jun 2014 21:54:16 +0530
Subject: [PATCH 150/192] 8046013: TypeError: Cannot apply "with" to non script
 object

Reviewed-by: lagergren, hannesw
---
 .../internal/objects/NativeObject.java        | 26 +++++++++
 .../internal/runtime/ScriptRuntime.java       | 19 ++++++-
 .../nashorn/internal/runtime/WithObject.java  | 19 ++++++-
 nashorn/test/script/basic/JDK-8046013.js      | 57 +++++++++++++++++++
 .../test/script/basic/JDK-8046013.js.EXPECTED |  4 ++
 .../api/scripting/ScriptEngineTest.java       | 14 +++++
 6 files changed, 135 insertions(+), 4 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8046013.js
 create mode 100644 nashorn/test/script/basic/JDK-8046013.js.EXPECTED

diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
index 30ffbabff9e..08ad24cc8a7 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
@@ -716,6 +716,32 @@ public final class NativeObject {
         return target;
     }
 
+    /*
+     * Binds the source mirror object's properties to the target object. Binding
+     * properties allows two-way read/write for the properties of the source object.
+     * All inherited, enumerable properties are also bound. This method is used to
+     * to make 'with' statement work with ScriptObjectMirror as scope object.
+     *
+     * @param target the target object to which the source object's properties are bound
+     * @param source the source object whose properties are bound to the target
+     * @return the target object after property binding
+     */
+    public static Object bindAllProperties(final ScriptObject target, final ScriptObjectMirror source) {
+        final Set<String> keys = source.keySet();
+        // make accessor properties using dynamic invoker getters and setters
+        final AccessorProperty[] props = new AccessorProperty[keys.size()];
+        int idx = 0;
+        for (String name : keys) {
+            final MethodHandle getter = Bootstrap.createDynamicInvoker("dyn:getMethod|getProp|getElem:" + name, MIRROR_GETTER_TYPE);
+            final MethodHandle setter = Bootstrap.createDynamicInvoker("dyn:setProp|setElem:" + name, MIRROR_SETTER_TYPE);
+            props[idx] = AccessorProperty.create(name, 0, getter, setter);
+            idx++;
+        }
+
+        target.addBoundProperties(source, props);
+        return target;
+    }
+
     private static void bindBeanProperties(final ScriptObject targetObj, final Object source,
             final Collection<String> readablePropertyNames, final Collection<String> writablePropertyNames,
             final Collection<String> methodNames) {
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
index 580e95d80ea..337d92699e3 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
@@ -49,6 +49,7 @@ import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.ir.debug.JSONWriter;
 import jdk.nashorn.internal.objects.Global;
+import jdk.nashorn.internal.objects.NativeObject;
 import jdk.nashorn.internal.parser.Lexer;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 
@@ -478,9 +479,21 @@ public final class ScriptRuntime {
             throw typeError(global, "cant.apply.with.to.null");
         }
 
-        final Object wrappedExpr = JSType.toScriptObject(global, expression);
-        if (wrappedExpr instanceof ScriptObject) {
-            return new WithObject(scope, (ScriptObject)wrappedExpr);
+        if (expression instanceof ScriptObjectMirror) {
+            final Object unwrapped = ScriptObjectMirror.unwrap(expression, global);
+            if (unwrapped instanceof ScriptObject) {
+                return new WithObject(scope, (ScriptObject)unwrapped);
+            } else {
+                // foreign ScriptObjectMirror
+                ScriptObject exprObj = global.newObject();
+                NativeObject.bindAllProperties(exprObj, (ScriptObjectMirror)expression);
+                return new WithObject(scope, exprObj);
+            }
+        } else {
+            final Object wrappedExpr = JSType.toScriptObject(global, expression);
+            if (wrappedExpr instanceof ScriptObject) {
+                return new WithObject(scope, (ScriptObject)wrappedExpr);
+            }
         }
 
         throw typeError(global, "cant.apply.with.to.non.scriptobject");
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java
index 24c5e3d9ff8..ac5f5a76e4a 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java
@@ -31,6 +31,8 @@ import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.SwitchPoint;
+import jdk.nashorn.api.scripting.AbstractJSObject;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
@@ -312,7 +314,22 @@ public final class WithObject extends ScriptObject implements Scope {
 
     @SuppressWarnings("unused")
     private static Object bindToExpression(final Object fn, final Object receiver) {
-        return fn instanceof ScriptFunction ? bindToExpression((ScriptFunction) fn, receiver) : fn;
+        if (fn instanceof ScriptFunction) {
+            return bindToExpression((ScriptFunction) fn, receiver);
+        } else if (fn instanceof ScriptObjectMirror) {
+            final ScriptObjectMirror mirror = (ScriptObjectMirror)fn;
+            if (mirror.isFunction()) {
+                // We need to make sure correct 'this' is used for calls with Ident call
+                // expressions. We do so here using an AbstractJSObject instance.
+                return new AbstractJSObject() {
+                    public Object call(final Object thiz, final Object... args) {
+                        return mirror.call(withFilterExpression(receiver), args);
+                    }
+                };
+            }
+        }
+
+        return fn;
     }
 
     private static Object bindToExpression(final ScriptFunction fn, final Object receiver) {
diff --git a/nashorn/test/script/basic/JDK-8046013.js b/nashorn/test/script/basic/JDK-8046013.js
new file mode 100644
index 00000000000..e3a5ac4e9be
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8046013.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8046013: TypeError: Cannot apply "with" to non script object
+ *
+ * @test
+ * @run
+ */
+
+var obj = loadWithNewGlobal({
+    script: "({ f: 33 })",
+    name: "test"
+});
+
+with (obj) {
+   print("f = " + f);
+}
+
+var obj2 = loadWithNewGlobal({
+    script: "var obj = Object.create({ foo: 42 }); obj.bar = 'hello'; obj",
+    name: "test2"
+});
+
+with (obj2) {
+    print("foo = " + foo);
+    print("bar = " + bar);
+}
+
+var obj3 = loadWithNewGlobal({
+    script: "({ f: 33, func: function() { print('this.f =', this.f); } })",
+    name: "test"
+});
+
+with(obj3) {
+    func();
+}
diff --git a/nashorn/test/script/basic/JDK-8046013.js.EXPECTED b/nashorn/test/script/basic/JDK-8046013.js.EXPECTED
new file mode 100644
index 00000000000..4b612ed6693
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8046013.js.EXPECTED
@@ -0,0 +1,4 @@
+f = 33
+foo = 42
+bar = hello
+this.f = 33
diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java
index 6989d6c646f..87d9b5ef35b 100644
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java
@@ -593,6 +593,20 @@ public class ScriptEngineTest {
         }
     }
 
+    // @bug 8046013: TypeError: Cannot apply "with" to non script object
+    @Test
+    public void withOnMirrorTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        final Object obj = e.eval("({ foo: 'hello'})");
+        final Object[] arr = new Object[1];
+        arr[0] = obj;
+        e.put("arr", arr);
+        final Object res = e.eval("var res; with(arr[0]) { res = foo; }; res");
+        assertEquals(res, "hello");
+    }
+
     private static void checkProperty(final ScriptEngine e, final String name)
         throws ScriptException {
         final String value = System.getProperty(name);
-- 
GitLab


From efbff37c1a061b96bb2b44c277b9816967b32c8a Mon Sep 17 00:00:00 2001
From: Mike Duigou <mduigou@openjdk.org>
Date: Fri, 27 Jun 2014 10:26:39 -0700
Subject: [PATCH 151/192] 8048207: Collections.checkedQueue.offer() calls add
 on wrapped queue

Reviewed-by: psandoz
---
 .../share/classes/java/util/Collections.java  |  23 +---
 .../java/util/Collections/CheckedQueue.java   | 116 ++++++------------
 2 files changed, 45 insertions(+), 94 deletions(-)

diff --git a/jdk/src/share/classes/java/util/Collections.java b/jdk/src/share/classes/java/util/Collections.java
index 0c0a105513e..f6a65c7b106 100644
--- a/jdk/src/share/classes/java/util/Collections.java
+++ b/jdk/src/share/classes/java/util/Collections.java
@@ -3077,10 +3077,7 @@ public class Collections {
                 public void remove()     {        it.remove(); }};
         }
 
-        public boolean add(E e) {
-            typeCheck(e);
-            return c.add(e);
-        }
+        public boolean add(E e)          { return c.add(typeCheck(e)); }
 
         private E[] zeroLengthElementArray; // Lazily initialized
 
@@ -3187,11 +3184,7 @@ public class Collections {
         public E peek()                 {return queue.peek();}
         public E poll()                 {return queue.poll();}
         public E remove()               {return queue.remove();}
-
-        public boolean offer(E e) {
-            typeCheck(e);
-            return add(e);
-        }
+        public boolean offer(E e)       {return queue.offer(typeCheck(e));}
     }
 
     /**
@@ -3440,13 +3433,11 @@ public class Collections {
         public int lastIndexOf(Object o) { return list.lastIndexOf(o); }
 
         public E set(int index, E element) {
-            typeCheck(element);
-            return list.set(index, element);
+            return list.set(index, typeCheck(element));
         }
 
         public void add(int index, E element) {
-            typeCheck(element);
-            list.add(index, element);
+            list.add(index, typeCheck(element));
         }
 
         public boolean addAll(int index, Collection<? extends E> c) {
@@ -3467,13 +3458,11 @@ public class Collections {
                 public void remove()         {        i.remove(); }
 
                 public void set(E e) {
-                    typeCheck(e);
-                    i.set(e);
+                    i.set(typeCheck(e));
                 }
 
                 public void add(E e) {
-                    typeCheck(e);
-                    i.add(e);
+                    i.add(typeCheck(e));
                 }
 
                 @Override
diff --git a/jdk/test/java/util/Collections/CheckedQueue.java b/jdk/test/java/util/Collections/CheckedQueue.java
index 6f28e12e9ef..fb47e2e5ca1 100644
--- a/jdk/test/java/util/Collections/CheckedQueue.java
+++ b/jdk/test/java/util/Collections/CheckedQueue.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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,55 +23,40 @@
 
 /*
  * @test
- * @bug 5020931
+ * @bug 5020931 8048207
  * @summary Unit test for Collections.checkedQueue
+ * @run testng CheckedQueue
  */
 
-import java.lang.reflect.Method;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.Queue;
 import java.util.concurrent.ArrayBlockingQueue;
 
-public class CheckedQueue {
-    static int status = 0;
-
-    public static void main(String[] args) throws Exception {
-        new CheckedQueue();
-    }
+import org.testng.annotations.Test;
+import static org.testng.Assert.fail;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
 
-    public CheckedQueue() throws Exception {
-        run();
-    }
 
-    private void run() throws Exception {
-        Method[] methods = this.getClass().getDeclaredMethods();
-
-        for (int i = 0; i < methods.length; i++) {
-            Method method = methods[i];
-            String methodName = method.getName();
-
-            if (methodName.startsWith("test")) {
-                try {
-                    Object obj = method.invoke(this, new Object[0]);
-                } catch(Exception e) {
-                    throw new Exception(this.getClass().getName() + "." +
-                            methodName + " test failed, test exception "
-                            + "follows\n" + e.getCause());
-                }
-            }
-        }
-    }
+public class CheckedQueue {
 
     /**
      * This test adds items to a queue.
      */
-    private void test00() {
+    @Test
+    public void testAdd() {
         int arrayLength = 10;
-        ArrayBlockingQueue<String> abq = new ArrayBlockingQueue(arrayLength);
+        Queue<String> abq = Collections.checkedQueue(new ArrayBlockingQueue<>(arrayLength), String.class);
 
         for (int i = 0; i < arrayLength; i++) {
-            abq.add(new String(Integer.toString(i)));
+            abq.add(Integer.toString(i));
+        }
+
+        try {
+            abq.add("full");
+        } catch (IllegalStateException full) {
+
         }
     }
 
@@ -80,23 +65,17 @@ public class CheckedQueue {
      * {@code String}s gets the checked queue, and attempt to add an Integer to
      * the checked queue.
      */
-    private void test01() throws Exception {
+    @Test(expectedExceptions = ClassCastException.class)
+    public void testAddFail1() {
         int arrayLength = 10;
         ArrayBlockingQueue<String> abq = new ArrayBlockingQueue(arrayLength + 1);
 
         for (int i = 0; i < arrayLength; i++) {
-            abq.add(new String(Integer.toString(i)));
+            abq.add(Integer.toString(i));
         }
 
         Queue q = Collections.checkedQueue(abq, String.class);
-
-        try {
-            q.add(new Integer(0));
-            throw new Exception(this.getClass().getName() + "." + "test01 test"
-                    + " failed, should throw ClassCastException.");
-        } catch(ClassCastException cce) {
-            // Do nothing.
-        }
+        q.add(0);
     }
 
     /**
@@ -104,47 +83,40 @@ public class CheckedQueue {
      * {@code String}, gets the checked queue, and attempt to add an Integer to
      * the checked queue.
      */
-    private void test02() throws Exception {
+    @Test(expectedExceptions = ClassCastException.class)
+    public void testAddFail2() {
         ArrayBlockingQueue<String> abq = new ArrayBlockingQueue(1);
         Queue q = Collections.checkedQueue(abq, String.class);
 
-        try {
-            q.add(new Integer(0));
-            throw new Exception(this.getClass().getName() + "." + "test02 test"
-                    + " failed, should throw ClassCastException.");
-        } catch(ClassCastException e) {
-            // Do nothing.
-        }
+        q.add(0);
     }
 
     /**
      * This test tests the Collections.checkedQueue method call for nulls in
      * each and both of the parameters.
      */
-    private void test03() throws Exception {
+    @Test
+    public void testArgs() {
         ArrayBlockingQueue<String> abq = new ArrayBlockingQueue(1);
         Queue q;
 
         try {
             q = Collections.checkedQueue(null, String.class);
-            throw new Exception(this.getClass().getName() + "." + "test03 test"
-                    + " failed, should throw NullPointerException.");
+            fail( "should throw NullPointerException.");
         } catch(NullPointerException npe) {
             // Do nothing
         }
 
         try {
             q = Collections.checkedQueue(abq, null);
-            throw new Exception(this.getClass().getName() + "." + "test03 test"
-                    + " failed, should throw NullPointerException.");
+            fail( "should throw NullPointerException.");
         } catch(Exception e) {
             // Do nothing
         }
 
         try {
             q = Collections.checkedQueue(null, null);
-            throw new Exception(this.getClass().getName() + "." + "test03 test"
-                    + " failed, should throw NullPointerException.");
+            fail( "should throw NullPointerException.");
         } catch(Exception e) {
             // Do nothing
         }
@@ -153,38 +125,28 @@ public class CheckedQueue {
     /**
      * This test tests the CheckedQueue.offer method.
      */
-    private void test04() throws Exception {
+    @Test
+    public void testOffer() {
         ArrayBlockingQueue<String> abq = new ArrayBlockingQueue(1);
         Queue q = Collections.checkedQueue(abq, String.class);
 
         try {
             q.offer(null);
-            throw new Exception(this.getClass().getName() + "." + "test04 test"
-                    + " failed, should throw NullPointerException.");
+            fail("should throw NullPointerException.");
         } catch (NullPointerException npe) {
             // Do nothing
         }
 
         try {
-            q.offer(new Integer(0));
-            throw new Exception(this.getClass().getName() + "." + "test04 test"
-                    + " failed, should throw ClassCastException.");
+            q.offer(0);
+            fail("should throw ClassCastException.");
         } catch (ClassCastException cce) {
             // Do nothing
         }
 
-        q.offer(new String("0"));
-
-        try {
-            q.offer(new String("1"));
-            throw new Exception(this.getClass().getName() + "." + "test04 test"
-                    + " failed, should throw IllegalStateException.");
-        } catch(IllegalStateException ise) {
-            // Do nothing
-        }
-    }
-
-    private void test05() {
+        assertTrue(q.offer("0"), "queue should have room");
 
+        // no room at the inn!
+        assertFalse(q.offer("1"), "queue should be full");
     }
 }
-- 
GitLab


From c75f8957e82d11a0c952a118f71c094396f7db26 Mon Sep 17 00:00:00 2001
From: Andrei Eremeev <andrei.eremeev@oracle.com>
Date: Mon, 30 Jun 2014 16:32:36 +0400
Subject: [PATCH 152/192] 8046434: Fix doclint warnings from
 javax.swing.plaf.metal package

Reviewed-by: alexsch
---
 .../javax/swing/plaf/metal/MetalBorders.java  |  75 +++++++-
 .../javax/swing/plaf/metal/MetalButtonUI.java |  35 ++++
 .../swing/plaf/metal/MetalCheckBoxIcon.java   |  13 ++
 .../swing/plaf/metal/MetalCheckBoxUI.java     |   7 +
 .../swing/plaf/metal/MetalComboBoxButton.java |  70 +++++++
 .../swing/plaf/metal/MetalComboBoxEditor.java |   3 +
 .../swing/plaf/metal/MetalComboBoxUI.java     |  24 +++
 .../swing/plaf/metal/MetalDesktopIconUI.java  |   9 +
 .../swing/plaf/metal/MetalFileChooserUI.java  | 127 ++++++++++--
 .../swing/plaf/metal/MetalIconFactory.java    | 180 +++++++++++++++++-
 .../metal/MetalInternalFrameTitlePane.java    |  26 +++
 .../plaf/metal/MetalInternalFrameUI.java      |  20 ++
 .../javax/swing/plaf/metal/MetalLabelUI.java  |   6 +
 .../plaf/metal/MetalPopupMenuSeparatorUI.java |   6 +
 .../swing/plaf/metal/MetalProgressBarUI.java  |   6 +
 .../swing/plaf/metal/MetalRadioButtonUI.java  |  34 ++++
 .../swing/plaf/metal/MetalScrollBarUI.java    |  27 ++-
 .../swing/plaf/metal/MetalScrollButton.java   |  43 ++---
 .../swing/plaf/metal/MetalScrollPaneUI.java   |  12 ++
 .../swing/plaf/metal/MetalSeparatorUI.java    |   6 +
 .../javax/swing/plaf/metal/MetalSliderUI.java |  57 +++++-
 .../swing/plaf/metal/MetalSplitPaneUI.java    |  13 +-
 .../swing/plaf/metal/MetalTabbedPaneUI.java   | 104 +++++++++-
 .../swing/plaf/metal/MetalTextFieldUI.java    |   6 +
 .../swing/plaf/metal/MetalToggleButtonUI.java |  33 ++++
 .../swing/plaf/metal/MetalToolBarUI.java      |  27 ++-
 .../swing/plaf/metal/MetalToolTipUI.java      |  24 +++
 .../javax/swing/plaf/metal/MetalTreeUI.java   |  68 ++++---
 28 files changed, 981 insertions(+), 80 deletions(-)

diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java
index 8f1ee4fb4d3..a49a4a8bb48 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java
@@ -56,6 +56,9 @@ public class MetalBorders {
     static Object NO_BUTTON_ROLLOVER =
         new StringUIClientPropertyKey("NoButtonRollover");
 
+    /**
+     * The class represents the 3D border.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class Flush3DBorder extends AbstractBorder implements UIResource{
         public void paintBorder(Component c, Graphics g, int x, int y,
@@ -73,9 +76,15 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a {@code JButton}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class ButtonBorder extends AbstractBorder implements UIResource {
 
+        /**
+         * The border insets.
+         */
         protected static Insets borderInsets = new Insets( 3, 3, 3, 3 );
 
         public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
@@ -188,6 +197,9 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a {@code JInternalFrame}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class InternalFrameBorder extends AbstractBorder implements UIResource {
         private static final int corner = 14;
@@ -470,6 +482,9 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of an option dialog.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class OptionDialogBorder extends AbstractBorder implements UIResource {
         int titleHeight = 0;
@@ -532,8 +547,15 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a {@code JMenuBar}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class MenuBarBorder extends AbstractBorder implements UIResource {
+
+        /**
+         * The border insets.
+         */
         protected static Insets borderInsets = new Insets( 1, 0, 1, 0 );
 
         public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
@@ -569,8 +591,15 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a {@code JMenuItem}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class MenuItemBorder extends AbstractBorder implements UIResource {
+
+        /**
+         * The border insets.
+         */
         protected static Insets borderInsets = new Insets( 2, 2, 2, 2 );
 
         public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
@@ -617,8 +646,15 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a {@code JPopupMenu}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class PopupMenuBorder extends AbstractBorder implements UIResource {
+
+        /**
+         * The border insets.
+         */
         protected static Insets borderInsets = new Insets( 3, 1, 2, 1 );
 
         public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
@@ -642,6 +678,9 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a rollover {@code Button}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class RolloverButtonBorder extends ButtonBorder {
 
@@ -693,9 +732,15 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a {@code JToolBar}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class ToolBarBorder extends AbstractBorder implements UIResource, SwingConstants
     {
+        /**
+         * The instance of {@code MetalBumps}.
+         */
         protected MetalBumps bumps = new MetalBumps( 10, 10,
                                       MetalLookAndFeel.getControlHighlight(),
                                       MetalLookAndFeel.getControlDarkShadow(),
@@ -779,7 +824,9 @@ public class MetalBorders {
     private static Border buttonBorder;
 
     /**
-     * Returns a border instance for a JButton
+     * Returns a border instance for a {@code JButton}.
+     *
+     * @return a border instance for a {@code JButton}
      * @since 1.3
      */
     public static Border getButtonBorder() {
@@ -794,7 +841,9 @@ public class MetalBorders {
     private static Border textBorder;
 
     /**
-     * Returns a border instance for a text component
+     * Returns a border instance for a text component.
+     *
+     * @return a border instance for a text component
      * @since 1.3
      */
     public static Border getTextBorder() {
@@ -809,7 +858,9 @@ public class MetalBorders {
     private static Border textFieldBorder;
 
     /**
-     * Returns a border instance for a JTextField
+     * Returns a border instance for a {@code JTextField}.
+     *
+     * @return a border instance for a {@code JTextField}
      * @since 1.3
      */
     public static Border getTextFieldBorder() {
@@ -821,6 +872,9 @@ public class MetalBorders {
         return textFieldBorder;
     }
 
+    /**
+     * The class represents the border of a {@code JTestField}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class TextFieldBorder extends Flush3DBorder {
 
@@ -846,6 +900,9 @@ public class MetalBorders {
         }
     }
 
+    /**
+     * The class represents the border of a {@code JScrollPane}.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class ScrollPaneBorder extends AbstractBorder implements UIResource {
         public void paintBorder(Component c, Graphics g, int x, int y,
@@ -892,7 +949,9 @@ public class MetalBorders {
     private static Border toggleButtonBorder;
 
     /**
-     * Returns a border instance for a JToggleButton
+     * Returns a border instance for a {@code JToggleButton}.
+     *
+     * @return a border instance for a {@code JToggleButton}
      * @since 1.3
      */
     public static Border getToggleButtonBorder() {
@@ -942,6 +1001,10 @@ public class MetalBorders {
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public static class TableHeaderBorder extends javax.swing.border.AbstractBorder {
+
+        /**
+         * The border insets.
+         */
         protected Insets editorBorderInsets = new Insets( 2, 2, 2, 0 );
 
         public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
@@ -964,7 +1027,9 @@ public class MetalBorders {
     }
 
     /**
-     * Returns a border instance for a Desktop Icon
+     * Returns a border instance for a Desktop Icon.
+     *
+     * @return a border instance for a Desktop Icon
      * @since 1.3
      */
     public static Border getDesktopIconBorder() {
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java
index 233949e3df1..db31cc126a9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java
@@ -52,10 +52,22 @@ import javax.swing.plaf.*;
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalButtonUI extends BasicButtonUI {
+
     // NOTE: These are not really needed, but at this point we can't pull
     // them. Their values are updated purely for historical reasons.
+    /**
+     * The color of the focused button.
+     */
     protected Color focusColor;
+
+    /**
+     * The color of the selected button.
+     */
     protected Color selectColor;
+
+    /**
+     * The color of the disabled color.
+     */
     protected Color disabledTextColor;
 
     private static final Object METAL_BUTTON_UI_KEY = new Object();
@@ -63,6 +75,13 @@ public class MetalButtonUI extends BasicButtonUI {
     // ********************************
     //          Create PLAF
     // ********************************
+
+    /**
+     * Returns an instance of {@code MetalButtonUI}.
+     *
+     * @param c a component
+     * @return an instance of {@code MetalButtonUI}
+     */
     public static ComponentUI createUI(JComponent c) {
         AppContext appContext = AppContext.getAppContext();
         MetalButtonUI metalButtonUI =
@@ -96,17 +115,33 @@ public class MetalButtonUI extends BasicButtonUI {
     // ********************************
     //         Default Accessors
     // ********************************
+
+    /**
+     * Returns the color of the selected button.
+     *
+     * @return the color of the selected button
+     */
     protected Color getSelectColor() {
         selectColor = UIManager.getColor(getPropertyPrefix() + "select");
         return selectColor;
     }
 
+    /**
+     * Returns the color of a disabled text.
+     *
+     * @return the color of a disabled text
+     */
     protected Color getDisabledTextColor() {
         disabledTextColor = UIManager.getColor(getPropertyPrefix() +
                                                "disabledText");
         return disabledTextColor;
     }
 
+    /**
+     * Returns the color of the focused button.
+     *
+     * @return the color of the focused button
+     */
     protected Color getFocusColor() {
         focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
         return focusColor;
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java
index 0962c8e943a..c262f460fe7 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java
@@ -49,6 +49,11 @@ import javax.swing.plaf.*;
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
 
+    /**
+     * Returns the size of the control.
+     *
+     * @return the size of the control
+     */
     protected int getControlSize() { return 13; }
 
     public void paintIcon(Component c, Graphics g, int x, int y) {
@@ -91,6 +96,14 @@ public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
         }
     }
 
+    /**
+     * Paints {@code MetalCheckBoxIcon}.
+     *
+     * @param c a component
+     * @param g an instance of {@code Graphics}
+     * @param x an X coordinate
+     * @param y an Y coordinate
+     */
     protected void drawCheck(Component c, Graphics g, int x, int y) {
         int controlSize = getControlSize();
         g.fillRect( x+3, y+5, 2, controlSize-8 );
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java
index b80ec636ac2..e18d44a37a0 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java
@@ -67,6 +67,13 @@ public class MetalCheckBoxUI extends MetalRadioButtonUI {
     // ********************************
     //         Create PlAF
     // ********************************
+
+    /**
+     * Returns an instance of {@code MetalCheckBoxUI}.
+     *
+     * @param b a component
+     * @return a new instance of {@code MetalCheckBoxUI}
+     */
     public static ComponentUI createUI(JComponent b) {
         AppContext appContext = AppContext.getAppContext();
         MetalCheckBoxUI checkboxUI =
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java
index 6a6d1ed860e..15b889e9d34 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java
@@ -50,19 +50,72 @@ import java.io.Serializable;
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalComboBoxButton extends JButton {
+
+    /**
+     * The instance of {@code JComboBox}.
+     */
     protected JComboBox comboBox;
+
+    /**
+     * The instance of {@code JList}.
+     */
     protected JList listBox;
+
+    /**
+     * The instance of {@code CellRendererPane}.
+     */
     protected CellRendererPane rendererPane;
+
+    /**
+     * The icon.
+     */
     protected Icon comboIcon;
+
+    /**
+     * The {@code iconOnly} value.
+     */
     protected boolean iconOnly = false;
 
+    /**
+     * Returns the {@code JComboBox}.
+     *
+     * @return the {@code JComboBox}
+     */
     public final JComboBox getComboBox() { return comboBox;}
+
+    /**
+     * Sets the {@code JComboBox}.
+     *
+     * @param cb the {@code JComboBox}
+     */
     public final void setComboBox( JComboBox cb ) { comboBox = cb;}
 
+    /**
+     * Returns the icon of the {@code JComboBox}.
+     *
+     * @return the icon of the {@code JComboBox}
+     */
     public final Icon getComboIcon() { return comboIcon;}
+
+    /**
+     * Sets the icon of the {@code JComboBox}.
+     *
+     * @param i the icon of the {@code JComboBox}
+     */
     public final void setComboIcon( Icon i ) { comboIcon = i;}
 
+    /**
+     * Returns the {@code isIconOnly} value.
+     *
+     * @return the {@code isIconOnly} value
+     */
     public final boolean isIconOnly() { return iconOnly;}
+
+    /**
+     * If {@code isIconOnly} is {@code true} then only icon is painted.
+     *
+     * @param isIconOnly if {@code true} then only icon is painted
+     */
     public final void setIconOnly( boolean isIconOnly ) { iconOnly = isIconOnly;}
 
     MetalComboBoxButton() {
@@ -75,6 +128,14 @@ public class MetalComboBoxButton extends JButton {
         setModel( model );
     }
 
+    /**
+     * Constructs a new instance of {@code MetalComboBoxButton}.
+     *
+     * @param cb an instance of {@code JComboBox}
+     * @param i an icon
+     * @param pane an instance of {@code CellRendererPane}
+     * @param list an instance of {@code JList}
+     */
     public MetalComboBoxButton( JComboBox cb, Icon i,
                                 CellRendererPane pane, JList list ) {
         this();
@@ -85,6 +146,15 @@ public class MetalComboBoxButton extends JButton {
         setEnabled( comboBox.isEnabled() );
     }
 
+    /**
+     * Constructs a new instance of {@code MetalComboBoxButton}.
+     *
+     * @param cb an instance of {@code JComboBox}
+     * @param i an icon
+     * @param onlyIcon if {@code true} only icon is painted
+     * @param pane an instance of {@code CellRendererPane}
+     * @param list an instance of {@code JList}
+     */
     public MetalComboBoxButton( JComboBox cb, Icon i, boolean onlyIcon,
                                 CellRendererPane pane, JList list ) {
         this( cb, i, pane, list );
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java
index 4c95250013b..e9f4aeb4c9d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java
@@ -50,6 +50,9 @@ import javax.swing.plaf.basic.BasicComboBoxEditor;
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalComboBoxEditor extends BasicComboBoxEditor {
 
+    /**
+     * Constructs a new instance of {@code MetalComboBoxEditor}.
+     */
     public MetalComboBoxEditor() {
         super();
         //editor.removeFocusListener(this);
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
index eb9afb93439..c95e6b5c6ce 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
@@ -54,6 +54,12 @@ import java.beans.*;
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalComboBoxUI extends BasicComboBoxUI {
 
+    /**
+     * Constructs an instance of {@code MetalComboBoxUI}.
+     *
+     * @param c a component
+     * @return an instance of {@code MetalComboBoxUI}
+     */
     public static ComponentUI createUI(JComponent c) {
         return new MetalComboBoxUI();
     }
@@ -234,6 +240,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
      * override. All the functionality of this method is in the
      * MetalPropertyChangeListener.
      *
+     * @param e an instance of {@code PropertyChangeEvent}
      * @deprecated As of Java 2 platform v1.4.
      */
     @Deprecated
@@ -251,11 +258,23 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
         public void layoutContainer( Container parent ) {
             layoutComboBox( parent, this );
         }
+
+        /**
+         * Lays out the parent container.
+         *
+         * @param parent a container
+         */
         public void superLayout( Container parent ) {
             super.layoutContainer( parent );
         }
     }
 
+    /**
+     * Lays out the {@code JComboBox} in the {@code parent} container.
+     *
+     * @param parent a container
+     * @param manager an instance of {@code MetalComboBoxLayoutManager}
+     */
     // This is here because of a bug in the compiler.
     // When a protected-inner-class-savvy compiler comes out we
     // should move this into MetalComboBoxLayoutManager.
@@ -367,6 +386,11 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
     @Deprecated
     public class MetalComboPopup extends BasicComboPopup {
 
+        /**
+         * Constructs a new instance of {@code MetalComboPopup}.
+         *
+         * @param cBox an instance of {@code JComboBox}
+         */
         public MetalComboPopup( JComboBox cBox) {
             super( cBox );
         }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalDesktopIconUI.java
index 074a3b5eb79..ec3921b5671 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalDesktopIconUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalDesktopIconUI.java
@@ -48,10 +48,19 @@ public class MetalDesktopIconUI extends BasicDesktopIconUI
     TitleListener titleListener;
     private int width;
 
+    /**
+     * Constructs a new instance of {@code MetalDesktopIconUI}.
+     *
+     * @param c a component
+     * @return a new instance of {@code MetalDesktopIconUI}
+     */
     public static ComponentUI createUI(JComponent c)    {
         return new MetalDesktopIconUI();
     }
 
+    /**
+     * Constructs a new instance of {@code MetalDesktopIconUI}.
+     */
     public MetalDesktopIconUI() {
     }
 
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
index dc15fe68498..06fb070113b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
@@ -138,13 +138,21 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         }
     }
 
-    //
-    // ComponentUI Interface Implementation methods
-    //
+    /**
+     * Constructs a new instance of {@code MetalFileChooserUI}.
+     *
+     * @param c a component
+     * @return a new instance of {@code MetalFileChooserUI}
+     */
     public static ComponentUI createUI(JComponent c) {
         return new MetalFileChooserUI((JFileChooser) c);
     }
 
+    /**
+     * Constructs a new instance of {@code MetalFileChooserUI}.
+     *
+     * @param filechooser a {@code JFileChooser}
+     */
     public MetalFileChooserUI(JFileChooser filechooser) {
         super(filechooser);
     }
@@ -446,6 +454,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel });
     }
 
+    /**
+     * Returns the button panel.
+     *
+     * @return the button panel
+     */
     protected JPanel getButtonPanel() {
         if (buttonPanel == null) {
             buttonPanel = new JPanel();
@@ -453,6 +466,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         return buttonPanel;
     }
 
+    /**
+     * Returns the bottom panel.
+     *
+     * @return the bottom panel
+     */
     protected JPanel getBottomPanel() {
         if(bottomPanel == null) {
             bottomPanel = new JPanel();
@@ -503,20 +521,42 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         SwingUtilities.replaceUIActionMap(fc, actionMap);
     }
 
+    /**
+     * Returns an instance of {@code ActionMap}.
+     *
+     * @return an instance of {@code ActionMap}
+     */
     protected ActionMap getActionMap() {
         return createActionMap();
     }
 
+    /**
+     * Constructs an instance of {@code ActionMap}.
+     *
+     * @return an instance of {@code ActionMap}
+     */
     protected ActionMap createActionMap() {
         ActionMap map = new ActionMapUIResource();
         FilePane.addActionsToMap(map, filePane.getActions());
         return map;
     }
 
+    /**
+     * Constructs a details view.
+     *
+     * @param fc a {@code JFileChooser}
+     * @return the list
+     */
     protected JPanel createList(JFileChooser fc) {
         return filePane.createList();
     }
 
+    /**
+     * Constructs a details view.
+     *
+     * @param fc a {@code JFileChooser}
+     * @return the details view
+     */
     protected JPanel createDetailsView(JFileChooser fc) {
         return filePane.createDetailsView();
     }
@@ -533,7 +573,12 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
 
     // Obsolete class, not used in this version.
     protected class SingleClickListener extends MouseAdapter {
-        public  SingleClickListener(JList list) {
+        /**
+         * Constructs an instance of {@code SingleClickListener}.
+         *
+         * @param list an instance of {@code JList}
+         */
+        public SingleClickListener(JList list) {
         }
     }
 
@@ -788,11 +833,16 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         };
     }
 
-
+    /**
+     * Removes control buttons from bottom panel.
+     */
     protected void removeControlButtons() {
         getBottomPanel().remove(getButtonPanel());
     }
 
+    /**
+     * Adds control buttons to bottom panel.
+     */
     protected void addControlButtons() {
         getBottomPanel().add(getButtonPanel());
     }
@@ -842,15 +892,31 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         }
     }
 
+    /**
+     * Returns the directory name.
+     *
+     * @return the directory name
+     */
     public String getDirectoryName() {
         // PENDING(jeff) - get the name from the directory combobox
         return null;
     }
 
+    /**
+     * Sets the directory name.
+     *
+     * @param dirname the directory name
+     */
     public void setDirectoryName(String dirname) {
         // PENDING(jeff) - set the name in the directory combobox
     }
 
+    /**
+     * Constructs a new instance of {@code DirectoryComboBoxRenderer}.
+     *
+     * @param fc a {@code JFileChooser}
+     * @return a new instance of {@code DirectoryComboBoxRenderer}
+     */
     protected DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(JFileChooser fc) {
         return new DirectoryComboBoxRenderer();
     }
@@ -906,9 +972,12 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
 
     }
 
-    //
-    // DataModel for DirectoryComboxbox
-    //
+    /**
+     * Constructs a new instance of {@code DataModel} for {@code DirectoryComboBox}.
+     *
+     * @param fc a {@code JFileChooser}
+     * @return a new instance of {@code DataModel} for {@code DirectoryComboBox}
+     */
     protected DirectoryComboBoxModel createDirectoryComboBoxModel(JFileChooser fc) {
         return new DirectoryComboBoxModel();
     }
@@ -924,6 +993,9 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         JFileChooser chooser = getFileChooser();
         FileSystemView fsv = chooser.getFileSystemView();
 
+        /**
+         * Constructs an instance of {@code DirectoryComboBoxModel}.
+         */
         public DirectoryComboBoxModel() {
             // Add the current directory to the model, and make it the
             // selectedDirectory
@@ -1017,6 +1089,12 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
             }
         }
 
+        /**
+         * Returns the depth of {@code i}-th file.
+         *
+         * @param i an index
+         * @return the depth of {@code i}-th file
+         */
         public int getDepth(int i) {
             return (depths != null && i >= 0 && i < depths.length) ? depths[i] : 0;
         }
@@ -1039,9 +1117,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         }
     }
 
-    //
-    // Renderer for Types ComboBox
-    //
+    /**
+     * Constructs a {@code Renderer} for types {@code ComboBox}.
+     *
+     * @return a {@code Renderer} for types {@code ComboBox}
+     */
     protected FilterComboBoxRenderer createFilterComboBoxRenderer() {
         return new FilterComboBoxRenderer();
     }
@@ -1065,9 +1145,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         }
     }
 
-    //
-    // DataModel for Types Comboxbox
-    //
+    /**
+     * Constructs a {@code DataModel} for types {@code ComboBox}.
+     *
+     * @return a {@code DataModel} for types {@code ComboBox}
+     */
     protected FilterComboBoxModel createFilterComboBoxModel() {
         return new FilterComboBoxModel();
     }
@@ -1077,7 +1159,15 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
      */
     @SuppressWarnings("serial") // Same-version serialization only
     protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
+
+        /**
+         * An array of file filters.
+         */
         protected FileFilter[] filters;
+
+        /**
+         * Constructs an instance of {@code FilterComboBoxModel}.
+         */
         protected FilterComboBoxModel() {
             super();
             filters = getFileChooser().getChoosableFileFilters();
@@ -1142,6 +1232,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
         }
     }
 
+    /**
+     * Invokes when {@code ListSelectionEvent} occurs.
+     *
+     * @param e an instance of {@code ListSelectionEvent}
+     */
     public void valueChanged(ListSelectionEvent e) {
         JFileChooser fc = getFileChooser();
         File f = fc.getSelectedFile();
@@ -1155,6 +1250,10 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class DirectoryComboBoxAction extends AbstractAction {
+
+        /**
+         * Constructs a new instance of {@code DirectoryComboBoxAction}.
+         */
         protected DirectoryComboBoxAction() {
             super("DirectoryComboBoxAction");
         }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java
index 4e0b3535208..8cd0bd04ace 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java
@@ -90,10 +90,22 @@ public class MetalIconFactory implements Serializable {
     private static Icon oceanVerticalSliderThumb;
 
     // Constants
+    /**
+     * {@code DARK} is used for the property {@code Tree.expandedIcon}.
+     */
     public static final boolean DARK = false;
+
+    /**
+     * {@code LIGHT} is used for the property {@code Tree.collapsedIcon}.
+     */
     public static final boolean LIGHT = true;
 
     // Accessor functions for Icons. Does the caching work.
+    /**
+     * Returns the instance of {@code FileChooserDetailViewIcon}.
+     *
+     * @return the instance of {@code FileChooserDetailViewIcon}
+     */
     public static Icon getFileChooserDetailViewIcon() {
         if (fileChooserDetailViewIcon == null) {
             fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
@@ -101,6 +113,11 @@ public class MetalIconFactory implements Serializable {
         return fileChooserDetailViewIcon;
     }
 
+    /**
+     * Returns the instance of {@code FileChooserHomeFolderIcon}.
+     *
+     * @return the instance of {@code FileChooserHomeFolderIcon}
+     */
     public static Icon getFileChooserHomeFolderIcon() {
         if (fileChooserHomeFolderIcon == null) {
             fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
@@ -108,6 +125,11 @@ public class MetalIconFactory implements Serializable {
         return fileChooserHomeFolderIcon;
     }
 
+    /**
+     * Returns the instance of {@code FileChooserListViewIcon}.
+     *
+     * @return the instance of {@code FileChooserListViewIcon}
+     */
     public static Icon getFileChooserListViewIcon() {
         if (fileChooserListViewIcon == null) {
             fileChooserListViewIcon = new FileChooserListViewIcon();
@@ -115,6 +137,11 @@ public class MetalIconFactory implements Serializable {
         return fileChooserListViewIcon;
     }
 
+    /**
+     * Returns the instance of {@code FileChooserNewFolderIcon}.
+     *
+     * @return the instance of {@code FileChooserNewFolderIcon}
+     */
     public static Icon getFileChooserNewFolderIcon() {
         if (fileChooserNewFolderIcon == null) {
             fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
@@ -122,6 +149,11 @@ public class MetalIconFactory implements Serializable {
         return fileChooserNewFolderIcon;
     }
 
+    /**
+     * Returns the instance of {@code FileChooserUpFolderIcon}.
+     *
+     * @return the instance of {@code FileChooserUpFolderIcon}
+     */
     public static Icon getFileChooserUpFolderIcon() {
         if (fileChooserUpFolderIcon == null) {
             fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
@@ -129,14 +161,31 @@ public class MetalIconFactory implements Serializable {
         return fileChooserUpFolderIcon;
     }
 
+    /**
+     * Constructs a new instance of {@code InternalFrameAltMaximizeIcon}.
+     *
+     * @param size the size of the icon
+     * @return a new instance of {@code InternalFrameAltMaximizeIcon}
+     */
     public static Icon getInternalFrameAltMaximizeIcon(int size) {
         return new InternalFrameAltMaximizeIcon(size);
     }
 
+    /**
+     * Constructs a new instance of {@code InternalFrameCloseIcon}.
+     *
+     * @param size the size of the icon
+     * @return a new instance of {@code InternalFrameCloseIcon}
+     */
     public static Icon getInternalFrameCloseIcon(int size) {
         return new InternalFrameCloseIcon(size);
     }
 
+    /**
+     * Returns the instance of {@code InternalFrameDefaultMenuIcon}.
+     *
+     * @return the instance of {@code InternalFrameDefaultMenuIcon}
+     */
     public static Icon getInternalFrameDefaultMenuIcon() {
         if (internalFrameDefaultMenuIcon == null) {
             internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
@@ -144,14 +193,31 @@ public class MetalIconFactory implements Serializable {
         return internalFrameDefaultMenuIcon;
     }
 
+    /**
+     * Constructs a new instance of {@code InternalFrameMaximizeIcon}.
+     *
+     * @param size the size of the icon
+     * @return a new instance of {@code InternalFrameMaximizeIcon}
+     */
     public static Icon getInternalFrameMaximizeIcon(int size) {
         return new InternalFrameMaximizeIcon(size);
     }
 
+    /**
+     * Constructs a new instance of {@code InternalFrameMinimizeIcon}.
+     *
+     * @param size the size of the icon
+     * @return a new instance of {@code InternalFrameMinimizeIcon}
+     */
     public static Icon getInternalFrameMinimizeIcon(int size) {
         return new InternalFrameMinimizeIcon(size);
     }
 
+    /**
+     * Returns the instance of {@code RadioButtonIcon}.
+     *
+     * @return the instance of {@code RadioButtonIcon}
+     */
     public static Icon getRadioButtonIcon() {
         if (radioButtonIcon == null) {
             radioButtonIcon = new RadioButtonIcon();
@@ -161,6 +227,8 @@ public class MetalIconFactory implements Serializable {
 
     /**
      * Returns a checkbox icon.
+     *
+     * @return a checkbox icon
      * @since 1.3
      */
     public static Icon getCheckBoxIcon() {
@@ -170,6 +238,11 @@ public class MetalIconFactory implements Serializable {
         return checkBoxIcon;
     }
 
+    /**
+     * Returns the instance of {@code TreeComputerIcon}.
+     *
+     * @return the instance of {@code TreeComputerIcon}
+     */
     public static Icon getTreeComputerIcon() {
         if ( treeComputerIcon == null ) {
             treeComputerIcon = new TreeComputerIcon();
@@ -177,6 +250,11 @@ public class MetalIconFactory implements Serializable {
         return treeComputerIcon;
     }
 
+    /**
+     * Returns the instance of {@code TreeFloppyDriveIcon}.
+     *
+     * @return the instance of {@code TreeFloppyDriveIcon}
+     */
     public static Icon getTreeFloppyDriveIcon() {
         if ( treeFloppyDriveIcon == null ) {
             treeFloppyDriveIcon = new TreeFloppyDriveIcon();
@@ -184,10 +262,20 @@ public class MetalIconFactory implements Serializable {
         return treeFloppyDriveIcon;
     }
 
+    /**
+     * Constructs a new instance of {@code TreeFolderIcon}.
+     *
+     * @return a new instance of {@code TreeFolderIcon}
+     */
     public static Icon getTreeFolderIcon() {
         return new TreeFolderIcon();
     }
 
+    /**
+     * Returns the instance of {@code TreeHardDriveIcon}.
+     *
+     * @return the instance of {@code TreeHardDriveIcon}
+     */
     public static Icon getTreeHardDriveIcon() {
         if ( treeHardDriveIcon == null ) {
             treeHardDriveIcon = new TreeHardDriveIcon();
@@ -195,14 +283,30 @@ public class MetalIconFactory implements Serializable {
         return treeHardDriveIcon;
     }
 
+    /**
+     * Constructs a new instance of {@code TreeLeafIcon}.
+     *
+     * @return a new instance of {@code TreeLeafIcon}
+     */
     public static Icon getTreeLeafIcon() {
         return new TreeLeafIcon();
     }
 
+    /**
+     * Constructs a new instance of {@code TreeControlIcon}.
+     *
+     * @param isCollapsed if {@code true} the icon is collapsed
+     * @return a new instance of {@code TreeControlIcon}
+     */
     public static Icon getTreeControlIcon( boolean isCollapsed ) {
             return new TreeControlIcon( isCollapsed );
     }
 
+    /**
+     * Returns an icon to be used by {@code JMenu}.
+     *
+     * @return an icon to be used by {@code JMenu}
+     */
     public static Icon getMenuArrowIcon() {
         if (menuArrowIcon == null) {
             menuArrowIcon = new MenuArrowIcon();
@@ -220,6 +324,11 @@ public class MetalIconFactory implements Serializable {
         return null;
     }
 
+    /**
+     * Returns an icon to be used by {@code JMenuItem}.
+     *
+     * @return an icon to be used by {@code JMenuItem}
+     */
     public static Icon getMenuItemArrowIcon() {
         if (menuItemArrowIcon == null) {
             menuItemArrowIcon = new MenuItemArrowIcon();
@@ -227,6 +336,11 @@ public class MetalIconFactory implements Serializable {
         return menuItemArrowIcon;
     }
 
+    /**
+     * Returns an icon to be used by {@code JCheckBoxMenuItem}.
+     *
+     * @return an icon to be used by {@code JCheckBoxMenuItem}
+     */
     public static Icon getCheckBoxMenuItemIcon() {
         if (checkBoxMenuItemIcon == null) {
             checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
@@ -234,6 +348,11 @@ public class MetalIconFactory implements Serializable {
         return checkBoxMenuItemIcon;
     }
 
+    /**
+     * Returns an icon to be used by {@code JRadioButtonMenuItem}.
+     *
+     * @return an icon to be used by {@code JRadioButtonMenuItem}
+     */
     public static Icon getRadioButtonMenuItemIcon() {
         if (radioButtonMenuItemIcon == null) {
             radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
@@ -241,6 +360,11 @@ public class MetalIconFactory implements Serializable {
         return radioButtonMenuItemIcon;
     }
 
+    /**
+     * Returns a thumb icon to be used by horizontal slider.
+     *
+     * @return a thumb icon to be used by horizontal slider
+     */
     public static Icon getHorizontalSliderThumbIcon() {
         if (MetalLookAndFeel.usingOcean()) {
             if (oceanHorizontalSliderThumb == null) {
@@ -253,6 +377,11 @@ public class MetalIconFactory implements Serializable {
         return new HorizontalSliderThumbIcon();
     }
 
+    /**
+     * Returns a thumb icon to be used by vertical slider.
+     *
+     * @return a thumb icon to be used by vertical slider
+     */
     public static Icon getVerticalSliderThumbIcon() {
         if (MetalLookAndFeel.usingOcean()) {
             if (oceanVerticalSliderThumb == null) {
@@ -1621,7 +1750,18 @@ public class MetalIconFactory implements Serializable {
 
         }
 
+        /**
+         * Returns a shift of the icon.
+         *
+         * @return a shift of the icon
+         */
         public int getShift() { return 0; }
+
+        /**
+         * Returns an additional height of the icon.
+         *
+         * @return an additional height of the icon
+         */
         public int getAdditionalHeight() { return 0; }
 
         public int getIconWidth() { return folderIcon16Size.width; }
@@ -1719,7 +1859,18 @@ public class MetalIconFactory implements Serializable {
 
         }
 
+        /**
+         * Returns a shift of the icon.
+         *
+         * @return a shift of the icon
+         */
         public int getShift() { return 0; }
+
+        /**
+         * Returns an additional height of the icon.
+         *
+         * @return an additional height of the icon
+         */
         public int getAdditionalHeight() { return 0; }
 
         public int getIconWidth() { return fileIcon16Size.width; }
@@ -1727,6 +1878,9 @@ public class MetalIconFactory implements Serializable {
     }
 
 
+    /**
+     * The class represents a tree leaf icon.
+     */
     public static class TreeLeafIcon extends FileIcon16 {
         public int getShift() { return 2; }
         public int getAdditionalHeight() { return 4; }
@@ -1748,12 +1902,20 @@ public class MetalIconFactory implements Serializable {
      */
     @SuppressWarnings("serial") // Same-version serialization only
     public static class TreeControlIcon implements Icon, Serializable {
-        // This data member should not have been exposed.  It's called
-        // isLight, but now it really means isCollapsed.  Since we can't change
-        // any APIs... that's life.
-        protected boolean isLight;
 
+        /**
+         * if {@code true} the icon is collapsed.
+         * NOTE: This data member should not have been exposed. It's called
+         * {@code isLight}, but now it really means {@code isCollapsed}.
+         * Since we can't change any APIs... that's life.
+         */
+        protected boolean isLight;
 
+        /**
+         * Constructs an instance of {@code TreeControlIcon}.
+         *
+         * @param isCollapsed if {@code true} the icon is collapsed
+         */
         public TreeControlIcon( boolean isCollapsed ) {
             isLight = isCollapsed;
         }
@@ -1811,6 +1973,14 @@ public class MetalIconFactory implements Serializable {
             }
         }
 
+        /**
+         * Paints the {@code TreeControlIcon}.
+         *
+         * @param c a component
+         * @param g an instance of {@code Graphics}
+         * @param x an X coordinate
+         * @param y an Y coordinate
+         */
         public void paintMe(Component c, Graphics g, int x, int y) {
 
             g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
@@ -1823,7 +1993,7 @@ public class MetalIconFactory implements Serializable {
             g.drawLine( xoff + 6, 4, xoff + 9, 4 );     // top
             g.drawLine( xoff + 10, 5, xoff + 10, 5 );   // top right dot
             g.drawLine( xoff + 11, 6, xoff + 11, 9 );   // right
-            g.drawLine( xoff + 10, 10, xoff + 10, 10 ); // botom right dot
+            g.drawLine( xoff + 10, 10, xoff + 10, 10 ); // bottom right dot
             g.drawLine( xoff + 6, 11, xoff + 9, 11 );   // bottom
             g.drawLine( xoff + 5, 10, xoff + 5, 10 );   // bottom left dot
 
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
index bcf1abbcedc..b517b4ad3c8 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
@@ -46,8 +46,19 @@ import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
 @SuppressWarnings("serial") // Superclass is not serializable across versions
 public class MetalInternalFrameTitlePane  extends BasicInternalFrameTitlePane {
 
+    /**
+     * The value {@code isPalette}
+     */
     protected boolean isPalette = false;
+
+    /**
+     * The palette close icon.
+     */
     protected Icon paletteCloseIcon;
+
+    /**
+     * The height of the palette title.
+     */
     protected int paletteTitleHeight;
 
     private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0);
@@ -94,6 +105,11 @@ public class MetalInternalFrameTitlePane  extends BasicInternalFrameTitlePane {
     private Color activeBumpsShadow = MetalLookAndFeel.
                              getPrimaryControlDarkShadow();
 
+    /**
+     * Constructs a new instance of {@code MetalInternalFrameTitlePane}
+     *
+     * @param f an instance of {@code JInternalFrame}
+     */
     public MetalInternalFrameTitlePane(JInternalFrame f) {
         super( f );
     }
@@ -307,6 +323,11 @@ public class MetalInternalFrameTitlePane  extends BasicInternalFrameTitlePane {
         }
     }
 
+    /**
+     * Paints palette.
+     *
+     * @param g a instance of {@code Graphics}
+     */
     public void paintPalette(Graphics g)  {
         boolean leftToRight = MetalUtils.isLeftToRight(frame);
 
@@ -471,6 +492,11 @@ public class MetalInternalFrameTitlePane  extends BasicInternalFrameTitlePane {
         bumps.paintIcon(this, g, bumpXOffset, bumpYOffset);
     }
 
+    /**
+     * If {@code b} is {@code true}, sets palette icons.
+     *
+     * @param b if {@code true}, sets palette icons
+     */
     public void setPalette(boolean b) {
         isPalette = b;
 
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java
index c8b75e88ac8..94daa93f3b0 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java
@@ -47,6 +47,9 @@ public class MetalInternalFrameUI extends BasicInternalFrameUI {
 
   private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0);
 
+  /**
+   * The property {@code JInternalFrame.isPalette}.
+   */
   protected static String IS_PALETTE   = "JInternalFrame.isPalette";
   private static String IS_PALETTE_KEY = "JInternalFrame.isPalette";
   private static String FRAME_TYPE     = "JInternalFrame.frameType";
@@ -54,10 +57,22 @@ public class MetalInternalFrameUI extends BasicInternalFrameUI {
   private static String PALETTE_FRAME  = "palette";
   private static String OPTION_DIALOG  = "optionDialog";
 
+
+  /**
+   * Constructs a new {@code MetalInternalFrameUI} instance.
+   *
+   * @param b an internal frame
+   */
   public MetalInternalFrameUI(JInternalFrame b)   {
     super(b);
   }
 
+  /**
+   * Constructs a new {@code MetalInternalFrameUI} instance.
+   *
+   * @param c a component
+   * @return a new {@code MetalInternalFrameUI} instance
+   */
   public static ComponentUI createUI(JComponent c)    {
       return new MetalInternalFrameUI( (JInternalFrame) c);
   }
@@ -152,6 +167,11 @@ public class MetalInternalFrameUI extends BasicInternalFrameUI {
       }
   }
 
+  /**
+   * If {@code isPalette} is {@code true}, sets palette border and title
+   *
+   * @param isPalette if {@code true}, sets palette border and title
+   */
   // this should be deprecated - jcs
   public void setPalette(boolean isPalette) {
     if (isPalette) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java
index 6d62d1d640e..977b0789df6 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java
@@ -56,6 +56,12 @@ public class MetalLabelUI extends BasicLabelUI
 
     private static final Object METAL_LABEL_UI_KEY = new Object();
 
+    /**
+     * Returns an instance of {@code MetalLabelUI}.
+     *
+     * @param c a component
+     * @return an instance of {@code MetalLabelUI}
+     */
     public static ComponentUI createUI(JComponent c) {
         if (System.getSecurityManager() != null) {
             AppContext appContext = AppContext.getAppContext();
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
index c32d2679f9c..7a22550febc 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
@@ -43,6 +43,12 @@ import javax.swing.plaf.*;
 
 public class MetalPopupMenuSeparatorUI extends MetalSeparatorUI
 {
+    /**
+     * Constructs a new {@code MetalPopupMenuSeparatorUI} instance.
+     *
+     * @param c a component
+     * @return a new {@code MetalPopupMenuSeparatorUI} instance
+     */
     public static ComponentUI createUI( JComponent c )
     {
         return new MetalPopupMenuSeparatorUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalProgressBarUI.java
index aedede36688..42b0b3719a2 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalProgressBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalProgressBarUI.java
@@ -50,6 +50,12 @@ public class MetalProgressBarUI extends BasicProgressBarUI {
     private Rectangle innards;
     private Rectangle box;
 
+    /**
+     * Constructs an instance of {@code MetalProgressBarUI}.
+     *
+     * @param c a component
+     * @return an instance of {@code MetalProgressBarUI}
+     */
     public static ComponentUI createUI(JComponent c) {
         return new MetalProgressBarUI();
     }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java
index 9b7beeacf98..660bfa84c8b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java
@@ -58,8 +58,19 @@ public class MetalRadioButtonUI extends BasicRadioButtonUI {
 
     private static final Object METAL_RADIO_BUTTON_UI_KEY = new Object();
 
+    /**
+     * The color of the focused radio button.
+     */
     protected Color focusColor;
+
+    /**
+     * The color of the selected radio button.
+     */
     protected Color selectColor;
+
+    /**
+     * The color of a disabled text.
+     */
     protected Color disabledTextColor;
 
     private boolean defaults_initialized = false;
@@ -67,6 +78,13 @@ public class MetalRadioButtonUI extends BasicRadioButtonUI {
     // ********************************
     //        Create PlAF
     // ********************************
+
+    /**
+     * Returns an instance of {@code MetalRadioButtonUI}.
+     *
+     * @param c a component
+     * @return an instance of {@code MetalRadioButtonUI}
+     */
     public static ComponentUI createUI(JComponent c) {
         AppContext appContext = AppContext.getAppContext();
         MetalRadioButtonUI metalRadioButtonUI =
@@ -100,14 +118,30 @@ public class MetalRadioButtonUI extends BasicRadioButtonUI {
     // ********************************
     //         Default Accessors
     // ********************************
+
+    /**
+     * Returns the color of the selected {@code JRadioButton}.
+     *
+     * @return the color of the selected {@code JRadioButton}
+     */
     protected Color getSelectColor() {
         return selectColor;
     }
 
+    /**
+     * Returns the color of the disabled text.
+     *
+     * @return the color of the disabled text
+     */
     protected Color getDisabledTextColor() {
         return disabledTextColor;
     }
 
+    /**
+     * Returns the color of the focused {@code JRadioButton}.
+     *
+     * @return the color of the focused {@code JRadioButton}
+     */
     protected Color getFocusColor() {
         return focusColor;
     }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java
index 6d410d88b71..cb4fbd72590 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java
@@ -59,17 +59,42 @@ public class MetalScrollBarUI extends BasicScrollBarUI
     private static Color thumbShadow;
     private static Color thumbHighlightColor;
 
-
+    /**
+     * The metal bumps.
+     */
     protected MetalBumps bumps;
 
+    /**
+     * The increase button.
+     */
     protected MetalScrollButton increaseButton;
+
+    /**
+     * The decrease button.
+     */
     protected MetalScrollButton decreaseButton;
 
+    /**
+     * The width of the scroll bar.
+     */
     protected  int scrollBarWidth;
 
+    /**
+     * The property {@code JScrollBar.isFreeStanding}.
+     */
     public static final String FREE_STANDING_PROP = "JScrollBar.isFreeStanding";
+
+    /**
+     * The value of the property {@code JScrollBar.isFreeStanding}.
+     */
     protected boolean isFreeStanding = true;
 
+    /**
+     * Constructs a new {@code MetalScrollBarUI} instance.
+     *
+     * @param c a component
+     * @return a new {@code MetalScrollBarUI} instance
+     */
     public static ComponentUI createUI( JComponent c )
     {
         return new MetalScrollBarUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollButton.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollButton.java
index edd40950ec4..31a874326b1 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollButton.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollButton.java
@@ -59,6 +59,13 @@ public class MetalScrollButton extends BasicArrowButton
 
   private int buttonWidth;
 
+        /**
+         * Constructs an instance of {@code MetalScrollButton}.
+         *
+         * @param direction the direction
+         * @param width the width
+         * @param freeStanding the free standing value
+         */
         public MetalScrollButton( int direction, int width, boolean freeStanding )
         {
             super( direction );
@@ -70,6 +77,11 @@ public class MetalScrollButton extends BasicArrowButton
             isFreeStanding = freeStanding;
         }
 
+        /**
+         * Sets the free standing value.
+         *
+         * @param freeStanding the free standing value
+         */
         public void setFreeStanding( boolean freeStanding )
         {
             isFreeStanding = freeStanding;
@@ -115,14 +127,10 @@ public class MetalScrollButton extends BasicArrowButton
                 g.setColor( arrowColor );
                 int startY = ((h+1) - arrowHeight) / 2;
                 int startX = (w / 2);
-                //                  System.out.println( "startX :" + startX + " startY :"+startY);
+
                 for (int line = 0; line < arrowHeight; line++) {
                     g.drawLine( startX-line, startY+line, startX +line+1, startY+line);
                 }
-        /*      g.drawLine( 7, 6, 8, 6 );
-                g.drawLine( 6, 7, 9, 7 );
-                g.drawLine( 5, 8, 10, 8 );
-                g.drawLine( 4, 9, 11, 9 );*/
 
                 if (isEnabled) {
                     g.setColor( highlightColor );
@@ -167,17 +175,10 @@ public class MetalScrollButton extends BasicArrowButton
                 int startY = (((h+1) - arrowHeight) / 2)+ arrowHeight-1;
                 int startX = (w / 2);
 
-                //          System.out.println( "startX2 :" + startX + " startY2 :"+startY);
-
                 for (int line = 0; line < arrowHeight; line++) {
                     g.drawLine( startX-line, startY-line, startX +line+1, startY-line);
                 }
 
-        /*      g.drawLine( 4, 5, 11, 5 );
-                g.drawLine( 5, 6, 10, 6 );
-                g.drawLine( 6, 7, 9, 7 );
-                g.drawLine( 7, 8, 8, 8 ); */
-
                 if (isEnabled) {
                     g.setColor( highlightColor );
 
@@ -219,18 +220,10 @@ public class MetalScrollButton extends BasicArrowButton
                 int startX = (((w+1) - arrowHeight) / 2) + arrowHeight-1;
                 int startY = (h / 2);
 
-                //System.out.println( "startX2 :" + startX + " startY2 :"+startY);
-
                 for (int line = 0; line < arrowHeight; line++) {
                     g.drawLine( startX-line, startY-line, startX -line, startY+line+1);
                 }
 
-
-/*              g.drawLine( 5, 4, 5, 11 );
-                g.drawLine( 6, 5, 6, 10 );
-                g.drawLine( 7, 6, 7, 9 );
-                g.drawLine( 8, 7, 8, 8 );*/
-
                 if (isEnabled) {
                     g.setColor( highlightColor );
 
@@ -274,11 +267,6 @@ public class MetalScrollButton extends BasicArrowButton
                     g.drawLine( startX+line, startY-line, startX +line, startY+line+1);
                 }
 
-        /*      g.drawLine( 6, 7, 6, 8 );
-                g.drawLine( 7, 6, 7, 9 );
-                g.drawLine( 8, 5, 8, 10 );
-                g.drawLine( 9, 4, 9, 11 );*/
-
                 if (isEnabled) {
                     g.setColor( highlightColor );
 
@@ -341,6 +329,11 @@ public class MetalScrollButton extends BasicArrowButton
             return new Dimension( Integer.MAX_VALUE, Integer.MAX_VALUE );
         }
 
+        /**
+         * Returns the width of the button.
+         *
+         * @return the width of the button
+         */
         public int getButtonWidth() {
             return buttonWidth;
         }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java
index ffc5fc4df1c..c65eb52a657 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java
@@ -56,6 +56,12 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI
 
     private PropertyChangeListener scrollBarSwapListener;
 
+    /**
+     * Constructs a new {@code MetalScrollPaneUI}.
+     *
+     * @param x a component
+     * @return a new {@code MetalScrollPaneUI}
+     */
     public static ComponentUI createUI(JComponent x) {
         return new MetalScrollPaneUI();
     }
@@ -97,6 +103,7 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI
     }
 
     /**
+     * @param scrollPane an instance of the {@code JScrollPane}
      * @deprecated - Replaced by {@link #uninstallListeners(JComponent)}
      */
     @Deprecated
@@ -136,6 +143,11 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI
         }
     }
 
+    /**
+     * Returns a new {@code PropertyChangeListener} for scroll bar swap events.
+     *
+     * @return a new {@code PropertyChangeListener} for scroll bar swap events.
+     */
     protected PropertyChangeListener createScrollBarSwapListener() {
         return new PropertyChangeListener() {
             public void propertyChange(PropertyChangeEvent e) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java
index 9de133b902d..58b6e69e6fb 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java
@@ -53,6 +53,12 @@ import javax.swing.plaf.basic.BasicSeparatorUI;
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalSeparatorUI extends BasicSeparatorUI
 {
+    /**
+     * Constructs a new {@code MetalSeparatorUI} instance.
+     *
+     * @param c a component
+     * @return a new {@code MetalSeparatorUI} instance.
+     */
     public static ComponentUI createUI( JComponent c )
     {
         return new MetalSeparatorUI();
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java
index 6e629938a65..bc21c7a5094 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java
@@ -53,13 +53,42 @@ import javax.swing.plaf.*;
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalSliderUI extends BasicSliderUI {
 
+    /**
+     * The buffer of a tick.
+     */
     protected final int TICK_BUFFER = 4;
+
+    /**
+     * The value of the property {@code JSlider.isFilled}.
+     * By default, {@code false} if the property is not set,
+     * {@code true} for Ocean theme.
+     */
     protected boolean filledSlider = false;
+
     // NOTE: these next five variables are currently unused.
+    /**
+     * The color of a thumb
+     */
     protected static Color thumbColor;
+
+    /**
+     * The color of highlighting.
+     */
     protected static Color highlightColor;
+
+    /**
+     * The color of dark shadow.
+     */
     protected static Color darkShadowColor;
+
+    /**
+     * The width of a track.
+     */
     protected static int trackWidth;
+
+    /**
+     * The length of a tick.
+     */
     protected static int tickLength;
     private int safeLength;
 
@@ -80,13 +109,24 @@ public class MetalSliderUI extends BasicSliderUI {
     private static Icon SAFE_HORIZ_THUMB_ICON;
     private static Icon SAFE_VERT_THUMB_ICON;
 
-
+    /**
+     * Property for {@code JSlider.isFilled}.
+     */
     protected final String SLIDER_FILL = "JSlider.isFilled";
 
+    /**
+     * Constructs a {@code MetalSliderUI} instance.
+     *
+     * @param c a component
+     * @return a {@code MetalSliderUI} instance
+     */
     public static ComponentUI createUI(JComponent c)    {
         return new MetalSliderUI();
     }
 
+    /**
+     * Constructs a {@code MetalSliderUI} instance.
+     */
     public MetalSliderUI() {
         super( null );
     }
@@ -126,10 +166,19 @@ public class MetalSliderUI extends BasicSliderUI {
         prepareFilledSliderField();
     }
 
+    /**
+     * Constructs {@code MetalPropertyListener}.
+     *
+     * @param slider a {@code JSlider}
+     * @return the {@code MetalPropertyListener}
+     */
     protected PropertyChangeListener createPropertyChangeListener( JSlider slider ) {
         return new MetalPropertyListener();
     }
 
+    /**
+     * {@code PropertyListener} for {@code JSlider.isFilled}.
+     */
     protected class MetalPropertyListener extends BasicSliderUI.PropertyChangeHandler {
         public void propertyChange( PropertyChangeEvent e ) {  // listen for slider fill
             super.propertyChange( e );
@@ -485,6 +534,8 @@ public class MetalSliderUI extends BasicSliderUI {
 
     /**
      * Returns the shorter dimension of the track.
+     *
+     * @return the shorter dimension of the track
      */
     protected int getTrackWidth() {
         // This strange calculation is here to keep the
@@ -504,6 +555,8 @@ public class MetalSliderUI extends BasicSliderUI {
     /**
      * Returns the longer dimension of the slide bar.  (The slide bar is only the
      * part that runs directly under the thumb)
+     *
+     * @return the longer dimension of the slide bar
      */
     protected int getTrackLength() {
         if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
@@ -514,6 +567,8 @@ public class MetalSliderUI extends BasicSliderUI {
 
     /**
      * Returns the amount that the thumb goes past the slide bar.
+     *
+     * @return the amount that the thumb goes past the slide bar
      */
     protected int getThumbOverhang() {
         return (int)(getThumbSize().getHeight()-getTrackWidth())/2;
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSplitPaneUI.java
index d27ea2e4828..8d183126780 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSplitPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSplitPaneUI.java
@@ -49,15 +49,20 @@ public class MetalSplitPaneUI extends BasicSplitPaneUI
 
 
     /**
-      * Creates a new MetalSplitPaneUI instance
-      */
+     * Creates a new {@code MetalSplitPaneUI} instance
+     *
+     * @param x a component
+     * @return a new {@code MetalSplitPaneUI} instance
+     */
     public static ComponentUI createUI(JComponent x) {
         return new MetalSplitPaneUI();
     }
 
     /**
-      * Creates the default divider.
-      */
+     * Creates the default divider.
+     *
+     * @return the default divider
+     */
     public BasicSplitPaneDivider createDefaultDivider() {
         return new MetalSplitPaneDivider(this);
     }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
index 0a54a878534..76451154127 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
@@ -50,12 +50,27 @@ import javax.swing.plaf.basic.BasicTabbedPaneUI;
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
 
+    /**
+     * The minimum width of a pane.
+     */
     protected int minTabWidth = 40;
     // Background color for unselected tabs that don't have an explicitly
     // set color.
     private Color unselectedBackground;
+
+    /**
+     * The color of tab's background.
+     */
     protected Color tabAreaBackground;
+
+    /**
+     * The color of the selected pane.
+     */
     protected Color selectColor;
+
+    /**
+     * The color of the highlight.
+     */
     protected Color selectHighlight;
     private boolean tabsOpaque = true;
 
@@ -65,6 +80,12 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
     // Selected border color for ocean.
     private Color oceanSelectedBorderColor;
 
+    /**
+     * Constructs {@code MetalTabbedPaneUI}.
+     *
+     * @param x a component
+     * @return an instance of {@code MetalTabbedPaneUI}
+     */
     public static ComponentUI createUI( JComponent x ) {
         return new MetalTabbedPaneUI();
     }
@@ -116,6 +137,19 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
     }
 
 
+    /**
+     * Paints the top tab border.
+     *
+     * @param tabIndex a tab index
+     * @param g an instance of {@code Graphics}
+     * @param x an X coordinate
+     * @param y an Y coordinate
+     * @param w a width
+     * @param h a height
+     * @param btm bottom
+     * @param rght right
+     * @param isSelected a selection
+     */
     protected void paintTopTabBorder( int tabIndex, Graphics g,
                                       int x, int y, int w, int h,
                                       int btm, int rght,
@@ -286,6 +320,15 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
         g.translate( -x, -y );
     }
 
+    /**
+     * Returns {@code true} if the gap should be filled.
+     *
+     * @param currentRun the current run
+     * @param tabIndex the tab index
+     * @param x an X coordinate
+     * @param y an Y coordinate
+     * @return {@code true} if the gap should be filled
+     */
     protected boolean shouldFillGap( int currentRun, int tabIndex, int x, int y ) {
         boolean result = false;
 
@@ -322,6 +365,14 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
         return result;
     }
 
+    /**
+     * Returns the color of the gap.
+     *
+     * @param currentRun the current run
+     * @param x an X coordinate
+     * @param y an Y coordinate
+     * @return the color of the gap
+     */
     protected Color getColorForGap( int currentRun, int x, int y ) {
         final int shadowWidth = 4;
         int selectedIndex = tabPane.getSelectedIndex();
@@ -349,6 +400,19 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
         return tabPane.getBackground();
     }
 
+    /**
+     * Paints the left tab border.
+     *
+     * @param tabIndex a tab index
+     * @param g an instance of {@code Graphics}
+     * @param x an X coordinate
+     * @param y an Y coordinate
+     * @param w a width
+     * @param h a height
+     * @param btm bottom
+     * @param rght right
+     * @param isSelected a selection
+     */
     protected void paintLeftTabBorder( int tabIndex, Graphics g,
                                        int x, int y, int w, int h,
                                        int btm, int rght,
@@ -466,6 +530,19 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
     }
 
 
+    /**
+     * Paints the bottom tab border.
+     *
+     * @param tabIndex a tab index
+     * @param g an instance of {@code Graphics}
+     * @param x an X coordinate
+     * @param y an Y coordinate
+     * @param w a width
+     * @param h a height
+     * @param btm bottom
+     * @param rght right
+     * @param isSelected a selection
+     */
     protected void paintBottomTabBorder( int tabIndex, Graphics g,
                                          int x, int y, int w, int h,
                                          int btm, int rght,
@@ -623,6 +700,19 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
         g.translate( -x, -y );
     }
 
+    /**
+     * Paints the right tab border.
+     *
+     * @param tabIndex a tab index
+     * @param g an instance of {@code Graphics}
+     * @param x an X coordinate
+     * @param y an Y coordinate
+     * @param w a width
+     * @param h a height
+     * @param btm bottom
+     * @param rght right
+     * @param isSelected a selection
+     */
     protected void paintRightTabBorder( int tabIndex, Graphics g,
                                         int x, int y, int w, int h,
                                         int btm, int rght,
@@ -842,6 +932,9 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
         super.paint( g, c );
     }
 
+    /**
+     * Paints highlights below tab.
+     */
     protected void paintHighlightBelowTab( ) {
 
     }
@@ -1158,7 +1251,13 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
         return 0;
     }
 
-    // Don't rotate runs!
+    /**
+     * Returns {@code true} if tab runs should be rotated.
+     *
+     * @param tabPlacement a tab placement
+     * @param selectedRun a selected run
+     * @return {@code true} if tab runs should be rotated.
+     */
     protected boolean shouldRotateTabRuns( int tabPlacement, int selectedRun ) {
         return false;
     }
@@ -1200,6 +1299,9 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
      */
     public class TabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout {
 
+        /**
+         * Constructs {@code TabbedPaneLayout}.
+         */
         public TabbedPaneLayout() {
             MetalTabbedPaneUI.this.super();
         }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTextFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTextFieldUI.java
index 1eca55ed7d2..70db1ee921b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTextFieldUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTextFieldUI.java
@@ -50,6 +50,12 @@ import javax.swing.plaf.basic.*;
 @SuppressWarnings("serial") // Same-version serialization only
 public class MetalTextFieldUI extends BasicTextFieldUI {
 
+    /**
+     * Constructs {@code MetalTextFieldUI}.
+     *
+     * @param c a component
+     * @return the instance of {@code MetalTextFieldUI}
+     */
     public static ComponentUI createUI(JComponent c) {
         return new MetalTextFieldUI();
     }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java
index d0d902eecee..d8375cec460 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java
@@ -60,8 +60,19 @@ public class MetalToggleButtonUI extends BasicToggleButtonUI {
 
     private static final Object METAL_TOGGLE_BUTTON_UI_KEY = new Object();
 
+    /**
+     * The color of a focused toggle button.
+     */
     protected Color focusColor;
+
+    /**
+     * The color of a selected button.
+     */
     protected Color selectColor;
+
+    /**
+     * The color of a disabled text.
+     */
     protected Color disabledTextColor;
 
     private boolean defaults_initialized = false;
@@ -69,6 +80,13 @@ public class MetalToggleButtonUI extends BasicToggleButtonUI {
     // ********************************
     //        Create PLAF
     // ********************************
+
+    /**
+     * Constructs the {@code MetalToogleButtonUI}.
+     *
+     * @param b a component
+     * @return the {@code MetalToogleButtonUI}.
+     */
     public static ComponentUI createUI(JComponent b) {
         AppContext appContext = AppContext.getAppContext();
         MetalToggleButtonUI metalToggleButtonUI =
@@ -101,14 +119,29 @@ public class MetalToggleButtonUI extends BasicToggleButtonUI {
     // ********************************
     //         Default Accessors
     // ********************************
+    /**
+     * Returns the color of a selected button.
+     *
+     * @return the color of a selected button
+     */
     protected Color getSelectColor() {
         return selectColor;
     }
 
+    /**
+     * Returns the color of a disabled text.
+     *
+     * @return the color of a disabled text
+     */
     protected Color getDisabledTextColor() {
         return disabledTextColor;
     }
 
+    /**
+     * Returns the color of a focused toggle button.
+     *
+     * @return the color of a focused toggle button
+     */
     protected Color getFocusColor() {
         return focusColor;
     }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java
index 6fe5250cc18..b9899a3d877 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java
@@ -158,6 +158,12 @@ public class MetalToolBarUI extends BasicToolBarUI
         return false;
     }
 
+    /**
+     * Constructs an instance of {@code MetalToolBarUI}.
+     *
+     * @param c a component
+     * @return an instance of {@code MetalToolBarUI}
+     */
     public static ComponentUI createUI( JComponent c )
     {
         return new MetalToolBarUI();
@@ -269,6 +275,11 @@ public class MetalToolBarUI extends BasicToolBarUI
         return new MetalDockingListener( toolBar );
     }
 
+    /**
+     * Sets the offset of the mouse cursor inside the DragWindow.
+     *
+     * @param p the offset
+     */
     protected void setDragOffset(Point p) {
         if (!GraphicsEnvironment.isHeadless()) {
             if (dragWindow == null) {
@@ -346,17 +357,29 @@ public class MetalToolBarUI extends BasicToolBarUI
         }
     }
 
-    // No longer used. Cannot remove for compatibility reasons
+    /**
+     * No longer used. The class cannot be removed for compatibility reasons.
+     */
     protected class MetalContainerListener
         extends BasicToolBarUI.ToolBarContListener {}
 
-    // No longer used. Cannot remove for compatibility reasons
+    /**
+     * No longer used. The class cannot be removed for compatibility reasons.
+     */
     protected class MetalRolloverListener
         extends BasicToolBarUI.PropertyListener {}
 
+    /**
+     * {@code DockingListener} for {@code MetalToolBarUI}.
+     */
     protected class MetalDockingListener extends DockingListener {
         private boolean pressedInBumps = false;
 
+        /**
+         * Constructs the {@code MetalDockingListener}.
+         *
+         * @param t an instance of {@code JToolBar}
+         */
         public MetalDockingListener(JToolBar t) {
             super(t);
         }
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java
index 2a7a1b1e571..d851a162685 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java
@@ -58,13 +58,26 @@ public class MetalToolTipUI extends BasicToolTipUI {
     private Font smallFont;
     // Refer to note in getAcceleratorString about this field.
     private JToolTip tip;
+
+    /**
+     * The space between strings.
+     */
     public static final int padSpaceBetweenStrings = 12;
     private String acceleratorDelimiter;
 
+    /**
+     * Constructs an instance of the {@code MetalToolTipUI}.
+     */
     public MetalToolTipUI() {
         super();
     }
 
+    /**
+     * Returns an instance of the {@code MetalToolTipUI}.
+     *
+     * @param c a component
+     * @return an instance of the {@code MetalToolTipUI}.
+     */
     public static ComponentUI createUI(JComponent c) {
         return sharedInstance;
     }
@@ -148,6 +161,12 @@ public class MetalToolTipUI extends BasicToolTipUI {
         return d;
     }
 
+    /**
+     * If the accelerator is hidden, the method returns {@code true},
+     * otherwise, returns {@code false}.
+     *
+     * @return {@code true} if the accelerator is hidden.
+     */
     protected boolean isAcceleratorHidden() {
         Boolean b = (Boolean)UIManager.get("ToolTip.hideAccelerator");
         return b != null && b.booleanValue();
@@ -162,6 +181,11 @@ public class MetalToolTipUI extends BasicToolTipUI {
         return retValue;
     }
 
+    /**
+     * Returns the accelerator string.
+     *
+     * @return the accelerator string.
+     */
     // NOTE: This requires the tip field to be set before this is invoked.
     // As MetalToolTipUI is shared between all JToolTips the tip field is
     // set appropriately before this is invoked. Unfortunately this means
diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java
index dee9e022f55..0e333ba630f 100644
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java
@@ -93,20 +93,26 @@ public class MetalTreeUI extends BasicTreeUI {
     private int lineStyle = LEG_LINE_STYLE;
     private PropertyChangeListener lineStyleListener = new LineListener();
 
-    // Boilerplate
+    /**
+     * Constructs the {@code MetalTreeUI}.
+     *
+     * @param x a component
+     * @return the instance of the {@code MetalTreeUI}
+     */
     public static ComponentUI createUI(JComponent x) {
         return new MetalTreeUI();
     }
 
-    public MetalTreeUI()
-    {
+    /**
+     * Constructs the {@code MetalTreeUI}.
+     */
+    public MetalTreeUI() {
         super();
     }
 
-    protected int getHorizontalLegBuffer()
-      {
-          return 3;
-      }
+    protected int getHorizontalLegBuffer() {
+        return 3;
+    }
 
     public void installUI( JComponent c ) {
         super.installUI( c );
@@ -123,24 +129,36 @@ public class MetalTreeUI extends BasicTreeUI {
          super.uninstallUI(c);
     }
 
-    /** this function converts between the string passed into the client property
-      * and the internal representation (currently and int)
-      *
-      */
+    /**
+     * Converts between the string passed into the client property
+     * and the internal representation (currently and int)
+     *
+     * @param lineStyleFlag a flag
+     */
     protected void decodeLineStyle(Object lineStyleFlag) {
-      if ( lineStyleFlag == null ||
-                    lineStyleFlag.equals(LEG_LINE_STYLE_STRING)){
-        lineStyle = LEG_LINE_STYLE; // default case
-      } else {
-          if ( lineStyleFlag.equals(NO_STYLE_STRING) ) {
-              lineStyle = NO_LINE_STYLE;
-          } else if ( lineStyleFlag.equals(HORIZ_STYLE_STRING) ) {
-              lineStyle = HORIZ_LINE_STYLE;
-          }
-      }
-
+        if ( lineStyleFlag == null ||
+                    lineStyleFlag.equals(LEG_LINE_STYLE_STRING)) {
+            lineStyle = LEG_LINE_STYLE; // default case
+        } else {
+            if ( lineStyleFlag.equals(NO_STYLE_STRING) ) {
+                lineStyle = NO_LINE_STYLE;
+            } else if ( lineStyleFlag.equals(HORIZ_STYLE_STRING) ) {
+                lineStyle = HORIZ_LINE_STYLE;
+            }
+        }
     }
 
+    /**
+     * Returns {@code true} if a point with X coordinate {@code mouseX}
+     * and Y coordinate {@code mouseY} is in expanded control.
+     *
+     * @param row a row
+     * @param rowLevel a row level
+     * @param mouseX X coordinate
+     * @param mouseY Y coordinate
+     * @return {@code true} if a point with X coordinate {@code mouseX}
+     *         and Y coordinate {@code mouseY} is in expanded control.
+     */
     protected boolean isLocationInExpandControl(int row, int rowLevel,
                                                 int mouseX, int mouseY) {
         if(tree != null && !isLeaf(row)) {
@@ -175,6 +193,12 @@ public class MetalTreeUI extends BasicTreeUI {
         }
     }
 
+    /**
+     * Paints the horizontal separators.
+     *
+     * @param g an instance of {@code Graphics}
+     * @param c a component
+     */
     protected void paintHorizontalSeparators(Graphics g, JComponent c) {
         g.setColor( lineColor );
 
-- 
GitLab


From 51aad86e6b4d0c6b2f432257edb7ac89f03d9e1d Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Mon, 30 Jun 2014 20:23:16 +0530
Subject: [PATCH 153/192] 8048718: JSON.parse('{"0":0, "64":0}') throws
 ArrayindexOutOfBoundsException

Reviewed-by: lagergren, hannesw, attila
---
 .../internal/runtime/ScriptObject.java        |  1 +
 nashorn/test/script/basic/JDK-8048718.js      | 52 +++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 nashorn/test/script/basic/JDK-8048718.js

diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
index 90003b38f67..1987d317100 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -691,6 +691,7 @@ public abstract class ScriptObject implements PropertyAccess {
         assert isValidArrayIndex(index) : "invalid array index";
         final long longIndex = ArrayIndex.toLongIndex(index);
         doesNotHaveEnsureDelete(longIndex, getArray().length(), false);
+        setArray(getArray().ensure(longIndex));
         setArray(getArray().set(index, value, false));
     }
 
diff --git a/nashorn/test/script/basic/JDK-8048718.js b/nashorn/test/script/basic/JDK-8048718.js
new file mode 100644
index 00000000000..08b0e3f8879
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048718.js
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8048718: JSON.parse('{"0":0, "64":0}') throws ArrayindexOutOfBoundsException
+ *
+ * @test
+ * @run
+ */
+
+var obj = JSON.parse('{"0":0, "64":0}');
+if ("1" in obj) {
+    fail("found element at index 1");
+}
+
+if ("63" in obj) {
+    fail("found element at index 63");
+}
+
+if (obj[0] != 0) {
+    fail("expected obj[0] to be 0");
+}
+
+if (obj[64] != 0) {
+    fail("expected obj[64] to be 0");
+}
+
+for (var i in obj) {
+    if (i != "0" && i != "64") {
+        fail("invalid property " + i);
+    }
+}
-- 
GitLab


From 3e0fd99223bc26c3784df881f46859b2da49477a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Mon, 30 Jun 2014 17:31:28 +0200
Subject: [PATCH 154/192] 8048586: String concatenation with optimistic types
 is slow

Reviewed-by: lagergren, attila
---
 .../codegen/LocalVariableTypesCalculator.java |  4 +-
 .../internal/codegen/types/ObjectType.java    |  2 +
 .../nashorn/internal/codegen/types/Type.java  | 16 ++++++++
 .../jdk/nashorn/internal/runtime/JSType.java  | 13 ++++++
 nashorn/test/script/basic/JDK-8048586.js      | 41 +++++++++++++++++++
 5 files changed, 75 insertions(+), 1 deletion(-)
 create mode 100644 nashorn/test/script/basic/JDK-8048586.js

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 9a6bcef259d..df763c1ba4f 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -1196,7 +1196,9 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
                 } else if(binaryNode.isOptimisticUndecidedType()) {
                     // At this point, we can assign a static type to the optimistic binary ADD operator as now we know
                     // the types of its operands.
-                    return binaryNode.setType(Type.widest(binaryNode.lhs().getType(), binaryNode.rhs().getType()));
+                    final Type type = Type.widest(binaryNode.lhs().getType(), binaryNode.rhs().getType());
+                    // Use Type.CHARSEQUENCE instead of Type.STRING to avoid conversion of ConsStrings to Strings.
+                    return binaryNode.setType(type.equals(Type.STRING) ? Type.CHARSEQUENCE : type);
                 }
                 return binaryNode;
             }
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/types/ObjectType.java b/nashorn/src/jdk/nashorn/internal/codegen/types/ObjectType.java
index 50cc02fc9ea..0ccf6644a59 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/ObjectType.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/ObjectType.java
@@ -171,6 +171,8 @@ class ObjectType extends Type {
             invokestatic(method, JSType.TO_BOOLEAN);
         } else if (to.isString()) {
             invokestatic(method, JSType.TO_PRIMITIVE_TO_STRING);
+        } else if (to.isCharSequence()) {
+            invokestatic(method, JSType.TO_PRIMITIVE_TO_CHARSEQUENCE);
         } else {
             throw new UnsupportedOperationException("Illegal conversion " + this + " -> " + to + " " + isString() + " " + toString);
         }
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java
index 18b2c0d3a77..1fc648039ff 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java
@@ -416,6 +416,15 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
         return this.equals(Type.STRING);
     }
 
+    /**
+     * Determines whether a type is a CHARSEQUENCE type used internally strings
+     *
+     * @return true if CharSequence (internal string) type, false otherwise
+     */
+    public boolean isCharSequence() {
+        return this.equals(Type.CHARSEQUENCE);
+    }
+
     /**
      * Determine if two types are equivalent, i.e. need no conversion
      *
@@ -799,6 +808,13 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
      */
     public static final Type STRING = putInCache(new ObjectType(String.class));
 
+    /**
+     * This is the CharSequence singleton used to represent JS strings internally
+     * (either a {@code java.lang.String} or {@code jdk.nashorn.internal.runtime.ConsString}.
+     */
+    public static final Type CHARSEQUENCE = putInCache(new ObjectType(CharSequence.class));
+
+
     /**
      * This is the object singleton, used for all object types
      */
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
index 1d4e409fd3d..388761c4655 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
@@ -130,6 +130,9 @@ public enum JSType {
     /** Combined call to toPrimitive followed by toString. */
     public static final Call TO_PRIMITIVE_TO_STRING = staticCall(JSTYPE_LOOKUP, JSType.class, "toPrimitiveToString", String.class, Object.class);
 
+    /** Combined call to toPrimitive followed by toCharSequence. */
+    public static final Call TO_PRIMITIVE_TO_CHARSEQUENCE = staticCall(JSTYPE_LOOKUP, JSType.class, "toPrimitiveToCharSequence", CharSequence.class, Object.class);
+
     /** Throw an unwarranted optimism exception */
     public static final Call THROW_UNWARRANTED = staticCall(JSTYPE_LOOKUP, JSType.class, "throwUnwarrantedOptimismException", Object.class, Object.class, int.class);
 
@@ -487,6 +490,16 @@ public enum JSType {
         return toString(toPrimitive(obj));
     }
 
+    /**
+     * Like {@link #toPrimitiveToString(Object)}, but avoids conversion of ConsString to String.
+     *
+     * @param obj  an object
+     * @return the CharSequence form of the primitive form of the object
+     */
+    public static CharSequence toPrimitiveToCharSequence(final Object obj) {
+        return toCharSequence(toPrimitive(obj));
+    }
+
     /**
      * JavaScript compliant conversion of number to boolean
      *
diff --git a/nashorn/test/script/basic/JDK-8048586.js b/nashorn/test/script/basic/JDK-8048586.js
new file mode 100644
index 00000000000..03941985877
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8048586.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8048586: String concatenation with optimistic types is slow
+ *
+ * @test
+ * @run
+ */
+
+var body = '';
+
+for (var i = 0; i < 1024 * 1024; i++) {
+  body += 'hello world\n';
+}
+
+body = '';
+
+for (var i = 0; i < 1024 * 1024; i++) {
+  body = body + 'hello world\n';
+}
-- 
GitLab


From f5c7c3c790e07ad25c01aa737801fc2f0debbe0a Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Mon, 30 Jun 2014 14:27:37 -0700
Subject: [PATCH 155/192] 8048302: Update bug reporting URL in make/Javadoc.gmk
 8048321: Enable doclint warnings in build of docs from langtools

Reviewed-by: tbell
---
 make/Javadoc.gmk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk
index aebdb21a8b2..d95f9dc1ad1 100644
--- a/make/Javadoc.gmk
+++ b/make/Javadoc.gmk
@@ -118,7 +118,7 @@ DOCSDIR_URL = {@docroot}/$(GET2DOCSDIR)
 COPYRIGHT_URL = $(DOCSDIR_URL)/legal/cpyr.html
 
 # Url to bug filing site
-BUG_SUBMIT_URL = http://bugreport.sun.com/bugreport/
+BUG_SUBMIT_URL = http://bugreport.java.com/bugreport/
 
 # Common line for how to submit a bug or rfe
 BUG_SUBMIT_LINE = <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a>
@@ -442,7 +442,7 @@ $(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE) $(
 $(DOCLETAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
-	  $(call OptionOnly,-Xdoclint:none) ; \
+	  $(call OptionOnly,-Xdoclint:all) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-breakiterator) ; \
@@ -499,7 +499,7 @@ $(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE) $(
 $(TAGLETAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
-	  $(call OptionOnly,-Xdoclint:none) ; \
+	  $(call OptionOnly,-Xdoclint:all) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionOnly,-nonavbar) ; \
@@ -1074,7 +1074,7 @@ $(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE) $(COREAP
 $(TREEAPI_OPTIONS_FILE):
 	$(prep-target)
 	@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
-	  $(call OptionOnly,-Xdoclint:none) ; \
+	  $(call OptionOnly,-Xdoclint:all) ; \
 	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
 	  $(call OptionPair,-encoding,ascii) ; \
 	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE)) ; \
-- 
GitLab


From 61183bb10c7b9b6fa353a24309fc72596f862c6e Mon Sep 17 00:00:00 2001
From: Joe Wang <joehw@openjdk.org>
Date: Mon, 30 Jun 2014 18:04:13 -0700
Subject: [PATCH 156/192] 8023276: Java SE should include the full DOM API from
 JAXP

Reviewed-by: lancea, mchung, alanb
---
 make/common/CORE_PKGS.gmk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/make/common/CORE_PKGS.gmk b/make/common/CORE_PKGS.gmk
index 9c85da65ec7..fc7dddadff1 100644
--- a/make/common/CORE_PKGS.gmk
+++ b/make/common/CORE_PKGS.gmk
@@ -39,8 +39,6 @@ EXCLUDE_PKGS = \
     org.w3c.dom.css \
     org.w3c.dom.html \
     org.w3c.dom.stylesheets \
-    org.w3c.dom.traversal \
-    org.w3c.dom.ranges \
     org.omg.stub.javax.management.remote.rmi
 
 #
@@ -294,6 +292,8 @@ CORE_PKGS = \
     org.w3c.dom.events \
     org.w3c.dom.bootstrap \
     org.w3c.dom.ls \
+    org.w3c.dom.ranges \
+    org.w3c.dom.traversal \
     org.w3c.dom.views \
     org.xml.sax \
     org.xml.sax.ext \
-- 
GitLab


From f2399d7d549310b359e7ee54d1061922bac48527 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Mon, 30 Jun 2014 18:17:46 -0700
Subject: [PATCH 157/192] 8048839: Reverse sense of -Xlint options in build of
 jdk repo

Reviewed-by: tbell, mikael
---
 jdk/make/Setup.gmk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/make/Setup.gmk b/jdk/make/Setup.gmk
index 13e513d3274..485c3b72b13 100644
--- a/jdk/make/Setup.gmk
+++ b/jdk/make/Setup.gmk
@@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-
 
 # To build with all warnings enabled, do the following:
 # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
-JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,auxiliaryclass,cast,classfile,dep-ann,divzero,empty,fallthrough,finally,overloads,overrides,serial,static,try,varargs -Werror
+JAVAC_WARNINGS := -Xlint:all,-deprecation,-rawtypes,-unchecked -Werror
 
 # Any java code executed during a JDK build to build other parts of the JDK must be 
 # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 
-- 
GitLab


From 4b31ce4a17de26f1083efd1ea0e36cbb8a3d53ec Mon Sep 17 00:00:00 2001
From: Staffan Larsen <sla@openjdk.org>
Date: Tue, 1 Jul 2014 10:40:14 +0200
Subject: [PATCH 158/192] 8048687: [TESTBUG] com/sun/jdi/ExclusiveBind.java
 "Could not find or load main class"

Reviewed-by: jbachorik, egahlin, dholmes
---
 jdk/test/com/sun/jdi/ExclusiveBind.java | 4 +++-
 jdk/test/com/sun/jdi/VMConnection.java  | 8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/jdk/test/com/sun/jdi/ExclusiveBind.java b/jdk/test/com/sun/jdi/ExclusiveBind.java
index 40a42d0e16d..a4801fa4ab6 100644
--- a/jdk/test/com/sun/jdi/ExclusiveBind.java
+++ b/jdk/test/com/sun/jdi/ExclusiveBind.java
@@ -68,7 +68,9 @@ public class ExclusiveBind {
     private static ProcessBuilder prepareLauncher(String address, boolean suspend, String class_name) throws Exception {
         List<String> args = new ArrayList<>();
         for(String dbgOption : VMConnection.getDebuggeeVMOptions().split(" ")) {
-            args.add(dbgOption);
+            if (!dbgOption.trim().isEmpty()) {
+                args.add(dbgOption);
+            }
         }
         String lib = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=";
         if (suspend) {
diff --git a/jdk/test/com/sun/jdi/VMConnection.java b/jdk/test/com/sun/jdi/VMConnection.java
index e0d72758661..2df2e63057e 100644
--- a/jdk/test/com/sun/jdi/VMConnection.java
+++ b/jdk/test/com/sun/jdi/VMConnection.java
@@ -59,13 +59,13 @@ class VMConnection {
         retVal += "-classpath " + testClasses;
 
         String vmOpts = System.getProperty("test.vm.opts");
-        System.out.println("vmOpts: "+vmOpts);
-        if (vmOpts != null) {
+        System.out.println("vmOpts: '" + vmOpts + "'");
+        if (vmOpts != null && !vmOpts.trim().isEmpty()) {
             retVal += " " + vmOpts;
         }
         String javaOpts = System.getProperty("test.java.opts");
-        System.out.println("javaOpts: "+javaOpts);
-        if (javaOpts != null) {
+        System.out.println("javaOpts: '" + javaOpts + "'");
+        if (javaOpts != null && !javaOpts.trim().isEmpty()) {
             retVal += " " + javaOpts;
         }
 
-- 
GitLab


From 7b43631edcc97605a9e6873949f5fb12b1ff1a7e Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik <jbachorik@openjdk.org>
Date: Tue, 1 Jul 2014 11:47:36 +0200
Subject: [PATCH 159/192] 8038794:
 java/lang/management/ThreadMXBean/SynchronizationStatistics.java fails
 intermittently

Reviewed-by: sla
---
 .../SynchronizationStatistics.java            | 133 ++++++++++++------
 1 file changed, 88 insertions(+), 45 deletions(-)

diff --git a/jdk/test/java/lang/management/ThreadMXBean/SynchronizationStatistics.java b/jdk/test/java/lang/management/ThreadMXBean/SynchronizationStatistics.java
index 6986adc6893..f998b7e2375 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/SynchronizationStatistics.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/SynchronizationStatistics.java
@@ -34,6 +34,7 @@
 
 import java.lang.management.*;
 import java.util.concurrent.Phaser;
+import java.util.function.Supplier;
 
 public class SynchronizationStatistics {
     private static class LockerThread extends Thread {
@@ -86,6 +87,8 @@ public class SynchronizationStatistics {
     private static void testBlockingOnSimpleMonitor() throws Exception {
         System.out.println("testBlockingOnSimpleMonitor");
         final Object lock1 = new Object();
+        System.out.println("Lock1 = " + lock1);
+
         final Phaser p = new Phaser(2);
         LockerThread lt = newLockerThread(new Runnable() {
             @Override
@@ -110,12 +113,12 @@ public class SynchronizationStatistics {
         }
 
         p.arriveAndAwaitAdvance(); // phase[2]
-        testBlocked(ti, mbean.getThreadInfo(tid), lockName, lock1);
+        testBlocked(ti, () -> mbean.getThreadInfo(tid), lockName, lock1);
         p.arriveAndDeregister(); // phase[3]
 
         lt.join();
 
-        System.out.println("OK");
+        printok();
     }
 
     /**
@@ -128,6 +131,9 @@ public class SynchronizationStatistics {
         final Object lock1 = new Object();
         final Object lock2 = new Object();
 
+        System.out.println("Lock1 = " + lock1);
+        System.out.println("Lock2 = " + lock2);
+
         final Phaser p = new Phaser(2);
         LockerThread lt = newLockerThread(new Runnable() {
             @Override
@@ -149,7 +155,6 @@ public class SynchronizationStatistics {
         lt.start();
         long tid = lt.getId();
         ThreadInfo ti = mbean.getThreadInfo(tid);
-        ThreadInfo ti1 = null;
         String lockName = null;
         synchronized(lock1) {
             p.arriveAndAwaitAdvance(); // phase[1]
@@ -158,9 +163,7 @@ public class SynchronizationStatistics {
         }
         p.arriveAndAwaitAdvance(); // phase[2]
 
-        ti1 = mbean.getThreadInfo(tid);
-        testBlocked(ti, ti1, lockName, lock1);
-        ti = ti1;
+        ti = testBlocked(ti, () -> mbean.getThreadInfo(tid), lockName, lock1);
 
         synchronized(lock2) {
             p.arriveAndAwaitAdvance(); // phase [3]
@@ -168,12 +171,12 @@ public class SynchronizationStatistics {
             lockName = mbean.getThreadInfo(tid).getLockName();
         }
         p.arriveAndAwaitAdvance(); // phase [4]
-        testBlocked(ti, mbean.getThreadInfo(tid), lockName, lock2);
+        testBlocked(ti, () -> mbean.getThreadInfo(tid), lockName, lock2);
         p.arriveAndDeregister();
 
         lt.join();
 
-        System.out.println("OK");
+        printok();
     }
 
     /**
@@ -209,13 +212,12 @@ public class SynchronizationStatistics {
         }
         p.arriveAndAwaitAdvance(); // phase[2]
 
-        ThreadInfo ti2 = mbean.getThreadInfo(lt.getId());
+        testWaited(ti1, () -> mbean.getThreadInfo(lt.getId()), 1);
         p.arriveAndDeregister(); // phase[3]
 
         lt.join();
 
-        testWaited(ti1, ti2, 1);
-        System.out.println("OK");
+        printok();
     }
 
     /**
@@ -256,12 +258,12 @@ public class SynchronizationStatistics {
         int phase = p.getPhase();
         while ((p.arriveAndAwaitAdvance() - phase) < 3); // phase[2-4]
 
-        ThreadInfo ti2 = mbean.getThreadInfo(lt.getId());
+        testWaited(ti1, () -> mbean.getThreadInfo(lt.getId()), 3);
         p.arriveAndDeregister(); // phase[5]
 
         lt.join();
-        testWaited(ti1, ti2, 3);
-        System.out.println("OK");
+
+        printok();
     }
 
     /**
@@ -331,44 +333,85 @@ public class SynchronizationStatistics {
         }
 
         p.arriveAndAwaitAdvance(); // phase[4]
-        ThreadInfo ti2 = mbean.getThreadInfo(lt.getId());
+        testWaited(ti1, () -> mbean.getThreadInfo(lt.getId()), 3);
         p.arriveAndDeregister(); // phase[5]
 
         lt.join();
-        testWaited(ti1, ti2, 3);
-        System.out.println("OK");
+        printok();
     }
 
-    private static void testWaited(ThreadInfo ti1, ThreadInfo ti2, int waited) throws Error {
-        long waitCntDiff = ti2.getWaitedCount() - ti1.getWaitedCount();
-        long waitTimeDiff = ti2.getWaitedTime() - ti1.getWaitedTime();
-        if (waitCntDiff < waited) {
-            throw new Error("Unexpected diff in waited count. Expecting at least "
-                            + waited + " , got " + waitCntDiff);
-        }
-        if (waitTimeDiff <= 0) {
-            throw new Error("Unexpected diff in waited time. Expecting increasing " +
-                            "value, got " + waitTimeDiff + "ms");
-        }
+    private static void printok() {
+        System.out.println("OK\n");
     }
 
-    private static void testBlocked(ThreadInfo ti1, ThreadInfo ti2,
+    private static void testWaited(ThreadInfo ti1, Supplier<ThreadInfo> ti2, int waited)
+    throws InterruptedException {
+        boolean error;
+        do {
+            error = false;
+            ThreadInfo ti = ti2.get();
+            long waitCntDiff = ti.getWaitedCount() - ti1.getWaitedCount();
+            long waitTimeDiff = ti.getWaitedTime() - ti1.getWaitedTime();
+            if (waitCntDiff < waited) {
+                System.err.println(
+                    "Unexpected diff in waited count. Expecting at least "
+                    + waited + " , got " + waitCntDiff
+                );
+                error = true;
+            }
+            if (waitTimeDiff <= 0) {
+                System.err.println(
+                    "Unexpected diff in waited time. Expecting increasing " +
+                    "value, got " + waitTimeDiff + "ms"
+                );
+                error = true;
+            }
+            if (error) {
+                System.err.println("Retrying in 20ms ...");
+                Thread.sleep(20);
+            }
+        } while (error);
+    }
+
+    private static ThreadInfo testBlocked(ThreadInfo ti1, Supplier<ThreadInfo> ti2,
                                     String lockName, final Object lock)
-    throws Error {
-        long blkCntDiff = ti2.getBlockedCount() - ti1.getBlockedCount();
-        long blkTimeDiff = ti2.getBlockedTime() - ti1.getBlockedTime();
-        if (blkCntDiff < 1) {
-            throw new Error("Unexpected diff in blocked count. Expecting at least 1, " +
-                            "got " + blkCntDiff);
-        }
-        if (blkTimeDiff < 0) {
-            throw new Error("Unexpected diff in blocked time. Expecting a positive " +
-                            "number, got " + blkTimeDiff);
-        }
-        if (!lockName.equals(lock.toString())) {
-            throw new Error("Unexpected blocked monitor name. Expecting " +
-                    lock.toString() + ", got " +
-                    lockName);
-        }
+    throws InterruptedException {
+        boolean error;
+        ThreadInfo ti = null;
+        do {
+            error = false;
+            ti = ti2.get();
+            long blkCntDiff = ti.getBlockedCount() - ti1.getBlockedCount();
+            long blkTimeDiff = ti.getBlockedTime() - ti1.getBlockedTime();
+
+            System.out.println("testBlocked: [" + blkCntDiff + ", " + blkTimeDiff + ", " + lockName + "]");
+
+            if (blkCntDiff < 1) {
+                System.err.println(
+                    "Unexpected diff in blocked count. Expecting at least 1, " +
+                    "got " + blkCntDiff
+                );
+                error = true;
+            }
+            if (blkTimeDiff < 0) {
+                System.err.println(
+                    "Unexpected diff in blocked time. Expecting a positive " +
+                    "number, got " + blkTimeDiff
+                );
+                error = true;
+            }
+            if (!lockName.equals(lock.toString())) {
+                System.err.println(
+                    "Unexpected blocked monitor name. Expecting " +
+                    lock.toString() + ", got " + lockName
+                );
+                error = true;
+            }
+            if (error) {
+                System.err.println("Retrying in 20ms ...");
+                Thread.sleep(20);
+            }
+        } while (error);
+        return ti;
     }
 }
-- 
GitLab


From 81f8f932251d03b563869fa059405e0db9afe453 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Tue, 1 Jul 2014 17:37:39 +0530
Subject: [PATCH 160/192] 8047359: large string size RangeError should be
 thrown rather than reporting negative length

Reviewed-by: hannesw, attila
---
 nashorn/make/build.xml                        |  3 +-
 .../dynalink/beans/OverloadedMethod.java      |  2 +-
 ...mpositeTypeBasedGuardingDynamicLinker.java |  3 +-
 .../internal/codegen/FunctionSignature.java   |  2 +-
 .../internal/ir/debug/NashornClassReader.java |  2 +-
 .../nashorn/internal/objects/NativeDate.java  |  1 +
 .../nashorn/internal/runtime/ConsString.java  |  3 ++
 .../internal/runtime/ScriptRuntime.java       |  7 ++-
 .../jdk/nashorn/internal/runtime/Source.java  |  1 +
 .../runtime/UserAccessorProperty.java         |  4 +-
 .../runtime/arrays/ByteBufferArrayData.java   |  2 +-
 .../internal/runtime/linker/InvokeByName.java |  2 +-
 .../runtime/resources/Messages.properties     |  1 +
 nashorn/test/script/basic/JDK-8047359.js      | 47 +++++++++++++++++++
 14 files changed, 69 insertions(+), 11 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8047359.js

diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml
index 1b28e9bdcbe..a872f358e6d 100644
--- a/nashorn/make/build.xml
+++ b/nashorn/make/build.xml
@@ -125,8 +125,7 @@
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
       <compilerarg value="-J-Djava.ext.dirs="/>
-      <compilerarg value="-Xlint:unchecked"/>
-      <compilerarg value="-Xlint:deprecation"/>
+      <compilerarg value="-Xlint:all"/>
       <compilerarg value="-XDignore.symbol.file"/>
       <compilerarg value="-Xdiags:verbose"/>
     </javac>
diff --git a/nashorn/src/jdk/internal/dynalink/beans/OverloadedMethod.java b/nashorn/src/jdk/internal/dynalink/beans/OverloadedMethod.java
index 75332859f17..70ec495a7ac 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/OverloadedMethod.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/OverloadedMethod.java
@@ -152,7 +152,7 @@ class OverloadedMethod {
 
     @SuppressWarnings("unused")
     private MethodHandle selectMethod(final Object[] args) throws NoSuchMethodException {
-        final Class<?>[] argTypes = new Class[args.length];
+        final Class<?>[] argTypes = new Class<?>[args.length];
         for(int i = 0; i < argTypes.length; ++i) {
             final Object arg = args[i];
             argTypes[i] = arg == null ? ClassString.NULL_CLASS : arg.getClass();
diff --git a/nashorn/src/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java b/nashorn/src/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java
index 814fc6936bf..91946969370 100644
--- a/nashorn/src/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java
+++ b/nashorn/src/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java
@@ -111,7 +111,7 @@ public class CompositeTypeBasedGuardingDynamicLinker implements TypeBasedGuardin
         private final TypeBasedGuardingDynamicLinker[] linkers;
         private final List<TypeBasedGuardingDynamicLinker>[] singletonLinkers;
 
-        @SuppressWarnings("unchecked")
+        @SuppressWarnings(value={"unchecked", "rawtypes"})
         ClassToLinker(final TypeBasedGuardingDynamicLinker[] linkers) {
             this.linkers = linkers;
             singletonLinkers = new List[linkers.length];
@@ -120,6 +120,7 @@ public class CompositeTypeBasedGuardingDynamicLinker implements TypeBasedGuardin
             }
         }
 
+        @SuppressWarnings("fallthrough")
         @Override
         protected List<TypeBasedGuardingDynamicLinker> computeValue(final Class<?> clazz) {
             List<TypeBasedGuardingDynamicLinker> list = NO_LINKER;
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/FunctionSignature.java b/nashorn/src/jdk/nashorn/internal/codegen/FunctionSignature.java
index 627623b378e..5e06794609c 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/FunctionSignature.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FunctionSignature.java
@@ -141,7 +141,7 @@ public final class FunctionSignature {
             paramTypeList.add(paramType.getTypeClass());
         }
 
-        this.methodType = MH.type(returnType.getTypeClass(), paramTypeList.toArray(new Class[paramTypes.length]));
+        this.methodType = MH.type(returnType.getTypeClass(), paramTypeList.toArray(new Class<?>[paramTypes.length]));
     }
 
     /**
diff --git a/nashorn/src/jdk/nashorn/internal/ir/debug/NashornClassReader.java b/nashorn/src/jdk/nashorn/internal/ir/debug/NashornClassReader.java
index 3fd2ce96750..87eb18df73c 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/NashornClassReader.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/NashornClassReader.java
@@ -443,7 +443,7 @@ public class NashornClassReader extends ClassReader {
     @Override
     protected Label readLabel(final int offset, final Label[] labels) {
         final Label label = super.readLabel(offset, labels);
-        label.info = (int)offset;
+        label.info = offset;
         return label;
     }
 
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java
index b3661df7eb2..0f42998d261 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java
@@ -909,6 +909,7 @@ public final class NativeDate extends ScriptObject {
         sb.append(n);
     }
 
+    @SuppressWarnings("fallthrough")
     private static String toStringImpl(final Object self, final int format) {
         final NativeDate nd = getNativeDate(self);
 
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java b/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java
index 41e2c49e938..3d1979d6c62 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ConsString.java
@@ -57,6 +57,9 @@ public final class ConsString implements CharSequence {
         this.left = left;
         this.right = right;
         length = left.length() + right.length();
+        if (length < 0) {
+            throw new IllegalArgumentException("too big concatenated String");
+        }
     }
 
     @Override
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
index 337d92699e3..a73b7ab992f 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
@@ -27,6 +27,7 @@ package jdk.nashorn.internal.runtime;
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
+import static jdk.nashorn.internal.runtime.ECMAErrors.rangeError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.syntaxError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
@@ -531,7 +532,11 @@ public final class ScriptRuntime {
 
         if (xPrim instanceof String || yPrim instanceof String
                 || xPrim instanceof ConsString || yPrim instanceof ConsString) {
-            return new ConsString(JSType.toCharSequence(xPrim), JSType.toCharSequence(yPrim));
+            try {
+                return new ConsString(JSType.toCharSequence(xPrim), JSType.toCharSequence(yPrim));
+            } catch (final IllegalArgumentException iae) {
+                throw rangeError(iae, "concat.string.too.big");
+            }
         }
 
         return JSType.toNumber(xPrim) + JSType.toNumber(yPrim);
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Source.java b/nashorn/src/jdk/nashorn/internal/runtime/Source.java
index d64bbfa26e6..b5829eee735 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java
@@ -306,6 +306,7 @@ public final class Source implements Loggable {
             return array == null;
         }
 
+        @SuppressWarnings("try")
         protected void checkPermissionAndClose() throws IOException {
             try (InputStream in = url.openStream()) {
                 // empty
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
index 03a17f7bc0c..0a29d8911a6 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
@@ -201,7 +201,7 @@ public final class UserAccessorProperty extends SpillProperty {
 
     @Override
     public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
-        return userAccessorGetter(getAccessors((owner != null) ? owner : (ScriptObject)self), self);
+        return userAccessorGetter(getAccessors((owner != null) ? owner : self), self);
     }
 
     @Override
@@ -221,7 +221,7 @@ public final class UserAccessorProperty extends SpillProperty {
 
     @Override
     public void setValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
-        userAccessorSetter(getAccessors((owner != null) ? owner : (ScriptObject)self), strict ? getKey() : null, self, value);
+        userAccessorSetter(getAccessors((owner != null) ? owner : self), strict ? getKey() : null, self, value);
     }
 
     @Override
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java
index b76d0756ea5..85f1b433383 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java
@@ -150,7 +150,7 @@ final class ByteBufferArrayData extends ArrayData {
 
     @Override
     public Object getObject(final int index) {
-        return (int)(0x0ff & buf.get(index));
+        return 0x0ff & buf.get(index);
     }
 
     @Override
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java
index e6d13c20c9a..19fe6bd758c 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java
@@ -90,7 +90,7 @@ public final class InvokeByName {
         if(plength == 0) {
             finalPtypes = new Class<?>[] { Object.class, targetClass };
         } else {
-            finalPtypes = new Class[plength + 2];
+            finalPtypes = new Class<?>[plength + 2];
             finalPtypes[0] = Object.class;
             finalPtypes[1] = targetClass;
             System.arraycopy(ptypes, 0, finalPtypes, 2, plength);
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
index 29785a3f70e..53cb4a68290 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -151,6 +151,7 @@ range.error.invalid.precision=precision argument toPrecision() must be in [1, 21
 range.error.invalid.radix=radix argument must be in [2, 36]
 range.error.invalid.date=Invalid Date
 range.error.too.many.errors=Script contains too many errors: {0} errors
+range.error.concat.string.too.big=Concatenated String is too big
 
 reference.error.not.defined="{0}" is not defined
 reference.error.cant.be.used.as.lhs="{0}" can not be used as the left-hand side of assignment
diff --git a/nashorn/test/script/basic/JDK-8047359.js b/nashorn/test/script/basic/JDK-8047359.js
new file mode 100644
index 00000000000..812f3414347
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047359.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047359: large string size RangeError should be thrown rather than reporting negative length
+ *
+ * @test
+ * @run
+ */
+
+try {
+    var s = " "; for (var i=0;i<31;++i) s+=s; s.length;
+    throw new Error("should have thrown RangeError!");
+} catch (e) {
+    if (! (e instanceof RangeError)) {
+        fail("RangeError expected, got " + e);
+    }
+}
+
+try {
+    var s = " "; for (var i=0;i<31;++i) s+=s;
+    throw new Error("should have thrown RangeError!");
+} catch (e) {
+    if (! (e instanceof RangeError)) {
+        fail("RangeError expected, got " + e);
+    }
+}
-- 
GitLab


From e614cf24ef8d2c4957bb132bd40ea8901258f731 Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik <jbachorik@openjdk.org>
Date: Tue, 1 Jul 2014 15:00:33 +0200
Subject: [PATCH 161/192] 8048193: [tests] Replace JPS and stdout based PID
 retrieval by Process.getPid()

Reviewed-by: sla
---
 .../com/sun/tools/attach/Application.java     | 38 ++------
 jdk/test/com/sun/tools/attach/BasicTests.java | 15 ++-
 .../com/sun/tools/attach/PermissionTest.java  | 18 ++--
 jdk/test/com/sun/tools/attach/RunnerUtil.java | 84 ++--------------
 jdk/test/com/sun/tools/attach/Shutdown.java   | 45 ---------
 .../tools/attach/StartManagementAgent.java    | 13 +--
 .../com/sun/tools/attach/TempDirTest.java     | 14 ++-
 .../jdk/testlibrary/ProcessThread.java        | 81 +++++++++++++++-
 .../bootstrap/CustomLauncherTest.java         | 13 +--
 .../bootstrap/LocalManagementTest.java        | 15 ++-
 .../jmxremote/bootstrap/TestApplication.java  | 15 +--
 .../startstop/JMXStartStopDoSomething.java    |  1 -
 .../jmxremote/startstop/JMXStartStopTest.java | 16 ++--
 jdk/test/sun/tools/jstat/JStatInterval.java   |  9 +-
 jdk/test/sun/tools/jstatd/JstatdTest.java     | 96 +++++++------------
 15 files changed, 172 insertions(+), 301 deletions(-)
 delete mode 100644 jdk/test/com/sun/tools/attach/Shutdown.java

diff --git a/jdk/test/com/sun/tools/attach/Application.java b/jdk/test/com/sun/tools/attach/Application.java
index ecc7193af0b..485b8527c75 100644
--- a/jdk/test/com/sun/tools/attach/Application.java
+++ b/jdk/test/com/sun/tools/attach/Application.java
@@ -23,41 +23,21 @@
 
 /*
  * A simple "Application" used by the Attach API unit tests. This application is
- * launched by the test. It binds to a random port and shuts down when somebody
- * connects to that port.
- * Used port and pid are written both to stdout and to a specified file.
+ * launched by the test.
  */
-import java.net.Socket;
-import java.net.ServerSocket;
-import java.io.PrintWriter;
-import jdk.testlibrary.ProcessTools;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 
 public class Application {
-    public static void main(String args[]) throws Exception {
-        // bind to a random port
-        if (args.length < 1) {
-            System.err.println("First argument should be path to output file.");
-        }
-        String outFileName = args[0];
-
-        ServerSocket ss = new ServerSocket(0);
-        int port = ss.getLocalPort();
-        int pid = ProcessTools.getProcessId();
+    public static final String READY_MSG="ready";
+    public static final String SHUTDOWN_MSG="shutdown";
 
-        System.out.println("shutdownPort=" + port);
-        System.out.println("pid=" + pid);
+    public static void main(String args[]) throws Exception {
+        System.out.println(READY_MSG);
         System.out.flush();
 
-        try (PrintWriter writer = new PrintWriter(outFileName)) {
-            writer.println("shutdownPort=" + port);
-            writer.println("pid=" + pid);
-            writer.println("done");
-            writer.flush();
+        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
+            while (!br.readLine().equals(SHUTDOWN_MSG));
         }
-
-        // wait for test harness to connect
-        Socket s = ss.accept();
-        s.close();
-        ss.close();
     }
 }
diff --git a/jdk/test/com/sun/tools/attach/BasicTests.java b/jdk/test/com/sun/tools/attach/BasicTests.java
index f380c28b3a7..e462cf6463f 100644
--- a/jdk/test/com/sun/tools/attach/BasicTests.java
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java
@@ -38,7 +38,7 @@ import jdk.testlibrary.ProcessThread;
  * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
  * @summary Basic unit tests for the VM attach mechanism.
  * @library /lib/testlibrary
- * @run build jdk.testlibrary.* Agent BadAgent RedefineAgent Application Shutdown RedefineDummy RunnerUtil
+ * @run build jdk.testlibrary.* Agent BadAgent RedefineAgent Application RedefineDummy RunnerUtil
  * @run main BasicTests
  *
  * This test will perform a number of basic attach tests.
@@ -55,21 +55,18 @@ public class BasicTests {
      * 5. Shut down the Application.
      */
     public static void main(String args[]) throws Throwable {
-        final String pidFile = "TestsBasic.Application.pid";
         ProcessThread processThread = null;
-        RunnerUtil.ProcessInfo info = null;
         try {
             buildJars();
-            processThread = RunnerUtil.startApplication(pidFile);
-            info = RunnerUtil.readProcessInfo(pidFile);
-            runTests(info.pid);
+            processThread = RunnerUtil.startApplication();
+            runTests(processThread.getPid());
         } catch (Throwable t) {
             System.out.println("TestBasic got unexpected exception: " + t);
             t.printStackTrace();
             throw t;
         } finally {
             // Make sure the Application process is stopped.
-            RunnerUtil.stopApplication(info.shutdownPort, processThread);
+            RunnerUtil.stopApplication(processThread);
         }
     }
 
@@ -78,7 +75,7 @@ public class BasicTests {
      * The reason for running the tests in a separate process
      * is that we need to modify the class path.
      */
-    private static void runTests(int pid) throws Throwable {
+    private static void runTests(long pid) throws Throwable {
         final String sep = File.separator;
 
         // Need to add jdk/lib/tools.jar to classpath.
@@ -92,7 +89,7 @@ public class BasicTests {
             "-classpath",
             classpath,
             "BasicTests$TestMain",
-            Integer.toString(pid),
+            Long.toString(pid),
             testClassDir + "Agent.jar",
             testClassDir + "BadAgent.jar",
             testClassDir + "RedefineAgent.jar" };
diff --git a/jdk/test/com/sun/tools/attach/PermissionTest.java b/jdk/test/com/sun/tools/attach/PermissionTest.java
index 5ac458a3754..471f6fc5953 100644
--- a/jdk/test/com/sun/tools/attach/PermissionTest.java
+++ b/jdk/test/com/sun/tools/attach/PermissionTest.java
@@ -23,7 +23,6 @@
 
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.AttachNotSupportedException;
-import java.util.Properties;
 import java.io.File;
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.ProcessTools;
@@ -34,7 +33,7 @@ import jdk.testlibrary.ProcessThread;
  * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
  * @summary Basic unit tests for the VM attach mechanism.
  * @library /lib/testlibrary
- * @run build jdk.testlibrary.* Application Shutdown
+ * @run build jdk.testlibrary.* Application
  * @run main PermissionTest
  *
  * Unit test for Attach API -
@@ -51,20 +50,17 @@ public class PermissionTest {
      * 4. Shut down the Application.
      */
     public static void main(String args[]) throws Throwable {
-        final String pidFile ="TestPermission.Application.pid";
         ProcessThread processThread = null;
-        RunnerUtil.ProcessInfo info = null;
         try {
-            processThread = RunnerUtil.startApplication(pidFile);
-            info = RunnerUtil.readProcessInfo(pidFile);
-            runTests(info.pid);
+            processThread = RunnerUtil.startApplication();
+            runTests(processThread.getPid());
         } catch (Throwable t) {
             System.out.println("TestPermission got unexpected exception: " + t);
             t.printStackTrace();
             throw t;
         } finally {
             // Make sure the Application process is stopped.
-            RunnerUtil.stopApplication(info.shutdownPort, processThread);
+            RunnerUtil.stopApplication(processThread);
         }
     }
 
@@ -72,7 +68,7 @@ public class PermissionTest {
      * Runs the actual test the nested class TestMain.
      * The test is run in a separate process because we need to add to the classpath.
      */
-    private static void runTests(int pid) throws Throwable {
+    private static void runTests(long pid) throws Throwable {
         final String sep = File.separator;
 
         // Need to add jdk/lib/tools.jar to classpath.
@@ -88,7 +84,7 @@ public class PermissionTest {
             "-Djava.security.manager",
             String.format("-Djava.security.policy=%sjava.policy.deny", testSrc),
             "PermissionTest$TestMain",
-            Integer.toString(pid),
+            Long.toString(pid),
             "true" };
         OutputAnalyzer output = ProcessTools.executeTestJvm(args);
         output.shouldHaveExitValue(0);
@@ -100,7 +96,7 @@ public class PermissionTest {
             "-Djava.security.manager",
             String.format("-Djava.security.policy=%sjava.policy.allow", testSrc),
             "PermissionTest$TestMain",
-            Integer.toString(pid),
+            Long.toString(pid),
             "false" };
         output = ProcessTools.executeTestJvm(args);
         output.shouldHaveExitValue(0);
diff --git a/jdk/test/com/sun/tools/attach/RunnerUtil.java b/jdk/test/com/sun/tools/attach/RunnerUtil.java
index 0fd27894170..de2b70b2b36 100644
--- a/jdk/test/com/sun/tools/attach/RunnerUtil.java
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java
@@ -25,10 +25,7 @@ import java.io.IOException;
 import java.io.File;
 import java.nio.file.Files;
 import java.util.Arrays;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
 
-import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.Utils;
 import jdk.testlibrary.ProcessThread;
@@ -49,12 +46,12 @@ public class RunnerUtil {
      *
      * The Application will write its pid and shutdownPort in the given outFile.
      */
-    public static ProcessThread startApplication(String outFile, String... additionalOpts) throws Throwable {
+    public static ProcessThread startApplication(String... additionalOpts) throws Throwable {
         String classpath = System.getProperty("test.class.path", ".");
-        String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application", outFile });
+        String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application" });
         String[] args = Utils.addTestJavaOpts(myArgs);
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
-        ProcessThread pt = new ProcessThread("runApplication", pb);
+        ProcessThread pt = new ProcessThread("runApplication", (line) -> line.equals(Application.READY_MSG), pb);
         pt.start();
         return pt;
     }
@@ -81,23 +78,16 @@ public class RunnerUtil {
      *
      * If the nice shutdown fails, then an Exception is thrown and the test should fail.
      *
-     * @param port The shut down port.
      * @param processThread The process to stop.
      */
-    public static void stopApplication(int port, ProcessThread processThread) throws Throwable {
+    public static void stopApplication(ProcessThread processThread) throws Throwable {
         if (processThread == null) {
             System.out.println("RunnerUtil.stopApplication ignored since proc is null");
             return;
         }
         try {
-            System.out.println("RunnerUtil.stopApplication waiting to for shutdown");
-            OutputAnalyzer output = ProcessTools.executeTestJvm(
-                    "-classpath",
-                    System.getProperty("test.class.path", "."),
-                    "Shutdown",
-                    Integer.toString(port));
-            // Verify that both the Shutdown command and the Application finished ok.
-            output.shouldHaveExitValue(0);
+            System.out.println("RunnerUtil.stopApplication waiting for shutdown");
+            processThread.sendMessage(Application.SHUTDOWN_MSG);
             processThread.joinAndThrow();
             processThread.getOutput().shouldHaveExitValue(0);
         } catch (Throwable t) {
@@ -119,59 +109,6 @@ public class RunnerUtil {
         }
     }
 
-    /**
-     * Read process info for the running Application.
-     * The Application writes its info to a file with this format:
-     * shutdownPort=42994
-     * pid=19597
-     * done
-     *
-     * The final "done" is used to make sure the complete file has been written
-     * before we try to read it.
-     * This function will wait until the file is available.
-     *
-     * @param filename Path to file to read.
-     * @return The ProcessInfo containing pid and shutdownPort.
-     */
-    public static ProcessInfo readProcessInfo(String filename) throws Throwable {
-        System.out.println("Reading port and pid from file: " + filename);
-        File file = new File(filename);
-        String content = null;
-
-        // Read file or wait for it to be created.
-        long startTime = System.currentTimeMillis();
-        long lastWarningTime = 0;
-        while (true) {
-            content = readFile(file);
-            if (content != null && content.indexOf("done") >= 0) {
-                break;
-            }
-            Thread.sleep(100);
-            long elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
-            if (elapsedTime > lastWarningTime) {
-                lastWarningTime = elapsedTime;
-                System.out.println("Waited " + elapsedTime + " seconds for file.");
-            }
-        }
-
-        ProcessInfo info = new ProcessInfo();
-        // search for a line with format: key=nnn
-        Pattern pattern = Pattern.compile("(\\w*)=([0-9]+)\\r?\\n");
-        Matcher matcher = pattern.matcher(content);
-        while (matcher.find()) {
-            String key = matcher.group(1);
-            int value  = Integer.parseInt(matcher.group(2));
-            if ("pid".equals(key)) {
-                info.pid = value;
-            } else if ("shutdownPort".equals(key)) {
-                info.shutdownPort = value;
-            }
-        }
-        System.out.println("processInfo.pid:" + info.pid);
-        System.out.println("processInfo.shutdownPort:" + info.shutdownPort);
-        return info;
-    }
-
     /**
      * Read the content of a file.
      * @param file The file to read.
@@ -190,13 +127,4 @@ public class RunnerUtil {
             throw e;
         }
     }
-
-    /**
-     * Helper class with info of the running Application.
-     */
-    public static class ProcessInfo {
-        public int pid = -1;
-        public int shutdownPort = -1;
-    }
-
 }
diff --git a/jdk/test/com/sun/tools/attach/Shutdown.java b/jdk/test/com/sun/tools/attach/Shutdown.java
deleted file mode 100644
index 2361aa405e4..00000000000
--- a/jdk/test/com/sun/tools/attach/Shutdown.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2005, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *
- *
- * Utility used by the unit tests for the attach mechanism. Connects to a
- * given port which triggers the listener to shutdown.
- */
-import java.net.Socket;
-import java.net.InetSocketAddress;
-import java.io.IOException;
-
-public class Shutdown {
-    public static void main(String args[]) throws IOException {
-        int port = Integer.parseInt(args[0]);
-
-        System.out.println("Connecting to port " + port +
-            " to shutdown Application ...");
-
-        Socket s = new Socket();
-        s.connect( new InetSocketAddress(port) );
-        s.close();
-    }
-}
diff --git a/jdk/test/com/sun/tools/attach/StartManagementAgent.java b/jdk/test/com/sun/tools/attach/StartManagementAgent.java
index c760755110e..adb71048f04 100644
--- a/jdk/test/com/sun/tools/attach/StartManagementAgent.java
+++ b/jdk/test/com/sun/tools/attach/StartManagementAgent.java
@@ -40,7 +40,7 @@ import jdk.testlibrary.Utils;
  * @test
  * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
  * @library /lib/testlibrary
- * @run build Application Shutdown
+ * @run build Application jdk.testlibrary.*
  * @run main StartManagementAgent
  */
 
@@ -51,20 +51,17 @@ import jdk.testlibrary.Utils;
  */
 public class StartManagementAgent {
     public static void main(String[] args) throws Throwable {
-        final String pidFile = "StartManagementAgent.Application.pid";
         ProcessThread processThread = null;
-        RunnerUtil.ProcessInfo info = null;
         try {
-            processThread = RunnerUtil.startApplication(pidFile);
-            info = RunnerUtil.readProcessInfo(pidFile);
-            runTests(info.pid);
+            processThread = RunnerUtil.startApplication();
+            runTests(processThread.getPid());
         } catch (Throwable t) {
             System.out.println("StartManagementAgent got unexpected exception: " + t);
             t.printStackTrace();
             throw t;
         } finally {
             // Make sure the Application process is stopped.
-            RunnerUtil.stopApplication(info.shutdownPort, processThread);
+            RunnerUtil.stopApplication(processThread);
         }
     }
 
@@ -104,7 +101,7 @@ public class StartManagementAgent {
 
     private static final int MAX_RETRIES = 10;
 
-    public static void runTests(int pid) throws Exception {
+    public static void runTests(long pid) throws Exception {
         VirtualMachine vm = VirtualMachine.attach(""+pid);
         try {
 
diff --git a/jdk/test/com/sun/tools/attach/TempDirTest.java b/jdk/test/com/sun/tools/attach/TempDirTest.java
index ee240018175..86e3edda742 100644
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java
@@ -38,7 +38,7 @@ import jdk.testlibrary.ProcessThread;
  * @bug 8033104
  * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
  * @library /lib/testlibrary
- * @run build jdk.testlibrary.* Application Shutdown RunnerUtil
+ * @run build jdk.testlibrary.* Application RunnerUtil
  * @run main/timeout=200 TempDirTest
  */
 
@@ -90,22 +90,20 @@ public class TempDirTest {
 
         final String pidFile = "TempDirTest.Application.pid-" + counter++;
         ProcessThread processThread = null;
-        RunnerUtil.ProcessInfo info = null;
         try {
             String[] tmpDirArg = null;
             if (targetTmpDir != null) {
                 tmpDirArg = new String[] {"-Djava.io.tmpdir=" + targetTmpDir};
             }
-            processThread = RunnerUtil.startApplication(pidFile, tmpDirArg);
-            info = RunnerUtil.readProcessInfo(pidFile);
-            launchTests(info.pid, clientTmpDir);
+            processThread = RunnerUtil.startApplication(tmpDirArg);
+            launchTests(processThread.getPid(), clientTmpDir);
         } catch (Throwable t) {
             System.out.println("TempDirTest got unexpected exception: " + t);
             t.printStackTrace();
             throw t;
         } finally {
             // Make sure the Application process is stopped.
-            RunnerUtil.stopApplication(info.shutdownPort, processThread);
+            RunnerUtil.stopApplication(processThread);
         }
 
         elapsedTime = (System.currentTimeMillis() - startTime) / 1000;
@@ -119,7 +117,7 @@ public class TempDirTest {
      * is that we need to modify the class path and
      * the -Djava.io.tmpdir property.
      */
-    private static void launchTests(int pid, Path clientTmpDir) throws Throwable {
+    private static void launchTests(long pid, Path clientTmpDir) throws Throwable {
         final String sep = File.separator;
 
         // Need to add jdk/lib/tools.jar to classpath.
@@ -139,7 +137,7 @@ public class TempDirTest {
                     "-classpath",
                     classpath,
                     "TempDirTest$TestMain",
-                    Integer.toString(pid) });
+                    Long.toString(pid) });
         OutputAnalyzer output = ProcessTools.executeTestJvm(args);
         output.shouldHaveExitValue(0);
     }
diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java
index dc6b32cdbc7..8c0ddb33822 100644
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java
@@ -23,11 +23,11 @@
 
 package jdk.testlibrary;
 
-import static jdk.testlibrary.Asserts.assertNotEquals;
-import static jdk.testlibrary.Asserts.assertTrue;
+import java.io.PrintWriter;
 
-import java.util.List;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
 
 /**
  * The helper class for starting and stopping {@link Process} in a separate thread.
@@ -54,6 +54,29 @@ public class ProcessThread extends TestThread {
         super(new ProcessRunnable(pb), threadName);
     }
 
+
+    /**
+     * Creates a new {@code ProcessThread} object.
+     *
+     * @param threadName The name of thread
+     * @param waitfor A predicate to determine whether the target process has been initialized
+     * @param cmd The string array of program and its arguments to pass to {@link ProcessBuilder}
+     */
+    public ProcessThread(String threadName, Predicate<String> waitfor, String... cmd) {
+        super(new ProcessRunnable(new ProcessBuilder(cmd), threadName, waitfor), threadName);
+    }
+
+    /**
+     * Creates a new {@code ProcessThread} object.
+     *
+     * @param threadName The name of thread.
+     * @param waitfor A predicate to determine whether the target process has been initialized
+     * @param pb The ProcessBuilder to execute.
+     */
+    public ProcessThread(String threadName, Predicate<String> waitfor, ProcessBuilder pb) {
+        super(new ProcessRunnable(pb, threadName, waitfor), threadName);
+    }
+
     /**
      * Stops {@link Process} started by {@code ProcessRunnable}.
      *
@@ -70,6 +93,18 @@ public class ProcessThread extends TestThread {
         return ((ProcessRunnable) getRunnable()).getOutput();
     }
 
+    /**
+    * Returns the PID associated with this process thread
+    * @return The PID associated with this process thread
+    */
+    public long getPid() throws InterruptedException {
+        return ((ProcessRunnable)getRunnable()).getPid();
+    }
+
+    public void sendMessage(String message) throws InterruptedException {
+        ((ProcessRunnable)getRunnable()).sendMessage(message);
+    }
+
     /**
      * {@link Runnable} interface for starting and stopping {@link Process}.
      */
@@ -79,6 +114,8 @@ public class ProcessThread extends TestThread {
         private final CountDownLatch latch;
         private volatile Process process;
         private volatile OutputAnalyzer output;
+        private final Predicate<String> waitfor;
+        private final String name;
 
         /**
          * Creates a new {@code ProcessRunnable} object.
@@ -86,9 +123,21 @@ public class ProcessThread extends TestThread {
          * @param pb The {@link ProcessBuilder} to run.
          */
         public ProcessRunnable(ProcessBuilder pb) {
-            super();
+            this(pb, "", null);
+        }
+
+        /**
+         * Creates a new {@code ProcessRunnable} object.
+         *
+         * @param pb The {@link ProcessBuilder} to run.
+         * @param name An optional process name; may be null
+         * @param waitfor A predicate to determine whether the target process has been initialized; may be null
+         */
+        public ProcessRunnable(ProcessBuilder pb, String name, Predicate<String> waitfor) {
             this.processBuilder = pb;
             this.latch = new CountDownLatch(1);
+            this.name = name;
+            this.waitfor = waitfor;
         }
 
         /**
@@ -99,7 +148,9 @@ public class ProcessThread extends TestThread {
          */
         @Override
         public void xrun() throws Throwable {
-            this.process = processBuilder.start();
+            this.process = ProcessTools.startProcess(
+                name, processBuilder, waitfor, -1, TimeUnit.SECONDS
+            );
             // Release when process is started
             latch.countDown();
 
@@ -138,6 +189,26 @@ public class ProcessThread extends TestThread {
         public OutputAnalyzer getOutput() {
             return output;
         }
+
+        /**
+         * Returns the PID associated with this process runnable
+         * @return The PID associated with this process runnable
+         */
+        public long getPid() throws InterruptedException {
+            return getProcess().getPid();
+        }
+
+        public void sendMessage(String message) throws InterruptedException {
+            try (PrintWriter pw = new PrintWriter(this.getProcess().getOutputStream())) {
+                pw.println(message);
+                pw.flush();
+            }
+        }
+
+        private Process getProcess() throws InterruptedException {
+            latch.await();
+            return process;
+        }
     }
 
 }
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java
index 9745169b639..ac0911a52ca 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java
@@ -122,7 +122,6 @@ public class CustomLauncherTest {
             );
 
             final AtomicReference<String> port = new AtomicReference<>();
-            final AtomicReference<String> pid = new AtomicReference<>();
 
             serverPrc = ProcessTools.startProcess(
                 "Launcher",
@@ -130,12 +129,10 @@ public class CustomLauncherTest {
                 (String line) -> {
                     if (line.startsWith("port:")) {
                          port.set(line.split("\\:")[1]);
-                     } else  if (line.startsWith("pid:")) {
-                         pid.set(line.split("\\:")[1]);
-                     } else if (line.startsWith("waiting")) {
+                    } else if (line.startsWith("waiting")) {
                          return true;
-                     }
-                     return false;
+                    }
+                    return false;
                 },
                 5,
                 TimeUnit.SECONDS
@@ -143,7 +140,7 @@ public class CustomLauncherTest {
 
             System.out.println("Attaching test manager:");
             System.out.println("=========================");
-            System.out.println("  PID           : " + pid.get());
+            System.out.println("  PID           : " + serverPrc.getPid());
             System.out.println("  shutdown port : " + port.get());
 
             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -156,7 +153,7 @@ public class CustomLauncherTest {
                     File.separator +
                     "tools.jar",
                 "TestManager",
-                pid.get(),
+                String.valueOf(serverPrc.getPid()),
                 port.get(),
                 "true"
             );
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
index b0d44c34325..87ab6a9245e 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
@@ -109,7 +109,6 @@ public class LocalManagementTest {
         Process serverPrc = null, clientPrc = null;
         try {
             final AtomicReference<String> port = new AtomicReference<>();
-            final AtomicReference<String> pid = new AtomicReference<>();
 
             serverPrc = ProcessTools.startProcess(
                 "TestApplication(" + testId + ")",
@@ -117,12 +116,10 @@ public class LocalManagementTest {
                 (String line) -> {
                     if (line.startsWith("port:")) {
                          port.set(line.split("\\:")[1]);
-                     } else  if (line.startsWith("pid:")) {
-                         pid.set(line.split("\\:")[1]);
-                     } else if (line.startsWith("waiting")) {
-                         return true;
-                     }
-                     return false;
+                    } else if (line.startsWith("waiting")) {
+                        return true;
+                    }
+                    return false;
                 },
                 5,
                 TimeUnit.SECONDS
@@ -130,7 +127,7 @@ public class LocalManagementTest {
 
             System.out.println("Attaching test manager:");
             System.out.println("=========================");
-            System.out.println("  PID           : " + pid.get());
+            System.out.println("  PID           : " + serverPrc.getPid());
             System.out.println("  shutdown port : " + port.get());
 
             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -143,7 +140,7 @@ public class LocalManagementTest {
                     File.separator +
                     "tools.jar",
                 "TestManager",
-                pid.get(),
+                String.valueOf(serverPrc.getPid()),
                 port.get(),
                 "true"
             );
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/TestApplication.java b/jdk/test/sun/management/jmxremote/bootstrap/TestApplication.java
index 5d6ca2b6a27..e4fdc439538 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/TestApplication.java
+++ b/jdk/test/sun/management/jmxremote/bootstrap/TestApplication.java
@@ -26,16 +26,13 @@
  *
  * A test "application" used by unit tests -
  *   LocalManagementTest.java, CustomLauncherTest.java.
- * This application binds to some random port, prints its pid and
- * the port number to standard output, waits for somebody to connect,
- * and then shuts down.
+ * This application binds to some random port, prints the port number
+ * to standard output, waits for somebody to connect, and then shuts down.
  */
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
 
-import jdk.testlibrary.ProcessTools;
-
 public class TestApplication {
     public static void main(String[] args) throws IOException {
         // Some tests require the application to exit immediately
@@ -47,16 +44,8 @@ public class TestApplication {
         ServerSocket ss = new ServerSocket(0);
         int port = ss.getLocalPort();
 
-        int pid = -1;
-        try {
-            pid = ProcessTools.getProcessId();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
         // signal test that we are started - do not remove these lines!!
         System.out.println("port:" + port);
-        System.out.println("pid:" + pid);
         System.out.println("waiting for the manager ...");
         System.out.flush();
 
diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java
index e6b1f43a752..5a04a6d718b 100644
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java
@@ -31,7 +31,6 @@ public class JMXStartStopDoSomething {
     }
 
     public static void main(String args[]) throws Exception {
-        System.out.println("pid:" + ProcessTools.getProcessId());
         System.out.println("main enter");
         System.out.flush();
         doSomething();
diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
index 4a058cb1f76..2f53118e6b9 100644
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
@@ -134,13 +134,13 @@ public class JMXStartStopTest {
     }
 
 
-    private static void testConnectLocal(int pid)
+    private static void testConnectLocal(long pid)
     throws Exception {
 
         String jmxUrlStr = null;
 
         try {
-            jmxUrlStr = sun.management.ConnectorAddressLink.importFrom(pid);
+            jmxUrlStr = sun.management.ConnectorAddressLink.importFrom((int)pid);
             dbg_print("Local Service URL: " +jmxUrlStr);
             if ( jmxUrlStr == null ) {
                 throw new Exception("No Service URL. Local agent not started?");
@@ -318,7 +318,7 @@ public class JMXStartStopTest {
         private final ProcessBuilder pb;
         private final String name;
         private final AtomicBoolean started = new AtomicBoolean(false);
-        private volatile int pid = -1;
+        private volatile long pid = -1;
 
         public Something(ProcessBuilder pb, String name) {
             this.pb = pb;
@@ -331,15 +331,11 @@ public class JMXStartStopTest {
                     p = ProcessTools.startProcess(
                         "JMXStartStopDoSomething",
                         pb,
-                        (line) -> {
-                            if (line.toLowerCase().startsWith("pid:")) {
-                                pid = Integer.parseInt(line.split("\\:")[1]);
-                            }
-                            return line.equals("main enter");
-                        },
+                        (line) -> line.equals("main enter"),
                         5,
                         TimeUnit.SECONDS
                     );
+                    pid = p.getPid();
                 } catch (TimeoutException e) {
                     p.destroy();
                     p.waitFor();
@@ -348,7 +344,7 @@ public class JMXStartStopTest {
             }
         }
 
-        public int getPid() {
+        public long getPid() {
             return pid;
         }
 
diff --git a/jdk/test/sun/tools/jstat/JStatInterval.java b/jdk/test/sun/tools/jstat/JStatInterval.java
index 8c1203be4c8..4a67ba7b9dc 100644
--- a/jdk/test/sun/tools/jstat/JStatInterval.java
+++ b/jdk/test/sun/tools/jstat/JStatInterval.java
@@ -42,14 +42,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class JStatInterval {
-    private static final String PID = "PID";
     private static final String READY = "READY";
     private static final String ERROR = "!ERROR";
 
     public static class Application {
         public static void main(String[] args) {
             try {
-                System.out.println(PID + ":" + ProcessTools.getProcessId());
                 System.out.println(READY);
                 System.out.flush();
                 int exitCode = System.in.read();
@@ -69,15 +67,12 @@ public class JStatInterval {
             "-XX:+UsePerfData",
             Application.class.getName()
         );
-        AtomicInteger pid = new AtomicInteger(-1);
         AtomicBoolean error = new AtomicBoolean(false);
         Process app = ProcessTools.startProcess(
             "application",
             pb,
             line -> {
-                if (line.startsWith(PID)) {
-                    pid.set(Integer.parseInt(line.split("\\:")[1]));
-                } else if (line.equals(READY)) {
+                if (line.equals(READY)) {
                     return true;
                 } else if (line.equals(ERROR)) {
                     error.set(true);
@@ -92,7 +87,7 @@ public class JStatInterval {
             throw new Error("Unable to start the monitored application.");
         }
 
-        String pidStr = String.valueOf(pid.get());
+        String pidStr = String.valueOf(app.getPid());
         JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jstat");
         l.addToolArg("-compiler");
         l.addToolArg(pidStr);
diff --git a/jdk/test/sun/tools/jstatd/JstatdTest.java b/jdk/test/sun/tools/jstatd/JstatdTest.java
index 0c003cfcb5e..5d01eb2397d 100644
--- a/jdk/test/sun/tools/jstatd/JstatdTest.java
+++ b/jdk/test/sun/tools/jstatd/JstatdTest.java
@@ -22,12 +22,12 @@
  */
 
 import java.io.File;
+import java.io.IOException;
 import java.net.UnknownHostException;
 import java.rmi.RemoteException;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 import java.util.Arrays;
-import java.util.regex.Pattern;
 
 import static jdk.testlibrary.Asserts.*;
 import jdk.testlibrary.JDKToolLauncher;
@@ -69,7 +69,7 @@ public final class JstatdTest {
     private boolean useDefaultPort = true;
     private String port;
     private String serverName;
-    private String jstatdPid;
+    private Long jstatdPid;
     private boolean withExternalRegistry = false;
 
     public void setServerName(String serverName) {
@@ -84,67 +84,26 @@ public final class JstatdTest {
         this.withExternalRegistry = withExternalRegistry;
     }
 
-    /**
-     * Parse pid from jps output
-     */
-    private String parsePid(String tool, OutputAnalyzer output) throws Exception {
-        String[] lines = output.getOutput().split(Utils.NEW_LINE);
-        String pid = null;
-        int count = 0;
-        String processName = tool;
-        if (tool == "rmiregistry") {
-            processName = "registryimpl";
-        }
+    private Long waitOnTool(ProcessThread thread) throws Throwable {
+        long pid = thread.getPid();
 
-        Pattern toolInJpsPattern =
-                Pattern.compile("^\\d+\\s{1}" + processName + "\\s{1}.*-dparent\\.pid\\." + ProcessTools.getProcessId() + ".*");
-        for (String line : lines) {
-            if (toolInJpsPattern.matcher(line.toLowerCase()).matches()) {
-                pid = line.split(" ")[0];
-                count++;
+        Throwable t = thread.getUncaught();
+        if (t != null) {
+            if (t.getMessage().contains(
+                    "java.rmi.server.ExportException: Port already in use")) {
+                System.out.println("Port already in use. Trying to restart with a new one...");
+                Thread.sleep(100);
+                return null;
+            } else {
+                // Something unexpected has happened
+                throw new Throwable(t);
             }
         }
-        if (count > 1) {
-            throw new Exception("Expected one " + tool
-                    + " process, got " + count + ". Test will be canceled.");
-        }
 
+        System.out.println(thread.getName() + " pid: " + pid);
         return pid;
     }
 
-    private String getToolPid(String tool)
-            throws Exception {
-        OutputAnalyzer output = runJps();
-        return parsePid(tool, output);
-    }
-
-    private String waitOnTool(String tool, TestThread thread) throws Throwable {
-        while (true) {
-            String pid = getToolPid(tool);
-
-            if (pid != null) {
-                System.out.println(tool + " pid: " + pid);
-                return pid;
-            }
-
-            Throwable t = thread.getUncaught();
-            if (t != null) {
-                if (t.getMessage().contains(
-                        "java.rmi.server.ExportException: Port already in use")) {
-                    System.out.println("Port already in use. Trying to restart with a new one...");
-                    Thread.sleep(100);
-                    return null;
-                } else {
-                    // Something unexpected has happened
-                    throw new Throwable(t);
-                }
-            }
-
-            System.out.println("Waiting until " + tool + " is running...");
-            Thread.sleep(100);
-        }
-    }
-
     private void log(String caption, String... cmd) {
         System.out.println(Utils.NEW_LINE + caption + ":");
         System.out.println(Arrays.toString(cmd).replace(",", ""));
@@ -180,12 +139,29 @@ public final class JstatdTest {
         log("Start jps", cmd);
 
         ProcessBuilder processBuilder = new ProcessBuilder(cmd);
-        OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
+        OutputAnalyzer output = waitForJstatdRMI(processBuilder);
         System.out.println(output.getOutput());
 
         return output;
     }
 
+    private OutputAnalyzer waitForJstatdRMI(ProcessBuilder pb) throws IOException, InterruptedException {
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+        while (output.getExitValue() != 0) {
+            String out = output.getOutput();
+
+            if (out.contains("RMI Registry not available") ||
+                out.contains("RMI Server JStatRemoteHost not available")) {
+                Thread.sleep(100);
+                output = new OutputAnalyzer(pb.start());
+            } else {
+                output.shouldHaveExitValue(0);
+            }
+        }
+        return output;
+    }
+
     /**
      * Verifies output form jps contains pids and programs' name information.
      * The function will discard any lines that come before the first line with pid.
@@ -235,7 +211,7 @@ public final class JstatdTest {
         log("Start jstat", cmd);
 
         ProcessBuilder processBuilder = new ProcessBuilder(cmd);
-        OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
+        OutputAnalyzer output = waitForJstatdRMI(processBuilder);
         System.out.println(output.getOutput());
 
         return output;
@@ -323,7 +299,7 @@ public final class JstatdTest {
         try {
             jstatdThread.start();
             // Make sure jstatd is up and running
-            jstatdPid = waitOnTool("jstatd", jstatdThread);
+            jstatdPid = waitOnTool(jstatdThread);
             if (jstatdPid == null) {
                 // The port is already in use. Cancel and try with new one.
                 jstatdThread.stopProcess();
@@ -344,7 +320,7 @@ public final class JstatdTest {
         try {
             while (jstatdThread == null) {
                 if (!useDefaultPort || withExternalRegistry) {
-                    port = Integer.toString(Utils.getFreePort());
+                    port = String.valueOf(Utils.getFreePort());
                 }
 
                 if (withExternalRegistry) {
-- 
GitLab


From 829524e7d6d976c926cdb1ccd6aa6570be31dfab Mon Sep 17 00:00:00 2001
From: Staffan Larsen <sla@openjdk.org>
Date: Tue, 1 Jul 2014 16:08:45 +0200
Subject: [PATCH 162/192] 8048710: Use ServiceLoader for the jvmstat protocols

Reviewed-by: alanb
---
 .../{remote => }/BufferedMonitoredVm.java     |   2 +-
 .../sun.jvmstat.monitor.MonitoredHostService  |   3 +
 .../sun/jvmstat/monitor/MonitoredHost.java    | 105 ++++--------------
 .../jvmstat/monitor/MonitoredHostService.java |  48 ++++++++
 .../file/MonitoredHostFileService.java        |  46 ++++++++
 .../local/MonitoredHostLocalService.java      |  46 ++++++++
 .../protocol/rmi/MonitoredHostRmiService.java |  45 ++++++++
 .../jdk/testlibrary/ProcessTools.java         |   3 +
 8 files changed, 215 insertions(+), 83 deletions(-)
 rename jdk/src/share/classes/sun/jvmstat/monitor/{remote => }/BufferedMonitoredVm.java (98%)
 create mode 100644 jdk/src/share/classes/sun/jvmstat/monitor/META-INF/services/sun.jvmstat.monitor.MonitoredHostService
 create mode 100644 jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHostService.java
 create mode 100644 jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/file/MonitoredHostFileService.java
 create mode 100644 jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostLocalService.java
 create mode 100644 jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService.java

diff --git a/jdk/src/share/classes/sun/jvmstat/monitor/remote/BufferedMonitoredVm.java b/jdk/src/share/classes/sun/jvmstat/monitor/BufferedMonitoredVm.java
similarity index 98%
rename from jdk/src/share/classes/sun/jvmstat/monitor/remote/BufferedMonitoredVm.java
rename to jdk/src/share/classes/sun/jvmstat/monitor/BufferedMonitoredVm.java
index fbbfb80e1aa..56e9b16aadd 100644
--- a/jdk/src/share/classes/sun/jvmstat/monitor/remote/BufferedMonitoredVm.java
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/BufferedMonitoredVm.java
@@ -23,7 +23,7 @@
  * questions.
  */
 
-package sun.jvmstat.monitor.remote;
+package sun.jvmstat.monitor;
 
 import sun.jvmstat.monitor.*;
 
diff --git a/jdk/src/share/classes/sun/jvmstat/monitor/META-INF/services/sun.jvmstat.monitor.MonitoredHostService b/jdk/src/share/classes/sun/jvmstat/monitor/META-INF/services/sun.jvmstat.monitor.MonitoredHostService
new file mode 100644
index 00000000000..b106c0fc9a9
--- /dev/null
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/META-INF/services/sun.jvmstat.monitor.MonitoredHostService
@@ -0,0 +1,3 @@
+sun.jvmstat.perfdata.monitor.protocol.file.MonitoredHostFileService
+sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostLocalService
+sun.jvmstat.perfdata.monitor.protocol.rmi.MonitoredHostRmiService
diff --git a/jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHost.java b/jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHost.java
index dabd2fd0f44..037f49e53f6 100644
--- a/jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHost.java
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHost.java
@@ -25,9 +25,11 @@
 
 package sun.jvmstat.monitor;
 
-import java.util.*;
-import java.net.*;
-import java.lang.reflect.*;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.Set;
 
 import sun.jvmstat.monitor.event.HostListener;
 
@@ -51,31 +53,6 @@ public abstract class MonitoredHost {
     private static Map<HostIdentifier, MonitoredHost> monitoredHosts =
                 new HashMap<HostIdentifier, MonitoredHost>();
 
-    /*
-     * The monitoring implementation override mechanism. The value of
-     * this property is used as the class name for the concrete MonitoredHost
-     * subclass that implements the monitoring APIs.  Setting this property
-     * will cause the remaining override mechanisms to be ignored. When
-     * this mechanism is used, the HostIdentifier scheme name, which
-     * indicates the communications protocol, is not used to locate a
-     * the protocol specific package. However, the HostIdentifier is
-     * still passed to the corresponding single arg constructor.
-     * This property is not expected to be set in normal circumstances.
-     */
-    private static final String IMPL_OVERRIDE_PROP_NAME =
-            "sun.jvmstat.monitor.MonitoredHost";
-
-    /*
-     * The monitoring package name override mechanism. The value
-     * the this property is used as base package name for the
-     * monitoring implementation package. This property is not
-     * expected to be set under normal circumstances.
-     */
-    private static final String IMPL_PKG_PROP_NAME =
-            "sun.jvmstat.monitor.package";
-    private static final String IMPL_PACKAGE =
-            System.getProperty(IMPL_PKG_PROP_NAME, "sun.jvmstat.perfdata");
-
     /*
      * The default optimized local protocol override mechanism. The value
      * of this property is used to construct the default package name
@@ -100,15 +77,6 @@ public abstract class MonitoredHost {
     private static final String REMOTE_PROTOCOL =
             System.getProperty(REMOTE_PROTOCOL_PROP_NAME, "rmi");
 
-    /*
-     * The default class name of the MonitoredHost implementation subclass.
-     * There is no override mechanism for this variable, other than the
-     * IMPL_OVERRIDE_PROP_NAME override, which is larger in scope. A concrete
-     * instance of this class is expected to be found in:
-     *     <IMPL_PACKAGE>.monitor.protocol.<protocol>.<MONITORED_HOST_CLASS>
-     */
-    private static final String MONITORED_HOST_CLASS = "MonitoredHostProvider";
-
     /**
      * The HostIdentifier for this MonitoredHost instance.
      */
@@ -165,6 +133,13 @@ public abstract class MonitoredHost {
         return getMonitoredHost(hostId);
     }
 
+
+    /*
+     * Load the MonitoredHostServices
+     */
+    private static ServiceLoader<MonitoredHostService> monitoredHostServiceLoader =
+        ServiceLoader.load(MonitoredHostService.class, MonitoredHostService.class.getClassLoader());
+
     /**
      * Factory method to construct a MonitoredHost instance to manage the
      * connection to the host indicated by <tt>hostId</tt>.
@@ -177,11 +152,6 @@ public abstract class MonitoredHost {
      */
     public static MonitoredHost getMonitoredHost(HostIdentifier hostId)
                   throws MonitorException {
-        /*
-         * determine the class name to load. If the system property is set,
-         * use the indicated class. otherwise, use the default class.
-         */
-        String classname = System.getProperty(IMPL_OVERRIDE_PROP_NAME);
         MonitoredHost mh = null;
 
         synchronized(monitoredHosts) {
@@ -197,50 +167,21 @@ public abstract class MonitoredHost {
 
         hostId = resolveHostId(hostId);
 
-        if (classname == null) {
-            // construct the class name
-            classname = IMPL_PACKAGE + ".monitor.protocol."
-                        + hostId.getScheme() + "." + MONITORED_HOST_CLASS;
+        for (MonitoredHostService mhs : monitoredHostServiceLoader) {
+            if (mhs.getScheme().equals(hostId.getScheme())) {
+                mh = mhs.getMonitoredHost(hostId);
+            }
         }
 
-        try {
-            // run the constructor taking a single String parameter.
-            Class<?> c = Class.forName(classname);
-
-            Constructor cons = c.getConstructor(
-                new Class[] { hostId.getClass() }
-            );
-
-            mh = (MonitoredHost)cons.newInstance(new Object[] { hostId } );
+        if (mh == null) {
+            throw new IllegalArgumentException("Could not find MonitoredHost for scheme: " + hostId.getScheme());
+        }
 
-            synchronized(monitoredHosts) {
-                monitoredHosts.put(mh.hostId, mh);
-            }
-            return mh;
-        } catch (ClassNotFoundException e) {
-            // from Class.forName();
-            throw new IllegalArgumentException("Could not find " + classname
-                                               + ": " + e.getMessage(), e);
-        } catch (NoSuchMethodException e) {
-            // from Class.getConstructor();
-            throw new IllegalArgumentException(
-                "Expected constructor missing in " + classname + ": "
-                + e.getMessage(), e);
-        } catch (IllegalAccessException e) {
-            // from Constructor.newInstance()
-            throw new IllegalArgumentException(
-                "Unexpected constructor access in " + classname + ": "
-                + e.getMessage(), e);
-        } catch (InstantiationException e) {
-            throw new IllegalArgumentException(classname + "is abstract: "
-                                               + e.getMessage(), e);
-        } catch (InvocationTargetException e) {
-            Throwable cause = e.getCause();
-            if (cause instanceof MonitorException) {
-                throw (MonitorException)cause;
-            }
-            throw new RuntimeException("Unexpected exception", e);
+        synchronized(monitoredHosts) {
+            monitoredHosts.put(mh.hostId, mh);
         }
+
+        return mh;
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHostService.java b/jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHostService.java
new file mode 100644
index 00000000000..27607a990cd
--- /dev/null
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/MonitoredHostService.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.monitor;
+
+public interface MonitoredHostService {
+
+    /**
+     * Construct a MonitoredHost instance to manage the
+     * connection to the host indicated by <tt>hostId</tt>.
+     *
+     * @param hostId the identifier for the target host.
+     * @return MonitoredHost - The MonitoredHost object needed to attach to
+     *                         the target host.
+     *
+     * @throws MonitorException Thrown if monitoring errors occur.
+     */
+    public MonitoredHost getMonitoredHost(HostIdentifier hostId) throws MonitorException;
+
+    /**
+     * Get the scheme that this service supports.
+     *
+     * @return scheme name
+     */
+    public String getScheme();
+}
diff --git a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/file/MonitoredHostFileService.java b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/file/MonitoredHostFileService.java
new file mode 100644
index 00000000000..205fda6ff9a
--- /dev/null
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/file/MonitoredHostFileService.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.perfdata.monitor.protocol.file;
+
+import sun.jvmstat.monitor.HostIdentifier;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredHostService;
+
+public final class MonitoredHostFileService implements MonitoredHostService {
+
+    @Override
+    public MonitoredHost getMonitoredHost(HostIdentifier hostId)
+            throws MonitorException {
+        return new MonitoredHostProvider(hostId);
+    }
+
+    @Override
+    public String getScheme() {
+        return "file";
+    }
+
+}
diff --git a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostLocalService.java b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostLocalService.java
new file mode 100644
index 00000000000..aa93b486e77
--- /dev/null
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostLocalService.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.perfdata.monitor.protocol.local;
+
+import sun.jvmstat.monitor.HostIdentifier;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredHostService;
+
+public final class MonitoredHostLocalService implements MonitoredHostService {
+
+    @Override
+    public MonitoredHost getMonitoredHost(HostIdentifier hostId)
+            throws MonitorException {
+        return new MonitoredHostProvider(hostId);
+    }
+
+    @Override
+    public String getScheme() {
+        return "local";
+    }
+
+}
diff --git a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService.java b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService.java
new file mode 100644
index 00000000000..bbaa10932a6
--- /dev/null
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostRmiService.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.perfdata.monitor.protocol.rmi;
+
+import sun.jvmstat.monitor.HostIdentifier;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredHostService;
+
+public final class MonitoredHostRmiService implements MonitoredHostService {
+
+    @Override
+    public MonitoredHost getMonitoredHost(HostIdentifier hostId) throws MonitorException {
+        return new MonitoredHostProvider(hostId);
+    }
+
+    @Override
+    public String getScheme() {
+        return "rmi";
+    }
+
+}
diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
index c949e0f6c11..042c8c65e0c 100644
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
@@ -41,6 +41,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.function.Predicate;
 import java.util.function.Consumer;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
 
 import sun.management.VMManagement;
 
@@ -135,6 +137,7 @@ public final class ProcessTools {
                                        long timeout,
                                        TimeUnit unit)
     throws IOException, InterruptedException, TimeoutException {
+        System.out.println("["+name+"]:" + processBuilder.command().stream().collect(Collectors.joining(" ")));
         Process p = processBuilder.start();
         StreamPumper stdout = new StreamPumper(p.getInputStream());
         StreamPumper stderr = new StreamPumper(p.getErrorStream());
-- 
GitLab


From 19c07ee15b6070a5af92c112d72e17c4c9c56d37 Mon Sep 17 00:00:00 2001
From: Sean Coffey <coffeys@openjdk.org>
Date: Tue, 1 Jul 2014 16:51:44 +0100
Subject: [PATCH 163/192] 7095856: OutputStreamHook doesn't handle null values

Reviewed-by: lancea, msheppar
---
 .../corba/se/impl/io/CustomOutputStream.java  | 192 ++++++++++++++++++
 .../corba/se/impl/io/HookPutFieldsTest.java   |  42 ++++
 2 files changed, 234 insertions(+)
 create mode 100644 jdk/test/com/sun/corba/se/impl/io/CustomOutputStream.java
 create mode 100644 jdk/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java

diff --git a/jdk/test/com/sun/corba/se/impl/io/CustomOutputStream.java b/jdk/test/com/sun/corba/se/impl/io/CustomOutputStream.java
new file mode 100644
index 00000000000..4a057575def
--- /dev/null
+++ b/jdk/test/com/sun/corba/se/impl/io/CustomOutputStream.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.Serializable;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.CORBA_2_3.portable.InputStream;
+
+public class CustomOutputStream extends OutputStream {
+
+    @Override
+    public void write_value(Serializable value, Class clz) {
+    }
+
+    @Override
+    public InputStream create_input_stream() {
+        return null;
+    }
+
+    @Override
+    public void write_boolean(boolean value) {
+    }
+
+    @Override
+    public void write_char(char value) {
+    }
+
+    @Override
+    public void write_wchar(char value) {
+    }
+
+    @Override
+    public void write_octet(byte value) {
+    }
+
+    @Override
+    public void write_short(short value) {
+    }
+
+    @Override
+    public void write_ushort(short value) {
+    }
+
+    @Override
+    public void write_long(int value) {
+    }
+
+    @Override
+    public void write_ulong(int value) {
+    }
+
+    @Override
+    public void write_longlong(long value) {
+    }
+
+    @Override
+    public void write_ulonglong(long value) {
+    }
+
+    @Override
+    public void write_float(float value) {
+    }
+
+    @Override
+    public void write_double(double value) {
+    }
+
+    @Override
+    public void write_string(String value) {
+    }
+
+    @Override
+    public void write_wstring(String value) {
+    }
+
+    @Override
+    public void write_boolean_array(boolean[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_char_array(char[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_wchar_array(char[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_octet_array(byte[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_short_array(short[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_ushort_array(short[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_long_array(int[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_ulong_array(int[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_longlong_array(long[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_ulonglong_array(long[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_float_array(float[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_double_array(double[] value, int offset,
+            int length) {
+    }
+
+    @Override
+    public void write_Object(org.omg.CORBA.Object value) {
+    }
+
+    @Override
+    public void write_TypeCode(TypeCode value) {
+    }
+
+    @Override
+    public void write_any(Any value) {
+    }
+
+    @Override
+    public void write_Principal(Principal value) {
+    }
+
+    @Override
+    public void write(int b) throws java.io.IOException {
+    }
+
+    @Override
+    public void write_fixed(java.math.BigDecimal value) {
+    }
+
+    @Override
+    public void write_Context(org.omg.CORBA.Context ctx,
+            org.omg.CORBA.ContextList contexts) {
+    }
+
+    @Override
+    public org.omg.CORBA.ORB orb() {
+        return null;
+    }
+}
diff --git a/jdk/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java b/jdk/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java
new file mode 100644
index 00000000000..cd7c50bdd37
--- /dev/null
+++ b/jdk/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7095856
+ * @summary OutputStreamHook doesn't handle null values
+ */
+
+import java.net.InetAddress;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+public class HookPutFieldsTest  {
+
+    public static void main(String[] args ) throws Exception {
+        CustomOutputStream os = new CustomOutputStream();
+        InetAddress a = InetAddress.getByAddress(null, new byte[] {1,2,3,4});
+        ValueHandler vh = Util.createValueHandler();
+        vh.writeValue(os, a);
+    }
+}
-- 
GitLab


From 3962277490e8a93ae691f2f36ea2c22641f669f1 Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik <jbachorik@openjdk.org>
Date: Tue, 1 Jul 2014 17:58:14 +0200
Subject: [PATCH 164/192] 8044427: [test]
 sun/management/jmxremote/startstop/JMXStartStopTest times out intermittently
 on Solaris/Sparcv9

Reviewed-by: sla
---
 .../sun/management/jmxremote/startstop/JMXStartStopTest.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
index 2f53118e6b9..046da3a46eb 100644
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
@@ -40,7 +40,6 @@ import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
-import java.util.function.IntUnaryOperator;
 
 import javax.management.*;
 import javax.management.remote.*;
@@ -54,7 +53,7 @@ import jdk.testlibrary.JDKToolLauncher;
  * @bug 7110104
  * @library /lib/testlibrary
  * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething
- * @run main/othervm JMXStartStopTest
+ * @run main/othervm/timeout=600 JMXStartStopTest
  * @summary Makes sure that enabling/disabling the management agent through
  *          JCMD achieves the desired results
  */
-- 
GitLab


From 4da668378d30a0b749e0138efbc7a3c1efa376bf Mon Sep 17 00:00:00 2001
From: Otavio Santana <otaviojava@java.net>
Date: Tue, 1 Jul 2014 15:12:59 +0100
Subject: [PATCH 165/192] 8048267: Replace uses of 'new Long()' with
 appropriate alternative across core classes

Reviewed-by: chegar, psandoz, prappo
---
 jdk/src/macosx/classes/sun/font/CStrike.java  |  2 +-
 .../imageio/plugins/gif/GIFImageReader.java   |  2 +-
 .../imageio/plugins/jpeg/JPEGImageReader.java |  6 +--
 .../com/sun/jmx/snmp/SnmpCounter64.java       |  2 +-
 .../classes/com/sun/jmx/snmp/SnmpInt.java     |  2 +-
 .../com/sun/jmx/snmp/agent/SnmpMibGroup.java  |  4 +-
 .../jmx/snmp/daemon/SnmpAdaptorServer.java    | 38 +++++++++----------
 .../com/sun/jndi/ldap/LdapPoolManager.java    |  2 +-
 .../sun/jndi/ldap/NamingEventNotifier.java    |  8 ++--
 .../auth/SolarisNumericGroupPrincipal.java    |  4 +-
 .../auth/SolarisNumericUserPrincipal.java     |  4 +-
 .../auth/UnixNumericGroupPrincipal.java       |  4 +-
 .../auth/UnixNumericUserPrincipal.java        |  4 +-
 .../example/debug/tty/BreakpointSpec.java     |  4 +-
 .../sun/tools/example/debug/tty/Commands.java |  6 +--
 .../internal/model/JavaLazyReadObject.java    |  2 +-
 .../tools/hat/internal/model/Snapshot.java    |  2 +-
 .../hat/internal/parser/HprofReader.java      | 12 +++---
 .../hat/internal/server/RefsByTypeQuery.java  |  8 ++--
 .../com/sun/tools/jdi/VirtualMachineImpl.java | 10 ++---
 .../awt/image/renderable/ParameterBlock.java  |  4 +-
 .../classes/java/text/DecimalFormat.java      |  2 +-
 .../javax/management/loading/MLet.java        |  2 +-
 .../modelmbean/RequiredModelMBean.java        |  4 +-
 .../swing/plaf/basic/BasicLookAndFeel.java    |  2 +-
 .../perfdata/monitor/PerfLongMonitor.java     |  2 +-
 .../sun/management/GcInfoCompositeData.java   |  8 ++--
 .../classes/sun/management/HotspotThread.java |  2 +-
 .../MemoryNotifInfoCompositeData.java         |  2 +-
 .../management/MemoryUsageCompositeData.java  |  8 ++--
 .../management/ThreadInfoCompositeData.java   | 12 +++---
 .../counter/perf/LongCounterSnapshot.java     |  2 +-
 .../counter/perf/PerfLongCounter.java         |  2 +-
 .../snmp/jvminstr/JvmClassLoadingImpl.java    |  6 +--
 .../snmp/jvminstr/JvmCompilationImpl.java     |  2 +-
 .../snmp/jvminstr/JvmMemGCEntryImpl.java      |  4 +-
 .../snmp/jvminstr/JvmMemPoolEntryImpl.java    | 30 +++++++--------
 .../snmp/jvminstr/JvmMemoryImpl.java          | 22 +++++------
 .../snmp/jvminstr/JvmRuntimeImpl.java         |  4 +-
 .../jvminstr/JvmThreadInstanceEntryImpl.java  | 12 +++---
 .../snmp/jvminstr/JvmThreadingImpl.java       | 10 ++---
 jdk/src/share/classes/sun/nio/ch/Util.java    |  4 +-
 .../sun/security/action/GetLongAction.java    |  2 +-
 .../security/jgss/wrapper/GSSNameElement.java |  2 +-
 .../security/krb5/internal/KerberosTime.java  |  7 ++--
 .../sun/security/tools/keytool/Main.java      |  2 +-
 .../sun/tools/java/BinaryConstantPool.java    |  2 +-
 .../sun/tools/jconsole/MemoryPoolProxy.java   |  4 +-
 .../sun/tools/tree/BitNotExpression.java      |  2 +-
 .../sun/tools/tree/IncDecExpression.java      |  2 +-
 .../sun/tools/tree/LongExpression.java        |  4 +-
 .../util/prefs/FileSystemPreferences.java     |  2 +-
 .../sun/awt/X11/XFocusProxyWindow.java        |  5 ++-
 53 files changed, 153 insertions(+), 153 deletions(-)

diff --git a/jdk/src/macosx/classes/sun/font/CStrike.java b/jdk/src/macosx/classes/sun/font/CStrike.java
index af4f8754cfb..5296f5c87f0 100644
--- a/jdk/src/macosx/classes/sun/font/CStrike.java
+++ b/jdk/src/macosx/classes/sun/font/CStrike.java
@@ -415,7 +415,7 @@ public final class CStrike extends FontStrike {
                 generalCache = new HashMap<Integer, Long>();
             }
 
-            generalCache.put(new Integer(index), new Long(value));
+            generalCache.put(new Integer(index), Long.valueOf(value));
         }
 
         public synchronized void dispose() {
diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
index 961f7a0682e..82814627077 100644
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
@@ -616,7 +616,7 @@ public class GIFImageReader extends ImageReader {
                     return index;
                 }
 
-                Long l1 = new Long(stream.getStreamPosition());
+                Long l1 = stream.getStreamPosition();
                 imageStartPosition.add(l1);
                 ++index;
             }
diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
index 8b6cdcbce13..5743cedc904 100644
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
@@ -367,10 +367,10 @@ public class JPEGImageReader extends ImageReader {
             // Now we are at the first image if there are any, so add it
             // to the list
             if (hasNextImage()) {
-                imagePositions.add(new Long(iis.getStreamPosition()));
+                imagePositions.add(iis.getStreamPosition());
             }
         } else { // Not tables only, so add original pos to the list
-            imagePositions.add(new Long(savePos));
+            imagePositions.add(savePos);
             // And set current image since we've read it now
             currentImage = 0;
         }
@@ -498,7 +498,7 @@ public class JPEGImageReader extends ImageReader {
                 if (!hasNextImage()) {
                     throw new IndexOutOfBoundsException();
                 }
-                pos = new Long(iis.getStreamPosition());
+                pos = iis.getStreamPosition();
                 imagePositions.add(pos);
                 if (seekForwardOnly) {
                     iis.flushBefore(pos.longValue());
diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java
index 7d29b251127..f65d887050b 100644
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java
@@ -84,7 +84,7 @@ public class SnmpCounter64 extends SnmpValue {
      * @return The <CODE>Long</CODE> representation of the value.
      */
     public Long toLong() {
-        return new Long(value) ;
+        return value;
     }
 
     /**
diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java
index a6114d7dbc5..eb536581bb8 100644
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java
@@ -130,7 +130,7 @@ public class SnmpInt extends SnmpValue {
      * @return The <CODE>Long</CODE> representation of the value.
      */
     public Long toLong() {
-        return new Long(value) ;
+        return value;
     }
 
     /**
diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java
index b689ef287e7..99223ea0cb8 100644
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java
@@ -136,7 +136,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
      */
     public boolean isNestedArc(long arc) {
         if (subgroups == null) return false;
-        Object obj = subgroups.get(new Long(arc));
+        Object obj = subgroups.get(arc);
         // if the arc is registered in the hashtable,
         // it leads to a subgroup.
         return (obj != null);
@@ -260,7 +260,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
      *
      */
     void registerNestedArc(long arc) {
-        Long obj = new Long(arc);
+        Long obj = arc;
         if (subgroups == null) subgroups = new Hashtable<>();
         // registers the arc in the hashtable.
         subgroups.put(obj,obj);
diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java
index 612d4c57437..b55c32ab1ea 100644
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java
@@ -858,7 +858,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpOutTraps() {
-        return new Long(snmpOutTraps);
+        return (long)snmpOutTraps;
     }
 
     /**
@@ -868,7 +868,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpOutGetResponses() {
-        return new Long(snmpOutGetResponses);
+        return (long)snmpOutGetResponses;
     }
 
     /**
@@ -878,7 +878,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpOutGenErrs() {
-        return new Long(snmpOutGenErrs);
+        return (long)snmpOutGenErrs;
     }
 
     /**
@@ -888,7 +888,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpOutBadValues() {
-        return new Long(snmpOutBadValues);
+        return (long)snmpOutBadValues;
     }
 
     /**
@@ -898,7 +898,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpOutNoSuchNames() {
-        return new Long(snmpOutNoSuchNames);
+        return (long)snmpOutNoSuchNames;
     }
 
     /**
@@ -908,7 +908,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpOutTooBigs() {
-        return new Long(snmpOutTooBigs);
+        return (long)snmpOutTooBigs;
     }
 
     /**
@@ -918,7 +918,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInASNParseErrs() {
-        return new Long(snmpInASNParseErrs);
+        return (long)snmpInASNParseErrs;
     }
 
     /**
@@ -928,7 +928,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInBadCommunityUses() {
-        return new Long(snmpInBadCommunityUses);
+        return (long)snmpInBadCommunityUses;
     }
 
     /**
@@ -939,7 +939,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInBadCommunityNames() {
-        return new Long(snmpInBadCommunityNames);
+        return (long)snmpInBadCommunityNames;
     }
 
     /**
@@ -949,7 +949,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInBadVersions() {
-        return new Long(snmpInBadVersions);
+        return (long)snmpInBadVersions;
     }
 
     /**
@@ -959,7 +959,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpOutPkts() {
-        return new Long(snmpOutPkts);
+        return (long)snmpOutPkts;
     }
 
     /**
@@ -969,7 +969,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInPkts() {
-        return new Long(snmpInPkts);
+        return (long)snmpInPkts;
     }
 
     /**
@@ -979,7 +979,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInGetRequests() {
-        return new Long(snmpInGetRequests);
+        return (long)snmpInGetRequests;
     }
 
     /**
@@ -989,7 +989,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInGetNexts() {
-        return new Long(snmpInGetNexts);
+        return (long)snmpInGetNexts;
     }
 
     /**
@@ -999,7 +999,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInSetRequests() {
-        return new Long(snmpInSetRequests);
+        return (long)snmpInSetRequests;
     }
 
     /**
@@ -1009,7 +1009,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInTotalSetVars() {
-        return new Long(snmpInTotalSetVars);
+        return (long)snmpInTotalSetVars;
     }
 
     /**
@@ -1019,7 +1019,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpInTotalReqVars() {
-        return new Long(snmpInTotalReqVars);
+        return (long)snmpInTotalReqVars;
     }
 
     /**
@@ -1032,7 +1032,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpSilentDrops() {
-        return new Long(snmpSilentDrops);
+        return (long)snmpSilentDrops;
     }
 
     /**
@@ -1045,7 +1045,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
      */
     @Override
     public Long getSnmpProxyDrops() {
-        return new Long(0);
+        return 0L;
     }
 
 
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java
index 88b36cba315..a40b964c592 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java
@@ -421,7 +421,7 @@ public final class LdapPoolManager {
                 try {
                     return Long.getLong(propName, defVal);
                 } catch (SecurityException e) {
-                    return new Long(defVal);
+                    return defVal;
                 }
             }
         });
diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java b/jdk/src/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java
index d614aa943da..20794f8e502 100644
--- a/jdk/src/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java
@@ -221,7 +221,7 @@ final class NamingEventNotifier implements Runnable {
             return;
 
         NamingEvent e = new NamingEvent(eventSrc, NamingEvent.OBJECT_ADDED,
-            newBd, null, new Long(changeID));
+            newBd, null, changeID);
         support.queueEvent(e, namingListeners);
     }
 
@@ -233,7 +233,7 @@ final class NamingEventNotifier implements Runnable {
             return;
 
         NamingEvent e = new NamingEvent(eventSrc, NamingEvent.OBJECT_REMOVED,
-            null, oldBd, new Long(changeID));
+            null, oldBd, changeID);
         support.queueEvent(e, namingListeners);
     }
 
@@ -248,7 +248,7 @@ final class NamingEventNotifier implements Runnable {
         Binding oldBd = new Binding(newBd.getName(), null, newBd.isRelative());
 
         NamingEvent e = new NamingEvent(
-            eventSrc, NamingEvent.OBJECT_CHANGED, newBd, oldBd, new Long(changeID));
+            eventSrc, NamingEvent.OBJECT_CHANGED, newBd, oldBd, changeID);
         support.queueEvent(e, namingListeners);
     }
 
@@ -273,7 +273,7 @@ final class NamingEventNotifier implements Runnable {
         }
 
         NamingEvent e = new NamingEvent(
-            eventSrc, NamingEvent.OBJECT_RENAMED, newBd, oldBd, new Long(changeID));
+            eventSrc, NamingEvent.OBJECT_RENAMED, newBd, oldBd, changeID);
         support.queueEvent(e, namingListeners);
     }
 
diff --git a/jdk/src/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java b/jdk/src/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java
index 7924362f28b..04229eaab9c 100644
--- a/jdk/src/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java
+++ b/jdk/src/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java
@@ -110,7 +110,7 @@ public class SolarisNumericGroupPrincipal implements
      *
      */
     public SolarisNumericGroupPrincipal(long name, boolean primaryGroup) {
-        this.name = (new Long(name)).toString();
+        this.name = Long.toString(name);
         this.primaryGroup = primaryGroup;
     }
 
@@ -137,7 +137,7 @@ public class SolarisNumericGroupPrincipal implements
      *          <code>SolarisNumericGroupPrincipal</code> as a long.
      */
     public long longValue() {
-        return ((new Long(name)).longValue());
+        return Long.parseLong(name);
     }
 
     /**
diff --git a/jdk/src/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java b/jdk/src/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java
index 86f7ed67768..d7ba9c038d7 100644
--- a/jdk/src/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java
+++ b/jdk/src/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java
@@ -96,7 +96,7 @@ public class SolarisNumericUserPrincipal implements
      *                  represented as a long.
      */
     public SolarisNumericUserPrincipal(long name) {
-        this.name = (new Long(name)).toString();
+        this.name = Long.toString(name);
     }
 
     /**
@@ -122,7 +122,7 @@ public class SolarisNumericUserPrincipal implements
      *          <code>SolarisNumericUserPrincipal</code> as a long.
      */
     public long longValue() {
-        return ((new Long(name)).longValue());
+        return Long.parseLong(name);
     }
 
     /**
diff --git a/jdk/src/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java b/jdk/src/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java
index db5775ab329..63c9d28c34d 100644
--- a/jdk/src/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java
+++ b/jdk/src/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java
@@ -102,7 +102,7 @@ public class UnixNumericGroupPrincipal implements
      *
      */
     public UnixNumericGroupPrincipal(long name, boolean primaryGroup) {
-        this.name = (new Long(name)).toString();
+        this.name = Long.toString(name);
         this.primaryGroup = primaryGroup;
     }
 
@@ -129,7 +129,7 @@ public class UnixNumericGroupPrincipal implements
      *          <code>UnixNumericGroupPrincipal</code> as a long.
      */
     public long longValue() {
-        return ((new Long(name)).longValue());
+        return Long.parseLong(name);
     }
 
     /**
diff --git a/jdk/src/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java b/jdk/src/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java
index c6dfd7eaf1b..e2016efe77d 100644
--- a/jdk/src/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java
+++ b/jdk/src/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java
@@ -87,7 +87,7 @@ public class UnixNumericUserPrincipal implements
      *                  represented as a long.
      */
     public UnixNumericUserPrincipal(long name) {
-        this.name = (new Long(name)).toString();
+        this.name = Long.toString(name);
     }
 
     /**
@@ -113,7 +113,7 @@ public class UnixNumericUserPrincipal implements
      *          <code>UnixNumericUserPrincipal</code> as a long.
      */
     public long longValue() {
-        return ((new Long(name)).longValue());
+        return Long.parseLong(name);
     }
 
     /**
diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java
index db0f25c1cb8..2bd04857e00 100644
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java
@@ -142,8 +142,8 @@ class BreakpointSpec extends EventRequestSpec {
                                          refSpec.toString()));
         } else if (e instanceof LineNotFoundException) {
             return (MessageOutput.format("No code at line",
-                                         new Object [] {new Long (lineNumber()),
-                                                        refSpec.toString()}));
+                                         new Object [] {Long.valueOf(lineNumber()),
+                                                 refSpec.toString()}));
         } else if (e instanceof InvalidTypeException) {
             return (MessageOutput.format("Breakpoints can be located only in classes.",
                                          refSpec.toString()));
diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java
index 65a0a800e09..2ea7d487a02 100644
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java
@@ -935,7 +935,7 @@ class Commands {
             try {
                 methodInfo = loc.sourceName() +
                     MessageOutput.format("line number",
-                                         new Object [] {new Long(lineNumber)});
+                                         new Object [] {Long.valueOf(lineNumber)});
             } catch (AbsentInformationException e) {
                 methodInfo = MessageOutput.format("unknown");
             }
@@ -946,7 +946,7 @@ class Commands {
                                                  meth.declaringType().name(),
                                                  meth.name(),
                                                  methodInfo,
-                                                 new Long(pc)});
+                                                 Long.valueOf(pc)});
         } else {
             MessageOutput.println("stack frame dump",
                                   new Object [] {new Integer(frameNumber + 1),
@@ -1015,7 +1015,7 @@ class Commands {
                                     new Object [] {loc.declaringType().name(),
                                                    loc.method().name(),
                                                    new Integer (loc.lineNumber()),
-                                                   new Long (loc.codeIndex())});
+                                                   Long.valueOf(loc.codeIndex())});
     }
 
     void listBreakpoints() {
diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java
index 0727d519ca6..7b80466f488 100644
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java
@@ -102,7 +102,7 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
         if ((id & ~Snapshot.SMALL_ID_MASK) == 0) {
             return new Integer((int)id);
         } else {
-            return new Long(id);
+            return id;
         }
     }
 
diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java b/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java
index 4d881fd0d72..51f922c8044 100644
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java
@@ -583,7 +583,7 @@ public class Snapshot {
         if (identifierSize == 4) {
             return new Integer((int)id);
         } else {
-            return new Long(id);
+            return id;
         }
     }
 
diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java b/jdk/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java
index 33cdb3aa3e1..8a5afa88854 100644
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java
@@ -215,7 +215,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
                     long id = readID();
                     byte[] chars = new byte[(int)length - identifierSize];
                     in.readFully(chars);
-                    names.put(new Long(id), new String(chars));
+                    names.put(id, new String(chars));
                     break;
                 }
                 case HPROF_LOAD_CLASS: {
@@ -223,7 +223,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
                     long classID = readID();
                     int stackTraceSerialNo = in.readInt();
                     long classNameID = readID();
-                    Long classIdI = new Long(classID);
+                    Long classIdI = classID;
                     String nm = getNameFromID(classNameID).replace('/', '.');
                     classNameFromObjectID.put(classIdI, nm);
                     if (classNameFromSerialNo != null) {
@@ -303,7 +303,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
                             warn("Weird stack frame line number:  " + lineNumber);
                             lineNumber = StackFrame.LINE_NUMBER_UNKNOWN;
                         }
-                        stackFrames.put(new Long(id),
+                        stackFrames.put(id,
                                         new StackFrame(methodName, methodSig,
                                                        className, sourceFile,
                                                        lineNumber));
@@ -319,7 +319,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
                         StackFrame[] frames = new StackFrame[in.readInt()];
                         for (int i = 0; i < frames.length; i++) {
                             long fid = readID();
-                            frames[i] = stackFrames.get(new Long(fid));
+                            frames[i] = stackFrames.get(fid);
                             if (frames[i] == null) {
                                 throw new IOException("Stack frame " + toHex(fid) + " not found");
                             }
@@ -619,7 +619,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
     }
 
     private String getNameFromID(long id) throws IOException {
-        return getNameFromID(new Long(id));
+        return getNameFromID(Long.valueOf(id));
     }
 
     private String getNameFromID(Long id) throws IOException {
@@ -703,7 +703,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
             String signature = "" + ((char) type);
             fields[i] = new JavaField(fieldName, signature);
         }
-        String name = classNameFromObjectID.get(new Long(id));
+        String name = classNameFromObjectID.get(id);
         if (name == null) {
             warn("Class name not found for " + toHex(id));
             name = "unknown-name@" + toHex(id);
diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java b/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java
index ccffc6d5602..73755c2e523 100644
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/RefsByTypeQuery.java
@@ -63,9 +63,9 @@ public class RefsByTypeQuery extends QueryHandler {
                     }
                     Long count = referrersStat.get(cl);
                     if (count == null) {
-                        count = new Long(1);
+                        count = 1L;
                     } else {
-                        count = new Long(count.longValue() + 1);
+                        count = count + 1L;
                     }
                     referrersStat.put(cl, count);
                 }
@@ -75,9 +75,9 @@ public class RefsByTypeQuery extends QueryHandler {
                             JavaClass cl = obj.getClazz();
                             Long count = refereesStat.get(cl);
                             if (count == null) {
-                                count = new Long(1);
+                                count = 1L;
                             } else {
-                                count = new Long(count.longValue() + 1);
+                                count = count + 1L;
                             }
                             refereesStat.put(cl, count);
                         }
diff --git a/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
index ca1c6e21408..c03ed4de31b 100644
--- a/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
+++ b/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
@@ -781,7 +781,7 @@ class VirtualMachineImpl extends MirrorImpl
             type.setSignature(signature);
         }
 
-        typesByID.put(new Long(id), type);
+        typesByID.put(id, type);
         typesBySignature.add(type);
 
         if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
@@ -809,7 +809,7 @@ class VirtualMachineImpl extends MirrorImpl
             if (comp == 0) {
                 matches++;
                 iter.remove();
-                typesByID.remove(new Long(type.ref()));
+                typesByID.remove(type.ref());
                 if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
                    vm.printTrace("Uncaching ReferenceType, sig=" + signature +
                                  ", id=" + type.ref());
@@ -895,7 +895,7 @@ class VirtualMachineImpl extends MirrorImpl
             ReferenceTypeImpl retType = null;
             synchronized (this) {
                 if (typesByID != null) {
-                    retType = (ReferenceTypeImpl)typesByID.get(new Long(id));
+                    retType = (ReferenceTypeImpl)typesByID.get(id);
                 }
                 if (retType == null) {
                     retType = addReferenceType(id, tag, signature);
@@ -1247,7 +1247,7 @@ class VirtualMachineImpl extends MirrorImpl
             return null;
         }
         ObjectReferenceImpl object = null;
-        Long key = new Long(id);
+        Long key = id;
 
         /*
          * Attempt to retrieve an existing object object reference
@@ -1313,7 +1313,7 @@ class VirtualMachineImpl extends MirrorImpl
         // Handle any queue elements that are not strongly reachable
         processQueue();
 
-        SoftObjectReference ref = objectsByID.remove(new Long(object.ref()));
+        SoftObjectReference ref = objectsByID.remove(object.ref());
         if (ref != null) {
             batchForDispose(ref);
         } else {
diff --git a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java
index bf14e8ce2d3..63e510d9c83 100644
--- a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java
+++ b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java
@@ -381,7 +381,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *         the specified parameter.
      */
     public ParameterBlock add(long l) {
-        return add(new Long(l));
+        return add(Long.valueOf(l));
     }
 
     /**
@@ -505,7 +505,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *        the specified parameter.
      */
     public ParameterBlock set(long l, int index) {
-        return set(new Long(l), index);
+        return set(Long.valueOf(l), index);
     }
 
     /**
diff --git a/jdk/src/share/classes/java/text/DecimalFormat.java b/jdk/src/share/classes/java/text/DecimalFormat.java
index f89fd151749..a82011fd7d5 100644
--- a/jdk/src/share/classes/java/text/DecimalFormat.java
+++ b/jdk/src/share/classes/java/text/DecimalFormat.java
@@ -2094,7 +2094,7 @@ public class DecimalFormat extends NumberFormat {
             }
 
             return gotDouble ?
-                (Number)new Double(doubleResult) : (Number)new Long(longResult);
+                (Number)new Double(doubleResult) : (Number)Long.valueOf(longResult);
         }
     }
 
diff --git a/jdk/src/share/classes/javax/management/loading/MLet.java b/jdk/src/share/classes/javax/management/loading/MLet.java
index ac80c38b93c..b3f507839ad 100644
--- a/jdk/src/share/classes/javax/management/loading/MLet.java
+++ b/jdk/src/share/classes/javax/management/loading/MLet.java
@@ -1311,7 +1311,7 @@ public class MLet extends java.net.URLClassLoader
         if (type.compareTo("java.lang.Short") == 0)
              return new Short(param);
         if (type.compareTo("java.lang.Long") == 0)
-             return new Long(param);
+             return Long.valueOf(param);
         if (type.compareTo("java.lang.Integer") == 0)
              return new Integer(param);
         if (type.compareTo("java.lang.Float") == 0)
diff --git a/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java b/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
index 869a2c8cdc8..d9323203a03 100644
--- a/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
+++ b/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
@@ -544,7 +544,7 @@ public class RequiredModelMBean
             }
 
             // convert seconds to milliseconds for time comparison
-            currencyPeriod = ((new Long(expTime)).longValue()) * 1000;
+            currencyPeriod = Long.parseLong(expTime) * 1000;
             if (currencyPeriod < 0) {
                 /* if currencyTimeLimit is -1 then value is never cached */
                 returnCachedValue = false;
@@ -580,7 +580,7 @@ public class RequiredModelMBean
                 if (tStamp == null)
                     tStamp = "0";
 
-                long lastTime = (new Long(tStamp)).longValue();
+                long lastTime = Long.parseLong(tStamp);
 
                 if (tracing) {
                     MODELMBEAN_LOGGER.logp(Level.FINER,
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java
index 6ed2265087e..8c1622a4f2a 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -458,7 +458,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
         Integer fiveHundred = new Integer(500);
 
         // *** Shared Longs
-        Long oneThousand = new Long(1000);
+        Long oneThousand = 1000L;
 
         LazyValue dialogPlain12 = t ->
             new FontUIResource(Font.DIALOG, Font.PLAIN, 12);
diff --git a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java
index faa79c22c8a..27d5431b1bf 100644
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java
@@ -66,7 +66,7 @@ public class PerfLongMonitor extends AbstractMonitor implements LongMonitor {
      *                  return type is guaranteed to be of type Long.
      */
     public Object getValue() {
-        return new Long(lb.get(0));
+        return Long.valueOf(lb.get(0));
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/GcInfoCompositeData.java b/jdk/src/share/classes/sun/management/GcInfoCompositeData.java
index b5797c947a4..a7730300e76 100644
--- a/jdk/src/share/classes/sun/management/GcInfoCompositeData.java
+++ b/jdk/src/share/classes/sun/management/GcInfoCompositeData.java
@@ -105,10 +105,10 @@ public class GcInfoCompositeData extends LazyCompositeData {
 
         try {
             baseGcInfoItemValues = new Object[] {
-                new Long(info.getId()),
-                new Long(info.getStartTime()),
-                new Long(info.getEndTime()),
-                new Long(info.getDuration()),
+                info.getId(),
+                info.getStartTime(),
+                info.getEndTime(),
+                info.getDuration(),
                 memoryUsageMapType.toOpenTypeData(info.getMemoryUsageBeforeGc()),
                 memoryUsageMapType.toOpenTypeData(info.getMemoryUsageAfterGc()),
             };
diff --git a/jdk/src/share/classes/sun/management/HotspotThread.java b/jdk/src/share/classes/sun/management/HotspotThread.java
index 17319ba1526..03e403a8983 100644
--- a/jdk/src/share/classes/sun/management/HotspotThread.java
+++ b/jdk/src/share/classes/sun/management/HotspotThread.java
@@ -60,7 +60,7 @@ class HotspotThread
         int numThreads = getInternalThreadTimes0(names, times);
         Map<String, Long> result = new HashMap<>(numThreads);
         for (int i = 0; i < numThreads; i++) {
-            result.put(names[i], new Long(times[i]));
+            result.put(names[i], times[i]);
         }
         return result;
     }
diff --git a/jdk/src/share/classes/sun/management/MemoryNotifInfoCompositeData.java b/jdk/src/share/classes/sun/management/MemoryNotifInfoCompositeData.java
index b99ccdaed19..219b2d9fbc1 100644
--- a/jdk/src/share/classes/sun/management/MemoryNotifInfoCompositeData.java
+++ b/jdk/src/share/classes/sun/management/MemoryNotifInfoCompositeData.java
@@ -60,7 +60,7 @@ public class MemoryNotifInfoCompositeData extends LazyCompositeData {
         final Object[] memoryNotifInfoItemValues = {
             memoryNotifInfo.getPoolName(),
             MemoryUsageCompositeData.toCompositeData(memoryNotifInfo.getUsage()),
-            new Long(memoryNotifInfo.getCount()),
+            memoryNotifInfo.getCount(),
         };
 
         try {
diff --git a/jdk/src/share/classes/sun/management/MemoryUsageCompositeData.java b/jdk/src/share/classes/sun/management/MemoryUsageCompositeData.java
index a30795201ce..0b3a6e0656f 100644
--- a/jdk/src/share/classes/sun/management/MemoryUsageCompositeData.java
+++ b/jdk/src/share/classes/sun/management/MemoryUsageCompositeData.java
@@ -56,10 +56,10 @@ public class MemoryUsageCompositeData extends LazyCompositeData {
         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
         // memoryUsageItemNames!
         final Object[] memoryUsageItemValues = {
-            new Long(usage.getInit()),
-            new Long(usage.getUsed()),
-            new Long(usage.getCommitted()),
-            new Long(usage.getMax()),
+            usage.getInit(),
+            usage.getUsed(),
+            usage.getCommitted(),
+            usage.getMax(),
         };
 
         try {
diff --git a/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java b/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java
index cef28271e7e..1067c175939 100644
--- a/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java
+++ b/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java
@@ -108,16 +108,16 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
         // threadInfoItemNames!
         final Object[] threadInfoItemValues = {
-            new Long(threadInfo.getThreadId()),
+            threadInfo.getThreadId(),
             threadInfo.getThreadName(),
             threadInfo.getThreadState().name(),
-            new Long(threadInfo.getBlockedTime()),
-            new Long(threadInfo.getBlockedCount()),
-            new Long(threadInfo.getWaitedTime()),
-            new Long(threadInfo.getWaitedCount()),
+            threadInfo.getBlockedTime(),
+            threadInfo.getBlockedCount(),
+            threadInfo.getWaitedTime(),
+            threadInfo.getWaitedCount(),
             lockInfoData,
             threadInfo.getLockName(),
-            new Long(threadInfo.getLockOwnerId()),
+            threadInfo.getLockOwnerId(),
             threadInfo.getLockOwnerName(),
             stackTraceData,
                 threadInfo.isSuspended(),
diff --git a/jdk/src/share/classes/sun/management/counter/perf/LongCounterSnapshot.java b/jdk/src/share/classes/sun/management/counter/perf/LongCounterSnapshot.java
index 5935f7f7920..1281a688eb2 100644
--- a/jdk/src/share/classes/sun/management/counter/perf/LongCounterSnapshot.java
+++ b/jdk/src/share/classes/sun/management/counter/perf/LongCounterSnapshot.java
@@ -43,7 +43,7 @@ class LongCounterSnapshot extends AbstractCounter
     }
 
     public Object getValue() {
-        return new Long(value);
+        return Long.valueOf(value);
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/counter/perf/PerfLongCounter.java b/jdk/src/share/classes/sun/management/counter/perf/PerfLongCounter.java
index e50ccd54153..b0246ed717a 100644
--- a/jdk/src/share/classes/sun/management/counter/perf/PerfLongCounter.java
+++ b/jdk/src/share/classes/sun/management/counter/perf/PerfLongCounter.java
@@ -42,7 +42,7 @@ public class PerfLongCounter extends AbstractCounter
     }
 
     public Object getValue() {
-        return new Long(lb.get(0));
+        return Long.valueOf(lb.get(0));
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmClassLoadingImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmClassLoadingImpl.java
index af8900b433d..e4a9953ea81 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmClassLoadingImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmClassLoadingImpl.java
@@ -129,21 +129,21 @@ public class JvmClassLoadingImpl implements JvmClassLoadingMBean {
      * Getter for the "JvmClassesUnloadedCount" variable.
      */
     public Long getJvmClassesUnloadedCount() throws SnmpStatusException {
-        return new Long(getClassLoadingMXBean().getUnloadedClassCount());
+        return getClassLoadingMXBean().getUnloadedClassCount();
     }
 
     /**
      * Getter for the "JvmClassesTotalLoadedCount" variable.
      */
     public Long getJvmClassesTotalLoadedCount() throws SnmpStatusException {
-        return new Long(getClassLoadingMXBean().getTotalLoadedClassCount());
+        return getClassLoadingMXBean().getTotalLoadedClassCount();
     }
 
     /**
      * Getter for the "JvmClassesLoadedCount" variable.
      */
     public Long getJvmClassesLoadedCount() throws SnmpStatusException {
-        return new Long(getClassLoadingMXBean().getLoadedClassCount());
+        return (long)getClassLoadingMXBean().getLoadedClassCount();
     }
 
 }
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmCompilationImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmCompilationImpl.java
index ef699c7033d..7e3ce4bd4d4 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmCompilationImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmCompilationImpl.java
@@ -115,7 +115,7 @@ public class JvmCompilationImpl implements JvmCompilationMBean {
             t = getCompilationMXBean().getTotalCompilationTime();
         else
             t = 0;
-        return new Long(t);
+        return t;
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCEntryImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCEntryImpl.java
index f6f125bc2cc..7c23d772fc2 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCEntryImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCEntryImpl.java
@@ -70,7 +70,7 @@ public class JvmMemGCEntryImpl implements JvmMemGCEntryMBean {
      */
     // Don't bother to uses the request contextual cache for this.
     public Long getJvmMemGCTimeMs() throws SnmpStatusException {
-        return new Long(gcm.getCollectionTime());
+        return gcm.getCollectionTime();
     }
 
     /**
@@ -78,7 +78,7 @@ public class JvmMemGCEntryImpl implements JvmMemGCEntryMBean {
      */
     // Don't bother to uses the request contextual cache for this.
     public Long getJvmMemGCCount() throws SnmpStatusException {
-        return new Long(gcm.getCollectionCount());
+        return gcm.getCollectionCount();
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java
index f86ef931805..f1b14602224 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java
@@ -191,7 +191,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolMaxSize() throws SnmpStatusException {
         final long val = getMemoryUsage().getMax();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -200,7 +200,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolUsed() throws SnmpStatusException {
         final long val = getMemoryUsage().getUsed();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -209,7 +209,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolInitSize() throws SnmpStatusException {
         final long val = getMemoryUsage().getInit();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -218,7 +218,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolCommitted() throws SnmpStatusException {
         final long val = getMemoryUsage().getCommitted();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -227,7 +227,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolPeakMaxSize() throws SnmpStatusException {
         final long val = getPeakMemoryUsage().getMax();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -236,7 +236,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolPeakUsed() throws SnmpStatusException {
         final long val = getPeakMemoryUsage().getUsed();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -245,7 +245,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolPeakCommitted() throws SnmpStatusException {
         final long val = getPeakMemoryUsage().getCommitted();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -254,7 +254,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolCollectMaxSize() throws SnmpStatusException {
         final long val = getCollectMemoryUsage().getMax();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -263,7 +263,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolCollectUsed() throws SnmpStatusException {
         final long val = getCollectMemoryUsage().getUsed();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -272,7 +272,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public Long getJvmMemPoolCollectCommitted() throws SnmpStatusException {
         final long val = getCollectMemoryUsage().getCommitted();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -283,7 +283,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
         if (!pool.isUsageThresholdSupported())
             return JvmMemoryImpl.Long0;
         final long val = pool.getUsageThreshold();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -334,7 +334,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
         if (!pool.isUsageThresholdSupported())
             return JvmMemoryImpl.Long0;
         final long val = pool.getUsageThresholdCount();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -345,7 +345,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
         if (!pool.isCollectionUsageThresholdSupported())
             return JvmMemoryImpl.Long0;
         final long val = pool.getCollectionUsageThreshold();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -399,7 +399,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
         if (!pool.isCollectionUsageThresholdSupported())
             return JvmMemoryImpl.Long0;
         final long val = pool.getCollectionUsageThresholdCount();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return JvmMemoryImpl.Long0;
     }
 
@@ -450,7 +450,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
      */
     public synchronized Long getJvmMemPoolPeakReset()
         throws SnmpStatusException {
-        return new Long(jvmMemPoolPeakReset);
+        return jvmMemPoolPeakReset;
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java
index a40267d0799..c24866e4d2f 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java
@@ -222,7 +222,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
         }
     }
 
-    static final Long Long0 = new Long(0);
+    static final Long Long0 = 0L;
 
     /**
      * Getter for the "JvmMemoryNonHeapMaxSize" variable.
@@ -230,7 +230,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
     public Long getJvmMemoryNonHeapMaxSize()
         throws SnmpStatusException {
         final long val = getNonHeapMemoryUsage().getMax();
-        if (val > -1) return  new Long(val);
+        if (val > -1) return  val;
         else return Long0;
     }
 
@@ -239,7 +239,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
      */
     public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException {
         final long val = getNonHeapMemoryUsage().getCommitted();
-        if (val > -1) return new Long(val);
+        if (val > -1) return val;
         else return Long0;
     }
 
@@ -248,7 +248,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
      */
     public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException {
         final long val = getNonHeapMemoryUsage().getUsed();
-        if (val > -1) return new Long(val);
+        if (val > -1) return val;
         else return Long0;
     }
 
@@ -257,7 +257,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
      */
     public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException {
         final long val = getNonHeapMemoryUsage().getInit();
-        if (val > -1) return new Long(val);
+        if (val > -1) return val;
         else return Long0;
     }
 
@@ -266,7 +266,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
      */
     public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException {
         final long val = getHeapMemoryUsage().getMax();
-        if (val > -1) return new Long(val);
+        if (val > -1) return val;
         else return Long0;
     }
 
@@ -320,7 +320,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
      */
     public Long getJvmMemoryHeapCommitted() throws SnmpStatusException {
         final long val = getHeapMemoryUsage().getCommitted();
-        if (val > -1) return new Long(val);
+        if (val > -1) return val;
         else return Long0;
     }
 
@@ -359,7 +359,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
      */
     public Long getJvmMemoryHeapUsed() throws SnmpStatusException {
         final long val = getHeapMemoryUsage().getUsed();
-        if (val > -1) return new Long(val);
+        if (val > -1) return val;
         else return Long0;
     }
 
@@ -368,7 +368,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
      */
     public Long getJvmMemoryHeapInitSize() throws SnmpStatusException {
         final long val = getHeapMemoryUsage().getInit();
-        if (val > -1) return new Long(val);
+        if (val > -1) return val;
         else return Long0;
     }
 
@@ -380,11 +380,11 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
         final long val = ManagementFactory.getMemoryMXBean().
             getObjectPendingFinalizationCount();
 
-        if (val > -1) return new Long((int)val);
+        if (val > -1) return Long.valueOf((int) val);
 
         // Should never happen... but stay safe all the same.
         //
-        else return new Long(0);
+        else return 0L;
     }
 
     static final MibLogger log = new MibLogger(JvmMemoryImpl.class);
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeImpl.java
index fea0240b365..cf62699872f 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeImpl.java
@@ -259,14 +259,14 @@ public class JvmRuntimeImpl implements JvmRuntimeMBean {
      * Getter for the "JvmRTUptimeMs" variable.
      */
     public Long getJvmRTUptimeMs() throws SnmpStatusException {
-        return new Long(getRuntimeMXBean().getUptime());
+        return getRuntimeMXBean().getUptime();
     }
 
     /**
      * Getter for the "JvmRTStartTimeMs" variable.
      */
     public Long getJvmRTStartTimeMs() throws SnmpStatusException {
-        return new Long(getRuntimeMXBean().getStartTime());
+        return getRuntimeMXBean().getStartTime();
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java
index b4344def620..d419e57e899 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java
@@ -231,7 +231,7 @@ public class JvmThreadInstanceEntryImpl
             log.debug("getJvmThreadInstCpuTimeNs",
                       "Operation not supported: " + e);
         }
-        return new Long(l);
+        return l;
     }
 
     /**
@@ -248,14 +248,14 @@ public class JvmThreadInstanceEntryImpl
             //Monitoring is disabled
             if(l == -1) l = 0;
         }
-        return new Long(l);
+        return l;
     }
 
     /**
      * Getter for the "JvmThreadInstBlockCount" variable.
      */
     public Long getJvmThreadInstBlockCount() throws SnmpStatusException {
-        return new Long(info.getBlockedCount());
+        return info.getBlockedCount();
     }
 
     /**
@@ -272,14 +272,14 @@ public class JvmThreadInstanceEntryImpl
             //Monitoring is disabled
             if(l == -1) l = 0;
         }
-        return new Long(l);
+        return l;
     }
 
     /**
      * Getter for the "JvmThreadInstWaitCount" variable.
      */
     public Long getJvmThreadInstWaitCount() throws SnmpStatusException {
-        return new Long(info.getWaitedCount());
+        return info.getWaitedCount();
     }
 
     /**
@@ -294,7 +294,7 @@ public class JvmThreadInstanceEntryImpl
      * Getter for the "JvmThreadInstId" variable.
      */
     public Long getJvmThreadInstId() throws SnmpStatusException {
-        return new Long(info.getThreadId());
+        return info.getThreadId();
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadingImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadingImpl.java
index 480642c3253..e4a1f01d024 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadingImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadingImpl.java
@@ -303,28 +303,28 @@ public class JvmThreadingImpl implements JvmThreadingMBean {
      * Getter for the "JvmThreadTotalStartedCount" variable.
      */
     public Long getJvmThreadTotalStartedCount() throws SnmpStatusException {
-        return new Long(getThreadMXBean().getTotalStartedThreadCount());
+        return getThreadMXBean().getTotalStartedThreadCount();
     }
 
     /**
      * Getter for the "JvmThreadPeakCount" variable.
      */
     public Long getJvmThreadPeakCount() throws SnmpStatusException {
-        return  new Long(getThreadMXBean().getPeakThreadCount());
+        return (long)getThreadMXBean().getPeakThreadCount();
     }
 
     /**
      * Getter for the "JvmThreadDaemonCount" variable.
      */
     public Long getJvmThreadDaemonCount() throws SnmpStatusException {
-        return new Long(getThreadMXBean().getDaemonThreadCount());
+        return (long)getThreadMXBean().getDaemonThreadCount();
     }
 
     /**
      * Getter for the "JvmThreadCount" variable.
      */
     public Long getJvmThreadCount() throws SnmpStatusException {
-        return new Long(getThreadMXBean().getThreadCount());
+        return (long)getThreadMXBean().getThreadCount();
     }
 
    /**
@@ -332,7 +332,7 @@ public class JvmThreadingImpl implements JvmThreadingMBean {
      */
     public synchronized Long getJvmThreadPeakCountReset()
         throws SnmpStatusException {
-        return new Long(jvmThreadPeakCountReset);
+        return jvmThreadPeakCountReset;
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/nio/ch/Util.java b/jdk/src/share/classes/sun/nio/ch/Util.java
index dca91d6e8b2..5a30b51721b 100644
--- a/jdk/src/share/classes/sun/nio/ch/Util.java
+++ b/jdk/src/share/classes/sun/nio/ch/Util.java
@@ -329,7 +329,7 @@ public class Util {
         try {
             dbb = (MappedByteBuffer)directByteBufferConstructor.newInstance(
               new Object[] { new Integer(size),
-                             new Long(addr),
+                             addr,
                              fd,
                              unmapper });
         } catch (InstantiationException |
@@ -374,7 +374,7 @@ public class Util {
         try {
             dbb = (MappedByteBuffer)directByteBufferRConstructor.newInstance(
               new Object[] { new Integer(size),
-                             new Long(addr),
+                             addr,
                              fd,
                              unmapper });
         } catch (InstantiationException |
diff --git a/jdk/src/share/classes/sun/security/action/GetLongAction.java b/jdk/src/share/classes/sun/security/action/GetLongAction.java
index 4b99f02ae03..fdadc191b72 100644
--- a/jdk/src/share/classes/sun/security/action/GetLongAction.java
+++ b/jdk/src/share/classes/sun/security/action/GetLongAction.java
@@ -106,7 +106,7 @@ public class GetLongAction implements java.security.PrivilegedAction<Long> {
     public Long run() {
         Long value = Long.getLong(theProp);
         if ((value == null) && defaultSet)
-            return new Long(defaultVal);
+            return defaultVal;
         return value;
     }
 }
diff --git a/jdk/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java b/jdk/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java
index b98dcea6fce..1f216ec32bd 100644
--- a/jdk/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java
+++ b/jdk/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java
@@ -203,7 +203,7 @@ public class GSSNameElement implements GSSNameSpi {
     }
 
     public int hashCode() {
-        return new Long(pName).hashCode();
+        return Long.hashCode(pName);
     }
 
     public byte[] export() throws GSSException {
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java b/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java
index 3beaac873ce..264f2e06192 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KerberosTime.java
@@ -188,8 +188,8 @@ public class KerberosTime {
     }
 
     public int getMicroSeconds() {
-        Long temp_long = new Long((kerberosTime % 1000L) * 1000L);
-        return temp_long.intValue() + microSeconds;
+        int temp_int = (int) ((kerberosTime % 1000L) * 1000L);
+        return temp_int + microSeconds;
     }
 
     /**
@@ -250,8 +250,7 @@ public class KerberosTime {
     }
 
     public int getSeconds() {
-        Long temp_long = new Long(kerberosTime / 1000L);
-        return temp_long.intValue();
+        return (int) (kerberosTime / 1000L);
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Main.java b/jdk/src/share/classes/sun/security/tools/keytool/Main.java
index 1618fe19f89..2947a3081a1 100644
--- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java
@@ -1675,7 +1675,7 @@ public final class Main {
             Object[] source = {new Integer(keysize),
                                 privKey.getAlgorithm(),
                                 chain[0].getSigAlgName(),
-                                new Long(validity),
+                                validity,
                                 x500Name};
             System.err.println(form.format(source));
         }
diff --git a/jdk/src/share/classes/sun/tools/java/BinaryConstantPool.java b/jdk/src/share/classes/sun/tools/java/BinaryConstantPool.java
index 2bcc7e1b32d..18d0087efb2 100644
--- a/jdk/src/share/classes/sun/tools/java/BinaryConstantPool.java
+++ b/jdk/src/share/classes/sun/tools/java/BinaryConstantPool.java
@@ -66,7 +66,7 @@ class BinaryConstantPool implements Constants {
                 cpool[i] = new Float(in.readFloat());
                 break;
               case CONSTANT_LONG:
-                cpool[i++] = new Long(in.readLong());
+                cpool[i++] = in.readLong();
                 break;
               case CONSTANT_DOUBLE:
                 cpool[i++] = new Double(in.readDouble());
diff --git a/jdk/src/share/classes/sun/tools/jconsole/MemoryPoolProxy.java b/jdk/src/share/classes/sun/tools/jconsole/MemoryPoolProxy.java
index 8bd37ce9a49..33fa55d73f7 100644
--- a/jdk/src/share/classes/sun/tools/jconsole/MemoryPoolProxy.java
+++ b/jdk/src/share/classes/sun/tools/jconsole/MemoryPoolProxy.java
@@ -56,7 +56,7 @@ public class MemoryPoolProxy {
                 ObjectName mbeanName = new ObjectName(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE +
                                                       ",name=" + name);
                 if (client.isRegistered(mbeanName)) {
-                    gcMBeans.put(mbeanName, new Long(0));
+                    gcMBeans.put(mbeanName, 0L);
                 }
             } catch (Exception e) {
                 assert false;
@@ -97,7 +97,7 @@ public class MemoryPoolProxy {
             Long gcCount = e.getValue();
             Long newCount = gc.getCollectionCount();
             if (newCount > gcCount) {
-                gcMBeans.put(e.getKey(), new Long(newCount));
+                gcMBeans.put(e.getKey(), newCount);
                 lastGcInfo = gc.getLastGcInfo();
                 if (lastGcInfo.getEndTime() > lastGcEndTime) {
                     gcId = lastGcInfo.getId();
diff --git a/jdk/src/share/classes/sun/tools/tree/BitNotExpression.java b/jdk/src/share/classes/sun/tools/tree/BitNotExpression.java
index b729c7de51b..ac1cf526d29 100644
--- a/jdk/src/share/classes/sun/tools/tree/BitNotExpression.java
+++ b/jdk/src/share/classes/sun/tools/tree/BitNotExpression.java
@@ -83,7 +83,7 @@ class BitNotExpression extends UnaryExpression {
             asm.add(where, opc_ldc, new Integer(-1));
             asm.add(where, opc_ixor);
         } else {
-            asm.add(where, opc_ldc2_w, new Long(-1));
+            asm.add(where, opc_ldc2_w, -1L);
             asm.add(where, opc_lxor);
         }
     }
diff --git a/jdk/src/share/classes/sun/tools/tree/IncDecExpression.java b/jdk/src/share/classes/sun/tools/tree/IncDecExpression.java
index 5a4021b8c3e..c9ec1ad3d2f 100644
--- a/jdk/src/share/classes/sun/tools/tree/IncDecExpression.java
+++ b/jdk/src/share/classes/sun/tools/tree/IncDecExpression.java
@@ -131,7 +131,7 @@ class IncDecExpression extends UnaryExpression {
             asm.add(where, inc ? opc_iadd : opc_isub);
             break;
           case TC_LONG:
-            asm.add(where, opc_ldc2_w, new Long(1));
+            asm.add(where, opc_ldc2_w, 1L);
             asm.add(where, inc ? opc_ladd : opc_lsub);
             break;
           case TC_FLOAT:
diff --git a/jdk/src/share/classes/sun/tools/tree/LongExpression.java b/jdk/src/share/classes/sun/tools/tree/LongExpression.java
index 82f084ddbd4..d1900161ca8 100644
--- a/jdk/src/share/classes/sun/tools/tree/LongExpression.java
+++ b/jdk/src/share/classes/sun/tools/tree/LongExpression.java
@@ -50,7 +50,7 @@ class LongExpression extends ConstantExpression {
      * Get the value
      */
     public Object getValue() {
-        return new Long(value);
+        return value;
     }
 
     /**
@@ -71,7 +71,7 @@ class LongExpression extends ConstantExpression {
      * Code
      */
     public void codeValue(Environment env, Context ctx, Assembler asm) {
-        asm.add(where, opc_ldc2_w, new Long(value));
+        asm.add(where, opc_ldc2_w, value);
     }
 
     /**
diff --git a/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java b/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java
index 18af8c7830d..37c4458f6e4 100644
--- a/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java
+++ b/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java
@@ -747,7 +747,7 @@ class FileSystemPreferences extends AbstractPreferences {
                        nmt = systemRootModFile.lastModified();
                        isSystemRootModified = systemRootModTime == nmt;
                    }
-                   return new Long(nmt);
+                   return nmt;
                }
            });
            try {
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java
index 293b9e05341..1365a7d8a07 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java
@@ -38,8 +38,9 @@ public class XFocusProxyWindow extends XBaseWindow {
     public XFocusProxyWindow(XWindowPeer owner) {
         super(new XCreateWindowParams(new Object[] {
             BOUNDS, new Rectangle(-1, -1, 1, 1),
-            PARENT_WINDOW, new Long(owner.getWindow()),
-            EVENT_MASK, new Long(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)
+            PARENT_WINDOW, Long.valueOf(owner.getWindow()),
+            EVENT_MASK, Long.valueOf(XConstants.FocusChangeMask | XConstants
+                .KeyPressMask | XConstants.KeyReleaseMask)
         }));
         this.owner = owner;
     }
-- 
GitLab


From 5a0450feea95340545d30d58bcb5714f3e595d21 Mon Sep 17 00:00:00 2001
From: Otavio Santana <otaviojava@java.net>
Date: Tue, 1 Jul 2014 14:44:37 +0100
Subject: [PATCH 166/192] 8048874: Replace uses of 'new Byte', 'new Short' and
 'new Character' with appropriate alternative across core classes

Reviewed-by: chegar, psandoz, prappo
---
 .../plaf/windows/WindowsLookAndFeel.java      |  3 +-
 .../classes/com/sun/jmx/snmp/SnmpString.java  |  2 +-
 .../sun/jndi/toolkit/dir/SearchFilter.java    |  2 +-
 .../security/sasl/digest/DigestMD5Base.java   |  2 +-
 .../security/sasl/gsskerb/GssKrb5Client.java  |  4 +--
 .../security/sasl/gsskerb/GssKrb5Server.java  |  4 +--
 .../security/sasl/util/AbstractSaslImpl.java  |  2 +-
 jdk/src/share/classes/java/awt/Component.java |  2 +-
 .../awt/image/renderable/ParameterBlock.java  | 12 +++----
 .../share/classes/java/beans/Statement.java   |  2 +-
 .../javax/management/loading/MLet.java        |  4 +--
 .../jvminstr/JvmThreadInstanceEntryImpl.java  |  2 +-
 .../classes/sun/misc/ProxyGenerator.java      |  4 +--
 .../sun/security/pkcs/PKCS9Attribute.java     | 36 +++++++++----------
 .../share/classes/sun/security/x509/AVA.java  |  2 +-
 .../sun/tools/jconsole/inspector/Utils.java   |  4 +--
 16 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
index a6c1c895757..5998f85483c 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
@@ -1102,8 +1102,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
             "PasswordField.selectionBackground", SelectionBackgroundColor,
             "PasswordField.selectionForeground", SelectionTextColor,
             "PasswordField.caretForeground",WindowTextColor,
-            "PasswordField.echoChar", new XPValue(new Character((char)0x25CF),
-                                                  new Character('*')),
+            "PasswordField.echoChar", new XPValue((char)0x25CF, '*'),
 
             // *** ProgressBar
             "ProgressBar.font", ControlFont,
diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java
index 169b67bcad3..675386ab1be 100644
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java
@@ -140,7 +140,7 @@ public class SnmpString extends SnmpValue {
     public Byte[] toByte() {
         Byte[] result = new Byte[value.length] ;
         for (int i = 0 ; i < value.length ; i++) {
-            result[i] = new Byte(value[i]) ;
+            result[i] = value[i];
         }
         return result ;
     }
diff --git a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java
index bdbf578cc24..cf23c3dd2e4 100644
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java
@@ -379,7 +379,7 @@ public class SearchFilter implements AttrFilter {
         // used for substring comparisons (where proto has "*" wildcards
         private boolean substringMatch(String proto, String value) {
             // simple case 1: "*" means attribute presence is being tested
-            if(proto.equals(new Character(WILDCARD_TOKEN).toString())) {
+            if(proto.equals(Character.toString(WILDCARD_TOKEN))) {
                 if(debug) {System.out.println("simple presence assertion");}
                 return true;
             }
diff --git a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java
index 37a261a6a2f..3469e708233 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java
@@ -1460,7 +1460,7 @@ abstract class DigestMD5Base extends AbstractSaslImpl {
                     if (logger.isLoggable(Level.INFO)) {
                         logger.log(Level.INFO,
                             "DIGEST39:Incorrect padding: {0}",
-                            new Byte(msgWithPadding[msgWithPadding.length - 1]));
+                            msgWithPadding[msgWithPadding.length - 1]);
                     }
                     return EMPTY_BYTE_ARRAY;
                 }
diff --git a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
index e8d9a4cc866..aca462929f7 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
@@ -241,7 +241,7 @@ final class GssKrb5Client extends GssKrb5Base implements SaslClient {
                         "KRB5CLNT05:Challenge [unwrapped]:", gssOutToken);
                 }
                 logger.log(Level.FINE, "KRB5CLNT06:Server protections: {0}",
-                    new Byte(gssOutToken[0]));
+                    gssOutToken[0]);
             }
 
             // Client selects preferred protection
@@ -293,7 +293,7 @@ final class GssKrb5Client extends GssKrb5Base implements SaslClient {
             if (logger.isLoggable(Level.FINE)) {
                 logger.log(Level.FINE,
             "KRB5CLNT08:Selected protection: {0}; privacy: {1}; integrity: {2}",
-                    new Object[]{new Byte(selectedQop),
+                    new Object[]{selectedQop,
                                  Boolean.valueOf(privacy),
                                  Boolean.valueOf(integrity)});
             }
diff --git a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
index 94ce39c0ad1..c15dfc9aae7 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
@@ -221,7 +221,7 @@ final class GssKrb5Server extends GssKrb5Base implements SaslServer {
             if (logger.isLoggable(Level.FINE)) {
                 logger.log(Level.FINE,
                     "KRB5SRV06:Supported protections: {0}; recv max buf size: {1}",
-                    new Object[]{new Byte(allQop),
+                    new Object[]{allQop,
                                  new Integer(recvMaxBufSize)});
             }
 
@@ -288,7 +288,7 @@ final class GssKrb5Server extends GssKrb5Base implements SaslServer {
             if (logger.isLoggable(Level.FINE)) {
                 logger.log(Level.FINE,
             "KRB5SRV10:Selected protection: {0}; privacy: {1}; integrity: {2}",
-                    new Object[]{new Byte(selectedQop),
+                    new Object[]{selectedQop,
                                  Boolean.valueOf(privacy),
                                  Boolean.valueOf(integrity)});
                 logger.log(Level.FINE,
diff --git a/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java b/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java
index eb122e3bbb4..1136d8db723 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java
@@ -77,7 +77,7 @@ public abstract class AbstractSaslImpl {
 
             if (logger.isLoggable(Level.FINE)) {
                 logger.logp(Level.FINE, myClassName, "constructor",
-                    "SASLIMPL02:Preferred qop mask: {0}", new Byte(allQop));
+                    "SASLIMPL02:Preferred qop mask: {0}", allQop);
 
                 if (qop.length > 0) {
                     StringBuilder str = new StringBuilder();
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index b062cc718b7..24cc58733e7 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -8640,7 +8640,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
         if (changeSupport == null || oldValue == newValue) {
             return;
         }
-        firePropertyChange(propertyName, new Character(oldValue), new Character(newValue));
+        firePropertyChange(propertyName, Character.valueOf(oldValue), Character.valueOf(newValue));
     }
 
     /**
diff --git a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java
index 63e510d9c83..e6b923dda0e 100644
--- a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java
+++ b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java
@@ -337,7 +337,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *         the specified parameter.
      */
     public ParameterBlock add(byte b) {
-        return add(new Byte(b));
+        return add(Byte.valueOf(b));
     }
 
     /**
@@ -348,7 +348,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *         the specified parameter.
      */
     public ParameterBlock add(char c) {
-        return add(new Character(c));
+        return add(Character.valueOf(c));
     }
 
     /**
@@ -359,7 +359,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *         the specified parameter.
      */
     public ParameterBlock add(short s) {
-        return add(new Short(s));
+        return add(Short.valueOf(s));
     }
 
     /**
@@ -441,7 +441,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *        the specified parameter.
      */
     public ParameterBlock set(byte b, int index) {
-        return set(new Byte(b), index);
+        return set(Byte.valueOf(b), index);
     }
 
     /**
@@ -457,7 +457,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *        the specified parameter.
      */
     public ParameterBlock set(char c, int index) {
-        return set(new Character(c), index);
+        return set(Character.valueOf(c), index);
     }
 
     /**
@@ -473,7 +473,7 @@ public class ParameterBlock implements Cloneable, Serializable {
      *        the specified parameter.
      */
     public ParameterBlock set(short s, int index) {
-        return set(new Short(s), index);
+        return set(Short.valueOf(s), index);
     }
 
     /**
diff --git a/jdk/src/share/classes/java/beans/Statement.java b/jdk/src/share/classes/java/beans/Statement.java
index d1e6717817f..fc11a42be12 100644
--- a/jdk/src/share/classes/java/beans/Statement.java
+++ b/jdk/src/share/classes/java/beans/Statement.java
@@ -248,7 +248,7 @@ public class Statement {
                 // ignored elsewhere.
                 if (target == Character.class && arguments.length == 1 &&
                     argClasses[0] == String.class) {
-                    return new Character(((String)arguments[0]).charAt(0));
+                    return ((String)arguments[0]).charAt(0);
                 }
                 try {
                     m = ConstructorFinder.findConstructor((Class)target, argClasses);
diff --git a/jdk/src/share/classes/javax/management/loading/MLet.java b/jdk/src/share/classes/javax/management/loading/MLet.java
index b3f507839ad..54f2a872512 100644
--- a/jdk/src/share/classes/javax/management/loading/MLet.java
+++ b/jdk/src/share/classes/javax/management/loading/MLet.java
@@ -1307,9 +1307,9 @@ public class MLet extends java.net.URLClassLoader
         if (type.compareTo("java.lang.Boolean") == 0)
              return Boolean.valueOf(param);
         if (type.compareTo("java.lang.Byte") == 0)
-             return new Byte(param);
+             return Byte.valueOf(param);
         if (type.compareTo("java.lang.Short") == 0)
-             return new Short(param);
+             return Short.valueOf(param);
         if (type.compareTo("java.lang.Long") == 0)
              return Long.valueOf(param);
         if (type.compareTo("java.lang.Integer") == 0)
diff --git a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java
index d419e57e899..455bd677fc6 100644
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java
@@ -139,7 +139,7 @@ public class JvmThreadInstanceEntryImpl
                           "Unexpected exception: " + r);
                 log.debug("getJvmThreadInstState",r);
             }
-            Byte[] result = { new Byte(bitmap[0]), new Byte(bitmap[1]) };
+            Byte[] result = {bitmap[0], bitmap[1]};
             return result;
         }
     }
diff --git a/jdk/src/share/classes/sun/misc/ProxyGenerator.java b/jdk/src/share/classes/sun/misc/ProxyGenerator.java
index d561df61d27..844987823a7 100644
--- a/jdk/src/share/classes/sun/misc/ProxyGenerator.java
+++ b/jdk/src/share/classes/sun/misc/ProxyGenerator.java
@@ -1885,7 +1885,7 @@ public class ProxyGenerator {
                         "late constant pool addition: " + key);
                 }
                 short i = addEntry(new ValueEntry(key));
-                map.put(key, new Short(i));
+                map.put(key, i);
                 return i;
             }
         }
@@ -1903,7 +1903,7 @@ public class ProxyGenerator {
                     throw new InternalError("late constant pool addition");
                 }
                 short i = addEntry(e);
-                map.put(e, new Short(i));
+                map.put(e, i);
                 return i;
             }
         }
diff --git a/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java b/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java
index ab103d5963e..943ba93cc28 100644
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java
@@ -309,26 +309,26 @@ public class PKCS9Attribute implements DerEncoder {
      */
     private static final Byte[][] PKCS9_VALUE_TAGS = {
         null,
-        {new Byte(DerValue.tag_IA5String)},   // EMailAddress
-        {new Byte(DerValue.tag_IA5String),   // UnstructuredName
-         new Byte(DerValue.tag_PrintableString)},
-        {new Byte(DerValue.tag_ObjectId)},    // ContentType
-        {new Byte(DerValue.tag_OctetString)}, // MessageDigest
-        {new Byte(DerValue.tag_UtcTime)},     // SigningTime
-        {new Byte(DerValue.tag_Sequence)},    // Countersignature
-        {new Byte(DerValue.tag_PrintableString),
-         new Byte(DerValue.tag_T61String)},   // ChallengePassword
-        {new Byte(DerValue.tag_PrintableString),
-         new Byte(DerValue.tag_T61String)},   // UnstructuredAddress
-        {new Byte(DerValue.tag_SetOf)},       // ExtendedCertificateAttributes
-        {new Byte(DerValue.tag_Sequence)},    // issuerAndSerialNumber
+        {DerValue.tag_IA5String},   // EMailAddress
+        {DerValue.tag_IA5String,   // UnstructuredName
+         DerValue.tag_PrintableString},
+        {DerValue.tag_ObjectId},    // ContentType
+        {DerValue.tag_OctetString}, // MessageDigest
+        {DerValue.tag_UtcTime},     // SigningTime
+        {DerValue.tag_Sequence},    // Countersignature
+        {DerValue.tag_PrintableString,
+         DerValue.tag_T61String},   // ChallengePassword
+        {DerValue.tag_PrintableString,
+         DerValue.tag_T61String},   // UnstructuredAddress
+        {DerValue.tag_SetOf},       // ExtendedCertificateAttributes
+        {DerValue.tag_Sequence},    // issuerAndSerialNumber
         null,
         null,
         null,
-        {new Byte(DerValue.tag_Sequence)},    // extensionRequest
-        {new Byte(DerValue.tag_Sequence)},    // SMIMECapability
-        {new Byte(DerValue.tag_Sequence)},    // SigningCertificate
-        {new Byte(DerValue.tag_Sequence)}     // SignatureTimestampToken
+        {DerValue.tag_Sequence},    // extensionRequest
+        {DerValue.tag_Sequence},    // SMIMECapability
+        {DerValue.tag_Sequence},    // SigningCertificate
+        {DerValue.tag_Sequence}     // SignatureTimestampToken
     };
 
     private static final Class<?>[] VALUE_CLASSES = new Class<?>[18];
@@ -511,7 +511,7 @@ public class PKCS9Attribute implements DerEncoder {
         // check for illegal element tags
         Byte tag;
         for (int i=0; i < elems.length; i++) {
-            tag = new Byte(elems[i].tag);
+            tag = elems[i].tag;
 
             if (indexOf(tag, PKCS9_VALUE_TAGS[index], 0) == -1)
                 throwTagException(tag);
diff --git a/jdk/src/share/classes/sun/security/x509/AVA.java b/jdk/src/share/classes/sun/security/x509/AVA.java
index b07e565cfbd..fd3a3544592 100644
--- a/jdk/src/share/classes/sun/security/x509/AVA.java
+++ b/jdk/src/share/classes/sun/security/x509/AVA.java
@@ -517,7 +517,7 @@ public class AVA implements DerEncoder {
             if (hexDigits.indexOf(Character.toUpperCase((char)c2)) >= 0) {
                 int hi = Character.digit((char)c1, 16);
                 int lo = Character.digit((char)c2, 16);
-                return new Byte((byte)((hi<<4) + lo));
+                return (byte)((hi<<4) + lo);
             } else {
                 throw new IOException
                         ("escaped hex value must include two valid digits");
diff --git a/jdk/src/share/classes/sun/tools/jconsole/inspector/Utils.java b/jdk/src/share/classes/sun/tools/jconsole/inspector/Utils.java
index eb1f6b1be80..e706715fb0f 100644
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/Utils.java
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/Utils.java
@@ -342,14 +342,14 @@ public class Utils {
         Object result;
         if (primitiveToWrapper.containsKey(type)) {
             if (type.equals(Character.TYPE.getName())) {
-                result = new Character(value.charAt(0));
+                result = value.charAt(0);
             } else {
                 result = newStringConstructor(
                         ((Class<?>) primitiveToWrapper.get(type)).getName(),
                         value);
             }
         } else if (type.equals(Character.class.getName())) {
-            result = new Character(value.charAt(0));
+            result = value.charAt(0);
         } else if (Number.class.isAssignableFrom(Utils.getClass(type))) {
             result = createNumberFromStringValue(value);
         } else if (value == null || value.equals("null")) {
-- 
GitLab


From 68c76d1731c14dd39a22fd2481feeb5f68e715b1 Mon Sep 17 00:00:00 2001
From: Sean Coffey <coffeys@openjdk.org>
Date: Tue, 1 Jul 2014 15:17:55 +0100
Subject: [PATCH 167/192] 7095856: OutputStreamHook doesn't handle null values

Reviewed-by: lancea, msheppar
---
 .../com/sun/corba/se/impl/io/OutputStreamHook.java        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java b/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
index 1748397d065..6908cad9a83 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
+++ b/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -35,7 +35,8 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.ObjectOutputStream;
 import java.io.ObjectOutput;
-import java.util.Hashtable;
+import java.util.Map;
+import java.util.HashMap;
 
 import org.omg.CORBA.INTERNAL;
 
@@ -49,7 +50,7 @@ public abstract class OutputStreamHook extends ObjectOutputStream
      */
     private class HookPutFields extends ObjectOutputStream.PutField
     {
-        private Hashtable fields = new Hashtable();
+        private Map<String,Object> fields = new HashMap<>();
 
         /**
          * Put the value of the named boolean field into the persistent field.
@@ -140,7 +141,6 @@ public abstract class OutputStreamHook extends ObjectOutputStream
     public OutputStreamHook()
         throws java.io.IOException {
         super();
-
     }
 
     public void defaultWriteObject() throws IOException {
-- 
GitLab


From 2edd214440a4d4186506ce8ffdffd12ebce7be25 Mon Sep 17 00:00:00 2001
From: Jamil Nimeh <jamil.j.nimeh@oracle.com>
Date: Tue, 1 Jul 2014 09:46:20 -0700
Subject: [PATCH 168/192] 8015081: javax.security.auth.Subject.toString()
 throws NPE

Reviewed-by: xuelei, weijun
---
 .../classes/javax/security/auth/Subject.java  | 276 ++++--
 .../javax/security/auth/Subject/Generic.java  |   4 +-
 .../javax/security/auth/Subject/Serial.java   |   4 +-
 .../javax/security/auth/Subject/Subject.java  | 126 +++
 .../auth/Subject/SubjectNullTests.java        | 852 ++++++++++++++++++
 5 files changed, 1172 insertions(+), 90 deletions(-)
 create mode 100644 jdk/test/javax/security/auth/Subject/Subject.java
 create mode 100644 jdk/test/javax/security/auth/Subject/SubjectNullTests.java

diff --git a/jdk/src/share/classes/javax/security/auth/Subject.java b/jdk/src/share/classes/javax/security/auth/Subject.java
index 2c9e8b8083f..e8ce12c9eee 100644
--- a/jdk/src/share/classes/javax/security/auth/Subject.java
+++ b/jdk/src/share/classes/javax/security/auth/Subject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -142,7 +142,9 @@ public final class Subject implements java.io.Serializable {
      * <p> The newly constructed Sets check whether this {@code Subject}
      * has been set read-only before permitting subsequent modifications.
      * The newly created Sets also prevent illegal modifications
-     * by ensuring that callers have sufficient permissions.
+     * by ensuring that callers have sufficient permissions.  These Sets
+     * also prohibit null elements, and attempts to add or query a null
+     * element will result in a {@code NullPointerException}.
      *
      * <p> To modify the Principals Set, the caller must have
      * {@code AuthPermission("modifyPrincipals")}.
@@ -170,7 +172,9 @@ public final class Subject implements java.io.Serializable {
      * These newly created Sets check whether this {@code Subject}
      * has been set read-only before permitting subsequent modifications.
      * The newly created Sets also prevent illegal modifications
-     * by ensuring that callers have sufficient permissions.
+     * by ensuring that callers have sufficient permissions.  These Sets
+     * also prohibit null elements, and attempts to add or query a null
+     * element will result in a {@code NullPointerException}.
      *
      * <p> To modify the Principals Set, the caller must have
      * {@code AuthPermission("modifyPrincipals")}.
@@ -194,17 +198,16 @@ public final class Subject implements java.io.Serializable {
      *
      * @exception NullPointerException if the specified
      *          {@code principals}, {@code pubCredentials},
-     *          or {@code privCredentials} are {@code null}.
+     *          or {@code privCredentials} are {@code null},
+     *          or a null value exists within any of these three
+     *          Sets.
      */
     public Subject(boolean readOnly, Set<? extends Principal> principals,
                    Set<?> pubCredentials, Set<?> privCredentials)
     {
-
-        if (principals == null ||
-            pubCredentials == null ||
-            privCredentials == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.input.s."));
+        collectionNullClean(principals);
+        collectionNullClean(pubCredentials);
+        collectionNullClean(privCredentials);
 
         this.principals = Collections.synchronizedSet(new SecureSet<Principal>
                                 (this, PRINCIPAL_SET, principals));
@@ -287,18 +290,17 @@ public final class Subject implements java.io.Serializable {
             sm.checkPermission(AuthPermissionHolder.GET_SUBJECT_PERMISSION);
         }
 
-        if (acc == null) {
-            throw new NullPointerException(ResourcesMgr.getString
+        Objects.requireNonNull(acc, ResourcesMgr.getString
                 ("invalid.null.AccessControlContext.provided"));
-        }
 
         // return the Subject from the DomainCombiner of the provided context
         return AccessController.doPrivileged
             (new java.security.PrivilegedAction<Subject>() {
             public Subject run() {
                 DomainCombiner dc = acc.getDomainCombiner();
-                if (!(dc instanceof SubjectDomainCombiner))
+                if (!(dc instanceof SubjectDomainCombiner)) {
                     return null;
+                }
                 SubjectDomainCombiner sdc = (SubjectDomainCombiner)dc;
                 return sdc.getSubject();
             }
@@ -347,9 +349,9 @@ public final class Subject implements java.io.Serializable {
         if (sm != null) {
             sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
         }
-        if (action == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.action.provided"));
+
+        Objects.requireNonNull(action,
+                ResourcesMgr.getString("invalid.null.action.provided"));
 
         // set up the new Subject-based AccessControlContext
         // for doPrivileged
@@ -410,9 +412,8 @@ public final class Subject implements java.io.Serializable {
             sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
         }
 
-        if (action == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.action.provided"));
+        Objects.requireNonNull(action,
+                ResourcesMgr.getString("invalid.null.action.provided"));
 
         // set up the new Subject-based AccessControlContext for doPrivileged
         final AccessControlContext currentAcc = AccessController.getContext();
@@ -467,9 +468,8 @@ public final class Subject implements java.io.Serializable {
             sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
         }
 
-        if (action == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.action.provided"));
+        Objects.requireNonNull(action,
+                ResourcesMgr.getString("invalid.null.action.provided"));
 
         // set up the new Subject-based AccessControlContext
         // for doPrivileged
@@ -534,9 +534,8 @@ public final class Subject implements java.io.Serializable {
             sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
         }
 
-        if (action == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.action.provided"));
+        Objects.requireNonNull(action,
+                ResourcesMgr.getString("invalid.null.action.provided"));
 
         // set up the new Subject-based AccessControlContext for doPrivileged
         final AccessControlContext callerAcc =
@@ -557,13 +556,14 @@ public final class Subject implements java.io.Serializable {
         return java.security.AccessController.doPrivileged
             (new java.security.PrivilegedAction<AccessControlContext>() {
             public AccessControlContext run() {
-                if (subject == null)
+                if (subject == null) {
                     return new AccessControlContext(acc, null);
-                else
+                } else {
                     return new AccessControlContext
                                         (acc,
                                         new SubjectDomainCombiner(subject));
             }
+            }
         });
     }
 
@@ -615,9 +615,8 @@ public final class Subject implements java.io.Serializable {
      */
     public <T extends Principal> Set<T> getPrincipals(Class<T> c) {
 
-        if (c == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.Class.provided"));
+        Objects.requireNonNull(c,
+                ResourcesMgr.getString("invalid.null.Class.provided"));
 
         // always return an empty Set instead of null
         // so LoginModules can add to the Set if necessary
@@ -711,9 +710,8 @@ public final class Subject implements java.io.Serializable {
      */
     public <T> Set<T> getPublicCredentials(Class<T> c) {
 
-        if (c == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.Class.provided"));
+        Objects.requireNonNull(c,
+                ResourcesMgr.getString("invalid.null.Class.provided"));
 
         // always return an empty Set instead of null
         // so LoginModules can add to the Set if necessary
@@ -758,9 +756,8 @@ public final class Subject implements java.io.Serializable {
         // would do is protect the set operations themselves
         // (like size()), which don't seem security-sensitive.
 
-        if (c == null)
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.Class.provided"));
+        Objects.requireNonNull(c,
+                ResourcesMgr.getString("invalid.null.Class.provided"));
 
         // always return an empty Set instead of null
         // so LoginModules can add to the Set if necessary
@@ -790,11 +787,13 @@ public final class Subject implements java.io.Serializable {
      */
     public boolean equals(Object o) {
 
-        if (o == null)
+        if (o == null) {
             return false;
+        }
 
-        if (this == o)
+        if (this == o) {
             return true;
+        }
 
         if (o instanceof Subject) {
 
@@ -969,11 +968,10 @@ public final class Subject implements java.io.Serializable {
 
         Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null);
 
+        Objects.requireNonNull(inputPrincs,
+                ResourcesMgr.getString("invalid.null.input.s."));
+
         // Rewrap the principals into a SecureSet
-        if (inputPrincs == null) {
-            throw new NullPointerException
-                (ResourcesMgr.getString("invalid.null.input.s."));
-        }
         try {
             principals = Collections.synchronizedSet(new SecureSet<Principal>
                                 (this, PRINCIPAL_SET, inputPrincs));
@@ -992,14 +990,44 @@ public final class Subject implements java.io.Serializable {
                         (new SecureSet<Object>(this, PRIV_CREDENTIAL_SET));
     }
 
+    /**
+     * Tests for null-clean collections (both non-null reference and
+     * no null elements)
+     *
+     * @param coll A {@code Collection} to be tested for null references
+     *
+     * @exception NullPointerException if the specified collection is either
+     *            {@code null} or contains a {@code null} element
+     */
+    private static void collectionNullClean(Collection<?> coll) {
+        boolean hasNullElements = false;
+
+        Objects.requireNonNull(coll,
+                ResourcesMgr.getString("invalid.null.input.s."));
+
+        try {
+            hasNullElements = coll.contains(null);
+        } catch (NullPointerException npe) {
+            // A null-hostile collection may choose to throw
+            // NullPointerException if contains(null) is called on it
+            // rather than returning false.
+            // If this happens we know the collection is null-clean.
+            hasNullElements = false;
+        } finally {
+            if (hasNullElements) {
+                throw new NullPointerException
+                    (ResourcesMgr.getString("invalid.null.input.s."));
+            }
+        }
+    }
+
     /**
      * Prevent modifications unless caller has permission.
      *
      * @serial include
      */
     private static class SecureSet<E>
-        extends AbstractSet<E>
-        implements java.io.Serializable {
+        implements Set<E>, java.io.Serializable {
 
         private static final long serialVersionUID = 7911754171111800359L;
 
@@ -1098,6 +1126,9 @@ public final class Subject implements java.io.Serializable {
 
         public boolean add(E o) {
 
+            Objects.requireNonNull(o,
+                    ResourcesMgr.getString("invalid.null.input.s."));
+
             if (subject.isReadOnly()) {
                 throw new IllegalStateException
                         (ResourcesMgr.getString("Subject.is.read.only"));
@@ -1133,12 +1164,16 @@ public final class Subject implements java.io.Serializable {
             // check for duplicates
             if (!elements.contains(o))
                 return elements.add(o);
-            else
+            else {
                 return false;
         }
+        }
 
         public boolean remove(Object o) {
 
+            Objects.requireNonNull(o,
+                    ResourcesMgr.getString("invalid.null.input.s."));
+
             final Iterator<E> e = iterator();
             while (e.hasNext()) {
                 E next;
@@ -1153,12 +1188,7 @@ public final class Subject implements java.io.Serializable {
                     });
                 }
 
-                if (next == null) {
-                    if (o == null) {
-                        e.remove();
-                        return true;
-                    }
-                } else if (next.equals(o)) {
+                if (next.equals(o)) {
                     e.remove();
                     return true;
                 }
@@ -1167,6 +1197,10 @@ public final class Subject implements java.io.Serializable {
         }
 
         public boolean contains(Object o) {
+
+            Objects.requireNonNull(o,
+                    ResourcesMgr.getString("invalid.null.input.s."));
+
             final Iterator<E> e = iterator();
             while (e.hasNext()) {
                 E next;
@@ -1194,19 +1228,28 @@ public final class Subject implements java.io.Serializable {
                     });
                 }
 
-                if (next == null) {
-                    if (o == null) {
-                        return true;
-                    }
-                } else if (next.equals(o)) {
+                if (next.equals(o)) {
                     return true;
                 }
             }
             return false;
         }
 
+        public boolean addAll(Collection<? extends E> c) {
+            boolean result = false;
+
+            collectionNullClean(c);
+
+            for (E item : c) {
+                result |= this.add(item);
+            }
+
+            return result;
+        }
+
         public boolean removeAll(Collection<?> c) {
-            Objects.requireNonNull(c);
+            collectionNullClean(c);
+
             boolean modified = false;
             final Iterator<E> e = iterator();
             while (e.hasNext()) {
@@ -1224,30 +1267,34 @@ public final class Subject implements java.io.Serializable {
 
                 Iterator<?> ce = c.iterator();
                 while (ce.hasNext()) {
-                    Object o = ce.next();
-                    if (next == null) {
-                        if (o == null) {
+                    if (next.equals(ce.next())) {
                             e.remove();
                             modified = true;
                             break;
                         }
-                    } else if (next.equals(o)) {
-                        e.remove();
-                        modified = true;
-                        break;
-                    }
                 }
             }
             return modified;
         }
 
+        public boolean containsAll(Collection<?> c) {
+            collectionNullClean(c);
+
+            for (Object item : c) {
+                if (this.contains(item) == false) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
         public boolean retainAll(Collection<?> c) {
-            Objects.requireNonNull(c);
+            collectionNullClean(c);
+
             boolean modified = false;
-            boolean retain = false;
             final Iterator<E> e = iterator();
             while (e.hasNext()) {
-                retain = false;
                 E next;
                 if (which != Subject.PRIV_CREDENTIAL_SET) {
                     next = e.next();
@@ -1260,26 +1307,12 @@ public final class Subject implements java.io.Serializable {
                     });
                 }
 
-                Iterator<?> ce = c.iterator();
-                while (ce.hasNext()) {
-                    Object o = ce.next();
-                    if (next == null) {
-                        if (o == null) {
-                            retain = true;
-                            break;
-                        }
-                    } else if (next.equals(o)) {
-                        retain = true;
-                        break;
-                    }
-                }
-
-                if (!retain) {
+                if (c.contains(next) == false) {
                     e.remove();
-                    retain = false;
                     modified = true;
+                    }
                 }
-            }
+
             return modified;
         }
 
@@ -1301,6 +1334,73 @@ public final class Subject implements java.io.Serializable {
             }
         }
 
+        public boolean isEmpty() {
+            return elements.isEmpty();
+        }
+
+        public Object[] toArray() {
+            final Iterator<E> e = iterator();
+            while (e.hasNext()) {
+                // The next() method performs a security manager check
+                // on each element in the SecureSet.  If we make it all
+                // the way through we should be able to simply return
+                // element's toArray results.  Otherwise we'll let
+                // the SecurityException pass up the call stack.
+                e.next();
+            }
+
+            return elements.toArray();
+        }
+
+        public <T> T[] toArray(T[] a) {
+            final Iterator<E> e = iterator();
+            while (e.hasNext()) {
+                // The next() method performs a security manager check
+                // on each element in the SecureSet.  If we make it all
+                // the way through we should be able to simply return
+                // element's toArray results.  Otherwise we'll let
+                // the SecurityException pass up the call stack.
+                e.next();
+            }
+
+            return elements.toArray(a);
+        }
+
+        public boolean equals(Object o) {
+            if (o == this) {
+                return true;
+            }
+
+            if (!(o instanceof Set)) {
+                return false;
+            }
+
+            Collection<?> c = (Collection<?>) o;
+            if (c.size() != size()) {
+                return false;
+            }
+
+            try {
+                return containsAll(c);
+            } catch (ClassCastException unused)   {
+                return false;
+            } catch (NullPointerException unused) {
+                return false;
+            }
+        }
+
+        public int hashCode() {
+            int h = 0;
+            Iterator<E> i = iterator();
+            while (i.hasNext()) {
+                E obj = i.next();
+                if (obj != null) {
+                    h += obj.hashCode();
+                }
+            }
+            return h;
+        }
+
         /**
          * Writes this object out to a stream (i.e., serializes it).
          *
@@ -1338,12 +1438,16 @@ public final class Subject implements java.io.Serializable {
             which = fields.get("which", 0);
 
             LinkedList<E> tmp = (LinkedList<E>) fields.get("elements", null);
+
+            Subject.collectionNullClean(tmp);
+
             if (tmp.getClass() != LinkedList.class) {
                 elements = new LinkedList<E>(tmp);
             } else {
                 elements = tmp;
             }
         }
+
     }
 
     /**
diff --git a/jdk/test/javax/security/auth/Subject/Generic.java b/jdk/test/javax/security/auth/Subject/Generic.java
index 66bf5605649..1afba28f1fb 100644
--- a/jdk/test/javax/security/auth/Subject/Generic.java
+++ b/jdk/test/javax/security/auth/Subject/Generic.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014 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,7 +28,7 @@
  */
 
 import java.security.*;
-import javax.security.auth.*;
+import javax.security.auth.Subject;
 
 public class Generic {
     public static void main(String[] args) throws Exception {
diff --git a/jdk/test/javax/security/auth/Subject/Serial.java b/jdk/test/javax/security/auth/Subject/Serial.java
index 3bdee14071f..f4fc860d37e 100644
--- a/jdk/test/javax/security/auth/Subject/Serial.java
+++ b/jdk/test/javax/security/auth/Subject/Serial.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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,7 @@
  * @run main/othervm/policy=Serial.policy Serial
  */
 
-import javax.security.auth.*;
+import javax.security.auth.Subject;
 import java.io.*;
 import java.util.*;
 
diff --git a/jdk/test/javax/security/auth/Subject/Subject.java b/jdk/test/javax/security/auth/Subject/Subject.java
new file mode 100644
index 00000000000..422e94ae5ec
--- /dev/null
+++ b/jdk/test/javax/security/auth/Subject/Subject.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * An implementation of the Subject class that provides basic functionality
+ * for the construction of Subject objects with null Principal elements.
+ * This is a helper class for serialization tests tied to bug 8015081
+ * (see SubjectNullTests.java).
+ */
+package jjjjj.security.auth;
+
+import sun.misc.HexDumpEncoder;
+import javax.management.remote.JMXPrincipal;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.x500.X500Principal;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.lang.Exception;
+import java.lang.RuntimeException;
+import java.security.Principal;
+import java.util.AbstractSet;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Set;
+
+import java.io.FileOutputStream;
+
+public class Subject implements java.io.Serializable {
+
+    private static final long serialVersionUID = -8308522755600156056L;
+
+    Set<Principal> principals;
+    private volatile boolean readOnly = false;
+    private static final int PRINCIPAL_SET = 1;
+
+    public Subject(Set<? extends Principal> principals) {
+        this.principals = Collections.synchronizedSet(new SecureSet<Principal>
+                (this, PRINCIPAL_SET, principals));
+    }
+
+    public Set<Principal> getPrincipals() {
+        return principals;
+    }
+
+    private static class SecureSet<E>
+            extends AbstractSet<E>
+            implements java.io.Serializable {
+
+        private static final long serialVersionUID = 7911754171111800359L;
+        private static final ObjectStreamField[] serialPersistentFields = {
+                new ObjectStreamField("this$0", Subject.class),
+                new ObjectStreamField("elements", LinkedList.class),
+                new ObjectStreamField("which", int.class)
+        };
+
+        Subject subject;
+        LinkedList<E> elements;
+        private int which;
+
+        SecureSet(Subject subject, int which, Set<? extends E> set) {
+            this.subject = subject;
+            this.which = which;
+            this.elements = new LinkedList<E>(set);
+        }
+
+        public Iterator<E> iterator() {
+            return elements.iterator();
+        }
+
+        public int size() {
+            return elements.size();
+        }
+
+        private void writeObject(java.io.ObjectOutputStream oos)
+                throws java.io.IOException {
+
+            ObjectOutputStream.PutField fields = oos.putFields();
+            fields.put("this$0", subject);
+            fields.put("elements", elements);
+            fields.put("which", which);
+            oos.writeFields();
+        }
+    }
+
+    public static byte[] enc(Object obj) {
+        try {
+            HexDumpEncoder hex = new HexDumpEncoder();
+            ByteArrayOutputStream bout;
+            bout = new ByteArrayOutputStream();
+            new ObjectOutputStream(bout).writeObject(obj);
+            byte[] data = bout.toByteArray();
+            for (int i = 0; i < data.length - 5; i++) {
+                if (data[i] == 'j' && data[i + 1] == 'j' && data[i + 2] == 'j'
+                        && data[i + 3] == 'j' && data[i + 4] == 'j') {
+                    System.arraycopy("javax".getBytes(), 0, data, i, 5);
+                }
+            }
+            return data;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/jdk/test/javax/security/auth/Subject/SubjectNullTests.java b/jdk/test/javax/security/auth/Subject/SubjectNullTests.java
new file mode 100644
index 00000000000..c473ea8f30b
--- /dev/null
+++ b/jdk/test/javax/security/auth/Subject/SubjectNullTests.java
@@ -0,0 +1,852 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8015081
+ * @compile Subject.java
+ * @compile SubjectNullTests.java
+ * @build SubjectNullTests
+ * @run main SubjectNullTests
+ * @summary javax.security.auth.Subject.toString() throws NPE
+ */
+
+import java.io.File;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import javax.management.remote.JMXPrincipal;
+import javax.security.auth.Subject;
+import javax.security.auth.x500.X500Principal;
+import javax.security.auth.kerberos.KerberosPrincipal;
+
+public class SubjectNullTests {
+
+    // Value templates for the constructor
+    private static Principal[] princVals = {
+        new X500Principal("CN=Tom Sawyer, ST=Missouri, C=US"),
+        new JMXPrincipal("Huckleberry Finn"),
+        new KerberosPrincipal("mtwain/author@LITERATURE.US")
+    };
+    private static String[] pubVals = {"tsawyer", "hfinn", "mtwain"};
+    private static String[] privVals = {"th3R!v3r", "oNth3R4ft", "5Cl3M3nz"};
+
+    // Templates for collection-based modifiers for the Subject
+    private static Principal[] tmplAddPrincs = {
+        new X500Principal("CN=John Doe, O=Bogus Corp."),
+        new KerberosPrincipal("jdoe/admin@BOGUSCORP.COM")
+    };
+    private static String[] tmplAddPubVals = {"jdoe", "djoe"};
+    private static String[] tmplAddPrvVals = {"b4dpa55w0rd", "pass123"};
+
+    /**
+     * Byte arrays used for deserialization:
+     * These byte arrays contain serialized Subjects and SecureSets,
+     * either with or without nulls.  These use
+     * jjjjj.security.auth.Subject, which is a modified Subject
+     * implementation that allows the addition of null elements
+     */
+    private static final byte[] SUBJ_NO_NULL =
+        jjjjj.security.auth.Subject.enc(makeSubjWithNull(false));
+    private static final byte[] SUBJ_WITH_NULL =
+        jjjjj.security.auth.Subject.enc(makeSubjWithNull(true));
+    private static final byte[] PRIN_NO_NULL =
+        jjjjj.security.auth.Subject.enc(makeSecSetWithNull(false));
+    private static final byte[] PRIN_WITH_NULL =
+        jjjjj.security.auth.Subject.enc(makeSecSetWithNull(true));
+
+    /**
+     * Method to allow creation of a subject that can optionally
+     * insert a null reference into the principals Set.
+     */
+    private static jjjjj.security.auth.Subject makeSubjWithNull(
+            boolean nullPrinc) {
+        Set<Principal> setPrinc = new HashSet<>(Arrays.asList(princVals));
+        if (nullPrinc) {
+            setPrinc.add(null);
+        }
+
+        return (new jjjjj.security.auth.Subject(setPrinc));
+    }
+
+    /**
+     * Method to allow creation of a SecureSet that can optionally
+     * insert a null reference.
+     */
+    private static Set<Principal> makeSecSetWithNull(boolean nullPrinc) {
+        Set<Principal> setPrinc = new HashSet<>(Arrays.asList(princVals));
+        if (nullPrinc) {
+            setPrinc.add(null);
+        }
+
+        jjjjj.security.auth.Subject subj =
+            new jjjjj.security.auth.Subject(setPrinc);
+
+        return subj.getPrincipals();
+    }
+
+    /**
+     * Construct a subject, and optionally place a null in any one
+     * of the three Sets used to initialize a Subject's values
+     */
+    private static Subject makeSubj(boolean nullPrinc, boolean nullPub,
+                             boolean nullPriv) {
+        Set<Principal> setPrinc = new HashSet<>(Arrays.asList(princVals));
+        Set<String> setPubCreds = new HashSet<>(Arrays.asList(pubVals));
+        Set<String> setPrvCreds = new HashSet<>(Arrays.asList(privVals));
+
+        if (nullPrinc) {
+            setPrinc.add(null);
+        }
+
+        if (nullPub) {
+            setPubCreds.add(null);
+        }
+
+        if (nullPriv) {
+            setPrvCreds.add(null);
+        }
+
+        return (new Subject(false, setPrinc, setPubCreds, setPrvCreds));
+    }
+
+    /**
+     * Provide a simple interface for abstracting collection-on-collection
+     * functions
+     */
+    public interface Function {
+        boolean execCollection(Set<?> subjSet, Collection<?> actorData);
+    }
+
+    public static final Function methAdd = new Function() {
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean execCollection(Set<?> subjSet, Collection<?> actorData) {
+            return subjSet.addAll((Collection)actorData);
+        }
+    };
+
+    public static final Function methContains = new Function() {
+        @Override
+        public boolean execCollection(Set<?> subjSet, Collection<?> actorData) {
+            return subjSet.containsAll(actorData);
+        }
+    };
+
+    public static final Function methRemove = new Function() {
+        @Override
+        public boolean execCollection(Set<?> subjSet, Collection<?> actorData) {
+            return subjSet.removeAll(actorData);
+        }
+    };
+
+    public static final Function methRetain = new Function() {
+        @Override
+        public boolean execCollection(Set<?> subjSet, Collection<?> actorData) {
+            return subjSet.retainAll(actorData);
+        }
+    };
+
+    /**
+     * Run a test using a specified Collection method upon a Subject's
+     * SecureSet fields. This method expects NullPointerExceptions
+     * to be thrown, and throws RuntimeException when the operation
+     * succeeds
+     */
+    private static void nullTestCollection(Function meth, Set<?> subjSet,
+           Collection<?> actorData) {
+        try {
+            meth.execCollection(subjSet, actorData);
+            throw new RuntimeException("Failed to throw NullPointerException");
+        } catch (NullPointerException npe) {
+            System.out.println("Caught expected NullPointerException [PASS]");
+        }
+    }
+
+    /**
+     * Run a test using a specified Collection method upon a Subject's
+     * SecureSet fields. This method expects the function and arguments
+     * passed in to complete without exception.  It returns false
+     * if either an exception occurs or the result of the operation is
+     * false.
+     */
+    private static boolean validTestCollection(Function meth, Set<?> subjSet,
+           Collection<?> actorData) {
+        boolean result = false;
+
+        try {
+            result = meth.execCollection(subjSet, actorData);
+        } catch (Exception exc) {
+            System.out.println("Caught exception " + exc);
+        }
+
+        return result;
+    }
+
+    /**
+     * Deserialize an object from a byte array.
+     *
+     * @param type The {@code Class} that the serialized file is supposed
+     *             to contain.
+     * @param serBuffer The byte array containing the serialized object data
+     *
+     * @return An object of the type specified in the {@code type} parameter
+     */
+    private static <T> T deserializeBuffer(Class<T> type, byte[] serBuffer)
+            throws IOException, ClassNotFoundException {
+
+        ByteArrayInputStream bis = new ByteArrayInputStream(serBuffer);
+        ObjectInputStream ois = new ObjectInputStream(bis);
+
+        T newObj = type.cast(ois.readObject());
+        ois.close();
+        bis.close();
+
+        return newObj;
+    }
+
+    private static void testCTOR() {
+        System.out.println("------ constructor ------");
+
+        try {
+            // Case 1: Create a subject with a null principal
+            // Expected result: NullPointerException
+            Subject mtSubj = makeSubj(true, false, false);
+            throw new RuntimeException(
+                    "constructor [principal w/ null]: Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println("constructor [principal w/ null]: " +
+                    "NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 2: Create a subject with a null public credential element
+            // Expected result: NullPointerException
+            Subject mtSubj = makeSubj(false, true, false);
+            throw new RuntimeException(
+                    "constructor [pub cred w/ null]: Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println("constructor [pub cred w/ null]: " +
+                    "NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 3: Create a subject with a null private credential element
+            // Expected result: NullPointerException
+            Subject mtSubj = makeSubj(false, false, true);
+            throw new RuntimeException(
+                    "constructor [priv cred w/ null]: Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println("constructor [priv cred w/ null]: " +
+                    "NullPointerException [PASS]");
+        }
+
+        // Case 4: Create a new subject using the principals, public
+        // and private credentials from another well-formed subject
+        // Expected result: Successful construction
+        Subject srcSubj = makeSubj(false, false, false);
+        Subject mtSubj = new Subject(false, srcSubj.getPrincipals(),
+                srcSubj.getPublicCredentials(),
+                srcSubj.getPrivateCredentials());
+        System.out.println("Construction from another well-formed Subject's " +
+                "principals/creds [PASS]");
+    }
+
+    @SuppressWarnings("unchecked")
+    private static void testDeserialize() throws Exception {
+        System.out.println("------ deserialize -----");
+
+        Subject subj = null;
+        Set<Principal> prin = null;
+
+        // Case 1: positive deserialization test of a Subject
+        // Expected result: well-formed Subject
+        subj = deserializeBuffer(Subject.class, SUBJ_NO_NULL);
+        System.out.println("Positive deserialization test (Subject) passed");
+
+        // Case 2: positive deserialization test of a SecureSet
+        // Expected result: well-formed Set
+        prin = deserializeBuffer(Set.class, PRIN_NO_NULL);
+        System.out.println("Positive deserialization test (SecureSet) passed");
+
+        System.out.println(
+                "* Testing deserialization with null-poisoned objects");
+        // Case 3: deserialization test of a null-poisoned Subject
+        // Expected result: NullPointerException
+        try {
+            subj = deserializeBuffer(Subject.class, SUBJ_WITH_NULL);
+            throw new RuntimeException("Failed to throw NullPointerException");
+        } catch (NullPointerException npe) {
+            System.out.println("Caught expected NullPointerException [PASS]");
+        }
+
+        // Case 4: deserialization test of a null-poisoned SecureSet
+        // Expected result: NullPointerException
+        try {
+            prin = deserializeBuffer(Set.class, PRIN_WITH_NULL);
+            throw new RuntimeException("Failed to throw NullPointerException");
+        } catch (NullPointerException npe) {
+            System.out.println("Caught expected NullPointerException [PASS]");
+        }
+    }
+
+    private static void testAdd() {
+        System.out.println("------ add() ------");
+        // Create a well formed subject
+        Subject mtSubj = makeSubj(false, false, false);
+
+        try {
+            // Case 1: Attempt to add null values to principal
+            // Expected result: NullPointerException
+            mtSubj.getPrincipals().add(null);
+            throw new RuntimeException(
+                    "PRINCIPAL add(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PRINCIPAL add(null): NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 2: Attempt to add null into the public creds
+            // Expected result: NullPointerException
+            mtSubj.getPublicCredentials().add(null);
+            throw new RuntimeException(
+                    "PUB CRED add(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PUB CRED add(null): NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 3: Attempt to add null into the private creds
+            // Expected result: NullPointerException
+            mtSubj.getPrivateCredentials().add(null);
+            throw new RuntimeException(
+                    "PRIV CRED add(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PRIV CRED add(null): NullPointerException [PASS]");
+        }
+    }
+
+    private static void testRemove() {
+        System.out.println("------ remove() ------");
+        // Create a well formed subject
+        Subject mtSubj = makeSubj(false, false, false);
+
+        try {
+            // Case 1: Attempt to remove null values from principal
+            // Expected result: NullPointerException
+            mtSubj.getPrincipals().remove(null);
+            throw new RuntimeException(
+                    "PRINCIPAL remove(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PRINCIPAL remove(null): NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 2: Attempt to remove null from the public creds
+            // Expected result: NullPointerException
+            mtSubj.getPublicCredentials().remove(null);
+            throw new RuntimeException(
+                    "PUB CRED remove(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PUB CRED remove(null): NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 3: Attempt to remove null from the private creds
+            // Expected result: NullPointerException
+            mtSubj.getPrivateCredentials().remove(null);
+            throw new RuntimeException(
+                    "PRIV CRED remove(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PRIV CRED remove(null): NullPointerException [PASS]");
+        }
+    }
+
+    private static void testContains() {
+        System.out.println("------ contains() ------");
+        // Create a well formed subject
+        Subject mtSubj = makeSubj(false, false, false);
+
+        try {
+            // Case 1: Attempt to check for null values in principals
+            // Expected result: NullPointerException
+            mtSubj.getPrincipals().contains(null);
+            throw new RuntimeException(
+                    "PRINCIPAL contains(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PRINCIPAL contains(null): NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 2: Attempt to check for null in public creds
+            // Expected result: NullPointerException
+            mtSubj.getPublicCredentials().contains(null);
+            throw new RuntimeException(
+                    "PUB CRED contains(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PUB CRED contains(null): NullPointerException [PASS]");
+        }
+
+        try {
+            // Case 3: Attempt to check for null in private creds
+            // Expected result: NullPointerException
+            mtSubj.getPrivateCredentials().contains(null);
+            throw new RuntimeException(
+                    "PRIV CRED contains(null): Failed to throw NPE");
+        } catch (NullPointerException npe) {
+            System.out.println(
+                    "PRIV CRED contains(null): NullPointerException [PASS]");
+        }
+    }
+
+    private static void testAddAll() {
+        // Create a well formed subject and additional collections
+        Subject mtSubj = makeSubj(false, false, false);
+        Set<Principal> morePrincs = new HashSet<>(Arrays.asList(tmplAddPrincs));
+        Set<Object> morePubVals = new HashSet<>(Arrays.asList(tmplAddPubVals));
+        Set<Object> morePrvVals = new HashSet<>(Arrays.asList(tmplAddPrvVals));
+
+        // Run one success test for each Subject family to verify the
+        // overloaded method works as intended.
+        Set<Principal> setPrin = mtSubj.getPrincipals();
+        Set<Object> setPubCreds = mtSubj.getPublicCredentials();
+        Set<Object> setPrvCreds = mtSubj.getPrivateCredentials();
+        int prinOrigSize = setPrin.size();
+        int pubOrigSize = setPubCreds.size();
+        int prvOrigSize = setPrvCreds.size();
+
+        System.out.println("------ addAll() -----");
+
+        // Add the new members, then check the resulting size of the
+        // Subject attributes to verify they've increased by the proper
+        // amounts.
+        if ((validTestCollection(methAdd, setPrin, morePrincs) != true) ||
+            (setPrin.size() != prinOrigSize + morePrincs.size()))
+        {
+            throw new RuntimeException("Failed addAll() on principals");
+        }
+        if ((validTestCollection(methAdd, setPubCreds,
+                morePubVals) != true) ||
+            (setPubCreds.size() != pubOrigSize + morePubVals.size()))
+        {
+            throw new RuntimeException("Failed addAll() on public creds");
+        }
+        if ((validTestCollection(methAdd, setPrvCreds,
+                morePrvVals) != true) ||
+            (setPrvCreds.size() != prvOrigSize + morePrvVals.size()))
+        {
+            throw new RuntimeException("Failed addAll() on private creds");
+        }
+        System.out.println("Positive addAll() test passed");
+
+        // Now add null elements into each container, then retest
+        morePrincs.add(null);
+        morePubVals.add(null);
+        morePrvVals.add(null);
+
+        System.out.println("* Testing addAll w/ null values on Principals");
+        nullTestCollection(methAdd, mtSubj.getPrincipals(), null);
+        nullTestCollection(methAdd, mtSubj.getPrincipals(), morePrincs);
+
+        System.out.println("* Testing addAll w/ null values on Public Creds");
+        nullTestCollection(methAdd, mtSubj.getPublicCredentials(), null);
+        nullTestCollection(methAdd, mtSubj.getPublicCredentials(),
+                morePubVals);
+
+        System.out.println("* Testing addAll w/ null values on Private Creds");
+        nullTestCollection(methAdd, mtSubj.getPrivateCredentials(), null);
+        nullTestCollection(methAdd, mtSubj.getPrivateCredentials(),
+                morePrvVals);
+    }
+
+    private static void testRemoveAll() {
+        // Create a well formed subject and additional collections
+        Subject mtSubj = makeSubj(false, false, false);
+        Set<Principal> remPrincs = new HashSet<>();
+        Set<Object> remPubVals = new HashSet<>();
+        Set<Object> remPrvVals = new HashSet<>();
+
+        remPrincs.add(new KerberosPrincipal("mtwain/author@LITERATURE.US"));
+        remPubVals.add("mtwain");
+        remPrvVals.add("5Cl3M3nz");
+
+        // Run one success test for each Subject family to verify the
+        // overloaded method works as intended.
+        Set<Principal> setPrin = mtSubj.getPrincipals();
+        Set<Object> setPubCreds = mtSubj.getPublicCredentials();
+        Set<Object> setPrvCreds = mtSubj.getPrivateCredentials();
+        int prinOrigSize = setPrin.size();
+        int pubOrigSize = setPubCreds.size();
+        int prvOrigSize = setPrvCreds.size();
+
+        System.out.println("------ removeAll() -----");
+
+        // Remove the specified members, then check the resulting size of the
+        // Subject attributes to verify they've decreased by the proper
+        // amounts.
+        if ((validTestCollection(methRemove, setPrin, remPrincs) != true) ||
+            (setPrin.size() != prinOrigSize - remPrincs.size()))
+        {
+            throw new RuntimeException("Failed removeAll() on principals");
+        }
+        if ((validTestCollection(methRemove, setPubCreds,
+                remPubVals) != true) ||
+            (setPubCreds.size() != pubOrigSize - remPubVals.size()))
+        {
+            throw new RuntimeException("Failed removeAll() on public creds");
+        }
+        if ((validTestCollection(methRemove, setPrvCreds,
+                remPrvVals) != true) ||
+            (setPrvCreds.size() != prvOrigSize - remPrvVals.size()))
+        {
+            throw new RuntimeException("Failed removeAll() on private creds");
+        }
+        System.out.println("Positive removeAll() test passed");
+
+        // Now add null elements into each container, then retest
+        remPrincs.add(null);
+        remPubVals.add(null);
+        remPrvVals.add(null);
+
+        System.out.println("* Testing removeAll w/ null values on Principals");
+        nullTestCollection(methRemove, mtSubj.getPrincipals(), null);
+        nullTestCollection(methRemove, mtSubj.getPrincipals(), remPrincs);
+
+        System.out.println(
+                "* Testing removeAll w/ null values on Public Creds");
+        nullTestCollection(methRemove, mtSubj.getPublicCredentials(), null);
+        nullTestCollection(methRemove, mtSubj.getPublicCredentials(),
+                remPubVals);
+
+        System.out.println(
+                "* Testing removeAll w/ null values on Private Creds");
+        nullTestCollection(methRemove, mtSubj.getPrivateCredentials(), null);
+        nullTestCollection(methRemove, mtSubj.getPrivateCredentials(),
+                remPrvVals);
+    }
+
+    private static void testContainsAll() {
+        // Create a well formed subject and additional collections
+        Subject mtSubj = makeSubj(false, false, false);
+        Set<Principal> testPrincs = new HashSet<>(Arrays.asList(princVals));
+        Set<Object> testPubVals = new HashSet<>(Arrays.asList(pubVals));
+        Set<Object> testPrvVals = new HashSet<>(Arrays.asList(privVals));
+
+        System.out.println("------ containsAll() -----");
+
+        // Run one success test for each Subject family to verify the
+        // overloaded method works as intended.
+        if ((validTestCollection(methContains, mtSubj.getPrincipals(),
+                 testPrincs) == false) &&
+            (validTestCollection(methContains, mtSubj.getPublicCredentials(),
+                 testPubVals) == false) &&
+            (validTestCollection(methContains,
+                 mtSubj.getPrivateCredentials(), testPrvVals) == false)) {
+            throw new RuntimeException("Valid containsAll() check failed");
+        }
+        System.out.println("Positive containsAll() test passed");
+
+        // Now let's add a null into each collection and watch the fireworks.
+        testPrincs.add(null);
+        testPubVals.add(null);
+        testPrvVals.add(null);
+
+        System.out.println(
+                "* Testing containsAll w/ null values on Principals");
+        nullTestCollection(methContains, mtSubj.getPrincipals(), null);
+        nullTestCollection(methContains, mtSubj.getPrincipals(), testPrincs);
+
+        System.out.println(
+                "* Testing containsAll w/ null values on Public Creds");
+        nullTestCollection(methContains, mtSubj.getPublicCredentials(),
+                null);
+        nullTestCollection(methContains, mtSubj.getPublicCredentials(),
+                testPubVals);
+
+        System.out.println(
+                "* Testing containsAll w/ null values on Private Creds");
+        nullTestCollection(methContains, mtSubj.getPrivateCredentials(),
+                null);
+        nullTestCollection(methContains, mtSubj.getPrivateCredentials(),
+                testPrvVals);
+    }
+
+    private static void testRetainAll() {
+        // Create a well formed subject and additional collections
+        Subject mtSubj = makeSubj(false, false, false);
+        Set<Principal> remPrincs = new HashSet<>(Arrays.asList(tmplAddPrincs));
+        Set<Object> remPubVals = new HashSet<>(Arrays.asList(tmplAddPubVals));
+        Set<Object> remPrvVals = new HashSet<>(Arrays.asList(tmplAddPrvVals));
+
+        // Add in values that exist within the Subject
+        remPrincs.add(princVals[2]);
+        remPubVals.add(pubVals[2]);
+        remPrvVals.add(privVals[2]);
+
+        // Run one success test for each Subject family to verify the
+        // overloaded method works as intended.
+        Set<Principal> setPrin = mtSubj.getPrincipals();
+        Set<Object> setPubCreds = mtSubj.getPublicCredentials();
+        Set<Object> setPrvCreds = mtSubj.getPrivateCredentials();
+        int prinOrigSize = setPrin.size();
+        int pubOrigSize = setPubCreds.size();
+        int prvOrigSize = setPrvCreds.size();
+
+        System.out.println("------ retainAll() -----");
+
+        // Retain the specified members (those that exist in the Subject)
+        // and validate the results.
+        if (validTestCollection(methRetain, setPrin, remPrincs) == false ||
+            setPrin.size() != 1 || setPrin.contains(princVals[2]) == false)
+        {
+            throw new RuntimeException("Failed retainAll() on principals");
+        }
+
+        if (validTestCollection(methRetain, setPubCreds,
+                remPubVals) == false ||
+            setPubCreds.size() != 1 ||
+            setPubCreds.contains(pubVals[2]) == false)
+        {
+            throw new RuntimeException("Failed retainAll() on public creds");
+        }
+        if (validTestCollection(methRetain, setPrvCreds,
+                remPrvVals) == false ||
+            setPrvCreds.size() != 1 ||
+            setPrvCreds.contains(privVals[2]) == false)
+        {
+            throw new RuntimeException("Failed retainAll() on private creds");
+        }
+        System.out.println("Positive retainAll() test passed");
+
+        // Now add null elements into each container, then retest
+        remPrincs.add(null);
+        remPubVals.add(null);
+        remPrvVals.add(null);
+
+        System.out.println("* Testing retainAll w/ null values on Principals");
+        nullTestCollection(methRetain, mtSubj.getPrincipals(), null);
+        nullTestCollection(methRetain, mtSubj.getPrincipals(), remPrincs);
+
+        System.out.println(
+                "* Testing retainAll w/ null values on Public Creds");
+        nullTestCollection(methRetain, mtSubj.getPublicCredentials(), null);
+        nullTestCollection(methRetain, mtSubj.getPublicCredentials(),
+                remPubVals);
+
+        System.out.println(
+                "* Testing retainAll w/ null values on Private Creds");
+        nullTestCollection(methRetain, mtSubj.getPrivateCredentials(), null);
+        nullTestCollection(methRetain, mtSubj.getPrivateCredentials(),
+                remPrvVals);
+    }
+
+    private static void testIsEmpty() {
+        Subject populatedSubj = makeSubj(false, false, false);
+        Subject emptySubj = new Subject();
+
+        System.out.println("------ isEmpty() -----");
+
+        if (populatedSubj.getPrincipals().isEmpty()) {
+            throw new RuntimeException(
+                    "Populated Subject Principals incorrectly returned empty");
+        }
+        if (emptySubj.getPrincipals().isEmpty() == false) {
+            throw new RuntimeException(
+                    "Empty Subject Principals incorrectly returned non-empty");
+        }
+        System.out.println("isEmpty() test passed");
+    }
+
+    private static void testSecureSetEquals() {
+        System.out.println("------ SecureSet.equals() -----");
+
+        Subject subj = makeSubj(false, false, false);
+        Subject subjComp = makeSubj(false, false, false);
+
+        // Case 1: null comparison [expect false]
+        if (subj.getPublicCredentials().equals(null) != false) {
+            throw new RuntimeException(
+                    "equals(null) incorrectly returned true");
+        }
+
+        // Case 2: Self-comparison [expect true]
+        Set<Principal> princs = subj.getPrincipals();
+        princs.equals(subj.getPrincipals());
+
+        // Case 3: Comparison with non-Set type [expect false]
+        List<Principal> listPrinc = new LinkedList<>(Arrays.asList(princVals));
+        if (subj.getPublicCredentials().equals(listPrinc) != false) {
+            throw new RuntimeException(
+                    "equals([Non-Set]) incorrectly returned true");
+        }
+
+        // Case 4: SecureSets of differing sizes [expect false]
+        Subject subj1princ = new Subject();
+        Subject subj2princ = new Subject();
+        subj1princ.getPrincipals().add(
+                new X500Principal("CN=Tom Sawyer, ST=Missouri, C=US"));
+        subj1princ.getPrincipals().add(
+                new X500Principal("CN=John Doe, O=Bogus Corp."));
+        subj2princ.getPrincipals().add(
+                new X500Principal("CN=Tom Sawyer, ST=Missouri, C=US"));
+        if (subj1princ.getPrincipals().equals(
+                    subj2princ.getPrincipals()) != false) {
+            throw new RuntimeException(
+                    "equals([differing sizes]) incorrectly returned true");
+        }
+
+        // Case 5: Content equality test [expect true]
+        Set<Principal> equalSet = new HashSet<>(Arrays.asList(princVals));
+        if (subj.getPrincipals().equals(equalSet) != true) {
+            throw new RuntimeException(
+                    "equals([equivalent set]) incorrectly returned false");
+        }
+
+        // Case 5: Content inequality test [expect false]
+        // Note: to not fall into the size inequality check the two
+        // sets need to have the same number of elements.
+        Set<Principal> inequalSet =
+            new HashSet<Principal>(Arrays.asList(tmplAddPrincs));
+        inequalSet.add(new JMXPrincipal("Samuel Clemens"));
+
+        if (subj.getPrincipals().equals(inequalSet) != false) {
+            throw new RuntimeException(
+                    "equals([equivalent set]) incorrectly returned false");
+        }
+        System.out.println("SecureSet.equals() tests passed");
+    }
+
+    private static void testSecureSetHashCode() {
+        System.out.println("------ SecureSet.hashCode() -----");
+
+        Subject subj = makeSubj(false, false, false);
+
+        // Make sure two other Set types that we know are equal per
+        // SecureSet.equals() and verify their hashCodes are also the same
+        Set<Principal> equalHashSet = new HashSet<>(Arrays.asList(princVals));
+
+        if (subj.getPrincipals().hashCode() != equalHashSet.hashCode()) {
+            throw new RuntimeException(
+                    "SecureSet and HashSet hashCodes() differ");
+        }
+        System.out.println("SecureSet.hashCode() tests passed");
+    }
+
+    private static void testToArray() {
+        System.out.println("------ toArray() -----");
+
+        Subject subj = makeSubj(false, false, false);
+
+        // Case 1: no-parameter toArray with equality comparison
+        // Expected result: true
+        List<Object> alSubj = Arrays.asList(subj.getPrincipals().toArray());
+        List<Principal> alPrincs = Arrays.asList(princVals);
+
+        if (alSubj.size() != alPrincs.size() ||
+                alSubj.containsAll(alPrincs) != true) {
+            throw new RuntimeException(
+                    "Unexpected inequality on returned toArray()");
+        }
+
+        // Case 2: generic-type toArray where passed array is of sufficient
+        //         size.
+        // Expected result: returned Array is reference-equal to input param
+        // and content equal to data used to construct the originating Subject.
+        Principal[] pBlock = new Principal[3];
+        Principal[] pBlockRef = subj.getPrincipals().toArray(pBlock);
+        alSubj = Arrays.asList((Object[])pBlockRef);
+
+        if (pBlockRef != pBlock) {
+            throw new RuntimeException(
+                    "Unexpected reference-inequality on returned toArray(T[])");
+        } else if (alSubj.size() != alPrincs.size() ||
+                alSubj.containsAll(alPrincs) != true) {
+            throw new RuntimeException(
+                    "Unexpected content-inequality on returned toArray(T[])");
+        }
+
+        // Case 3: generic-type toArray where passed array is of
+        //         insufficient size.
+        // Expected result: returned Array is not reference-equal to
+        // input param but is content equal to data used to construct the
+        // originating Subject.
+        pBlock = new Principal[1];
+        pBlockRef = subj.getPrincipals().toArray(pBlock);
+        alSubj = Arrays.asList((Object[])pBlockRef);
+
+        if (pBlockRef == pBlock) {
+            throw new RuntimeException(
+                    "Unexpected reference-equality on returned toArray(T[])");
+        } else if (alSubj.size() != alPrincs.size() ||
+                alSubj.containsAll(alPrincs) != true) {
+            throw new RuntimeException(
+                    "Unexpected content-inequality on returned toArray(T[])");
+        }
+        System.out.println("toArray() tests passed");
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        testCTOR();
+
+        testDeserialize();
+
+        testAdd();
+
+        testRemove();
+
+        testContains();
+
+        testAddAll();
+
+        testRemoveAll();
+
+        testContainsAll();
+
+        testRetainAll();
+
+        testIsEmpty();
+
+        testSecureSetEquals();
+
+        testSecureSetHashCode();
+
+        testToArray();
+    }
+}
-- 
GitLab


From 49402ab5179291b53c13cb209492056258b3ed7f Mon Sep 17 00:00:00 2001
From: Valerie Peng <valeriep@openjdk.org>
Date: Tue, 1 Jul 2014 20:35:30 +0000
Subject: [PATCH 169/192] 8046046: Test
 sun/security/pkcs11/Signature/TestDSAKeyLength.java fails intermittently on
 Solaris 11 in 8u40 nightly

Override the upper limit to 1024 for SHA1withDSA when larger DSA key size is supported.

Reviewed-by: mullan, ascarpino
---
 .../share/classes/sun/security/pkcs11/P11Signature.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
index 4a0733d7195..1bac22ca62c 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -340,7 +340,10 @@ final class P11Signature extends SignatureSpi {
         }
         int minKeySize = (int) mechInfo.ulMinKeySize;
         int maxKeySize = (int) mechInfo.ulMaxKeySize;
-
+        // need to override the MAX keysize for SHA1withDSA
+        if (md != null && mechanism == CKM_DSA && maxKeySize > 1024) {
+               maxKeySize = 1024;
+        }
         int keySize = 0;
         if (key instanceof P11Key) {
             keySize = ((P11Key) key).length();
-- 
GitLab


From edc85c8e4cc6011f37845013a6f3cd2305ef66f2 Mon Sep 17 00:00:00 2001
From: Valerie Peng <valeriep@openjdk.org>
Date: Tue, 1 Jul 2014 20:35:43 +0000
Subject: [PATCH 170/192] 8027575: b113 causing a lot of memory allocation and
 regression for wls_webapp_atomics

Reduce buffer allocation and do multiple cipher encryption/decryption calls.

Reviewed-by: xuelei, ascarpino
---
 .../com/sun/crypto/provider/CipherCore.java   | 67 +++++++++++--------
 .../provider/Cipher/AES/TestCopySafe.java     |  6 +-
 2 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java b/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java
index 8d54633adb1..6b5eea85d6d 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -720,6 +720,15 @@ final class CipherCore {
 
         int outLen = 0;
         if (len != 0) { // there is some work to do
+            if ((input == output)
+                 && (outputOffset < (inputOffset + inputLen))
+                 && (inputOffset < (outputOffset + buffer.length))) {
+                // copy 'input' out to avoid its content being
+                // overwritten prematurely.
+                input = Arrays.copyOfRange(input, inputOffset,
+                    inputOffset + inputLen);
+                inputOffset = 0;
+            }
             if (len <= buffered) {
                 // all to-be-processed data are from 'buffer'
                 if (decrypting) {
@@ -732,37 +741,37 @@ final class CipherCore {
                     System.arraycopy(buffer, len, buffer, 0, buffered);
                 }
             } else { // len > buffered
-                if ((input != output) && (buffered == 0)) {
-                    // all to-be-processed data are from 'input'
-                    // however, note that if 'input' and 'output' are the same,
-                    // then they can't be passed directly to the underlying cipher
-                    // engine operations as data may be overwritten before they
-                    // are read.
+                int inputConsumed = len - buffered;
+                int temp;
+                if (buffered > 0) {
+                    int bufferCapacity = buffer.length - buffered;
+                    if (bufferCapacity != 0) {
+                        temp = Math.min(bufferCapacity, inputConsumed);
+                        System.arraycopy(input, inputOffset, buffer, buffered, temp);
+                        inputOffset += temp;
+                        inputConsumed -= temp;
+                        inputLen -= temp;
+                        buffered += temp;
+                    }
+                    // process 'buffer'
                     if (decrypting) {
-                        outLen = cipher.decrypt(input, inputOffset, len, output, outputOffset);
+                         outLen = cipher.decrypt(buffer, 0, buffered, output, outputOffset);
                     } else {
-                        outLen = cipher.encrypt(input, inputOffset, len, output, outputOffset);
-                    }
-                    inputOffset += len;
-                    inputLen -= len;
-                } else {
-                    // assemble the data using both 'buffer' and 'input'
-                    byte[] in = new byte[len];
-                    int inConsumed = len - buffered;
-                    if (buffered != 0) {
-                        System.arraycopy(buffer, 0, in, 0, buffered);
-                        buffered = 0;
-                    }
-                    if (inConsumed != 0) {
-                        System.arraycopy(input, inputOffset, in, len - inConsumed, inConsumed);
-                        inputOffset += inConsumed;
-                        inputLen -= inConsumed;
+                         outLen = cipher.encrypt(buffer, 0, buffered, output, outputOffset);
                     }
+                    outputOffset += outLen;
+                    buffered = 0;
+                }
+                if (inputConsumed > 0) { // still has input to process
                     if (decrypting) {
-                        outLen = cipher.decrypt(in, 0, len, output, outputOffset);
+                        outLen += cipher.decrypt(input, inputOffset, inputConsumed,
+                            output, outputOffset);
                     } else {
-                        outLen = cipher.encrypt(in, 0, len, output, outputOffset);
+                        outLen += cipher.encrypt(input, inputOffset, inputConsumed,
+                            output, outputOffset);
                     }
+                    inputOffset += inputConsumed;
+                    inputLen -= inputConsumed;
                 }
             }
             // Let's keep track of how many bytes are needed to make
@@ -925,8 +934,10 @@ final class CipherCore {
         byte[] finalBuf = input;
         int finalOffset = inputOffset;
         int finalBufLen = inputLen;
-        if ((input == output) || (buffered != 0) ||
-            (!decrypting && padding != null)) {
+        if ((buffered != 0) || (!decrypting && padding != null) ||
+            ((input == output)
+              && (outputOffset < (inputOffset + inputLen))
+              && (inputOffset < (outputOffset + buffer.length)))) {
             if (decrypting || padding == null) {
                 paddingLen = 0;
             }
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCopySafe.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCopySafe.java
index 20dff835f90..697da6750ad 100644
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCopySafe.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCopySafe.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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,7 @@
 
 /*
  * @test
- * @bug 8026943
+ * @bug 8026943 8027575
  * @summary Verify that same buffer can be used as input and output when
  * using Cipher objects.
  * @author Valerie Peng
@@ -44,7 +44,7 @@ public class TestCopySafe {
     private static SecretKey KEY = new SecretKeySpec(new byte[16], "AES");
     private static byte[] IV = new byte[16];
 
-    private static int[] OFFSETS = { 1, 8, 17 };
+    private static int[] OFFSETS = { 1, 8, 9, 16, 17, 32, 33 };
 
     private static final String[] MODES = {
         "ECB", "CBC", "PCBC", "CTR", "CTS",
-- 
GitLab


From 8d02787bfc5894170787e89f891a775bac5e6cdd Mon Sep 17 00:00:00 2001
From: Weijun Wang <weijun@openjdk.org>
Date: Wed, 2 Jul 2014 09:48:32 +0800
Subject: [PATCH 171/192] 8048511: Uninitialised memory in
 jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c

Reviewed-by: valeriep
---
 jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c b/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
index e14036b899c..b9bfb929830 100644
--- a/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
+++ b/jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c
@@ -639,7 +639,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_releaseCred(JNIEnv *env,
  */
 void inquireCred(JNIEnv *env, jobject jobj, gss_cred_id_t pCred,
                  jint type, void *result) {
-  OM_uint32 minor, major=0;
+  OM_uint32 minor=0, major=0;
   OM_uint32 routineErr;
   gss_cred_id_t credHdl;
 
-- 
GitLab


From f377795d11a5d67f9617ae6551bffd16398e1efd Mon Sep 17 00:00:00 2001
From: Katja Kantserova <ykantser@openjdk.org>
Date: Tue, 1 Jul 2014 21:23:54 +0200
Subject: [PATCH 172/192] 8048892: TEST_BUG: shell script tests need to be
 change to not use retired @debuggeeVMOptions mechanism

Reviewed-by: sla, jbachorik
---
 jdk/test/com/sun/jdi/PrivateTransportTest.sh |   7 +-
 jdk/test/com/sun/jdi/ShellScaffold.sh        |   9 +-
 jdk/test/com/sun/jdi/SuspendNoFlagTest.java  |  48 +++++++++
 jdk/test/com/sun/jdi/SuspendNoFlagTest.sh    | 104 -------------------
 jdk/test/com/sun/jdi/VMConnection.java       |   3 +-
 5 files changed, 52 insertions(+), 119 deletions(-)
 create mode 100644 jdk/test/com/sun/jdi/SuspendNoFlagTest.java
 delete mode 100644 jdk/test/com/sun/jdi/SuspendNoFlagTest.sh

diff --git a/jdk/test/com/sun/jdi/PrivateTransportTest.sh b/jdk/test/com/sun/jdi/PrivateTransportTest.sh
index 7f4b0029f26..1885b6d3d4b 100644
--- a/jdk/test/com/sun/jdi/PrivateTransportTest.sh
+++ b/jdk/test/com/sun/jdi/PrivateTransportTest.sh
@@ -82,12 +82,7 @@ fi
 echo "JDK under test is: $TESTJAVA"
 
 # Get flags being sent to debuggee
-DEBUGGEEFLAGS=
-if [ -r $TESTCLASSES/@debuggeeVMOptions ] ; then
-   DEBUGGEEFLAGS=`cat $TESTCLASSES/@debuggeeVMOptions`
-elif [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
-   DEBUGGEEFLAGS=`cat $TESTCLASSES/../@debuggeeVMOptions`
-fi
+DEBUGGEEFLAGS=$TESTVMOPTS $TESTJAVAOPTS
 
 # Figure out what the libarch path is
 os=`uname -s`
diff --git a/jdk/test/com/sun/jdi/ShellScaffold.sh b/jdk/test/com/sun/jdi/ShellScaffold.sh
index 193aabcb907..dec8ed4151f 100644
--- a/jdk/test/com/sun/jdi/ShellScaffold.sh
+++ b/jdk/test/com/sun/jdi/ShellScaffold.sh
@@ -882,15 +882,10 @@ startJdb()
 
 startDebuggee()
 {
-    args=
-    # Note that @debuggeeVMOptions is unique to a test run instead of
-    # a test in a run.  It is not modified during a test run.
-    if [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
-       args=`cat $TESTCLASSES/../@debuggeeVMOptions`
-    fi
+    args=$TESTVMOPTS $TESTJAVAOPTS
 
     if [ ! -z "$args" ] ; then
-       echo "--Starting debuggee with args from @debuggeeVMOptions: $args"
+       echo "--Starting debuggee with args from TESTVMOPTS and/or TESTJAVAOPTS: $args"
     else
        echo "--Starting debuggee"
     fi
diff --git a/jdk/test/com/sun/jdi/SuspendNoFlagTest.java b/jdk/test/com/sun/jdi/SuspendNoFlagTest.java
new file mode 100644
index 00000000000..ad506f500ce
--- /dev/null
+++ b/jdk/test/com/sun/jdi/SuspendNoFlagTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2003, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+
+/* @test
+ * @bug 4914611
+ * @summary Test for JDWP: -agentlib:jdwp=suspend=n hanging
+ * @library /lib/testlibrary
+ * @build jdk.testlibarary.*
+ * @compile -g HelloWorld.java
+ * @run driver SuspendNoFlagTest
+ */
+public class SuspendNoFlagTest {
+
+    private static final String TEST_CLASSES = System.getProperty(
+            "test.classes", ".");
+
+    public static void main(String[] args) throws Throwable {
+        OutputAnalyzer output = ProcessTools.executeTestJvm("-classpath",
+                TEST_CLASSES,
+                "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n",
+                "HelloWorld");
+        output.shouldHaveExitValue(0);
+    }
+
+}
diff --git a/jdk/test/com/sun/jdi/SuspendNoFlagTest.sh b/jdk/test/com/sun/jdi/SuspendNoFlagTest.sh
deleted file mode 100644
index dd4a24e4d76..00000000000
--- a/jdk/test/com/sun/jdi/SuspendNoFlagTest.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/ksh -p
-
-#
-# Copyright (c) 2003, 2006, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-#   @test       SuspendNoFlagTest.sh
-#   @bug        4914611
-#   @summary    Test for JDWP: -agentlib:jdwp=suspend=n hanging
-#   @author     Kelly O'Hair
-#   Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
-#
-#   @run compile -g HelloWorld.java
-#   @run shell/timeout=60 SuspendNoFlagTest.sh
-#
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail() 
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass() 
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-TARGETCLASS="HelloWorld"
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-         TESTJAVA=$1
-      else
-         TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "${TESTCLASSES}" -g \
-            ${TARGETCLASS}.java
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath \"${TESTCLASSES}\""
-#
-DEBUGEEFLAGS=
-if [ -r $TESTCLASSES/@debuggeeVMOptions ] ; then
-   DEBUGEEFLAGS=`cat $TESTCLASSES/@debuggeeVMOptions`
-elif [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
-   DEBUGEEFLAGS=`cat $TESTCLASSES/../@debuggeeVMOptions`
-fi
-DEBUGEEFLAGS="$DEBUGEEFLAGS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n"
-
-java=java
-echo ${TESTJAVA}/bin/$java ${DEBUGEEFLAGS} ${CP} ${TARGETCLASS}
-eval ${TESTJAVA}/bin/$java ${DEBUGEEFLAGS} ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ] ;
-   then pass "status = 0 and no timeout occured"
-
-   else fail "unspecified test failure (timed out or hung)"
-fi
diff --git a/jdk/test/com/sun/jdi/VMConnection.java b/jdk/test/com/sun/jdi/VMConnection.java
index 2df2e63057e..a9e5355a321 100644
--- a/jdk/test/com/sun/jdi/VMConnection.java
+++ b/jdk/test/com/sun/jdi/VMConnection.java
@@ -44,8 +44,7 @@ class VMConnection {
     /**
      * Return a String containing VM Options to pass to the debugee
      * or an empty string if there are none.
-     * These are read from the first non-comment line
-     * in file @debuggeeVMOptions in the test.classes dir
+     * These are read from TESTVMOPTS and/or TESTJAVAOPTS.
      */
     static public String getDebuggeeVMOptions() {
         String retVal = "";
-- 
GitLab


From 463b504956df582adb3c51b864abfdb1d9aad2bf Mon Sep 17 00:00:00 2001
From: Raoul-Gabriel Urma <raoul@urma.com>
Date: Tue, 1 Jul 2014 23:39:31 -0700
Subject: [PATCH 173/192] 8048989: small errors in Collectors examples

Reviewed-by: darcy
---
 jdk/src/share/classes/java/util/stream/Collectors.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jdk/src/share/classes/java/util/stream/Collectors.java b/jdk/src/share/classes/java/util/stream/Collectors.java
index 75ca1ca0f50..70d7f286d8d 100644
--- a/jdk/src/share/classes/java/util/stream/Collectors.java
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java
@@ -729,7 +729,7 @@ public final class Collectors {
      * person in each city:
      * <pre>{@code
      *     Comparator<Person> byHeight = Comparator.comparing(Person::getHeight);
-     *     Map<City, Person> tallestByCity
+     *     Map<City, Optional<Person>> tallestByCity
      *         = people.stream().collect(groupingBy(Person::getCity, reducing(BinaryOperator.maxBy(byHeight))));
      * }</pre>
      *
@@ -784,7 +784,7 @@ public final class Collectors {
      *     Comparator<String> byLength = Comparator.comparing(String::length);
      *     Map<City, String> longestLastNameByCity
      *         = people.stream().collect(groupingBy(Person::getCity,
-     *                                              reducing(Person::getLastName, BinaryOperator.maxBy(byLength))));
+     *                                              reducing("", Person::getLastName, BinaryOperator.maxBy(byLength))));
      * }</pre>
      *
      * @param <T> the type of the input elements
-- 
GitLab


From 0139a3b9e7d3cbbe2c4efe1653856c2cd2769040 Mon Sep 17 00:00:00 2001
From: Staffan Larsen <sla@openjdk.org>
Date: Wed, 2 Jul 2014 08:41:59 +0200
Subject: [PATCH 174/192] 8046883: com/sun/jdi/ProcessAttachTest.sh gets
 "java.io.IOException: Invalid process identifier" on windows

Reviewed-by: dcubed, dsamersoff, allwin
---
 .../com/sun/jdi/ProcessAttachDebuggee.java    |  62 ------
 .../com/sun/jdi/ProcessAttachDebugger.java    |  81 -------
 jdk/test/com/sun/jdi/ProcessAttachTest.java   | 116 ++++++++++
 jdk/test/com/sun/jdi/ProcessAttachTest.sh     | 199 ------------------
 jdk/test/com/sun/jdi/ShutdownDebuggee.java    |  62 ------
 5 files changed, 116 insertions(+), 404 deletions(-)
 delete mode 100644 jdk/test/com/sun/jdi/ProcessAttachDebuggee.java
 delete mode 100644 jdk/test/com/sun/jdi/ProcessAttachDebugger.java
 create mode 100644 jdk/test/com/sun/jdi/ProcessAttachTest.java
 delete mode 100644 jdk/test/com/sun/jdi/ProcessAttachTest.sh
 delete mode 100644 jdk/test/com/sun/jdi/ShutdownDebuggee.java

diff --git a/jdk/test/com/sun/jdi/ProcessAttachDebuggee.java b/jdk/test/com/sun/jdi/ProcessAttachDebuggee.java
deleted file mode 100644
index 3208b1551ee..00000000000
--- a/jdk/test/com/sun/jdi/ProcessAttachDebuggee.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *
- *
- * The "debuggee" used by the unit tests for the ProcessAttachingConnector.
- * This debuggee binds to a random TCP port and waits for a client to connect.
- */
-import java.net.Socket;
-import java.net.ServerSocket;
-import java.nio.file.CopyOption;
-import java.nio.file.Files;
-import java.nio.file.StandardCopyOption;
-import java.io.File;
-import java.io.FileOutputStream;
-
-public class ProcessAttachDebuggee {
-    public static void main(String args[]) throws Exception {
-        // bind to a random port
-        ServerSocket ss = new ServerSocket(0);
-        int port = ss.getLocalPort();
-
-        // Write the port number to the given file
-        File partial = new File(args[0] + ".partial");
-        File portFile = new File(args[0]);
-        try (FileOutputStream fos = new FileOutputStream(partial)) {
-            fos.write( Integer.toString(port).getBytes("UTF-8") );
-        }
-        Files.move(partial.toPath(), portFile.toPath(), StandardCopyOption.ATOMIC_MOVE);
-
-        System.out.println("Debuggee bound to port: " + port);
-        System.out.flush();
-
-        // wait for test harness to connect
-        Socket s = ss.accept();
-        s.close();
-        ss.close();
-
-        System.out.println("Debuggee shutdown.");
-    }
-}
diff --git a/jdk/test/com/sun/jdi/ProcessAttachDebugger.java b/jdk/test/com/sun/jdi/ProcessAttachDebugger.java
deleted file mode 100644
index 93094032883..00000000000
--- a/jdk/test/com/sun/jdi/ProcessAttachDebugger.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2005, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *
- *
- * Unit test for ProcessAttachingConnector - this "debugger" attaches to a debuggee
- * given it's pid. Usage:
- *
- *      java ProcessAttachDebugger <pid>
- */
-
-import com.sun.jdi.Bootstrap;
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.ThreadReference;
-import com.sun.jdi.connect.Connector;
-import com.sun.jdi.connect.AttachingConnector;
-
-import java.util.List;
-import java.util.Map;
-
-public class ProcessAttachDebugger {
-
-    public static void main(String main_args[]) throws Exception {
-        String pid = main_args[0];
-
-        // find ProcessAttachingConnector
-
-        List<AttachingConnector> l =
-            Bootstrap.virtualMachineManager().attachingConnectors();
-        AttachingConnector ac = null;
-        for (AttachingConnector c: l) {
-            if (c.name().equals("com.sun.jdi.ProcessAttach")) {
-                ac = c;
-                break;
-            }
-        }
-        if (ac == null) {
-            throw new RuntimeException("Unable to locate ProcessAttachingConnector");
-        }
-
-        Map<String,Connector.Argument> args = ac.defaultArguments();
-        Connector.StringArgument arg = (Connector.StringArgument)args.get("pid");
-        arg.setValue(pid);
-
-        System.out.println("Debugger is attaching to: " + pid + " ...");
-
-        VirtualMachine vm = ac.attach(args);
-
-        System.out.println("Attached! Now listing threads ...");
-
-        // list all threads
-
-        for (ThreadReference thr: vm.allThreads()) {
-            System.out.println(thr);
-        }
-
-        System.out.println("Debugger done.");
-    }
-
-}
diff --git a/jdk/test/com/sun/jdi/ProcessAttachTest.java b/jdk/test/com/sun/jdi/ProcessAttachTest.java
new file mode 100644
index 00000000000..972f27b04db
--- /dev/null
+++ b/jdk/test/com/sun/jdi/ProcessAttachTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+import jdk.testlibrary.ProcessTools;
+
+import com.sun.jdi.Bootstrap;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+
+/**
+ * @test
+ * @bug 4527279
+ * @summary Unit test for ProcessAttachingConnector
+ *
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.* ProcessAttachTest
+ * @run driver ProcessAttachTest
+ */
+
+class ProcessAttachTestTarg {
+    public static void main(String args[]) throws Exception {
+        // Write something that can be read by the driver
+        System.out.println("Debuggee started");
+        System.out.flush();
+        for (;;) {
+            Thread.sleep(100);
+        }
+    }
+}
+
+public class ProcessAttachTest {
+
+    public static final String TESTCLASSES = System.getProperty("test.classes");
+
+    public static void main(String[] args) throws Exception {
+
+        System.out.println("Test 1: Debuggee start with suspend=n");
+        runTest("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n");
+
+        System.out.println("Test 2: Debuggee start with suspend=y");
+        runTest("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y");
+
+    }
+
+    private static void runTest(String jdwpArg) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                jdwpArg,
+                "-classpath", TESTCLASSES,
+                "ProcessAttachTestTarg");
+        Process p = null;
+        try {
+            p = pb.start();
+
+            // Wait for the process to start
+            InputStream is = p.getInputStream();
+            is.read();
+
+            // Attach a debugger
+            tryDebug(p.getPid());
+        } finally {
+            p.destroyForcibly();
+        }
+    }
+
+    private static void tryDebug(long pid) throws IOException,
+            IllegalConnectorArgumentsException {
+        AttachingConnector ac = Bootstrap.virtualMachineManager().attachingConnectors()
+                .stream()
+                .filter(c -> c.name().equals("com.sun.jdi.ProcessAttach"))
+                .findFirst()
+                .orElseThrow(() -> new RuntimeException("Unable to locate ProcessAttachingConnector"));
+
+        Map<String, Connector.Argument> args = ac.defaultArguments();
+        Connector.StringArgument arg = (Connector.StringArgument) args
+                .get("pid");
+        arg.setValue("" + pid);
+
+        System.out.println("Debugger is attaching to: " + pid + " ...");
+        VirtualMachine vm = ac.attach(args);
+
+        // list all threads
+        System.out.println("Attached! Now listing threads ...");
+        vm.allThreads().stream().forEach(System.out::println);
+
+        System.out.println("Debugger done.");
+        vm.dispose();
+    }
+}
diff --git a/jdk/test/com/sun/jdi/ProcessAttachTest.sh b/jdk/test/com/sun/jdi/ProcessAttachTest.sh
deleted file mode 100644
index 739b53abb10..00000000000
--- a/jdk/test/com/sun/jdi/ProcessAttachTest.sh
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2013, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-# @test
-# @bug 4527279
-# @summary Unit test for ProcessAttachingConnector
-#
-# @build ProcessAttachDebugger ProcessAttachDebuggee ShutdownDebuggee
-# @run shell/timeout=120 ProcessAttachTest.sh
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-                                                                                                     
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-                                                                                                     
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-                                                                                                     
-JAVA="${TESTJAVA}/bin/java"
-
-OS=`uname -s`
-
-case "$OS" in
-  Windows*)
-    PS=";"
-    OS="Windows"
-    ;;
-  CYGWIN*)
-    PS=";"
-    OS="CYGWIN"
-    ;;
-  * )
-    PS=":"
-    ;;
-esac
-
-startDebuggee()
-{
-  rm -f ${OUTPUTFILE}
-  ${JAVA} "$@" > ${OUTPUTFILE} 2>&1 &
-  startpid="$!"
-  pid="${startpid}"
-                                                                                                     
-  # CYGWIN startpid is not the native windows PID we want, get the WINPID
-  if [ "${OS}" = "CYGWIN" ]; then
-    sleep 2
-    ps -l -p ${startpid}
-    pid=`ps -l -p ${startpid} | tail -1 | awk '{print $4;}'`
-  fi
-  
-  # MKS creates an intermediate shell to launch ${JAVA} so
-  # ${startpid} is not the actual pid. We have put in a small sleep
-  # to give the intermediate shell process time to launch the
-  # "java" process.
-  if [ "$OS" = "Windows" ]; then
-    sleep 2
-    pid=`ps -o pid,ppid,comm | awk '/${startpid}.+java/{ print $1 }'`
-  fi
-                                                                                                     
-  echo "Waiting for Debuggee to initialize..."
-  attempts=0
-  while true; do
-    out=`tail -1 ${OUTPUTFILE}`
-    if [ ! -z "$out" ]; then
-      break
-    fi
-    sleep 1
-    attempts=`expr $attempts + 1`
-    echo "Waiting $attempts second(s) ..."
-  done
-
-  echo "Debuggee is process $pid (startpid=${startpid})"
-}
-
-stopDebuggee()
-{
-  # We have to make sure the debuggee has written the portfile before
-  # trying to read it.
-
-  echo "Waiting for port file to be written..."
-  attempts=0
-  while true; do
-    attempts=`expr $attempts + 1`
-    if [ -f  ${PORTFILE} ]; then
-      break
-    fi
-    sleep 1
-    echo "Waiting $attempts second(s) ..."
-  done
-
-  $JAVA -classpath "${TESTCLASSES}" ShutdownDebuggee $1 2>&1
-  if [ $? != 0 ] ; then
-    echo "Error: ShutdownDebuggee failed: $?"
-    failures=`expr $failures + 1`
-    kill -9 ${startpid}
-  fi
-}
-
-failures=0
-
-#########################################################
-echo "Test 1: Debuggee start with suspend=n"
-
-PORTFILE=shutdown1.port
-OUTPUTFILE=Debuggee1.out
-
-DEBUGGEEFLAGS=
-if [ -r $TESTCLASSES/@debuggeeVMOptions ] ; then
-   DEBUGGEEFLAGS=`cat $TESTCLASSES/@debuggeeVMOptions`
-elif [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
-   DEBUGGEEFLAGS=`cat $TESTCLASSES/../@debuggeeVMOptions`
-fi
-
-startDebuggee \
-  $DEBUGGEEFLAGS \
-  -agentlib:jdwp=transport=dt_socket,server=y,suspend=n \
-  -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}"
-
-$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
-  ProcessAttachDebugger $pid 2>&1
-  
-if [ $? != 0 ]; then 
-  echo "Error: ProcessAttachDebugger failed: $?"
-  failures=`expr $failures + 1`
-fi
-
-# Note that when the debugger disconnects, the debuggee picks another
-# port and outputs another 'Listening for transport ... ' msg.
-
-stopDebuggee "${PORTFILE}"
-
-echo "${OUTPUTFILE}:"
-cat $OUTPUTFILE
-echo "-----"
-
-#########################################################
-echo "\nTest 2: Debuggee start with suspend=y"
-
-PORTFILE=shutdown2.port
-OUTPUTFILE=Debuggee2.out
-
-startDebuggee \
-  $DEBUGGEEFLAGS \
-  -agentlib:jdwp=transport=dt_socket,server=y,suspend=y \
-  -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}"
-
-$JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
-  ProcessAttachDebugger $pid 2>&1
-
-if [ $? != 0 ]; then 
-  echo "Error: ProcessAttachDebugger failed: $?"
-  failures=`expr $failures + 1`
-fi
-
-stopDebuggee "${PORTFILE}"
-
-echo $OUTPUTFILE :
-cat $OUTPUTFILE
-echo -----
-
-### 
-if [ $failures = 0 ];
-  then echo "All tests passed.";
-  else echo "$failures test(s) failed."
-fi
-exit $failures
diff --git a/jdk/test/com/sun/jdi/ShutdownDebuggee.java b/jdk/test/com/sun/jdi/ShutdownDebuggee.java
deleted file mode 100644
index b69768892a5..00000000000
--- a/jdk/test/com/sun/jdi/ShutdownDebuggee.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2005, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *
- *
- * Used by the unit tests for the ProcessAttachingConnector. This class is
- * used to shutdown the debuggee by connecting to its shutdown port.
- */
-import java.net.Socket;
-import java.net.InetSocketAddress;
-import java.io.File;
-import java.io.FileInputStream;
-
-public class ShutdownDebuggee {
-    public static void main(String args[]) throws Exception {
-
-        // read the (TCP) port number from the given file
-
-        File f = new File(args[0]);
-        FileInputStream fis = new FileInputStream(f);
-        byte b[] = new byte[8];
-        int n = fis.read(b);
-        if (n < 1) {
-            throw new RuntimeException("Empty file");
-        }
-        fis.close();
-
-        String str = new String(b, 0, n, "UTF-8");
-        System.out.println("Port number of debuggee is: " + str);
-        int port = Integer.parseInt(str);
-
-        // Now connect to the port (which will shutdown debuggee)
-
-        System.out.println("Connecting to port " + port +
-            " to shutdown Debuggee ...");
-
-        Socket s = new Socket();
-        s.connect( new InetSocketAddress(port) );
-        s.close();
-    }
-}
-- 
GitLab


From f4db094473e5c9838a1c4e45eba6cb34b438dae8 Mon Sep 17 00:00:00 2001
From: Weijun Wang <weijun@openjdk.org>
Date: Wed, 2 Jul 2014 17:03:47 +0800
Subject: [PATCH 175/192] 8042053: Broken links to jarsigner and keytool docs
 in java.security package summary

Reviewed-by: xuelei
---
 jdk/src/share/classes/java/security/package-info.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jdk/src/share/classes/java/security/package-info.java b/jdk/src/share/classes/java/security/package-info.java
index 599e95259ba..2c8205b09b9 100644
--- a/jdk/src/share/classes/java/security/package-info.java
+++ b/jdk/src/share/classes/java/security/package-info.java
@@ -92,14 +92,14 @@
  *     </b></a></li>
  *
  *   <li><b>keytool</b>
- *     (<a href="{@docRoot}/../technotes/tools/solaris/keytool.html">
+ *     (<a href="{@docRoot}/../technotes/tools/unix/keytool.html">
  *       for Solaris/Linux</a>)
  *     (<a href="{@docRoot}/../technotes/tools/windows/keytool.html">
  *       for Windows</a>)
  *     </li>
  *
  *   <li><b>jarsigner</b>
- *     (<a href="{@docRoot}/../technotes/tools/solaris/jarsigner.html">
+ *     (<a href="{@docRoot}/../technotes/tools/unix/jarsigner.html">
  *       for Solaris/Linux</a>)
  *     (<a href="{@docRoot}/../technotes/tools/windows/jarsigner.html">
  *       for Windows</a>)
-- 
GitLab


From fb6a5827280bca622083ad1a545e1e7d12103710 Mon Sep 17 00:00:00 2001
From: Alan Bateman <alanb@openjdk.org>
Date: Wed, 2 Jul 2014 10:03:40 +0100
Subject: [PATCH 176/192] 8048891: Remove unused JObjC from jdk repository

Reviewed-by: mchung
---
 .../jobjc/JObjC.xcodeproj/default.pbxuser     |  207 ---
 .../jobjc/JObjC.xcodeproj/project.pbxproj     | 1397 -----------------
 jdk/src/macosx/native/jobjc/README.txt        |  132 --
 jdk/src/macosx/native/jobjc/TODOS             |   27 -
 jdk/src/macosx/native/jobjc/bridgesupport.gmk |   54 -
 jdk/src/macosx/native/jobjc/build.xml         |  520 ------
 .../macosx/native/jobjc/extract_classes.pl    |   39 -
 .../macosx/native/jobjc/run-and-write-if-okay |   48 -
 jdk/src/macosx/native/jobjc/rungen            |   67 -
 jdk/src/macosx/native/jobjc/runjava           |   27 -
 .../native/jobjc/src/core/PrimitiveCoder.hs   |  275 ----
 .../src/core/java/com/apple/jobjc/CFType.java |   35 -
 .../src/core/java/com/apple/jobjc/CIF.java    |   63 -
 .../src/core/java/com/apple/jobjc/Coder.java  |  289 ----
 .../core/java/com/apple/jobjc/FFIType.java    |   57 -
 .../core/java/com/apple/jobjc/Function.java   |   60 -
 .../src/core/java/com/apple/jobjc/ID.java     |  163 --
 .../src/core/java/com/apple/jobjc/Invoke.java |  224 ---
 .../java/com/apple/jobjc/JObjCRuntime.java    |  139 --
 .../java/com/apple/jobjc/MacOSXFramework.java |   74 -
 .../core/java/com/apple/jobjc/NSClass.java    |  117 --
 .../com/apple/jobjc/NativeArgumentBuffer.java |  112 --
 .../java/com/apple/jobjc/NativeBuffer.java    |  109 --
 .../jobjc/NativeObjectLifecycleManager.java   |   55 -
 .../src/core/java/com/apple/jobjc/Opaque.java |   31 -
 .../core/java/com/apple/jobjc/Pointer.java    |   57 -
 .../java/com/apple/jobjc/PrimitiveCoder.java  |  700 ---------
 .../src/core/java/com/apple/jobjc/SEL.java    |   62 -
 .../src/core/java/com/apple/jobjc/Struct.java |   56 -
 .../java/com/apple/jobjc/Subclassing.java     |  167 --
 .../macosx/native/jobjc/src/core/native/CIF.m |   50 -
 .../native/jobjc/src/core/native/Coder.m      |   58 -
 .../native/jobjc/src/core/native/FFIType.m    |   43 -
 .../native/jobjc/src/core/native/Function.m   |   51 -
 .../macosx/native/jobjc/src/core/native/ID.m  |   51 -
 .../native/jobjc/src/core/native/Invoke.m     |   40 -
 .../jobjc/src/core/native/JObjCRuntime.m      |   27 -
 .../jobjc/src/core/native/MacOSXFramework.m   |   69 -
 .../native/jobjc/src/core/native/NSClass.m    |   78 -
 .../jobjc/src/core/native/NativeBuffer.h      |   40 -
 .../jobjc/src/core/native/NativeBuffer.m      |   37 -
 .../native/NativeObjectLifecycleManager.m     |   65 -
 .../macosx/native/jobjc/src/core/native/SEL.m |   44 -
 .../jobjc/src/core/native/Subclassing.m       |  301 ----
 .../jobjc/generator/BootClassPathMinus.java   |   51 -
 .../jobjc/generator/ClassConsolidator.java    |  112 --
 .../jobjc/generator/ClassGenerator.java       |   45 -
 .../internal/jobjc/generator/FileCopier.java  |   61 -
 .../jobjc/generator/FrameworkGenerator.java   |  112 --
 .../jobjc/generator/FunctionGenerator.java    |  178 ---
 .../internal/jobjc/generator/Generator.java   |   94 --
 .../jobjc/generator/MethodDisambiguator.java  |   66 -
 .../jobjc/generator/RestrictedKeywords.java   |   45 -
 .../apple/internal/jobjc/generator/Utils.java |  186 ---
 .../classes/AbstractObjCClassFile.java        |   41 -
 .../generator/classes/CFTypeClassFile.java    |   59 -
 .../classes/CategoryClassClassFile.java       |   64 -
 .../generator/classes/CategoryClassFile.java  |   48 -
 .../jobjc/generator/classes/CopiedFile.java   |   54 -
 .../generator/classes/FrameworkClassFile.java |  160 --
 .../generator/classes/GeneratedClassFile.java |   78 -
 .../classes/JObjCClassClassFile.java          |   69 -
 .../generator/classes/JObjCClassFile.java     |   81 -
 .../classes/MixedPrimitiveCoderClassFile.java |   51 -
 .../generator/classes/OpaqueClassFile.java    |   53 -
 .../jobjc/generator/classes/OutputFile.java   |   58 -
 .../generator/classes/RootJObjCClass.java     |   84 -
 .../generator/classes/StructClassFile.java    |  147 --
 .../internal/jobjc/generator/model/Arg.java   |   36 -
 .../jobjc/generator/model/CFType.java         |   47 -
 .../jobjc/generator/model/Category.java       |   44 -
 .../internal/jobjc/generator/model/Clazz.java |  154 --
 .../jobjc/generator/model/Constant.java       |   33 -
 .../jobjc/generator/model/Element.java        |  102 --
 .../jobjc/generator/model/ElementWType.java   |   61 -
 .../jobjc/generator/model/Framework.java      |  209 ---
 .../jobjc/generator/model/Function.java       |   82 -
 .../jobjc/generator/model/FunctionAlias.java  |   33 -
 .../generator/model/InformalProtocol.java     |   33 -
 .../jobjc/generator/model/Method.java         |   87 -
 .../jobjc/generator/model/NativeEnum.java     |  138 --
 .../jobjc/generator/model/Opaque.java         |   42 -
 .../generator/model/OutputFileGenerator.java  |   33 -
 .../jobjc/generator/model/Protocol.java       |   33 -
 .../jobjc/generator/model/ReturnValue.java    |   45 -
 .../jobjc/generator/model/StringConstant.java |   36 -
 .../jobjc/generator/model/Struct.java         |   78 -
 .../jobjc/generator/model/TypeElement.java    |   46 -
 .../model/coders/CoderDescriptor.java         |  127 --
 .../model/coders/ComplexCoderDescriptor.java  |  102 --
 .../coders/PrimitiveCoderDescriptor.java      |  108 --
 .../jobjc/generator/model/types/JType.java    |  237 ---
 .../jobjc/generator/model/types/NType.java    |  280 ----
 .../jobjc/generator/model/types/Type.java     |  173 --
 .../generator/model/types/TypeCache.java      |  132 --
 .../generator/model/types/TypeToJType.java    |  130 --
 .../internal/jobjc/generator/utils/Fp.java    |  260 ---
 .../jobjc/generator/utils/JavaLang.java       |  168 --
 .../jobjc/generator/utils/NTypeMerger.java    |  190 ---
 .../jobjc/generator/utils/NTypeParser.java    |  273 ----
 .../jobjc/generator/utils/NTypePrinter.java   |  107 --
 .../generator/utils/ObjectInspector.java      |   70 -
 .../internal/jobjc/generator/utils/QA.java    |   39 -
 .../jobjc/generator/utils/StringStream.java   |  155 --
 .../generator/utils/StructOffsetResolver.java |  255 ---
 .../utils/StructOffsetResolverBigBang.java    |   80 -
 .../com/apple/jobjc/SuperClassExtractor.java  |   51 -
 .../com/apple/jobjc/UnsafeRuntimeAccess.java  |   70 -
 .../java/com/apple/jobjc/Utils.java           |  121 --
 .../runtime-additions/native/NativeNumber.m   |   50 -
 .../runtime-additions/native/NativeString.m   |   50 -
 .../runtime-additions/native/NativeThread.m   |  111 --
 .../tests/java/com/apple/jobjc/BaseBench.java |   78 -
 .../java/com/apple/jobjc/BenchFunCall.java    |   81 -
 .../java/com/apple/jobjc/BenchIDPop.java      |   95 --
 .../com/apple/jobjc/BenchStructCoding.java    |   83 -
 .../java/com/apple/jobjc/BenchUnsafe.java     |   61 -
 .../java/com/apple/jobjc/CategoryTest.java    |   47 -
 .../java/com/apple/jobjc/FunctionTest.java    |   81 -
 .../tests/java/com/apple/jobjc/GUIDemo.java   |  116 --
 .../tests/java/com/apple/jobjc/IBDemo.java    |   91 --
 .../tests/java/com/apple/jobjc/IntroTest.java |  125 --
 .../java/com/apple/jobjc/NSClassTest.java     |   50 -
 .../com/apple/jobjc/NativeBufferTest.java     |   38 -
 .../java/com/apple/jobjc/NativeTypeTest.java  |   97 --
 .../java/com/apple/jobjc/PooledTestCase.java  |   47 -
 .../tests/java/com/apple/jobjc/SELTest.java   |   61 -
 .../java/com/apple/jobjc/StructTest.java      |   93 --
 .../java/com/apple/jobjc/SubclassingTest.java |  231 ---
 .../tests/java/com/apple/jobjc/TestUtils.java |   36 -
 .../tests/java/com/apple/jobjc/UtilsTest.java |   78 -
 .../java/com/apple/jobjc/VarArgsTest.java     |   63 -
 .../jobjc/src/tests/native/FunCallBench.m     |   70 -
 133 files changed, 14747 deletions(-)
 delete mode 100644 jdk/src/macosx/native/jobjc/JObjC.xcodeproj/default.pbxuser
 delete mode 100644 jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj
 delete mode 100644 jdk/src/macosx/native/jobjc/README.txt
 delete mode 100644 jdk/src/macosx/native/jobjc/TODOS
 delete mode 100644 jdk/src/macosx/native/jobjc/bridgesupport.gmk
 delete mode 100644 jdk/src/macosx/native/jobjc/build.xml
 delete mode 100644 jdk/src/macosx/native/jobjc/extract_classes.pl
 delete mode 100644 jdk/src/macosx/native/jobjc/run-and-write-if-okay
 delete mode 100644 jdk/src/macosx/native/jobjc/rungen
 delete mode 100644 jdk/src/macosx/native/jobjc/runjava
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CIF.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/CIF.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/Coder.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/FFIType.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/Function.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/ID.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/Invoke.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/MacOSXFramework.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/NSClass.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.h
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/NativeObjectLifecycleManager.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/SEL.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/core/native/Subclassing.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/BootClassPathMinus.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassConsolidator.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassGenerator.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FileCopier.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FrameworkGenerator.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FunctionGenerator.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Generator.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/MethodDisambiguator.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/RestrictedKeywords.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Utils.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/AbstractObjCClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CFTypeClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CopiedFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/GeneratedClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/MixedPrimitiveCoderClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OpaqueClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OutputFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/RootJObjCClass.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/StructClassFile.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Arg.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/CFType.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Category.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Constant.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Element.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ElementWType.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Framework.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Function.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/FunctionAlias.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/InformalProtocol.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Method.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/NativeEnum.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Opaque.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/OutputFileGenerator.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Protocol.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ReturnValue.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/StringConstant.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Struct.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/TypeElement.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/CoderDescriptor.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/PrimitiveCoderDescriptor.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/JType.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/NType.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/Type.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeCache.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeToJType.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/Fp.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/JavaLang.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeMerger.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeParser.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypePrinter.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/ObjectInspector.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/QA.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StringStream.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolver.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolverBigBang.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/SuperClassExtractor.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/UnsafeRuntimeAccess.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/runtime-additions/java/com/apple/jobjc/Utils.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeNumber.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeString.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeThread.m
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BaseBench.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchFunCall.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchIDPop.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchStructCoding.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchUnsafe.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/CategoryTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/FunctionTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/GUIDemo.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IBDemo.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IntroTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NSClassTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeBufferTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeTypeTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/PooledTestCase.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SELTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/StructTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SubclassingTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/TestUtils.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/UtilsTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/VarArgsTest.java
 delete mode 100644 jdk/src/macosx/native/jobjc/src/tests/native/FunCallBench.m

diff --git a/jdk/src/macosx/native/jobjc/JObjC.xcodeproj/default.pbxuser b/jdk/src/macosx/native/jobjc/JObjC.xcodeproj/default.pbxuser
deleted file mode 100644
index cda3de5e2f2..00000000000
--- a/jdk/src/macosx/native/jobjc/JObjC.xcodeproj/default.pbxuser
+++ /dev/null
@@ -1,207 +0,0 @@
-// !$*UTF8*$!
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-{
-        00E6828EFEC88D1A11DB9C8B /* Project object */ = {
-                activeBuildConfigurationName = Release;
-                activeExecutable = 6A9FA6570246BA6C0CC91562 /* JObjC */;
-                activeTarget = EB9FD8610AEECCF5008E157E /* JObjC */;
-                addToTargets = (
-                        4CEBA78E08679EF10015D03E /* JNILib */,
-                );
-                breakpointsGroup = 0AB3651F0B2F67B300788B6C /* XCBreakpointsBucket */;
-                codeSenseManager = 0AB364DB0B2F66FD00788B6C /* Code sense */;
-                executables = (
-                        6A9FA6570246BA6C0CC91562 /* JObjC */,
-                );
-                perUserDictionary = {
-                        PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
-                                PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
-                                PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
-                                PBXFileTableDataSourceColumnWidthsKey = (
-                                        22,
-                                        300,
-                                        131,
-                                );
-                                PBXFileTableDataSourceColumnsKey = (
-                                        PBXExecutablesDataSource_ActiveFlagID,
-                                        PBXExecutablesDataSource_NameID,
-                                        PBXExecutablesDataSource_CommentsID,
-                                );
-                        };
-                        PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
-                                PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
-                                PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
-                                PBXFileTableDataSourceColumnWidthsKey = (
-                                        20,
-                                        245,
-                                        20,
-                                        48,
-                                        43,
-                                        43,
-                                        20,
-                                );
-                                PBXFileTableDataSourceColumnsKey = (
-                                        PBXFileDataSource_FiletypeID,
-                                        PBXFileDataSource_Filename_ColumnID,
-                                        PBXFileDataSource_Built_ColumnID,
-                                        PBXFileDataSource_ObjectSize_ColumnID,
-                                        PBXFileDataSource_Errors_ColumnID,
-                                        PBXFileDataSource_Warnings_ColumnID,
-                                        PBXFileDataSource_Target_ColumnID,
-                                );
-                        };
-                        PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
-                                PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
-                                PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
-                                PBXFileTableDataSourceColumnWidthsKey = (
-                                        20,
-                                        200,
-                                        65,
-                                        20,
-                                        48,
-                                        43,
-                                        43,
-                                );
-                                PBXFileTableDataSourceColumnsKey = (
-                                        PBXFileDataSource_FiletypeID,
-                                        PBXFileDataSource_Filename_ColumnID,
-                                        PBXTargetDataSource_PrimaryAttribute,
-                                        PBXFileDataSource_Built_ColumnID,
-                                        PBXFileDataSource_ObjectSize_ColumnID,
-                                        PBXFileDataSource_Errors_ColumnID,
-                                        PBXFileDataSource_Warnings_ColumnID,
-                                );
-                        };
-                };
-                sourceControlManager = 0AB364DA0B2F66FD00788B6C /* Source Control */;
-                userBuildSettings = {
-                };
-        };
-        0AB364DA0B2F66FD00788B6C /* Source Control */ = {
-                isa = PBXSourceControlManager;
-                fallbackIsa = XCSourceControlManager;
-                isSCMEnabled = 0;
-                scmConfiguration = {
-                };
-                scmType = "";
-        };
-        0AB364DB0B2F66FD00788B6C /* Code sense */ = {
-                isa = PBXCodeSenseManager;
-                indexTemplatePath = "";
-        };
-        0AB3651F0B2F67B300788B6C /* XCBreakpointsBucket */ = {
-                isa = XCBreakpointsBucket;
-                name = "Project Breakpoints";
-                objects = (
-                );
-        };
-        0AB365570B2F6ABB00788B6C /* JObjCdylib.c */ = {
-                uiCtxt = {
-                        sepNavIntBoundsRect = "{{0, 0}, {847, 783}}";
-                        sepNavSelRange = "{0, 0}";
-                        sepNavVisRect = "{{0, 0}, {847, 783}}";
-                        sepNavWindowFrame = "{{84, 198}, {886, 912}}";
-                };
-        };
-        0A3CC35E0B94BB8800F6BA26 /* java */ = {
-                isa = PBXFileReference;
-                explicitFileType = "compiled.mach-o.executable";
-                name = java;
-                path = /usr/bin/java;
-                sourceTree = "<absolute>";
-        };
-        363028F90383184400C91562 /* Manifest */ = {
-                uiCtxt = {
-                        sepNavIntBoundsRect = "{{0, 0}, {847, 783}}";
-                        sepNavSelRange = "{0, 0}";
-                        sepNavVisRect = "{{0, 0}, {847, 783}}";
-                        sepNavWindowFrame = "{{38, 240}, {886, 912}}";
-                };
-        };
-        4CEBA78E08679EF10015D03E /* Dylib */ = {
-                activeExec = 0;
-        };
-        6A9FA6570246BA6C0CC91562 /* JObjC */ = {
-                isa = PBXExecutable;
-                activeArgIndex = 0;
-                activeArgIndices = (
-                        YES,
-                );
-                argumentStrings = (
-                        "-cp JObjC.jar JObjC",
-                );
-                autoAttachOnCrash = 1;
-                configStateDict = {
-                        "PBXLSLaunchAction-0" = {
-                                PBXLSLaunchAction = 0;
-                                PBXLSLaunchStartAction = 1;
-                                PBXLSLaunchStdioStyle = 2;
-                                PBXLSLaunchStyle = 0;
-                                class = PBXLSRunLaunchConfig;
-                                displayName = "Executable Runner";
-                                identifier = com.apple.Xcode.launch.runConfig;
-                                remoteHostInfo = "";
-                                startActionInfo = "";
-                        };
-                        "PBXLSLaunchAction-1" = {
-                                PBXLSLaunchAction = 1;
-                                PBXLSLaunchStartAction = 1;
-                                PBXLSLaunchStdioStyle = 2;
-                                PBXLSLaunchStyle = 0;
-                                class = PBXJavaDebuggingNativeLaunchConfig;
-                                displayName = "Java Debugger";
-                                identifier = com.apple.Xcode.launch.JavaDebugNativeConfig;
-                                remoteHostInfo = "";
-                                startActionInfo = "";
-                        };
-                };
-                customDataFormattersEnabled = 1;
-                debuggerPlugin = GDBDebugging;
-                disassemblyDisplayState = 0;
-                dylibVariantSuffix = "";
-                enableDebugStr = 1;
-                environmentEntries = (
-                );
-                executableSystemSymbolLevel = 0;
-                executableUserSymbolLevel = 0;
-                launchableReference = 0A3CC35E0B94BB8800F6BA26 /* java */;
-                libgmallocEnabled = 0;
-                name = JObjC;
-                sourceDirectories = (
-                );
-                startupPath = "dist";
-        };
-        EB9FD8610AEECCF5008E157E /* JObjC */ = {
-                activeExec = 0;
-        };
-        EB9FD8720AEECD83008E157E /* build.xml */ = {
-                uiCtxt = {
-                        sepNavIntBoundsRect = "{{0, 0}, {847, 1260}}";
-                        sepNavSelRange = "{1260, 0}";
-                        sepNavVisRect = "{{0, 8}, {847, 783}}";
-                        sepNavWindowFrame = "{{752, 266}, {886, 912}}";
-                };
-        };
-}
diff --git a/jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj b/jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj
deleted file mode 100644
index 61cf3948d0d..00000000000
--- a/jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,1397 +0,0 @@
-// !$*UTF8*$!
-{
-        archiveVersion = 1;
-        classes = {
-        };
-        objectVersion = 44;
-        objects = {
-
-/* Begin PBXAggregateTarget section */
-                89EBD58C0C95F43D000F04A0 /* B&I */ = {
-                        isa = PBXAggregateTarget;
-                        buildConfigurationList = 89EBD5930C95F44E000F04A0 /* Build configuration list for PBXAggregateTarget "B&I" */;
-                        buildPhases = (
-                        );
-                        dependencies = (
-                                C592D6590E12F27400D076FF /* PBXTargetDependency */,
-                                C592D65B0E12F27600D076FF /* PBXTargetDependency */,
-                                C592D65D0E12F27E00D076FF /* PBXTargetDependency */,
-                                89D7CB9C0CDC64F800472EA2 /* PBXTargetDependency */,
-                                C592D65F0E12F28500D076FF /* PBXTargetDependency */,
-                                C592D6610E12F28E00D076FF /* PBXTargetDependency */,
-                                C592D6630E12F29200D076FF /* PBXTargetDependency */,
-                                89D7CC920CDE7A8200472EA2 /* PBXTargetDependency */,
-                        );
-                        name = "B&I";
-                        productName = "B&I";
-                };
-/* End PBXAggregateTarget section */
-
-/* Begin PBXBuildFile section */
-                89D7C9F70CDB900E00472EA2 /* CIF.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9EC0CDB900E00472EA2 /* CIF.m */; };
-                89D7C9F80CDB900E00472EA2 /* Coder.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9ED0CDB900E00472EA2 /* Coder.m */; };
-                89D7C9F90CDB900E00472EA2 /* Function.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9EE0CDB900E00472EA2 /* Function.m */; };
-                89D7C9FA0CDB900E00472EA2 /* ID.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9EF0CDB900E00472EA2 /* ID.m */; };
-                89D7C9FB0CDB900E00472EA2 /* JObjCRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F00CDB900E00472EA2 /* JObjCRuntime.m */; };
-                89D7C9FC0CDB900E00472EA2 /* MacOSXFramework.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F10CDB900E00472EA2 /* MacOSXFramework.m */; };
-                89D7C9FD0CDB900E00472EA2 /* NativeBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 89D7C9F20CDB900E00472EA2 /* NativeBuffer.h */; };
-                89D7C9FE0CDB900E00472EA2 /* NativeBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F30CDB900E00472EA2 /* NativeBuffer.m */; };
-                89D7C9FF0CDB900E00472EA2 /* NativeObjectLifecycleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F40CDB900E00472EA2 /* NativeObjectLifecycleManager.m */; };
-                89D7CA000CDB900E00472EA2 /* NSClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F50CDB900E00472EA2 /* NSClass.m */; };
-                89D7CA010CDB900E00472EA2 /* SEL.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F60CDB900E00472EA2 /* SEL.m */; };
-                89D7CB770CDC4A6500472EA2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 890FBACC0C6F782C00902C32 /* Foundation.framework */; };
-                89D7CB780CDC4A6500472EA2 /* JavaVM.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 890FBACA0C6F781000902C32 /* JavaVM.framework */; };
-                89D7CB790CDC4A6500472EA2 /* JavaNativeFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 896D90BB0CC2877C005625F5 /* JavaNativeFoundation.framework */; };
-                89D7CB7A0CDC4A6500472EA2 /* libffi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 89E437680C97A7F200C756EE /* libffi.dylib */; };
-                89D7CCA40CDF9A2600472EA2 /* NativeBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 89D7C9F20CDB900E00472EA2 /* NativeBuffer.h */; };
-                89D7CCA60CDF9A2600472EA2 /* CIF.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9EC0CDB900E00472EA2 /* CIF.m */; };
-                89D7CCA70CDF9A2600472EA2 /* Coder.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9ED0CDB900E00472EA2 /* Coder.m */; };
-                89D7CCA80CDF9A2600472EA2 /* Function.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9EE0CDB900E00472EA2 /* Function.m */; };
-                89D7CCA90CDF9A2600472EA2 /* ID.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9EF0CDB900E00472EA2 /* ID.m */; };
-                89D7CCAA0CDF9A2600472EA2 /* JObjCRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F00CDB900E00472EA2 /* JObjCRuntime.m */; };
-                89D7CCAB0CDF9A2600472EA2 /* MacOSXFramework.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F10CDB900E00472EA2 /* MacOSXFramework.m */; };
-                89D7CCAC0CDF9A2600472EA2 /* NativeBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F30CDB900E00472EA2 /* NativeBuffer.m */; };
-                89D7CCAD0CDF9A2600472EA2 /* NativeObjectLifecycleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F40CDB900E00472EA2 /* NativeObjectLifecycleManager.m */; };
-                89D7CCAE0CDF9A2600472EA2 /* NSClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F50CDB900E00472EA2 /* NSClass.m */; };
-                89D7CCAF0CDF9A2600472EA2 /* SEL.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7C9F60CDB900E00472EA2 /* SEL.m */; };
-                89D7CCB10CDF9A2600472EA2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 890FBACC0C6F782C00902C32 /* Foundation.framework */; };
-                89D7CCB20CDF9A2600472EA2 /* JavaVM.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 890FBACA0C6F781000902C32 /* JavaVM.framework */; };
-                89D7CCB30CDF9A2600472EA2 /* JavaNativeFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 896D90BB0CC2877C005625F5 /* JavaNativeFoundation.framework */; };
-                89D7CCB40CDF9A2600472EA2 /* libffi.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 89E437680C97A7F200C756EE /* libffi.dylib */; };
-                89D7CCBB0CDF9AA200472EA2 /* NativeString.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7CCBA0CDF9AA200472EA2 /* NativeString.m */; };
-                89D7CCBD0CDF9AB100472EA2 /* NativeNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7CCBC0CDF9AB100472EA2 /* NativeNumber.m */; };
-                89D7CCBF0CDF9AC600472EA2 /* NativeThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D7CCBE0CDF9AC600472EA2 /* NativeThread.m */; };
-                C5742F6D0E316EFA00093838 /* Subclassing.m in Sources */ = {isa = PBXBuildFile; fileRef = C5742F6B0E316EFA00093838 /* Subclassing.m */; };
-                C5742F700E316F8600093838 /* Subclassing.m in Sources */ = {isa = PBXBuildFile; fileRef = C5742F6B0E316EFA00093838 /* Subclassing.m */; };
-                C5D196C90DF9E43C006F9FB9 /* FFIType.m in Sources */ = {isa = PBXBuildFile; fileRef = C5D196C80DF9E43C006F9FB9 /* FFIType.m */; };
-                C5D197D90DFB77C6006F9FB9 /* FFIType.m in Sources */ = {isa = PBXBuildFile; fileRef = C5D196C80DF9E43C006F9FB9 /* FFIType.m */; };
-                C5E4547B0E36729F0046D3E8 /* Invoke.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E454790E36729F0046D3E8 /* Invoke.m */; };
-                C5E4547D0E367DAB0046D3E8 /* Invoke.m in Sources */ = {isa = PBXBuildFile; fileRef = C5E454790E36729F0046D3E8 /* Invoke.m */; };
-                C5F3B23D0E39948300B771AE /* FunCallBench.m in Sources */ = {isa = PBXBuildFile; fileRef = C5F3B1370E398F8E00B771AE /* FunCallBench.m */; };
-                C5F3B2620E3AB0F300B771AE /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5F3B2610E3AB0F300B771AE /* AppKit.framework */; };
-                C5F3B2640E3AB0F300B771AE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5F3B2630E3AB0F300B771AE /* Cocoa.framework */; };
-                C5F3B2650E3AB0F300B771AE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 890FBACC0C6F782C00902C32 /* Foundation.framework */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXContainerItemProxy section */
-                2CC7556013A1322100B09D1B /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = EB9FD8610AEECCF5008E157E;
-                        remoteInfo = "build-core-java";
-                };
-                2CC7556213A1322800B09D1B /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = C5F3B1530E39927900B771AE;
-                        remoteInfo = "build-test-java";
-                };
-                2CC7556413A1323700B09D1B /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CA160CDBA94D00472EA2;
-                        remoteInfo = "build-generator-java";
-                };
-                2CC7556613A1324300B09D1B /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CC600CDE75EC00472EA2;
-                        remoteInfo = "build-additions-java";
-                };
-                2CC7556813A1325700B09D1B /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CB870CDC4ED000472EA2;
-                        remoteInfo = "run-generator";
-                };
-                2CC7556A13A132AF00B09D1B /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 4CEBA78E08679EF10015D03E;
-                        remoteInfo = "build-core-native";
-                };
-                2CC7556C13A132B200B09D1B /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = EB9FD8610AEECCF5008E157E;
-                        remoteInfo = "build-core-java";
-                };
-                89D7CB9B0CDC64F800472EA2 /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CB870CDC4ED000472EA2;
-                        remoteInfo = "run-generator";
-                };
-                89D7CC910CDE7A8200472EA2 /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CC720CDE767500472EA2;
-                        remoteInfo = "assemble-product-java";
-                };
-                C592D6580E12F27400D076FF /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = EB9FD8610AEECCF5008E157E;
-                        remoteInfo = "build-core-java";
-                };
-                C592D65A0E12F27600D076FF /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 4CEBA78E08679EF10015D03E;
-                        remoteInfo = "build-core-native";
-                };
-                C592D65C0E12F27E00D076FF /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CA160CDBA94D00472EA2;
-                        remoteInfo = "build-generator-java";
-                };
-                C592D65E0E12F28500D076FF /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CC4C0CDE4C0400472EA2;
-                        remoteInfo = "build-generated-java";
-                };
-                C592D6600E12F28E00D076FF /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CC600CDE75EC00472EA2;
-                        remoteInfo = "build-additions-java";
-                };
-                C592D6620E12F29200D076FF /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 89D7CCA20CDF9A2600472EA2;
-                        remoteInfo = "build-additions-native";
-                };
-                C5D197DA0DFB77E4006F9FB9 /* PBXContainerItemProxy */ = {
-                        isa = PBXContainerItemProxy;
-                        containerPortal = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-                        proxyType = 1;
-                        remoteGlobalIDString = 4CEBA78E08679EF10015D03E;
-                        remoteInfo = "build-core-native";
-                };
-/* End PBXContainerItemProxy section */
-
-/* Begin PBXFileReference section */
-                0AB364E40B2F671600788B6C /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; path = src; sourceTree = "<group>"; };
-                890FBACA0C6F781000902C32 /* JavaVM.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaVM.framework; path = /System/Library/Frameworks/JavaVM.framework; sourceTree = "<absolute>"; };
-                890FBACC0C6F782C00902C32 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
-                896D90BB0CC2877C005625F5 /* JavaNativeFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaNativeFoundation.framework; path = /System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework; sourceTree = "<absolute>"; };
-                896D91230CC2ED34005625F5 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
-                89736E5F0CE819E5008C4205 /* JObjC.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = JObjC.jar; sourceTree = BUILT_PRODUCTS_DIR; };
-                89D7C9EC0CDB900E00472EA2 /* CIF.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CIF.m; sourceTree = "<group>"; };
-                89D7C9ED0CDB900E00472EA2 /* Coder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Coder.m; sourceTree = "<group>"; };
-                89D7C9EE0CDB900E00472EA2 /* Function.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Function.m; sourceTree = "<group>"; };
-                89D7C9EF0CDB900E00472EA2 /* ID.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ID.m; sourceTree = "<group>"; };
-                89D7C9F00CDB900E00472EA2 /* JObjCRuntime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JObjCRuntime.m; sourceTree = "<group>"; };
-                89D7C9F10CDB900E00472EA2 /* MacOSXFramework.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MacOSXFramework.m; sourceTree = "<group>"; };
-                89D7C9F20CDB900E00472EA2 /* NativeBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeBuffer.h; sourceTree = "<group>"; };
-                89D7C9F30CDB900E00472EA2 /* NativeBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeBuffer.m; sourceTree = "<group>"; };
-                89D7C9F40CDB900E00472EA2 /* NativeObjectLifecycleManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeObjectLifecycleManager.m; sourceTree = "<group>"; };
-                89D7C9F50CDB900E00472EA2 /* NSClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSClass.m; sourceTree = "<group>"; };
-                89D7C9F60CDB900E00472EA2 /* SEL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SEL.m; sourceTree = "<group>"; };
-                89D7CCB80CDF9A2600472EA2 /* libJObjC.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libJObjC.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
-                89D7CCBA0CDF9AA200472EA2 /* NativeString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeString.m; sourceTree = "<group>"; };
-                89D7CCBC0CDF9AB100472EA2 /* NativeNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeNumber.m; sourceTree = "<group>"; };
-                89D7CCBE0CDF9AC600472EA2 /* NativeThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeThread.m; sourceTree = "<group>"; };
-                89E437680C97A7F200C756EE /* libffi.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libffi.dylib; path = /usr/lib/libffi.dylib; sourceTree = "<absolute>"; };
-                C5742F6B0E316EFA00093838 /* Subclassing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Subclassing.m; sourceTree = "<group>"; };
-                C5D196C80DF9E43C006F9FB9 /* FFIType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FFIType.m; sourceTree = "<group>"; };
-                C5E454790E36729F0046D3E8 /* Invoke.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Invoke.m; sourceTree = "<group>"; };
-                C5F3B1370E398F8E00B771AE /* FunCallBench.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunCallBench.m; sourceTree = "<group>"; };
-                C5F3B1450E39910500B771AE /* libJObjC-tests.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libJObjC-tests.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
-                C5F3B2610E3AB0F300B771AE /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
-                C5F3B2630E3AB0F300B771AE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
-                EB9FD8720AEECD83008E157E /* build.xml */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = build.xml; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
-                4CEBA78D08679EF10015D03E /* Frameworks */ = {
-                        isa = PBXFrameworksBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                89D7CB770CDC4A6500472EA2 /* Foundation.framework in Frameworks */,
-                                89D7CB780CDC4A6500472EA2 /* JavaVM.framework in Frameworks */,
-                                89D7CB790CDC4A6500472EA2 /* JavaNativeFoundation.framework in Frameworks */,
-                                89D7CB7A0CDC4A6500472EA2 /* libffi.dylib in Frameworks */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-                89D7CCB00CDF9A2600472EA2 /* Frameworks */ = {
-                        isa = PBXFrameworksBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                89D7CCB10CDF9A2600472EA2 /* Foundation.framework in Frameworks */,
-                                89D7CCB20CDF9A2600472EA2 /* JavaVM.framework in Frameworks */,
-                                89D7CCB30CDF9A2600472EA2 /* JavaNativeFoundation.framework in Frameworks */,
-                                89D7CCB40CDF9A2600472EA2 /* libffi.dylib in Frameworks */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-                C5F3B1430E39910500B771AE /* Frameworks */ = {
-                        isa = PBXFrameworksBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                C5F3B2620E3AB0F300B771AE /* AppKit.framework in Frameworks */,
-                                C5F3B2640E3AB0F300B771AE /* Cocoa.framework in Frameworks */,
-                                C5F3B2650E3AB0F300B771AE /* Foundation.framework in Frameworks */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-                00E6828FFEC88D1A11DB9C8B = {
-                        isa = PBXGroup;
-                        children = (
-                                896D91230CC2ED34005625F5 /* README.txt */,
-                                EB9FD8720AEECD83008E157E /* build.xml */,
-                                0AB364E40B2F671600788B6C /* src */,
-                                89D7C9EB0CDB900E00472EA2 /* native-core */,
-                                89D7CA020CDB902200472EA2 /* native-additions */,
-                                C5A9597F0E398F050057C96D /* native-tests */,
-                                89D7CA030CDB903000472EA2 /* products */,
-                                890FBAC90C6F77B700902C32 /* frameworks */,
-                                C5F3B1450E39910500B771AE /* libJObjC-tests.dylib */,
-                                C5F3B2610E3AB0F300B771AE /* AppKit.framework */,
-                                C5F3B2630E3AB0F300B771AE /* Cocoa.framework */,
-                        );
-                        sourceTree = "<group>";
-                };
-                890FBAC90C6F77B700902C32 /* frameworks */ = {
-                        isa = PBXGroup;
-                        children = (
-                                890FBACC0C6F782C00902C32 /* Foundation.framework */,
-                                890FBACA0C6F781000902C32 /* JavaVM.framework */,
-                                896D90BB0CC2877C005625F5 /* JavaNativeFoundation.framework */,
-                                89E437680C97A7F200C756EE /* libffi.dylib */,
-                        );
-                        name = frameworks;
-                        sourceTree = "<group>";
-                };
-                89D7C9EB0CDB900E00472EA2 /* native-core */ = {
-                        isa = PBXGroup;
-                        children = (
-                                89D7C9EC0CDB900E00472EA2 /* CIF.m */,
-                                89D7C9ED0CDB900E00472EA2 /* Coder.m */,
-                                C5D196C80DF9E43C006F9FB9 /* FFIType.m */,
-                                89D7C9EE0CDB900E00472EA2 /* Function.m */,
-                                89D7C9EF0CDB900E00472EA2 /* ID.m */,
-                                C5E454790E36729F0046D3E8 /* Invoke.m */,
-                                89D7C9F00CDB900E00472EA2 /* JObjCRuntime.m */,
-                                89D7C9F10CDB900E00472EA2 /* MacOSXFramework.m */,
-                                89D7C9F20CDB900E00472EA2 /* NativeBuffer.h */,
-                                89D7C9F30CDB900E00472EA2 /* NativeBuffer.m */,
-                                89D7C9F40CDB900E00472EA2 /* NativeObjectLifecycleManager.m */,
-                                89D7C9F50CDB900E00472EA2 /* NSClass.m */,
-                                89D7C9F60CDB900E00472EA2 /* SEL.m */,
-                                C5742F6B0E316EFA00093838 /* Subclassing.m */,
-                        );
-                        name = "native-core";
-                        path = src/core/native;
-                        sourceTree = "<group>";
-                };
-                89D7CA020CDB902200472EA2 /* native-additions */ = {
-                        isa = PBXGroup;
-                        children = (
-                                89D7CCBA0CDF9AA200472EA2 /* NativeString.m */,
-                                89D7CCBC0CDF9AB100472EA2 /* NativeNumber.m */,
-                                89D7CCBE0CDF9AC600472EA2 /* NativeThread.m */,
-                        );
-                        name = "native-additions";
-                        path = "src/runtime-additions/native";
-                        sourceTree = "<group>";
-                };
-                89D7CA030CDB903000472EA2 /* products */ = {
-                        isa = PBXGroup;
-                        children = (
-                                89736E5F0CE819E5008C4205 /* JObjC.jar */,
-                                89D7CCB80CDF9A2600472EA2 /* libJObjC.dylib */,
-                        );
-                        name = products;
-                        path = "src/runtime-additions/native";
-                        sourceTree = "<group>";
-                };
-                C5A9597F0E398F050057C96D /* native-tests */ = {
-                        isa = PBXGroup;
-                        children = (
-                                C5F3B1370E398F8E00B771AE /* FunCallBench.m */,
-                        );
-                        name = "native-tests";
-                        path = src/tests/native;
-                        sourceTree = "<group>";
-                };
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
-                4CEBA78B08679EF10015D03E /* Headers */ = {
-                        isa = PBXHeadersBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                89D7C9FD0CDB900E00472EA2 /* NativeBuffer.h in Headers */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-                89D7CCA30CDF9A2600472EA2 /* Headers */ = {
-                        isa = PBXHeadersBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                89D7CCA40CDF9A2600472EA2 /* NativeBuffer.h in Headers */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-                C5F3B1410E39910500B771AE /* Headers */ = {
-                        isa = PBXHeadersBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXLegacyTarget section */
-                89D7CA160CDBA94D00472EA2 /* build-generator-java */ = {
-                        isa = PBXLegacyTarget;
-                        buildArgumentsString = "-verbose -emacs $ACTION";
-                        buildConfigurationList = 89D7CA1C0CDBA9B000472EA2 /* Build configuration list for PBXLegacyTarget "build-generator-java" */;
-                        buildPhases = (
-                        );
-                        buildToolPath = /usr/bin/ant;
-                        dependencies = (
-                                2CC7556D13A132B200B09D1B /* PBXTargetDependency */,
-                                2CC7556B13A132AF00B09D1B /* PBXTargetDependency */,
-                        );
-                        name = "build-generator-java";
-                        passBuildSettingsInEnvironment = 1;
-                        productName = "generator-build-java";
-                };
-                89D7CB870CDC4ED000472EA2 /* run-generator */ = {
-                        isa = PBXLegacyTarget;
-                        buildArgumentsString = "-verbose -emacs $ACTION";
-                        buildConfigurationList = 89D7CB8E0CDC4ED900472EA2 /* Build configuration list for PBXLegacyTarget "run-generator" */;
-                        buildPhases = (
-                        );
-                        buildToolPath = /usr/bin/ant;
-                        dependencies = (
-                                2CC7556513A1323700B09D1B /* PBXTargetDependency */,
-                        );
-                        name = "run-generator";
-                        passBuildSettingsInEnvironment = 1;
-                        productName = "run-generator";
-                };
-                89D7CC4C0CDE4C0400472EA2 /* build-generated-java */ = {
-                        isa = PBXLegacyTarget;
-                        buildArgumentsString = "-verbose -emacs $ACTION";
-                        buildConfigurationList = 89D7CC510CDE4C5200472EA2 /* Build configuration list for PBXLegacyTarget "build-generated-java" */;
-                        buildPhases = (
-                        );
-                        buildToolPath = /usr/bin/ant;
-                        dependencies = (
-                                2CC7556913A1325700B09D1B /* PBXTargetDependency */,
-                        );
-                        name = "build-generated-java";
-                        passBuildSettingsInEnvironment = 1;
-                        productName = "build-generated-java";
-                };
-                89D7CC600CDE75EC00472EA2 /* build-additions-java */ = {
-                        isa = PBXLegacyTarget;
-                        buildArgumentsString = "-verbose -emacs $ACTION";
-                        buildConfigurationList = 89D7CC630CDE762000472EA2 /* Build configuration list for PBXLegacyTarget "build-additions-java" */;
-                        buildPhases = (
-                        );
-                        buildToolPath = /usr/bin/ant;
-                        dependencies = (
-                        );
-                        name = "build-additions-java";
-                        passBuildSettingsInEnvironment = 1;
-                        productName = "build-additions-java";
-                };
-                89D7CC720CDE767500472EA2 /* assemble-product-java */ = {
-                        isa = PBXLegacyTarget;
-                        buildArgumentsString = "-verbose -emacs $ACTION";
-                        buildConfigurationList = 89D7CC7A0CDE76F500472EA2 /* Build configuration list for PBXLegacyTarget "assemble-product-java" */;
-                        buildPhases = (
-                        );
-                        buildToolPath = /usr/bin/ant;
-                        dependencies = (
-                        );
-                        name = "assemble-product-java";
-                        passBuildSettingsInEnvironment = 1;
-                        productName = "package-product";
-                };
-                C5F3B1530E39927900B771AE /* build-test-java */ = {
-                        isa = PBXLegacyTarget;
-                        buildArgumentsString = "-verbose -emacs $ACTION";
-                        buildConfigurationList = C5F3B15B0E3992AC00B771AE /* Build configuration list for PBXLegacyTarget "build-test-java" */;
-                        buildPhases = (
-                        );
-                        buildToolPath = /usr/bin/ant;
-                        dependencies = (
-                        );
-                        name = "build-test-java";
-                        passBuildSettingsInEnvironment = 1;
-                        productName = "build-test";
-                };
-                EB9FD8610AEECCF5008E157E /* build-core-java */ = {
-                        isa = PBXLegacyTarget;
-                        buildArgumentsString = "-verbose -emacs $ACTION";
-                        buildConfigurationList = EB9FD8690AEECD13008E157E /* Build configuration list for PBXLegacyTarget "build-core-java" */;
-                        buildPhases = (
-                        );
-                        buildToolPath = /usr/bin/ant;
-                        buildWorkingDirectory = "";
-                        dependencies = (
-                        );
-                        name = "build-core-java";
-                        passBuildSettingsInEnvironment = 1;
-                        productName = AntJNIWrapper;
-                };
-/* End PBXLegacyTarget section */
-
-/* Begin PBXNativeTarget section */
-                4CEBA78E08679EF10015D03E /* build-core-native */ = {
-                        isa = PBXNativeTarget;
-                        buildConfigurationList = 4CEBA79108679F100015D03E /* Build configuration list for PBXNativeTarget "build-core-native" */;
-                        buildPhases = (
-                                4CEBA78B08679EF10015D03E /* Headers */,
-                                4CEBA78C08679EF10015D03E /* Sources */,
-                                4CEBA78D08679EF10015D03E /* Frameworks */,
-                        );
-                        buildRules = (
-                        );
-                        dependencies = (
-                                2CC7556113A1322100B09D1B /* PBXTargetDependency */,
-                        );
-                        name = "build-core-native";
-                        productName = DylibN;
-                        productType = "com.apple.product-type.library.dynamic";
-                };
-                89D7CCA20CDF9A2600472EA2 /* build-additions-native */ = {
-                        isa = PBXNativeTarget;
-                        buildConfigurationList = 89D7CCB50CDF9A2600472EA2 /* Build configuration list for PBXNativeTarget "build-additions-native" */;
-                        buildPhases = (
-                                89D7CCA30CDF9A2600472EA2 /* Headers */,
-                                89D7CCA50CDF9A2600472EA2 /* Sources */,
-                                89D7CCB00CDF9A2600472EA2 /* Frameworks */,
-                        );
-                        buildRules = (
-                        );
-                        dependencies = (
-                                2CC7556713A1324300B09D1B /* PBXTargetDependency */,
-                                C5D197DB0DFB77E4006F9FB9 /* PBXTargetDependency */,
-                        );
-                        name = "build-additions-native";
-                        productName = DylibN;
-                        productReference = 89D7CCB80CDF9A2600472EA2 /* libJObjC.dylib */;
-                        productType = "com.apple.product-type.library.dynamic";
-                };
-                C5F3B1440E39910500B771AE /* build-test-native */ = {
-                        isa = PBXNativeTarget;
-                        buildConfigurationList = C5F3B1480E39917500B771AE /* Build configuration list for PBXNativeTarget "build-test-native" */;
-                        buildPhases = (
-                                C5F3B1410E39910500B771AE /* Headers */,
-                                C5F3B1420E39910500B771AE /* Sources */,
-                                C5F3B1430E39910500B771AE /* Frameworks */,
-                        );
-                        buildRules = (
-                        );
-                        dependencies = (
-                                2CC7556313A1322800B09D1B /* PBXTargetDependency */,
-                        );
-                        name = "build-test-native";
-                        productName = "build-tests-native";
-                        productReference = C5F3B1450E39910500B771AE /* libJObjC-tests.dylib */;
-                        productType = "com.apple.product-type.library.dynamic";
-                };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-                00E6828EFEC88D1A11DB9C8B /* Project object */ = {
-                        isa = PBXProject;
-                        attributes = {
-                                LastUpgradeCheck = 0410;
-                        };
-                        buildConfigurationList = 4CEBA75C08679E4D0015D03E /* Build configuration list for PBXProject "JObjC" */;
-                        compatibilityVersion = "Xcode 3.0";
-                        developmentRegion = English;
-                        hasScannedForEncodings = 1;
-                        knownRegions = (
-                                English,
-                                Japanese,
-                                French,
-                                German,
-                        );
-                        mainGroup = 00E6828FFEC88D1A11DB9C8B;
-                        productRefGroup = 00E6828FFEC88D1A11DB9C8B;
-                        projectDirPath = "";
-                        projectRoot = "";
-                        targets = (
-                                89EBD58C0C95F43D000F04A0 /* B&I */,
-                                EB9FD8610AEECCF5008E157E /* build-core-java */,
-                                4CEBA78E08679EF10015D03E /* build-core-native */,
-                                89D7CA160CDBA94D00472EA2 /* build-generator-java */,
-                                89D7CB870CDC4ED000472EA2 /* run-generator */,
-                                89D7CC4C0CDE4C0400472EA2 /* build-generated-java */,
-                                89D7CC600CDE75EC00472EA2 /* build-additions-java */,
-                                89D7CCA20CDF9A2600472EA2 /* build-additions-native */,
-                                89D7CC720CDE767500472EA2 /* assemble-product-java */,
-                                C5F3B1530E39927900B771AE /* build-test-java */,
-                                C5F3B1440E39910500B771AE /* build-test-native */,
-                        );
-                };
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
-                4CEBA78C08679EF10015D03E /* Sources */ = {
-                        isa = PBXSourcesBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                C5E4547B0E36729F0046D3E8 /* Invoke.m in Sources */,
-                                C5742F6D0E316EFA00093838 /* Subclassing.m in Sources */,
-                                89D7C9F70CDB900E00472EA2 /* CIF.m in Sources */,
-                                89D7C9F80CDB900E00472EA2 /* Coder.m in Sources */,
-                                89D7C9F90CDB900E00472EA2 /* Function.m in Sources */,
-                                89D7C9FA0CDB900E00472EA2 /* ID.m in Sources */,
-                                89D7C9FB0CDB900E00472EA2 /* JObjCRuntime.m in Sources */,
-                                89D7C9FC0CDB900E00472EA2 /* MacOSXFramework.m in Sources */,
-                                89D7C9FE0CDB900E00472EA2 /* NativeBuffer.m in Sources */,
-                                89D7C9FF0CDB900E00472EA2 /* NativeObjectLifecycleManager.m in Sources */,
-                                89D7CA000CDB900E00472EA2 /* NSClass.m in Sources */,
-                                89D7CA010CDB900E00472EA2 /* SEL.m in Sources */,
-                                C5D196C90DF9E43C006F9FB9 /* FFIType.m in Sources */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-                89D7CCA50CDF9A2600472EA2 /* Sources */ = {
-                        isa = PBXSourcesBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                C5E4547D0E367DAB0046D3E8 /* Invoke.m in Sources */,
-                                C5742F700E316F8600093838 /* Subclassing.m in Sources */,
-                                89D7CCA60CDF9A2600472EA2 /* CIF.m in Sources */,
-                                89D7CCA70CDF9A2600472EA2 /* Coder.m in Sources */,
-                                89D7CCA80CDF9A2600472EA2 /* Function.m in Sources */,
-                                89D7CCA90CDF9A2600472EA2 /* ID.m in Sources */,
-                                89D7CCAA0CDF9A2600472EA2 /* JObjCRuntime.m in Sources */,
-                                89D7CCAB0CDF9A2600472EA2 /* MacOSXFramework.m in Sources */,
-                                89D7CCAC0CDF9A2600472EA2 /* NativeBuffer.m in Sources */,
-                                89D7CCAD0CDF9A2600472EA2 /* NativeObjectLifecycleManager.m in Sources */,
-                                89D7CCAE0CDF9A2600472EA2 /* NSClass.m in Sources */,
-                                89D7CCAF0CDF9A2600472EA2 /* SEL.m in Sources */,
-                                89D7CCBB0CDF9AA200472EA2 /* NativeString.m in Sources */,
-                                89D7CCBD0CDF9AB100472EA2 /* NativeNumber.m in Sources */,
-                                89D7CCBF0CDF9AC600472EA2 /* NativeThread.m in Sources */,
-                                C5D197D90DFB77C6006F9FB9 /* FFIType.m in Sources */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-                C5F3B1420E39910500B771AE /* Sources */ = {
-                        isa = PBXSourcesBuildPhase;
-                        buildActionMask = 2147483647;
-                        files = (
-                                C5F3B23D0E39948300B771AE /* FunCallBench.m in Sources */,
-                        );
-                        runOnlyForDeploymentPostprocessing = 0;
-                };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXTargetDependency section */
-                2CC7556113A1322100B09D1B /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = EB9FD8610AEECCF5008E157E /* build-core-java */;
-                        targetProxy = 2CC7556013A1322100B09D1B /* PBXContainerItemProxy */;
-                };
-                2CC7556313A1322800B09D1B /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = C5F3B1530E39927900B771AE /* build-test-java */;
-                        targetProxy = 2CC7556213A1322800B09D1B /* PBXContainerItemProxy */;
-                };
-                2CC7556513A1323700B09D1B /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CA160CDBA94D00472EA2 /* build-generator-java */;
-                        targetProxy = 2CC7556413A1323700B09D1B /* PBXContainerItemProxy */;
-                };
-                2CC7556713A1324300B09D1B /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CC600CDE75EC00472EA2 /* build-additions-java */;
-                        targetProxy = 2CC7556613A1324300B09D1B /* PBXContainerItemProxy */;
-                };
-                2CC7556913A1325700B09D1B /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CB870CDC4ED000472EA2 /* run-generator */;
-                        targetProxy = 2CC7556813A1325700B09D1B /* PBXContainerItemProxy */;
-                };
-                2CC7556B13A132AF00B09D1B /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 4CEBA78E08679EF10015D03E /* build-core-native */;
-                        targetProxy = 2CC7556A13A132AF00B09D1B /* PBXContainerItemProxy */;
-                };
-                2CC7556D13A132B200B09D1B /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = EB9FD8610AEECCF5008E157E /* build-core-java */;
-                        targetProxy = 2CC7556C13A132B200B09D1B /* PBXContainerItemProxy */;
-                };
-                89D7CB9C0CDC64F800472EA2 /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CB870CDC4ED000472EA2 /* run-generator */;
-                        targetProxy = 89D7CB9B0CDC64F800472EA2 /* PBXContainerItemProxy */;
-                };
-                89D7CC920CDE7A8200472EA2 /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CC720CDE767500472EA2 /* assemble-product-java */;
-                        targetProxy = 89D7CC910CDE7A8200472EA2 /* PBXContainerItemProxy */;
-                };
-                C592D6590E12F27400D076FF /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = EB9FD8610AEECCF5008E157E /* build-core-java */;
-                        targetProxy = C592D6580E12F27400D076FF /* PBXContainerItemProxy */;
-                };
-                C592D65B0E12F27600D076FF /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 4CEBA78E08679EF10015D03E /* build-core-native */;
-                        targetProxy = C592D65A0E12F27600D076FF /* PBXContainerItemProxy */;
-                };
-                C592D65D0E12F27E00D076FF /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CA160CDBA94D00472EA2 /* build-generator-java */;
-                        targetProxy = C592D65C0E12F27E00D076FF /* PBXContainerItemProxy */;
-                };
-                C592D65F0E12F28500D076FF /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CC4C0CDE4C0400472EA2 /* build-generated-java */;
-                        targetProxy = C592D65E0E12F28500D076FF /* PBXContainerItemProxy */;
-                };
-                C592D6610E12F28E00D076FF /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CC600CDE75EC00472EA2 /* build-additions-java */;
-                        targetProxy = C592D6600E12F28E00D076FF /* PBXContainerItemProxy */;
-                };
-                C592D6630E12F29200D076FF /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 89D7CCA20CDF9A2600472EA2 /* build-additions-native */;
-                        targetProxy = C592D6620E12F29200D076FF /* PBXContainerItemProxy */;
-                };
-                C5D197DB0DFB77E4006F9FB9 /* PBXTargetDependency */ = {
-                        isa = PBXTargetDependency;
-                        target = 4CEBA78E08679EF10015D03E /* build-core-native */;
-                        targetProxy = C5D197DA0DFB77E4006F9FB9 /* PBXContainerItemProxy */;
-                };
-/* End PBXTargetDependency section */
-
-/* Begin XCBuildConfiguration section */
-                4CEBA75D08679E4D0015D03E /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                ARCHS = (
-                                        "$(NATIVE_ARCH_32_BIT)",
-                                        "$(NATIVE_ARCH_64_BIT)",
-                                );
-                                GCC_ENABLE_OBJC_GC = supported;
-                                SYMROOT = build;
-                        };
-                        name = Debug;
-                };
-                4CEBA75E08679E4D0015D03E /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                GCC_ENABLE_OBJC_GC = supported;
-                                INSTALL_PATH = /System/Library/Java/Extensions;
-                        };
-                        name = Release;
-                };
-                4CEBA79208679F100015D03E /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                ARCHS = (
-                                        "$(NATIVE_ARCH_32_BIT)",
-                                        "$(NATIVE_ARCH_64_BIT)",
-                                );
-                                COPY_PHASE_STRIP = NO;
-                                DYLIB_COMPATIBILITY_VERSION = 1;
-                                DYLIB_CURRENT_VERSION = 1;
-                                EXECUTABLE_EXTENSION = dylib;
-                                EXECUTABLE_PREFIX = lib;
-                                FRAMEWORK_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                );
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-                                GCC_MODEL_TUNING = G5;
-                                GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
-                                GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
-                                GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-                                GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                                GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-                                GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                                GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
-                                GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
-                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                                GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
-                                GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
-                                GCC_WARN_MISSING_PARENTHESES = YES;
-                                GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
-                                GCC_WARN_PEDANTIC = NO;
-                                GCC_WARN_PROTOTYPE_CONVERSION = NO;
-                                GCC_WARN_SHADOW = YES;
-                                GCC_WARN_SIGN_COMPARE = YES;
-                                GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
-                                GCC_WARN_UNINITIALIZED_AUTOS = YES;
-                                GCC_WARN_UNKNOWN_PRAGMAS = YES;
-                                GCC_WARN_UNUSED_FUNCTION = YES;
-                                GCC_WARN_UNUSED_VARIABLE = YES;
-                                HEADER_SEARCH_PATHS = (
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                        /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers,
-                                );
-                                HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/core\" \"$(OBJROOT)/src/jni_headers/core\"";
-                                LIBRARY_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
-                                );
-                                LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries\"";
-                                LIBRARY_STYLE = DYNAMIC;
-                                MACH_O_TYPE = mh_dylib;
-                                OTHER_LDFLAGS = "";
-                                OTHER_REZFLAGS = "";
-                                PRODUCT_NAME = JObjC;
-                                SECTORDER_FLAGS = "";
-                                VALID_ARCHS = "ppc7400 ppc970 i386 x86_64 ppc";
-                                WARNING_CFLAGS = (
-                                        "-Wmost",
-                                        "-Wno-four-char-constants",
-                                        "-Wno-unknown-pragmas",
-                                        "-Wformat",
-                                        "-Wformat-security",
-                                        "-Wcast-align",
-                                        "-Wwrite-strings",
-                                        "-Wuninitialized",
-                                        "-Wshadow",
-                                        "-Wshorten-64-to-32",
-                                        "-Wsign-compare",
-                                        "-Wpointer-arith",
-                                        "-Wall",
-                                );
-                                ZERO_LINK = NO;
-                        };
-                        name = Debug;
-                };
-                4CEBA79308679F100015D03E /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                ARCHS = (
-                                        i386,
-                                        ppc,
-                                        x86_64,
-                                );
-                                COPY_PHASE_STRIP = YES;
-                                DYLIB_COMPATIBILITY_VERSION = 1;
-                                DYLIB_CURRENT_VERSION = 1;
-                                EXECUTABLE_EXTENSION = dylib;
-                                EXECUTABLE_PREFIX = lib;
-                                FRAMEWORK_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                );
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-                                GCC_MODEL_TUNING = G5;
-                                GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
-                                GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
-                                GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-                                GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                                GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-                                GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                                GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
-                                GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
-                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                                GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
-                                GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
-                                GCC_WARN_MISSING_PARENTHESES = YES;
-                                GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
-                                GCC_WARN_PEDANTIC = NO;
-                                GCC_WARN_PROTOTYPE_CONVERSION = NO;
-                                GCC_WARN_SHADOW = YES;
-                                GCC_WARN_SIGN_COMPARE = YES;
-                                GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
-                                GCC_WARN_UNINITIALIZED_AUTOS = YES;
-                                GCC_WARN_UNKNOWN_PRAGMAS = YES;
-                                GCC_WARN_UNUSED_FUNCTION = YES;
-                                GCC_WARN_UNUSED_VARIABLE = YES;
-                                HEADER_SEARCH_PATHS = (
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                        /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers,
-                                );
-                                HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/core\" \"$(OBJROOT)/src/jni_headers/core\"";
-                                LIBRARY_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                );
-                                LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries\"";
-                                LIBRARY_STYLE = DYNAMIC;
-                                MACH_O_TYPE = mh_dylib;
-                                OTHER_LDFLAGS = "";
-                                OTHER_REZFLAGS = "";
-                                PRODUCT_NAME = JObjC;
-                                SECTORDER_FLAGS = "";
-                                VALID_ARCHS = "ppc7400 ppc970 i386 x86_64 ppc";
-                                WARNING_CFLAGS = (
-                                        "-Wmost",
-                                        "-Wno-four-char-constants",
-                                        "-Wno-unknown-pragmas",
-                                        "-Wformat",
-                                        "-Wformat-security",
-                                        "-Wcast-align",
-                                        "-Wwrite-strings",
-                                        "-Wuninitialized",
-                                        "-Wshadow",
-                                        "-Wshorten-64-to-32",
-                                        "-Wsign-compare",
-                                        "-Wpointer-arith",
-                                        "-Wall",
-                                );
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                89D7CA170CDBA94D00472EA2 /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                PRODUCT_NAME = "build-generator";
-                        };
-                        name = Debug;
-                };
-                89D7CA180CDBA94D00472EA2 /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                                PRODUCT_NAME = "build-generator";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                89D7CB880CDC4ED000472EA2 /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_OPTIMIZATION_LEVEL = "\U00010";
-                                PRODUCT_NAME = "run-generator";
-                        };
-                        name = Debug;
-                };
-                89D7CB890CDC4ED000472EA2 /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                                PRODUCT_NAME = "run-generator";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                89D7CC4D0CDE4C0400472EA2 /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                PRODUCT_NAME = "build-generated";
-                        };
-                        name = Debug;
-                };
-                89D7CC4E0CDE4C0400472EA2 /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                                PRODUCT_NAME = "build-generated";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                89D7CC610CDE75EC00472EA2 /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                PRODUCT_NAME = "build-additions";
-                        };
-                        name = Debug;
-                };
-                89D7CC620CDE75EC00472EA2 /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                                PRODUCT_NAME = "build-additions";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                89D7CC730CDE767500472EA2 /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                PRODUCT_NAME = "assemble-product";
-                        };
-                        name = Debug;
-                };
-                89D7CC740CDE767500472EA2 /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                                PRODUCT_NAME = "assemble-product";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                89D7CCB60CDF9A2600472EA2 /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                ARCHS = (
-                                        "$(NATIVE_ARCH_32_BIT)",
-                                        "$(NATIVE_ARCH_64_BIT)",
-                                );
-                                COPY_PHASE_STRIP = NO;
-                                DYLIB_COMPATIBILITY_VERSION = 1;
-                                DYLIB_CURRENT_VERSION = 1;
-                                EXECUTABLE_EXTENSION = dylib;
-                                EXECUTABLE_PREFIX = lib;
-                                FRAMEWORK_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                );
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-                                GCC_MODEL_TUNING = G5;
-                                GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
-                                GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
-                                GCC_TREAT_WARNINGS_AS_ERRORS = NO;
-                                GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                                GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-                                GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                                GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
-                                GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
-                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                                GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
-                                GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
-                                GCC_WARN_MISSING_PARENTHESES = YES;
-                                GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
-                                GCC_WARN_PEDANTIC = NO;
-                                GCC_WARN_PROTOTYPE_CONVERSION = NO;
-                                GCC_WARN_SHADOW = YES;
-                                GCC_WARN_SIGN_COMPARE = YES;
-                                GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
-                                GCC_WARN_UNINITIALIZED_AUTOS = YES;
-                                GCC_WARN_UNKNOWN_PRAGMAS = YES;
-                                GCC_WARN_UNUSED_FUNCTION = YES;
-                                GCC_WARN_UNUSED_VARIABLE = YES;
-                                HEADER_SEARCH_PATHS = (
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                        /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers,
-                                );
-                                HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/core\" \"$(OBJROOT)/src/jni_headers/core\"";
-                                HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/additions\" \"$(OBJROOT)/src/jni_headers/additions\"";
-                                INSTALL_PATH = /usr/local/lib;
-                                LIBRARY_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
-                                );
-                                LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries\"";
-                                LIBRARY_STYLE = DYNAMIC;
-                                MACH_O_TYPE = mh_dylib;
-                                OTHER_LDFLAGS = "";
-                                OTHER_REZFLAGS = "";
-                                PRODUCT_NAME = JObjC;
-                                SECTORDER_FLAGS = "";
-                                VALID_ARCHS = "ppc7400 ppc970 i386 x86_64 ppc";
-                                WARNING_CFLAGS = (
-                                        "-Wmost",
-                                        "-Wno-four-char-constants",
-                                        "-Wno-unknown-pragmas",
-                                        "-Wformat",
-                                        "-Wformat-security",
-                                        "-Wcast-align",
-                                        "-Wwrite-strings",
-                                        "-Wuninitialized",
-                                        "-Wshadow",
-                                        "-Wshorten-64-to-32",
-                                        "-Wsign-compare",
-                                        "-Wpointer-arith",
-                                        "-Wall",
-                                );
-                                ZERO_LINK = NO;
-                        };
-                        name = Debug;
-                };
-                89D7CCB70CDF9A2600472EA2 /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                ARCHS = (
-                                        x86_64,
-                                        ppc,
-                                        i386,
-                                );
-                                COPY_PHASE_STRIP = YES;
-                                DYLIB_COMPATIBILITY_VERSION = 1;
-                                DYLIB_CURRENT_VERSION = 1;
-                                EXECUTABLE_EXTENSION = dylib;
-                                EXECUTABLE_PREFIX = lib;
-                                FRAMEWORK_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                );
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-                                GCC_MODEL_TUNING = G5;
-                                GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
-                                GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
-                                GCC_TREAT_WARNINGS_AS_ERRORS = NO;
-                                GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                                GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-                                GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                                GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
-                                GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
-                                GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-                                GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
-                                GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
-                                GCC_WARN_MISSING_PARENTHESES = YES;
-                                GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
-                                GCC_WARN_PEDANTIC = NO;
-                                GCC_WARN_PROTOTYPE_CONVERSION = NO;
-                                GCC_WARN_SHADOW = YES;
-                                GCC_WARN_SIGN_COMPARE = YES;
-                                GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
-                                GCC_WARN_UNINITIALIZED_AUTOS = YES;
-                                GCC_WARN_UNKNOWN_PRAGMAS = YES;
-                                GCC_WARN_UNUSED_FUNCTION = YES;
-                                GCC_WARN_UNUSED_VARIABLE = YES;
-                                HEADER_SEARCH_PATHS = (
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                        /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers,
-                                );
-                                HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/core\"  \"$(OBJROOT)/src/jni_headers/core\"";
-                                HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/additions\"  \"$(OBJROOT)/src/jni_headers/additions\"";
-                                LIBRARY_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                );
-                                LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries\"";
-                                LIBRARY_STYLE = DYNAMIC;
-                                MACH_O_TYPE = mh_dylib;
-                                OTHER_LDFLAGS = "";
-                                OTHER_REZFLAGS = "";
-                                PRODUCT_NAME = JObjC;
-                                SECTORDER_FLAGS = "";
-                                VALID_ARCHS = "ppc7400 ppc970 i386 x86_64 ppc";
-                                WARNING_CFLAGS = (
-                                        "-Wmost",
-                                        "-Wno-four-char-constants",
-                                        "-Wno-unknown-pragmas",
-                                        "-Wformat",
-                                        "-Wformat-security",
-                                        "-Wcast-align",
-                                        "-Wwrite-strings",
-                                        "-Wuninitialized",
-                                        "-Wshadow",
-                                        "-Wshorten-64-to-32",
-                                        "-Wsign-compare",
-                                        "-Wpointer-arith",
-                                        "-Wall",
-                                );
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                89EBD58D0C95F43D000F04A0 /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                PRODUCT_NAME = "B&I";
-                        };
-                        name = Debug;
-                };
-                89EBD58E0C95F43D000F04A0 /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                                PRODUCT_NAME = "B&I";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                C5F3B1460E39910500B771AE /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                ALWAYS_SEARCH_USER_PATHS = YES;
-                                ARCHS = (
-                                        x86_64,
-                                        i386,
-                                        ppc,
-                                );
-                                COPY_PHASE_STRIP = NO;
-                                DEBUG_INFORMATION_FORMAT = dwarf;
-                                EXECUTABLE_EXTENSION = dylib;
-                                EXECUTABLE_PREFIX = lib;
-                                FRAMEWORK_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                );
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_MODEL_TUNING = G5;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                HEADER_SEARCH_PATHS = (
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                        /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers,
-                                        "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/core\"",
-                                        "\"$(OBJROOT)/src/jni_headers/core\"",
-                                        "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/additions\"",
-                                        "\"$(OBJROOT)/src/jni_headers/additions\"",
-                                        "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/test\"",
-                                        "\"$(OBJROOT)/src/jni_headers/test\"",
-                                );
-                                INSTALL_PATH = /usr/local/lib;
-                                LIBRARY_STYLE = DYNAMIC;
-                                MACH_O_TYPE = mh_dylib;
-                                PRODUCT_NAME = "JObjC-tests";
-                                SKIP_INSTALL = YES;
-                        };
-                        name = Debug;
-                };
-                C5F3B1470E39910500B771AE /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                ALWAYS_SEARCH_USER_PATHS = YES;
-                                ARCHS = (
-                                        x86_64,
-                                        i386,
-                                        ppc,
-                                );
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = dwarf;
-                                EXECUTABLE_EXTENSION = dylib;
-                                EXECUTABLE_PREFIX = lib;
-                                FRAMEWORK_SEARCH_PATHS = (
-                                        "$(inherited)",
-                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                );
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaVM.framework/Versions/A/Frameworks\"";
-                                GCC_MODEL_TUNING = G5;
-                                HEADER_SEARCH_PATHS = (
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
-                                        "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
-                                        /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers,
-                                        "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/core\"",
-                                        "\"$(OBJROOT)/src/jni_headers/core\"",
-                                        "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/additions\"",
-                                        "\"$(OBJROOT)/src/jni_headers/additions\"",
-                                        "\"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/src/jni_headers/test\"",
-                                        "\"$(OBJROOT)/src/jni_headers/test\"",
-                                );
-                                INSTALL_PATH = /usr/local/lib;
-                                LIBRARY_STYLE = DYNAMIC;
-                                MACH_O_TYPE = mh_dylib;
-                                PRODUCT_NAME = "JObjC-tests";
-                                SKIP_INSTALL = YES;
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                C5F3B1540E39927A00B771AE /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                PRODUCT_NAME = "build-test";
-                        };
-                        name = Debug;
-                };
-                C5F3B1550E39927A00B771AE /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                                PRODUCT_NAME = "build-test";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-                EB9FD86A0AEECD13008E157E /* Debug */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = NO;
-                                GCC_DYNAMIC_NO_PIC = NO;
-                                GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-                                GCC_OPTIMIZATION_LEVEL = 0;
-                                PRODUCT_NAME = "build-core";
-                        };
-                        name = Debug;
-                };
-                EB9FD86B0AEECD13008E157E /* Release */ = {
-                        isa = XCBuildConfiguration;
-                        buildSettings = {
-                                COPY_PHASE_STRIP = YES;
-                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-                                PRODUCT_NAME = "build-core";
-                                ZERO_LINK = NO;
-                        };
-                        name = Release;
-                };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-                4CEBA75C08679E4D0015D03E /* Build configuration list for PBXProject "JObjC" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                4CEBA75D08679E4D0015D03E /* Debug */,
-                                4CEBA75E08679E4D0015D03E /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                4CEBA79108679F100015D03E /* Build configuration list for PBXNativeTarget "build-core-native" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                4CEBA79208679F100015D03E /* Debug */,
-                                4CEBA79308679F100015D03E /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                89D7CA1C0CDBA9B000472EA2 /* Build configuration list for PBXLegacyTarget "build-generator-java" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                89D7CA170CDBA94D00472EA2 /* Debug */,
-                                89D7CA180CDBA94D00472EA2 /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                89D7CB8E0CDC4ED900472EA2 /* Build configuration list for PBXLegacyTarget "run-generator" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                89D7CB880CDC4ED000472EA2 /* Debug */,
-                                89D7CB890CDC4ED000472EA2 /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                89D7CC510CDE4C5200472EA2 /* Build configuration list for PBXLegacyTarget "build-generated-java" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                89D7CC4D0CDE4C0400472EA2 /* Debug */,
-                                89D7CC4E0CDE4C0400472EA2 /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                89D7CC630CDE762000472EA2 /* Build configuration list for PBXLegacyTarget "build-additions-java" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                89D7CC610CDE75EC00472EA2 /* Debug */,
-                                89D7CC620CDE75EC00472EA2 /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                89D7CC7A0CDE76F500472EA2 /* Build configuration list for PBXLegacyTarget "assemble-product-java" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                89D7CC730CDE767500472EA2 /* Debug */,
-                                89D7CC740CDE767500472EA2 /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                89D7CCB50CDF9A2600472EA2 /* Build configuration list for PBXNativeTarget "build-additions-native" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                89D7CCB60CDF9A2600472EA2 /* Debug */,
-                                89D7CCB70CDF9A2600472EA2 /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                89EBD5930C95F44E000F04A0 /* Build configuration list for PBXAggregateTarget "B&I" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                89EBD58D0C95F43D000F04A0 /* Debug */,
-                                89EBD58E0C95F43D000F04A0 /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                C5F3B1480E39917500B771AE /* Build configuration list for PBXNativeTarget "build-test-native" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                C5F3B1460E39910500B771AE /* Debug */,
-                                C5F3B1470E39910500B771AE /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                C5F3B15B0E3992AC00B771AE /* Build configuration list for PBXLegacyTarget "build-test-java" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                C5F3B1540E39927A00B771AE /* Debug */,
-                                C5F3B1550E39927A00B771AE /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-                EB9FD8690AEECD13008E157E /* Build configuration list for PBXLegacyTarget "build-core-java" */ = {
-                        isa = XCConfigurationList;
-                        buildConfigurations = (
-                                EB9FD86A0AEECD13008E157E /* Debug */,
-                                EB9FD86B0AEECD13008E157E /* Release */,
-                        );
-                        defaultConfigurationIsVisible = 0;
-                        defaultConfigurationName = Release;
-                };
-/* End XCConfigurationList section */
-        };
-        rootObject = 00E6828EFEC88D1A11DB9C8B /* Project object */;
-}
diff --git a/jdk/src/macosx/native/jobjc/README.txt b/jdk/src/macosx/native/jobjc/README.txt
deleted file mode 100644
index 3bde08a77c4..00000000000
--- a/jdk/src/macosx/native/jobjc/README.txt
+++ /dev/null
@@ -1,132 +0,0 @@
-#title JObjC
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-JObjC core provides a pure Java interface for calling C functions and
-sending ObjC messages. Given some information, it can marshal types
-automatically.
-
-It also parses BridgeSupport to generate Java wrappers around
-Framework bundles. These wrappers rely on the core to provide access
-to the C constants, enums, structs, functions, ObjC classes, etc of a
-framework.
-
-* How to build it
-
-Your best option is `ant all`. There's an Xcode "B&I" target that
-works for buildit.
-
-You'll need a recent JavaNativeFoundation, and perhaps some other
-things. Everything is usually there on SnowLeopard (or Leopard after
-the common ~javabuild/bin/update runs).
-
-The build process is quite involved. Xcode takes care of the native
-parts, ant takes care of the Java parts, and there's an unholy mix of
-external targets and hidden dependencies that keep Xcode and ant (and
-buildit on top of that) from stepping on each other. So a warning: the
-ant and Xcode targets don't have proper dependencies set up because of
-this. They have some dependencies configured, but not the entire
-chain. This is because of the jumping back and forth between
-externals. If you run the aggregate targets (Xcode B&I, ant all, ant
-test, ant bench), everything's is good. But if you manually invoke
-individual targets, chances are you'll miss something. Let's go over
-it all step by step:
-
-** ant gen-pcoder
-
-The PrimitiveCoder subclasses have a lot of boiler plate which
-simplifies the generated MixedPrimitiveCoder classes. So instead of
-maintaining it, I maintain a tiny Haskell script that spits out the
-Java code. This ant target runs that script if Haskell is available on
-the system. If it isn't available, this will silently fail. That's
-okay, because chances are the PrimitiveCoder.java that you got from
-svn is current and does not need to be updated.
-
-** ant build-core / Xcode build-core-java
-
-Build core simply builds the JObjC core java classes, and also
-generates headers for the JNI for Xcode.
-
-** ant build-core-native / Xcode build-core-native
-
-Xcode builds the native core, using the headers from the Java core. It
-generates libJObjC.dylib.
-
-** ant build-generator / Xcode build-generator-java
-
-ant builds the generator.
-
-** ant run-generator / Xcode run-generator
-
-ant runs the generator, using the core Java and native classes.
-
-What is rungen? And what's run-generator-old? run-generator-old is the
-preferred way to run the generator from ant, but there's a strange bug
-when running from buildit that causes run-generator-old to
-freeze. Pratik was helping me debug it, inspecting the stack and
-snooping dtrace probes, but we never found the reason for the
-block. So I figured that maybe if I just add a layer of indirection
-maybe it'll work around that. And it did. Sad but true.
-
-** ant build-generated / Xcode build-generated-java
-
-Build the generator output.
-
-** ant build-additions / Xcode build-additions-java
-
-Builds java additions.
-
-** ant build-additions-native / Xcode build-additions-native
-
-This builds a new version of libJObjC.dylib. It will rebuild
-everything from the core, and include everything from additions.
-
-** ant assemble-product / Xcode assemble-product-java
-
-Create a jar, copy products to destination, etc.
-
-* How to test it
-
-The test cases also contain a Java component and a native component,
-and are built similarly to the above. The benchmarks are built
-together with the tests. So "ant build-test" and "ant
-build-test-native" will build both the benchmarks and the test. "ant
-test" will run the test. "ant bench" will run benchmarks. If you only
-want to run a specific benchmark, you can pass a regexp in the
-environment variable BENCH_MATCH.
-
-<src>
-ant test
-ant bench
-BENCH_MATCH=Foo ant bench
-</src>
-
-Test and bench reports will end up in
-build/JObjC.build/Debug/test-reports/
-
-* How to use it
-
-Include the jar in your classpath and set your java.library.path to
-the directory that contains the dylib. Same thing for app bundles.
diff --git a/jdk/src/macosx/native/jobjc/TODOS b/jdk/src/macosx/native/jobjc/TODOS
deleted file mode 100644
index 16abea13760..00000000000
--- a/jdk/src/macosx/native/jobjc/TODOS
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-egrep "(TODO|FIXME|XXX|HACK)" -r src
diff --git a/jdk/src/macosx/native/jobjc/bridgesupport.gmk b/jdk/src/macosx/native/jobjc/bridgesupport.gmk
deleted file mode 100644
index 1de9bd1d5c5..00000000000
--- a/jdk/src/macosx/native/jobjc/bridgesupport.gmk
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# makefile for generating a stable set of bridgesupport files that change timestamp
-# only when the bridgesupport data actually changes
-
-FRAMEWORKS_DIR = /System/Library/Frameworks
-GBM = /usr/bin/gen_bridge_metadata
-GEN_HEADERS = $(addsuffix .headers,$(FRAMEWORKS))
-GEN_BRIDGESUPPORT = $(addsuffix .bridgesupport,$(FRAMEWORKS))
-
-%.bridgesupport : %.headers $(FRAMEWORKS_DIR)/%.framework/Headers/*.h
-	@echo "generating bridge support for" $<
-	if [ -f $(FRAMEWORKS_DIR)/$(<:.headers=.framework)/Resources/BridgeSupport/$(<:.headers=Full.bridgesupport) ] ; \
-	  then cp $(FRAMEWORKS_DIR)/$(<:.headers=.framework)/Resources/BridgeSupport/$(<:.headers=Full.bridgesupport) $@ ; \
-	  else $(GBM) -F complete --framework $(<:.headers=.framework) -o $@ ; \
-	fi
-	if cmp -s $@ $(STABLE_GEN_DIR)/$(@:.bridgesupport=Full.bridgesupport) ; \
-	  then : ; \
-	  else cp $@ $(STABLE_GEN_DIR)/$(@:.bridgesupport=Full.bridgesupport) ; \
-	fi
-
-%.headers : $(FRAMEWORKS_DIR)/%.framework/Headers
-	@echo linking $<
-	ln -s $< $@
-
-$(STABLE_GEN_DIR):
-	mkdir -p $(STABLE_GEN_DIR)
-
-$(GEN_BRIDGESUPPORT): $(GEN_HEADERS) $(STABLE_GEN_DIR)
-
-all: $(GEN_BRIDGESUPPORT)
diff --git a/jdk/src/macosx/native/jobjc/build.xml b/jdk/src/macosx/native/jobjc/build.xml
deleted file mode 100644
index 9f638840fcf..00000000000
--- a/jdk/src/macosx/native/jobjc/build.xml
+++ /dev/null
@@ -1,520 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
--->
-<project name="JObjC" default="install" basedir=".">
-  <property environment="env"/>
-  <echoproperties/>
-
-  <target name="installhdrs">
-    <echo>Nothing to do for install-headers build phase</echo>
-  </target>
-
-  <target name="installsrc">
-    <echo>Nothing to do for install-source build phase</echo>
-  </target>
-
-  <property name="redirection-target-defined" value="${env.PRODUCT_NAME}"/>
-
-  <target name="install" description="Redirects to the target specified in $PRODUCT_NAME">
-    <fail unless="env.PRODUCT_NAME" status="-1">
-      This Ant build file depends on the native Xcode project to invoke
-      targets by defining $PRODUCT_NAME to specify the target.
-    </fail>
-
-    <echo>--- Redirecting to target "${env.PRODUCT_NAME}"</echo>
-    <antcall target="${env.PRODUCT_NAME}"/>
-  </target>
-
-  <property name="compile.debug" value="true"/>
-
-  <!-- building from the command line / xcode b&i -->
-  <condition property="src" value="." else="${env.SRCROOT}">
-    <not><isset property="env.SRCROOT"/></not>
-  </condition>
-
-  <condition property="cfg" value="Debug" else="${env.CONFIGURATION}">
-    <not><isset property="env.CONFIGURATION"/></not>
-  </condition>
-
-  <condition property="obj" value="build/JObjC.build/${cfg}" else="${env.OBJROOT}">
-    <not><isset property="env.OBJROOT"/></not>
-  </condition>
-
-  <condition property="dst" value="build/${cfg}" else="${env.DSTROOT}/${cfg}">
-    <not><isset property="env.DSTROOT"/></not>
-  </condition>
-
-  <condition property="ARCHS" value="ppc i386 x86_64" else="${env.RC_ARCHS}">
-    <not><isset property="env.RC_ARCHS"/></not>
-  </condition>
-
-  <!-- -/- -->
-
-  <property name="bin" location="${obj}/bin"/>
-  <property name="gendoc" location="${obj}/doc"/>
-
-  <condition property="nativelib.dir" value="${dst}">
-    <not><isset property="env.CONFIGURATION_BUILD_DIR"/></not>
-  </condition>
-  <condition property="nativelib.dir" value="${env.CONFIGURATION_BUILD_DIR}">
-    <isset property="env.CONFIGURATION_BUILD_DIR"/>
-  </condition>
-  <property name="nativelib.file" location="${nativelib.dir}/libJObjC.dylib" />
-
-  <property name="jniheaders" location="${obj}/src/jni_headers"/>
-
-  <property name="core.src" location="${src}/src/core/java"/>
-  <property name="core.bin" location="${bin}/core"/>
-  <property name="core.jniheaders" location="${jniheaders}/core"/>
-  <property name="core.nativelib.dir" location="${nativelib.dir}"/>
-
-  <property name="generator.src" location="${src}/src/generator/java"/>
-  <property name="generator.bin" location="${bin}/generator"/>
-
-  <property name="generated.src" location="${obj}/src/jobjc"/>
-  <property name="generated.bin" location="${bin}/generated"/>
-
-  <property name="additions.src" location="${src}/src/runtime-additions"/>
-  <property name="additions.bin" location="${bin}/additions"/>
-  <property name="additions.jniheaders" location="${jniheaders}/additions"/>
-  <property name="additions.nativelib.dir" location="${nativelib.dir}"/>
-
-  <property name="test.src" location="${src}/src/tests/java"/>
-  <property name="test.bin" location="${bin}/test"/>
-  <property name="test.jniheaders" location="${jniheaders}/test"/>
-  <property name="test.reports" location="${obj}/test-reports"/>
-
-  <condition property="product.target_path"
-             value="/System/Library/Java/Extensions"
-             else="${env.INSTALL_PATH}">
-    <not><isset property="env.INSTALL_PATH"/></not>
-  </condition>
-
-  <echo message="(Settings :src '${src}' :cfg '${cfg}' :obj '${obj}' :dst '${dst}')"/>
-
-  <path id="test.lib.path.id">
-    <fileset dir="/usr/share/java">
-      <include name="**/*.jar"/>
-    </fileset>
-  </path>
-
-  <property name="product.jarfile.dir" location="${obj}"/>
-  <property name="product.jarfile.name" value="JObjC.jar"/>
-  <property name="product.jarfile" location="${product.jarfile.dir}/${product.jarfile.name}"/>
-
-  <target name="gen-pcoder" description="Generate PrimitiveCoder.java">
-    <exec executable="ruby" failonerror="true">
-      <arg value="${src}/run-and-write-if-okay"/>
-      <arg value="${src}/src/core/PrimitiveCoder.hs"/>
-      <arg value="${src}/src/core/java/com/apple/jobjc/PrimitiveCoder.java"/>
-    </exec>
-  </target>
-
-  <target name="build-core" depends="gen-pcoder" description="Compile the core runtime classes">
-    <mkdir dir="${core.bin}" />
-    <!-- Compile PrimitiveCoder first to work around javac bug. -->
-    <javac srcdir="${core.src}" destdir="${core.bin}" source="1.5" target="1.5" debug="${compile.debug}"
-           includes="**/PrimitiveCoder.java"
-           includeantruntime="false">
-      <classpath>
-        <path location="${obj}/../langtools/dist/lib/classes.jar"/>
-      </classpath>
-    </javac>
-    <javac srcdir="${core.src}" destdir="${core.bin}" source="1.5" target="1.5" debug="${compile.debug}" includeantruntime="false">
-      <classpath>
-        <path location="${obj}/../langtools/dist/lib/classes.jar"/>
-      </classpath>
-    </javac>
-
-    <exec executable="/usr/bin/perl" outputproperty="core.classes" failonerror="true">
-      <arg value="${src}/extract_classes.pl"/>
-      <arg path="${core.bin}"/>
-    </exec>
-
-    <mkdir dir="${core.jniheaders}" />
-    <javah destdir="${core.jniheaders}" class="${core.classes}">
-      <classpath path="${core.bin}"/>
-    </javah>
-  </target>
-
-  <target name="build-core-native" depends="build-core">
-    <exec executable="xcodebuild" failonerror="true">
-      <env key="CC" value=""/>
-      <env key="CXX" value=""/>
-      <arg value="-configuration"/>
-      <arg value="${cfg}"/>
-      <arg value="-target"/>
-      <arg value="build-core-native"/>
-      <arg value="SRCROOT=${src}"/>
-      <arg value="OBJROOT=${obj}"/>
-      <arg value="DSTROOT=${dst}"/>
-      <arg value="TARGET_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="PROJECT_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="BUILD_DIR=${env.DSTROOT}"/>
-    </exec>
-  </target>
-
-  <!-- macosx jdk 7 puts jobjc core classes on the bootclasspath by default -->
-  <target name="build-generator" description="Compile and assemble the generator">
-    <mkdir dir="${generator.bin}"/>
-    <javac srcdir="${generator.src}" destdir="${generator.bin}" source="1.5" target="1.5" debug="${compile.debug}" includeantruntime="false">
-      <compilerarg value="-version"/>
-      <compilerarg value="-Xbootclasspath/p:${core.bin}"/>
-    </javac>
-  </target>
-
-  <!-- Use this indirection hack to work around buildit lockup when
-  running the generator. -->
-  <target name="run-generator" depends="build-generator" description="Invoke the assembled generator">
-    <mkdir dir="${generated.src}"/>
-    <exec executable="ruby" failonerror="true">
-      <arg value="${src}/rungen"/>
-      <arg value="install"/>
-      <arg value="${product.jarfile.name}"/>
-      <arg value="${nativelib.dir}"/>
-      <arg value="${obj}"/>
-      <arg value="${ARCHS}"/>
-      <arg value="${env.STABLE_GEN_DIR}"/>
-    </exec>
-  </target>
-
-  <target name="run-generator-old" depends="build-generator" description="Invoke the assembled generator">
-    <mkdir dir="${generated.src}"/>
-    <java classname="com.apple.internal.jobjc.generator.Generator" fork="true" failonerror="true">
-      <jvmarg value="-Xms128m" />
-      <jvmarg value="-Xmx512m" />
-      <assertions><enable/></assertions>
-      <classpath>
-        <path location="${core.bin}"/>
-        <path location="${generator.bin}"/>
-      </classpath>
-      <sysproperty key="java.library.path" value="${core.nativelib.dir}"/>
-      <arg value="dst=${generated.src}"/>
-    </java>
-  </target>
-
-  <target name="build-generated" description="Build and assemble the JObjC core and all generated frameworks">
-    <mkdir dir="${generated.bin}"/>
-    <javac srcdir="${generated.src}" destdir="${generated.bin}" source="1.5" target="1.5" fork="yes" memoryMaximumSize="512m" debug="${compile.debug}" includeantruntime="false">
-      <classpath>
-        <path location="${core.bin}"/>
-      </classpath>
-      <compilerarg value="-version"/>
-    </javac>
-  </target>
-
-  <target name="build-additions" depends="build-generated">
-    <mkdir dir="${additions.bin}"/>
-    <javac srcdir="${additions.src}" destdir="${additions.bin}" source="1.5" target="1.5" debug="${compile.debug}" includeantruntime="false">
-      <classpath>
-        <path location="${core.bin}"/>
-        <path location="${generated.bin}"/>
-      </classpath>
-      <compilerarg value="-version"/>
-    </javac>
-
-    <exec executable="/usr/bin/perl" outputproperty="additions.classes" failonerror="true">
-      <arg value="${src}/extract_classes.pl"/>
-      <arg path="${additions.bin}"/>
-    </exec>
-
-    <mkdir dir="${additions.jniheaders}"/>
-    <javah destdir="${additions.jniheaders}" class="${additions.classes}">
-      <classpath>
-        <path location="${core.bin}"/>
-        <path location="${generated.bin}"/>
-        <path location="${additions.bin}"/>
-      </classpath>
-    </javah>
-  </target>
-
-  <target name="build-additions-native">
-    <exec executable="xcodebuild" failonerror="true">
-      <env key="CC" value=""/>
-      <env key="CXX" value=""/>
-      <arg value="-configuration"/>
-      <arg value="${cfg}"/>
-      <arg value="-target"/>
-      <arg value="build-additions-native"/>
-      <arg value="SRCROOT=${src}"/>
-      <arg value="OBJROOT=${obj}"/>
-      <arg value="DSTROOT=${dst}"/>
-      <arg value="TARGET_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="PROJECT_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="BUILD_DIR=${env.DSTROOT}"/>
-    </exec>
-  </target>
-
-  <target name="assemble-product">
-    <mkdir dir="${product.jarfile.dir}"/>
-    <jar jarfile="${product.jarfile}" level="9" index="true">
-      <fileset dir="${core.bin}"/>
-      <fileset dir="${generated.bin}"/>
-      <fileset dir="${additions.bin}"/>
-    </jar>
-
-    <mkdir dir="${dst}/${product.target_path}"/>
-    <copy file="${product.jarfile}" toDir="${dst}/${product.target_path}" failonerror="true" verbose="true"/>
-    <copy file="${nativelib.file}" toDir="${dst}/${product.target_path}" failonerror="true" verbose="true"/>
-  </target>
-
-  <target name="doc-core">
-    <mkdir dir="${gendoc}"/>
-    <javadoc destdir="${gendoc}" access="protected">
-      <fileset dir="${src}/src" includes="**/*.java"/>
-    </javadoc>
-  </target>
-
-  <target name="build-test" description="compile unit tests">
-    <mkdir dir="${test.bin}"/>
-    <javac srcdir="${test.src}" destdir="${test.bin}" debug="false" includeantruntime="false">
-      <classpath>
-        <pathelement location="${core.bin}"/>
-        <pathelement location="${generator.bin}"/>
-        <pathelement location="${generated.bin}"/>
-        <pathelement location="${additions.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-      <compilerarg value="-version"/>
-    </javac>
-
-    <exec executable="/usr/bin/perl" outputproperty="test.classes" failonerror="true">
-      <arg value="${src}/extract_classes.pl"/>
-      <arg path="${test.bin}"/>
-    </exec>
-
-    <mkdir dir="${test.jniheaders}"/>
-    <javah destdir="${test.jniheaders}" class="${test.classes}">
-      <classpath>
-        <path location="${core.bin}"/>
-        <path location="${generated.bin}"/>
-        <path location="${additions.bin}"/>
-        <path location="${test.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-    </javah>
-  </target>
-
-  <target name="build-test-installed" description="compile unit tests">
-    <mkdir dir="${test.bin}"/>
-    <javac srcdir="${test.src}" destdir="${test.bin}" debug="false" includeantruntime="false">
-      <compilerarg value="-verbose"/>
-      <classpath>
-        <pathelement location="${generator.bin}"/>
-        <pathelement location="${generated.bin}"/>
-        <pathelement location="${additions.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-      <compilerarg value="-version"/>
-    </javac>
-
-    <exec executable="/usr/bin/perl" outputproperty="test.classes" failonerror="true">
-      <arg value="${src}/extract_classes.pl"/>
-      <arg path="${test.bin}"/>
-    </exec>
-
-    <mkdir dir="${test.jniheaders}"/>
-    <javah destdir="${test.jniheaders}" class="${test.classes}">
-      <classpath>
-        <path location="${generated.bin}"/>
-        <path location="${additions.bin}"/>
-        <path location="${test.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-    </javah>
-  </target>
-
-  <target name="build-test-native" depends="build-test">
-    <exec executable="xcodebuild" failonerror="true">
-      <env key="CC" value=""/>
-      <env key="CXX" value=""/>
-      <arg value="-configuration"/>
-      <arg value="${cfg}"/>
-      <arg value="-target"/>
-      <arg value="build-test-native"/>
-      <arg value="SRCROOT=${src}"/>
-      <arg value="OBJROOT=${obj}"/>
-      <arg value="DSTROOT=${dst}"/>
-      <arg value="TARGET_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="PROJECT_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="BUILD_DIR=${env.DSTROOT}"/>
-    </exec>
-  </target>
-
-  <target name="build-test-native-installed" depends="build-test-installed">
-    <exec executable="xcodebuild" failonerror="true">
-      <env key="CC" value=""/>
-      <env key="CXX" value=""/>
-      <arg value="-configuration"/>
-      <arg value="${cfg}"/>
-      <arg value="-target"/>
-      <arg value="build-test-native"/>
-      <arg value="SRCROOT=${src}"/>
-      <arg value="OBJROOT=${obj}"/>
-      <arg value="DSTROOT=${dst}"/>
-      <arg value="TARGET_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="PROJECT_TEMP_DIR=${env.DSTROOT}"/>
-      <arg value="BUILD_DIR=${env.DSTROOT}"/>
-    </exec>
-  </target>
-
-  <target name="test" depends="build-test-native" description="run unit tests">
-    <mkdir dir="${test.reports}"/>
-    <junit fork="yes" printsummary="yes">
-      <assertions>
-        <enable/>
-      </assertions>
-      <jvmarg value="-server" />
-
-      <sysproperty key="java.library.path" value="${nativelib.dir}" />
-      <classpath>
-        <pathelement location="${core.bin}"/>
-        <pathelement location="${generator.bin}"/>
-        <pathelement location="${generated.bin}"/>
-        <pathelement location="${additions.bin}"/>
-        <pathelement location="${test.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-
-      <formatter type="plain"/>
-
-      <batchtest fork="yes" todir="${test.reports}">
-        <fileset dir="${test.src}">
-          <include name="**/*Test.java"/>
-          <exclude name="**/AllTests.java"/>
-        </fileset>
-      </batchtest>
-    </junit>
-  </target>
-
-  <target name="test-installed" depends="build-test-native-installed" description="run unit tests">
-    <mkdir dir="${test.reports}"/>
-    <junit fork="yes" printsummary="yes">
-      <assertions>
-        <enable/>
-      </assertions>
-      <jvmarg value="-server" />
-
-      <sysproperty key="java.library.path" value="${nativelib.dir}" />
-      <classpath>
-        <pathelement location="${generator.bin}"/>
-        <pathelement location="${generated.bin}"/>
-        <pathelement location="${additions.bin}"/>
-        <pathelement location="${test.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-
-      <formatter type="plain"/>
-
-      <batchtest fork="yes" todir="${test.reports}">
-        <fileset dir="${test.src}">
-          <include name="**/*Test.java"/>
-          <exclude name="**/AllTests.java"/>
-        </fileset>
-      </batchtest>
-    </junit>
-  </target>
-
-
-  <condition property="bench_match" value="*" else="${env.BENCH_MATCH}">
-    <not><isset property="env.BENCH_MATCH"/></not>
-  </condition>
-
-  <target name="bench" depends="build-test-native" description="run benchmarks">
-    <mkdir dir="${test.reports}"/>
-    <junit fork="yes" printsummary="yes">
-      <sysproperty key="java.library.path" value="${nativelib.dir}" />
-      <classpath>
-        <pathelement location="${core.bin}"/>
-        <pathelement location="${generator.bin}"/>
-        <pathelement location="${generated.bin}"/>
-        <pathelement location="${additions.bin}"/>
-        <pathelement location="${test.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-
-      <jvmarg value="-Xms256m" />
-      <jvmarg value="-Xmx1024m" />
-      <jvmarg value="-server" />
-
-      <formatter type="plain"/>
-
-      <batchtest fork="yes" todir="${test.reports}">
-        <fileset dir="${test.src}">
-          <include name="**/Bench*${bench_match}*.java"/>
-        </fileset>
-      </batchtest>
-    </junit>
-  </target>
-
-  <target name="bench-installed" depends="build-test-native-installed" description="run benchmarks">
-    <mkdir dir="${test.reports}"/>
-    <junit fork="yes" printsummary="yes">
-      <sysproperty key="java.library.path" value="${nativelib.dir}" />
-      <classpath>
-        <pathelement location="${generator.bin}"/>
-        <pathelement location="${generated.bin}"/>
-        <pathelement location="${additions.bin}"/>
-        <pathelement location="${test.bin}"/>
-      </classpath>
-      <classpath refid="test.lib.path.id"/>
-
-      <jvmarg value="-Xms256m" />
-      <jvmarg value="-Xmx1024m" />
-      <jvmarg value="-server" />
-
-      <formatter type="plain"/>
-
-      <batchtest fork="yes" todir="${test.reports}">
-        <fileset dir="${test.src}">
-          <include name="**/Bench*${bench_match}*.java"/>
-        </fileset>
-      </batchtest>
-    </junit>
-  </target>
-
-  <target name="clean">
-    <delete dir="build"/>
-    <delete dir="${obj}"/>
-    <delete dir="${dst}"/>
-    <delete dir="${gendoc}"/>
-    <delete dir="${test.reports}"/>
-  </target>
-
-
-  <target name="clean-all" depends="clean,build-core,build-core-native,build-generator,run-generator,build-generated,build-additions,build-additions-native,assemble-product">
-  </target>
-  <target name="all" depends="build-core,build-core-native,build-generator,run-generator,build-generated,build-additions,build-additions-native,assemble-product">
-  </target>
-  <target name="all-test" depends="build-core,build-core-native,build-generator,run-generator,build-generated,build-additions,build-additions-native,assemble-product,test-installed">
-  </target>
-  <target name="clean-all-test" depends="clean,build-core,build-core-native,build-generator,run-generator,build-generated,build-additions,build-additions-native,assemble-product,test-installed">
-  </target>
-  <target name="all-but-gen" depends="clean,build-core,build-core-native,build-generator,build-generated,build-additions,build-additions-native,assemble-product">
-  </target>
-</project>
diff --git a/jdk/src/macosx/native/jobjc/extract_classes.pl b/jdk/src/macosx/native/jobjc/extract_classes.pl
deleted file mode 100644
index b0950db4699..00000000000
--- a/jdk/src/macosx/native/jobjc/extract_classes.pl
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-##
-
-$file_dir = $ARGV[0];
-@file_list = qx("/usr/bin/find" "$file_dir");
-
-foreach $file (@file_list) {
-        if ($file =~ s/\.class//) {
-            if ($file !~ s/\$[0-9]//) {
-                $file =~ s/$file_dir\///g;
-                $file =~ s/\//\./g;
-                chomp($file);
-                print "$file,";
-            }
-        }
-}
diff --git a/jdk/src/macosx/native/jobjc/run-and-write-if-okay b/jdk/src/macosx/native/jobjc/run-and-write-if-okay
deleted file mode 100644
index 8d0bb690276..00000000000
--- a/jdk/src/macosx/native/jobjc/run-and-write-if-okay
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-
-if ARGV.length < 2
-  puts <<EOF
-Expects two args: EXEC and OUTPATH. First, it runs and prints
-`EXEC 2>&1`. If it returns successfully, it writes the output to OUTPATH.
-This script will return successfully unless writing the output fails.
-EOF
-  exit
-end
-
-EXECPATH = ARGV[0]
-OUTPATH  = ARGV[1]
-
-output = `#{EXECPATH}`
-puts output
-
-if $?.to_i == 0
-  puts "Writing output of #{EXECPATH} to #{OUTPATH}"
-  File.open(OUTPATH, 'w') {|f| f.write(output) }
-else
-  puts "#{EXECPATH} failed to run trial. Ignoring."
-end
diff --git a/jdk/src/macosx/native/jobjc/rungen b/jdk/src/macosx/native/jobjc/rungen
deleted file mode 100644
index 17aeabea15d..00000000000
--- a/jdk/src/macosx/native/jobjc/rungen
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-
-xcodeAction = ARGV[0]
-
-exit unless xcodeAction == "install"
-
-JOBJC_JAR = ARGV[1]
-LIBPATH = ARGV[2]
-OBJROOT = ARGV[3]
-ARCHS   = ARGV[4]
-STABLE_GEN_DIR = ARGV[5]
-
-ourJavaHome = ENV['JAVA_HOME']
-ourJavaVersion = `java -fullversion 2>&1`
-$stderr.puts "ENV['JAVA_HOME'] = #{ourJavaHome}"
-$stderr.puts "java -fullversion = #{ourJavaVersion}"
-
-$stderr.puts "jobjc_jar = #{JOBJC_JAR}"
-$stderr.puts "libpath = #{LIBPATH}"
-$stderr.puts "objroot = #{OBJROOT}"
-$stderr.puts "ARCHS   = #{ARCHS}"
-$stderr.puts "STABLE_GEN_DIR = #{STABLE_GEN_DIR}"
-
-jarch = if ARCHS =~ /x86_64/ then "-d64" else "-d32" end
-
-# compute the boot class path, but remove the JObjC jar file that may have been installed in the boot jdk
-
-bootclasspathcmd = "java -classpath #{OBJROOT}/bin/core:#{OBJROOT}/bin/generator com.apple.internal.jobjc.generator.BootClassPathMinus #{JOBJC_JAR}"
-$stderr.puts bootclasspathcmd
-bootclasspath = `#{bootclasspathcmd}`
-
-$stderr.puts "bootclasspath is: "
-$stderr.puts bootclasspath
-
-# we run the generator with our newly created JObjC.  The installed version (if available) has been removed from
-# the boot class path, so we are building with everything newly created.
-cmd = "java #{jarch} -Xms128m -Xmx512m -Djava.library.path=#{LIBPATH} -Xbootclasspath:#{bootclasspath.chomp} -classpath #{OBJROOT}/bin/core:#{OBJROOT}/bin/generator -ea com.apple.internal.jobjc.generator.Generator dst=#{OBJROOT}/src/jobjc frameworks=#{STABLE_GEN_DIR}"
-
-$stderr.puts cmd
-puts `#{cmd} 2>&1`
-
-raise $?.to_i if $?.to_i != 0
diff --git a/jdk/src/macosx/native/jobjc/runjava b/jdk/src/macosx/native/jobjc/runjava
deleted file mode 100644
index a6e91547e7d..00000000000
--- a/jdk/src/macosx/native/jobjc/runjava
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2011, 2012, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-java -ea -classpath "lib/junit-4.4.jar:build/JObjC.build/Debug/bin/core:build/JObjC.build/Debug/bin/generator:build/JObjC.build/Debug/bin/additions:build/JObjC.build/Debug/bin/test:build/JObjC.build/Debug/bin/generated" -Djava.library.path=build/Debug $@
diff --git a/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs b/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
deleted file mode 100644
index b9b0070fcb4..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
+++ /dev/null
@@ -1,275 +0,0 @@
-#!/usr/bin/env runhaskell
-
-{-
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
--}
-{-
-The simplest way to get Haskell is through MacPorts: sudo port install ghc
-
-Otherwise, see http://www.haskell.org/ghc/
--}
-
-import Data.List
-import Data.Maybe
-import Data.Char
-
-data Width = W32 | W64
-             deriving (Show, Eq, Bounded, Enum)
-
-data NType = NBOOL | Nschar | Nuchar | Nsshort | Nushort | Nsint | Nuint
-           | Nslong | Nulong | Nslonglong | Nulonglong | Nfloat | Ndouble
-             deriving (Show, Eq, Bounded, Enum)
-
-data JPrim = Jboolean | Jbyte | Jchar | Jshort | Jint | Jlong | Jfloat | Jdouble
-             deriving (Show, Eq, Bounded, Enum)
-
-data JClass = JBoolean | JByte | JCharacter | JShort | JInteger | JLong
-            | JFloat | JDouble
-              deriving (Show, Eq, Bounded, Enum)
-
-data FFIType = SINT8 | UINT8 | SINT16 | UINT16 | SINT32 | UINT32
-             | SINT64 | UINT64 | FLOAT | DOUBLE
-             deriving (Show, Eq, Bounded, Enum)
-
-widths = [minBound..maxBound] :: [Width]
-ntypes = [minBound..maxBound] :: [NType]
-jprims = [minBound..maxBound] :: [JPrim]
-jclasses = [minBound..maxBound] :: [JClass]
-ffitypes = [minBound..maxBound] :: [FFIType]
-
--- What's the FFIType for a given Width and NType? For example: W32 NBOOL -> SINT8
-ffitype :: Width -> NType -> FFIType
-ffitype _ NBOOL   = SINT8
-ffitype _ Nschar  = SINT8
-ffitype _ Nuchar  = UINT8
-ffitype _ Nsshort = SINT16
-ffitype _ Nushort = UINT16
-ffitype _ Nsint   = SINT32
-ffitype _ Nuint   = UINT32
-ffitype W32 Nslong = SINT32
-ffitype W64 Nslong = SINT64
-ffitype W32 Nulong = UINT32
-ffitype W64 Nulong = UINT64
-ffitype _ Nslonglong = SINT64
-ffitype _ Nulonglong = UINT64
-ffitype _ Nfloat  = FLOAT
-ffitype _ Ndouble = DOUBLE
-
-sizeof :: FFIType -> Int
-sizeof SINT8  = 1
-sizeof UINT8  = 1
-sizeof SINT16 = 2
-sizeof UINT16 = 2
-sizeof SINT32 = 4
-sizeof UINT32 = 4
-sizeof SINT64 = 8
-sizeof UINT64 = 8
-sizeof FLOAT  = 4
-sizeof DOUBLE = 8
-
--- What's the Obj-C encoding for a given NType? For example: unsigned char -> 'C'
-encoding nt = fromJust $ lookup nt $
-              [(NBOOL, 'B'), (Nschar, 'c'), (Nuchar, 'C'), (Nsshort, 's'),
-               (Nushort, 'S'), (Nsint, 'i'), (Nuint, 'I'), (Nslong, 'l'),
-               (Nulong, 'L'), (Nslonglong, 'q'), (Nulonglong, 'Q'),
-               (Nfloat, 'f'), (Ndouble, 'd')]
-
--- What's the JPrim for a given NType? For example: native signed long long -> java long
-ntype2jprim nt = fromJust $ lookup nt $
-                 [(NBOOL, Jboolean), (Nschar, Jbyte), (Nuchar, Jbyte),
-                  (Nsshort, Jshort), (Nushort, Jshort), (Nsint, Jint), (Nuint, Jint),
-                  (Nslong, Jlong), (Nulong, Jlong),
-                  (Nslonglong, Jlong), (Nulonglong, Jlong),
-                  (Nfloat, Jfloat), (Ndouble, Jdouble)]
-
--- What's the JClass for a given JPrim? For example: int -> Integer
-jprim2jclass jp = fromJust $ lookup jp $
-                  [(Jboolean, JBoolean), (Jbyte, JByte), (Jchar, JCharacter),
-                   (Jshort, JShort), (Jint, JInteger), (Jlong, JLong),
-                   (Jfloat, JFloat), (Jdouble, JDouble)]
-
--- Convert a type to something suitable for Java code. For example: Jboolean -> boolean
-ntype2js nt = tail $ show nt
-jclass2js t = tail $ show t
-jprim2js p = tail $ show p
-ffitype2js f = "FFI_" ++ (show f)
-
--- Capitalize the first letter of a String
-capitalize [] = []
-capitalize s = [toUpper $ head s] ++ tail s
-
--- Given an Width and NType, return the Java code for reading said NType from memory.
-popAddr :: Width -> NType -> String
-popAddr _ NBOOL   = "rt.unsafe.getByte(addr) != 0"
-popAddr _ Nschar  = "rt.unsafe.getByte(addr)"
-popAddr _ Nuchar  = "rt.unsafe.getByte(addr)"
-popAddr W32 Nslong = "rt.unsafe.getInt(addr)"
-popAddr W32 Nulong = "rt.unsafe.getInt(addr)"
-popAddr _ ntype = "rt.unsafe.get" ++ (capitalize.jprim2js.ntype2jprim $ ntype) ++ "(addr)"
-
--- Given an Width and NType, return the Java code for writing said NType to memory.
-pushAddr :: Width -> NType -> String
-pushAddr _ NBOOL   = "rt.unsafe.putByte(addr, (byte) (x ? 1 : 0));"
-pushAddr _ Nschar  = "rt.unsafe.putByte(addr, x);"
-pushAddr _ Nuchar  = "rt.unsafe.putByte(addr, x);"
-pushAddr W32 Nslong = "rt.unsafe.putInt(addr, (int) x);"
-pushAddr W32 Nulong = "rt.unsafe.putInt(addr, (int) x);"
-pushAddr _ ntype = "rt.unsafe.put" ++ (capitalize jprimS) ++ "(addr, (" ++ jprimS ++ ") x);"
-    where jprimS = jprim2js.ntype2jprim $ ntype
-
--- Helpers for generating Java ternarnies and conditionals.
-archExpr x32 x64 = if x32 /= x64 then retdiff else x32
-    where retdiff = "(JObjCRuntime.IS64 ? (" ++ x64 ++ ") : (" ++ x32 ++ "))"
-
-archStmt x32 x64 = if x32 /= x64 then retdiff else x32
-    where retdiff = "if(JObjCRuntime.IS64){ " ++ x64 ++ " }else{ " ++ x32 ++ " }"
-
--- Get a Java expression for the correct FFIType at runtime. For example: (JObjCRuntime.IS64 ? FFI_SINT64 : FFI_SINT32)
-ffitypeVal nt = archExpr (ffitype2js $ ffitype W32 nt)
-                         (ffitype2js $ ffitype W64 nt)
-
--- Similar to ffiTypeVal. Get the correct pop expression and push statement.
-popAddrVal nt = archExpr (popAddr W32 nt) (popAddr W64 nt)
-pushAddrVal nt = archStmt (pushAddr W32 nt) (pushAddr W64 nt)
-
--- What's the Coder class name we're using for a given NType?
-coderName nt = aux nt ++ "Coder"
-    where
-      aux NBOOL   = "Bool"
-      aux Nschar  = "SChar"
-      aux Nuchar  = "UChar"
-      aux Nsshort = "SShort"
-      aux Nushort = "UShort"
-      aux Nsint   = "SInt"
-      aux Nuint   = "UInt"
-      aux Nslong  = "SLong"
-      aux Nulong  = "ULong"
-      aux Nslonglong   = "SLongLong"
-      aux Nulonglong   = "ULongLong"
-      aux Nfloat  = "Float"
-      aux Ndouble = "Double"
-
--- Operation for converting between primitives. Usually it just casts, but booleans are special.
-jconvertPrims sym Jboolean Jboolean = sym
-jconvertPrims sym Jboolean b = "((" ++ jprim2js b ++ ")(" ++ sym ++ " ? 1 : 0))"
-jconvertPrims sym a Jboolean = "(" ++ sym ++ " != 0)"
-jconvertPrims sym a b = if a == b then sym else "((" ++ jprim2js b ++ ")" ++ sym ++ ")"
-
-sizeofRet nt =
-    let ffitypes = map (\w -> ffitype w nt) widths
-        sizes = map sizeof ffitypes in
-    if (length $ nub sizes) == 1
-    then "\t\treturn " ++ (show.head $ sizes) ++ ";"
-    else unlines [
-              "\t\tswitch(w){",
-              (unlines $ map casestmt widths),
-              "\t\tdefault: return -1;",
-               "\t\t}"]
-    where
-      casestmt w = "\t\t\tcase " ++ (show w) ++ ": return " ++
-                   (show.sizeof $ ffitype w nt) ++ ";"
-
--- Generate a coder class for a given NType.
-c2java ntype =
-    unlines [
- "// native " ++ ntypeS ++ " -> java " ++ jprimS,
- "public static final class " ++ className ++ " extends PrimitiveCoder<" ++ jclassS ++ ">{",
- "\tpublic static final " ++ className ++ " INST = new " ++ className ++ "();",
- "\tpublic " ++ className ++ "(){ super("++ffitypeVal ntype++", \"" ++ [encoding ntype] ++ "\", "++jclassS++".class, "++jprimS++".class); }",
- "\t// compile time",
- "\t@Override public void push(JObjCRuntime rt, long addr, " ++ jprimS ++ " x){",
- "\t\t" ++ pushAddrVal ntype,
- "\t}",
- "\t@Override public " ++ jprimS ++ " pop" ++ capitalize jprimS ++ "(JObjCRuntime rt, long addr){",
- "\t\treturn " ++ popAddrVal ntype ++ ";",
- "\t}",
- "\t// for runtime coding",
- "\t@Override public int sizeof(Width w){",
- sizeofRet ntype,
- "\t}",
- "\t@Override public void push(JObjCRuntime rt, long addr, " ++ jclassS ++ " x){ " ++
- "push(rt, addr, (" ++ jprimS ++ ") x); }",
- "\t@Override public " ++ jclassS ++ " pop(JObjCRuntime rt, long addr){ " ++
- "return pop" ++ capitalize jprimS ++ "(rt, addr); }",
- "\t// proxies for mixed encoding",
- makeProxyMethods ntype,
- "}"
- ]
-     where
-       jprim = ntype2jprim ntype
-       jclass = jprim2jclass jprim
-       jprimS = jprim2js jprim
-       jclassS = jclass2js jclass
-       ntypeS = ntype2js ntype
-       className = coderName ntype
-
--- Generate push and pop methods that convert and proxy to actual implementation.
-makeProxyMethods nt = unlines $ map aux jprims
-    where
-      targetJPrim = ntype2jprim nt
-      targetJPrimS = jprim2js targetJPrim
-      aux jprim = if targetJPrim == jprim then "" else unlines [
-                   "\t@Override public void push(JObjCRuntime rt, long addr, " ++ jprimS ++ " x){ " ++
-                   "push(rt, addr, " ++ pushConversion "x" ++ "); }",
-                   "\t@Override public " ++ jprimS ++ " pop" ++ capitalize jprimS ++ "(JObjCRuntime rt, long addr){ " ++
-                   "return " ++ (popConversion ("pop" ++ capitalize targetJPrimS ++ "(rt, addr)")) ++ "; }"
-                  ]
-          where
-            jprimS = jprim2js jprim
-            pushConversion sym = jconvertPrims sym jprim targetJPrim
-            popConversion sym = jconvertPrims sym targetJPrim jprim
-
-main = do
-  putStrLn "package com.apple.jobjc;"
-
-  putStrLn "import com.apple.jobjc.JObjCRuntime.Width;"
-
-  putStrLn "// Auto generated by PrimitiveCoder.hs"
-  putStrLn "// Do not edit by hand."
-
-  putStrLn "public abstract class PrimitiveCoder<T> extends Coder<T>{"
-
-  putStrLn "\tpublic PrimitiveCoder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim){"
-  putStrLn "\t\tsuper(ffiTypeCode, objCEncoding, jclass, jprim);"
-  putStrLn "\t}"
-
-  mapM_ (\p -> putStrLn $ unlines [makePopI p, makePushI p]) jprims
-
-  mapM_ (putStrLn . c2java) ntypes
-
-  putStrLn "}"
-    where
-      makePopI jprim = unlines ["\tpublic final " ++ jprim2js jprim ++ " pop" ++ (capitalize.jprim2js $ jprim)
-                                   ++ "(NativeArgumentBuffer args){\n"
-                                   ++ "\t\treturn pop" ++ (capitalize.jprim2js $ jprim) ++ "(args.runtime, args.retValPtr);\n"
-                                   ++ "\t}",
-                                "\tpublic abstract " ++ jprim2js jprim ++ " pop" ++ (capitalize.jprim2js $ jprim) ++ "(JObjCRuntime runtime, long addr);"]
-      makePushI jprim = unlines ["\tpublic final void push"
-          ++ "(NativeArgumentBuffer args, " ++ jprim2js jprim ++ " x){\n"
-          ++ "\t\tpush(args.runtime, args.argValuesPtr, x);\n"
-          ++ "\t\targs.didPutArgValue(sizeof());\n"
-          ++ "\t}",
-        "\tpublic abstract void push(JObjCRuntime runtime, long addr, " ++ jprim2js jprim ++ " x);"]
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java
deleted file mode 100644
index 5207cf81d57..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-public class CFType extends Pointer<Void> {
-    protected CFType(long ptr) { super(ptr); }
-    protected CFType(Pointer<?> ptr) { super(ptr.ptr); }
-
-    protected ID getTollFreeBridge(JObjCRuntime runtime){
-        return ID.getObjCObjectFor(runtime, super.ptr);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CIF.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CIF.java
deleted file mode 100644
index c32d822662f..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CIF.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-
-class CIF {
-    private static native int getSizeofCIF();
-    private static final int SIZEOF = getSizeofCIF();
-    private static native boolean prepCIF(long cifPtr, int nargs, long retFFITypePtr, long argsPtr);
-
-    public static CIF createCIFFor(final NativeArgumentBuffer args, final Coder returnCoder, final Coder ... argCoders) {
-        NativeBuffer cifBuf = new NativeBuffer(SIZEOF + (argCoders.length * JObjCRuntime.PTR_LEN));
-        final long argsPtr = cifBuf.bufferPtr + SIZEOF;
-
-        {
-            long argsIterPtr = argsPtr;
-            for(final Coder coder : argCoders){
-                PrimitivePointerCoder.INST.push(args.runtime, argsIterPtr, coder.getFFITypePtr());
-                argsIterPtr += JObjCRuntime.PTR_LEN;
-            }
-        }
-
-        boolean ok = prepCIF(cifBuf.bufferPtr, argCoders.length, returnCoder.getFFITypePtr(), argsPtr);
-        if(!ok)
-            throw new RuntimeException("ffi_prep_cif failed.");
-
-        return new CIF(cifBuf, returnCoder, argCoders);
-    }
-
-    final NativeBuffer cif;
-    // CIF needs to keep refs to the Coders, so they don't get finalized and their FFITypes freed.
-    final Coder returnCoder;
-    final Coder[] argCoders;
-
-    private CIF(final NativeBuffer cif, Coder returnCoder, Coder... argCoders) {
-        this.cif = cif;
-        this.returnCoder = returnCoder;
-        this.argCoders = argCoders;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java
deleted file mode 100644
index 9efc76e9c05..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.io.StringWriter;
-import java.lang.reflect.Method;
-
-import com.apple.jobjc.JObjCRuntime.Width;
-import com.apple.jobjc.PrimitiveCoder.BoolCoder;
-import com.apple.jobjc.PrimitiveCoder.DoubleCoder;
-import com.apple.jobjc.PrimitiveCoder.FloatCoder;
-import com.apple.jobjc.PrimitiveCoder.SCharCoder;
-import com.apple.jobjc.PrimitiveCoder.SIntCoder;
-import com.apple.jobjc.PrimitiveCoder.SLongLongCoder;
-import com.apple.jobjc.PrimitiveCoder.SShortCoder;
-
-public abstract class Coder<T> {
-    private static native long getNativeFFITypePtrForCode(final int code);
-
-    static final int FFI_VOID        = 0;
-    static final int FFI_PTR        = FFI_VOID+1;
-
-    static final int FFI_SINT8        = FFI_PTR+1;
-    static final int FFI_UINT8        = FFI_SINT8+1;
-    static final int FFI_SINT16        = FFI_UINT8+1;
-    static final int FFI_UINT16        = FFI_SINT16+1;
-    static final int FFI_SINT32        = FFI_UINT16+1;
-    static final int FFI_UINT32        = FFI_SINT32+1;
-    static final int FFI_SINT64        = FFI_UINT32+1;
-    static final int FFI_UINT64        = FFI_SINT64+1;
-
-    static final int FFI_FLOAT        = FFI_UINT64+1;
-    static final int FFI_DOUBLE        = FFI_FLOAT+1;
-    static final int FFI_LONGDOUBLE    = FFI_DOUBLE+1;
-
-    private static long[] ffiCodesToFFITypePtrs;
-    static{
-        System.loadLibrary("JObjC");
-        ffiCodesToFFITypePtrs = new long[FFI_LONGDOUBLE + 1];
-        for (int i = 0; i < FFI_LONGDOUBLE + 1; i++) ffiCodesToFFITypePtrs[i] = getNativeFFITypePtrForCode(i);
-    }
-
-    long getFFITypePtr() {
-        return ffiCodesToFFITypePtrs[getTypeCode()];
-    }
-
-    // runtime coding
-    public abstract void push(final JObjCRuntime runtime, final long addr, final T x);
-    public abstract T pop(final JObjCRuntime runtime, final long addr);
-
-    public void push(final NativeArgumentBuffer args, final T x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-
-    public T pop(final NativeArgumentBuffer args){
-        return pop(args.runtime, args.retValPtr);
-    }
-
-    public abstract int sizeof(Width w);
-    final public int sizeof(){ return sizeof(JObjCRuntime.WIDTH); }
-
-    //
-
-    public Coder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim) {
-        this.ffiTypeCode = ffiTypeCode;
-        this.objCEncoding = objCEncoding;
-        this.jclass = jclass;
-        this.jprim = jprim;
-    }
-
-    public Coder(int ffiTypeCode, String objCEncoding, Class jclass) {
-        this(ffiTypeCode, objCEncoding, jclass, null);
-    }
-
-    private final int ffiTypeCode;
-    private final String objCEncoding;
-    private final Class jclass;
-    private final Class jprim;
-
-    final int getTypeCode() { return ffiTypeCode; }
-    final String getObjCEncoding(){ return objCEncoding; }
-    public final Class getJavaClass() { return jclass; }
-    public final Class getJavaPrimitive() { return jprim; }
-
-    // runtime coding
-
-    private static Coder[] runtimeCoders;
-    static public Coder getCoderAtRuntimeForType(Class cls){
-        if(runtimeCoders == null) runtimeCoders = new Coder[]{
-            NSClassCoder.INST, IDCoder.INST, PointerCoder.INST,
-            DoubleCoder.INST, FloatCoder.INST, SLongLongCoder.INST,
-            SIntCoder.INST, SShortCoder.INST, SCharCoder.INST, BoolCoder.INST,
-            VoidCoder.INST
-        };
-
-        for(Coder c : runtimeCoders)
-            if((c.getJavaClass() != null && c.getJavaClass().isAssignableFrom(cls)) ||
-                    (c.getJavaPrimitive() != null && c.getJavaPrimitive().isAssignableFrom(cls)))
-                return c;
-
-        if(Struct.class.isAssignableFrom(cls)){
-            try {
-                Method m = cls.getDeclaredMethod("getStructCoder");
-                m.setAccessible(true);
-                return (Coder) m.invoke(null);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        throw new RuntimeException("Could not find suitable coder for " + cls);
-    }
-
-    static public Coder getCoderAtRuntime(Object inst){
-        if(inst == null)              return PointerCoder.INST;
-        if(inst instanceof Struct)    return ((Struct) inst).getCoder();
-        return getCoderAtRuntimeForType(inst.getClass());
-    }
-
-    //
-
-    public static final class VoidCoder extends Coder<Object>{
-        public static final VoidCoder INST = new VoidCoder();
-        public VoidCoder(){ super(FFI_VOID, "v", Void.class, void.class); }
-        @Override public int sizeof(Width w) { return -1; }
-        @Override public Object pop(JObjCRuntime runtime, long addr) { throw new RuntimeException("Trying to pop a Void."); }
-        @Override public void push(JObjCRuntime runtime, long addr, Object x) { throw new RuntimeException("Trying to push a Void."); }
-    }
-
-    public static final class UnknownCoder extends Coder<Object> {
-        public static final UnknownCoder INST = new UnknownCoder();
-        public UnknownCoder(){ super(-1, "?", null, null); }
-        @Override public int sizeof(Width w) { return -1; }
-        @Override public void push(JObjCRuntime runtime, long addr, Object x) { throw new RuntimeException("Coder not implemented");}
-        @Override public Object pop(JObjCRuntime runtime, long addr) { throw new RuntimeException("Coder not implemented"); }
-    }
-
-    public static final class PrimitivePointerCoder extends Coder<Long> {
-        public static final PrimitivePointerCoder INST = new PrimitivePointerCoder();
-        public PrimitivePointerCoder(){ super(Coder.FFI_PTR, "^?", Long.class, long.class); }
-        @Override public int sizeof(Width w) { return JObjCRuntime.PTR_LEN; }
-
-        public void push(JObjCRuntime runtime, long addr, long x) {
-            if(JObjCRuntime.IS64)
-                runtime.unsafe.putLong(addr, x);
-            else
-                runtime.unsafe.putInt(addr, (int) x);
-        }
-
-        public void push(final JObjCRuntime runtime, final NativeArgumentBuffer argBuf, final long ptr) {
-            push(runtime, argBuf.argValuesPtr, ptr);
-            argBuf.didPutArgValue(sizeof());
-        }
-
-        public long popPtr(final JObjCRuntime runtime, final long addr) {
-            return JObjCRuntime.IS64 ? runtime.unsafe.getLong(addr) : runtime.unsafe.getInt(addr);
-        }
-
-        public long popPtr(final JObjCRuntime runtime, final NativeArgumentBuffer argBuf) {
-            return popPtr(runtime, argBuf.retValPtr);
-        }
-
-        @Override public Long pop(JObjCRuntime runtime, long addr) { return popPtr(runtime, addr); }
-        @Override public void push(JObjCRuntime runtime, long addr, Long x) { push(runtime, addr, (long) x); }
-    }
-
-    public static final class PointerCoder extends Coder<Pointer> {
-        public static final PointerCoder INST = new PointerCoder();
-        public PointerCoder(){ super(FFI_PTR, "^?", Pointer.class); }
-        @Override public int sizeof(Width w) { return PrimitivePointerCoder.INST.sizeof(w); }
-
-        @Override public Pointer pop(JObjCRuntime runtime, long addr) {
-            return new Pointer(PrimitivePointerCoder.INST.popPtr(runtime, addr));
-        }
-        @Override public void push(JObjCRuntime runtime, long addr, Pointer x) {
-            PrimitivePointerCoder.INST.push(runtime, addr, x == null ? 0 : x.ptr);
-        }
-    }
-
-    public static final class SELCoder extends Coder<SEL> {
-        public static final SELCoder INST = new SELCoder();
-        public SELCoder(){ super(FFI_PTR, ":", SEL.class); }
-        @Override public int sizeof(Width w) { return PrimitivePointerCoder.INST.sizeof(w); }
-
-        @Override public void push(JObjCRuntime runtime, long addr, SEL x) {
-            PrimitivePointerCoder.INST.push(runtime, addr, x == null ? 0 : x.selPtr);
-        }
-        @Override public SEL pop(JObjCRuntime runtime, long addr) {
-            return new SEL(PrimitivePointerCoder.INST.popPtr(runtime, addr));
-        }
-    }
-
-    public static abstract class StructCoder extends Coder<Struct> {
-        private final FFIType ffiType;
-        final int sizeof;
-
-        public StructCoder(final int sizeof, final Coder... elementCoders){
-            super(-1, objCEncoding(elementCoders), null);
-            this.ffiType = new FFIType(elementCoders);
-            this.sizeof = sizeof;
-        }
-
-        @Override public int sizeof(Width w) { return sizeof; }
-
-        private static String objCEncoding(final Coder[] elementCoders) {
-            StringWriter str = new StringWriter();
-            str.append("{?=");
-            for(Coder c : elementCoders)
-                str.append(c.getObjCEncoding());
-            str.append("}");
-            return str.toString();
-        }
-
-        @Override long getFFITypePtr() { return ffiType.getPtr(); }
-
-        @Override public void push(NativeArgumentBuffer argBuf, Struct x) {
-            // Just point to the instance on the heap instead of copying it onto the arg buf.
-            argBuf.doPutArgPtr(x.raw.bufferPtr);
-        }
-
-        @Override public void push(JObjCRuntime rt, long addr, Struct x) {
-            rt.unsafe.copyMemory(x.raw.bufferPtr, addr, sizeof);
-        }
-
-        protected abstract Struct newInstance(JObjCRuntime runtime);
-
-        @Override public Struct pop(final JObjCRuntime runtime, final long addr) {
-            Struct s = newInstance(runtime);
-            runtime.unsafe.copyMemory(addr, s.raw.bufferPtr, sizeof);
-            return s;
-        }
-    }
-
-    public static final class IDCoder extends Coder<ID>{
-        public static final IDCoder INST = new IDCoder();
-        public IDCoder(){ super(FFI_PTR, "@", ID.class); }
-        @Override public int sizeof(Width w) { return PrimitivePointerCoder.INST.sizeof(w); }
-
-        public <T extends ID> T newID(final JObjCRuntime runtime, final long objPtr) {
-            return (T) ID.getObjCObjectFor(runtime, objPtr);
-        }
-
-        @Override public ID pop(final JObjCRuntime runtime, final long addr) {
-            return newID(runtime, PrimitivePointerCoder.INST.popPtr(runtime, addr));
-        }
-
-        @Override public void push(final JObjCRuntime runtime, final long addr, final ID x) {
-            PointerCoder.INST.push(runtime, addr, x);
-        }
-    }
-
-    public static final class NSClassCoder extends Coder<NSClass>{
-        public static final NSClassCoder INST = new NSClassCoder();
-        public NSClassCoder(){ super(FFI_PTR, "#", NSClass.class); }
-        @Override public int sizeof(Width w) { return PrimitivePointerCoder.INST.sizeof(w); }
-
-        @Override public NSClass pop(JObjCRuntime runtime, long addr) {
-            final long clsPtr = PrimitivePointerCoder.INST.popPtr(runtime, addr);
-            if (clsPtr == 0) return null;
-            return NSClass.getObjCClassFor(runtime, clsPtr);
-        }
-        @Override public void push(JObjCRuntime runtime, long addr, NSClass x) {
-            PointerCoder.INST.push(runtime, addr, x);
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java
deleted file mode 100644
index dcff0035587..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-
-
-class FFIType{
-    private static native void makeFFIType(long ffi_type_buf, long elements_buf);
-    private static native int  getFFITypeSizeof();
-    private static int FFI_TYPE_SIZEOF = getFFITypeSizeof();
-    final NativeBuffer ffi_type;
-    final NativeBuffer elements;
-    final Coder[] elementCoders;
-
-    public FFIType(final Coder... elementCoders){
-        final JObjCRuntime runtime = JObjCRuntime.inst();
-        this.elementCoders = elementCoders;
-        this.ffi_type = new NativeBuffer(FFI_TYPE_SIZEOF);
-        this.elements = new NativeBuffer(JObjCRuntime.PTR_LEN * (elementCoders.length + 1));
-
-        long elIterPtr = elements.bufferPtr;
-        for(Coder c : elementCoders){
-            PrimitivePointerCoder.INST.push(runtime, elIterPtr, c.getFFITypePtr());
-            elIterPtr += PrimitivePointerCoder.INST.sizeof();
-        }
-        PrimitivePointerCoder.INST.push(runtime, elIterPtr, 0);
-
-        makeFFIType(ffi_type.bufferPtr, elements.bufferPtr);
-    }
-
-    public long getPtr(){
-        return ffi_type.bufferPtr;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java
deleted file mode 100644
index 413d8fafe76..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-public class Function {
-    private static native long getFxnPtrForFunctionName(final String functionName);
-    private static native long getFxnPtrForFunctionNameAndLib(final long libPtr, final String functionName);
-
-    final long fxnPtr;
-
-    Function(final long fxnPtr) {
-        this.fxnPtr = fxnPtr;
-    }
-
-    public Function(final String name) {
-        this(getFxnPtr(name));
-    }
-
-    public Function(final MacOSXFramework framework, final String name) {
-        this(getFxnPtr(name, framework));
-    }
-
-    static long getFxnPtr(final String name){
-        long fxnPtr = getFxnPtrForFunctionName(name);
-        if(fxnPtr == 0) throw new RuntimeException("Function pointer for " + name + " not found in runtime.");
-        return fxnPtr;
-    }
-
-    static long getFxnPtr(final String name, final MacOSXFramework framework){
-        long fxnPtr = 0;
-        for(int i = 0; fxnPtr == 0 && i < framework.nativeLibPtrs.length; i++){
-            fxnPtr = getFxnPtrForFunctionNameAndLib(framework.nativeLibPtrs[i], name);
-            if(fxnPtr != 0) return fxnPtr;
-        }
-        throw new RuntimeException("Function pointer for " + name + " not found in framework " + framework + ".");
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java
deleted file mode 100644
index aa202cf0943..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-
-public class ID extends Pointer<Void>{
-    static native String getNativeDescription(final long objPtr);
-
-    final JObjCRuntime runtime;
-
-    static final Class[] CTOR_ARGS = { long.class, JObjCRuntime.class };
-    protected ID(final long objPtr, final JObjCRuntime runtime) {
-        super(objPtr);
-        runtime.assertOK();
-        this.runtime = runtime;
-    }
-
-    protected ID(final ID obj, final JObjCRuntime runtime) {
-        this(obj.ptr, runtime);
-    }
-
-    @Override protected NativeObjectLifecycleManager getNativeObjectLifecycleManager() {
-        return NativeObjectLifecycleManager.CFRetainRelease.INST;
-    }
-
-    protected final JObjCRuntime getRuntime() { return runtime; }
-
-    @Override public String toString(){
-        String s = super.toString();
-        return s + " (ObjC: " + ptr + " / " + Long.toHexString(ptr) + ")";
-    }
-
-    //
-
-    public static <T extends ID> T getInstance(final long ptr, final JObjCRuntime runtime){
-        return (T) getObjCObjectFor(runtime, ptr);
-    }
-
-    static <T extends ID> T getObjCObjectFor(final JObjCRuntime runtime, final long objPtr){
-        if (objPtr == 0) return null;
-
-        final WeakReference cachedObj = objectCache.get().get(objPtr);
-        if(cachedObj != null && cachedObj.get() != null) return (T) cachedObj.get();
-
-        final long clsPtr = NSClass.getClass(objPtr);
-
-        final T newObj = (T) (runtime.subclassing.isUserClass(clsPtr) ?
-                Subclassing.getJObjectFromIVar(objPtr)
-                : createNewObjCObjectFor(runtime, objPtr, clsPtr));
-
-        objectCache.get().put(objPtr, new WeakReference(newObj));
-        return newObj;
-    }
-
-    static <T extends ID> T createNewObjCObjectFor(final JObjCRuntime runtime, final long objPtr, final long clsPtr) {
-        final Constructor<T> ctor = getConstructorForClassPtr(runtime, clsPtr);
-        return (T) createNewObjCObjectForConstructor(ctor, objPtr, runtime);
-    }
-
-    @SuppressWarnings("unchecked")
-    static <T extends ID> Constructor<T> getConstructorForClassPtr(final JObjCRuntime runtime, final long clazzPtr){
-        final Constructor<T> cachedCtor = (Constructor<T>) constructorCache.get().get(clazzPtr);
-        if(cachedCtor != null) return cachedCtor;
-
-        final Class<T> clazz = getClassForClassPtr(runtime, clazzPtr);
-        Constructor<T> ctor;
-        try {
-            ctor = clazz.getDeclaredConstructor(CTOR_ARGS);
-        } catch (SecurityException e) {
-            throw new RuntimeException(e);
-        } catch (NoSuchMethodException e) {
-            throw new RuntimeException(e);
-        }
-        ctor.setAccessible(true);
-        constructorCache.get().put(clazzPtr, (Constructor<ID>) ctor);
-        return ctor;
-    }
-
-    @SuppressWarnings("unchecked")
-    static <T extends ID> Class<T> getClassForClassPtr(final JObjCRuntime runtime, final long clazzPtr){
-        final String className = NSClass.getClassNameOfClass(clazzPtr);
-        final Class<T> clazz = (Class<T>) runtime.getClassForNativeClassName(className);
-        if(clazz == null){
-            final long superClazzPtr = NSClass.getSuperClassOfClass(clazzPtr);
-            if(superClazzPtr != 0)
-                return getClassForClassPtr(runtime, superClazzPtr);
-        }
-        return clazz;
-    }
-
-    static <T extends ID> T createNewObjCObjectForConstructor(final Constructor ctor, final long objPtr, final JObjCRuntime runtime) {
-        try {
-            final T newInstance = (T) ctor.newInstance(new Object[] { Long.valueOf(objPtr), runtime });
-            objectCache.get().put(objPtr, new WeakReference(newInstance));
-            return newInstance;
-        } catch (final Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    static <T extends ID> T createNewObjCObjectForClass(final Class<T> clazz, final long objPtr, final JObjCRuntime runtime) {
-        try {
-            final Constructor<T> constructor = clazz.getDeclaredConstructor(CTOR_ARGS);
-            constructor.setAccessible(true);
-            return (T) createNewObjCObjectForConstructor(constructor, objPtr, runtime);
-        } catch (final Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    //
-
-    static final ThreadLocal<LinkedHashMap<Long, Constructor>> constructorCache = new ThreadLocal<LinkedHashMap<Long, Constructor>>(){
-        @Override protected LinkedHashMap<Long, Constructor> initialValue(){
-            final int MAX_ENTRIES = 1000;
-            final float LOAD_FACTOR = 0.75f;
-            return new LinkedHashMap<Long, Constructor>((int) (MAX_ENTRIES/LOAD_FACTOR), LOAD_FACTOR, true) {
-                @Override protected boolean removeEldestEntry(Map.Entry<Long, Constructor> eldest) {
-                    return size() > MAX_ENTRIES;
-                }
-            };
-        }
-    };
-
-    static final ThreadLocal<LinkedHashMap<Long, WeakReference>> objectCache = new ThreadLocal<LinkedHashMap<Long, WeakReference>>(){
-        @Override protected LinkedHashMap<Long, WeakReference> initialValue(){
-            final int MAX_ENTRIES = 1000;
-            final float LOAD_FACTOR = 0.75f;
-            return new LinkedHashMap<Long, WeakReference>((int) (MAX_ENTRIES/LOAD_FACTOR), LOAD_FACTOR, true) {
-                @Override protected boolean removeEldestEntry(Map.Entry<Long, WeakReference> eldest) {
-                    return size() > MAX_ENTRIES || eldest.getValue().get() == null;
-                }
-            };
-        }
-    };
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java
deleted file mode 100644
index 48ffc98663f..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Coder.IDCoder;
-import com.apple.jobjc.Coder.NSClassCoder;
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-import com.apple.jobjc.Coder.SELCoder;
-import com.apple.jobjc.Coder.StructCoder;
-
-
-public abstract class Invoke {
-    public abstract void invoke(NativeArgumentBuffer argBuf);
-    public abstract void invoke(NativeArgumentBuffer buffer, Struct retvalStruct);
-
-    //
-
-    public static final class FunCall extends Invoke{
-        static native void invoke(long cifPtr, long fxnPtr, long retValPtr, long argsPtr);
-
-        final long fxnPtr;
-        final CIF cif;
-
-        FunCall(long fxnPtr, CIF cif) {
-            this.fxnPtr = fxnPtr;
-            this.cif = cif;
-        }
-
-        public FunCall(final JObjCRuntime runtime, final String name, final Coder returnCoder, final Coder ... argCoders) {
-            this(Function.getFxnPtr(name), CIF.createCIFFor(runtime.getThreadLocalState(), returnCoder, argCoders));
-        }
-
-        public FunCall(final MacOSXFramework framework, final String name, final Coder returnCoder, final Coder ... argCoders) {
-            this(Function.getFxnPtr(name, framework), CIF.createCIFFor(framework.getRuntime().getThreadLocalState(), returnCoder, argCoders));
-        }
-
-        public void init(final NativeArgumentBuffer argBuf) {
-            argBuf.reset();
-        }
-
-        @Override public void invoke(final NativeArgumentBuffer argBuf) {
-            invoke(argBuf, argBuf.retValPtr);
-        }
-
-        @Override public void invoke(final NativeArgumentBuffer buffer, final Struct retvalStruct) {
-            invoke(buffer, retvalStruct.raw.bufferPtr);
-        }
-
-        void invoke(final NativeArgumentBuffer argBuf, final long retValPtr) {
-            invoke(cif.cif.bufferPtr, fxnPtr, retValPtr, argBuf.buffer.bufferPtr);
-        }
-    }
-
-    public static final class MsgSend extends Invoke{
-        static{ System.load("/usr/lib/libobjc.dylib"); }
-
-        private static final long OBJC_MSG_SEND_FXN_PTR = new Function("objc_msgSend").fxnPtr;
-        private static final long OBJC_MSG_SEND_FPRET_FXN_PTR = new Function("objc_msgSend_fpret").fxnPtr;
-        private static final long OBJC_MSG_SEND_STRET_FXN_PTR = new Function("objc_msgSend_stret").fxnPtr;
-
-        final FunCall funCall;
-        final long selPtr;
-
-        public MsgSend(final JObjCRuntime runtime, final String name, final Coder returnCoder, final Coder ... argCoders) {
-            this.funCall = new FunCall(getMsgSendFxnPtr(returnCoder),
-                    CIF.createCIFFor(runtime.getThreadLocalState(), returnCoder, getSelCoders(argCoders)));
-            this.selPtr = SEL.getSelectorPtr(name);
-        }
-
-        public void init(final NativeArgumentBuffer nativeBuffer, final ID obj) {
-            funCall.init(nativeBuffer);
-            IDCoder.INST.push(nativeBuffer, obj);
-            PrimitivePointerCoder.INST.push(nativeBuffer.runtime, nativeBuffer, selPtr);
-        }
-
-        @Override public void invoke(final NativeArgumentBuffer argBuf) {
-            funCall.invoke(argBuf);
-        }
-
-        @Override public void invoke(final NativeArgumentBuffer buffer, final Struct retvalStruct) {
-            funCall.invoke(buffer, retvalStruct);
-        }
-
-        // support
-
-        static Coder[] getSelCoders(final Coder[] argCoders) {
-            final Coder[] selArgCoders = new Coder[argCoders.length + 2];
-            selArgCoders[0] = IDCoder.INST;
-            selArgCoders[1] = SELCoder.INST;
-            for (int i = 0; i < argCoders.length; i++)
-                selArgCoders[i + 2] = argCoders[i];
-            return selArgCoders;
-        }
-
-        static long getMsgSendFxnPtr(final Coder returnCoder) {
-            if(returnCoder instanceof StructCoder){
-                StructCoder scoder = (StructCoder) returnCoder;
-
-                switch(JObjCRuntime.ARCH){
-                case ppc:
-                    return OBJC_MSG_SEND_STRET_FXN_PTR;
-                case i386:
-                    switch(scoder.sizeof){
-                    case 1: case 2: case 4: case 8:
-                        return OBJC_MSG_SEND_FXN_PTR;
-                    }
-                    return OBJC_MSG_SEND_STRET_FXN_PTR;
-                case x86_64:
-                    if(scoder.sizeof > 16)
-                        return OBJC_MSG_SEND_STRET_FXN_PTR;
-                    else
-                        return OBJC_MSG_SEND_FXN_PTR;
-                default:
-                    throw new RuntimeException();
-                }
-            }
-
-            final int typeCode = returnCoder.getTypeCode();
-
-            switch(JObjCRuntime.ARCH){
-            case ppc:
-                return OBJC_MSG_SEND_FXN_PTR;
-            case i386:
-                switch(typeCode) {
-                case Coder.FFI_FLOAT: case Coder.FFI_DOUBLE: case Coder.FFI_LONGDOUBLE:
-                    return OBJC_MSG_SEND_FPRET_FXN_PTR;
-                }
-                return OBJC_MSG_SEND_FXN_PTR;
-            case x86_64:
-                if(typeCode == Coder.FFI_LONGDOUBLE)
-                    return OBJC_MSG_SEND_FPRET_FXN_PTR;
-                return OBJC_MSG_SEND_FXN_PTR;
-            default:
-                throw new RuntimeException();
-            }
-        }
-    }
-
-    public static final class MsgSendSuper extends Invoke{
-        static{ System.load("/usr/lib/libobjc.dylib"); }
-
-        private static final long OBJC_MSG_SEND_SUPER_FXN_PTR = new Function("objc_msgSendSuper").fxnPtr;
-        private static final long OBJC_MSG_SEND_SUPER_STRET_FXN_PTR = new Function("objc_msgSendSuper_stret").fxnPtr;
-
-        final FunCall funCall;
-        final long selPtr;
-
-        public MsgSendSuper(final JObjCRuntime runtime, final String name, final Coder returnCoder, final Coder ... argCoders) {
-            this.funCall = new FunCall(getMsgSendSuperFxnPtr(returnCoder),
-                    CIF.createCIFFor(runtime.getThreadLocalState(), returnCoder, getSuperSelCoders(argCoders)));
-            this.selPtr = SEL.getSelectorPtr(name);
-        }
-
-        public void init(final NativeArgumentBuffer argBuf, final ID obj, final NSClass cls) {
-            funCall.init(argBuf);
-
-            // Instead of mallocing a struct, or keeping another thread local,
-            // let's write objc_super out to the argbuf, and then point an argument
-            // to the data.
-
-            final long valPtr = argBuf.argValuesPtr;
-            final int ptrLen = JObjCRuntime.PTR_LEN;
-
-            IDCoder     .INST.push(argBuf.runtime, valPtr,          obj);
-            NSClassCoder.INST.push(argBuf.runtime, valPtr + ptrLen, cls);
-            argBuf.argValuesPtr += ptrLen + ptrLen;
-
-            PrimitivePointerCoder.INST.push(argBuf.runtime, argBuf, valPtr);
-            PrimitivePointerCoder.INST.push(argBuf.runtime, argBuf, selPtr);
-        }
-
-        @Override public void invoke(final NativeArgumentBuffer argBuf) {
-            funCall.invoke(argBuf);
-        }
-
-        @Override public void invoke(final NativeArgumentBuffer buffer, final Struct retvalStruct) {
-            funCall.invoke(buffer, retvalStruct);
-        }
-
-        //
-
-        private final static StructCoder objc_super_coder = new StructCoder(JObjCRuntime.PTR_LEN*2, IDCoder.INST, NSClassCoder.INST){
-            @Override protected Struct newInstance(JObjCRuntime runtime) { return null; }};
-
-        static Coder[] getSuperSelCoders(final Coder[] argCoders) {
-            final Coder[] selArgCoders = new Coder[argCoders.length + 2];
-            selArgCoders[0] = objc_super_coder;
-            selArgCoders[1] = SELCoder.INST;
-            for (int i = 0; i < argCoders.length; i++)
-                selArgCoders[i + 2] = argCoders[i];
-            return selArgCoders;
-        }
-
-        static long getMsgSendSuperFxnPtr(final Coder returnCoder){
-            long normal = MsgSend.getMsgSendFxnPtr(returnCoder);
-            if(normal == MsgSend.OBJC_MSG_SEND_STRET_FXN_PTR)
-                return OBJC_MSG_SEND_SUPER_STRET_FXN_PTR;
-            else
-                return OBJC_MSG_SEND_SUPER_FXN_PTR;
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java
deleted file mode 100644
index 5bc01bc4e97..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.lang.reflect.Field;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import sun.misc.Unsafe;
-
-
-public final class JObjCRuntime {
-    static { System.loadLibrary("JObjC"); }
-
-    public static enum Arch{ ppc, i386, x86_64 };
-    public static enum Width{ W32, W64 };
-
-    public static final Arch ARCH = getArch();
-    public static final Width WIDTH = getWidth();
-
-    private static Arch getArch(){
-        String arch = System.getProperty("os.arch");
-        if("ppc".equals(arch)) return Arch.ppc;
-        if("i386".equals(arch)) return Arch.i386;
-        if("x86_64".equals(arch)) return Arch.x86_64;
-        if("amd64".equals(arch)) return Arch.x86_64;
-        if("universal".equals(arch)) return Arch.x86_64;
-        throw new RuntimeException("Did not recognize os.arch system property: '" + arch + "'");
-    }
-
-    private static Width getWidth(){
-        String width = System.getProperty("sun.arch.data.model");
-        if("32".equals(width)) return Width.W32;
-        if("64".equals(width)) return Width.W64;
-        throw new RuntimeException("Did not recognize sun.arch.data.model system property: '" + width + "'");
-    }
-
-    public static final boolean IS32 = System.getProperty("sun.arch.data.model").equals("32");
-    public static final boolean IS64 = System.getProperty("sun.arch.data.model").equals("64");
-    public static final int PTR_LEN = IS64 ? 8 : 4;
-    public static final boolean IS_BIG_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
-    static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("JObjC.debug"));
-
-    static void checkPermission(){
-        final SecurityManager security = System.getSecurityManager();
-        if (security != null) security.checkPermission(new RuntimePermission("canProcessApplicationEvents"));
-    }
-
-    public final void assertOK(){
-        if(this != instance)
-            throw new SecurityException("runtime");
-    }
-
-    private JObjCRuntime(){}
-
-    private static JObjCRuntime instance;
-    static JObjCRuntime inst() {
-        if (instance == null) instance = new JObjCRuntime();
-        return instance;
-    }
-
-    public static JObjCRuntime getInstance() {
-        checkPermission();
-        return inst();
-    }
-
-    public final NativeArgumentBuffer getThreadLocalState() {
-        return NativeArgumentBuffer.getThreadLocalBuffer(this);
-    }
-
-    final Unsafe unsafe = getUnsafe();
-    final Subclassing subclassing = new Subclassing(this);
-    final List<String> registeredPackages = new ArrayList<String>();
-
-    @SuppressWarnings("unchecked")
-    Class<? extends ID> getClassForNativeClassName(final String className) {
-        for (final String pkg : registeredPackages) {
-            try {
-                final Class<?> clazz = Class.forName(pkg + "." + className);
-                if (clazz != null) return (Class<? extends ID>)clazz;
-            } catch (final ClassNotFoundException e) { }
-        }
-
-        return null;
-    }
-
-    private final static Unsafe getUnsafe() {
-        Unsafe inst = null;
-        try {
-            Field f = Unsafe.class.getDeclaredField("theUnsafe");
-            f.setAccessible(true);
-            inst = (Unsafe) f.get(null);
-            if(inst == null) throw new NullPointerException("Unsafe.theUnsafe == null");
-        } catch (Exception e) {
-            throw new RuntimeException("Unable to get instance of Unsafe.", e);
-        }
-        return inst;
-    }
-
-    public void registerPackage(final String pkg) {
-        registeredPackages.add(pkg);
-    }
-
-    /**
-     * Register a subclass of NSObject to allow the native side to send
-     * messages which in turn call java methods declared on the class.
-     * If a native class by the same name already exists, registerClass
-     * will simply return without doing anything.
-     *
-     * For a usage example, see the SubclassingTest.
-     */
-    public boolean registerUserClass(Class<? extends ID> clazz, Class<? extends NSClass> clazzClazz) {
-        return subclassing.registerUserClass(clazz, clazzClazz);
-    }
-
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java
deleted file mode 100644
index bd776688f7d..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-
-public class MacOSXFramework {
-    private static native long retainFramework(final String frameworkName);
-    private static native void releaseFramework(final long frameworkPtr);
-    private static native void getConstant(final long frameworkPtr, String symbol, final long bufferPtr, final int size);
-
-    private final JObjCRuntime runtime;
-    protected final long[] nativeLibPtrs;
-
-    final long getFrameworkPtr() { return nativeLibPtrs.length > 0 ? nativeLibPtrs[0] : 0; }
-
-    private static long[] createFrameworkPtrsFromPaths(final String[] frameworkLibPaths) {
-        final long[] libPtrs = new long[frameworkLibPaths.length];
-        for(int i = 0; i < libPtrs.length; i++){
-            libPtrs[i] = retainFramework(frameworkLibPaths[i]);
-            if(libPtrs[i] == 0) throw new RuntimeException("Could not open library at " + frameworkLibPaths[i]);
-        }
-        return libPtrs;
-    }
-
-    protected MacOSXFramework(final JObjCRuntime runtime, final String[] nativeLibPaths) {
-        runtime.assertOK();
-        this.runtime = runtime;
-        this.nativeLibPtrs = createFrameworkPtrsFromPaths(nativeLibPaths);
-    }
-
-    @Override protected final synchronized void finalize() throws Throwable {
-        for(long lib : nativeLibPtrs)
-            if(lib != 0) releaseFramework(lib);
-    }
-
-    protected final JObjCRuntime getRuntime(){ return runtime; }
-
-    protected void getConstant(final String symbol, final long retValPtr, final int size){
-        assert size >= 0;
-        assert retValPtr != 0;
-        getConstant(getFrameworkPtr(), symbol, retValPtr, size);
-    }
-
-    protected void getConstant(final String symbol, final NativeArgumentBuffer out, final int size){
-        getConstant(symbol, out.retValPtr, size);
-    }
-
-    protected void getConstant(final String symbol, final Struct out, final int size){
-        getConstant(symbol, out.raw.bufferPtr, size);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java
deleted file mode 100644
index dfda99acf35..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-
-
-public class NSClass<T extends ID> extends ID {
-    public static class NSClassNotFoundException extends RuntimeException{
-        public NSClassNotFoundException(String m){ super(m); }
-        public NSClassNotFoundException(String m, Throwable cause){ super(m, cause); }
-    }
-
-    static native long getNativeClassByName(String name);
-    static native long getSuperClassOfClass(long classPtr);
-    static native String getClassNameOfClass(long classPtr);
-    static native long getClass(long objPtr);
-
-    public NSClass(final long ptr, final JObjCRuntime runtime) {
-        super(ptr, runtime);
-    }
-
-    public NSClass(final String name, final JObjCRuntime runtime) {
-        this(getNativeClassByName(name), runtime);
-        if(ptr == 0) throw new NSClassNotFoundException("NSClass pointer is 0. Found no class named " + name);
-    }
-
-    protected NSClass(final JObjCRuntime runtime){
-        super(0, runtime);
-        final String sn = getClass().getSimpleName();
-        final String name = sn.substring(0, sn.lastIndexOf("Class"));
-        ptr = getNativeClassByName(name);
-        if(ptr == 0) throw new NSClassNotFoundException("NSClass pointer is 0. Found no class named " + name);
-    }
-
-    NSClass<? super T> getSuperClass() {
-        return new NSClass<T>(getSuperClassOfClass(ptr), runtime);
-    }
-
-    String getClassName() { return getClassNameOfClass(ptr); }
-
-    @Override protected NativeObjectLifecycleManager getNativeObjectLifecycleManager() {
-        return NativeObjectLifecycleManager.Nothing.INST;
-    }
-
-    @Override public boolean equals(Object o){
-        return (o instanceof NSClass) && (this.ptr == ((NSClass) o).ptr);
-    }
-
-    //
-
-    static <T extends NSClass> T getObjCClassFor(final JObjCRuntime runtime, final long clsPtr){
-        if (clsPtr == 0) return null;
-
-        final WeakReference cachedObj = objectCache.get().get(clsPtr);
-        if(cachedObj != null && cachedObj.get() != null) return (T) cachedObj.get();
-
-        final T newObj = (T) createNewObjCClassFor(runtime, clsPtr);
-        objectCache.get().put(clsPtr, new WeakReference(newObj));
-        return newObj;
-    }
-
-    static <T extends NSClass> T createNewObjCClassFor(final JObjCRuntime runtime, final long clsPtr) {
-        final Constructor<T> ctor = getNSClassConstructorForClassPtr(runtime, clsPtr);
-        return (T) createNewObjCObjectForConstructor(ctor, clsPtr, runtime);
-    }
-
-    @SuppressWarnings("unchecked")
-    static <T extends NSClass> Constructor<T> getNSClassConstructorForClassPtr(final JObjCRuntime runtime, final long clazzPtr){
-        final Class<T> clazz = getNSClassForClassPtr(runtime, clazzPtr);
-        Constructor<T> ctor;
-        try {
-            ctor = clazz.getDeclaredConstructor(CTOR_ARGS);
-        } catch (SecurityException e) {
-            throw new RuntimeException(e);
-        } catch (NoSuchMethodException e) {
-            throw new RuntimeException(e);
-        }
-        ctor.setAccessible(true);
-        return ctor;
-    }
-
-    @SuppressWarnings("unchecked")
-    static <T extends ID> Class<T> getNSClassForClassPtr(final JObjCRuntime runtime, final long clazzPtr){
-        final String className = NSClass.getClassNameOfClass(clazzPtr);
-        final Class<T> clazz = (Class<T>) runtime.getClassForNativeClassName(className + "Class");
-        if(clazz == null){
-            final long superClazzPtr = NSClass.getSuperClassOfClass(clazzPtr);
-            if(superClazzPtr != 0)
-                return getNSClassForClassPtr(runtime, superClazzPtr);
-        }
-        return clazz;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java
deleted file mode 100644
index 7f8949a2b40..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.nio.ByteOrder;
-
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-
-
-public final class NativeArgumentBuffer{
-    private static final ThreadLocal<NativeArgumentBuffer> threadLocal = new ThreadLocal<NativeArgumentBuffer>();
-
-    static NativeArgumentBuffer getThreadLocalBuffer(final JObjCRuntime runtime) {
-        runtime.assertOK();
-        final NativeArgumentBuffer alreadyCreated = threadLocal.get();
-        if (alreadyCreated != null) return alreadyCreated;
-
-        final NativeArgumentBuffer newThreadLocalState = new NativeArgumentBuffer(runtime);
-        threadLocal.set(newThreadLocalState);
-        return newThreadLocalState;
-    }
-
-    final JObjCRuntime runtime;
-
-    final NativeBuffer buffer;
-
-    long argPtrsPtr;
-    long argValuesPtr;
-    final long retValPtr;
-
-    private static final int MAX_ARGS = 512;
-    private static final int BUF_SIZE = MAX_ARGS * 8 * 2;
-    private static final int ARG_VALS_OFFSET = BUF_SIZE/2;
-
-    private NativeArgumentBuffer(final JObjCRuntime runtime) {
-        runtime.assertOK();
-        this.runtime = runtime;
-        this.buffer = new NativeBuffer(BUF_SIZE);
-        this.buffer.buffer.order(ByteOrder.nativeOrder());
-
-        reset();
-        this.retValPtr = buffer.bufferPtr;
-    }
-
-
-    // Call before each new call
-    public void reset() {
-        argPtrsPtr = buffer.bufferPtr;
-        argValuesPtr = buffer.bufferPtr + ARG_VALS_OFFSET;
-        assert buffer.ptrInBounds(argValuesPtr);
-    }
-
-    // Push a pointer to a block of memory
-    public void doPutArgPtr(long ptr) {
-        assert buffer.ptrInBounds(argPtrsPtr);
-        PrimitivePointerCoder.INST.push(runtime, argPtrsPtr, ptr);
-        argPtrsPtr += JObjCRuntime.PTR_LEN;
-    }
-
-    // Call this after having written a value of size `sizeof` to `argValuesPtr`.
-    public void didPutArgValue(int sizeof) {
-        assert buffer.ptrInBounds(argValuesPtr);
-        doPutArgPtr(argValuesPtr);
-        argValuesPtr += sizeof;
-    }
-
-
-    @Override public String toString() {
-        final StringBuilder builder = new StringBuilder();
-        final long bptr = buffer.bufferPtr;
-
-        for(long i = bptr; i < bptr + ARG_VALS_OFFSET; i += JObjCRuntime.PTR_LEN){
-            if(argPtrsPtr == i)
-                builder.append("*");
-            builder.append(PrimitivePointerCoder.INST.popPtr(JObjCRuntime.inst(), i));
-            builder.append(" ");
-        }
-
-        builder.append("\n");
-
-        for(long i = bptr + ARG_VALS_OFFSET; i < bptr + BUF_SIZE; i += JObjCRuntime.PTR_LEN){
-            if(argValuesPtr == i)
-                builder.append("*");
-            builder.append(PrimitivePointerCoder.INST.popPtr(JObjCRuntime.inst(), i));
-            builder.append(" ");
-        }
-
-        return builder.toString();
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java
deleted file mode 100644
index 8630971c206..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-
-/**
- * A wrapper around a direct ByteBuffer and its native pointer. For documentation, @see java.nio.ByteBuffer
- */
-public class NativeBuffer {
-    static native long getPtrOfBuffer(final ByteBuffer byteBuffer);
-
-    public final ByteBuffer buffer;
-    public final long bufferPtr;
-
-    public NativeBuffer(final int capacity){
-        this(ByteBuffer.allocateDirect(capacity));
-    }
-
-    /**
-     * Wrap a ByteBuffer and set the ByteOrder to nativeOrder.
-     */
-    public NativeBuffer(ByteBuffer buffer){
-        this.buffer = buffer;
-        this.bufferPtr = getPtrOfBuffer(buffer);
-        assert buffer != null;
-        assert bufferPtr != 0;
-        this.buffer.order(ByteOrder.nativeOrder());
-    }
-
-    public byte   get() { return buffer.get(); }
-    public char   getChar() { return buffer.getChar(); }
-    public double getDouble() { return buffer.getDouble(); }
-    public float  getFloat() { return buffer.getFloat(); }
-    public int    getInt() { return buffer.getInt(); }
-    public long   getLong() { return buffer.getLong(); }
-    public short  getShort() { return buffer.getShort(); }
-    public NativeBuffer put(byte b) { buffer.put(b); return this; }
-    public NativeBuffer put(NativeBuffer src) { buffer.put(src.buffer); return this; }
-    public NativeBuffer putChar(char c) { buffer.putChar(c); return this; }
-    public NativeBuffer putDouble(double d) { buffer.putDouble(d); return this; }
-    public NativeBuffer putFloat(float f) { buffer.putFloat(f); return this; }
-    public NativeBuffer putInt(int i) { buffer.putInt(i); return this; }
-    public NativeBuffer putLong(long l) { buffer.putLong(l); return this; }
-    public NativeBuffer putShort(short s) { buffer.putShort(s); return this; }
-
-    public int capacity() { return buffer.capacity(); }
-    public int position() { return buffer.position(); }
-    public NativeBuffer position(int newPosition) { buffer.position(newPosition); return this; }
-    public NativeBuffer rewind(){ buffer.rewind(); return this; }
-
-    public int limit() { return buffer.limit(); }
-    public NativeBuffer limit(final int sizeof) { buffer.limit(sizeof); return this; }
-
-    public int remaining() { return buffer.remaining(); }
-
-    public NativeBuffer slice(){ return new NativeBuffer(buffer.slice()); }
-
-    @Override public String toString() {
-        final StringBuilder builder = new StringBuilder();
-
-        for(int i = 0; i < limit(); i += JObjCRuntime.PTR_LEN){
-            if(position() == i)
-                builder.append("*");
-            if(JObjCRuntime.IS32)
-                builder.append(buffer.getInt(i));
-            else
-                builder.append(buffer.getLong(i));
-            builder.append(" ");
-        }
-
-        return builder.toString();
-    }
-
-    public long positionPtr() {
-        return bufferPtr + position();
-    }
-
-    /**
-     * bufferPtr <= ptr && ptr < bufferPtr + capacity();
-     */
-    public boolean ptrInBounds(final long ptr){
-        return bufferPtr <= ptr && ptr < bufferPtr + capacity();
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java
deleted file mode 100644
index 993be3337fe..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-public abstract class NativeObjectLifecycleManager {
-    private static native void retainNativeObject(final long ptr);
-    private static native void releaseNativeObject(final long ptr);
-    private static native void freeNativeObject(final long ptr);
-
-    abstract void begin(final long ptr);
-    abstract void end(final long ptr);
-    boolean shouldPreRetain() { return false; }
-
-    public static class CFRetainRelease extends NativeObjectLifecycleManager {
-        public static final NativeObjectLifecycleManager INST = new CFRetainRelease();
-        @Override void begin(final long ptr) { retainNativeObject(ptr); }
-        @Override void end(final long ptr) { releaseNativeObject(ptr); }
-        @Override boolean shouldPreRetain() { return true; }
-    }
-
-    public static class Free extends NativeObjectLifecycleManager {
-        public static final NativeObjectLifecycleManager INST = new Free();
-        @Override void begin(final long ptr) { }
-        @Override void end(final long ptr) { freeNativeObject(ptr); }
-    }
-
-    public static class Nothing extends NativeObjectLifecycleManager {
-        public static final NativeObjectLifecycleManager INST = new Nothing();
-        @Override void begin(final long ptr) { }
-        @Override void end(final long ptr) { }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java
deleted file mode 100644
index fe6684833e0..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-public class Opaque extends Pointer<Void> {
-    protected Opaque(long ptr) { super(ptr); }
-    protected Opaque(Pointer<?> ptr) { super(ptr.ptr); }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java
deleted file mode 100644
index d5b83b93930..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-public class Pointer <T> implements Comparable<Pointer<T>>{
-    long ptr;
-
-    protected Pointer(final long ptr) {
-        this.ptr = ptr;
-        getNativeObjectLifecycleManager().begin(ptr);
-    }
-
-    @Override protected final synchronized void finalize() throws Throwable {
-        long pptr = ptr;
-        ptr = 0;
-        if (pptr != 0) getNativeObjectLifecycleManager().end(pptr);
-    }
-
-    protected NativeObjectLifecycleManager getNativeObjectLifecycleManager() {
-        return NativeObjectLifecycleManager.Nothing.INST;
-    }
-
-    @Override public boolean equals(Object o) {
-        return o instanceof Pointer && ptr == ((Pointer) o).ptr;
-    }
-
-    @Override public int hashCode() { return (int)(ptr^(ptr>>>32)); }
-
-    public int compareTo(Pointer<T> o) {
-        if(this==o || ptr==o.ptr) return 0;
-        if(ptr < o.ptr) return -1;
-        return 1;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java
deleted file mode 100644
index eab34a7e6af..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java
+++ /dev/null
@@ -1,700 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-import com.apple.jobjc.JObjCRuntime.Width;
-// Auto generated by PrimitiveCoder.hs
-// Do not edit by hand.
-public abstract class PrimitiveCoder<T> extends Coder<T>{
-    public PrimitiveCoder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim){
-        super(ffiTypeCode, objCEncoding, jclass, jprim);
-    }
-    public final boolean popBoolean(NativeArgumentBuffer args){
-        return popBoolean(args.runtime, args.retValPtr);
-    }
-    public abstract boolean popBoolean(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, boolean x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, boolean x);
-
-
-    public final byte popByte(NativeArgumentBuffer args){
-        return popByte(args.runtime, args.retValPtr);
-    }
-    public abstract byte popByte(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, byte x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, byte x);
-
-
-    public final char popChar(NativeArgumentBuffer args){
-        return popChar(args.runtime, args.retValPtr);
-    }
-    public abstract char popChar(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, char x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, char x);
-
-
-    public final short popShort(NativeArgumentBuffer args){
-        return popShort(args.runtime, args.retValPtr);
-    }
-    public abstract short popShort(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, short x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, short x);
-
-
-    public final int popInt(NativeArgumentBuffer args){
-        return popInt(args.runtime, args.retValPtr);
-    }
-    public abstract int popInt(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, int x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, int x);
-
-
-    public final long popLong(NativeArgumentBuffer args){
-        return popLong(args.runtime, args.retValPtr);
-    }
-    public abstract long popLong(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, long x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, long x);
-
-
-    public final float popFloat(NativeArgumentBuffer args){
-        return popFloat(args.runtime, args.retValPtr);
-    }
-    public abstract float popFloat(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, float x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, float x);
-
-
-    public final double popDouble(NativeArgumentBuffer args){
-        return popDouble(args.runtime, args.retValPtr);
-    }
-    public abstract double popDouble(JObjCRuntime runtime, long addr);
-
-    public final void push(NativeArgumentBuffer args, double x){
-        push(args.runtime, args.argValuesPtr, x);
-        args.didPutArgValue(sizeof());
-    }
-    public abstract void push(JObjCRuntime runtime, long addr, double x);
-
-
-// native BOOL -> java boolean
-public static final class BoolCoder extends PrimitiveCoder<Boolean>{
-    public static final BoolCoder INST = new BoolCoder();
-    public BoolCoder(){ super(FFI_SINT8, "B", Boolean.class, boolean.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){
-        rt.unsafe.putByte(addr, (byte) (x ? 1 : 0));
-    }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){
-        return rt.unsafe.getByte(addr) != 0;
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 1;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Boolean x){ push(rt, addr, (boolean) x); }
-    @Override public Boolean pop(JObjCRuntime rt, long addr){ return popBoolean(rt, addr); }
-    // proxies for mixed encoding
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, (x != 0)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)(popBoolean(rt, addr) ? 1 : 0)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, (x != 0)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)(popBoolean(rt, addr) ? 1 : 0)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, (x != 0)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)(popBoolean(rt, addr) ? 1 : 0)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, (x != 0)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)(popBoolean(rt, addr) ? 1 : 0)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, (x != 0)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)(popBoolean(rt, addr) ? 1 : 0)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, (x != 0)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)(popBoolean(rt, addr) ? 1 : 0)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, (x != 0)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)(popBoolean(rt, addr) ? 1 : 0)); }
-
-
-}
-
-// native schar -> java byte
-public static final class SCharCoder extends PrimitiveCoder<Byte>{
-    public static final SCharCoder INST = new SCharCoder();
-    public SCharCoder(){ super(FFI_SINT8, "c", Byte.class, byte.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, byte x){
-        rt.unsafe.putByte(addr, x);
-    }
-    @Override public byte popByte(JObjCRuntime rt, long addr){
-        return rt.unsafe.getByte(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 1;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Byte x){ push(rt, addr, (byte) x); }
-    @Override public Byte pop(JObjCRuntime rt, long addr){ return popByte(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((byte)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popByte(rt, addr) != 0); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((byte)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((byte)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((byte)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((byte)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((byte)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((byte)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popByte(rt, addr)); }
-
-
-}
-
-// native uchar -> java byte
-public static final class UCharCoder extends PrimitiveCoder<Byte>{
-    public static final UCharCoder INST = new UCharCoder();
-    public UCharCoder(){ super(FFI_UINT8, "C", Byte.class, byte.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, byte x){
-        rt.unsafe.putByte(addr, x);
-    }
-    @Override public byte popByte(JObjCRuntime rt, long addr){
-        return rt.unsafe.getByte(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 1;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Byte x){ push(rt, addr, (byte) x); }
-    @Override public Byte pop(JObjCRuntime rt, long addr){ return popByte(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((byte)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popByte(rt, addr) != 0); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((byte)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((byte)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((byte)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((byte)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((byte)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popByte(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((byte)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popByte(rt, addr)); }
-
-
-}
-
-// native sshort -> java short
-public static final class SShortCoder extends PrimitiveCoder<Short>{
-    public static final SShortCoder INST = new SShortCoder();
-    public SShortCoder(){ super(FFI_SINT16, "s", Short.class, short.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, short x){
-        rt.unsafe.putShort(addr, (short) x);
-    }
-    @Override public short popShort(JObjCRuntime rt, long addr){
-        return rt.unsafe.getShort(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 2;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Short x){ push(rt, addr, (short) x); }
-    @Override public Short pop(JObjCRuntime rt, long addr){ return popShort(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((short)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popShort(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((short)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((short)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popShort(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((short)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((short)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((short)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((short)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popShort(rt, addr)); }
-
-
-}
-
-// native ushort -> java short
-public static final class UShortCoder extends PrimitiveCoder<Short>{
-    public static final UShortCoder INST = new UShortCoder();
-    public UShortCoder(){ super(FFI_UINT16, "S", Short.class, short.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, short x){
-        rt.unsafe.putShort(addr, (short) x);
-    }
-    @Override public short popShort(JObjCRuntime rt, long addr){
-        return rt.unsafe.getShort(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 2;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Short x){ push(rt, addr, (short) x); }
-    @Override public Short pop(JObjCRuntime rt, long addr){ return popShort(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((short)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popShort(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((short)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((short)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popShort(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((short)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((short)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((short)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popShort(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((short)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popShort(rt, addr)); }
-
-
-}
-
-// native sint -> java int
-public static final class SIntCoder extends PrimitiveCoder<Integer>{
-    public static final SIntCoder INST = new SIntCoder();
-    public SIntCoder(){ super(FFI_SINT32, "i", Integer.class, int.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, int x){
-        rt.unsafe.putInt(addr, (int) x);
-    }
-    @Override public int popInt(JObjCRuntime rt, long addr){
-        return rt.unsafe.getInt(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 4;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Integer x){ push(rt, addr, (int) x); }
-    @Override public Integer pop(JObjCRuntime rt, long addr){ return popInt(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((int)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popInt(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((int)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((int)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((int)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popInt(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((int)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((int)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((int)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popInt(rt, addr)); }
-
-
-}
-
-// native uint -> java int
-public static final class UIntCoder extends PrimitiveCoder<Integer>{
-    public static final UIntCoder INST = new UIntCoder();
-    public UIntCoder(){ super(FFI_UINT32, "I", Integer.class, int.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, int x){
-        rt.unsafe.putInt(addr, (int) x);
-    }
-    @Override public int popInt(JObjCRuntime rt, long addr){
-        return rt.unsafe.getInt(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 4;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Integer x){ push(rt, addr, (int) x); }
-    @Override public Integer pop(JObjCRuntime rt, long addr){ return popInt(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((int)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popInt(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((int)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((int)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((int)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popInt(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((int)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((int)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popInt(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((int)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popInt(rt, addr)); }
-
-
-}
-
-// native slong -> java long
-public static final class SLongCoder extends PrimitiveCoder<Long>{
-    public static final SLongCoder INST = new SLongCoder();
-    public SLongCoder(){ super((JObjCRuntime.IS64 ? (FFI_SINT64) : (FFI_SINT32)), "l", Long.class, long.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, long x){
-        if(JObjCRuntime.IS64){ rt.unsafe.putLong(addr, (long) x); }else{ rt.unsafe.putInt(addr, (int) x); }
-    }
-    @Override public long popLong(JObjCRuntime rt, long addr){
-        return (JObjCRuntime.IS64 ? (rt.unsafe.getLong(addr)) : (rt.unsafe.getInt(addr)));
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        switch(w){
-            case W32: return 4;
-            case W64: return 8;
-
-        default: return -1;
-        }
-
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Long x){ push(rt, addr, (long) x); }
-    @Override public Long pop(JObjCRuntime rt, long addr){ return popLong(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((long)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popLong(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((long)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((long)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((long)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((long)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popLong(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((long)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((long)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popLong(rt, addr)); }
-
-
-}
-
-// native ulong -> java long
-public static final class ULongCoder extends PrimitiveCoder<Long>{
-    public static final ULongCoder INST = new ULongCoder();
-    public ULongCoder(){ super((JObjCRuntime.IS64 ? (FFI_UINT64) : (FFI_UINT32)), "L", Long.class, long.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, long x){
-        if(JObjCRuntime.IS64){ rt.unsafe.putLong(addr, (long) x); }else{ rt.unsafe.putInt(addr, (int) x); }
-    }
-    @Override public long popLong(JObjCRuntime rt, long addr){
-        return (JObjCRuntime.IS64 ? (rt.unsafe.getLong(addr)) : (rt.unsafe.getInt(addr)));
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        switch(w){
-            case W32: return 4;
-            case W64: return 8;
-
-        default: return -1;
-        }
-
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Long x){ push(rt, addr, (long) x); }
-    @Override public Long pop(JObjCRuntime rt, long addr){ return popLong(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((long)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popLong(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((long)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((long)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((long)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((long)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popLong(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((long)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((long)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popLong(rt, addr)); }
-
-
-}
-
-// native slonglong -> java long
-public static final class SLongLongCoder extends PrimitiveCoder<Long>{
-    public static final SLongLongCoder INST = new SLongLongCoder();
-    public SLongLongCoder(){ super(FFI_SINT64, "q", Long.class, long.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, long x){
-        rt.unsafe.putLong(addr, (long) x);
-    }
-    @Override public long popLong(JObjCRuntime rt, long addr){
-        return rt.unsafe.getLong(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 8;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Long x){ push(rt, addr, (long) x); }
-    @Override public Long pop(JObjCRuntime rt, long addr){ return popLong(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((long)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popLong(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((long)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((long)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((long)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((long)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popLong(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((long)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((long)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popLong(rt, addr)); }
-
-
-}
-
-// native ulonglong -> java long
-public static final class ULongLongCoder extends PrimitiveCoder<Long>{
-    public static final ULongLongCoder INST = new ULongLongCoder();
-    public ULongLongCoder(){ super(FFI_UINT64, "Q", Long.class, long.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, long x){
-        rt.unsafe.putLong(addr, (long) x);
-    }
-    @Override public long popLong(JObjCRuntime rt, long addr){
-        return rt.unsafe.getLong(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 8;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Long x){ push(rt, addr, (long) x); }
-    @Override public Long pop(JObjCRuntime rt, long addr){ return popLong(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((long)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popLong(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((long)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((long)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((long)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((long)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popLong(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((long)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popLong(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((long)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popLong(rt, addr)); }
-
-
-}
-
-// native float -> java float
-public static final class FloatCoder extends PrimitiveCoder<Float>{
-    public static final FloatCoder INST = new FloatCoder();
-    public FloatCoder(){ super(FFI_FLOAT, "f", Float.class, float.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, float x){
-        rt.unsafe.putFloat(addr, (float) x);
-    }
-    @Override public float popFloat(JObjCRuntime rt, long addr){
-        return rt.unsafe.getFloat(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 4;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Float x){ push(rt, addr, (float) x); }
-    @Override public Float pop(JObjCRuntime rt, long addr){ return popFloat(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((float)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popFloat(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((float)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popFloat(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((float)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popFloat(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((float)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popFloat(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((float)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popFloat(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((float)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popFloat(rt, addr)); }
-
-
-    @Override public void push(JObjCRuntime rt, long addr, double x){ push(rt, addr, ((float)x)); }
-    @Override public double popDouble(JObjCRuntime rt, long addr){ return ((double)popFloat(rt, addr)); }
-
-
-}
-
-// native double -> java double
-public static final class DoubleCoder extends PrimitiveCoder<Double>{
-    public static final DoubleCoder INST = new DoubleCoder();
-    public DoubleCoder(){ super(FFI_DOUBLE, "d", Double.class, double.class); }
-    // compile time
-    @Override public void push(JObjCRuntime rt, long addr, double x){
-        rt.unsafe.putDouble(addr, (double) x);
-    }
-    @Override public double popDouble(JObjCRuntime rt, long addr){
-        return rt.unsafe.getDouble(addr);
-    }
-    // for runtime coding
-    @Override public int sizeof(Width w){
-        return 8;
-    }
-    @Override public void push(JObjCRuntime rt, long addr, Double x){ push(rt, addr, (double) x); }
-    @Override public Double pop(JObjCRuntime rt, long addr){ return popDouble(rt, addr); }
-    // proxies for mixed encoding
-    @Override public void push(JObjCRuntime rt, long addr, boolean x){ push(rt, addr, ((double)(x ? 1 : 0))); }
-    @Override public boolean popBoolean(JObjCRuntime rt, long addr){ return (popDouble(rt, addr) != 0); }
-
-    @Override public void push(JObjCRuntime rt, long addr, byte x){ push(rt, addr, ((double)x)); }
-    @Override public byte popByte(JObjCRuntime rt, long addr){ return ((byte)popDouble(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, char x){ push(rt, addr, ((double)x)); }
-    @Override public char popChar(JObjCRuntime rt, long addr){ return ((char)popDouble(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, short x){ push(rt, addr, ((double)x)); }
-    @Override public short popShort(JObjCRuntime rt, long addr){ return ((short)popDouble(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, int x){ push(rt, addr, ((double)x)); }
-    @Override public int popInt(JObjCRuntime rt, long addr){ return ((int)popDouble(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, long x){ push(rt, addr, ((double)x)); }
-    @Override public long popLong(JObjCRuntime rt, long addr){ return ((long)popDouble(rt, addr)); }
-
-    @Override public void push(JObjCRuntime rt, long addr, float x){ push(rt, addr, ((double)x)); }
-    @Override public float popFloat(JObjCRuntime rt, long addr){ return ((float)popDouble(rt, addr)); }
-
-
-
-}
-
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java
deleted file mode 100644
index 7e085f8d54d..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-public class SEL {
-    static native long getSelectorPtr(String selectorName);
-    static native String getSelectorName(long ptr);
-
-    final long selPtr;
-
-    SEL(long ptr) {
-        this.selPtr = ptr;
-    }
-
-    public SEL(final String name) {
-        this(getSelectorPtr(name));
-    }
-
-    @Override public String toString(){
-        return ((int)selPtr) + " / " + selPtr + " : " + getSelectorName(selPtr);
-    }
-
-    /**
-     * Converts something like "performSelectorOnMainThread_withObject_wait"
-     * to "performSelectorOnMainThread:withObject:wait:"
-     */
-    public static String selectorName(String jMethodName, boolean hasArgs){
-        String b = jMethodName.replaceAll("_", ":");
-        return hasArgs ? b + ":" : b;
-    }
-
-    public static String jMethodName(String selectorName){
-        return selectorName.replaceAll(":", "_").replaceAll("_$", "");
-    }
-
-    public static boolean validName(String selectorName){
-        return selectorName.matches("^[a-zA-Z_][a-zA-Z0-9_:]*$");
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java
deleted file mode 100644
index b14e84dcaca..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-/**
- * A struct is malloced on the C heap and accessed in Java through a ByteBuffer.
- */
-public abstract class Struct{
-    protected final NativeBuffer raw;
-    private final JObjCRuntime runtime;
-    protected final JObjCRuntime getRuntime(){ return runtime; }
-
-    /**
-     * Create a brand new struct from nothing.
-     */
-    protected Struct(final JObjCRuntime runtime, final int SIZEOF){
-        this(runtime, new NativeBuffer(SIZEOF), SIZEOF);
-    }
-
-    /**
-     * Create a struct by taking ownership of an existing buffer.
-     * Used for struct fields of type struct. For example, the origin and size fields
-     * in NSRect would be initialized with this constructor.
-     */
-    protected Struct(final JObjCRuntime runtime, final NativeBuffer buffer, final int SIZEOF){
-        if(runtime == null) throw new NullPointerException("runtime");
-        this.runtime = runtime;
-        this.raw = buffer;
-        this.raw.limit(SIZEOF);
-    }
-
-    abstract public Coder getCoder();
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java
deleted file mode 100644
index c0e72b13e33..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.io.StringWriter;
-import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-import com.apple.jobjc.Coder.VoidCoder;
-import com.apple.jobjc.Invoke.MsgSend;
-
-
-final class Subclassing {
-    static native long allocateClassPair(long superClass, String name);
-    static native boolean addIVarForJObj(long clazz);
-    static native boolean patchAlloc(long classPtr);
-    static native boolean addMethod(long cls, String name, Method jMethod, CIF cif, long cifPtr, String objCEncodedType);
-    static native void registerClassPair(long clazz);
-
-    static native <T extends ID> T getJObjectFromIVar(long objPtr);
-    static native void initJObjectToIVar(long objPtr, ID object);
-
-    final Set<Long> registeredUserSubclasses = new HashSet<Long>();
-    final JObjCRuntime runtime;
-
-    Subclassing(JObjCRuntime runtime){
-        this.runtime = runtime;
-    }
-
-    boolean registerUserClass(final Class<? extends ID> clazz, final Class<? extends NSClass> clazzClazz) {
-        final String nativeClassName = clazz.getSimpleName();
-        // Is it already registered?
-        if(0 != NSClass.getNativeClassByName(nativeClassName))
-            return false;
-
-        if(clazz.isAnonymousClass())
-            throw new RuntimeException("JObjC cannot register anonymous classes.");
-
-        // Verify superclass
-        long superClass = NSClass.getNativeClassByName(clazz.getSuperclass().getSimpleName());
-        if(0 == superClass)
-            throw new RuntimeException(clazz.getSuperclass() + ", the superclass of " + clazz + ", must be a registered class.");
-
-        runtime.registerPackage(clazz.getPackage().getName());
-
-        // Create class
-        long classPtr = Subclassing.allocateClassPair(superClass, nativeClassName);
-        if(classPtr == 0) throw new RuntimeException("objc_allocateClassPair returned 0.");
-
-        // Add ivar to hold jobject
-        boolean addedI = Subclassing.addIVarForJObj(classPtr);
-        if(!addedI) throw new RuntimeException("class_addIvar returned false.");
-
-        // Verify constructor
-        try {
-            clazz.getConstructor(ID.CTOR_ARGS);
-        } catch (Exception e) {
-            throw new RuntimeException("Could not access required constructor: " + ID.CTOR_ARGS, e);
-        }
-
-        // Patch alloc to create corresponding jobject on invoke
-        patchAlloc(classPtr);
-
-        // Add methods
-        Set<String> takenSelNames = new HashSet<String>();
-        for(Method method : clazz.getDeclaredMethods()){
-            // No overloading
-            String selName = SEL.selectorName(method.getName(), method.getParameterTypes().length > 0);
-            if(takenSelNames.contains(selName))
-                throw new RuntimeException("Obj-C does not allow method overloading. The Objective-C selector '"
-                        + selName + "' appears more than once in class " + clazz.getCanonicalName() + " / " + nativeClassName + ".");
-
-            method.setAccessible(true);
-
-            // Divine CIF
-            Coder returnCoder = Coder.getCoderAtRuntimeForType(method.getReturnType());
-            Class[] paramTypes = method.getParameterTypes();
-            Coder[] argCoders = new Coder[paramTypes.length];
-            for(int i = 0; i < paramTypes.length; i++)
-                argCoders[i] = Coder.getCoderAtRuntimeForType(paramTypes[i]);
-
-            CIF cif = new MsgSend(runtime, selName, returnCoder, argCoders).funCall.cif;
-
-            // .. and objc encoding
-            StringWriter encType = new StringWriter();
-            encType.append(returnCoder.getObjCEncoding());
-            encType.append("@:");
-            for(int i = 0; i < argCoders.length; i++)
-                encType.append(argCoders[i].getObjCEncoding());
-
-            // Add it!
-            boolean addedM = Subclassing.addMethod(classPtr, selName, method, cif, cif.cif.bufferPtr, encType.toString());
-            if(!addedM) throw new RuntimeException("Failed to add method.");
-            takenSelNames.add(selName);
-        }
-
-        // Seal it
-        Subclassing.registerClassPair(classPtr);
-        registeredUserSubclasses.add(classPtr);
-
-        return true;
-    }
-
-    boolean isUserClass(long clsPtr) {
-        return registeredUserSubclasses.contains(clsPtr);
-    }
-
-    // Called from JNI
-
-    private static void initJObject(final long objPtr){
-//        System.err.println("initJObject " + objPtr + " / " + Long.toHexString(objPtr));
-        ID newObj = ID.createNewObjCObjectFor(JObjCRuntime.inst(), objPtr, NSClass.getClass(objPtr));
-//        System.err.println("... " + newObj);
-        initJObjectToIVar(objPtr, newObj);
-    }
-
-    private static void invokeFromJNI(ID obj, Method method, CIF cif, long result, long args){
-        assert obj != null;
-        assert obj.getClass().equals(method.getDeclaringClass()) :
-            obj.getClass().toString() + " != " + method.getDeclaringClass().toString();
-
-        final int argCount = method.getParameterTypes().length;
-
-        // The first two args & coders are for objc id and sel. Skip them.
-        final Object[] argObjects = new Object[argCount];
-        for(int i = 0; i < argCount; i++){
-            final long argAddrAddr = args + ((i+2) * JObjCRuntime.PTR_LEN);
-            final long argAddr = PrimitivePointerCoder.INST.popPtr(obj.runtime, argAddrAddr);
-            argObjects[i] = cif.argCoders[i + 2].pop(obj.runtime, argAddr);
-        }
-
-        Object retVal;
-        try {
-            retVal = method.invoke(obj, argObjects);
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new RuntimeException(e);
-        }
-
-        if(!(cif.returnCoder instanceof VoidCoder))
-            cif.returnCoder.push(obj.runtime, result, retVal);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/CIF.m b/jdk/src/macosx/native/jobjc/src/core/native/CIF.m
deleted file mode 100644
index 7aa4dd542a5..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/CIF.m
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_CIF.h"
-
-#define MACOSX
-#include <ffi/ffi.h>
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-#include "NativeBuffer.h"
-
-JNIEXPORT jint JNICALL Java_com_apple_jobjc_CIF_getSizeofCIF
-(JNIEnv *env, jclass clazz)
-{
-    return (jint) sizeof(ffi_cif);
-}
-
-JNIEXPORT jboolean JNICALL Java_com_apple_jobjc_CIF_prepCIF
-(JNIEnv *env, jclass clazz, jlong jCIFPtr, jint jNargs, jlong jRetTypePtr, jlong jArgsPtr)
-{
-    ffi_cif *cif = jlong_to_ptr(jCIFPtr);
-    unsigned int nargs = jNargs;
-    ffi_type *rtype = jlong_to_ptr(jRetTypePtr);
-    ffi_type **atypes = jlong_to_ptr(jArgsPtr);
-
-//    NSLog(@"rtype->(size: %d, alignment: %d, type: %d)", rtype->size, rtype->alignment, rtype->type);
-    return (jboolean) (FFI_OK == ffi_prep_cif(cif, FFI_DEFAULT_ABI, nargs, rtype, atypes));
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/Coder.m b/jdk/src/macosx/native/jobjc/src/core/native/Coder.m
deleted file mode 100644
index af3553949bf..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/Coder.m
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_Coder.h"
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-#define MACOSX
-#include <ffi/ffi.h>
-#include <AppKit/AppKit.h>
-
-/*
- * Class:     com_apple_jobjc_Coder
- * Method:    getNativeFFITypeCodeForCode
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_Coder_getNativeFFITypePtrForCode
-(JNIEnv *env, jclass clazz, jint code)
-{
-    switch ((long)code) {
-        case com_apple_jobjc_Coder_FFI_VOID:        return ptr_to_jlong(&ffi_type_void);
-        case com_apple_jobjc_Coder_FFI_PTR:            return ptr_to_jlong(&ffi_type_pointer);
-        case com_apple_jobjc_Coder_FFI_SINT8:        return ptr_to_jlong(&ffi_type_sint8);
-        case com_apple_jobjc_Coder_FFI_UINT8:        return ptr_to_jlong(&ffi_type_uint8);
-        case com_apple_jobjc_Coder_FFI_SINT16:        return ptr_to_jlong(&ffi_type_sint16);
-        case com_apple_jobjc_Coder_FFI_UINT16:        return ptr_to_jlong(&ffi_type_uint16);
-        case com_apple_jobjc_Coder_FFI_SINT32:        return ptr_to_jlong(&ffi_type_sint32);
-        case com_apple_jobjc_Coder_FFI_UINT32:        return ptr_to_jlong(&ffi_type_uint32);
-        case com_apple_jobjc_Coder_FFI_SINT64:        return ptr_to_jlong(&ffi_type_sint64);
-        case com_apple_jobjc_Coder_FFI_UINT64:        return ptr_to_jlong(&ffi_type_uint64);
-        case com_apple_jobjc_Coder_FFI_FLOAT:        return ptr_to_jlong(&ffi_type_float);
-        case com_apple_jobjc_Coder_FFI_DOUBLE:        return ptr_to_jlong(&ffi_type_double);
-        case com_apple_jobjc_Coder_FFI_LONGDOUBLE:    return ptr_to_jlong(&ffi_type_longdouble);
-    }
-
-    return ptr_to_jlong(NULL);
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/FFIType.m b/jdk/src/macosx/native/jobjc/src/core/native/FFIType.m
deleted file mode 100644
index 731397e1a01..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/FFIType.m
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-#include <ffi/ffi.h>
-
-#include "com_apple_jobjc_FFIType.h"
-
-JNIEXPORT void JNICALL Java_com_apple_jobjc_FFIType_makeFFIType
-(JNIEnv *env, jclass clazz, jlong ffi_type_jlong, jlong ffi_type_elements_jlong)
-{
-    ffi_type *type = jlong_to_ptr(ffi_type_jlong);
-    type->elements = jlong_to_ptr(ffi_type_elements_jlong);
-    type->type = FFI_TYPE_STRUCT;
-    type->size = type->alignment = 0;
-}
-
-JNIEXPORT jint JNICALL Java_com_apple_jobjc_FFIType_getFFITypeSizeof
-(JNIEnv *env, jclass clazz)
-{
-    return (jint) sizeof(ffi_type);
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/Function.m b/jdk/src/macosx/native/jobjc/src/core/native/Function.m
deleted file mode 100644
index 9060a0fd158..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/Function.m
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_Function.h"
-
-#define MACOSX
-#include <dlfcn.h>
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_Function_getFxnPtrForFunctionName
-(JNIEnv *env, jclass clazz, jstring fxnName)
-{
-    const char *functionName = (*env)->GetStringUTFChars(env, fxnName, NULL);
-    void *fxnPtr = dlsym(RTLD_SELF, functionName);
-    (*env)->ReleaseStringUTFChars(env, fxnName, functionName);
-    return ptr_to_jlong(fxnPtr);
-}
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_Function_getFxnPtrForFunctionNameAndLib
-(JNIEnv *env, jclass clazz, jlong frameworkPtr, jstring fxnName)
-{
-    void *frameworkHandle = jlong_to_ptr(frameworkPtr);
-
-    const char *functionName = (*env)->GetStringUTFChars(env, fxnName, NULL);
-    void *fxnPtr = dlsym(frameworkHandle, functionName);
-    (*env)->ReleaseStringUTFChars(env, fxnName, functionName);
-
-    return ptr_to_jlong(fxnPtr);
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/ID.m b/jdk/src/macosx/native/jobjc/src/core/native/ID.m
deleted file mode 100644
index 2e40a03fad2..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/ID.m
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_ID.h"
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-#include <objc/runtime.h>
-#include <objc/message.h>
-
-/*
- * Class:     com_apple_jobjc_ID
- * Method:    getNativeDescription
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_jobjc_ID_getNativeDescription
-(JNIEnv *env, jclass clazz, jlong objPtr)
-{
-    jstring ret = NULL;
-
-JNF_COCOA_ENTER(env);
-
-    NSString *desc = [((id)jlong_to_ptr(objPtr)) description];
-    ret = JNFNSToJavaString(env, desc);
-
-JNF_COCOA_EXIT(env);
-
-    return ret;
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/Invoke.m b/jdk/src/macosx/native/jobjc/src/core/native/Invoke.m
deleted file mode 100644
index 28a11d92d80..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/Invoke.m
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_Invoke_FunCall.h"
-#include <ffi/ffi.h>
-#include <objc/message.h>
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-JNIEXPORT void JNICALL Java_com_apple_jobjc_Invoke_00024FunCall_invoke
-(JNIEnv *env, jclass clazz, jlong cifPtr, jlong fxnPtr, jlong retValPtr, jlong argsPtr)
-{
-    ffi_cif *cif = jlong_to_ptr(cifPtr);
-    void *fxn    = jlong_to_ptr(fxnPtr);
-    void *retVal = jlong_to_ptr(retValPtr);
-    void **args  = jlong_to_ptr(argsPtr);
-
-    ffi_call(cif, fxn, retVal, args);
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m b/jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m
deleted file mode 100644
index dfb5b48676a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "Cocoa/Cocoa.h"
-
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/MacOSXFramework.m b/jdk/src/macosx/native/jobjc/src/core/native/MacOSXFramework.m
deleted file mode 100644
index 4609d79fdcd..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/MacOSXFramework.m
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_MacOSXFramework.h"
-
-#include <dlfcn.h>
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-/*
- * Class:     com_apple_jobjc_MacOSXFramework
- * Method:    retainFramework
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_MacOSXFramework_retainFramework
-(JNIEnv *env, jclass clazz, jstring frameworkName)
-{
-    if (frameworkName == NULL) return ptr_to_jlong(NULL);
-    const char *frameworkNameCStr = (*env)->GetStringUTFChars(env, frameworkName, JNI_FALSE);
-    const void *library = dlopen(frameworkNameCStr, RTLD_LOCAL);
-    (*env)->ReleaseStringUTFChars(env, frameworkName, frameworkNameCStr);
-    return ptr_to_jlong(library);
-}
-
-/*
- * Class:     com_apple_jobjc_MacOSXFramework
- * Method:    releaseFramework
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_apple_jobjc_MacOSXFramework_releaseFramework
-(JNIEnv *env, jclass clazz, jlong frameworkPtr)
-{
-    dlclose(jlong_to_ptr(frameworkPtr));
-}
-
-JNIEXPORT void JNICALL Java_com_apple_jobjc_MacOSXFramework_getConstant
-(JNIEnv *env, jclass clazz, jlong frameworkPtr, jstring constSymbol, jlong retBuffer, jint size)
-{
-    const char *symbol = (*env)->GetStringUTFChars(env, constSymbol, JNI_FALSE);
-    void *handle = frameworkPtr ? jlong_to_ptr(frameworkPtr) : RTLD_DEFAULT;
-    void *data = dlsym(handle, symbol);
-    (*env)->ReleaseStringUTFChars(env, constSymbol, symbol);
-
-    if(!data)
-        (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"), dlerror());
-    else
-        memcpy(jlong_to_ptr(retBuffer), data, (size_t) size);
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/NSClass.m b/jdk/src/macosx/native/jobjc/src/core/native/NSClass.m
deleted file mode 100644
index 8ae15e3a368..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/NSClass.m
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_NSClass.h"
-#include <objc/runtime.h>
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-/*
- * Class:     com_apple_jobjc_NSClass
- * Method:    getNativeClassByName
- * Signature: (JLjava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_NSClass_getNativeClassByName
-(JNIEnv *env, jclass clazz, jstring className)
-{
-    if (className == NULL) return ptr_to_jlong(NULL);
-    const char *classNameCStr = (*env)->GetStringUTFChars(env, className, JNI_FALSE);
-    const id obj = objc_getClass(classNameCStr);
-    (*env)->ReleaseStringUTFChars(env, className, classNameCStr);
-
-    if (obj == nil) return ptr_to_jlong(NULL);
-    return ptr_to_jlong(obj);
-}
-
-/*
- * Class:     com_apple_jobjc_NSClass
- * Method:    getSuperClass
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_NSClass_getSuperClassOfClass
-(JNIEnv *env, jclass clazz, jlong clazzPtr)
-{
-    if (clazzPtr == 0L) return ptr_to_jlong(NULL);
-    const Class objClazz = (Class)jlong_to_ptr(clazzPtr);
-    return ptr_to_jlong(class_getSuperclass(objClazz));
-}
-
-/*
- * Class:     com_apple_jobjc_NSClass
- * Method:    getClassName
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_jobjc_NSClass_getClassNameOfClass
-(JNIEnv *env, jclass clazz, jlong clazzPtr)
-{
-    const char *clazzName = (char *)class_getName((Class)jlong_to_ptr(clazzPtr));
-    return (*env)->NewStringUTF(env, clazzName);
-}
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_NSClass_getClass
-(JNIEnv *env, jclass clazz, jlong objPtr)
-{
-    id obj = (id)jlong_to_ptr(objPtr);
-    return ptr_to_jlong(object_getClass(obj));
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.h b/jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.h
deleted file mode 100644
index 0fafa6ef3a8..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *  NativeBuffer.h
- *  Copyright 2007 Apple Inc. All rights reserved.
- *
- */
-
-#define BUFFER_AT(buffer, offset)                (((UInt8 *)buffer) + offset)
-#define GET_VALUE(type, buffer, offset)            (*((type *)BUFFER_AT(buffer, offset)))
-#define PUT_VALUE(type, buffer, offset, value)    (*((type *)BUFFER_AT(buffer, offset)) = value)
-
-#define GET_INT_AT(buffer, offset)                GET_VALUE(jint, buffer, offset)
-#define GET_LONG_AT(buffer, offset)                GET_VALUE(jlong, buffer, offset)
-
-#define PUT_INT_AT(buffer, offset, value)        PUT_VALUE(jint, buffer, offset, value)
-#define PUT_LONG_AT(buffer, offset, value)        PUT_VALUE(jlong, buffer, offset, value)
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.m b/jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.m
deleted file mode 100644
index 8f7b9b0fe01..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/NativeBuffer.m
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_NativeBuffer.h"
-
-#define MACOSX
-#include <ffi/ffi.h>
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_NativeBuffer_getPtrOfBuffer
-(JNIEnv *env, jclass clazz, jobject buffer)
-{
-    if (buffer == NULL) return ptr_to_jlong(0);
-    return ptr_to_jlong((*env)->GetDirectBufferAddress(env, buffer));
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/NativeObjectLifecycleManager.m b/jdk/src/macosx/native/jobjc/src/core/native/NativeObjectLifecycleManager.m
deleted file mode 100644
index 012f83a1d6a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/NativeObjectLifecycleManager.m
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_NativeObjectLifecycleManager.h"
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-
-/*
- * Class:     com_apple_jobjc_NativeObjectLifecycleManager
- * Method:    retainNativeObject
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_apple_jobjc_NativeObjectLifecycleManager_retainNativeObject
-(JNIEnv *env, jclass clazz, jlong ptr)
-{
-    if (ptr == 0L) return;
-    CFRetain(jlong_to_ptr(ptr));
-}
-
-/*
- * Class:     com_apple_jobjc_NativeObjectLifecycleManager
- * Method:    releaseNativeObject
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_apple_jobjc_NativeObjectLifecycleManager_releaseNativeObject
-(JNIEnv *env, jclass clazz, jlong ptr)
-{
-    if (ptr == 0L) return;
-    CFRelease(jlong_to_ptr(ptr));
-}
-
-/*
- * Class:     com_apple_jobjc_NativeObjectLifecycleManager
- * Method:    freeNativeObject
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_apple_jobjc_NativeObjectLifecycleManager_freeNativeObject
-(JNIEnv *env, jclass clazz, jlong ptr)
-{
-    if (ptr == 0L) return;
-    free(jlong_to_ptr(ptr));
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/SEL.m b/jdk/src/macosx/native/jobjc/src/core/native/SEL.m
deleted file mode 100644
index dc39ed10132..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/SEL.m
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_SEL.h"
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-#include <objc/message.h>
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_SEL_getSelectorPtr
-(JNIEnv *env, jclass jclazz, jstring selName)
-{
-    const char *selNameAsChars = (*env)->GetStringUTFChars(env, selName, JNI_FALSE);
-    const SEL sel = sel_registerName(selNameAsChars);
-    (*env)->ReleaseStringUTFChars(env, selName, selNameAsChars);
-    return ptr_to_jlong((void*)sel);
-}
-
-JNIEXPORT jstring JNICALL Java_com_apple_jobjc_SEL_getSelectorName
-(JNIEnv *env, jclass jclazz, jlong selPtr)
-{
-    return (*env)->NewStringUTF(env, sel_getName(jlong_to_ptr(selPtr)));
-}
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/Subclassing.m b/jdk/src/macosx/native/jobjc/src/core/native/Subclassing.m
deleted file mode 100644
index 0e9d4651db8..00000000000
--- a/jdk/src/macosx/native/jobjc/src/core/native/Subclassing.m
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_Subclassing.h"
-
-#include <math.h>
-#include <assert.h>
-#include <errno.h>
-
-#include <objc/runtime.h>
-#include <objc/message.h>
-
-#include <ffi/ffi.h>
-#include <sys/mman.h>
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-// Subclassing of Obj-C classes in Java
-//
-// See:
-//  - Objective-C Runtime documentation
-//  - man ffi_prep_closure
-//  - Subclassing.java
-
-
-#pragma mark Accessing object in IVar
-
-#define JOBJ_IVAR_NAME "jObjWrapper"
-static jobject getJObjectFromIVar(id obj);
-
-jobject getJObjectFromIVar(id obj)
-{
-    JNFJObjectWrapper *wrapper = NULL;
-    object_getInstanceVariable(obj, JOBJ_IVAR_NAME, (void**) &wrapper);
-    return wrapper ? [wrapper jObject] : NULL;
-}
-
-JNIEXPORT jobject JNICALL Java_com_apple_jobjc_Subclassing_getJObjectFromIVar
-(JNIEnv *env, jclass jClass, jlong jPtr)
-{
-    id obj = (id) jlong_to_ptr(jPtr);
-    if(obj == NULL){
-        (*env)->ThrowNew(env, (*env)->FindClass(env,
-            "java/lang/NullPointerException"), "obj");
-        return NULL;
-    }
-
-    JNFJObjectWrapper *wrapper;
-
-    if(!object_getInstanceVariable(obj, JOBJ_IVAR_NAME, (void**) &wrapper)){
-        NSLog(@"IVar '%s' not found. obj: %@", JOBJ_IVAR_NAME, obj);
-        (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"),
-            "Could not find instance variable that holds Java object.");
-        return NULL;
-    }
-
-    return wrapper ? [wrapper jObject] : NULL;
-}
-
-JNIEXPORT void JNICALL Java_com_apple_jobjc_Subclassing_initJObjectToIVar
-(JNIEnv *env, jclass jClass, jlong jPtr, jobject jObject)
-{
-    id obj = (id) jlong_to_ptr(jPtr);
-    JNFJObjectWrapper *wrapper = [[JNFJObjectWrapper alloc]
-        initWithJObject:jObject withEnv:env];
-    [wrapper retain];
-
-    if(!object_setInstanceVariable(obj, JOBJ_IVAR_NAME, wrapper)){
-        NSLog(@"IVar '%s' not found. obj: %@", JOBJ_IVAR_NAME, obj);
-        (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"),
-            "Could not find instance variable that holds Java object.");
-        return;
-    }
-}
-
-#pragma mark Registering class
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_Subclassing_allocateClassPair
-(JNIEnv *env, jclass clazz, jlong jSuperClass, jstring jName)
-{
-    const Class superClass = (Class)jlong_to_ptr(jSuperClass);
-    assert(superClass);
-
-    const char *name = (*env)->GetStringUTFChars(env, jName, JNI_FALSE);
-    const Class newClass = objc_allocateClassPair(superClass, name, 0);
-    (*env)->ReleaseStringUTFChars(env, jName, name);
-
-    return ptr_to_jlong(newClass);
-}
-
-JNIEXPORT jboolean JNICALL Java_com_apple_jobjc_Subclassing_addIVarForJObj
-(JNIEnv *env, jclass clazz, jlong jSynthClass)
-{
-    return class_addIvar(
-        jlong_to_ptr(jSynthClass),
-        JOBJ_IVAR_NAME,
-        sizeof(id),
-        (uint8_t)log2((double)sizeof(id)),
-        "@");
-}
-
-JNIEXPORT void JNICALL Java_com_apple_jobjc_Subclassing_registerClassPair
-(JNIEnv *env, jclass clazz, jlong jClass)
-{
-    Class c = jlong_to_ptr(jClass);
-//    NSLog(@"Registering class pair %p / %s", c, class_getName(c));
-    objc_registerClassPair(c);
-}
-
-
-#pragma mark Patching +alloc
-
-static id patchedAllocIMP(id obj, SEL sel);
-static void addJavaInstance(id obj);
-
-JNIEXPORT jboolean JNICALL Java_com_apple_jobjc_Subclassing_patchAlloc
-(JNIEnv *env, jclass clazz, jlong jNativeClass)
-{
-    Class metaClass = object_getClass(jlong_to_ptr(jNativeClass));
-    return class_addMethod(metaClass,
-       sel_registerName("alloc"),
-       (IMP) patchedAllocIMP,
-       "@@:");
-}
-
-static id patchedAllocIMP(id cls, SEL sel){
-    id inst = class_createInstance(cls, 0);
-    addJavaInstance(inst);
-    return inst;
-}
-
-static void addJavaInstance(id obj){
-//    NSLog(@"addJavaInstance %p", obj);
-//    NSLog(@"... calling up to Java");
-
-    static JNF_CLASS_CACHE(jc_Subclassing, "com/apple/jobjc/Subclassing");
-    static JNF_STATIC_MEMBER_CACHE(jm_Subclassing_initJObject,
-        jc_Subclassing,
-        "initJObject",
-        "(J)V");
-
-    JNFThreadContext threadWasAttached = JNFThreadDetachOnThreadDeath;
-    JNIEnv *env = JNFObtainEnv(&threadWasAttached);
-    JNFCallStaticVoidMethod(env, jm_Subclassing_initJObject,
-        ptr_to_jlong(obj));
-
-    JNFReleaseEnv(env, &threadWasAttached);
-}
-
-
-#pragma mark Adding methods
-
-static ffi_closure *make_closure(ffi_cif *cif, void *user_data);
-static void sel_closure_call(ffi_cif* cif, void* result, void** args, void* user_data);
-
-typedef struct closure_data_t{
-    JNFJObjectWrapper *jMethod;
-    JNFJObjectWrapper *jCIF;
-} closure_data_t;
-
-static ffi_closure *make_closure(ffi_cif *cif, void *user_data){
-    // Allocate a page to hold the closure with read and write permissions.
-    ffi_closure *closure;
-    if ((closure = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
-                        MAP_ANON | MAP_PRIVATE, -1, (off_t) 0)) == (void*)-1)
-    {
-        fprintf(stderr, "mmap failed with errno: %d", errno);
-        return NULL;
-    }
-
-    // Prepare the ffi_closure structure.
-    ffi_status status;
-    if ((status = ffi_prep_closure(closure, cif, sel_closure_call, (void *)user_data)) != FFI_OK)
-    {
-        fprintf(stderr, "ffi_prep_closure failed with ffi_status: %d", status);
-        munmap(closure, sizeof(ffi_closure));
-        return NULL;
-    }
-
-    // Ensure that the closure will execute on all architectures.
-    if (mprotect(closure, sizeof(closure), PROT_READ | PROT_EXEC) == -1)
-    {
-        fprintf(stderr, "mprotect failed with errno: %d", errno);
-        munmap(closure, sizeof(ffi_closure));
-        return NULL;
-    }
-    return closure;
-}
-
-JNIEXPORT jboolean JNICALL Java_com_apple_jobjc_Subclassing_addMethod
-(JNIEnv *env, jclass clazz, jlong jClass, jstring jSelName, jobject jMethod,
-    jobject jCIF, jlong jCIFPtr, jstring jObjCEncodedType)
-{
-    ffi_cif *cif = jlong_to_ptr(jCIFPtr);
-
-    closure_data_t *user_data = malloc(sizeof(closure_data_t));
-    user_data->jMethod = [[JNFJObjectWrapper alloc] initWithJObject:jMethod withEnv:env];
-    user_data->jCIF = [[JNFJObjectWrapper alloc] initWithJObject:jCIF withEnv:env];
-
-    ffi_closure *closure;;
-    if(!(closure = make_closure(cif, user_data))){
-        [user_data->jMethod release];
-        [user_data->jCIF release];
-        free(user_data);
-        return NO;
-    }
-
-    const Class objcClass = (Class)jlong_to_ptr(jClass);
-
-    const char *selName = (*env)->GetStringUTFChars(env, jSelName, JNI_FALSE);
-    const char *objCEncodedType = (*env)->GetStringUTFChars(env, jObjCEncodedType, JNI_FALSE);
-
-//    NSLog(@"Adding method '%s' :: '%s' to '%s' / %p",
-//        selName,
-//        objCEncodedType,
-//        class_getName(objcClass),
-//        objcClass);
-
-    BOOL ret = class_addMethod(objcClass, sel_registerName(selName), (IMP) closure, objCEncodedType);
-
-    (*env)->ReleaseStringUTFChars(env, jSelName, selName);
-    (*env)->ReleaseStringUTFChars(env, jObjCEncodedType, objCEncodedType);
-
-    if(!ret){
-        NSLog(@"class_addMethod failed");
-        munmap(closure, sizeof(ffi_closure));
-        [user_data->jMethod release];
-        [user_data->jCIF release];
-        free(user_data);
-        return NO;
-    }
-
-    return ret;
-}
-
-static void sel_closure_call(ffi_cif* cif, void* result, void** args, void* user_data)
-{
-    id obj = *(id*) args[0];
-//    SEL sel = *(SEL*) args[1];
-
-//    NSLog(@"Subclassing: sel_closure_call: %p %p", obj, sel);
-//    NSLog(@"Subclassing: sel_closure_call: obj class: %@  sel name: %s", object_getClass(obj), sel_getName(sel));
-
-    jobject jObj = getJObjectFromIVar(obj);
-
-    if(!jObj){
-        addJavaInstance(obj);
-        jObj = getJObjectFromIVar(obj);
-    }
-
-    closure_data_t *jmeta = user_data;
-    jobject jMethod = [jmeta->jMethod jObject];
-    jobject jCIF = [jmeta->jCIF jObject];
-
-    JNFThreadContext threadWasAttached = JNFThreadDetachOnThreadDeath;
-    JNIEnv *env = JNFObtainEnv(&threadWasAttached);
-
-    if((*env)->ExceptionOccurred(env)) goto bail;
-
-        static JNF_CLASS_CACHE(jc, "com/apple/jobjc/Subclassing");
-        static JNF_STATIC_MEMBER_CACHE(jm_invokeFromJNI, jc, "invokeFromJNI",
-        "(Lcom/apple/jobjc/ID;Ljava/lang/reflect/Method;Lcom/apple/jobjc/CIF;JJ)V");
-
-    JNFCallStaticVoidMethod(env, jm_invokeFromJNI,
-        jObj,
-        jMethod,
-        jCIF,
-        ptr_to_jlong(result),
-        ptr_to_jlong(args));
-
-bail:
-    JNFReleaseEnv(env, &threadWasAttached);
-
-    if((*env)->ExceptionOccurred(env)){
-        NSLog(@"Exception!");
-        (*env)->ExceptionDescribe(env);
-    }
-    JNFReleaseEnv(env, &threadWasAttached);
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/BootClassPathMinus.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/BootClassPathMinus.java
deleted file mode 100644
index efbad58a104..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/BootClassPathMinus.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-public class BootClassPathMinus {
-
-    /*
-     * return the default boot class path with all parts mentioned in arguments removed
-     */
-    public static void main(String[] args) {
-    String bootClassPath = System.getProperty("sun.boot.class.path");
-    StringBuffer newPath = new StringBuffer(bootClassPath.length());
-    String[] bootClassPathParts = bootClassPath.split(java.io.File.pathSeparator, 0);
-    for (String part : bootClassPathParts) {
-        boolean found = false;
-        for (String minus : args) {
-        if (part.endsWith(minus)) {
-            found = true;
-        }
-        }
-        if (!found) {
-        if (newPath.length() > 0) newPath.append(java.io.File.pathSeparatorChar);
-        newPath.append(part);
-        }
-    }
-    System.out.println(newPath.toString());
-    }
-
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassConsolidator.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassConsolidator.java
deleted file mode 100644
index 69a872f8dbc..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassConsolidator.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.apple.internal.jobjc.generator.model.Category;
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Framework;
-
-public class ClassConsolidator {
-    private static String[] PREFERRED_FRAMEWORKS = { "Foundation", "AppKit" };
-
-    static void consolidateClassesForFrameworks(final List<Framework> frameworks) throws Throwable {
-        System.out.println("--2-- Resolving duplicate classes:");
-        final Map<String, List<Clazz>> allClasses = new HashMap<String, List<Clazz>>();
-
-        for (final Framework framework : frameworks) {
-            for (final Clazz clazz : framework.classes) {
-                final List<Clazz> existingClazzList = allClasses.get(clazz.name);
-                if(existingClazzList != null)
-                    existingClazzList.add(clazz);
-                else
-                    allClasses.put(clazz.name, new ArrayList<Clazz>(Arrays.asList(clazz)));
-            }
-        }
-
-        final Map<String, Clazz> filteredClasses = new HashMap<String, Clazz>();
-        final List<List<Clazz>> dreggs = new ArrayList<List<Clazz>>();
-
-        final Collection<List<Clazz>> clazzLists = allClasses.values();
-        for (final List<Clazz> clazzList : clazzLists) {
-            if (clazzList.size() > 1) {
-                // add to the list for later analysis
-                dreggs.add(clazzList);
-                continue;
-            }
-
-            // if there is only one class definition, go with it!
-            final Clazz clazz = clazzList.get(0);
-            filteredClasses.put(clazz.name, clazz);
-        }
-
-        // figure out which class is the real class, and convert the rest to categories
-        for (final List<Clazz> dreg : dreggs)
-            deriveCategoriesFrom(dreg, filteredClasses);
-
-        // patch up the inheritance hierarchy
-        System.out.println("Determining super classes:");
-        for (final Framework framework : frameworks)
-            framework.resolveSuperClasses(filteredClasses);
-    }
-
-    private static void deriveCategoriesFrom(final List<Clazz> clazzes, final Map<String, Clazz> filteredClasses) {
-        final List<Clazz> clazzesToDerive = new ArrayList<Clazz>(clazzes);
-
-        for (final String preferredFrameworkName : PREFERRED_FRAMEWORKS) {
-            for (final Clazz clazz : clazzesToDerive) {
-                if (!preferredFrameworkName.equals(clazz.parent.name)) continue;
-
-                System.out.print("\t" + clazz.parent.name + " owns \"" + clazz.name + "\", ");
-                addCategoriesAndPatchClasses(clazzes, clazz);
-                filteredClasses.put(clazz.name, clazz);
-                return;
-            }
-        }
-
-        final List<String> frameworkNameList = new ArrayList<String>(clazzes.size());
-        for (final Clazz clazz : clazzes) frameworkNameList.add(clazz.parent.name);
-        throw new RuntimeException("Could not derived a preferred framework for: " + clazzes.get(0).name + ", from (" + Utils.joinWComma(frameworkNameList) + ")");
-    }
-
-    private static void addCategoriesAndPatchClasses(final List<Clazz> clazzes, final Clazz clazz) {
-        final List<String> fwNames = new ArrayList<String>(clazzes.size());
-
-        for (final Clazz cls : clazzes) {
-            if (cls == clazz) continue;
-            fwNames.add(cls.parent.name);
-            cls.parent.classes.remove(cls);
-            cls.parent.categories.add(new Category(cls, clazz));
-        }
-
-        System.out.println("creating categories in: " + Utils.joinWComma(fwNames));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassGenerator.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassGenerator.java
deleted file mode 100644
index 8953fa306c0..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/ClassGenerator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.util.*;
-
-import com.apple.internal.jobjc.generator.classes.*;
-import com.apple.internal.jobjc.generator.model.Framework;
-
-public class ClassGenerator {
-    public static final String JOBJC_PACKAGE = "com.apple.jobjc";
-
-    public static List<OutputFile> generateClasses(final List<Framework> frameworks) {
-        final List<OutputFile> generatedClassFiles = new ArrayList<OutputFile>();
-
-        generatedClassFiles.add(new RootJObjCClass(frameworks));
-        for (final Framework f : frameworks) {
-            f.generateClasses(generatedClassFiles);
-        }
-
-        return generatedClassFiles;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FileCopier.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FileCopier.java
deleted file mode 100644
index bcaf5bcb8c7..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FileCopier.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.io.File;
-import java.util.*;
-
-import com.apple.internal.jobjc.generator.classes.*;
-
-public class FileCopier {
-    public static List<OutputFile> addSourceFilesFrom(final String srcPath) {
-        final List<OutputFile> outputFileList = new ArrayList<OutputFile>();
-
-        final List<File> fileList = getFileList(srcPath);
-        for (final File file : fileList) {
-            outputFileList.add(new CopiedFile(file, ClassGenerator.JOBJC_PACKAGE, file.getName().replace("\\.java", "")));
-        }
-
-        return outputFileList;
-    }
-
-    private static List<File> getFileList(final String srcPath) {
-        final File srcRoot = new File(srcPath);
-        if (!srcRoot.exists()) throw new RuntimeException("Source root " + srcRoot + " does not exist. Nowhere to copy base runtime objects from.");
-
-        final File targetDir = new File(srcRoot, ClassGenerator.JOBJC_PACKAGE.replaceAll("\\.", "\\/"));
-        if (!targetDir.exists() || !targetDir.isDirectory()) throw new RuntimeException("Base runtime object source directory " + targetDir + " does not exist. No runtime class files to copy.");
-
-        final List<File> fileList = new ArrayList<File>();
-        final File[] targetDirFileList = targetDir.listFiles();
-        for (final File file : targetDirFileList) {
-            if (!file.isFile()) continue;
-            if (!file.getName().endsWith(".java")) continue;
-            fileList.add(file);
-        }
-
-        return fileList;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FrameworkGenerator.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FrameworkGenerator.java
deleted file mode 100644
index 1f11ed9038b..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FrameworkGenerator.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.model.Framework.FrameworkDependency;
-import com.apple.internal.jobjc.generator.utils.Fp;
-import com.apple.internal.jobjc.generator.utils.StructOffsetResolverBigBang;
-import com.apple.jobjc.JObjCRuntime;
-
-public class FrameworkGenerator {
-    private static final String BRIDGESUPPORT_FILE_EXTENSION = "Full.bridgesupport";
-    private static final String FRAMEWORK_MATCH = "^.*Full\\.bridgesupport$";
-    private static final String FRAMEWORK_PRUNE = "^.*(PyObjC|/Versions|\\.lproj|/Headers|/PrivateHeaders).*$";
-
-    static List<File> findFrameworkFilesIn(final File file) throws IOException{
-        final List<File> bridgeSupportFiles = Utils.find(file, FRAMEWORK_MATCH, FRAMEWORK_PRUNE);
-        System.out.println("found " + bridgeSupportFiles.size() + " frameworks");
-        return bridgeSupportFiles;
-    }
-
-    static List<Framework> parseFrameworksFrom(final List<File> bridgeSupportFiles) {
-        final List<Framework> frameworks = new ArrayList<Framework>();
-
-        System.out.println("Parsing XML");
-        for (final File file : bridgeSupportFiles){
-            Framework f = new Framework(extractFrameworkNameFrom(file), file);
-            try{
-                f.load();
-                frameworks.add(f);
-                System.out.println("Generator@" + JObjCRuntime.ARCH + " loaded "
-                        + f.name + " (" + Fp.join(":", f.binaries) + ")");
-            }
-            catch(Exception x){
-                System.out.println("!! Generator@" + JObjCRuntime.ARCH + " failed to load "
-                        + f.name + " (" + Fp.join(":", f.binaries) + "). SKIPPING");
-            }
-        }
-
-        System.out.println("Parsing dependencies");
-        for (final Framework f : frameworks) f.parseDependencies(frameworks);
-
-        Set<String> alreadyWarnedDependency = new HashSet<String>();
-        for(final Framework f : frameworks)
-            for(final FrameworkDependency dep : f.dependencies)
-                if(dep.object == null && !alreadyWarnedDependency.contains(dep.name)){
-                    System.out.println(String.format("Warning: unresolved dependency: %1$30s -> %2$s", f.name, dep.name));
-                    alreadyWarnedDependency.add(dep.name);
-                }
-        if(alreadyWarnedDependency.size() > 0)
-            System.out.println("Unresolved dependencies lead to unresolved types.");
-
-        Utils.topologicalSort(frameworks);
-        List<Framework> cycle = Utils.getDependencyCycle(frameworks);
-        if(cycle != null)
-            System.out.println("Warning: cycle found in framework dependencies: " + Fp.join(" -> ", cycle));
-
-        System.out.println("Parsing types");
-        for (final Framework f : frameworks){
-            f.parseCFTypes();
-            f.parseOpaques();
-        }
-        for (final Framework f : frameworks) f.parseStructs();
-
-        new StructOffsetResolverBigBang().resolve(frameworks);
-
-        System.out.println("Parsing classes");
-        for (final Framework f : frameworks) f.parseClasses();
-
-        System.out.println("Parsing constants");
-        for (final Framework f : frameworks) f.parseConstants();
-
-        System.out.println("Parsing functions");
-        for (final Framework f : frameworks) f.parseFunctions();
-
-        return frameworks;
-    }
-
-    private static String extractFrameworkNameFrom(final File file) {
-        final String fileName = file.getName();
-        return fileName.substring(0, fileName.lastIndexOf(BRIDGESUPPORT_FILE_EXTENSION));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FunctionGenerator.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FunctionGenerator.java
deleted file mode 100644
index 37f67aa39bd..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/FunctionGenerator.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.io.PrintStream;
-import java.io.StringWriter;
-
-import com.apple.internal.jobjc.generator.model.Arg;
-import com.apple.internal.jobjc.generator.model.Function;
-import com.apple.internal.jobjc.generator.model.Method;
-import com.apple.internal.jobjc.generator.model.types.JType;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLCall;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLField;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLMethod;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLTertiary;
-import com.apple.jobjc.Coder;
-import com.apple.jobjc.Invoke;
-import com.apple.jobjc.Invoke.FunCall;
-import com.apple.jobjc.Invoke.MsgSend;
-
-public class FunctionGenerator {
-    private final static String VARARGS_NAME = "varargs";
-
-    private static String createFieldCache(final Class<? extends Invoke> type, final Function fxn) {
-        final String identifier = makeInstanceName(fxn);
-
-        JLField field = new JLField("private static", type.getCanonicalName(), identifier);
-        // It's okay to make it static, because the getter isn't static, so the only way to access it is through an instance.
-        JLMethod getter = new JLMethod("private final", type.getCanonicalName(), "get_" + identifier);
-
-        JLCall createIt = new JLCall("new " + type.getCanonicalName());
-        createIt.args.add(firstArg(fxn));
-        createIt.args.add("\"" + fxn.name + "\"");
-        createIt.args.add(fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName());
-        for (final Arg arg : fxn.args)
-            createIt.args.add(arg.type.getJType().getCoderDescriptor().getCoderInstanceName());
-
-        getter.body.add("return " + new JLTertiary(identifier + " != null", identifier, identifier + " = " + createIt) + ";");
-
-        return field.toString() + getter.toString();
-    }
-
-    private static String createLocalForward(final Class<? extends Invoke> type, final Function fxn) {
-        final String identifier = makeInstanceName(fxn);
-        return new JLField("final", type.getCanonicalName(), identifier, new JLCall("get_" + identifier)).toString();
-    }
-
-    private static String createLocalNew(final Class<? extends Invoke> type, final Function fxn) {
-        final String identifier = makeInstanceName(fxn);
-        StringWriter out = new StringWriter();
-
-        out.append(String.format("%3$s[] argCoders = new %3$s[%1$d + %2$s.length];\n", fxn.args.size(), VARARGS_NAME, Coder.class.getCanonicalName()));
-
-        for(int i = 0; i < fxn.args.size(); i++)
-            out.append(String.format("argCoders[%1$d] = %2$s;\n", i, fxn.args.get(0).type.getJType().getCoderDescriptor().getCoderInstanceName()));
-
-        if(fxn.variadic){
-            out.append(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)\n", fxn.args.size(), VARARGS_NAME));
-            out.append(String.format("\targCoders[i] = %1$s.getCoderAtRuntime(%2$s[i - %3$s]);\n", Coder.class.getCanonicalName(), VARARGS_NAME, fxn.args.size()));
-        }
-
-        out.append("final " + type.getCanonicalName() + " " + identifier + " = new " + type.getCanonicalName() + "(" + firstArg(fxn) + ", \"" + fxn.name + "\", "
-                + fxn.returnValue.type.getJType().getCoderDescriptor().getCoderInstanceName() + ", argCoders);");
-
-        return out.toString();
-    }
-
-    private static final String CONTEXT_NAME = "nativeBuffer";
-
-    public static void writeOutFunction(final PrintStream out, final Class<? extends Invoke> type, final Function fxn, final String initWithObj) {
-        final String instName = makeInstanceName(fxn);
-        final JType returnJavaType = fxn.returnValue.type.getJType();
-
-        if(!fxn.variadic){
-            out.print(createFieldCache(type, fxn));
-            out.println();
-        }
-
-        JLMethod meth = new JLMethod("public", returnJavaType.getJavaReturnTypeName(), fxn.getJavaName());
-
-        for(Arg arg : fxn.args)
-            meth.args.add("final " + arg.type.getJType().getTypeNameAsParam() + " " + arg.javaName);
-
-        if(fxn.variadic)
-            meth.args.add("final Object... " + VARARGS_NAME);
-
-        if(fxn instanceof Method && ((Method)fxn).ignore){
-            String suggestion = ((Method)fxn).suggestion == null ? "" : (" Suggested work-around: " + ((Method)fxn).suggestion);
-            meth.jdoc.add("@deprecated The framework recommends that this method be ignored. (It may be deprecated.)" + suggestion);
-            meth.attrs.add("@Deprecated");
-        }
-
-        // type mismatch warning
-        {
-            {
-                String retMsg = fxn.returnValue.type.getJType().getCoderDescriptor().mismatchMessage();
-                if(retMsg != null){
-                    meth.jdoc.add("@deprecated Possible type mismatch: (return value) " + retMsg);
-                    meth.attrs.add("@Deprecated");
-                }
-            }
-
-            for(int i = 0; i < fxn.args.size(); i++){
-                final Arg arg = fxn.args.get(i);
-                String argMsg = arg.type.getJType().getCoderDescriptor().mismatchMessage();
-                if(argMsg != null){
-                    meth.jdoc.add("@deprecated Possible type mismatch: (arg" + i + ": " + arg.javaName + ") " + argMsg);
-                    meth.attrs.add("@Deprecated");
-                }
-            }
-        }
-
-        if(fxn.variadic)
-            meth.body.add(createLocalNew(coreType(fxn), fxn));
-        else
-            meth.body.add(createLocalForward(coreType(fxn), fxn));
-
-        meth.body.add(returnJavaType.createDeclareBuffer(CONTEXT_NAME));
-        meth.body.add(returnJavaType.createInit(CONTEXT_NAME, instName, initWithObj));
-
-        for(final Arg arg : fxn.args)
-            meth.body.add(arg.type.getJType().getCoderDescriptor().getPushStatementFor(CONTEXT_NAME, arg.javaName));
-
-        if(fxn.variadic){
-            meth.body.add(String.format("for(int i = %1$d; i < (%1$d + %2$s.length); i++)", fxn.args.size(), VARARGS_NAME));
-            meth.body.add(String.format("\targCoders[i].push(%1$s, %2$s[i - %3$d]);", CONTEXT_NAME, VARARGS_NAME, fxn.args.size()));
-        }
-
-        meth.body.add(returnJavaType.createInvoke(CONTEXT_NAME, instName));
-        meth.body.add(returnJavaType.createPop(CONTEXT_NAME));
-        meth.body.add(returnJavaType.createReturn());
-
-        out.print(meth.toString());
-        out.println();
-    }
-
-    private static Class<? extends Invoke> coreType(final Function fxn){
-        return fxn instanceof Method ? MsgSend.class : FunCall.class;
-    }
-
-    private static String firstArg(Function fxn){
-        return fxn instanceof Method ? "getRuntime()" : "this";
-    }
-
-    private static String makeInstanceName(Function fxn){
-        String ext;
-        if(fxn instanceof Method){
-            if(((Method) fxn).isClassMethod) ext = "CMetInst";
-            else                             ext = "IMetInst";
-        }
-        else
-            ext = "FxnInst";
-
-        return fxn.getJavaName() + "_" + ext;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Generator.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Generator.java
deleted file mode 100644
index f1411e83e7d..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Generator.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-
-import com.apple.internal.jobjc.generator.classes.MixedPrimitiveCoderClassFile;
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.model.coders.ComplexCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.types.Type;
-import com.apple.internal.jobjc.generator.model.types.TypeCache;
-import com.apple.internal.jobjc.generator.utils.Fp.Pair;
-
-public class Generator {
-    private static final String DEFAULT_FRAMEWORKS_PATH = "/System/Library/Frameworks";
-    private static final String DEFAULT_OUTPUT_PATH = "/tmp/JObjC";
-
-    public static void main(final String...args) throws Throwable {
-        final Map<String, String> argMap = Utils.getArgs(args);
-
-        final String dst = get(argMap, "dst", DEFAULT_OUTPUT_PATH);
-        System.out.println("Cleaning up: " + dst);
-        final File dstLoc = new File(dst);
-        Utils.recDelete(dstLoc);
-        dstLoc.mkdirs();
-        System.out.println("Outputting classes to: " + dst);
-
-        final String frameworksPath = get(argMap, "frameworks", DEFAULT_FRAMEWORKS_PATH);
-        System.out.println("Searching for bridged frameworks in: " + frameworksPath);
-
-        final List<File> bridgeSupportFiles = FrameworkGenerator.findFrameworkFilesIn(new File(frameworksPath));
-        final List<Framework> frameworks = FrameworkGenerator.parseFrameworksFrom(bridgeSupportFiles);
-
-        System.out.println("--1-- Generator: consolidateClassesForFrameworks");
-        ClassConsolidator.consolidateClassesForFrameworks(frameworks);
-
-        System.out.println("--1-- Generator: TypeCache load");
-        TypeCache.inst().load(frameworks);
-
-        System.out.println("--1-- Generator: disambiguateMethodNames");
-        MethodDisambiguator.disambiguateMethodNames();
-
-        System.out.println("--1-- Generator: disambiguateFunctionsIn");
-        MethodDisambiguator.disambiguateFunctionsIn(frameworks);
-
-        System.out.println("--1-- Generator: generateClasses");
-        final List<OutputFile> sourceFiles = ClassGenerator.generateClasses(frameworks);
-        sourceFiles.add(new MixedPrimitiveCoderClassFile(ComplexCoderDescriptor.getMixedEncoders()));
-
-        System.out.println("--1-- Generator: writing " + sourceFiles.size() + " files");
-        for (final OutputFile sourceFile : sourceFiles) sourceFile.write(dstLoc);
-
-        System.out.println("I have " + TypeCache.inst().getUnknownTypes().size() + " unresolved types.");
-        for (final Type type : TypeCache.inst().getUnknownTypes())
-            System.out.println("[Warning] unknown type: " + type);
-
-        for(Type type : TypeCache.inst().typesByNTypes.values()){
-            if(!type.type32.getClass().equals(type.type64.getClass())){
-                System.out.format("Type with differing NTypes: %1$15s: %2$s\n", type.name, new Pair(type.type32, type.type64));
-            }
-        }
-    }
-
-    private static String get(final Map<String, String> defaults, final String key, final String defaultValue) {
-        final String value = defaults.get(key);
-        if (value != null) return value;
-        return defaultValue;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/MethodDisambiguator.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/MethodDisambiguator.java
deleted file mode 100644
index 5b8bcb2ec79..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/MethodDisambiguator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.util.List;
-
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.model.Function;
-import com.apple.internal.jobjc.generator.model.types.TypeCache;
-
-public class MethodDisambiguator {
-    static void disambiguateMethodNames() {
-        // link all subclassers off their parents
-        for (final Clazz clazz : TypeCache.inst().getAllClasses()) {
-            final Clazz superClazz = clazz.superClass;
-            if (superClazz != null) superClazz.subClassers.add(clazz);
-        }
-
-        // recursively call all subclassers, starting from NSObject on down
-        disambiguateMethodNamesFor(TypeCache.inst().getClassForName("NSObject"));
-
-        // NSProxy does not appear to subclass from NSObject, but it is still a real full class...?
-        disambiguateMethodNamesFor(TypeCache.inst().getClassForName("NSProxy"));
-    }
-
-    static void disambiguateMethodNamesFor(final Clazz clazz) {
-        clazz.disambiguateMethods();
-        for (final Clazz subClazz : clazz.subClassers) {
-            disambiguateMethodNamesFor(subClazz);
-        }
-    }
-
-    public static void disambiguateFunctionsIn(final List<Framework> frameworks) {
-        for (final Framework framework : frameworks) {
-            disambiguateFunctionsInFramework(framework);
-        }
-    }
-
-    static void disambiguateFunctionsInFramework(final Framework framework) {
-        for (final Function fxn : framework.functions)
-            fxn.disambiguateArgs();
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/RestrictedKeywords.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/RestrictedKeywords.java
deleted file mode 100644
index aeaaeee548a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/RestrictedKeywords.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-public class RestrictedKeywords {
-    static final String[] JAVA_KEYWORD_CONFLICTS = {
-        "wait", "null", "class", "new", "toString", "finalize", "boolean", "interface", "final", "static"
-    };
-
-    static final Set<String> originalRestrictedSet = new HashSet<String>(Arrays.asList(JAVA_KEYWORD_CONFLICTS));
-
-    public static Set<String> getNewRestrictedSet() {
-        return new HashSet<String>(originalRestrictedSet);
-    }
-
-    public static boolean isRestricted(String s){
-        return originalRestrictedSet.contains(s);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Utils.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Utils.java
deleted file mode 100644
index 7a3459c2164..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/Utils.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.regex.Pattern;
-
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.model.Framework.FrameworkDependency;
-import com.apple.internal.jobjc.generator.utils.Fp;
-
-public class Utils {
-    public static boolean isLeopard = System.getProperty("os.version").startsWith("10.5");
-    public static boolean isSnowLeopard = System.getProperty("os.version").startsWith("10.6");
-
-    @SuppressWarnings("unchecked")
-    public static <T> List<T> list(final Object...args) {
-        final ArrayList<Object> list = new ArrayList<Object>(args.length);
-        for (final Object arg : args) list.add(arg);
-        return (List<T>)list;
-    }
-
-    /**
-     * A small implementation of UNIX find.
-     * @param matchRegex Only collect paths that match this regex.
-     * @param pruneRegex Don't recurse down a path that matches this regex. May be null.
-     * @throws IOException if File.getCanonicalPath() fails.
-     */
-    public static List<File> find(final File startpath, final String matchRegex, final String pruneRegex) throws IOException{
-        final Pattern matchPattern = Pattern.compile(matchRegex, Pattern.CASE_INSENSITIVE);
-        final Pattern prunePattern = pruneRegex == null ? null : Pattern.compile(pruneRegex, Pattern.CASE_INSENSITIVE);
-        final Set<String> visited = new HashSet<String>();
-        final List<File> found = new ArrayList<File>();
-        class Search{
-            void search(final File path) throws IOException{
-                if(prunePattern != null && prunePattern.matcher(path.getAbsolutePath()).matches()) return;
-                String cpath = path.getCanonicalPath();
-                if(!visited.add(cpath))  return;
-                if(matchPattern.matcher(path.getAbsolutePath()).matches())
-                    found.add(path);
-                if(path.isDirectory())
-                    for(File sub : path.listFiles())
-                        search(sub);
-            }
-        }
-        new Search().search(startpath);
-        return found;
-    }
-
-    public static String joinWComma(final List<?> list) { return Fp.join(", ", list); }
-    public static String joinWComma(final Object[] list) { return Fp.join(", ", Arrays.asList(list)); }
-
-    public static class Substituter {
-        String str;
-
-        public Substituter(final String str) {
-            this.str = str.replaceAll("\\#", "\t").replaceAll("\\~", "\n");
-        }
-
-        public void replace(final String key, final String value) {
-            str = str.replaceAll("\\$" + key, value);
-        }
-
-        /**
-         * Apply String.format first, and then pass through Substituter.
-         */
-        public static String format(String format, Object... args){
-            return new Substituter(String.format(format, args)).toString();
-        }
-
-        @Override public String toString() {
-            return str;
-        }
-    }
-
-    static Map<String, String> getArgs(final String...args) {
-        final Map<String, String> argMap = new HashMap<String, String>();
-        for (final String arg : args) {
-            final String[] splitArg = arg.split("\\=");
-            if (splitArg.length != 2) continue;
-            argMap.put(splitArg[0], splitArg[1]);
-        }
-        return argMap;
-    }
-
-    static void recDelete(final File file) {
-        if (!file.exists()) return;
-        if (file.isDirectory()) for (final File f : file.listFiles()) recDelete(f);
-        file.delete();
-    }
-
-    public static String capitalize(String s){
-        if(s.length() == 0) return s;
-        return Character.toString(Character.toUpperCase(s.charAt(0))) + s.substring(1);
-    }
-
-    /**
-     * Sort frameworks by dependencies. If A is a dependency of B,
-     * then A will come before B in the list.
-     */
-    public static void topologicalSort(final List<Framework> frameworks) {
-        final Set<Framework> visited = new TreeSet<Framework>();
-        final List<Framework> sorted = new ArrayList<Framework>(frameworks.size());
-        class Rec{
-            void visit(final Framework fw){
-                if(!visited.add(fw)) return;
-                for(FrameworkDependency dep : fw.dependencies)
-                    if(dep.object != null)
-                        visit(dep.object);
-                sorted.add(fw);
-            }
-        }
-        for(Framework fw : frameworks) new Rec().visit(fw);
-        frameworks.clear();
-        frameworks.addAll(sorted);
-    }
-
-    /**
-     * If there is a cycle it is returned. Otherwise null is returned.
-     */
-    public static List<Framework> getDependencyCycle(List<Framework> frameworks) {
-        @SuppressWarnings("serial")
-        class FoundCycle extends Throwable{
-            public final List<Framework> cycle;
-            public FoundCycle(List<Framework> cycle){
-                this.cycle = cycle;
-            }
-        };
-        class Rec{
-            void visit(final Framework fw, List<Framework> visited) throws FoundCycle{
-                visited = new LinkedList<Framework>(visited);
-                if(visited.contains(fw)){
-                    visited.add(fw);
-                    throw new FoundCycle(visited);
-                }
-                visited.add(fw);
-                for(FrameworkDependency dep : fw.dependencies)
-                    if(dep.object != null)
-                        visit(dep.object, visited);
-            }
-        }
-        try{ for(Framework fw : frameworks){ new Rec().visit(fw, new LinkedList<Framework>()); }}
-        catch(FoundCycle x){ return x.cycle; }
-        return null;
-    }
-
-    public static String getCanonicalPath(File file) throws RuntimeException{
-        try {
-            return file.getCanonicalPath();
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/AbstractObjCClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/AbstractObjCClassFile.java
deleted file mode 100644
index e3208d17167..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/AbstractObjCClassFile.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import com.apple.internal.jobjc.generator.model.Clazz;
-
-public abstract class AbstractObjCClassFile extends GeneratedClassFile {
-    final Clazz clazz;
-
-    public AbstractObjCClassFile(final Clazz clazz, final String classname, final String genericArgs, final String superClass) {
-        super(clazz.getPackage(), classname, genericArgs, superClass);
-        this.clazz = clazz;
-    }
-
-    public AbstractObjCClassFile(final Clazz clazz, final String classname, final String superClass) {
-        super(clazz.getPackage(), classname, superClass);
-        this.clazz = clazz;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CFTypeClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CFTypeClassFile.java
deleted file mode 100644
index 774cae18e6e..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CFTypeClassFile.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-
-import com.apple.internal.jobjc.generator.model.CFType;
-import com.apple.jobjc.Pointer;
-
-public class CFTypeClassFile extends GeneratedClassFile {
-    final CFType cftype;
-
-    public CFTypeClassFile(final CFType cftype) {
-        super(cftype.parent.pkg, cftype.type.getJType().getJavaClassName(), com.apple.jobjc.CFType.class.getCanonicalName());
-        this.cftype = cftype;
-    }
-
-    @Override public void writeBeginning(PrintStream out){
-        out.println("\tpublic " + className + "(" + Pointer.class.getName() + "<?> ptr){");
-        out.println("\t\tsuper(ptr);");
-        out.println("\t}");
-        out.println("");
-        out.println("\tpublic " + className + "(long ptr){");
-        out.println("\t\tsuper(ptr);");
-        out.println("\t}");
-    }
-
-    @Override public void writeBody(PrintStream out){
-        if(cftype.getTypeIdFunc != null){
-            out.println("\tpublic static long getTypeId(){");
-            out.println("\t\treturn " + RootJObjCClass.runtimeFrameworkInst(cftype.parent.name) + "." + cftype.getTypeIdFunc + "();");
-            out.println("\t}");
-        }
-        else
-            out.println("\t// getTypeIdFunc not found");
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassClassFile.java
deleted file mode 100644
index f89c24320cf..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassClassFile.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.apple.internal.jobjc.generator.FunctionGenerator;
-import com.apple.internal.jobjc.generator.model.Category;
-import com.apple.internal.jobjc.generator.model.Method;
-import com.apple.jobjc.JObjCRuntime;
-import com.apple.jobjc.Invoke.MsgSend;
-
-public class CategoryClassClassFile extends AbstractObjCClassFile {
-    final Category category;
-
-    public CategoryClassClassFile(final Category category) {
-        super(category.category, category.category.name + "Class",
-                category.category.superClass.getFullPath() + "Class");
-        this.category = category;
-    }
-
-    @Override public void writeBeginning(final PrintStream out) {
-        out.format(
-                "\t%1$s(%2$s runtime) {\n" +
-                "\t\tsuper(\"%3$s\", runtime);\n" +
-                "\t}\n",
-                className, JObjCRuntime.class.getCanonicalName(), category.category.superClass.name);
-    }
-
-    @Override public void writeBody(final PrintStream out) {
-        Set<String> written = new HashSet<String>();
-        for(final Method method : this.clazz.classMethods)
-            if(written.add(method.name))
-                FunctionGenerator.writeOutFunction(out, MsgSend.class, method, "this");
-            else
-                System.out.format("Duplicate method: %1$s %2$s -%3$s\n", clazz.parent.name, className, method.name);
-    }
-
-    @Override protected boolean isFinal(){ return true; }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassFile.java
deleted file mode 100644
index c858546d092..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CategoryClassFile.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-
-import com.apple.internal.jobjc.generator.model.Category;
-import com.apple.jobjc.JObjCRuntime;
-
-public class CategoryClassFile extends JObjCClassFile {
-    private final Category category;
-
-    public CategoryClassFile(final Category category) {
-        super(category.category);
-        this.category = category;
-    }
-
-    @Override public void writeBeginning(final PrintStream out) {
-        String targetCls = category.category.superClass.getFullPath();
-        out.format("\tpublic %1$s(final %2$s obj, final %3$s runtime) {\n" +
-                "\t\tsuper(obj, runtime);\n" +
-                "\t}\n",
-            className, targetCls, JObjCRuntime.class.getCanonicalName());
-        super.writeBeginning(out);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CopiedFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CopiedFile.java
deleted file mode 100644
index 7061b86be92..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/CopiedFile.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.*;
-
-public class CopiedFile extends OutputFile {
-    final File sourceFile;
-
-    public CopiedFile(final File sourceFile, final String pkg, final String filename) {
-        super(pkg, filename);
-        this.sourceFile = sourceFile;
-    }
-
-    @Override
-    public void write(final File parentDir) {
-        try {
-            final PrintStream out = open(parentDir);
-            final InputStream in = new FileInputStream(sourceFile);
-
-            copy(in, out);
-            close(out);
-        } catch (final IOException e) { throw new RuntimeException(e); }
-    }
-
-    private static void copy(final InputStream in, final PrintStream out) throws IOException {
-        int bit;
-        while (-1 != (bit = in.read())) {
-            out.write(bit);
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java
deleted file mode 100644
index aade30f05fe..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.TreeSet;
-
-import com.apple.internal.jobjc.generator.FunctionGenerator;
-import com.apple.internal.jobjc.generator.Utils;
-import com.apple.internal.jobjc.generator.model.Category;
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Constant;
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.model.Function;
-import com.apple.internal.jobjc.generator.model.NativeEnum;
-import com.apple.internal.jobjc.generator.model.StringConstant;
-import com.apple.internal.jobjc.generator.model.Struct;
-import com.apple.internal.jobjc.generator.model.types.JType;
-import com.apple.internal.jobjc.generator.model.types.JType.JStruct;
-import com.apple.internal.jobjc.generator.utils.Fp;
-import com.apple.internal.jobjc.generator.utils.JavaLang;
-import com.apple.internal.jobjc.generator.utils.Fp.Map1;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLCall;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLField;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLMethod;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLReturn;
-import com.apple.jobjc.JObjCRuntime;
-import com.apple.jobjc.MacOSXFramework;
-import com.apple.jobjc.Invoke.FunCall;
-
-public class FrameworkClassFile extends GeneratedClassFile {
-    final Framework framework;
-
-    public FrameworkClassFile(final Framework framework) {
-        super(framework.pkg, framework.name + "Framework", MacOSXFramework.class.getName());
-        this.framework = framework;
-    }
-
-    @Override public void writeBeginning(final PrintStream out) {
-        List<String> binPaths = Fp.map(new Map1<File,String>(){
-            public String apply(File a) { return "\"" + a.getAbsolutePath() + "\""; }},
-            framework.binaries);
-        out.println(new Utils.Substituter(
-                "#public " + className + "(" + JObjCRuntime.class.getName() + " runtime) {~" +
-                "##super(runtime, new String[]{" + Fp.join(", ", binPaths) + "});~" +
-                "#}~"
-        ));
-    }
-
-    @Override public void writeBody(final PrintStream out) {
-        for(final Struct struct : new ArrayList<Struct>(framework.structs)){
-            out.println("\tpublic " + struct.name + " make" + struct.name + "(){");
-            out.println("\t\treturn new " + struct.name + "(getRuntime());");
-            out.println("\t}");
-            out.println("\tpublic " + struct.name + " make" + struct.name + "(com.apple.jobjc.NativeBuffer base){");
-            out.println("\t\treturn new " + struct.name + "(getRuntime(), base);");
-            out.println("\t}");
-        }
-
-        for(final NativeEnum nenum : framework.enums){
-            if(nenum.ignore){
-                out.println("\t/**");
-                out.println("\t * @deprecated Suggestion: " + nenum.suggestion);
-                out.println("\t */");
-                out.println("\t@Deprecated");
-            }
-            out.println(String.format("\tpublic final %3$s %1$s(){ return %2$s; }",
-                    nenum.name, nenum.valueToString(), nenum.type.getJType().getJavaReturnTypeName()));
-        }
-
-        for(final Constant konst : framework.constants){
-            String cacheName = "_" + konst.name;
-            final JType jtype = konst.type.getJType();
-            final String cast = jtype.getReturnTypeCast() == null ? "" : "(" + jtype.getReturnTypeCast() + ")";
-            out.println();
-
-            out.print(new JLField("private", jtype.getJavaTypeName(), cacheName, jtype.getDefaultReturnValue()));
-
-            JLMethod reader = new JLMethod("public final", jtype.getJavaReturnTypeName(), konst.name);
-            reader.body.add("if(" + cacheName + " != " + jtype.getDefaultReturnValue() + ") return " + cast + cacheName + ";");
-
-            String contextName = jtype instanceof JStruct ? "returnValue" : "nativeBuffer";
-
-            if(jtype instanceof JStruct)
-                reader.body.add(((JStruct)jtype).createReturnValue());
-            else
-                reader.body.add(jtype.createDeclareBuffer(contextName));
-
-            reader.body.add("getConstant(\"" + konst.name + "\", " + contextName + ", " + jtype.getCoderDescriptor().getCoderInstanceName() + ".sizeof());");
-
-            reader.body.add(jtype.createPop(contextName));
-            reader.body.add(cacheName + " = returnValue;");
-            reader.body.add(jtype.createReturn());
-
-            out.print(reader);
-        }
-
-        for(final StringConstant konst : framework.stringConstants){
-            if(Fp.any(new Map1<Constant,Boolean>(){ public Boolean apply(Constant a) {
-                return a.name.equals(konst.name);
-                }}, new ArrayList<Constant>(framework.constants))){
-                System.out.println("Warning: [" + framework.name + "] String constant " + konst.name + " is already defined in constants. Skipping.");
-            }
-            else{
-                out.println("\tpublic final String " + konst.name + "(){ return \"" + escapeQuotes(konst.value) + "\"; }");
-            }
-        }
-
-        /**
-         * Order classes to get stable output
-         */
-        TreeSet<Clazz> sortedClasses = new TreeSet<Clazz>(framework.classes);
-        for (final Clazz clazz : sortedClasses) {
-            final String classClassName = clazz.name + "Class";
-            out.println(JavaLang.makeSingleton("_" + classClassName, clazz.name, classClassName, "getRuntime()"));
-        }
-
-        for (final Category cat : framework.categories) {
-            final String classClassName = cat.category.name + "Class";
-            out.println(JavaLang.makeSingleton("_" + classClassName, cat.category.name, classClassName, "getRuntime()"));
-
-            JLMethod jlm = new JLMethod("public", cat.category.name, cat.category.name, "final " + cat.category.superClass.getFullPath() + " obj");
-            jlm.body.add(new JLReturn(new JLCall("new " + cat.category.name, "obj", "getRuntime()")));
-            out.println(jlm);
-        }
-
-        for (final Function fxn : framework.functions){
-            FunctionGenerator.writeOutFunction(out, FunCall.class, fxn, null);
-        }
-    }
-
-    private String escapeQuotes(String s){
-        return s.replace("\"", "\\\"");
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/GeneratedClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/GeneratedClassFile.java
deleted file mode 100644
index 0098d4d442c..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/GeneratedClassFile.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintStream;
-
-public class GeneratedClassFile extends OutputFile {
-    protected final String className;
-    protected final String genericArgs;
-    protected final String superClass;
-
-    public GeneratedClassFile(final String pkg, final String classname, final String superClass) {
-        this(pkg, classname, null, superClass);
-    }
-
-    public GeneratedClassFile(final String pkg, final String classname, final String genericArgs, final String superClass) {
-        super(pkg, classname + ".java");
-        this.className = classname;
-        this.genericArgs = genericArgs;
-        this.superClass = superClass;
-    }
-
-    @Override
-    public void write(final File parentDir) {
-        try {
-            final PrintStream out = open(parentDir);
-            out.println("package " + pkg + ";");
-            out.println();
-            out.print("public " + (isFinal() ? "final" : "") + " class " + className);
-            if(genericArgs != null) out.print("<" + genericArgs + ">");
-            if (superClass != null) out.print(" extends " + superClass);
-            out.println(" {");
-            writeBeginning(out);
-            writeBody(out);
-            writeEnd(out);
-            out.println("}");
-            close(out);
-        } catch (final IOException e) { throw new RuntimeException(e); }
-    }
-
-    public void writeBeginning(final PrintStream out) {
-
-    }
-
-    public void writeBody(final PrintStream out) {
-
-    }
-
-    public void writeEnd(final PrintStream out) {
-
-    }
-
-    protected boolean isFinal(){ return false; }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassClassFile.java
deleted file mode 100644
index a22bb5b5fa3..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassClassFile.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.apple.internal.jobjc.generator.ClassGenerator;
-import com.apple.internal.jobjc.generator.FunctionGenerator;
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Method;
-import com.apple.jobjc.JObjCRuntime;
-import com.apple.jobjc.Invoke.MsgSend;
-
-public class JObjCClassClassFile extends AbstractObjCClassFile {
-    public JObjCClassClassFile(final Clazz clazz) {
-        super(clazz, clazz.name + "Class", clazz.superClass != null ? clazz.superClass.getFullPath() + "Class" : ClassGenerator.JOBJC_PACKAGE + ".NSClass<" + clazz.name + ">");
-    }
-
-    @Override public void writeBeginning(final PrintStream out) {
-        out.format(
-                "\tpublic %1$s(%2$s runtime) {\n" +
-                "\t\tsuper(runtime);\n" +
-                "\t}\n",
-                className, JObjCRuntime.class.getCanonicalName());
-        out.format(
-                "\tpublic %1$s(String name, %2$s runtime) {\n" +
-                "\t\tsuper(name, runtime);\n" +
-                "\t}\n",
-                className, JObjCRuntime.class.getCanonicalName());
-        out.format(
-                "\tpublic %1$s(long ptr, %2$s runtime) {\n" +
-                "\t\tsuper(ptr, runtime);\n" +
-                "\t}\n",
-                className, JObjCRuntime.class.getCanonicalName());
-    }
-
-    @Override public void writeBody(final PrintStream out) {
-        Set<String> written = new HashSet<String>();
-        for(final Method method : this.clazz.classMethods)
-            if(written.add(method.name))
-                FunctionGenerator.writeOutFunction(out, MsgSend.class, method, "this");
-            else
-                System.out.format("Duplicate method: %1$s %2$s -%3$s\n", clazz.parent.name, className, method.name);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassFile.java
deleted file mode 100644
index 276c76b3a97..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/JObjCClassFile.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import com.apple.internal.jobjc.generator.FunctionGenerator;
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Method;
-import com.apple.jobjc.JObjCRuntime;
-import com.apple.jobjc.NativeObjectLifecycleManager;
-import com.apple.jobjc.Invoke.MsgSend;
-
-public class JObjCClassFile extends AbstractObjCClassFile {
-    public JObjCClassFile(final Clazz clazz) {
-        super(clazz, clazz.name,
-                clazz.superClass == null ? "com.apple.jobjc.ID"
-                        : clazz.superClass.getFullPath());
-    }
-
-    private static Map<String, NativeObjectLifecycleManager> nolmForClass =
-        new TreeMap<String, NativeObjectLifecycleManager>();
-    static{
-        nolmForClass.put("NSAutoreleasePool", NativeObjectLifecycleManager.Nothing.INST);
-    }
-
-    @Override public void writeBeginning(final PrintStream out) {
-        out.format("\tpublic %1$s(final long objPtr, final %2$s runtime) {\n" +
-                "\t\tsuper(objPtr, runtime);\n" +
-                "\t}\n",
-            className, JObjCRuntime.class.getCanonicalName());
-
-        out.format("\tpublic %1$s(final %1$s obj, final %2$s runtime) {\n" +
-                "\t\tsuper(obj, runtime);\n" +
-                "\t}\n",
-            className, JObjCRuntime.class.getCanonicalName());
-
-        NativeObjectLifecycleManager nolm = nolmForClass.get(clazz.name);
-        if(nolm != null)
-            out.format("\t@Override\n"+
-                    "\tprotected %1$s getNativeObjectLifecycleManager() {\n" +
-                    "\t\treturn %2$s.INST;\n" +
-                    "\t}\n",
-                    NativeObjectLifecycleManager.class.getCanonicalName(), nolm.getClass().getCanonicalName());
-    }
-
-    @Override public void writeBody(final PrintStream out) {
-        Set<String> written = new HashSet<String>();
-        for(final Method method : this.clazz.instanceMethods)
-            if(written.add(method.name))
-                FunctionGenerator.writeOutFunction(out, MsgSend.class, method, "this");
-            else
-                System.out.format("Duplicate method: %1$s %2$s -%3$s\n", clazz.parent.name, className, method.name);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/MixedPrimitiveCoderClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/MixedPrimitiveCoderClassFile.java
deleted file mode 100644
index ea28298bc48..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/MixedPrimitiveCoderClassFile.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-import java.util.Collection;
-
-import com.apple.internal.jobjc.generator.ClassGenerator;
-import com.apple.internal.jobjc.generator.model.coders.ComplexCoderDescriptor.MixedEncodingDescriptor;
-import com.apple.jobjc.PrimitiveCoder;
-
-public class MixedPrimitiveCoderClassFile extends GeneratedClassFile {
-    private static final String MULTI_CODER_CLASSNAME = "MixedPrimitiveCoder";
-    public static final String FULL_MULTI_CODER_CLASSNAME = ClassGenerator.JOBJC_PACKAGE + "." + MULTI_CODER_CLASSNAME;
-
-    final Collection<MixedEncodingDescriptor> coderDescs;
-
-    public MixedPrimitiveCoderClassFile(final Collection<MixedEncodingDescriptor> coderDescs) {
-        super(ClassGenerator.JOBJC_PACKAGE, MULTI_CODER_CLASSNAME, "java.lang.Object");
-        this.coderDescs = coderDescs;
-    }
-
-    @Override
-    public void writeBody(final PrintStream out) {
-        for (final MixedEncodingDescriptor desc : coderDescs) {
-            out.println("\tpublic static final " + PrimitiveCoder.class.getCanonicalName() + " " + desc.getMixedName() + " = " + desc.getDefinition() + ";");
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OpaqueClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OpaqueClassFile.java
deleted file mode 100644
index c7fa5d7f131..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OpaqueClassFile.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-
-import com.apple.internal.jobjc.generator.model.Opaque;
-import com.apple.jobjc.Pointer;
-
-public class OpaqueClassFile extends GeneratedClassFile {
-    final Opaque opaque;
-
-    public OpaqueClassFile(final Opaque opaque) {
-        super(opaque.parent.pkg, opaque.type.getJType().getJavaClassName(), com.apple.jobjc.Opaque.class.getCanonicalName());
-        this.opaque = opaque;
-    }
-
-    @Override public void writeBeginning(PrintStream out){
-        out.println("\t// " + opaque.type);
-        out.println("\t// " + opaque.type.getJType());
-        out.println("");
-        out.println("\tpublic " + className + "(" + Pointer.class.getName() + "<?> ptr){");
-        out.println("\t\tsuper(ptr);");
-        out.println("\t}");
-        out.println("");
-        out.println("\tpublic " + className + "(long ptr){");
-        out.println("\t\tsuper(ptr);");
-        out.println("\t}");
-    }
-
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OutputFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OutputFile.java
deleted file mode 100644
index 615bb24acfa..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/OutputFile.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.*;
-
-public abstract class OutputFile {
-    final String pkg;
-    final String fileName;
-
-    public OutputFile(final String pkg, final String filename) {
-        this.pkg = pkg;
-        this.fileName = filename;
-    }
-
-    public PrintStream open(final File parentDir) throws IOException {
-        final File pkgDir = new File(parentDir, pkg.replace('.', '/'));
-        pkgDir.mkdirs();
-        final File classFile = new File(pkgDir, fileName);
-        classFile.createNewFile();
-        return new PrintStream(classFile);
-    }
-
-    public void close(final PrintStream out) {
-        out.close();
-    }
-
-    public abstract void write(final File parentDir);
-
-    public boolean isClass(final Class<?> clazz) {
-        final String pkgName = clazz.getPackage().getName();
-        if (!pkgName.equals(pkg)) return false;
-
-        return fileName.contains(clazz.getSimpleName());
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/RootJObjCClass.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/RootJObjCClass.java
deleted file mode 100644
index a581d1ce2ee..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/RootJObjCClass.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-import java.util.List;
-
-import com.apple.internal.jobjc.generator.ClassGenerator;
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.utils.JavaLang;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLCtor;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLField;
-import com.apple.internal.jobjc.generator.utils.JavaLang.JLMethod;
-import com.apple.jobjc.JObjCRuntime;
-
-public class RootJObjCClass extends GeneratedClassFile {
-    private static final String JOBJC_CLASSNAME = "JObjC";
-    public static final String FULL_JOBJC_CLASSNAME = ClassGenerator.JOBJC_PACKAGE + "." + JOBJC_CLASSNAME;
-    public static final String JOBJC_RUNTIME_INST = FULL_JOBJC_CLASSNAME + ".getInstance()";
-    public static final String JOBJC_RUNTIME_INST_R = FULL_JOBJC_CLASSNAME + ".getInstance(getRuntime())";
-
-    public static final String runtimeFrameworkInst(String fwname){
-        return JOBJC_RUNTIME_INST + "." + fwname + "()";
-    }
-
-    public static final String runtimeFrameworkInstR(String fwname){
-        return JOBJC_RUNTIME_INST_R + "." + fwname + "()";
-    }
-
-    final List<Framework> frameworks;
-
-    public RootJObjCClass(final List<Framework> frameworks) {
-        super(ClassGenerator.JOBJC_PACKAGE, JOBJC_CLASSNAME, "java.lang.Object");
-        this.frameworks = frameworks;
-    }
-
-    @Override public void writeBeginning(final PrintStream out) {
-        out.print(new JLField("private static", JOBJC_CLASSNAME, "instance"));
-        out.print(new JLField("private final", JObjCRuntime.class.getName(), "runtime"));
-
-        JLMethod getInstR = new JLMethod("public static", JOBJC_CLASSNAME, "getInstance", "final JObjCRuntime runtime");
-        getInstR.body.add("if(runtime == null) throw new NullPointerException(\"runtime\");");
-        getInstR.body.add("if(instance == null) instance = new JObjC(runtime);");
-        getInstR.body.add("return instance;");
-        out.print(getInstR);
-
-        JLMethod getInst = new JLMethod("public static", JOBJC_CLASSNAME, "getInstance");
-        getInst.body.add("return getInstance(JObjCRuntime.getInstance());");
-        out.print(getInst);
-
-        JLCtor ctor = new JLCtor("private", JOBJC_CLASSNAME, "final JObjCRuntime runtime");
-        ctor.body.add("this.runtime = runtime;");
-        for (final Framework f : frameworks)
-            ctor.body.add("runtime.registerPackage(\"" + f.pkg + "\");");
-        out.print(ctor);
-    }
-
-    @Override public void writeBody(final PrintStream out) {
-        for (final Framework f : frameworks)
-            out.println(JavaLang.makeSingleton("_" + f.name, f.name, f.pkg + "." + f.name + "Framework", "runtime"));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/StructClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/StructClassFile.java
deleted file mode 100644
index 597d30a5818..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/StructClassFile.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.classes;
-
-import java.io.PrintStream;
-
-import com.apple.internal.jobjc.generator.model.Struct;
-import com.apple.internal.jobjc.generator.model.Struct.Field;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor;
-import com.apple.internal.jobjc.generator.model.types.JType;
-import com.apple.internal.jobjc.generator.model.types.JType.JStruct;
-import com.apple.internal.jobjc.generator.model.types.NType.NBitfield;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.utils.Fp;
-import com.apple.internal.jobjc.generator.utils.Fp.Map1;
-import com.apple.jobjc.JObjCRuntime;
-import com.apple.jobjc.Coder.StructCoder;
-
-public class StructClassFile extends GeneratedClassFile {
-    final Struct struct;
-
-    public StructClassFile(final Struct struct) {
-        super(struct.parent.pkg, struct.name, com.apple.jobjc.Struct.class.getName());
-        this.struct = struct;
-    }
-
-    @Override public boolean isFinal(){ return true; }
-
-    @Override public void writeBeginning(final PrintStream out) {
-        out.println();
-        out.println("\tpublic static int SIZEOF = " + JObjCRuntime.class.getName() + ".IS64 ? "
-                + ((NStruct) struct.type.type64).sizeof64() + " : " + ((NStruct) struct.type.type32).sizeof32() + ";");
-        out.println();
-        out.format("\tpublic final static %1$s getStructCoder(){ return coder; }\n", StructCoder.class.getCanonicalName());
-        out.format("\t@Override public final %1$s getCoder(){ return coder; }\n", StructCoder.class.getCanonicalName());
-        out.format("\tprivate final static %1$s coder = new %1$s(SIZEOF%2$s%3$s){\n", StructCoder.class.getCanonicalName(),
-                (struct.fields.size() > 0 ? ",\n\t\t" : ""),
-                Fp.join(",\n\t\t", Fp.map(new Map1<Field,String>(){
-                    public String apply(Field a) {
-                        return a.type.getJType().getCoderDescriptor().getCoderInstanceName();
-                    }}, struct.fields)));
-        out.format("\t\t@Override protected %1$s newInstance(%2$s runtime){ return new %1$s(runtime); }\n",
-                struct.name,
-                JObjCRuntime.class.getCanonicalName());
-        out.println("\t};");
-        out.println();
-        out.println("\t" + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime){");
-        out.println("\t\tsuper(runtime, SIZEOF);");
-        out.println("\t}");
-        out.println();
-        out.println("\tpublic " + struct.name + "(final " + JObjCRuntime.class.getCanonicalName() + " runtime, final com.apple.jobjc.NativeBuffer buffer) {");
-        out.println("\t\tsuper(runtime, buffer, SIZEOF);");
-        out.println("\t}");
-    }
-
-    @Override public void writeBody(final PrintStream out) {
-        for(Struct.Field field : struct.fields){
-            if(field.type.type64 instanceof NStruct && field.type.type32 instanceof NStruct)
-                writeStructField(field, out);
-            else
-                writeField(field, out);
-        }
-    }
-
-    private void writeField(final Struct.Field field, final PrintStream out){
-        if(field.type.type32 instanceof NBitfield){
-            out.format("\t// Skipping bitfield '%1$s'\n", field.name);
-            return;
-        }
-        String privName = field.name + "__";
-        String offsetName = field.name.toUpperCase() + "_OFFSET";
-        JType jtype = field.type.getJType();
-        String retType = jtype.getJavaReturnTypeName();
-        CoderDescriptor cdesc = jtype.getCoderDescriptor();
-        out.println();
-        out.println("\tprivate static final int " + offsetName + " = " + JObjCRuntime.class.getName()
-                + ".IS64 ? " + field.field64.offset64() + " : " + field.field32.offset32() + ";");
-
-        out.println("\t//" + cdesc.getClass().toString());
-        out.println("\tpublic " + retType + " " + getterName(field) + "(){");
-        out.println(jtype.createPopAddr("getRuntime()", "this.raw.bufferPtr + " + offsetName));
-        out.println(jtype.createReturn());
-        out.println("\t}");
-        out.println();
-        out.println("\tpublic void " + setterName(field.name) + "(final " + retType + " " + privName + "){");
-        out.println("\t\t" + cdesc.getPushAddrStatementFor("getRuntime()", "this.raw.bufferPtr + " + offsetName, privName));
-        out.println("\t}");
-    }
-
-    private void writeStructField(final Struct.Field field, final PrintStream out){
-        if(field.type.getJType() == null || !(field.type.getJType() instanceof JStruct)){
-            out.println("\t// Found bad JavaType (" + field.type.getJType() + ") for field (" + field.name + ") of type (" + field.type + ")");
-            return;
-        }
-        String privName = field.name + "__";
-        String offsetName = field.name.toUpperCase() + "_OFFSET";
-        JStruct jstype = (JStruct) field.type.getJType();
-        String retTypeName = jstype.getJavaReturnTypeName();
-        out.println();
-        out.println("\tprivate static final int " + offsetName + " = " + JObjCRuntime.class.getName() + ".IS64"
-                + " ? " + field.field64.offset64() + " : " + field.field32.offset32() + ";");
-
-        out.println("\tprivate " + retTypeName + " " + privName + " = null;");
-        out.println("\tpublic " + retTypeName + " " + getterName(field) + "(){");
-        out.println("\t\tif(null==" + privName + "){");
-        out.println("\t\t\tthis.raw.position(" + offsetName + ");");
-        out.println("\t\t\t" + privName + " = " + RootJObjCClass.runtimeFrameworkInstR(struct.parent.name) + ".make" + jstype.struct.name + "(this.raw.slice());");
-        out.println("\t\t}");
-        out.println("\t\treturn " + privName + ";");
-        out.println("\t}");
-    }
-
-    private String getterName(Struct.Field field) {
-        if(com.apple.internal.jobjc.generator.RestrictedKeywords.isRestricted(field.name))
-            return field.name + field.type.getJType().getAppendableDescription();
-        return field.name;
-    }
-
-    private String setterName(String name) {
-        return "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
-    }
-
-    @Override public void writeEnd(final PrintStream out) {
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Arg.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Arg.java
deleted file mode 100644
index ce296352c66..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Arg.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import org.w3c.dom.Node;
-
-public class Arg extends ElementWType<Function>{
-    public String javaName;
-
-    public Arg(final Node node, final Function parent) {
-        super(node, parent);
-        javaName = name;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/CFType.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/CFType.java
deleted file mode 100644
index d71eec5fe8a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/CFType.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.List;
-
-import org.w3c.dom.Node;
-
-import com.apple.internal.jobjc.generator.classes.CFTypeClassFile;
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-
-public class CFType extends TypeElement<Framework> implements OutputFileGenerator {
-    public final String getTypeIdFunc;
-    public final String tollfree;
-
-    public CFType(final Node node, final Framework parent) {
-        super(node, getAttr(node, "name"), parent);
-        getTypeIdFunc = getAttr(node, "gettypeid_func");
-        tollfree = getAttr(node, "tollfree");
-    }
-
-    public void generateClasses(final List<OutputFile> generatedClassFiles) {
-        generatedClassFiles.add(new CFTypeClassFile(this));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Category.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Category.java
deleted file mode 100644
index 8bd50646992..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Category.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.List;
-
-import com.apple.internal.jobjc.generator.classes.CategoryClassClassFile;
-import com.apple.internal.jobjc.generator.classes.CategoryClassFile;
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-
-public class Category implements OutputFileGenerator{
-    public final Clazz category;
-
-    public Category(Clazz fromClass, Clazz target) {
-        this.category = new Clazz(fromClass.name + "Category", fromClass.classMethods, fromClass.instanceMethods, target, fromClass.parent);
-    }
-
-    public void generateClasses(List<OutputFile> generatedClassFiles) {
-        generatedClassFiles.add(new CategoryClassFile(this));
-        generatedClassFiles.add(new CategoryClassClassFile(this));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java
deleted file mode 100644
index 3571974ccdb..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import com.apple.internal.jobjc.generator.RestrictedKeywords;
-import com.apple.internal.jobjc.generator.classes.JObjCClassClassFile;
-import com.apple.internal.jobjc.generator.classes.JObjCClassFile;
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-import com.apple.jobjc.MacOSXFramework;
-import com.apple.jobjc.SuperClassExtractor;
-import com.apple.jobjc.UnsafeRuntimeAccess;
-import com.apple.jobjc.NSClass.NSClassNotFoundException;
-import com.apple.jobjc.SEL;
-
-public class Clazz extends Element<Framework> implements OutputFileGenerator {
-    private final Map<String, Method> instanceMethodsByName = new HashMap<String, Method>();
-    private final Map<String, Method> classMethodsByName = new HashMap<String, Method>();
-
-    public final List<Method> classMethods;
-    public final List<Method> instanceMethods;
-
-    public final List<Clazz> subClassers = new ArrayList<Clazz>(0);
-    public Clazz superClass;
-
-    public Clazz(String name, List<Method> classMethods, List<Method> instanceMethods, Clazz superClass, Framework parent){
-        super(name, parent);
-        this.classMethods = classMethods;
-        this.instanceMethods = instanceMethods;
-        this.superClass = superClass;
-    }
-
-    public Clazz(final Node classNode, final Framework parent) {
-        super(classNode, parent);
-        this.classMethods = new ArrayList<Method>();
-        this.instanceMethods = new ArrayList<Method>();
-
-        final NodeList methodNodes = classNode.getChildNodes();
-        for (int i = 0; i < methodNodes.getLength(); i++) {
-            final Node node = methodNodes.item(i);
-            if (!"method".equals(node.getLocalName())) continue;
-
-            final String selName = Element.getAttr(node, "selector");
-            if(selName == null || !SEL.validName(selName)){
-                System.err.format("Warning: Discarding method %1$s:%2$s:%3$s"
-                        + " -- Invalid selector name. Verify.\n",
-                        parent.name, name, selName);
-                continue;
-            }
-
-            final Method method = new Method(node, parent);
-            if (method.isClassMethod) {
-                classMethods.add(method);
-            } else {
-                instanceMethods.add(method);
-            }
-        }
-    }
-
-    public String getPackage() {
-        return parent.pkg;
-    }
-
-    public String getFullPath(){
-        return parent.pkg + "." + name;
-    }
-
-    @Override
-    public String toString() {
-        return super.toString() + " " + classMethods + " " + instanceMethods;
-    }
-
-    public boolean doesActuallyExist(){
-        try{
-            UnsafeRuntimeAccess.getNSClass(parent.load(), name);
-        }catch(NSClassNotFoundException x){
-            return false;
-        }
-        return true;
-    }
-
-    void resolveSuperClass(final MacOSXFramework nativeFramework, final Map<String, Clazz> allClasses) throws Throwable {
-        superClass = SuperClassExtractor.getSuperClassFor(name, nativeFramework, allClasses);
-    }
-
-    public void disambiguateMethods() {
-        disambiguateMethods(instanceMethods, instanceMethodsByName);
-        disambiguateMethods(classMethods, classMethodsByName);
-    }
-
-    private void disambiguateMethods(final List<Method> methods, final Map<String, Method> methodMap) {
-        final Set<String> existingMethodNames = RestrictedKeywords.getNewRestrictedSet();
-        for (final Method method : methods) {
-            method.disambiguateNameAndArgs(this, existingMethodNames);
-            methodMap.put(method.javaName, method);
-        }
-    }
-
-    public void generateClasses(final List<OutputFile> generatedClassFiles) {
-        generatedClassFiles.add(new JObjCClassClassFile(this));
-        generatedClassFiles.add(new JObjCClassFile(this));
-    }
-
-    Method getParentMethodMatchingName(final String methodName) {
-        if(superClass == null) return null;
-        Method m = superClass.getMethodNamed(methodName);
-        if(m != null) return m;
-        return superClass.getParentMethodMatchingName(methodName);
-    }
-
-    private Method getMethodNamed(final String methodName) {
-        final Method instanceMethod = instanceMethodsByName.get(methodName);
-        if (instanceMethod != null) return instanceMethod;
-
-        final Method classMethod = classMethodsByName.get(methodName);
-        if (classMethod != null) return classMethod;
-
-        return null;
-    }
-
-    int compareTo(Clazz o) {
-      return toString().compareTo(o.toString());
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Constant.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Constant.java
deleted file mode 100644
index b5c0b627649..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Constant.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import org.w3c.dom.Node;
-
-public class Constant extends ElementWType<Framework> {
-    public Constant(final Node node, final Framework parent) {
-        super(node, parent);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Element.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Element.java
deleted file mode 100644
index 47fff332e6b..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Element.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import com.apple.internal.jobjc.generator.model.types.Type;
-import com.apple.internal.jobjc.generator.utils.ObjectInspector;
-
-/**
- * Subclasses must implement ctor(Node, P)
- */
-public class Element <P extends Element<?>> implements Comparable<Element<?>>{
-    public final String name;
-    public final P parent;
-
-    public Element(final String name, final P parent) {
-        this.name = Type.cleanName(name);
-        this.parent = parent;
-    }
-
-    public Element(final Node node, final P parent) {
-        this(getAttr(node, "name"), parent);
-    }
-
-    public static String getAttr(final Node node, final String key) {
-        final NamedNodeMap attrs = node.getAttributes();
-        if (attrs == null) return null;
-        final Node name = attrs.getNamedItem(key);
-        if (name == null) return null;
-        return name.getNodeValue();
-    }
-
-    static <P extends Element<?>, T extends Element<P>> List<T> getNodesFor(final Node parentNode, final String selection, final Class<T> clazz, final P parent) {
-        Constructor<T> ctor;
-        try {
-            ctor = clazz.getConstructor(new Class[] { Node.class, parent.getClass() });
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-
-        final NodeList childNodes = parentNode.getChildNodes();
-        final List<T> nodes = new ArrayList<T>();
-        for (int i = 0; i < childNodes.getLength(); i++) {
-            final Node node = childNodes.item(i);
-            if (!selection.equals(node.getLocalName())) continue;
-
-            T obj;
-            try {
-                obj = ctor.newInstance(new Object[] { node, parent });
-            } catch (InvocationTargetException e) {
-                throw new RuntimeException(e.getCause());
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-            nodes.add(obj);
-        }
-
-        return nodes;
-    }
-
-    @Override public String toString() {
-        return name;
-    }
-
-    public String reflectOnMySelf() {
-        return ObjectInspector.inspect(this);
-    }
-
-    public int compareTo(Element<?> o) {
-        return name.compareTo(o.name);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ElementWType.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ElementWType.java
deleted file mode 100644
index 8bb31b9449e..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ElementWType.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import com.apple.internal.jobjc.generator.model.types.NType;
-import org.w3c.dom.Node;
-
-import com.apple.internal.jobjc.generator.model.types.Type;
-import com.apple.internal.jobjc.generator.utils.NTypeParser;
-
-/**
- * An ElementWType has a type but does not necessarily represent a type. Examples are constants, enums, arguments, return values.
- */
-public class ElementWType<P extends Element<?>> extends Element<P> {
-    public final Type type;
-
-    public ElementWType(final String name, final Type t, final P parent) {
-        super(name, parent);
-        this.type = t;
-    }
-
-    public ElementWType(final Node node, final Type t, final P parent) {
-        super(node, parent);
-        this.type = t;
-    }
-
-    public ElementWType(final Node node, final String declType, final P parent) {
-        super(node, parent);
-        final String type32 = getAttr(node, "type");
-        final String type64 = getAttr(node, "type64");
-        this.type = Type.getType(declType,
-                        type32 == null ? NType.NUnknown.inst() : NTypeParser.parseFrom(type32),
-                        type64 == null ? null : NTypeParser.parseFrom(type64));
-    }
-
-    public ElementWType(final Node node, final P parent){
-        this(node, getAttr(node, "declared_type"), parent);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Framework.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Framework.java
deleted file mode 100644
index a63be7d4106..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Framework.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-import com.apple.internal.jobjc.generator.ClassGenerator;
-import com.apple.internal.jobjc.generator.Utils;
-import com.apple.internal.jobjc.generator.classes.FrameworkClassFile;
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-import com.apple.internal.jobjc.generator.utils.Fp;
-import com.apple.internal.jobjc.generator.utils.Fp.Map1;
-import com.apple.jobjc.MacOSXFramework;
-import com.apple.jobjc.UnsafeRuntimeAccess;
-
-public class Framework extends Element<Element<?>> implements OutputFileGenerator {
-    public final String path;
-    public final String pkg;
-    public final List<File> binaries;
-    public MacOSXFramework nativeFramework;
-
-    public MacOSXFramework load(){
-        if(nativeFramework == null){
-            String[] bins = new String[binaries.size()];
-            for(int i = 0; i < binaries.size(); ++i)
-                bins[i] = Utils.getCanonicalPath(binaries.get(i));
-            nativeFramework = UnsafeRuntimeAccess.getFramework(bins);
-        }
-        return nativeFramework;
-    }
-
-    public File getMainFrameworkBinary(){ return binaries.get(0); }
-
-    final Node rootNode;
-
-    public Set<Clazz> classes;
-    public List<Struct> structs;
-    public List<CFType> cfTypes;
-    public List<Opaque> opaques;
-    public List<Constant> constants;
-    public List<StringConstant> stringConstants;
-    public List<NativeEnum> enums;
-    public List<Function> functions;
-    public List<FunctionAlias> functionAliases;
-    public List<InformalProtocol> informalProtocols;
-    public List<Protocol> protocols;
-    public List<Category> categories;
-    public List<FrameworkDependency> dependencies;
-
-    public static class FrameworkDependency extends Element<Framework>{
-        final String path;
-        public Framework object = null;
-
-        public FrameworkDependency(final Node node, final Framework parent) {
-            super(getAttr(node, "path").replaceFirst("^.*/([^/]+)\\.framework$", "$1"), parent);
-            this.path = getAttr(node, "path");
-        }
-    }
-
-    public static final XPath XPATH = XPathFactory.newInstance().newXPath();
-    public Framework(final String name, final File bsFile) {
-        super(name, null);
-        try {
-            final File pathf = bsFile.getCanonicalFile().getParentFile().getParentFile().getParentFile();
-            path = pathf.getParentFile().getParentFile().getCanonicalPath();
-        } catch (IOException x) {
-            throw new RuntimeException(x);
-        }
-        binaries = findBinaries(path, name);
-
-        pkg = ClassGenerator.JOBJC_PACKAGE + "." + name.toLowerCase();
-        try {
-            rootNode = (Node)XPATH.evaluate("signatures", new InputSource(bsFile.getAbsolutePath()), XPathConstants.NODE);
-        } catch (final XPathExpressionException e) { throw new RuntimeException(e); }
-        protocols = new ArrayList<Protocol>();
-        categories = new ArrayList<Category>();
-    }
-
-    private static List<File> findBinaries(final String rootPath, final String name){
-        List<File> bins = new ArrayList<File>(2);
-
-        File mainBin = new File(rootPath, name);
-        if(mainBin.exists()) bins.add(mainBin);
-
-        File bsBin = new File(rootPath, "Resources/BridgeSupport/" + name + ".dylib");
-        if(bsBin.exists()) bins.add(bsBin);
-
-        return bins;
-    }
-
-    public void parseDependencies(final Collection<Framework> frameworks) {
-        // Parse
-        dependencies = getNodesFor(rootNode, "depends_on", FrameworkDependency.class, this);
-        // Resolve
-        for(final FrameworkDependency dep : dependencies)
-            dep.object = Fp.find(new Map1<Framework,Boolean>(){
-                public Boolean apply(Framework f) {
-                    return f.path.equals(dep.path);
-                }}, frameworks);
-    }
-
-    public void parseStructs() {
-        structs = getNodesFor(rootNode, "struct", Struct.class, this);
-
-        // HACK BS bug #6100313
-        if(Utils.isSnowLeopard && name.equals("IOBluetooth"))
-            structs.remove(getStructByName("BluetoothHCIRequestNotificationInfo"));
-
-        // GLIFunctionDispatch is frequently out of sync in BS / system
-        if(name.equals("OpenGL"))
-            structs.remove(getStructByName("GLIFunctionDispatch"));
-    }
-
-    public void parseCFTypes() {
-        cfTypes = getNodesFor(rootNode, "cftype", CFType.class, this);
-    }
-
-    public void parseOpaques() {
-        opaques = getNodesFor(rootNode, "opaque", Opaque.class, this);
-    }
-
-    public void parseConstants() {
-        constants = getNodesFor(rootNode, "constant", Constant.class, this);
-        stringConstants = getNodesFor(rootNode, "string_constant", StringConstant.class, this);
-        enums = getNodesFor(rootNode, "enum", NativeEnum.class, this);
-    }
-
-    public void parseFunctions() {
-        functions = getNodesFor(rootNode, "function", Function.class, this);
-        functionAliases = getNodesFor(rootNode, "function_alias", FunctionAlias.class, this);
-    }
-
-    public void parseClasses() {
-        classes = new HashSet<Clazz>(getNodesFor(rootNode, "class", Clazz.class, this));
-        classes = Fp.filterSet(new Map1<Clazz,Boolean>(){
-            public Boolean apply(Clazz a) {
-                if(a.doesActuallyExist())
-                    return true;
-                else{
-                    System.out.println("Could not find class " + name + ":" + a.name + " in runtime. Discarding.");
-                    return false;
-                }
-            }}, classes);
-        informalProtocols = getNodesFor(rootNode, "informal_protocol", InformalProtocol.class, this);
-    }
-
-    public void resolveSuperClasses(final Map<String, Clazz> allClasses) throws Throwable {
-        load();
-        for (final Clazz clazz : classes)
-            clazz.resolveSuperClass(nativeFramework, allClasses);
-    }
-
-    public void generateClasses(final List<OutputFile> generatedClassFiles) {
-        generatedClassFiles.add(new FrameworkClassFile(this));
-
-        final List<List<OutputFileGenerator>> generatorLists =
-                  Utils.list(new ArrayList<Clazz>(classes), structs, cfTypes, opaques, categories);
-        for (final List<OutputFileGenerator> generators : generatorLists) {
-            for (final OutputFileGenerator generator : generators)
-                generator.generateClasses(generatedClassFiles);
-        }
-    }
-
-    @Override public String toString() { return reflectOnMySelf(); }
-
-    public Struct getStructByName(final String stname) {
-        return Fp.find(new Fp.Map1<Struct,Boolean>(){
-            public Boolean apply(Struct a) {
-                return stname.equals(a.name);
-            }}, structs);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Function.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Function.java
deleted file mode 100644
index c08d99925e9..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Function.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.*;
-
-import org.w3c.dom.*;
-
-import com.apple.internal.jobjc.generator.RestrictedKeywords;
-
-public class Function extends Element<Framework> {
-    public final boolean variadic;
-    public final List<Arg> args;
-    public final ReturnValue returnValue;
-
-    public Function(final Node node, final Framework parent) {
-        this(node, getAttr(node, "name"), parent);
-    }
-
-    public Function(final Node node, final String name, final Framework parent) {
-        super(name, parent);
-
-        this.variadic = "true".equals(getAttr(node, "variadic"));
-        this.args = new ArrayList<Arg>();
-
-        ReturnValue returnValue = null;
-
-        final NodeList children = node.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            final Node child = children.item(i);
-            final String childName = child.getLocalName();
-
-            if ("retval".equals(childName)) {
-                returnValue = new ReturnValue(child, this);
-            }
-
-            if ("arg".equals(childName)) {
-                final Arg arg = new Arg(child, this);
-                if (arg.name == null || "".equals(arg.name)) {
-                    arg.javaName = "arg" + i;
-                }
-                args.add(arg);
-            }
-        }
-
-        if (returnValue == null) returnValue = ReturnValue.VOID;
-        this.returnValue = returnValue;
-    }
-
-    public String getJavaName(){ return name; }
-
-    public void disambiguateArgs() {
-        final Set<String> priorArgs = RestrictedKeywords.getNewRestrictedSet();
-        for (int i = 0; i < args.size(); i++) {
-            final Arg arg = args.get(i);
-            if (priorArgs.contains(arg.name)) arg.javaName = arg.javaName + i;
-            priorArgs.add(arg.javaName);
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/FunctionAlias.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/FunctionAlias.java
deleted file mode 100644
index 641d5b5c92d..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/FunctionAlias.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import org.w3c.dom.Node;
-
-public class FunctionAlias extends Element<Framework> {
-    public FunctionAlias(final Node node, final Framework parent) {
-        super(node, parent);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/InformalProtocol.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/InformalProtocol.java
deleted file mode 100644
index 8213e7d1b2c..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/InformalProtocol.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import org.w3c.dom.Node;
-
-public class InformalProtocol extends Element<Framework> {
-    public InformalProtocol(final Node node, final Framework parent) {
-        super(node, parent);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Method.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Method.java
deleted file mode 100644
index a1099078a4d..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Method.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.Set;
-import org.w3c.dom.Node;
-import com.apple.jobjc.SEL;
-import com.apple.internal.jobjc.generator.Utils;
-
-public class Method extends Function {
-    public final boolean isClassMethod;
-
-    public String javaName;
-
-    public boolean ignore;
-    public String suggestion;
-
-    public Method(final Node node, final Framework fw) {
-        super(node, getAttr(node, "selector"), fw);
-        this.javaName = SEL.jMethodName(name);
-        this.isClassMethod = "true".equals(getAttr(node, "class_method"));
-        this.ignore = "true".equals(getAttr(node, "ignore"));
-        this.suggestion = getAttr(node, "suggestion");
-    }
-
-    @Override public String getJavaName(){ return javaName; }
-
-    @Override public String toString() {
-        return returnValue + " " + super.toString() + args;
-    }
-
-    public boolean returnTypeEquals(final ReturnValue returnValueIn) {
-        return returnValue.type.getJType().getJavaReturnTypeName().equals(returnValueIn.type.getJType().getJavaReturnTypeName());
-    }
-
-    public void disambiguateNameAndArgs(final Clazz parentClazz, final Set<String> existingMethodNames) {
-        javaName = getDisambiguatedNameFor(parentClazz, javaName, existingMethodNames);
-        disambiguateArgs();
-    }
-
-    private String getDisambiguatedNameFor(final Clazz parentClazz, final String proposedName, final Set<String> existingNames) {
-        // Does this method override a parent class method and change the return type? Example: IOBlueToothSDPUUID length
-        {
-            final Method superClassMethod = parentClazz.getParentMethodMatchingName(proposedName);
-            if (superClassMethod != null && !superClassMethod.returnValue.equals(returnValue)) {
-                final String usingReturnType = createMethodNameAppendingReturnType(proposedName);
-                if(existingNames.add(usingReturnType))
-                    return usingReturnType;
-            }
-        }
-
-        if(existingNames.add(proposedName))
-            return proposedName;
-
-        final String usingReturnType = createMethodNameAppendingReturnType(proposedName);
-        if(existingNames.add(usingReturnType))
-            return usingReturnType;
-
-        throw new RuntimeException("Unable to disambiguate method: " + this);
-    }
-
-    private String createMethodNameAppendingReturnType(final String proposedName) {
-        return proposedName + Utils.capitalize(returnValue.type.getJType().getAppendableDescription().replaceAll(".+\\.", ""));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/NativeEnum.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/NativeEnum.java
deleted file mode 100644
index e6bbd9b0652..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/NativeEnum.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.Arrays;
-
-import org.w3c.dom.Node;
-
-import com.apple.internal.jobjc.generator.model.types.Type;
-import com.apple.internal.jobjc.generator.model.types.JType.JPrimitive;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.internal.jobjc.generator.utils.Fp;
-import com.apple.jobjc.JObjCRuntime;
-
-public class NativeEnum extends ElementWType<Framework> {
-    public final String value, value64, le_value, be_value;
-    public boolean ignore;
-    public String suggestion;
-    public NativeEnum(final Node node, final Framework parent) {
-        super(node, typeForEnum(getAttr(node, "name"),
-                getAttr(node, "value"), getAttr(node, "value64"),
-                getAttr(node, "le_value"), getAttr(node, "be_value"),
-                getAttr(node, "ignore")), parent);
-        this.value = getAttr(node, "value");
-        this.value64 = getAttr(node, "value64");
-        this.le_value = getAttr(node, "le_value");
-        this.be_value = getAttr(node, "be_value");
-        String ignoreS = getAttr(node, "ignore");
-        this.ignore = ignoreS == null ? false : Boolean.parseBoolean(ignoreS);
-        this.suggestion = getAttr(node, "suggestion");
-        assert valueToString() != null;
-    }
-
-    private static Type typeForEnum(String name, String value32, String value64, String le_value, String be_value, String ignore){
-        if("true".equals(ignore)) return Type.getType(null, NPrimitive.inst('i'), null);
-
-        NumTest[] tests = new NumTest[]{new IntTest(), new LongTest(), new FloatTest(), new DoubleTest()};
-        for(NumTest t : tests)
-            if(t.confirm(value32, value64, le_value, be_value))
-                return t.getType();
-
-        throw new NumberFormatException(String.format("Failed to parse type for enum: %1$s = 32: %2$s / 64: %3$s / le: %4$s / be: %5$s\n",
-                name, value32, value64, le_value, be_value));
-    }
-
-    public String valueToString(){
-        if(ignore == true) return "0";
-        JPrimitive jprim = (JPrimitive) type.getJType();
-        if(le_value == null && be_value == null){
-            if(value == null && value64 != null)
-                return value64 + jprim.getLiteralSuffix();
-            else if(value != null && value64 == null)
-                return value + jprim.getLiteralSuffix();
-            else
-                return String.format("(%1$s.IS64 ? %2$s%4$s : %3$s%4$s)", JObjCRuntime.class.getName(),
-                        value64, value, jprim.getLiteralSuffix());
-        }
-        else if(value == null && value64 == null){
-            return String.format("(%1$s.IS_BIG_ENDIAN ? %2$s%4$s : %3$s%4$s)",
-                    JObjCRuntime.class.getName(), be_value, le_value, jprim.getLiteralSuffix());
-        }
-
-        throw new RuntimeException("Unable to produce a value for enum " + name);
-    }
-
-    // Used to find the best type to use for the enum.
-
-    static abstract class NumTest{
-        public boolean confirm(String... values){
-            return Fp.all(new Fp.Map1<String,Boolean>(){
-                public Boolean apply(String a) {
-                    try{ return a == null || confirm(a); }
-                    catch(Exception x){ return false; }
-                }},
-                Arrays.asList(values));
-        }
-
-        public abstract boolean confirm(String v);
-        public abstract Type getType();
-    }
-
-    static class IntTest extends NumTest{
-        @Override public boolean confirm(String v) {
-            Integer.parseInt(v);
-            return true;
-        }
-
-        @Override public Type getType() { return Type.getType(null, NPrimitive.inst('i'), null); }
-    }
-
-    static class LongTest extends NumTest{
-        @Override public boolean confirm(String v) {
-            Long.parseLong(v);
-            return true;
-        }
-
-        @Override public Type getType() { return Type.getType(null, NPrimitive.inst('l'), null); }
-    }
-
-    static class FloatTest extends NumTest{
-        @Override public boolean confirm(String v) {
-            return Float.parseFloat(v) == Double.parseDouble(v);
-        }
-
-        @Override public Type getType() { return Type.getType(null, NPrimitive.inst('f'), null); }
-    }
-
-    static class DoubleTest extends NumTest{
-        @Override public boolean confirm(String v) {
-            double d = Double.parseDouble(v);
-            return !Double.isInfinite(d) && !Double.isNaN(d);
-        }
-
-        @Override public Type getType() { return Type.getType(null, NPrimitive.inst('d'), null); }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Opaque.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Opaque.java
deleted file mode 100644
index 9cc4317d855..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Opaque.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.List;
-
-import org.w3c.dom.Node;
-
-import com.apple.internal.jobjc.generator.classes.OpaqueClassFile;
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-
-public class Opaque extends TypeElement<Framework> implements OutputFileGenerator {
-    public Opaque(final Node node, final Framework parent) {
-        super(node, getAttr(node, "name"), parent);
-    }
-
-    public void generateClasses(final List<OutputFile> generatedClassFiles) {
-        generatedClassFiles.add(new OpaqueClassFile(this));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/OutputFileGenerator.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/OutputFileGenerator.java
deleted file mode 100644
index ac4b71d4d31..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/OutputFileGenerator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.List;
-
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-
-public interface OutputFileGenerator {
-    public void generateClasses(final List<OutputFile> generatedClassFiles);
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Protocol.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Protocol.java
deleted file mode 100644
index b0e548e63f3..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Protocol.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-public class Protocol {
-
-    public Protocol(final Clazz protocol) {
-
-    }
-
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ReturnValue.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ReturnValue.java
deleted file mode 100644
index 320f55a086a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/ReturnValue.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import org.w3c.dom.Node;
-
-import com.apple.internal.jobjc.generator.model.types.Type;
-
-public class ReturnValue extends ElementWType<Function>{
-    public static ReturnValue VOID = new ReturnValue(Type.VOID);
-
-    public ReturnValue(final Node node, final Function parent) {
-        super(node, parent);
-    }
-
-    public ReturnValue(Type type) {
-        super("return value", type, null); // TODO bad style, the null might lead to trouble
-    }
-
-    @Override public boolean equals(Object o){
-        return o instanceof ReturnValue && type.equals(((ReturnValue)o).type);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/StringConstant.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/StringConstant.java
deleted file mode 100644
index acfbc6ab4a7..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/StringConstant.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import org.w3c.dom.Node;
-
-public class StringConstant extends Element<Framework> {
-    public final String value;
-
-    public StringConstant(final Node node, final Framework parent) {
-        super(node, parent);
-        this.value = getAttr(node, "value");
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Struct.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Struct.java
deleted file mode 100644
index b583cdbf59c..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Struct.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import java.util.List;
-
-import org.w3c.dom.Node;
-
-import com.apple.internal.jobjc.generator.classes.OutputFile;
-import com.apple.internal.jobjc.generator.classes.StructClassFile;
-import com.apple.internal.jobjc.generator.model.types.Type;
-import com.apple.internal.jobjc.generator.model.types.NType.NField;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.utils.Fp;
-import com.apple.internal.jobjc.generator.utils.QA;
-import com.apple.internal.jobjc.generator.utils.Fp.Map2;
-
-/**
- * A struct has the following restrictions:
- *
- *    - type32.fields.count == type64.fields.count
- *    - forAll i: type32.field[i].name == type64.field[i].name
- *    - forAll i: type32.field[i].class == type64.field[i].class
- */
-public class Struct extends TypeElement<Framework> implements OutputFileGenerator {
-    public final List<Field> fields;
-    public static class Field{
-        public final String name;
-        public final Type type;
-        public final NField field32, field64;
-        public Field(String name, NField field32, NField field64) {
-            QA.nonNull(name);
-            this.name = name;
-            // TODO <field> really should have a declared_type attr. See if BS patch is possible.
-            this.type = Type.getType(null, field32.type, field64.type);
-            this.field32 = field32;
-            this.field64 = field64;
-        }
-    }
-
-    public Struct(final Node node, final Framework parent) throws Throwable {
-        super(node, getAttr(node, "name"), parent);
-        NStruct nstruct32 = (NStruct) type.type32;
-        NStruct nstruct64 = (NStruct) type.type64;
-        this.fields = Fp.map2(new Map2<NField,NField,Field>(){
-            public Field apply(NField f32, NField f64) {
-                assert f32.name.equals(f64.name);
-                return new Field(f32.name, f32, f64);
-            }
-        }, nstruct32.fields, nstruct64.fields);
-    }
-
-    public void generateClasses(final List<OutputFile> generatedClassFiles) {
-        generatedClassFiles.add(new StructClassFile(this));
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/TypeElement.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/TypeElement.java
deleted file mode 100644
index b7b826edef2..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/TypeElement.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model;
-
-import org.w3c.dom.Node;
-
-import com.apple.internal.jobjc.generator.model.types.Type;
-
-/**
- * A TypeElement represents a Type, such as a struct or cftype.
- */
-public abstract class TypeElement<P extends Element<?>> extends ElementWType<P> {
-    public TypeElement(String name, Type type, final P parent) {
-        super(name, type, parent);
-    }
-
-    public TypeElement(final Node node, final String declType, final P parent) {
-        super(node, declType, parent);
-    }
-
-    public TypeElement(final Node node, final P parent) {
-        super(node, parent);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/CoderDescriptor.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/CoderDescriptor.java
deleted file mode 100644
index b7a734fa975..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/CoderDescriptor.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.coders;
-
-import com.apple.internal.jobjc.generator.model.types.JType.JStruct;
-import com.apple.jobjc.Coder;
-import com.apple.jobjc.Coder.IDCoder;
-import com.apple.jobjc.Coder.NSClassCoder;
-import com.apple.jobjc.Coder.PointerCoder;
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-import com.apple.jobjc.Coder.SELCoder;
-import com.apple.jobjc.Coder.UnknownCoder;
-import com.apple.jobjc.Coder.VoidCoder;
-
-public class CoderDescriptor {
-    public static final CoderDescriptor VOID_DESC = new CoderDescriptor(VoidCoder.INST, null, null);
-
-    final Coder coder;
-    private final String coderInstanceName;
-    final String pushName;
-    final String popName;
-
-    public String mismatchMessage(){ return null; }
-
-    public CoderDescriptor(final Coder coder, final String pushName, final String popName) {
-        this.coder = coder;
-        this.coderInstanceName = coder.getClass().getCanonicalName() + ".INST";
-        if (coderInstanceName == null) throw new NullPointerException();
-
-        this.pushName = pushName;
-        this.popName = popName;
-    }
-
-    public CoderDescriptor(final String pushName, final String popName) {
-        this.coder = null;
-        this.coderInstanceName = null;
-        this.pushName = pushName;
-        this.popName = popName;
-    }
-
-    public CoderDescriptor(final Coder coder) { this(coder, "push", "pop"); }
-    public CoderDescriptor(){ this("push", "pop"); }
-
-    public String getPopStatementFor(final String contextName, final String returnValueType, final String returnValueName, final String transform) {
-        return "final " + returnValueType + " " + returnValueName + " = " + "(" + returnValueType + ") " + (transform == null ? "" : transform)
-        + "(" + getCoderInstanceName() + "." + popName + "(" + contextName + "));";
-    }
-
-    public final String getPushStatementFor(final String contextName, final String argumentName) {
-        return getCoderInstanceName() + "." + pushName + "(" + contextName + ", " + argumentName + ");";
-    }
-
-    public String getPopAddrStatementFor(final String runtime, final String addr, final String returnValueType, final String returnValueName, final String transform) {
-        return "final " + returnValueType + " " + returnValueName + " = " + "(" + returnValueType + ") " + (transform == null ? "" : transform)
-        + "(" + getCoderInstanceName() + "." + popName + "(" + runtime + ", " + addr + "));";
-    }
-
-    public final String getPushAddrStatementFor(final String runtime, final String addr, final String argumentName) {
-        return getCoderInstanceName() + "." + pushName + "(" + runtime + ", " + addr + ", " + argumentName + ");";
-    }
-
-    public String getCoderInstanceName() { return coderInstanceName; }
-    public Coder getCoder() { return coder; }
-    public String getDefaultReturnValue() { return "null"; }
-
-    //
-    // Specialized
-    //
-
-    static public class UnknownCoderDescriptor extends CoderDescriptor {
-        public static final CoderDescriptor UNKNOWN_DESC = new UnknownCoderDescriptor();
-        public UnknownCoderDescriptor() { super(UnknownCoder.INST); }
-    }
-
-    static public class PrimitivePointerCoderDescriptor extends CoderDescriptor {
-        public static final PrimitivePointerCoderDescriptor POINTER_DESC = new PrimitivePointerCoderDescriptor();
-        public PrimitivePointerCoderDescriptor() { super(PrimitivePointerCoder.INST, "push", "popPtr"); }
-    }
-
-    static public class PointerCoderDescriptor extends CoderDescriptor {
-        public static final PointerCoderDescriptor INST = new PointerCoderDescriptor();
-        public PointerCoderDescriptor() { super(PointerCoder.INST); }
-    }
-
-    static public class SELCoderDescriptor extends CoderDescriptor {
-        public static final SELCoderDescriptor INST = new SELCoderDescriptor();
-        public SELCoderDescriptor() { super(SELCoder.INST); }
-    }
-
-    static public class IDCoderDescriptor extends CoderDescriptor {
-        public static final IDCoderDescriptor INST = new IDCoderDescriptor();
-        public IDCoderDescriptor() { super(IDCoder.INST); }
-    }
-
-    static public class NSClassCoderDescriptor extends CoderDescriptor {
-        public static final NSClassCoderDescriptor INST = new NSClassCoderDescriptor();
-        public NSClassCoderDescriptor() { super(NSClassCoder.INST); }
-    }
-
-    static public class StructCoderDescriptor extends CoderDescriptor {
-        public final JStruct jstruct;
-        public StructCoderDescriptor(JStruct jst) { this.jstruct = jst; }
-        @Override public String getCoderInstanceName(){ return jstruct.getJavaTypeName() + ".getStructCoder()"; }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java
deleted file mode 100644
index 929b0744ec3..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.coders;
-
-import java.util.HashMap;
-import java.util.TreeSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.apple.internal.jobjc.generator.classes.MixedPrimitiveCoderClassFile;
-import com.apple.internal.jobjc.generator.model.types.NType;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.internal.jobjc.generator.utils.Fp.Pair;
-import com.apple.jobjc.JObjCRuntime;
-
-/**
- * Used to code two primitives of different 32/64 types.
- */
-public class ComplexCoderDescriptor extends CoderDescriptor {
-    static Map<Pair<NType,NType>, ComplexCoderDescriptor> cache = new HashMap<Pair<NType,NType>, ComplexCoderDescriptor>();
-    static Set<MixedEncodingDescriptor> mixedEncodingDescriptors = new TreeSet<MixedEncodingDescriptor>();
-
-    public static Set<MixedEncodingDescriptor> getMixedEncoders() { return mixedEncodingDescriptors; }
-
-    public static ComplexCoderDescriptor getCoderDescriptorFor(final NType nt32, final NType nt64) {
-        Pair<NType,NType> cacheKey = new Pair(nt32, nt64);
-        if(cache.containsKey(cacheKey)) return cache.get(cacheKey);
-
-        final PrimitiveCoderDescriptor desc32 = PrimitiveCoderDescriptor.getCoderDescriptorFor((NPrimitive) nt32);
-        final PrimitiveCoderDescriptor desc64 = PrimitiveCoderDescriptor.getCoderDescriptorFor((NPrimitive) nt64);
-
-        final ComplexCoderDescriptor newDesc = nt32.equals(nt64) ? new ComplexCoderDescriptor(desc64) : new MixedEncodingDescriptor(desc32, desc64);
-        cache.put(cacheKey, newDesc);
-        if(newDesc instanceof MixedEncodingDescriptor)
-            mixedEncodingDescriptors.add((MixedEncodingDescriptor) newDesc);
-
-        return newDesc;
-    }
-
-    protected final PrimitiveCoderDescriptor desc64;
-
-    public ComplexCoderDescriptor(final PrimitiveCoderDescriptor desc64) {
-        super(desc64.coder, desc64.pushName, desc64.popName);
-        this.desc64 = desc64;
-    }
-
-    public String getName() { return desc64.javaPrimitiveClazz.getName(); }
-    @Override public String getDefaultReturnValue() { return desc64.defaultReturnValue; }
-    public String getJavaObjectClass() { return desc64.javaObjectClazz.getName(); }
-    public String getDefinition() { return get64CoderName(); }
-    public String getCoderAccessor() { return get64CoderName(); }
-    String get64CoderName() { return desc64.getCoderInstanceName(); }
-
-    // ** Subclasses
-    // -------------
-
-    public static class MixedEncodingDescriptor extends ComplexCoderDescriptor implements java.lang.Comparable {
-        protected final PrimitiveCoderDescriptor desc32;
-
-        public MixedEncodingDescriptor(final PrimitiveCoderDescriptor desc32, final PrimitiveCoderDescriptor desc64) {
-            super(desc64);
-            this.desc32 = desc32;
-        }
-
-        @Override public String getDefinition() { return JObjCRuntime.class.getName() + ".IS64 ? " + get64CoderName() + " : " + get32CoderName(); }
-        @Override public String getCoderAccessor() { return MixedPrimitiveCoderClassFile.FULL_MULTI_CODER_CLASSNAME + "." + getMixedName(); }
-        String get32CoderName() { return desc32.getCoderInstanceName(); }
-        @Override public String getCoderInstanceName(){ return getCoderAccessor(); }
-        @Override public String toString() { return getMixedName(); }
-
-        public String getMixedName() {
-            final String coder32Name = getBaseNameOfCoder(desc32.primitiveCoderName);
-            final String coder64Name = getBaseNameOfCoder(desc64.primitiveCoderName);
-            return coder32Name + coder64Name + "Coder";
-        }
-
-        static String getBaseNameOfCoder(final String coderName) { return coderName.substring(0, coderName.indexOf("Coder")); }
-        public int compareTo(Object _o) { MixedEncodingDescriptor o = (MixedEncodingDescriptor)_o; return getMixedName().compareTo(o.getMixedName()); }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/PrimitiveCoderDescriptor.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/PrimitiveCoderDescriptor.java
deleted file mode 100644
index 82684415120..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/PrimitiveCoderDescriptor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.coders;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.jobjc.Coder;
-import com.apple.jobjc.PrimitiveCoder;
-import com.apple.jobjc.PrimitiveCoder.BoolCoder;
-import com.apple.jobjc.PrimitiveCoder.SCharCoder;
-import com.apple.jobjc.PrimitiveCoder.SIntCoder;
-import com.apple.jobjc.PrimitiveCoder.SLongCoder;
-import com.apple.jobjc.PrimitiveCoder.SLongLongCoder;
-import com.apple.jobjc.PrimitiveCoder.SShortCoder;
-import com.apple.jobjc.PrimitiveCoder.UCharCoder;
-import com.apple.jobjc.PrimitiveCoder.UIntCoder;
-import com.apple.jobjc.PrimitiveCoder.ULongCoder;
-import com.apple.jobjc.PrimitiveCoder.ULongLongCoder;
-import com.apple.jobjc.PrimitiveCoder.UShortCoder;
-import com.apple.internal.jobjc.generator.Utils;
-
-public class PrimitiveCoderDescriptor extends CoderDescriptor {
-    static Map<Character, PrimitiveCoderDescriptor> descriptors = new HashMap<Character, PrimitiveCoderDescriptor>();
-
-    public static PrimitiveCoderDescriptor getCoderDescriptorFor(NPrimitive nt) {
-        return getCoderDescriptorFor(nt.type);
-    }
-
-    public static PrimitiveCoderDescriptor getCoderDescriptorFor(char c) {
-        final PrimitiveCoderDescriptor desc = descriptors.get(c);
-        if (desc != null) return desc;
-        final PrimitiveCoderDescriptor newDesc = createCoderDescriptorFor(c);
-        descriptors.put(c, newDesc);
-        return newDesc;
-    }
-
-    public static PrimitiveCoderDescriptor createCoderDescriptorFor(final char encoding) {
-        switch(encoding) {
-            case 'B': return new PrimitiveCoderDescriptor(BoolCoder.INST, "false");
-
-            case 'c': return new PrimitiveCoderDescriptor(SCharCoder.INST, "0");
-            case 'C': return new PrimitiveCoderDescriptor(UCharCoder.INST, "0");
-
-            case 's': return new PrimitiveCoderDescriptor(SShortCoder.INST, "0");
-            case 'S': return new PrimitiveCoderDescriptor(UShortCoder.INST, "0");
-
-            case 'i': return new PrimitiveCoderDescriptor(SIntCoder.INST, "0");
-            case 'I': return new PrimitiveCoderDescriptor(UIntCoder.INST, "0");
-
-            case 'l': return new PrimitiveCoderDescriptor(SLongCoder.INST, "0");
-            case 'L': return new PrimitiveCoderDescriptor(ULongCoder.INST, "0", "x86_64: no suitable Java primitive for unsigned long.");
-            case 'q': return new PrimitiveCoderDescriptor(SLongLongCoder.INST, "0");
-            case 'Q': return new PrimitiveCoderDescriptor(ULongLongCoder.INST, "0", "x86_64: no suitable Java primitive for unsigned long long.");
-
-            case 'f': return new PrimitiveCoderDescriptor(PrimitiveCoder.FloatCoder.INST, "0");
-            case 'd': return new PrimitiveCoderDescriptor(PrimitiveCoder.DoubleCoder.INST, "0");
-            default: throw new RuntimeException("unknown encoding: " + encoding);
-        }
-    }
-
-    public final Class<?> javaPrimitiveClazz;
-    final Class<?> javaObjectClazz;
-    final String defaultReturnValue;
-    final String primitiveCoderName;
-    final String _mismatchMessage;
-
-    public PrimitiveCoderDescriptor(final Coder coder, final String defaultRetVal) {
-        this(coder, defaultRetVal, null);
-    }
-
-    public PrimitiveCoderDescriptor(final Coder coder,
-            final String defaultReturnValue, final String mismatchMessage) {
-        super(coder, "push", "pop" + Utils.capitalize(coder.getJavaPrimitive().getSimpleName()));
-        this.javaPrimitiveClazz = coder.getJavaPrimitive();
-        this.javaObjectClazz = coder.getJavaClass();
-        this.defaultReturnValue = defaultReturnValue;
-        this.primitiveCoderName = coder.getClass().getSimpleName();
-        this._mismatchMessage = mismatchMessage;
-    }
-
-    @Override public PrimitiveCoder getCoder(){ return (PrimitiveCoder) super.getCoder(); }
-    @Override public String mismatchMessage(){ return _mismatchMessage; }
-    @Override public String getDefaultReturnValue() { return defaultReturnValue; }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/JType.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/JType.java
deleted file mode 100644
index 56e0f4b2386..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/JType.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.types;
-
-import com.apple.internal.jobjc.generator.classes.RootJObjCClass;
-import com.apple.internal.jobjc.generator.model.CFType;
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Opaque;
-import com.apple.internal.jobjc.generator.model.Struct;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor;
-import com.apple.internal.jobjc.generator.model.coders.ComplexCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor.IDCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor.NSClassCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor.PointerCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor.SELCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor.StructCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.coders.CoderDescriptor.UnknownCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.jobjc.ID;
-import com.apple.jobjc.NSClass;
-import com.apple.jobjc.NativeArgumentBuffer;
-import com.apple.jobjc.Pointer;
-import com.apple.jobjc.SEL;
-
-public abstract class JType {
-    public abstract String getJavaTypeName();
-    public String getJavaClassName() { return getJavaTypeName().substring(getJavaTypeName().lastIndexOf('.') + 1); }
-    public String getJavaReturnTypeName() { return getJavaTypeName(); }
-    public String getReturnTypeCast() { return null; }
-    public String getTypeNameAsParam() { return getJavaTypeName(); }
-
-    public abstract CoderDescriptor getCoderDescriptor();
-    public String getDefaultReturnValue() { return "null"; }
-    public String getAppendableDescription() { return getJavaTypeName().substring(getJavaTypeName().lastIndexOf('.') + 1); }
-
-    /**
-     * Used for primitive types (like int) that can't be used as generic arguments. This returns an appropriate Java class (like Integer).
-     */
-    public JType getParameterizableType() { return this; }
-
-    //
-    // Writer ops
-    //
-
-    public String createDeclareBuffer(String contextName) {
-        return "final " + NativeArgumentBuffer.class.getName() + " " + contextName + " = getRuntime().getThreadLocalState();";
-    }
-
-    public String createInit(final String contextName, final String functionIdentifier, final String initWithObj) {
-        return functionIdentifier + ".init(" + contextName + (initWithObj != null ? ", " + initWithObj : "") + ");";
-    }
-
-    public String createInvoke(final String contextName, final String functionIdentifier) {
-        return functionIdentifier + ".invoke(" + contextName + ");";
-    }
-
-    public String createPop(final String contextName) {
-        return getCoderDescriptor().getPopStatementFor(contextName, getJavaTypeName(), "returnValue", null);
-    }
-
-    public String createPopAddr(final String runtime, final String addr) {
-        return getCoderDescriptor().getPopAddrStatementFor(runtime, addr, getJavaTypeName(), "returnValue", null);
-    }
-
-    public String createReturn() {
-        final String preCast = getReturnTypeCast();
-        return "return " + (preCast == null ? "" : "(" + preCast + ")") + "returnValue;";
-    }
-
-    //
-    // Specialized
-    //
-
-    static public class JUnknown extends JType {
-        final Type type;
-        protected JUnknown(final Type type) {
-            this.type = type;
-            TypeCache.inst().getUnknownTypes().add(type);
-        }
-        @Override public String getJavaTypeName() { return "Object /* " + type + " */"; }
-        @Override public String getAppendableDescription() { return "Unknown"; }
-        @Override public CoderDescriptor getCoderDescriptor() { return UnknownCoderDescriptor.UNKNOWN_DESC; }
-    }
-
-    static class JVoid extends JType {
-        public static JVoid INST = new JVoid();
-        @Override public String getJavaTypeName() { return "Void"; }
-        @Override public String getJavaReturnTypeName() { return "void"; }
-        @Override public CoderDescriptor getCoderDescriptor(){ return CoderDescriptor.VOID_DESC; }
-        @Override public String createPop(final String contextName){ return ""; }
-        @Override public String createReturn(){ return ""; }
-    };
-
-    static class JSelector extends JType {
-        public static JSelector INST = new JSelector();
-        @Override public String getJavaTypeName() { return SEL.class.getName(); }
-        @Override public CoderDescriptor getCoderDescriptor() { return SELCoderDescriptor.INST; }
-    };
-
-    static class JCFType extends JType{
-        final CFType cfType;
-        public JCFType(final CFType cfType){ this.cfType = cfType; }
-        @Override public String getJavaTypeName() { return cfType.parent.pkg + "." + cfType.name + "CFType"; }
-        @Override public CoderDescriptor getCoderDescriptor() { return PointerCoderDescriptor.INST; }
-        @Override public String createPop(final String contextName) {
-            return "\t\t" + getCoderDescriptor().getPopStatementFor(contextName, getJavaReturnTypeName(), "returnValue", "new " + getJavaTypeName());
-        }
-    }
-
-    static class JOpaque extends JType{
-        final Opaque opaque;
-        public JOpaque(final Opaque opaque){ this.opaque = opaque; }
-        @Override public String getJavaTypeName() { return opaque.parent.pkg + "." + opaque.name + "Opaque"; }
-        @Override public CoderDescriptor getCoderDescriptor() { return PointerCoderDescriptor.INST; }
-        @Override public String createPop(final String contextName) {
-            return "\t\t" + getCoderDescriptor().getPopStatementFor(contextName, getJavaReturnTypeName(), "returnValue", "new " + getJavaTypeName());
-        }
-    }
-
-    static class JPointer extends JType {
-        static JType VOID_PTR = new JPointer(JVoid.INST);
-
-        final JType subject;
-        protected JPointer(final JType javaType) { this.subject = javaType; }
-
-        @Override public String getJavaTypeName() { return Pointer.class.getName() + "<" + subject.getParameterizableType().getJavaTypeName() + ">"; }
-        @Override public String getAppendableDescription() { return "PointerTo" + subject.getAppendableDescription(); }
-        @Override public CoderDescriptor getCoderDescriptor() { return PointerCoderDescriptor.INST; }
-    }
-
-    static class JObject extends JType {
-        public static JType ID_TYPE = new JType() {
-            @Override public String getJavaTypeName() { return ID.class.getName(); }
-            @Override public String getJavaReturnTypeName() { return "<T extends " + getJavaTypeName() + "> T"; }
-            @Override public String getReturnTypeCast() { return "T"; }
-            @Override public CoderDescriptor getCoderDescriptor() { return IDCoderDescriptor.INST; }
-        };
-
-        final Type type;
-        final Clazz clazz;
-
-        public JObject(final Type type, final Clazz clazz) {
-            this.type = type;
-            this.clazz = clazz;
-        }
-
-        @Override public String getJavaTypeName() { return clazz.getFullPath();}
-        @Override public CoderDescriptor getCoderDescriptor() { return IDCoderDescriptor.INST; }
-    }
-
-    static class JClass extends JType {
-        public static JClass INST = new JClass();
-        @Override public String getJavaTypeName() { return NSClass.class.getName(); }
-        @Override public String getJavaReturnTypeName() { return "<T extends " + super.getJavaReturnTypeName() + "> T"; }
-        @Override public String getTypeNameAsParam() { return super.getTypeNameAsParam(); }
-        @Override public String getReturnTypeCast() { return "T"; }
-        @Override public CoderDescriptor getCoderDescriptor() { return NSClassCoderDescriptor.INST; }
-    };
-
-    public static class JStruct extends JType {
-        public final Struct struct;
-        public JStruct(final Struct struct) { this.struct = struct; }
-
-        @Override public String getJavaTypeName() { return struct.parent.pkg + "." + struct.name; }
-        @Override public String getJavaReturnTypeName() { return getJavaTypeName(); }
-
-        StructCoderDescriptor coderDescriptor = new StructCoderDescriptor(this);
-        @Override public CoderDescriptor getCoderDescriptor() { return coderDescriptor; }
-
-        public String createReturnValue() {
-            return "\t\t" + getJavaReturnTypeName() + " returnValue = " + RootJObjCClass.runtimeFrameworkInstR(struct.parent.name)
-            + ".make" + struct.name + "();";
-        }
-
-        @Override public String createInvoke(final String contextName, final String functionIdentifier) {
-            return createReturnValue() + "\n\t\t" + functionIdentifier + ".invoke(" + contextName + ", returnValue);";
-        }
-
-        @Override public String createPop(final String contextName){ return ""; }
-    }
-
-    public static class JPrimitive extends JType {
-        final Type type;
-        final ComplexCoderDescriptor coderDescriptor;
-        final JType parameterizable;
-
-        public JPrimitive(final Type type, final ComplexCoderDescriptor coderDesc) {
-            this.type = type;
-            this.coderDescriptor = coderDesc;
-
-            this.parameterizable = new JType() {
-                @Override public String getJavaTypeName() { return coderDescriptor.getJavaObjectClass(); }
-                @Override public CoderDescriptor getCoderDescriptor() { throw new RuntimeException(); }
-            };
-        }
-
-        @Override public String getJavaTypeName() { return coderDescriptor.getName(); }
-        @Override public String getDefaultReturnValue() { return coderDescriptor.getDefaultReturnValue(); }
-        @Override public JType getParameterizableType() { return parameterizable; }
-        @Override public CoderDescriptor getCoderDescriptor() { return coderDescriptor; }
-
-        /**
-         * Return the suffix placed on java literals to indicate the type. If none applies, return ' '.
-         */
-        public char getLiteralSuffix() {
-            char t = ((NPrimitive)type.type64).type;
-            switch(t){
-                case 'l': case 'L': case 'f': case 'd': return t;
-                case 'q': case 'Q': return 'L';
-            }
-            return ' ';
-        }
-    }
-
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/NType.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/NType.java
deleted file mode 100644
index 3c6d644eece..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/NType.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.types;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.apple.internal.jobjc.generator.Utils;
-import com.apple.internal.jobjc.generator.model.coders.PrimitiveCoderDescriptor;
-import com.apple.internal.jobjc.generator.utils.Fp;
-import com.apple.internal.jobjc.generator.utils.NTypePrinter;
-import com.apple.internal.jobjc.generator.utils.QA;
-import com.apple.jobjc.JObjCRuntime.Width;
-
-/**
- * NType (Native Type) bridges the type and type64 attributes in BridgeSupport.
- *
- * For example:
- *
- * <pre>
- *   type="c"                 // BridgeSupport attribute
- *   (NPrimitive type: 'c')   // Java object (in sexp form here, for readability)
- *
- *   type="^v"
- *   (NPointer subject: (NVoid))
- *
- *   type="{foo_t="a"c"b"b8"c"[32^v]}"
- *   (NStruct
- *     name: "foo_t"
- *     fields:
- *       (List<NField>
- *         0: (NField name:"a" type: (NPrimitive type: 'c'))
- *         1: (NField name:"b" type: (NBitfield size: 8))
- *         2: (NField name:"c" type:
- *              (NArray size: 32
- *                      type: (NPointer subject: (NVoid))))))
- * </pre>
- */
-public abstract class NType implements Comparable<NType>{
-    public final Map<Width, Integer> sizeof;
-
-    public NType(Map<Width, Integer> sizeof) {
-        this.sizeof = sizeof;
-    }
-
-    public NType(){
-        this(new HashMap<Width, Integer>());
-    }
-
-    public NType(int sz32, int sz64){
-        this();
-        this.sizeof.put(Width.W32, sz32);
-        this.sizeof.put(Width.W64, sz32);
-    }
-
-    public int sizeof32(){ return sizeof.get(Width.W32); }
-    public int sizeof64(){ return sizeof.get(Width.W64); }
-
-    protected abstract boolean equals2(NType nt);
-
-    private String _toString;
-    @Override public String toString(){ return _toString != null ? _toString : (_toString = NTypePrinter.inst().print(this)); }
-    @Override public boolean equals(Object o) {
-        return o!=null && (o==this || (getClass().isInstance(o)
-                && this.sizeof.equals(((NType) o).sizeof)
-                && equals2((NType) o)));
-    }
-    public int compareTo(NType o){ return toString().compareTo(o.toString()); }
-
-    // ** NType subclasses
-    // -------------------
-
-    public static class NBitfield extends NType{
-        public final int length;
-
-        public NBitfield(int length){
-            super(-1, -1);
-            this.length = length;
-        }
-
-        @Override protected boolean equals2(NType nt) { return ((NBitfield) nt).length == length; }
-        @Override public int hashCode() { return Integer.valueOf(length).hashCode(); }
-    }
-
-    public static class NPrimitive extends NType{
-        public static Collection<Character> CODES = Arrays.asList(
-                'B', 'c', 'C', 's', 'S', 'i', 'I', 'l', 'L', 'q', 'Q', 'f', 'd');
-
-        public final char type;
-
-        protected NPrimitive(char c){
-            super(PrimitiveCoderDescriptor.createCoderDescriptorFor(c).getCoder().sizeof(Width.W32),
-                    PrimitiveCoderDescriptor.createCoderDescriptorFor(c).getCoder().sizeof(Width.W64));
-            type = c;
-        }
-        private static final Map<Character, NPrimitive> cache = new HashMap<Character, NPrimitive>();
-        public static final NPrimitive inst(final char c){
-            if(!cache.containsKey(c)) cache.put(c, new NPrimitive(c));
-            return cache.get(c);
-        }
-
-        @Override protected boolean equals2(NType nt) { return ((NPrimitive)nt).type == type; }
-        @Override public int hashCode() { return Character.valueOf(type).hashCode(); }
-    }
-
-    public static class NVoid extends NType{
-        protected NVoid(){ super(); }
-        private final static NVoid INST = new NVoid();
-        public static NVoid inst() { return INST; }
-
-        @Override protected boolean equals2(NType nt) { return true; }
-    }
-
-    public static class NPointer extends NType{
-        public final NType subject;
-
-        public NPointer(NType subject){
-            super(4, 8);
-            QA.nonNull(subject);
-            this.subject = subject;
-        }
-
-        @Override protected boolean equals2(NType nt) { return ((NPointer)nt).subject.equals(subject); }
-        @Override public int hashCode() { return subject.hashCode(); }
-    }
-
-    public static class NObject extends NType{
-        protected NObject(){ super(4, 8); }
-        private final static NObject INST = new NObject();
-        public static NObject inst() { return INST; }
-
-        @Override protected boolean equals2(NType nt) { return true; }
-    }
-
-    public static class NClass extends NType{
-        protected NClass(){ super(4, 8); }
-        private final static NClass INST = new NClass();
-        public static NClass inst() { return INST; }
-
-        @Override protected boolean equals2(NType nt) { return true; }
-    }
-
-    public static class NSelector extends NType{
-        protected NSelector(){ super(4, 8); }
-        private final static NSelector INST = new NSelector();
-        public static NSelector inst() { return INST; }
-
-        @Override protected boolean equals2(NType nt) { return true;}
-    }
-
-    public static class NField{
-        public final Map<Width,Integer> offset;
-        public final String name;
-        public final NType type;
-
-        public NField(String name, NType type, Map<Width,Integer> offset) {
-            QA.nonNull(name, type, offset);
-            this.name = name;
-            this.type = type;
-            this.offset = offset;
-        }
-
-        public NField(String name, NType type) {
-            this(name, type, new HashMap());
-        }
-
-        public int offset32(){ return offset.get(Width.W32); }
-        public int offset64(){ return offset.get(Width.W64); }
-
-        @Override public int hashCode() { return name.hashCode() + type.hashCode(); }
-        @Override public boolean equals(Object o) {
-            return o!=null && (o==this ||
-                    (o instanceof NField
-                            && this.offset.equals(((NField) o).offset)
-                            && ((NField) o).name.equals(this.name)
-                            && ((NField) o).type.equals(this.type)));
-        }
-    }
-
-    public static class NStruct extends NType{
-        public final String name;
-        public final List<NField> fields;
-
-        public NStruct(String name, List<NField> fields, Map<Width,Integer> sizeof){
-            super(sizeof);
-            QA.nonNull(name, fields);
-            this.name = name;
-            this.fields = fields;
-        }
-
-        public NStruct(String name, List<NField> fields){
-            super();
-            QA.nonNull(name, fields);
-            this.name = name;
-            this.fields = fields;
-        }
-
-        @Override protected boolean equals2(NType nt) {
-            return ((NStruct)nt).name.equals(name) && ((NStruct)nt).fields.equals(fields);
-        }
-
-        @Override public int hashCode() { return name.hashCode() + fields.hashCode(); }
-    }
-
-    // A Union is like a Struct, but the offset of every field is 0.
-    public static class NUnion extends NStruct{
-        public NUnion(String concreteName, List<NField> fields){
-            super(concreteName, fields);
-            assert Fp.all(hasZeroOffsets, fields) : Utils.joinWComma(fields);
-        }
-
-        public NUnion(String name, List<NField> fields, Map<Width,Integer> sizeof) {
-            super(name, fields, sizeof);
-            assert Fp.all(hasZeroOffsets, fields) : Utils.joinWComma(fields);
-        }
-
-        public static final Fp.Map1<NField,Boolean> hasZeroOffsets = new Fp.Map1<NField,Boolean>(){
-            public Boolean apply(NField a) {
-                for(int i : a.offset.values())
-                    if(i != 0)
-                        return false;
-                return true;
-            }};
-        public static final Fp.Map1<NField,NField> zeroOffsets = new Fp.Map1<NField,NField>(){
-            public NField apply(NField a) {
-                Map<Width,Integer> off = new HashMap();
-                for(Width w : a.offset.keySet())
-                    off.put(w, 0);
-                return new NField(a.name, a.type, off);
-            }};
-    }
-
-    public static class NArray extends NType{
-        public final int length;
-        public final NType type;
-
-        public NArray(int length, NType type){
-            QA.nonNull(type);
-            this.length = length;
-            this.type = type;
-        }
-
-        @Override protected boolean equals2(NType nt) { return ((NArray)nt).length == length && ((NArray)nt).type.equals(type); }
-        @Override public int hashCode(){ return Long.valueOf(length).hashCode() + type.hashCode(); }
-    }
-
-    // Seems to be used for callbacks
-    public static class NUnknown extends NType{
-        protected NUnknown(){ super(); }
-        private final static NUnknown INST = new NUnknown();
-        public static NUnknown inst() { return INST; }
-
-        @Override protected boolean equals2(NType nt) { return true;}
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/Type.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/Type.java
deleted file mode 100644
index 740e68154b2..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/Type.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.types;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.apple.internal.jobjc.generator.model.types.NType.NObject;
-import com.apple.internal.jobjc.generator.model.types.NType.NPointer;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.internal.jobjc.generator.model.types.NType.NVoid;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.model.types.NType.NField;
-import com.apple.internal.jobjc.generator.utils.NTypeMerger;
-import com.apple.internal.jobjc.generator.utils.QA;
-import com.apple.internal.jobjc.generator.utils.Fp.Pair;
-import com.apple.internal.jobjc.generator.utils.NTypeMerger.MergeFailed;
-
-public class Type implements Comparable<Type>{
-    public static Type VOID = Type.getType("void", NVoid.inst(), null);
-    public static Type VOID_PTR = Type.getType("void*", new NPointer(NVoid.inst()), null);
-
-    final public String name;
-    final public NType type32;
-    final public NType type64;
-
-    // HACK BS bug where some types have inconsistent definitions in the metadata,
-    // e.g. (l / i) in some places and just (l) (and thus (l / l)) in others.
-    // This is a mapping from the type name to a Type object with the correct definition.
-    private static final Map<String, Type> exceptions;
-    static {
-        exceptions = new HashMap<String, Type>();
-        exceptions.put("OSStatus", getType("OSStatus", new NPrimitive('l'), new NPrimitive('i'))); // (l / i) vs. (l)
-        exceptions.put("CGFloat", getType("CGFloat", new NPrimitive('f'), new NPrimitive('d'))); // (f / d) vs. (f)
-        exceptions.put("NSRect", getType("NSRect", getNSRectType(), getCGRectType())); // ({{_NSPoint}{_NSSize}} / {{CGPoint}{CGSize}}) vs. ({{_NSPoint}{_NSSize}})
-        exceptions.put("NSPoint", getType("NSPoint", getNSPointType(), getCGPointType())); // (_NSPoint / CGPoint) vs. (_NSPoint)
-        exceptions.put("NSSize", getType("NSSize", getNSSizeType(), getCGSizeType())); // (_NSSize / CGSize) vs. (_NSSize)
-        exceptions.put("NSInteger", getType("NSInteger", new NPrimitive('i'), new NPrimitive('q'))); // (i / q) vs. (i)
-        exceptions.put("NSPointArray", getType("NSPointArray", new NPointer(getNSPointType()), new NPointer(getCGPointType()))); // (^_NSPoint / ^CGPoint) vs. (^_NSPoint)
-        exceptions.put("NSMultibyteGlyphPacking", getType("NSMultibyteGlyphPacking", new NPrimitive('I'), new NPrimitive('Q'))); // (I / Q) vs. (I)
-        exceptions.put("CFTypeRef", getType("CFTypeRef", new NPointer(NVoid.inst()), new NPointer(NVoid.inst()))); // (^v, ^v) vs. (@, @)
-    }
-
-    public static Type getType(final String name, final NType t32, final NType t64){
-        return TypeCache.inst().pingType(new Type(name, t32, t64));
-    }
-
-    private Type(final String name, final NType t32, final NType t64) {
-        QA.nonNull(t32);
-        this.name = cleanName(name);
-        this.type32 = t32;
-        this.type64 = t64 == null || t32.equals(t64) ? t32 : t64;
-    }
-
-    private JType _getJType;
-    public JType getJType() {
-        return _getJType!=null ? _getJType : (_getJType = TypeToJType.inst().getJTypeFor(TypeCache.inst().pingType(this)));
-    }
-
-    private String _toString;
-    @Override public String toString() {
-        return _toString != null ? _toString : (_toString = name + " " + new Pair(type32, type64).toString());
-    }
-
-    @Override public boolean equals(Object o){
-        if(o==null || !(o instanceof Type)) return false;
-        Type t = (Type) o;
-        return QA.bothNullOrEquals(t.name, this.name)
-        && t.type32.equals(this.type32)
-        && t.type64.equals(this.type64);
-    }
-
-    @Override public int hashCode(){
-        return (name == null ? 0 : name.hashCode())
-        + type32.hashCode() + type64.hashCode();
-    }
-
-    public int compareTo(Type o) { return toString().compareTo(o.toString()); }
-
-    public static Type merge(Type a, Type b) throws MergeFailed{
-        if(a!=null && b==null) return a;
-        if(a==null && b!=null) return b;
-        if(QA.bothNullOrEquals(a, b)) return a;
-        if (exceptions.containsKey(a.name)) return exceptions.get(a.name); // HACK BS bug
-        if(a.name != null && b.name != null && !a.name.equals(b.name)){
-            System.out.println("Merging:");
-            System.out.println("\ta.....: " + a.toString());
-            System.out.println("\tb.....: " + b.toString());
-        }
-        final Type merged = new Type(NTypeMerger.inst().mergeName(a.name, b.name),
-                NTypeMerger.inst().merge(a.type32, b.type32),
-                NTypeMerger.inst().merge(a.type64, b.type64));
-        if(a.name != null && b.name != null && !a.name.equals(b.name)){
-            System.out.println("\tmerged: " + merged.toString());
-        }
-        return merged;
-    }
-
-    // HACK BS bug where sometimes the name is declared as "id <A, B..." and sometimes it's "id<A,B..."
-    public static String cleanName(String name){ return name == null ? null : name.replaceAll("\\s+", ""); }
-
-    // HACK BS bug where NSRect has inconsistent definitions in the metadata
-    // Methods return NTypes created according to the correct definitions below:
-    //
-    // {_NSRect="origin"{_NSPoint="x"f"y"f}"size"{_NSSize="width"f"height"f}} *** 32-bit
-    // {CGRect="origin"{CGPoint="x"d"y"d}"size"{CGSize="width"d"height"d}} *** 64-bit
-
-    private static NType getCGRectType() {
-        List<NField> fields = new ArrayList<NField>();
-        fields.add(new NField("origin", getCGPointType()));
-        fields.add(new NField("size", getCGSizeType()));
-        return new NStruct("CGRect", fields);
-    }
-
-    private static NType getNSRectType() {
-        List<NField> fields = new ArrayList<NField>();
-        fields.add(new NField("origin", getNSPointType()));
-        fields.add(new NField("size", getNSSizeType()));
-        return new NStruct("_NSRect", fields);
-    }
-
-    private static NType getCGPointType() {
-        List<NField> fields = new ArrayList<NField>();
-        fields.add(new NField("x", new NPrimitive('d')));
-        fields.add(new NField("y", new NPrimitive('d')));
-        return new NStruct("CGPoint", fields);
-    }
-
-    private static NType getNSPointType() {
-        List<NField> fields = new ArrayList<NField>();
-        fields.add(new NField("x", new NPrimitive('f')));
-        fields.add(new NField("y", new NPrimitive('f')));
-        return new NStruct("_NSPoint", fields);
-    }
-
-    private static NType getCGSizeType() {
-        List<NField> fields = new ArrayList<NField>();
-        fields.add(new NField("width", new NPrimitive('d')));
-        fields.add(new NField("height", new NPrimitive('d')));
-        return new NStruct("CGSize", fields);
-    }
-
-    private static NType getNSSizeType() {
-        List<NField> fields = new ArrayList<NField>();
-        fields.add(new NField("width", new NPrimitive('f')));
-        fields.add(new NField("height", new NPrimitive('f')));
-        return new NStruct("_NSSize", fields);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeCache.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeCache.java
deleted file mode 100644
index dabf0d99ff2..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeCache.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.types;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import com.apple.internal.jobjc.generator.model.CFType;
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.model.Opaque;
-import com.apple.internal.jobjc.generator.model.Struct;
-import com.apple.internal.jobjc.generator.utils.Fp.Pair;
-
-/**
- * Central store for types found in the frameworks.
- */
-public class TypeCache {
-    private static TypeCache INST = new TypeCache();
-    public static TypeCache inst(){ return INST; }
-    protected TypeCache(){}
-
-    /**
-     * When a new Type is discovered, pass it through here to
-     * hit the cache, potentially merge with other types, etc.
-     *
-     * Always do:
-     *
-     *   Type type = TypeCache.inst().pingType(new Type(a,b,c));
-     *
-     * because this should return a better merge for you.
-     */
-    public Type pingType(final Type type_){
-        Type typex = type_;
-
-        // XXX Exception for void* clashes: void* (^{OpaqueCMProfileRef}), void* (^{X}), etc
-        if("void*".equals(typex.name) && getTypeByName(typex.name)!=null)
-            return getTypeByName(typex.name);
-
-        if(typex.name != null)
-            typex = Type.merge(typex, getTypeByName(typex.name));
-        else // type.name == null
-            typex = Type.merge(typex, getTypeByNTypes(new Pair(typex.type32, typex.type64)));
-        putTypeByName(typex.name, typex);
-        putTypeByNTypes(new Pair(typex.type32, typex.type64), typex);
-        return typex;
-    }
-
-    public final Map<String, Type> typesByName = new HashMap<String, Type>();
-    public Type getTypeByName(final String name) { return typesByName.get(Type.cleanName(name)); }
-    public void putTypeByName(String name, Type type) { if(name!=null) typesByName.put(name, type);    }
-
-    public final Map<Pair<NType,NType>, Type> typesByNTypes = new HashMap<Pair<NType,NType>, Type>();
-    public Type getTypeByNTypes(Pair<NType,NType> pair) { return typesByNTypes.get(pair); }
-    public void putTypeByNTypes(Pair<NType,NType> pair, Type type) { if(pair!=null) typesByNTypes.put(pair, type); }
-
-    private final Map<String, Clazz> classesByName = new HashMap<String, Clazz>();
-    private final Map<String, Struct> structsByName = new HashMap<String, Struct>();
-    private final Map<String, CFType> cfTypesByName = new HashMap<String, CFType>();
-    private final Map<String, Opaque> opaquesByName = new HashMap<String, Opaque>();
-
-    public void load(final List<Framework> frameworks) {
-        for (final Framework framework : frameworks) {
-            for (final Clazz obj : framework.classes) {
-                final Clazz previous = classesByName.put(obj.name, obj);
-                if(previous != null)
-                    throw new RuntimeException(String.format(
-                            "TypeCache: naming collision: class name: %1$-10s -- framework1: %2$-10s -- framework2: %3$-10s \n",
-                            obj.name, obj.parent.name, previous.parent.name));
-            }
-
-            for (final Struct obj : framework.structs) {
-                final Struct previous = structsByName.put(obj.name, obj);
-                if(previous != null)
-                    throw new RuntimeException(String.format(
-                            "TypeCache: naming collision: name: %1$-10s -- type1: %2$-10s -- type2: %3$-10s \n",
-                            obj.name, obj.type, previous.type));
-            }
-
-            for (final CFType obj : framework.cfTypes) {
-                final CFType previous = cfTypesByName.put(obj.name, obj);
-                if(previous != null)
-                    throw new RuntimeException(String.format(
-                            "TypeCache: naming collision: name: %1$-10s -- type1: %2$-10s -- type2: %3$-10s \n",
-                            obj.name, obj.type, previous.type));
-            }
-
-            for (final Opaque obj : framework.opaques) {
-                final Opaque previous = opaquesByName.put(obj.name, obj);
-                if(previous != null)
-                    throw new RuntimeException(String.format(
-                            "TypeCache: naming collision: name: %1$-10s -- type1: %2$-10s -- type2: %3$-10s \n",
-                            obj.name, obj.type, previous.type));
-            }
-        }
-    }
-
-    public Collection<Clazz> getAllClasses() { return classesByName.values(); }
-    public Clazz getClassForName(final String className) { return classesByName.get(className); }
-    public Struct getStructForName(final String declaredType) { return structsByName.get(declaredType); }
-    public CFType getCFTypeForName(final String declaredType) { return cfTypesByName.get(declaredType); }
-    public Opaque getOpaqueForName(final String declaredType) { return opaquesByName.get(declaredType); }
-
-    final Set<Type> unknownTypes = new TreeSet<Type>();
-    public Set<Type> getUnknownTypes() { return unknownTypes; }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeToJType.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeToJType.java
deleted file mode 100644
index 82ee3f7aaef..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/types/TypeToJType.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.model.types;
-
-import com.apple.internal.jobjc.generator.model.CFType;
-import com.apple.internal.jobjc.generator.model.Clazz;
-import com.apple.internal.jobjc.generator.model.Opaque;
-import com.apple.internal.jobjc.generator.model.Struct;
-import com.apple.internal.jobjc.generator.model.coders.ComplexCoderDescriptor;
-import com.apple.internal.jobjc.generator.model.types.JType.JCFType;
-import com.apple.internal.jobjc.generator.model.types.JType.JClass;
-import com.apple.internal.jobjc.generator.model.types.JType.JObject;
-import com.apple.internal.jobjc.generator.model.types.JType.JOpaque;
-import com.apple.internal.jobjc.generator.model.types.JType.JPointer;
-import com.apple.internal.jobjc.generator.model.types.JType.JPrimitive;
-import com.apple.internal.jobjc.generator.model.types.JType.JSelector;
-import com.apple.internal.jobjc.generator.model.types.JType.JStruct;
-import com.apple.internal.jobjc.generator.model.types.JType.JUnknown;
-import com.apple.internal.jobjc.generator.model.types.JType.JVoid;
-import com.apple.internal.jobjc.generator.model.types.NType.NClass;
-import com.apple.internal.jobjc.generator.model.types.NType.NObject;
-import com.apple.internal.jobjc.generator.model.types.NType.NPointer;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.internal.jobjc.generator.model.types.NType.NSelector;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.model.types.NType.NVoid;
-import com.apple.internal.jobjc.generator.utils.Fp.CacheMap;
-import com.apple.internal.jobjc.generator.utils.Fp.Dispatcher;
-import com.apple.internal.jobjc.generator.utils.Fp.Map0;
-
-public class TypeToJType {
-    private static TypeToJType INST = new TypeToJType();
-    public static TypeToJType inst(){ return INST; }
-
-    private CacheMap<Type,JType> cache = new CacheMap<Type,JType>();
-    public JType getJTypeFor(final Type type){
-        return cache.get(type, new Map0<JType>(){
-            public JType apply() {
-                try {
-                    return Dispatcher.dispatch(TypeToJType.this.getClass(), TypeToJType.this, "accept", type, type.type32, type.type64);
-                } catch (NoSuchMethodException e) {
-                    return new JUnknown(type);
-                }
-            }});
-    }
-
-    protected JType accept(Type type, NObject nt32, NObject nt64){
-        if ("id".equals(type.name)) return JObject.ID_TYPE;
-
-        final String className = type.name.replaceAll("\\*$", "");
-        assert !className.endsWith("*");
-
-        final Clazz clazz = TypeCache.inst().getClassForName(className);
-        if (clazz == null) return new JUnknown(type);
-        // TODO Instead of JUnknown, ID_TYPE might be more appropriate. Investigate.
-
-        return new JObject(type, clazz);
-    }
-
-    protected JType accept(Type type, NPointer nt32, NPointer nt64){
-        final CFType cfType = TypeCache.inst().getCFTypeForName(type.name);
-        if(cfType != null) return new JCFType(cfType);
-
-        final Opaque opaque = TypeCache.inst().getOpaqueForName(type.name);
-        if(opaque != null) return new JOpaque(opaque);
-
-        if("void*".equals(type.name)) return JPointer.VOID_PTR;
-
-        if(type.name != null && type.name.endsWith("*")){
-            final String subDeclaredType = type.name.substring(0, type.name.length() - 1);
-            final Type subType = TypeCache.inst().getTypeByName(subDeclaredType);
-            if (subType == null) return new JUnknown(type);
-            // TODO Instead of JUnknown, VOID_PTR might be a good fallback. Investigate.
-
-            final JType javaType = TypeToJType.inst().getJTypeFor(subType).getParameterizableType();
-
-            final JPointer pointer = new JPointer(javaType);
-            return pointer;
-        }
-
-        return new JUnknown(type);
-    }
-
-    protected JType accept(Type type, NPrimitive nt32, NPrimitive nt64){
-        final ComplexCoderDescriptor coderDesc = ComplexCoderDescriptor.getCoderDescriptorFor(type.type32, type.type64);
-        if (coderDesc == null) return null;
-        return new JPrimitive(type, coderDesc);
-    }
-
-    protected JType accept(Type type, NVoid nt32, NVoid nt64){
-        return JVoid.INST;
-    }
-
-    protected JType accept(Type type, NSelector nt32, NSelector nt64){
-        return JSelector.INST;
-    }
-
-    protected JType accept(Type type, NClass nt32, NClass nt64){
-        return JClass.INST;
-    }
-
-    protected JType accept(Type type, NStruct nt32, NStruct nt64){
-        Struct st = TypeCache.inst().getStructForName(type.name);
-        return st != null ? new JStruct(st) : new JUnknown(type);
-        // TODO We could probably generate a struct here based on the type. But we need access to its parent framework.
-        // Maybe we could use a fallback anonymous struct, but we need the SIZEOF.
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/Fp.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/Fp.java
deleted file mode 100644
index 5c7db20c91b..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/Fp.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-/**
- * Functional programming constructs and utilities. Java for Lisp and Haskell nerds.
- */
-public abstract class Fp {
-    /**
-     * Multiple dynamic dispatch (multi-methods) for Java.
-     *
-     * This is implemented with Java reflection:
-     * Class.getDeclaredMethod and Method.invoke.
-     * It is about 20-40 times slower than chains of
-     * "if instanceof" statements.
-     */
-    public static abstract class Dispatcher{
-        /**
-         * Shorthand, works only if no arg is null.
-         */
-        public static final <R> R dispatch(Class clazz, Object instance, String method, Object... args) throws NoSuchMethodException{
-            Class[] types = new Class[args.length];
-            for(int i = 0; i < args.length; i++) types[i] = args[i].getClass();
-            return (R) dispatch(clazz, instance, method, args, types);
-        }
-
-        /**
-         * Dispatch `args` of `types` to `method` on `clazz` for `instance`. If `method` is static, `instance` should be null.
-         */
-        public static final <R> R dispatch(Class clazz, Object instance, String method, Object[] args, Class[] types) throws NoSuchMethodException{
-            try{
-                java.lang.reflect.Method m = clazz.getDeclaredMethod(method, types);
-                m.setAccessible(true);
-                return (R) m.invoke(instance, args);
-            }
-            catch(NoSuchMethodException x){
-                if(clazz.getSuperclass() != null)  return (R) dispatch(clazz.getSuperclass(), instance, method, args, types);
-                else                               throw x;
-            }
-            catch(Exception x){
-                throw new RuntimeException(x);
-            }
-        }
-    }
-
-    /**
-     * The "Maybe" type encapsulates an optional value. A value of type
-     * "Maybe a" either contains a value of type "a" (represented as "Just a"),
-     * or it is empty (represented as "Nothing").
-     *
-     * http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html
-     */
-    public static abstract class Maybe<A>{
-        public abstract boolean isJust();
-        public abstract boolean isNothing();
-        public abstract A fromJust() throws ClassCastException;
-        public abstract A fromMaybe(final A fallback);
-
-        public static class Nothing<A> extends Maybe<A>{
-            @Override public A fromJust() throws ClassCastException { throw new ClassCastException("Cannot extract value from Nothing."); }
-            @Override public A fromMaybe(A fallback) { return fallback; }
-            @Override public boolean isJust() { return false; }
-            @Override public boolean isNothing() { return true; }
-        }
-        public static class Just<A> extends Maybe<A>{
-            public final A a;
-            public Just(A a){ this.a = a; }
-            @Override public A fromJust(){ return a; }
-            @Override public A fromMaybe(A fallback) { return a; }
-            @Override public boolean isJust() { return true; }
-            @Override public boolean isNothing() { return false; }
-        }
-    }
-
-    public static class NonNull<A>{
-        public final A obj;
-        public NonNull(A o){
-            if(o==null) throw new RuntimeException("o may not be null.");
-            this.obj = o;
-        }
-    }
-
-    // Closures
-    public static interface Map0<A>{ A apply(); }
-    public static interface Map1<A,B>{ B apply(final A a); }
-    public static interface Map2<A,B,C>{ C apply(final A a, final B b); }
-
-    public static class CacheMap<K extends Comparable<K>,V>{
-        private Map<K,V> cache = new TreeMap<K,V>();
-        public V get(K key, Map0<V> create){
-            if(cache.containsKey(key)) return cache.get(key);
-            V value = create.apply();
-            cache.put(key, value);
-            return value;
-        }
-    }
-
-    public static class Curry2to1<A,B,C> implements Map1<B,C>{
-        private Map2<A,B,C> target; private A a;
-        public Curry2to1(Map2<A, B, C> targett, A aa) { target = targett; a = aa; }
-        public C apply(B b) { return target.apply(a, b); }
-    }
-
-    // Tuple
-    public static class Pair <A,B> implements Comparable<Pair<A,B>>{
-        public final A a; public final B b;
-        public Pair(final A aa, final B bb){ a=aa; b=bb; }
-        @Override public int hashCode(){ return (a==null ? 0 : a.hashCode()) + (b==null ? 0 : b.hashCode()); }
-        @Override public boolean equals(Object o){
-            if(!(o instanceof Pair)) return false;
-            Pair<?,?> p = (Pair<?,?>) o;
-            return QA.bothNullOrEquals(a, p.a) && QA.bothNullOrEquals(b, p.b);
-        }
-        @Override public String toString(){ return "(" + a + ", " + b + ")"; }
-        public int compareTo(Pair<A, B> o){ return toString().compareTo(o.toString()); }
-    }
-
-    /**
-     * @return [fn(x) | x <- items]
-     */
-    public static <A,B> List<B> map(Map1<A,B> fn, final Collection<A> xs){
-        ArrayList<B> rs = new ArrayList<B>(xs.size());
-        for(A x : xs) rs.add(fn.apply(x));
-        return rs;
-    }
-
-    public static <A,B,C> List<C> map2(Map2<A,B,C> fn, final Collection<A> as, final Collection<B> bs){
-        assert as.size() == bs.size();
-        ArrayList<C> cs = new ArrayList<C>(as.size());
-        Iterator<A> aiter = as.iterator();
-        Iterator<B> biter = bs.iterator();
-        while(aiter.hasNext() && biter.hasNext())
-            cs.add(fn.apply(aiter.next(), biter.next()));
-        return cs;
-    }
-
-    /**
-     * Same as map, but does not retain results.
-     */
-    public static <A> void each(Map1<A,?> fn, final Collection<A> xs){
-        for(A x : xs) fn.apply(x);
-    }
-
-    /**
-     * @return [x | x <- items, take(x)]
-     */
-    public static <A> List<A> filter(Map1<A,Boolean> take, final Collection<A> xs){
-        List<A> rs = new ArrayList<A>(xs.size());
-        for(A x : xs) if(take.apply(x)) rs.add(x);
-        return rs;
-    }
-
-    /**
-     * @return [x | x <- items, take(x)]
-     */
-    public static <A> Set<A> filterSet(Map1<A,Boolean> take, final Collection<A> xs){
-        Set<A> rs = new HashSet<A>(xs.size());
-        for(A x : xs) if(take.apply(x)) rs.add(x);
-        return rs;
-    }
-
-    /**
-     * @return the first x in items that satisfies take(x), or null if none
-     */
-    public static <X> X find(Map1<X,Boolean> take, final Collection<X> xs){
-        for(X x : xs) if(take.apply(x)) return x;
-        return null;
-    }
-
-    public static <A,B> A foldl(final Map2<A,B,A> f, A a, final Collection<B> xs){
-        for(B b : xs) a = f.apply(a, b);
-        return a;
-    }
-
-    /**
-     * @return All x : p(x) == true
-     */
-    public static <A> boolean all(Map1<A,Boolean> p, Collection<A> xs) {
-        for(A x : xs) if(!p.apply(x)) return false;
-        return true;
-    }
-
-    /**
-     * @return Any x : p(x) == true
-     */
-    public static <A> boolean any(Map1<A,Boolean> p, Collection<A> xs) {
-        for(A x : xs) if(p.apply(x)) return true;
-        return false;
-    }
-
-    public static <A> String join(final String sep, final Collection<A> xs) {
-        if(xs.size() == 0) return "";
-        if(xs.size() == 1) return xs.iterator().next().toString();
-        return Fp.foldl(new Fp.Map2<String, A, String>(){
-            public String apply(String a, A b) {
-                String sb = b==null? "null" : b.toString();
-                return a == null ? sb : a + sep + sb;
-            }}, null, xs);
-    }
-
-    public static Map2<Integer,Integer,Integer> operatorPlus = new Map2<Integer, Integer, Integer>(){
-        public Integer apply(Integer a, Integer b) { return (int)a + (int)b;}
-    };
-
-    public static int sum(Collection<Integer> xs){ return foldl(operatorPlus, 0, xs); }
-
-    public static <A> List<A> append(Collection<A> xs, Collection<A> ys) {
-        List<A> rs = new ArrayList<A>(xs.size() + ys.size());
-        rs.addAll(xs);
-        rs.addAll(ys);
-        return rs;
-    }
-
-    public static <A> Set<A> appendSet(Collection<A> xs, Collection<A> ys) {
-        Set<A> rs = new HashSet<A>(xs.size() + ys.size());
-        rs.addAll(xs);
-        rs.addAll(ys);
-        return rs;
-    }
-
-    public static <K,V> Map<K,V> litMap(K key, V value, Object... pairs){
-        Map ret = new HashMap(1 + pairs.length/2);
-        ret.put(key, value);
-        for(int i = 0; i < pairs.length; i += 2)
-            ret.put(pairs[i], pairs[i+1]);
-        return ret;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/JavaLang.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/JavaLang.java
deleted file mode 100644
index 799ab7770d3..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/JavaLang.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import com.apple.internal.jobjc.generator.Utils;
-import com.apple.internal.jobjc.generator.Utils.Substituter;
-
-/**
- * Utility for generating Java source code.
- */
-public abstract class JavaLang {
-
-    public static String makeSingleton(final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
-        return generateSingleton(new Substituter(
-            "#private $CLASS $IVAR = null;~" +
-            "#public $CLASS $METHOD() {~" +
-            "##return $IVAR != null ? $IVAR : ($IVAR = new $CLASS($CTORARGS));~" +
-            "#}~"),
-        instanceVariable, methodName, className, constructorArgs);
-    }
-
-    public static String makeStaticSingleton(final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
-        return generateSingleton(new Substituter(
-            "#private static $CLASS $IVAR = null;~" +
-            "#public static $CLASS $METHOD() {~" +
-            "##return $IVAR != null ? $IVAR : ($IVAR = new $CLASS($CTORARGS));~" +
-            "#}~"),
-        instanceVariable, methodName, className, constructorArgs);
-    }
-
-    private static String generateSingleton(final Substituter singleton, final String instanceVariable, final String methodName, final String className, final String...constructorArgs) {
-        singleton.replace("IVAR", instanceVariable);
-        singleton.replace("METHOD", methodName);
-        singleton.replace("CLASS", className);
-        singleton.replace("CTORARGS", Utils.joinWComma(constructorArgs));
-        return singleton.toString();
-    }
-
-    ///
-
-    public static class JLTertiary{
-        public Object cond, tExp, fExp;
-        public JLTertiary(){}
-        public JLTertiary(Object cond, Object tExp, Object fExp){
-            this.cond = cond;
-            this.tExp = tExp;
-            this.fExp = fExp;
-        }
-        @Override public String toString() {
-            return "((" + cond + ")\n\t? (" + tExp + ")\n\t: (" + fExp + "))";
-        }
-    }
-
-    public static class JLCall{
-        public String fun;
-        public List<Object> args = new ArrayList<Object>();
-        public JLCall(String fun, Object... args){
-            this.fun = fun;
-            this.args.addAll(Arrays.asList(args));
-        }
-        @Override public String toString(){
-            return fun + "(" + Fp.join(", ", args) + ")";
-        }
-    }
-
-    public static class JLField{
-        public Set<String> mods = new TreeSet<String>();
-        public String type;
-        public String name;
-        public Object value;
-
-        public JLField(String mods, String type, String name){
-            this(mods, type, name, null);
-        }
-
-        public JLField(String mods, String type, String name, Object value){
-            this.mods.addAll(Arrays.asList(mods.split("\\s")));
-            this.type = type;
-            this.name = name;
-            this.value = value;
-        }
-
-        @Override public String toString(){
-            return "\t" + Fp.join(" ", mods) + " " + type + " " + name + (value==null ? "" : " = " + value) + ";\n";
-        }
-    }
-
-    public static class JLCtor extends JLMethod{
-        public JLCtor(String mods, String name, Object... args) {
-            super(mods, "", name, args);
-        }
-
-        @Override public String toString(){
-            this.type = "";
-            return super.toString();
-        }
-    }
-
-    public static class JLReturn{
-        public Object target;
-        public JLReturn(Object target){
-            this.target = target;
-        }
-        @Override public String toString(){
-            return "return " + target + ";";
-        }
-    }
-
-    public static class JLMethod{
-        public List<String> jdoc = new ArrayList<String>();
-        public Set<String> attrs = new TreeSet<String>();
-        public Set<String> mods = new TreeSet<String>();
-        public String type;
-        public String name;
-        public List<Object> args = new ArrayList<Object>();
-        public List<Object> body = new ArrayList<Object>();
-
-        public JLMethod(){}
-        public JLMethod(String mods, String type, String name, Object... args) {
-            this.mods.addAll(Arrays.asList(mods.split("\\s")));
-            this.type = type;
-            this.name = name;
-            this.args.addAll(Arrays.asList(args));
-        }
-
-        @Override public String toString(){
-            StringWriter out = new StringWriter();
-            if(jdoc.size() > 0){
-                out.append("\t/**\n");
-                out.append("\t * " + Fp.join("\n\t * ", jdoc));
-                out.append("\t */\n");
-            }
-            out.append("\t" + Fp.join(" ", attrs) + " " + Fp.join(" ", mods) + " " + type + " " + name + "(" + Fp.join(", ", args) + "){\n");
-            out.append("\t\t" + Fp.join("\n\t\t", body) + "\n");
-            out.append("\t}\n");
-            return out.toString();
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeMerger.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeMerger.java
deleted file mode 100644
index a1ad5658050..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeMerger.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.apple.internal.jobjc.generator.model.types.NType;
-import com.apple.internal.jobjc.generator.model.types.NType.NArray;
-import com.apple.internal.jobjc.generator.model.types.NType.NBitfield;
-import com.apple.internal.jobjc.generator.model.types.NType.NClass;
-import com.apple.internal.jobjc.generator.model.types.NType.NField;
-import com.apple.internal.jobjc.generator.model.types.NType.NObject;
-import com.apple.internal.jobjc.generator.model.types.NType.NPointer;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.internal.jobjc.generator.model.types.NType.NSelector;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.model.types.NType.NUnion;
-import com.apple.internal.jobjc.generator.model.types.NType.NUnknown;
-import com.apple.internal.jobjc.generator.model.types.NType.NVoid;
-import com.apple.internal.jobjc.generator.utils.Fp.Dispatcher;
-import com.apple.internal.jobjc.generator.utils.Fp.Map2;
-import com.apple.jobjc.JObjCRuntime.Width;
-
-/**
- * Merges two NTypes. All merge does is fill out missing information. It doesn't choose the larger primitive when there's a conflict or anything like that.
- *
- * Example:
- *<pre>
- * a: {_NSRect={_NSPoint="x"f"y"f}"size"{_NSSize=ff}}
- * b: {_NSRect="origin"{_NSPoint=ff}{_NSSize="width"f"height"f}}
- * c: {_NSRect="origin"{_NSPoint="x"f"y"f}"size"{_NSSize="width"f"height"f}}
- *</pre>
- */
-public class NTypeMerger {
-    public static class MergeFailed extends RuntimeException{
-        public MergeFailed(String reason, Object a, Object b){
-            super(reason
-                    + " -- (" + a.getClass().getSimpleName() + ") a: " + a
-                    + " -- (" + b.getClass().getSimpleName() + ") b: " + b);
-        }
-    }
-
-    private static NTypeMerger INST = new NTypeMerger();
-    public static NTypeMerger inst(){ return INST; }
-
-    /**
-     * Merge a and b.
-     */
-    public NType merge(NType a, NType b) throws MergeFailed{
-        if(a!=null && b==null) return a;
-        if(a==null && b!=null) return b;
-        if(a==null && b==null) return null;
-        if(a.equals(b)) return a;
-        try {
-            return Dispatcher.dispatch(getClass(), this, "accept", a, b);
-        } catch (NoSuchMethodException e) {
-            throw new MergeFailed("a and b are of different NType", a, b);
-        }
-    }
-
-    private static Collection<String> emptyNames = Arrays.asList(null, "", "?");
-    /**
-     * Merge two identifiers:
-     *  - If they're equal, return one.
-     *  - If one is null, "", "?", return the other one.
-     *  - else throw MergeFailed
-     *
-     *  Exception: Due to a bug in BridgeSupport, this will return
-     *  a (the first arg) instead of throwing MergeFailed.
-     */
-    public String mergeName(String a, String b) throws MergeFailed{
-        if(QA.bothNullOrEquals(a, b)) return a;
-        if(emptyNames.contains(a) && !emptyNames.contains(b)) return b;
-        if(emptyNames.contains(b) && !emptyNames.contains(a)) return a;
-        return a; // HACK BS bug #5954843
-//        throw new MergeFailed("a and b have different names");
-    }
-
-    private Map mergeMap(Map a, Map b) throws MergeFailed{
-        if(a.equals(b)) return a;
-        Map ret = new HashMap();
-        Set keys = new HashSet(Fp.append(a.keySet(), b.keySet()));
-        for(Object key : keys){
-            Object ai = a.get(key);
-            Object bi = b.get(key);
-            if(ai != null && bi == null) ret.put(key, ai);
-            else if(ai == null && bi != null) ret.put(key, bi);
-            else if(ai.equals(bi)) ret.put(key, ai);
-            else throw new MergeFailed("a and b are different", ai, bi);
-        }
-        return ret;
-    }
-
-    public Map<Width,Integer> mergeSizeOf(Map<Width,Integer> a, Map<Width,Integer> b) throws MergeFailed{
-        return mergeMap(a, b);
-    }
-
-    public Map<Width,Integer> mergeOffset(Map<Width,Integer> a, Map<Width,Integer> b) throws MergeFailed{
-        return mergeMap(a, b);
-    }
-
-    //
-
-    private void mustEqual(NType a, NType b){
-        if(!a.equals(b)) throw new MergeFailed("a must equal b", a, b);
-    }
-
-    protected NType accept(NBitfield a, NBitfield b) {
-        mustEqual(a, b);
-        return a;
-    }
-
-    protected NType accept(NPrimitive a, NPrimitive b) {
-        mustEqual(a, b);
-        return a;
-    }
-
-    protected NType accept(NPointer a, NPointer b) {
-        return new NPointer(NTypeMerger.inst().merge(a.subject, b.subject));
-    }
-
-    // Merge structs
-
-    protected NField mergeNFields(NField a, NField b) {
-        return new NField(mergeName(a.name, b.name),
-                NTypeMerger.inst().merge(a.type, b.type),
-                mergeOffset(a.offset, b.offset));
-    }
-
-    protected NStruct mergeStructs(NStruct a, NStruct b){
-        if(a.fields.size() != b.fields.size())
-            throw new MergeFailed("a and b have different numbers of fields", a, b);
-
-        List<NField> fields = Fp.map2(new Map2<NField,NField,NField>(){
-            public NField apply(NField f32, NField f64) { return mergeNFields(f32, f64); }
-        }, a.fields, b.fields);
-
-        return new NStruct(mergeName(a.name, b.name),
-                fields, mergeSizeOf(a.sizeof, b.sizeof));
-    }
-
-    protected NType accept(NStruct a, NStruct b) {
-        return mergeStructs(a, b);
-    }
-
-    protected NType accept(NUnion a, NUnion b) {
-        NStruct nst = mergeStructs(a, b);
-        return new NUnion(nst.name, Fp.map(NUnion.zeroOffsets, nst.fields), nst.sizeof);
-    }
-
-    protected NType accept(NArray a, NArray b) {
-        if(a.length != b.length)
-            throw new MergeFailed("a and b are of different sizes", a, b);
-        return new NArray(a.length, NTypeMerger.inst().merge(a.type, b.type));
-    }
-
-    protected NType accept(NVoid a, NVoid b) { return NVoid.inst(); }
-    protected NType accept(NObject a, NObject b) { return NObject.inst(); }
-    protected NType accept(NClass a, NClass b) { return NClass.inst(); }
-    protected NType accept(NSelector a, NSelector b) { return NSelector.inst(); }
-    protected NType accept(NUnknown a, NUnknown b) { return NUnknown.inst(); }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeParser.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeParser.java
deleted file mode 100644
index 850076280a2..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypeParser.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.apple.internal.jobjc.generator.model.types.NType;
-import com.apple.internal.jobjc.generator.model.types.NType.NArray;
-import com.apple.internal.jobjc.generator.model.types.NType.NBitfield;
-import com.apple.internal.jobjc.generator.model.types.NType.NClass;
-import com.apple.internal.jobjc.generator.model.types.NType.NObject;
-import com.apple.internal.jobjc.generator.model.types.NType.NPointer;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.internal.jobjc.generator.model.types.NType.NSelector;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.model.types.NType.NUnion;
-import com.apple.internal.jobjc.generator.model.types.NType.NUnknown;
-import com.apple.internal.jobjc.generator.model.types.NType.NVoid;
-
-/**
- * NTypeParser (Native Type Parser) parses type & type64 attributes from BridgeSupport.
- *
- * See Obj-C Language: Type Encodings
- */
-public abstract class NTypeParser {
-    // ** Parser entry point
-
-    private static Map<String, NType> cached = new HashMap<String, NType>();
-    public static NType parseFrom(String s) {
-        if(!cached.containsKey(s)) cached.put(s, parseFrom(new StringStream(s)));
-        return cached.get(s);
-    }
-
-    // ** Parser driver
-
-    private static List<NTypeParser> PARSERS = new ArrayList<NTypeParser>(
-            Arrays.asList(new NBitfieldParser(), new NPrimitiveParser(), new NVoidParser(),
-            new NPointerParser(), new NStructParser(), new NUnionParser(),
-            new NObjectParser(), new NClassParser(), new NSelectorParser(),
-            new NArrayParser(), new NUnknownParser(), new NSpecifierParser()));
-
-    protected static NType parseFrom(StringStream ss) {
-        if(ss.left() == 0)
-            return null;
-        try{
-            for(NTypeParser nt : PARSERS)
-                if(nt.parsePossible(ss))
-                    return nt.parse(ss);
-        }
-        catch(RuntimeException x){
-            throw new RuntimeException("Exception while parsing '" + ss.remainingToString()
-                    + "' from '" + ss.toString() + "'", x);
-        }
-        throw new RuntimeException("Found no parser for '" + ss.remainingToString()
-                + "' from '" + ss.toString() + "'");
-    }
-
-    // ** Methods for parsers
-
-    protected abstract boolean parsePossible(StringStream ss);
-    protected abstract NType parse(StringStream ss);
-
-    // ** Individual parsers
-
-    public static class NBitfieldParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.left() >= 2 && ss.peekAt(0) == 'b' && Character.isDigit(ss.peekAt(1));
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            assert parsePossible(ss);
-            ss.eat('b');
-            return new NBitfield(Integer.parseInt(ss.readWhileDigits()));
-        }
-    }
-
-    public static class NPrimitiveParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return NPrimitive.CODES.contains(ss.peek());
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            assert parsePossible(ss);
-            return NPrimitive.inst(ss.read());
-        }
-    }
-
-    public static class NVoidParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.peek() == 'v';
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            ss.eat('v');
-            return NVoid.inst();
-        }
-    }
-
-    public static class NPointerParser extends NTypeParser{
-        private static NPointer CHAR_PTR = new NPointer(NPrimitive.inst('C'));
-
-        @Override protected boolean parsePossible(StringStream ss) {
-            return (ss.left() >= 2 && ss.peek() == '^') || (ss.peek() == '*');
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            if(ss.peek() == '*'){
-                ss.eat('*');
-                return CHAR_PTR;
-            }
-            else{
-                ss.eat('^');
-                return new NPointer(NTypeParser.parseFrom(ss));
-            }
-        }
-    }
-
-    public static class NStructParser extends NTypeParser{
-        protected char getOpen(){ return '{'; };
-        protected char getClose(){ return '}'; };
-
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.left() >= 2 && ss.peek() == getOpen();
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            assert parsePossible(ss);
-            // {_NSRect=
-            //   "origin"{_NSPoint="x"f"y"f}
-            //   "size"{_NSSize="width"f"height"f}}
-            ss.eat(getOpen());
-            String cname = ss.readUntilEither("=" + getClose());
-            List<NStruct.NField> fields = new ArrayList<NStruct.NField>();
-            if(ss.peek() == '='){
-                ss.eat('=');
-                while(ss.peek() != getClose()){
-                    String fname = "";
-                    if(ss.peek() == '"'){
-                        ss.eat('"');
-                        fname = ss.readUntil('"');
-                        ss.eat('"');
-                    }
-                    NType type = NTypeParser.parseFrom(ss);
-                    fields.add(new NStruct.NField(fname, type));
-                }
-            }
-            ss.eat(getClose());
-            return getNew(cname, fields);
-        }
-
-        protected NType getNew(String cname, List<NStruct.NField> fields){
-            return new NStruct(cname, fields);
-        }
-    }
-
-    // A Union is very much like a Struct.
-    public static class NUnionParser extends NStructParser{
-        @Override protected char getOpen(){ return '('; };
-
-        @Override protected char getClose(){ return ')'; };
-
-        @Override protected NType getNew(String cname, List<NStruct.NField> fields){
-            return new NUnion(cname, Fp.map(NUnion.zeroOffsets, fields));
-        }
-    }
-
-    public static class NArrayParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.peek() == '[';
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            ss.eat('[');
-            int size = Integer.parseInt(ss.readWhileDigits());
-            NType type = NTypeParser.parseFrom(ss);
-            ss.eat(']');
-            return new NArray(size, type);
-        }
-    }
-
-    public static class NObjectParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.peek() == '@';
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            ss.eat('@');
-            return NObject.inst();
-        }
-    }
-
-    public static class NClassParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.peek() == '#';
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            ss.eat('#');
-            return NClass.inst();
-        }
-    }
-
-    public static class NSelectorParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.peek() == ':';
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            ss.eat(':');
-            return NSelector.inst();
-        }
-    }
-
-    public static class NUnknownParser extends NTypeParser{
-        @Override protected boolean parsePossible(StringStream ss) {
-            return ss.peek() == '?';
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            ss.eat('?');
-            return NUnknown.inst();
-        }
-    }
-
-    /**
-     * Specifier     Encoding
-     * const         r
-     * in             n
-     * inout         N
-     * out             o
-     * bycopy         O
-     * oneway         V
-     */
-    public static class NSpecifierParser extends NTypeParser{
-        private static Collection<Character> SPECS = Arrays.asList('r', 'n', 'N', 'o', 'O', 'V');
-        @Override protected boolean parsePossible(StringStream ss) {
-            return SPECS.contains(ss.peek());
-        }
-
-        @Override protected NType parse(StringStream ss) {
-            assert parsePossible(ss);
-            ss.seek(); // XXX Just ignore specs for now and return the affected type.
-            return NTypeParser.parseFrom(ss);
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypePrinter.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypePrinter.java
deleted file mode 100644
index 07ba7259e37..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/NTypePrinter.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.io.StringWriter;
-
-import com.apple.internal.jobjc.generator.model.types.NType;
-import com.apple.internal.jobjc.generator.model.types.NType.NArray;
-import com.apple.internal.jobjc.generator.model.types.NType.NBitfield;
-import com.apple.internal.jobjc.generator.model.types.NType.NClass;
-import com.apple.internal.jobjc.generator.model.types.NType.NField;
-import com.apple.internal.jobjc.generator.model.types.NType.NObject;
-import com.apple.internal.jobjc.generator.model.types.NType.NPointer;
-import com.apple.internal.jobjc.generator.model.types.NType.NPrimitive;
-import com.apple.internal.jobjc.generator.model.types.NType.NSelector;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.model.types.NType.NUnion;
-import com.apple.internal.jobjc.generator.model.types.NType.NUnknown;
-import com.apple.internal.jobjc.generator.model.types.NType.NVoid;
-import com.apple.internal.jobjc.generator.utils.Fp.Dispatcher;
-
-/**
- * Print an NType to the BridgeSupport encoding.
- */
-public class NTypePrinter{
-    private static NTypePrinter INST = new NTypePrinter();
-    public static NTypePrinter inst(){ return INST; }
-
-    public String print(NType nt){
-        try {
-            return Dispatcher.dispatch(getClass(), this, "accept", nt);
-        } catch (NoSuchMethodException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    protected String accept(NBitfield nt) {
-        return "b" + nt.length;
-    }
-
-    protected String accept(NPrimitive nt) {
-        return Character.toString(nt.type);
-    }
-
-    protected String accept(NPointer nt) {
-        if(nt.subject instanceof NPrimitive && ((NPrimitive) nt.subject).type == 'C')
-            return "*";
-        else
-            return "^" + print(nt.subject);
-    }
-
-    protected String printStruct(NStruct nt, char open, char close){
-        StringWriter sw = new StringWriter();
-        sw.append(open);
-        sw.append(nt.name);
-        if(nt.fields.size() > 0){
-            sw.append('=');
-            for(NField f : nt.fields){
-                if(f.name != null && f.name.length() > 0)
-                    sw.append("\"" + f.name + "\"");
-                sw.append(print(f.type));
-            }
-        }
-        sw.append(close);
-        return sw.toString();
-    }
-
-    protected String accept(NStruct nt) {
-        return printStruct(nt, '{', '}');
-    }
-
-    protected String accept(NUnion nt) {
-        return printStruct(nt, '(', ')');
-    }
-
-    protected String accept(NArray nt) {
-        return "[" + nt.length + print(nt.type) + "]";
-    }
-
-    protected String accept(NObject nt) { return "@"; }
-    protected String accept(NVoid nt) { return "v"; }
-    protected String accept(NClass nt) { return "#"; }
-    protected String accept(NSelector nt) { return ":"; }
-    protected String accept(NUnknown nt) { return "?"; }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/ObjectInspector.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/ObjectInspector.java
deleted file mode 100644
index e54ba340987..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/ObjectInspector.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.io.StringWriter;
-import java.lang.reflect.Field;
-
-public abstract class ObjectInspector {
-    /**
-     * @return  a string representation of object internals.
-     */
-    public static String inspect(Object obj) {
-        StringWriter sw = new StringWriter();
-        inspectForClass(obj, obj.getClass(), sw);
-        return sw.toString();
-    }
-
-    private static void inspectForClass(Object instance, Class clazz, StringWriter sw){
-        boolean willGoSuper = clazz.getSuperclass() != null && !clazz.getSuperclass().getName().equals("java.lang.Object");
-
-        sw.append(clazz.getSimpleName());
-        sw.append("{");
-        Field[] fs = clazz.getDeclaredFields();
-        for(int i = 0; i < fs.length; i++){
-            Field f = fs[i];
-            f.setAccessible(true);
-            sw.append(f.getName());
-            sw.append(": ");
-            try {
-                Object o = f.get(instance);
-                sw.append(o == null ? "null" : o.toString());
-            } catch (IllegalArgumentException ex) {
-                throw new RuntimeException(ex);
-            } catch (IllegalAccessException ex) {
-                throw new RuntimeException(ex);
-            }
-            if(i < fs.length - 1 || willGoSuper)
-                sw.append(", ");
-        }
-
-        if(willGoSuper){
-            sw.append("super: ");
-            inspectForClass(instance, clazz.getSuperclass(), sw);
-        }
-
-        sw.append("}");
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/QA.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/QA.java
deleted file mode 100644
index e745636a38a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/QA.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import com.apple.internal.jobjc.generator.Utils;
-
-public class QA {
-    public static void nonNull(Object... os){
-        for(Object o : os) if(o == null) throw new NullPointerException(Utils.joinWComma(os));
-    }
-
-    public static boolean bothNullOrEquals(Object a, Object b) {
-        if(a == null && b == null) return true;
-        if(a == null || b == null) return false;
-        return a.equals(b);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StringStream.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StringStream.java
deleted file mode 100644
index 448d4be12e6..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StringStream.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.io.StringWriter;
-
-/**
- * Stream-like class backed by a string. Useful for parsers.
- */
-public class StringStream{
-    private String data;
-    private int pos;
-
-    public StringStream(String s){
-        QA.nonNull(s);
-        this.data = s;
-        this.pos = 0;
-    }
-
-    /**
-     * Number of characters left.
-     */
-    public int left(){ return data.length() - pos; }
-
-    /**
-     * Are there any characters left?
-     */
-    public boolean atEOF(){ return left() <= 0; }
-
-    /**
-     * Read next character.
-     */
-    public char read(){ return data.charAt(pos++); }
-
-    /**
-     * Read n characters and return string.
-     */
-    public String readN(int n){
-        String s = data.substring(pos, pos + n);
-        pos += n;
-        return s;
-    }
-
-    /**
-     * Read until the next char is c, and return the string.
-     */
-    public String readUntil(char c){
-        int ix = data.indexOf(c, pos);
-        if(ix == -1) throw new RuntimeException("readUntil did not find character '" + c + "'");
-        return readN(data.indexOf(c, pos) - pos);
-    }
-
-    /**
-     * Read until the next char is one in s, and return the string.
-     */
-    public String readUntilEither(String s) {
-        int ix = Integer.MAX_VALUE;
-
-        for(char c : s.toCharArray()){
-            int ixx = data.indexOf(c, pos);
-            if(ixx >= 0 && ixx < ix)
-                ix = ixx;
-        }
-
-        if(ix == -1) throw new RuntimeException("readUntilEither did not find any character in '" + s + "'");
-        return readN(ix - pos);
-    }
-
-    public String readWhile(String s) {
-        StringWriter sw = new StringWriter();
-        while(s.indexOf(peek()) != -1)
-            sw.append(read());
-        return sw.toString();
-    }
-
-    public String readWhileDigits() {
-        return readWhile("0123456789");
-    }
-
-    /**
-     * @return the nth char from the current position.
-     */
-    public char peekAt(int n){ return data.charAt(pos + n); }
-
-    /**
-     * @return the next n chars.
-     */
-    public String peekN(int n){ return data.substring(pos, pos + n); }
-
-    /**
-     * @return the next char.
-     */
-    public char peek(){ return peekAt(0); }
-
-    /**
-     * Skip n chars ahead.
-     */
-    public void seekN(int n){ pos += n; }
-
-    /**
-     * Skip 1 char ahead.
-     */
-    public void seek(){ seekN(1); }
-
-    /**
-     * If the next character is c, seek over it. Otherwise throw RuntimeException.
-     */
-    public void eat(char c) {
-        if(peek() != c) throw new RuntimeException("Parser expected '" + c + "' but got '" + peek() + "'.");
-        seek();
-    }
-
-    /**
-     * If the next characters are the same as those in s, seek over them. Otherwise throw RuntimeException.
-     */
-    public void eat(String s) {
-        String pn = peekN(s.length());
-        if(!pn.equals(s)) throw new RuntimeException("Parser expected '" + s + "' but got '" + pn + "'.");
-        seekN(s.length());
-    }
-
-    @Override
-    public String toString(){
-        return data;
-    }
-
-    /**
-     * @return the remaining characters as a String.
-     */
-    public String remainingToString() {
-        return data.substring(pos);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolver.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolver.java
deleted file mode 100644
index c207aae323a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolver.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import com.apple.internal.jobjc.generator.Utils;
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.model.Struct;
-import com.apple.internal.jobjc.generator.model.types.NType;
-import com.apple.internal.jobjc.generator.model.types.TypeCache;
-import com.apple.internal.jobjc.generator.model.types.NType.NField;
-import com.apple.internal.jobjc.generator.model.types.NType.NStruct;
-import com.apple.internal.jobjc.generator.utils.Fp.Map1;
-import com.apple.jobjc.JObjCRuntime.Width;
-import java.util.Date;
-
-/**
- * Takes a framework, compiles a native source file with all its structs,
- * and figures out their sizes and field offsets.
- */
-public class StructOffsetResolver {
-    public void resolve(Collection<Framework> fws){
-        try {
-            _resolve(fws);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    protected void _resolve(final Collection<Framework> fws) throws Exception{
-        for(final Framework fw : fws){
-            for(final Width width : Width.values()){
-                System.out.println("SOR -- Getting Struct offsets @" + width + " for " + fw.name);
-                String nativeSrc = generateFileForFramework(fw, width);
-                String executable = compileObjC(nativeSrc, width);
-                execute(executable, new Map1<String,Object>(){
-                    public Object apply(String ln) {
-                        try {
-                            processLine(ln, fws, width);
-                            return null;
-                        } catch (Exception e) {
-                            throw new RuntimeException(e);
-                        }
-                    }
-                });
-            }
-        }
-    }
-
-    static Set<String> alwaysHeaders_shared = new TreeSet<String>(Arrays.asList(
-            "<Cocoa/Cocoa.h>",
-    "\"/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/HIToolbox.h\""));
-    static Map<Width,Set<String>> alwaysHeaders = Fp.litMap(
-            Width.W32, alwaysHeaders_shared,
-            Width.W64, alwaysHeaders_shared);
-
-    static Set<String> bannedHeaders_shared = new TreeSet<String>(Arrays.asList(
-            "NSJavaSetup.h", "IMKInputController.h", "NSSimpleHorizontalTypesetter.h", "NSSpellServer.h", "IMKServer.h", "IKImageBrowserCell.h"));
-    static Map<Width,Set<String>> bannedHeaders = Fp.litMap(
-            Width.W32, bannedHeaders_shared,
-            Width.W64, Fp.appendSet(bannedHeaders_shared,
-                    Arrays.asList("npapi.h", "npruntime.h", "npfunctions.h")));
-
-    // We can cache the last accessed framework because, 99% of the time,
-    // the caller will ask for the same one, over and over again.
-    protected Framework cachedFw;
-    protected Framework findFrameworkByName(Collection<Framework> fws, String name){
-        if(cachedFw != null && cachedFw.name.equals(name))
-            return cachedFw;
-        cachedFw = null;
-        for(Framework fw : fws)
-            if(fw.name.equals(name)){
-                cachedFw = fw;
-                break;
-            }
-        return cachedFw;
-    }
-
-    protected void processLine(String ln, Collection<Framework> fws, Width arch) throws Exception{
-        System.out.println("\tSOR '" + ln + "'");
-        if(ln.trim().length() == 0) return;
-        Pattern stinfo = Pattern.compile("^(.*) (.*):(\\d+).*$");
-        Matcher m = stinfo.matcher(ln);
-        if(!m.matches()) throw new RuntimeException("Failed to parse line from exec: " + ln);
-        String fwname = m.group(1);
-        String stname = m.group(2);
-        int stsize = Integer.parseInt(m.group(3));
-
-        Framework fw = findFrameworkByName(fws, fwname);
-
-        Struct st = fw.getStructByName(stname);
-        NStruct nst = wget(arch, st.type.type32, st.type.type64);
-        nst.sizeof.put(arch, stsize);
-
-//        System.out.println(st.name + " : " + stsize);
-
-        Pattern finfo = Pattern.compile(" (-?\\d+)");
-        Matcher fm = finfo.matcher(ln);
-        int fi = 0;
-        while(fm.find()){
-            NField sf = nst.fields.get(fi++);
-            sf.offset.put(arch, Integer.parseInt(fm.group(1)));
-//            System.out.println("\t" + sf.name + " : " + off);
-        }
-
-        TypeCache.inst().pingType(st.type);
-    }
-
-    /**
-     * Generates Objective-C file and returns absolute path name.
-     */
-    private String generateFileForFramework(Framework fw, Width arch) throws Exception{
-        File tempfile = File.createTempFile("JObjC-SOR-" + fw.name + "-" + arch + "-", ".mm");
-        PrintWriter out = new PrintWriter(new FileWriter(tempfile));
-        out.println("#include<iostream>");
-        printHeaderLines(fw, arch, out);
-        out.println("");
-        out.println("int main(int argc, char** argv){");
-        printStructInfos(fw, arch, out);
-        out.println("\treturn 0;");
-        out.println("}");
-        out.close();
-        return tempfile.getAbsolutePath();
-    }
-
-    protected void execute(String executable, Fp.Map1<String,Object> lineProcessor) throws Exception {
-//        System.out.println(">>>> Executing " + new Date().toString());
-        Process p = Runtime.getRuntime().exec(new String[]{executable});
-
-        if(lineProcessor != null){
-            BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
-            String line;
-            while ((line = stdout.readLine()) != null)
-                lineProcessor.apply(line);
-            stdout.close();
-        }
-        p.waitFor();
-        if(p.exitValue() != 0)
-            throw new RuntimeException(executable + " did not execute successfully: " + p.exitValue());
-    }
-
-    private static Map<Width,String> gccFlag = Fp.litMap(Width.W32, "-m32", Width.W64, "-m64");
-
-    static boolean isDone(Process p){
-        try{
-            p.exitValue();
-            return true;
-        }
-        catch(Exception x){
-            return false;
-        }
-    }
-
-    protected static String compileObjC(String nativeSrc, Width arch) throws Exception {
-        String execPath = nativeSrc.replace(".mm", "");
-        Process p = Runtime.getRuntime().exec(new String[]{
-                "llvm-g++", "-Wall", gccFlag.get(arch), "-ObjC++", "-framework", "Foundation", "-o", execPath, nativeSrc
-        });
-        BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-        while(!isDone(p)){
-            while(stdout.ready()) System.out.println(stdout.readLine());
-            while(stderr.ready()) System.out.println(stderr.readLine());
-        }
-        p.waitFor();
-        while(stdout.ready() || stderr.ready()){
-            if(stdout.ready()) System.out.println(stdout.readLine());
-            if(stderr.ready()) System.out.println(stderr.readLine());
-        }
-        if(p.exitValue() != 0)
-            throw new RuntimeException("gcc did not compile '" + nativeSrc + "' successfully: " + p.exitValue());
-        return execPath;
-    }
-
-    static void printStructInfos(Framework fw, Width arch, PrintWriter out){
-        for(Struct st : fw.structs){
-            NStruct nst = wget(arch, st.type.type32, st.type.type64);
-            out.println("std::cout << \"" + fw.name + " " + st.name + "\" << ':' << sizeof("+st.name+")");
-            for(NField sf : nst.fields){
-                out.print("\t<< ' ' << ");
-                out.println(sf.type instanceof NType.NBitfield
-                          ? "-1"
-                          : "offsetof("+st.name+","+sf.name+")");
-            }
-            out.println("\t<< std::endl;");
-        }
-    }
-
-    static void printHeaderLines(Framework fw, Width arch, PrintWriter out) throws Exception {
-        Collection<String> always = alwaysHeaders.get(arch);
-        Collection<String> banned = bannedHeaders.get(arch);
-        out.println("#define COREFOUNDATION_CFPLUGINCOM_SEPARATE 0");
-        for(String header : always)
-            out.println("#import " + header);
-
-        out.println("#undef COREFOUNDATION_CFPLUGINCOM_SEPARATE");
-        String umbrella = fw.path + "/Headers/" + fw.name;
-        if(new File(umbrella).exists())
-            out.println("#import \"" + umbrella + "\"");
-
-        for(File header : getHeaders(fw))
-            if(!banned.contains(header.getName()))
-                out.println("#import \"" + header.getAbsolutePath() + "\"");
-    }
-
-    static <A,B> A wget(Width arch, B x32, B x64){
-        switch(arch){
-        case W32: return (A) x32;
-        case W64: return (A) x64;
-        default: throw new RuntimeException();
-        }
-    }
-
-    /**
-     * Gets the absolute path to every header in FOO.framework/Headers
-     */
-    static Collection<File> getHeaders(Framework fw) throws Exception {
-        String hpath = fw.path + "/Headers";
-        return Utils.find(new File(hpath), "^.*\\.h$", "");
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolverBigBang.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolverBigBang.java
deleted file mode 100644
index 212df7734b5..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/utils/StructOffsetResolverBigBang.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.internal.jobjc.generator.utils;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.Collection;
-
-import com.apple.internal.jobjc.generator.model.Framework;
-import com.apple.internal.jobjc.generator.utils.Fp.Map1;
-import com.apple.jobjc.JObjCRuntime.Width;
-
-/**
- * Takes a framework, compiles a native source file with all its structs,
- * and figures out their sizes and field offsets.
- *
- * BigBang significantly speeds up the process by
- * compiling all frameworks as one big Objective-C file.
- */
-public class StructOffsetResolverBigBang extends StructOffsetResolver{
-
-    @Override protected void _resolve(final Collection<Framework> fws) throws Exception{
-        for(final Width arch : Width.values()){
-            System.out.println("SORBB -- Getting Struct offsets @" + arch.toString());
-            String nativeSrc = generateFileForFrameworks(fws, arch);
-            String executable = compileObjC(nativeSrc, arch);
-            execute(executable, new Map1<String,Object>(){
-                public Object apply(String ln) {
-                    try {
-                        processLine(ln, fws, arch);
-                        return null;
-                    } catch (Exception e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-            });
-        }
-    }
-
-    /**
-     * Generates Objective-C file and returns absolute path name.
-     */
-    protected String generateFileForFrameworks(final Collection<Framework> fws, final Width arch) throws Exception{
-        File tempfile = File.createTempFile("JObjC-SORBB-" + arch + "-", ".mm");
-        PrintWriter out = new PrintWriter(new FileWriter(tempfile));
-
-        out.println("#include<iostream>");
-        for(Framework fw : fws) printHeaderLines(fw, arch, out);
-        out.println("int main(int argc, char** argv){");
-        for(Framework fw : fws) printStructInfos(fw, arch, out);
-        out.println("\treturn 0;");
-        out.println("}");
-
-        out.close();
-        return tempfile.getAbsolutePath();
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/SuperClassExtractor.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/SuperClassExtractor.java
deleted file mode 100644
index cc0b3f9047c..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/SuperClassExtractor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.util.Map;
-
-import com.apple.internal.jobjc.generator.model.Clazz;
-
-/*
- * Isolating all the reflection trickery to hijack the runtime into giving up its secrets
- * without actually having a full working version of JObjC. Below is a bunch of evil reflection,
- * but it allows the generated output to have a cleaner design.
- */
-public class SuperClassExtractor {
-    public static Clazz getSuperClassFor(final String className, final MacOSXFramework nativeFramework, final Map<String, Clazz> allClasses) throws Throwable {
-        final NSClass<ID> nativeClass = new NSClass<ID>(className, nativeFramework.getRuntime());
-        final NSClass<? extends ID> nativeSuperClass = UnsafeRuntimeAccess.getSuperClass(nativeClass);
-        final String superClassName = UnsafeRuntimeAccess.getClassNameFor(nativeSuperClass);
-        if ("nil".equals(superClassName)) return null;
-
-        final Clazz superClazz = allClasses.get(superClassName);
-        if (superClazz != null) return superClazz;
-
-        final Clazz superClazzX = getSuperClassFor(superClassName, nativeFramework, allClasses);
-        System.out.print("[Warning] class \"" + superClassName + "\" not found in bridge support files, ");
-        System.out.println("using \"" + superClazzX.name + "\" as superclass for \"" + className + "\"");
-        return superClazzX;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/UnsafeRuntimeAccess.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/UnsafeRuntimeAccess.java
deleted file mode 100644
index 556ba97021a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/jobjc/UnsafeRuntimeAccess.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Invoke.FunCall;
-import com.apple.jobjc.Invoke.MsgSend;
-
-public class UnsafeRuntimeAccess {
-    public static NativeArgumentBuffer getNativeBuffer() {
-        return NativeArgumentBuffer.getThreadLocalBuffer(JObjCRuntime.getInstance());
-    }
-
-    public static String getClassNameFor(final long obj) {
-        return NSClass.getClassNameOfClass(obj);
-    }
-
-    public static String getClassNameFor(final NSClass cls) {
-        return NSClass.getClassNameOfClass(cls.ptr);
-    }
-
-    public static NSClass<?> getSuperClass(final NSClass<? extends ID> clazz) {
-        return clazz.getSuperClass();
-    }
-
-    public static String getDescriptionForPtr(final long objPtr) {
-        return ID.getNativeDescription(objPtr);
-    }
-
-    public static MacOSXFramework getFramework(final String[] frameworkLibs) {
-        return new MacOSXFramework(JObjCRuntime.getInstance(), frameworkLibs);
-    }
-
-    public static FunCall createFunCall(final MacOSXFramework framework, final String fxnName, final Coder returnCoder, final Coder ... argCoders) {
-        return new FunCall(framework, fxnName, returnCoder, argCoders);
-    }
-
-    public static MsgSend createMsgSend(final NSClass<?> clazz, final String selName, final Coder returnCoder, final Coder ... argCoders) {
-        return new MsgSend(clazz.getRuntime(), selName, returnCoder, argCoders);
-    }
-
-    public static NSClass<ID> getNSClass(final MacOSXFramework framework, final String name) {
-        return new NSClass<ID>(name, framework.getRuntime());
-    }
-
-    public static long getObjPtr(final ID obj) {
-        return obj.ptr;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/runtime-additions/java/com/apple/jobjc/Utils.java b/jdk/src/macosx/native/jobjc/src/runtime-additions/java/com/apple/jobjc/Utils.java
deleted file mode 100644
index a22851de4cb..00000000000
--- a/jdk/src/macosx/native/jobjc/src/runtime-additions/java/com/apple/jobjc/Utils.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.util.concurrent.Callable;
-
-import com.apple.jobjc.foundation.NSNumber;
-import com.apple.jobjc.foundation.NSString;
-
-public class Utils {
-    JObjCRuntime runtime;
-    Utils(JObjCRuntime runtime){ this.runtime = runtime; }
-
-    private static Utils utils;
-    public static Utils get() {
-        JObjCRuntime runtime = JObjCRuntime.getInstance(); // enforce security check
-        return utils != null ? utils : (utils = new Utils(runtime));
-    }
-
-    private Strings strings_;
-    public Strings strings() {
-        return strings_ != null ? strings_ : (strings_ = new Strings(runtime));
-    }
-
-    private Numbers numbers_;
-    public Numbers numbers() {
-        return numbers_ != null ? numbers_ : (numbers_ = new Numbers(runtime));
-    }
-
-    private Threads threads_;
-    public Threads threads() {
-        return threads_ != null ? threads_ : (threads_ = new Threads(runtime));
-    }
-
-    public static class Strings {
-        private static native long getNativeNSStringForJavaString(final String javaString);
-        private static native String getNativeJavaStringForNSString(final long nsString);
-
-        JObjCRuntime runtime;
-        Strings(JObjCRuntime runtime) { this.runtime = runtime; }
-
-        public NSString nsString(final String str) {
-            if (str == null) return null;
-            final long nsString = getNativeNSStringForJavaString(str);
-            return ID.createNewObjCObjectForClass(NSString.class, nsString, runtime);
-        }
-
-        public String javaString(final NSString str) {
-            if (str == null) return null;
-            return getNativeJavaStringForNSString(((ID)str).ptr);
-        }
-
-//        static public CString cStringForJavaString(final String str) {
-//            return null;
-//        }
-    }
-
-    public static class Numbers {
-        private static native long getNativeNSNumberForJavaNumber(final Number num);
-        private static native Number getNativeJavaNumberForNSNumber(final long num);
-
-        JObjCRuntime runtime;
-        Numbers(JObjCRuntime runtime) { this.runtime = runtime; }
-
-        public NSNumber nsNumber(final Number num) {
-            if (num == null) return null;
-            final long nsNumber = getNativeNSNumberForJavaNumber(num);
-            return ID.createNewObjCObjectForClass(NSNumber.class, nsNumber, runtime);
-        }
-
-        public Number javaNumber(final NSNumber num) {
-            if (num == null) return null;
-            return getNativeJavaNumberForNSNumber(((ID)num).ptr);
-        }
-    }
-
-    public static class Threads {
-        private static native void performRunnableOnMainThread(final Runnable runnable, final boolean wait);
-        private static native <V> V performCallableOnMainThread(final Callable<V> callable) throws Exception;
-
-        JObjCRuntime runtime;
-        Threads(JObjCRuntime runtime) { this.runtime = runtime; }
-
-        /**
-         * Perform callable on main thread. Exceptions that are thrown on the main thread are ignored.
-         */
-        public void performOnMainThread(final Runnable runnable, final boolean wait) {
-            performRunnableOnMainThread(runnable, wait);
-        }
-
-        /**
-         * Perform callable on main thread, block until done, and return the result.
-         * This also catches any exceptions on the main thread, brings them back and throws them to the caller.
-         */
-        public <V> V performOnMainThread(final Callable<V> callable) throws Exception{
-            return performCallableOnMainThread(callable);
-        }
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeNumber.m b/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeNumber.m
deleted file mode 100644
index 395f46fb211..00000000000
--- a/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeNumber.m
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_Utils_Numbers.h"
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-/*
- * Class:     com_apple_jobjc_Utils_Numbers
- * Method:    getNativeNSNumberForJavaNumber
- * Signature: (Ljava/lang/Number;)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_Utils_00024Numbers_getNativeNSNumberForJavaNumber
-(JNIEnv *env, jclass clazz, jobject javaNumber)
-{
-    return ptr_to_jlong(JNFJavaToNSNumber(env, javaNumber));
-}
-
-/*
- * Class:     com_apple_jobjc_Utils_Numbers
- * Method:    getNativeJavaNumberForNSNumber
- * Signature: (J)Ljava/lang/Number;
- */
-JNIEXPORT jobject JNICALL Java_com_apple_jobjc_Utils_00024Numbers_getNativeJavaNumberForNSNumber
-(JNIEnv *env, jclass clazz, jlong nativeNumber)
-{
-    return JNFNSToJavaNumber(env, (NSNumber *)jlong_to_ptr(nativeNumber));
-}
diff --git a/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeString.m b/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeString.m
deleted file mode 100644
index 1e01545555d..00000000000
--- a/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeString.m
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_Utils_Strings.h"
-
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-
-/*
- * Class:     com_apple_jobjc_Utils_Strings
- * Method:    getNativeNSStringForJavaString
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_Utils_00024Strings_getNativeNSStringForJavaString
-(JNIEnv *env, jclass clazz, jstring javaString)
-{
-    return ptr_to_jlong(JNFJavaToNSString(env, javaString));
-}
-
-/*
- * Class:     com_apple_jobjc_Utils_Strings
- * Method:    getNativeJavaStringForNSString
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_jobjc_Utils_00024Strings_getNativeJavaStringForNSString
-(JNIEnv *env, jclass clazz, jlong nativeString)
-{
-    return JNFNSToJavaString(env, (NSString *)jlong_to_ptr(nativeString));
-}
diff --git a/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeThread.m b/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeThread.m
deleted file mode 100644
index 75062e44e0c..00000000000
--- a/jdk/src/macosx/native/jobjc/src/runtime-additions/native/NativeThread.m
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "com_apple_jobjc_Utils_Threads.h"
-
-#import <AppKit/AppKit.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-
-@interface JObjCCallable : NSObject {
-    @public jobject returnValue;
-    @public jthrowable exception;
-}
-@property jobject returnValue;
-@property jthrowable exception;
-- (void) performCallable:(JNFJObjectWrapper *)callableWrapper;
-@end
-
-/*
- * Class:     com_apple_jobjc_Utils_Threads
- * Method:    performRunnableOnMainThreadNative
- * Signature: (Ljava/lang/Runnable;Z)V
- */
-JNIEXPORT void JNICALL Java_com_apple_jobjc_Utils_00024Threads_performRunnableOnMainThread
-(JNIEnv *env, jclass clazz, jobject runnable, jboolean jWaitUntilDone)
-{
-JNF_COCOA_ENTER(env);
-    [JNFRunLoop performOnMainThreadWaiting:jWaitUntilDone
-                                 withBlock:[JNFRunnable blockWithRunnable:runnable
-                                                                  withEnv:env]];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     com_apple_jobjc_Utils_Threads
- * Method:    performCallableOnMainThreadNative
- * Signature: (Ljava/util/concurrent/Callable;)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_com_apple_jobjc_Utils_00024Threads_performCallableOnMainThread
-(JNIEnv *env, jclass clazz, jobject callable)
-{
-    jobject returnValue = NULL;
-
-JNF_COCOA_ENTER(env);
-    JNFJObjectWrapper *callableWrapper = [[JNFJObjectWrapper alloc] initWithJObject:callable withEnv:env];
-    JObjCCallable *ncallable = [JObjCCallable alloc];
-
-    [ncallable performSelectorOnMainThread:@selector(performCallable:)
-                                withObject:callableWrapper
-                             waitUntilDone:true];
-
-    returnValue = ncallable.returnValue;
-    jthrowable exception = ncallable.exception;
-
-    [ncallable release];
-    if(exception) (*env)->Throw(env, exception);
-
-JNF_COCOA_EXIT(env);
-
-    return returnValue;
-}
-
-
-@implementation JObjCCallable
-@synthesize returnValue;
-@synthesize exception;
-
-- (void) performCallable:(JNFJObjectWrapper *)callableWrapper {
-    static JNF_CLASS_CACHE(jc_Callable, "java/util/concurrent/Callable");
-    static JNF_MEMBER_CACHE(jm_Callable_call, jc_Callable, "call", "()Ljava/lang/Object;");
-
-    JNFThreadContext threadWasAttached = JNFThreadDetachOnThreadDeath;
-    JNIEnv *env = JNFObtainEnv(&threadWasAttached);
-    jobject callable = [callableWrapper jObject];
-
-    @try{
-        self.returnValue = JNFCallObjectMethod(env, callable, jm_Callable_call);
-    } @catch (JNFException *x) {
-        [x raiseToJava:env];
-    }
-
-    self.exception = (*env)->ExceptionOccurred(env);
-    (*env)->ExceptionClear(env);
-
-    [callableWrapper release];
-    JNFReleaseEnv(env, &threadWasAttached);
-}
-
-@end
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BaseBench.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BaseBench.java
deleted file mode 100644
index dbbb80cd31f..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BaseBench.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import sun.misc.Unsafe;
-
-public class BaseBench extends PooledTestCase {
-    protected final static JObjCRuntime RUNTIME = JObjCRuntime.getInstance();
-    protected final static JObjC JOBJC = JObjC.getInstance();
-    protected final static Unsafe UNSAFE = JObjCRuntime.getInstance().unsafe;
-    protected final static NativeArgumentBuffer ARGS = JObjCRuntime.getInstance().getThreadLocalState();
-
-    public abstract static class Task{
-        final String name;
-        public Task(String name){ this.name = name; }
-        public abstract void run();
-    }
-
-    public void bench(final String title, final long warmup, final long runs, final long iterations, final Task... tasks){
-        final long[] runtimes = new long[tasks.length];
-
-        for(int t = 0; t < tasks.length; ++t){
-            long runtime = 0;
-            for(int i = 0; i < warmup; ++i)
-                singleBench(iterations, tasks[t]);
-            for(int i = 0; i < runs; ++i)
-                runtime = runtime + singleBench(iterations, tasks[t]);
-            runtimes[t] = runtime;
-        }
-
-        final float[] relatives = new float[tasks.length];
-
-        for(int t = 0; t < tasks.length; ++t)
-            relatives[t] = ((float) runtimes[t] / (float) runs);
-
-        float min = relatives[0];
-        for(float t : relatives)
-            if(t < min)
-                min = t;
-
-        for(int t = 0; t < tasks.length; ++t)
-            relatives[t] = relatives[t] / min;
-
-        System.out.format("\n* %1$s\n", title);
-        for(int t = 0; t < tasks.length; ++t)
-            System.out.format("%1$60s : %2$.1f\n", tasks[t].name, relatives[t]);
-    }
-
-    public long singleBench(final long iterations, final Task task){
-        long start = System.currentTimeMillis();
-        for(long i = 0; i < iterations; ++i)
-            task.run();
-        long end = System.currentTimeMillis();
-        return end - start;
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchFunCall.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchFunCall.java
deleted file mode 100644
index 417ad6d1187..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchFunCall.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Invoke.FunCall;
-import com.apple.jobjc.PrimitiveCoder.DoubleCoder;
-
-public final class BenchFunCall extends BaseBench{
-    final static int ITERS  = 1000;
-    final static FunCall fc = new FunCall(JObjCRuntime.getInstance(), "sin", DoubleCoder.INST, DoubleCoder.INST);
-    final static double ARG = 3.14159265 / 2.0;
-    final static double RET = 1.0;
-
-    private static native double jniSin(double arg);
-
-    public void testBench(){
-        this.bench("Calling functions", 5, 3, 10000L,
-
-                new Task("JNI Invoke"){
-            @Override public void run() {
-                for(int i = 0; i < ITERS; ++i)
-                    jniSin(ARG);
-            }},
-
-            new Task("JObjC FunCall"){
-                @Override public void run() {
-                    for(int i = 0; i < ITERS; ++i){
-                        fc.init(ARGS);
-                        DoubleCoder.INST.push(ARGS, ARG);
-                        fc.invoke(ARGS);
-                        DoubleCoder.INST.pop(ARGS);
-                    }
-                }},
-
-                new Task("JObjC FunCall (inlined)"){
-                    @Override public void run() {
-                        for(int i = 0; i < ITERS; ++i){
-                            // init
-                            ARGS.argPtrsPtr = ARGS.buffer.bufferPtr;
-                            ARGS.argValuesPtr = ARGS.buffer.bufferPtr + 256;
-                            // push double
-                            //// push arg ptr
-                            if(JObjCRuntime.IS64)
-                                UNSAFE.putLong(ARGS.argPtrsPtr, ARGS.argValuesPtr);
-                            else
-                                UNSAFE.putInt(ARGS.argPtrsPtr, (int) ARGS.argValuesPtr);
-                            ARGS.argPtrsPtr += JObjCRuntime.PTR_LEN;
-                            //// push arg value
-                            UNSAFE.putDouble(ARGS.argValuesPtr, ARG);
-                            ARGS.argValuesPtr += 8;
-                            // invoke
-                            FunCall.invoke(fc.cif.cif.bufferPtr, fc.fxnPtr, ARGS.retValPtr, ARGS.buffer.bufferPtr);
-                            // pop
-                            UNSAFE.getDouble(ARGS.retValPtr);
-                        }
-                    }}
-        );
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchIDPop.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchIDPop.java
deleted file mode 100644
index b24059b3644..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchIDPop.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.foundation.FoundationFramework;
-import com.apple.jobjc.foundation.NSString;
-
-public class BenchIDPop extends BaseBench{
-    static native long jniNSStringAlloc();
-    static native long jniNSStringAllocAndRetain();
-    static native long jniNSStringCached();
-    static native void jniCFRetain(long x);
-    static native void jniCFRelease(long x);
-
-    final static int ITERS = 1000;
-    final static FoundationFramework FND = JOBJC.Foundation();
-
-    private static class LongWrap{
-        long l;
-        public LongWrap(long l){ this.l = l; }
-    }
-
-    public void testIt(){
-        bench("Alloc, retain, pop a new NSString", 2, 3, 2000,
-                new Task("jniNSStringAllocAndRetain()"){
-            @Override public void run() {
-                for(int i = 0; i < ITERS; i++)
-                    jniNSStringAllocAndRetain();
-            }},
-
-            new Task("new LongWrap(jniNSStringAllocAndRetain())"){
-                @Override public void run() {
-                    for(int i = 0; i < ITERS; i++)
-                        new LongWrap(jniNSStringAllocAndRetain());
-                }},
-
-                new Task("FND.NSString().alloc()"){
-                    @Override public void run() {
-                        for(int i = 0; i < ITERS; i++)
-                            FND.NSString().alloc();
-                    }},
-
-                    new Task("new NSString(jniNSStringAlloc(), RUNTIME)"){
-                        @Override public void run() {
-                            for(int i = 0; i < ITERS; i++)
-                                new NSString(jniNSStringAlloc(), RUNTIME);
-                        }}
-        );
-
-        final long nsstringPtr = jniNSStringAlloc();
-
-        bench("Get and hold an existing object", 2, 3, 2000,
-                new Task("jniCFRetain(nsstringPtr)"){
-            @Override public void run() {
-                for(int i = 0; i < ITERS; i++)
-                    jniCFRetain(nsstringPtr);
-            }},
-
-            new Task("jniCFRetain(new LongWrap(nsstringPtr).l"){
-                @Override public void run() {
-                    for(int i = 0; i < ITERS; i++)
-                        jniCFRetain(new LongWrap(nsstringPtr).l);
-                }},
-
-                new Task("ID.getInstance(nsstringPtr, RUNTIME)"){
-                    @Override public void run() {
-                        for(int i = 0; i < ITERS; i++)
-                            ID.getInstance(nsstringPtr, RUNTIME);
-                    }}
-        );
-    }
-
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchStructCoding.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchStructCoding.java
deleted file mode 100644
index 9d0a769805a..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchStructCoding.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Coder.StructCoder;
-import com.apple.jobjc.Invoke.FunCall;
-import com.apple.jobjc.foundation.FoundationFramework;
-import com.apple.jobjc.foundation.NSRect;
-
-public class BenchStructCoding extends BaseBench {
-    final static FoundationFramework FND = JOBJC.Foundation();
-    final static int ITERS = 1000;
-    final static PrimitiveCoder CODER = com.apple.jobjc.MixedPrimitiveCoder.FloatDoubleCoder;
-    final static StructCoder RCODER = NSRect.getStructCoder();
-    final static FunCall nsMakePoint =
-        new com.apple.jobjc.Invoke.FunCall(FND, "NSMakeRect", com.apple.jobjc.foundation.NSRect.getStructCoder(),
-                com.apple.jobjc.MixedPrimitiveCoder.FloatDoubleCoder,
-                com.apple.jobjc.MixedPrimitiveCoder.FloatDoubleCoder,
-                com.apple.jobjc.MixedPrimitiveCoder.FloatDoubleCoder,
-                com.apple.jobjc.MixedPrimitiveCoder.FloatDoubleCoder);
-
-    public void testFoo(){
-        bench("NSMakeRect", 3, 3, 10,
-                new Task("FND.NSMakeRect"){
-            @Override public void run() {
-                for(int i = 0; i < ITERS; ++i){
-                    NSRect s = FND.NSMakeRect(0, 1, 2, 3);
-//                    assertEquals(1.0D, s.origin().y());
-                }
-            }},
-
-            new Task("nsMakeRect.invoke(..., s)"){
-                @Override public void run() {
-                    for(int i = 0; i < ITERS; ++i){
-                        nsMakePoint.init(ARGS);
-                        CODER.push(ARGS, 0.0D);
-                        CODER.push(ARGS, 1.0D);
-                        CODER.push(ARGS, 2.0D);
-                        CODER.push(ARGS, 3.0D);
-                        NSRect s = FND.makeNSRect();
-                        nsMakePoint.invoke(ARGS, s);
-//                        assertEquals(1.0D, s.origin().y());
-                    }
-                }},
-
-                new Task("nsMakeRect.invoke(..); NSRect r = pop(..);"){
-                    @Override public void run() {
-                        for(int i = 0; i < ITERS; ++i){
-                            nsMakePoint.init(ARGS);
-                            CODER.push(ARGS, 0.0D);
-                            CODER.push(ARGS, 1.0D);
-                            CODER.push(ARGS, 2.0D);
-                            CODER.push(ARGS, 3.0D);
-                            nsMakePoint.invoke(ARGS);
-                            NSRect s = (NSRect) RCODER.pop(ARGS);
-//                            assertEquals(1.0D, s.origin().y());
-                        }
-                    }}
-        );
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchUnsafe.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchUnsafe.java
deleted file mode 100644
index f04c99d3dc8..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/BenchUnsafe.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.nio.ByteBuffer;
-
-public class BenchUnsafe extends BaseBench{
-    final static int ITERS = 1000000;
-
-    final static NativeBuffer NBUF = new NativeBuffer(2 * ITERS);
-    final static ByteBuffer BBUF = NBUF.buffer;
-    final static long ADDR = NBUF.bufferPtr;
-    final static long ADDR_MAX = NBUF.bufferPtr + ITERS;
-
-    final static NativeBuffer NBUF2 = new NativeBuffer(2 * ITERS);
-    final static ByteBuffer BBUF2 = NBUF2.buffer;
-    final static long ADDR2 = NBUF2.bufferPtr;
-    final static long ADDR2_MAX = NBUF2.bufferPtr + ITERS;
-
-    final static long ARG = 345;
-
-    final static long BUFSIZE = BBUF.limit();
-
-    public void testIt(){
-        this.bench("Memory writes", 5, 3, 100L,
-
-                new Task("buffer.putLong"){
-            @Override public void run() {
-                for(long i = 0; i < ITERS; i++)
-                    BBUF.putLong((int) i, ARG);
-            }},
-
-            new Task("unsafe.putLong"){
-                @Override public void run() {
-                    for(long i = ADDR; i < ADDR_MAX; i++)
-                        UNSAFE.putLong(i, ARG);
-                }});
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/CategoryTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/CategoryTest.java
deleted file mode 100644
index b762d7e9bb2..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/CategoryTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.appkit.AppKitFramework;
-import com.apple.jobjc.appkit.NSStringCategory;
-import com.apple.jobjc.foundation.NSSize;
-import com.apple.jobjc.foundation.NSString;
-
-public class CategoryTest extends PooledTestCase {
-    public void testAppKit_NSString(){
-        AppKitFramework APPKIT = JObjC.getInstance().AppKit();
-
-        NSString nstr = Utils.get().strings().nsString("mirzapirza");
-        NSStringCategory nstrx = APPKIT.NSStringCategory(nstr);
-        NSSize sz = nstrx.sizeWithAttributes(null);
-
-        assertEquals(57.0, sz.width());
-        assertEquals(15.0, sz.height());
-    }
-
-    public static void main(String[] args){
-        junit.textui.TestRunner.run(CategoryTest.class);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/FunctionTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/FunctionTest.java
deleted file mode 100644
index 00e3c4deac1..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/FunctionTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Coder.PointerCoder;
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-import com.apple.jobjc.Coder.VoidCoder;
-import com.apple.jobjc.Invoke.FunCall;
-
-public class FunctionTest extends PooledTestCase {
-    NativeArgumentBuffer nativeBuffer;
-    JObjCRuntime runtime;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        nativeBuffer = UnsafeRuntimeAccess.getNativeBuffer();
-        runtime = nativeBuffer.runtime;
-    }
-
-    public void testInvokeNoParamNoReturn() throws Throwable {
-        final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSBeep", VoidCoder.INST);
-
-        fxn.init(nativeBuffer);
-        fxn.invoke(nativeBuffer);
-    }
-
-    public void testInvokeNoParams() throws Throwable {
-        final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSFullUserName", PointerCoder.INST);
-
-        fxn.init(nativeBuffer);
-        fxn.invoke(nativeBuffer);
-
-        final long ptr = PrimitivePointerCoder.INST.pop(nativeBuffer);
-        System.out.println("0x" + Long.toHexString(ptr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(ptr));
-    }
-
-    public void testInvokeOneParam() throws Throwable {
-        final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST);
-
-        getHomeDirFxn.init(nativeBuffer);
-        getHomeDirFxn.invoke(nativeBuffer);
-
-        final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer);
-        System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr));
-
-        final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST);
-        getTypeOfFxn.init(nativeBuffer);
-        PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr);
-        getTypeOfFxn.invoke(nativeBuffer);
-
-    //    long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer);
-    //    System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr));
-    }
-
-    public static void main(final String[] args) {
-        junit.textui.TestRunner.run(FunctionTest.class);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/GUIDemo.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/GUIDemo.java
deleted file mode 100644
index c9a3f46b05e..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/GUIDemo.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Utils.Strings;
-import com.apple.jobjc.appkit.NSApplication;
-import com.apple.jobjc.appkit.NSButton;
-import com.apple.jobjc.appkit.NSDrawer;
-import com.apple.jobjc.appkit.NSMenu;
-import com.apple.jobjc.appkit.NSWindow;
-import com.apple.jobjc.foundation.NSAutoreleasePool;
-import com.apple.jobjc.foundation.NSObject;
-import com.apple.jobjc.foundation.NSObjectClass;
-import com.apple.jobjc.foundation.NSRect;
-import com.apple.jobjc.foundation.NSSize;
-
-class MyDelegate extends NSObject{
-    static final JObjC objc = JObjC.getInstance();
-    static final Strings str = Utils.get().strings();
-
-    public MyDelegate(long ptr, JObjCRuntime r) { super(ptr, r); }
-
-    private NSWindow myWindow;
-    private NSDrawer myDrawer;
-
-    public void printHello(ID sender){
-        System.out.println("Hello!");
-        myDrawer.toggle(this);
-    }
-
-    public void createMenu(){
-        NSMenu menu = objc.AppKit().NSMenu().newID();
-        menu.addItemWithTitle_action_keyEquivalent(
-                str.nsString("Quit"),
-                new SEL("terminate:"),
-                str.nsString("q"));
-        NSApplication app = objc.AppKit().NSApp();
-        app.setMainMenu(menu);
-    }
-
-    public void createWindow(){
-        NSRect rect;
-        int styleMask = objc.AppKit().NSTitledWindowMask() | objc.AppKit().NSMiniaturizableWindowMask();
-        NSButton myButton;
-        NSSize buttonSize;
-        myButton = objc.AppKit().NSButton().newID();
-        myButton.setTitle(str.nsString("Print Hello!"));
-        myButton.sizeToFit();
-        myButton.setTarget(this);
-        myButton.setAction(new SEL("printHello:"));
-        buttonSize = myButton.frame().size();
-        rect = objc.Foundation().NSMakeRect(100, 100, 2*buttonSize.width(), 2*buttonSize.height());
-        myWindow = objc.AppKit().NSWindow().alloc();
-        myWindow = myWindow.initWithContentRect_styleMask_backing_defer(
-                rect, styleMask, objc.AppKit().NSBackingStoreBuffered(), false);
-        myWindow.setTitle(str.nsString("This is a test window."));
-        myWindow.setContentView(myButton);
-
-        myDrawer = objc.AppKit().NSDrawer().alloc();
-        myDrawer = myDrawer.initWithContentSize_preferredEdge(
-                  objc.Foundation().NSMakeSize(100, 40), objc.Foundation().NSMinYEdge());
-        myDrawer.setParentWindow(myWindow);
-    }
-
-    public void applicationWillFinishLaunching(ID not){
-        createMenu();
-        createWindow();
-    }
-
-    public void applicationDidFinishLaunching(ID not){
-        myWindow.makeKeyAndOrderFront(null);
-    }
-}
-
-class MyDelegateClass extends NSObjectClass{
-    public MyDelegateClass(JObjCRuntime r){ super(r); }
-}
-
-public class GUIDemo{
-    static final JObjC objc = JObjC.getInstance();
-
-    public static void main(String[] args){
-        JObjCRuntime.getInstance().registerUserClass(MyDelegate.class, MyDelegateClass.class);
-
-        objc.AppKit().NSApplication().sharedApplication();
-        NSApplication app = objc.AppKit().NSApp();
-
-        NSAutoreleasePool pool = objc.Foundation().NSAutoreleasePool().alloc();
-        pool = pool.init();
-        app.setDelegate(new MyDelegateClass(JObjCRuntime.getInstance()).newID());
-        app.run();
-        pool.drain();
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IBDemo.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IBDemo.java
deleted file mode 100644
index dbfc1eff4a3..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IBDemo.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/**
- * To locate the nib correctly, this demo must run from
- * a .app (created with Jar Bundler...).
- *
- * TODO Add .app/Jar Bundler as ant task
- */
-
-package com.apple.jobjc;
-
-import java.awt.Toolkit;
-
-import com.apple.jobjc.appkit.AppKitFramework;
-import com.apple.jobjc.appkit.NSApplication;
-import com.apple.jobjc.appkit.NSView;
-import com.apple.jobjc.appkit.NSViewClass;
-import com.apple.jobjc.foundation.FoundationFramework;
-import com.apple.jobjc.foundation.NSRect;
-import com.apple.jobjc.foundation.NSString;
-
-class MyView extends NSView{
-    static final AppKitFramework APPKIT = JObjC.getInstance().AppKit();
-
-    public MyView(long objPtr, JObjCRuntime runtime) { super(objPtr, runtime); }
-
-    @Override public void drawRect(NSRect r){
-        APPKIT.NSColor().redColor().set();
-        APPKIT.NSBezierPath().fillRect(r);
-    }
-}
-
-class MyViewClass extends NSViewClass{
-    protected MyViewClass(String name, JObjCRuntime runtime) { super(name, runtime); }
-    public MyViewClass(JObjCRuntime runtime){ this(MyView.class.getSimpleName(), runtime); }
-}
-
-public class IBDemo{
-    final static FoundationFramework FOUNDATION = JObjC.getInstance().Foundation();
-    final static AppKitFramework APPKIT = JObjC.getInstance().AppKit();
-
-    // Works if the JVM is launched on the main thread,
-    // but JavaApplicationStub does not understand -XstartOnFirstThread
-    public static void mainWithAppMain(String[] args){
-        APPKIT.NSApplicationMain(0, null);
-    }
-
-    // Work around: let someone else init, and then
-    // get on the main thread to load the nib.
-    public static void mainWithoutAppMain(String[] args){
-        Toolkit.getDefaultToolkit();
-
-        Utils.get().threads().performOnMainThread(new Runnable(){
-            public void run() {
-                APPKIT.NSApplication().sharedApplication();
-                NSApplication APP = APPKIT.NSApp();
-
-                NSString nibName = Utils.get().strings().nsString("MainMenu");
-                boolean loadedNib = APPKIT.NSBundleCategory().loadNibNamed_owner(nibName, APP);
-                if(!loadedNib) throw new RuntimeException("Failed to load nib.");
-            }}, false);
-    }
-
-    public static void main(String[] args){
-        JObjCRuntime.getInstance().registerUserClass(MyView.class, MyViewClass.class);
-        mainWithoutAppMain(args);
-        //mainWithAppMain(args);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IntroTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IntroTest.java
deleted file mode 100644
index edd5f072575..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/IntroTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import junit.framework.TestCase;
-
-import com.apple.jobjc.Invoke.FunCall;
-import com.apple.jobjc.PrimitiveCoder.DoubleCoder;
-import com.apple.jobjc.appkit.AppKitFramework;
-import com.apple.jobjc.appkit.NSApplication;
-import com.apple.jobjc.appkit.NSApplicationClass;
-import com.apple.jobjc.appkit.NSColorPanel;
-import com.apple.jobjc.appkit.NSWorkspace;
-import com.apple.jobjc.foundation.FoundationFramework;
-import com.apple.jobjc.foundation.NSAutoreleasePool;
-import com.apple.jobjc.foundation.NSPoint;
-import com.apple.jobjc.foundation.NSString;
-import com.apple.jobjc.foundation.NSStringClass;
-
-public class IntroTest extends TestCase{
-    // The low-level core makes function calls, sends messages, marshals data, etc.
-    public void testCore(){
-        // pass security check and get ahold of a runtime (should cache this)
-        final JObjCRuntime RUNTIME = JObjCRuntime.getInstance();
-        final NativeArgumentBuffer ARGS = JObjCRuntime.getInstance().getThreadLocalState();
-
-        // create a funcall (should cache this)
-        final FunCall fc = new FunCall(RUNTIME, "sin", DoubleCoder.INST, DoubleCoder.INST);
-
-        // start function call
-        fc.init(ARGS);
-        // push an arg
-        DoubleCoder.INST.push(ARGS, 3.14159265 / 2.0);
-        // make the call
-        fc.invoke(ARGS);
-        // read the return value
-        double ret = DoubleCoder.INST.pop(ARGS);
-
-        assertEquals(1.0, ret);
-    }
-
-    // Frameworks bridge the Mac OS X frameworks
-    public void testFrameworks(){
-        // First, get an instance of JObjC:
-        final JObjC JOBJC = com.apple.jobjc.JObjC.getInstance();
-
-        // It's your gateway to the frameworks.
-        final FoundationFramework FND = JOBJC.Foundation();
-        final AppKitFramework APP = JOBJC.AppKit();
-
-        // From which you can then access...
-
-        // enums, defines, constants
-        int nsmye = FND.NSMaxYEdge();
-        boolean debug = FND.NSDebugEnabled();
-
-        // structs
-        NSPoint p = FND.makeNSPoint();
-        p.setX(3);
-        assertEquals(3.0, p.x());
-
-        // C functions
-        NSPoint p2 = FND.NSMakePoint(12, 34);
-        assertEquals(12.0, p2.x());
-
-        // ... Let's create an AutoreleasePool before we go on
-        NSAutoreleasePool pool = ((NSAutoreleasePool) FND.NSAutoreleasePool().alloc()).init();
-
-        // Objective-C classes
-        NSStringClass nsc = FND.NSString();
-
-        // class-methods
-        NSString nsStringClassDescr = nsc.description();
-
-        // instances
-        NSString nsi = ((NSString) FND.NSString().alloc()).init();
-
-        // instance methods
-        NSString d = nsi.description();
-
-        // The bridge marshals some types for you, but it doesn't
-        // convert between NSString and Java String automatically.
-        // For that we use Utils.get().strings().nsString(String)
-        // and Utils.get().strings().javaString(NSString);
-
-        assertEquals("NSString", Utils.get().strings().javaString(nsStringClassDescr));
-
-        NSString format = Utils.get().strings().nsString("Foo bar %d baz");
-
-        NSString formatted = ((NSString) FND.NSString().alloc()).initWithFormat(format, 34);
-        String jformatted = Utils.get().strings().javaString(formatted);
-
-        assertEquals("Foo bar 34 baz", jformatted);
-
-        // Reveal in Finder
-//        NSString file = Utils.get().strings().nsString(
-//                "/Applications/Calculator.app/Contents/Resources/Calculator.icns");
-//        APP.NSWorkspace().sharedWorkspace()
-//           .selectFile_inFileViewerRootedAtPath(file, null);
-
-        pool.drain();
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NSClassTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NSClassTest.java
deleted file mode 100644
index cbd5105737f..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NSClassTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.foundation.FoundationFramework;
-import com.apple.jobjc.foundation.NSString;
-import com.apple.jobjc.foundation.NSStringClass;
-
-public class NSClassTest extends PooledTestCase{
-    JObjC JOBJC = JObjC.getInstance();
-    FoundationFramework FND = JOBJC.Foundation();
-
-    public void testNSClassName(){
-        NSString s = ((NSString) FND.NSString().alloc()).init();
-
-        NSString cname = s.className();
-        String jcname = Utils.get().strings().javaString(cname);
-        assertEquals("NSCFString", jcname);
-    }
-
-    public void testNSClassPop(){
-        NSString s = ((NSString) FND.NSString().alloc()).init();
-
-        NSStringClass c = s.classNSClass();
-        String jdescr = Utils.get().strings().javaString(c.description());
-        assertEquals("NSCFString", jdescr);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeBufferTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeBufferTest.java
deleted file mode 100644
index a6c93ab382e..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeBufferTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import junit.framework.TestCase;
-
-public class NativeBufferTest extends TestCase{
-    public void testSlicePtrs(){
-        JObjC.getInstance();
-
-        NativeBuffer b = new NativeBuffer(123);
-        b.position(1);
-        NativeBuffer c = b.slice();
-        assertEquals(b.bufferPtr + 1, c.bufferPtr);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeTypeTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeTypeTest.java
deleted file mode 100644
index fb352f78046..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/NativeTypeTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.internal.jobjc.generator.model.types.NType;
-import com.apple.internal.jobjc.generator.utils.NTypeMerger;
-import com.apple.internal.jobjc.generator.utils.NTypeParser;
-
-public class NativeTypeTest extends PooledTestCase{
-
-    private NType doParse(String type){
-        NType nt = NTypeParser.parseFrom(type);
-        String printed = nt.toString();
-        System.out.println("Original: " + type);
-        System.out.println("Printed.: " + printed);
-        assertEquals(type, printed);
-        return nt;
-    }
-
-    // {_NSRect=
-    //   "origin"{_NSPoint="x"f"y"f}
-    //   "size"{_NSSize="width"f"height"f}}
-    public void testStruct(){
-        doParse("{_NSRect=\"origin\"{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}");
-    }
-
-    // {IOBluetoothL2CAPChannelEvent=
-    //   "eventType"i
-    //   "u"(?=
-    //     "data"{IOBluetoothL2CAPChannelDataBlock=
-    //       "dataPtr"^v
-    //       "dataSize"I}
-    //     "writeRefCon"^v
-    //     "padding"[32C])
-    //   "status"i}
-    public void testUnion(){
-        doParse("{IOBluetoothL2CAPChannelEvent=\"eventType\"i\"u\"(?=\"data\"{IOBluetoothL2CAPChannelDataBlock=\"dataPtr\"^v\"dataSize\"I}\"writeRefCon\"^v\"padding\"[32C])\"status\"i}");
-    }
-
-    public void testUnknown(){
-        doParse("{_CFSocketContext=\"version\"i\"info\"^v\"retain\"^?\"release\"^?\"copyDescription\"^?}");
-    }
-
-    public void testEmptyStruct(){
-        doParse("{_CFSocketSignature=\"protocolFamily\"i\"socketType\"i\"protocol\"i\"address\"^{__CFData}}");
-    }
-
-    public void testCharPtr(){
-        doParse("^*");
-    }
-
-    public void doEquals(final String s){
-        assertEquals(doParse(s), doParse(s));
-    }
-
-    public void testEquals(){
-        doEquals("{_NSRect=\"origin\"{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}");
-        doEquals("{IOBluetoothL2CAPChannelEvent=\"eventType\"i\"u\"(?=\"data\"{IOBluetoothL2CAPChannelDataBlock=\"dataPtr\"^v\"dataSize\"I}\"writeRefCon\"^v\"padding\"[32C])\"status\"i}");
-        doEquals("{_CFSocketContext=\"version\"i\"info\"^v\"retain\"^?\"release\"^?\"copyDescription\"^?}");
-        doEquals("{_CFSocketSignature=\"protocolFamily\"i\"socketType\"i\"protocol\"i\"address\"^{__CFData}}");
-    }
-
-    public void testMerge(){
-        NType a = doParse("{_NSRect={_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=ff}}");
-        NType b = doParse("{_NSRect=\"origin\"{_NSPoint=ff}{_NSSize=\"width\"f\"height\"f}}");
-        NType c = NTypeMerger.inst().merge(a, b);
-        NType expected = doParse("{_NSRect=\"origin\"{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}");
-        System.out.println("Merge results:");
-        System.out.println("\ta: " + a.toString());
-        System.out.println("\tb: " + b.toString());
-        System.out.println("\tc: " + c.toString());
-        System.out.println("\tx: " + expected.toString());
-        assertEquals(expected, c);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/PooledTestCase.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/PooledTestCase.java
deleted file mode 100644
index f52c3860f47..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/PooledTestCase.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import junit.framework.TestCase;
-
-import com.apple.jobjc.foundation.FoundationFramework;
-import com.apple.jobjc.foundation.NSAutoreleasePool;
-
-public class PooledTestCase extends TestCase {
-    static{
-        System.loadLibrary("JObjC-tests");
-    }
-    NSAutoreleasePool pool;
-
-    @Override public void setUp() throws Exception {
-        FoundationFramework foundation = JObjC.getInstance().Foundation();
-        pool = foundation.NSAutoreleasePool().alloc();
-        pool.init();
-    }
-
-    @Override public void tearDown() throws Exception {
-        pool.drain();
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SELTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SELTest.java
deleted file mode 100644
index 1fd94e12ec1..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SELTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Coder.PointerCoder;
-import com.apple.jobjc.Coder.PrimitivePointerCoder;
-import com.apple.jobjc.Invoke.MsgSend;
-
-public class SELTest extends PooledTestCase {
-
-    NativeArgumentBuffer nativeBuffer;
-    JObjCRuntime runtime;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        nativeBuffer = UnsafeRuntimeAccess.getNativeBuffer();
-        runtime = nativeBuffer.runtime;
-    }
-
-    public void testGetBlackColor() throws Throwable {
-        final MacOSXFramework appKit = TestUtils.getAppKit();
-        final NSClass<? extends ID> clazz = UnsafeRuntimeAccess.getNSClass(appKit, "NSColor");
-        final MsgSend sel = UnsafeRuntimeAccess.createMsgSend(clazz, "redColor", PointerCoder.INST);
-
-        sel.init(nativeBuffer, clazz);
-        sel.invoke(nativeBuffer);
-
-        final long blackColorPtr = PrimitivePointerCoder.INST.pop(nativeBuffer);
-        String dscr = UnsafeRuntimeAccess.getDescriptionForPtr(blackColorPtr);
-
-        System.out.println("0x" + Long.toHexString(blackColorPtr) + ": " + dscr);
-        assertEquals("NSCalibratedRGBColorSpace 1 0 0 1", dscr);
-    }
-
-    public static void main(final String[] args) {
-        junit.textui.TestRunner.run(SELTest.class);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/StructTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/StructTest.java
deleted file mode 100644
index b55e731fa58..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/StructTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.io.StringWriter;
-
-import com.apple.jobjc.coreaudio.AudioBuffer;
-import com.apple.jobjc.foundation.NSPoint;
-import com.apple.jobjc.foundation.NSRect;
-
-public class StructTest extends PooledTestCase {
-    public void testSimpleStruct(){
-        AudioBuffer b = JObjC.getInstance().CoreAudio().makeAudioBuffer();
-        assertEquals(0, b.mNumberChannels());
-        assertEquals(0, b.mDataByteSize());
-        b.setMNumberChannels(1);
-        b.setMDataByteSize(3);
-        assertEquals(1, b.mNumberChannels());
-        assertEquals(3, b.mDataByteSize());
-    }
-
-    public void testNestedStruct(){
-        NSRect r = JObjC.getInstance().Foundation().makeNSRect();
-        assertTrue(0f == r.size().width());
-        r.size().setWidth(3f);
-        assertTrue(3f == r.size().width());
-        assertTrue(r.size() == r.size());
-    }
-
-    public void testSTRET(){
-        NSPoint point = JObjC.getInstance().Foundation().NSMakePoint(3, 4);
-        assertTrue(point.x() == 3);
-        assertTrue(point.y() == 4);
-
-        NSRect rect = JObjC.getInstance().Foundation().NSMakeRect(0, 1, 2, 3);
-        assertTrue(rect.origin().x() == 0);
-        assertTrue(rect.origin().y() == 1);
-        assertTrue(rect.size().width() == 2);
-        assertTrue(rect.size().height() == 3);
-    }
-
-    //
-
-    private char halfByteToHex(int b){
-        return (b >= 0x0 && b < 0xA) ? (char) ('0' + b) : (char) ('A' + (b-0xA));
-    }
-
-    private String byteToHexString(Byte b){
-        StringWriter sw = new StringWriter();
-        sw.append(halfByteToHex(b & 0xF));
-        sw.append(halfByteToHex((b & 0xF0) >> 4));
-        return sw.toString();
-    }
-
-    String print(Struct st){
-        StringWriter sw = new StringWriter();
-        st.raw.position(0);
-        sw.append(st.getClass().getSimpleName() + ":" + st.raw.limit() + " @ " + Long.toHexString(st.raw.bufferPtr) + " : ");
-        for(int i = 0; i < st.raw.limit(); i++){
-            sw.append(byteToHexString(st.raw.get()) + " ");
-            if((i+1) % 4 == 0)
-                sw.append(" ");
-        }
-        System.out.println(sw.toString().trim());
-        return sw.toString().trim();
-    }
-
-    public static void main(String[] args){
-        junit.textui.TestRunner.run(StructTest.class);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SubclassingTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SubclassingTest.java
deleted file mode 100644
index bfe91440d2b..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/SubclassingTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.Coder.IDCoder;
-import com.apple.jobjc.Coder.VoidCoder;
-import com.apple.jobjc.Invoke.MsgSend;
-import com.apple.jobjc.Invoke.MsgSendSuper;
-import com.apple.jobjc.PrimitiveCoder.DoubleCoder;
-import com.apple.jobjc.PrimitiveCoder.FloatCoder;
-import com.apple.jobjc.PrimitiveCoder.SIntCoder;
-import com.apple.jobjc.PrimitiveCoder.SLongLongCoder;
-import com.apple.jobjc.foundation.NSObject;
-import com.apple.jobjc.foundation.NSObjectClass;
-import com.apple.jobjc.foundation.NSPoint;
-import com.apple.jobjc.foundation.NSString;
-
-public class SubclassingTest extends PooledTestCase{
-    JObjCRuntime runtime;
-    NativeArgumentBuffer ctx;
-
-    @Override public void setUp() throws Exception{
-        super.setUp();
-        this.runtime = JObjCRuntime.getInstance();
-        this.ctx = runtime.getThreadLocalState();
-
-        runtime.registerUserClass(MyObject.class, MyObjectClass.class);
-    }
-
-    public void testClass(){
-        final MyObjectClass cls = new MyObjectClass(runtime);
-        assertEquals(MyObject.class.getSimpleName(), UnsafeRuntimeAccess.getClassNameFor(cls));
-    }
-
-    public void testInst(){
-        final MyObjectClass cls = new MyObjectClass(runtime);
-        final MyObject instObj = cls.alloc();
-        final MyObject retrievedObj = Subclassing.getJObjectFromIVar(UnsafeRuntimeAccess.getObjPtr(instObj));
-        assertTrue(instObj == retrievedObj);
-    }
-
-    public void testVoidVoidMethod(){
-        final MyObject instObj = new MyObjectClass(runtime).alloc();
-
-        assertEquals(0, instObj.myMethodHits);
-        MsgSend sel = new MsgSend(runtime, "myMethod", VoidCoder.INST);
-        sel.init(ctx, instObj);
-        sel.invoke(ctx);
-        assertEquals(1, instObj.myMethodHits);
-    }
-
-    public void testMsgSendSuper(){
-        final MyObjectClass cls = new MyObjectClass(runtime);
-        final MyObject obj = ((MyObject) cls.alloc()).init();
-
-        // direct descr
-
-        assertEquals("foo", Utils.get().strings().javaString(obj.description()));
-
-        // indirect (from native) descr
-        {
-            MsgSend msgSend = new MsgSend(runtime, "description", IDCoder.INST);
-            msgSend.init(ctx, obj);
-            msgSend.invoke(ctx);
-            assertEquals("foo", Utils.get().strings().javaString((NSString) IDCoder.INST.pop(ctx)));
-        }
-
-        // indirect (from native) descr
-        {
-            MsgSendSuper msgSendSuper = new MsgSendSuper(runtime, "description", IDCoder.INST);
-            msgSendSuper.init(ctx, obj, cls);
-            msgSendSuper.invoke(ctx);
-            assertEquals("foo", Utils.get().strings().javaString((NSString) IDCoder.INST.pop(ctx)));
-        }
-
-        // nso descr
-        {
-            MsgSendSuper msgSendSuper = new MsgSendSuper(runtime, "description", IDCoder.INST);
-            msgSendSuper.init(ctx, obj, JObjC.getInstance().Foundation().NSObject());
-            msgSendSuper.invoke(ctx);
-
-            final NSString nsod = (NSString) IDCoder.INST.pop(ctx);
-            String jde = Utils.get().strings().javaString(nsod);
-            assertEquals(jde.substring(0, 9), "<MyObject");
-        }
-    }
-
-    public void testPerformSelector(){
-        final MyObject instObj = new MyObjectClass(runtime).alloc();
-
-        assertEquals(0, instObj.myMethodHits);
-        instObj.performSelector(new SEL("myMethod"));
-        assertEquals(1, instObj.myMethodHits);
-
-        instObj.performSelectorOnMainThread_withObject_waitUntilDone(
-                new SEL("myMethod"), null, true);
-        assertEquals(2, instObj.myMethodHits);
-    }
-
-    public void testVoidIntMethod(){
-        final MyObject instObj = new MyObjectClass(runtime).alloc();
-
-        MsgSend sel2 = new MsgSend(runtime, "intMethod", SIntCoder.INST);
-        sel2.init(ctx, instObj);
-        sel2.invoke(ctx);
-        int ret = SIntCoder.INST.popInt(ctx);
-        assertEquals(3, ret);
-    }
-
-    public void testStructStructMethod(){
-        final MyObject instObj = new MyObjectClass(runtime).alloc();
-
-        NSPoint p = JObjC.getInstance().Foundation().NSMakePoint(3, 3);
-
-        MsgSend sel2 = new MsgSend(runtime, "doubleIt:", p.getCoder(), p.getCoder());
-        sel2.init(ctx, instObj);
-        p.getCoder().push(ctx, p);
-        sel2.invoke(ctx, p);
-
-        assertEquals(6.0, p.x());
-    }
-
-    public void testNSStringNSStringMethod(){
-        final MyObject instObj = new MyObjectClass(runtime).alloc();
-
-        final NSString orig = Utils.get().strings().nsString("foobar");
-        final String expected = "foobarfoobarfoobar";
-
-        final MsgSend sel = new MsgSend(runtime, "stringTimesThree:", IDCoder.INST, IDCoder.INST);
-        sel.init(ctx, instObj);
-        IDCoder.INST.push(ctx, orig);
-        sel.invoke(ctx);
-        NSString ret = (NSString) IDCoder.INST.pop(ctx);
-        assertEquals(expected, Utils.get().strings().javaString(ret));
-    }
-
-    public void testDoubleIntLongMethod(){
-        final MyObject instObj = new MyObjectClass(runtime).alloc();
-
-        final int arg1 = 3;
-        final long arg2 = 4;
-        final float arg3 = 5.5F;
-        final double expected = 12.5D;
-
-        final MsgSend sel = new MsgSend(runtime, "add:and:and:", DoubleCoder.INST,
-                SIntCoder.INST, SLongLongCoder.INST, FloatCoder.INST);
-        sel.init(ctx, instObj);
-        SIntCoder.INST.push(ctx, arg1);
-        SLongLongCoder.INST.push(ctx, arg2);
-        FloatCoder.INST.push(ctx, arg3);
-        sel.invoke(ctx);
-        final double ret = DoubleCoder.INST.pop(ctx);
-        assertEquals(expected, ret);
-    }
-
-    public static void main(String[] args){
-        junit.textui.TestRunner.run(SubclassingTest.class);
-    }
-}
-
-class MyObject extends NSObject{
-    public MyObject(long objPtr, JObjCRuntime runtime) {
-        super(objPtr, runtime);
-    }
-
-    public int myMethodHits = 0;
-
-    public void myMethod(){
-        myMethodHits++;
-    }
-
-    public int intMethod(){
-        return 3;
-    }
-
-    public NSString stringTimesThree(NSString nss){
-        int count = 3;
-        String jss = Utils.get().strings().javaString(nss);
-        String js2 = "";
-        while(count-- > 0)
-            js2 += jss;
-        return Utils.get().strings().nsString(js2);
-    }
-
-    public double add_and_and(int a, long b, float c){
-        return a + b + c;
-    }
-
-    public NSPoint doubleIt(NSPoint p){
-        System.out.println("Doubling NSPoint(" + p.x() + ", " + p.y() + ").");
-        p.setX(p.x() * 2);
-        p.setY(p.y() * 2);
-        return p;
-    }
-
-    @Override public NSString description(){
-        return Utils.get().strings().nsString("foo");
-    }
-}
-
-class MyObjectClass extends NSObjectClass{
-    protected MyObjectClass(String name, JObjCRuntime runtime) {
-        super(name, runtime);
-    }
-
-    public MyObjectClass(JObjCRuntime runtime){
-        this("MyObject", runtime);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/TestUtils.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/TestUtils.java
deleted file mode 100644
index 1bf18154d84..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/TestUtils.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-
-public class TestUtils {
-    static MacOSXFramework getAppKit() {
-        return UnsafeRuntimeAccess.getFramework(new String[]{"/System/Library/Frameworks/AppKit.framework/AppKit"});
-    }
-
-    static MacOSXFramework getFoundation() {
-        return UnsafeRuntimeAccess.getFramework(new String[]{"/System/Library/Frameworks/Foundation.framework/Foundation"});
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/UtilsTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/UtilsTest.java
deleted file mode 100644
index b77a82f92af..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/UtilsTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import java.util.concurrent.Callable;
-
-import com.apple.jobjc.foundation.NSString;
-
-public class UtilsTest extends PooledTestCase{
-    public void testStrings(){
-        String s = "fooBarBazDazzle";
-        NSString ns = Utils.get().strings().nsString(s);
-        String t = Utils.get().strings().javaString(ns);
-        assertEquals(s, t);
-    }
-
-    public void testThreadsPerformRunnableOnMainThread(){
-        final long testThreadId = Thread.currentThread().getId();
-        class Wrap{ public long x = testThreadId; }
-        final Wrap wrap = new Wrap();
-        assertTrue(testThreadId == wrap.x);
-
-        Utils.get().threads().performOnMainThread(new Runnable(){
-            public void run() {
-                wrap.x = Thread.currentThread().getId();
-            }
-        }, true);
-
-        assertTrue(testThreadId != wrap.x);
-    }
-
-    public void testThreadsPerformCallableOnMainThread() throws Exception{
-        final long testThreadId = Thread.currentThread().getId();
-        final long mainThreadId = Utils.get().threads().performOnMainThread(new Callable<Long>(){
-            public Long call() { return Thread.currentThread().getId(); }
-        });
-        assertTrue(testThreadId != mainThreadId);
-    }
-
-    public void testThreadsPerformCallableOnMainThreadException() throws Exception{
-        class FooException extends RuntimeException{}
-        try {
-            Utils.get().threads().performOnMainThread(new Callable<Object>(){
-                public Object call() { throw new FooException(); }
-            });
-        } catch (FooException e) {
-            return;
-        }
-        fail("Failed to catch exception.");
-    }
-
-    public static void main(String[] args){
-        junit.textui.TestRunner.run(UtilsTest.class);
-    }
-}
-
diff --git a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/VarArgsTest.java b/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/VarArgsTest.java
deleted file mode 100644
index 6d8774ece87..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/java/com/apple/jobjc/VarArgsTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.apple.jobjc;
-
-import com.apple.jobjc.foundation.FoundationFramework;
-import com.apple.jobjc.foundation.NSDictionary;
-import com.apple.jobjc.foundation.NSString;
-
-public class VarArgsTest extends PooledTestCase {
-    FoundationFramework FND = JObjC.getInstance().Foundation();
-
-    public void testNSString_initWithFormat(){
-        String expected = "1 + 0.2 = 1.2 abracadabra";
-        NSString format = Utils.get().strings().nsString("%d + %.1f = %.1f %@");
-
-        NSString abra = Utils.get().strings().nsString("abracadabra");
-
-        NSString nstr = ((NSString)FND.NSString().alloc()).initWithFormat(format, 1, 0.2, 1.2, abra);
-        String actual = Utils.get().strings().javaString(nstr);
-
-        assertEquals(expected, actual);
-    }
-
-    public void testNSDictionary(){
-        NSString v1 = Utils.get().strings().nsString("value1");
-        NSString v2 = Utils.get().strings().nsString("value2");
-        NSString k1 = Utils.get().strings().nsString("key1");
-        NSString k2 = Utils.get().strings().nsString("key2");
-
-        NSDictionary dict = ((NSDictionary)FND.NSDictionary().alloc()).initWithObjectsAndKeys(v1, k1, v2, k2, null);
-
-        NSString nsdescr = dict.description();
-        String jdescr = Utils.get().strings().javaString(nsdescr);
-
-        assertEquals("{\n    key1 = value1;\n    key2 = value2;\n}", jdescr);
-    }
-
-    public static void main(String[] args){
-        junit.textui.TestRunner.run(VarArgsTest.class);
-    }
-}
diff --git a/jdk/src/macosx/native/jobjc/src/tests/native/FunCallBench.m b/jdk/src/macosx/native/jobjc/src/tests/native/FunCallBench.m
deleted file mode 100644
index 3c5f9adcc8f..00000000000
--- a/jdk/src/macosx/native/jobjc/src/tests/native/FunCallBench.m
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-#include <JavaNativeFoundation/JavaNativeFoundation.h>
-#include <Cocoa/Cocoa.h>
-
-#include "com_apple_jobjc_BenchFunCall.h"
-#include <math.h>
-
-JNIEXPORT jdouble JNICALL Java_com_apple_jobjc_BenchFunCall_jniSin
-(JNIEnv *env, jclass clazz, jdouble x)
-{
-    return (jdouble) sin((double) x);
-}
-
-
-#include "com_apple_jobjc_BenchIDPop.h"
-
-JNIEXPORT void JNICALL Java_com_apple_jobjc_BenchIDPop_jniCFRetain
-(JNIEnv *env, jclass clazz, jlong x)
-{
-    CFRetain(jlong_to_ptr(x));
-}
-
-JNIEXPORT void JNICALL Java_com_apple_jobjc_BenchIDPop_jniCFRelease
-(JNIEnv *env, jclass clazz, jlong x)
-{
-    CFRelease(jlong_to_ptr(x));
-}
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_BenchIDPop_jniNSStringAlloc
-(JNIEnv *env, jclass clazz)
-{
-    return ptr_to_jlong([NSString alloc]);
-}
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_BenchIDPop_jniNSStringAllocAndRetain
-(JNIEnv *env, jclass clazz)
-{
-    return ptr_to_jlong(CFRetain([NSString alloc]));
-}
-
-JNIEXPORT jlong JNICALL Java_com_apple_jobjc_BenchIDPop_jniNSStringCached
-(JNIEnv *env, jclass clazz)
-{
-    static jlong str = 0;
-    if(!str) str = ptr_to_jlong([NSString alloc]);
-    return str;
-}
-- 
GitLab


From 27ba0956b68acf75940f1c5ed32adc21ea891327 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Wed, 2 Jul 2014 18:10:31 +0530
Subject: [PATCH 177/192] 8043232: Index selection of overloaded java new
 constructors

Reviewed-by: attila, hannesw, jlaskey
---
 .../dynalink/beans/AbstractJavaLinker.java    |  2 +-
 .../internal/dynalink/beans/BeansLinker.java  | 20 +++++
 .../beans/CallerSensitiveDynamicMethod.java   |  5 ++
 .../dynalink/beans/DynamicMethod.java         |  9 +++
 .../dynalink/beans/DynamicMethodLinker.java   | 23 +++++-
 .../beans/OverloadedDynamicMethod.java        | 11 +++
 .../dynalink/beans/SimpleDynamicMethod.java   | 20 +++++
 .../dynalink/beans/StaticClassLinker.java     |  8 ++
 .../internal/runtime/NativeJavaPackage.java   | 31 +++++++
 .../runtime/linker/NashornBottomLinker.java   |  3 +
 .../runtime/resources/Messages.properties     |  3 +
 nashorn/test/script/basic/JDK-8043232.js      | 80 +++++++++++++++++++
 .../test/script/basic/JDK-8043232.js.EXPECTED | 11 +++
 13 files changed, 221 insertions(+), 5 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8043232.js
 create mode 100644 nashorn/test/script/basic/JDK-8043232.js.EXPECTED

diff --git a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java
index 9e3fbe8231f..11b700bac0f 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java
@@ -290,7 +290,7 @@ abstract class AbstractJavaLinker implements GuardingDynamicLinker {
             return new CallerSensitiveDynamicMethod(m);
         }
         final Member member = (Member)m;
-        return new SimpleDynamicMethod(unreflectSafely(m), member.getDeclaringClass(), member.getName());
+        return new SimpleDynamicMethod(unreflectSafely(m), member.getDeclaringClass(), member.getName(), m instanceof Constructor);
     }
 
     /**
diff --git a/nashorn/src/jdk/internal/dynalink/beans/BeansLinker.java b/nashorn/src/jdk/internal/dynalink/beans/BeansLinker.java
index b1862de0f0c..439c5a6519f 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/BeansLinker.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/BeansLinker.java
@@ -168,6 +168,26 @@ public class BeansLinker implements GuardingDynamicLinker {
         return obj instanceof DynamicMethod;
     }
 
+    /**
+     * Returns true if the object is a Dynalink Java constructor.
+     *
+     * @param obj the object we want to test for being a constructor
+     * @return true if it is a constructor, false otherwise.
+     */
+    public static boolean isDynamicConstructor(final Object obj) {
+        return obj instanceof DynamicMethod && ((DynamicMethod)obj).isConstructor();
+    }
+
+    /**
+     * Return the dynamic method of constructor of the given class and the given signature.
+     * @param clazz the class
+     * @param signature full signature of the constructor
+     * @return DynamicMethod for the constructor
+     */
+    public static Object getConstructorMethod(final Class<?> clazz, final String signature) {
+        return StaticClassLinker.getConstructorMethod(clazz, signature);
+    }
+
     /**
      * Returns a collection of names of all readable instance properties of a class.
      * @param clazz the class
diff --git a/nashorn/src/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java b/nashorn/src/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java
index 5fceb1a7af0..2896732e3f7 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java
@@ -155,4 +155,9 @@ class CallerSensitiveDynamicMethod extends SingleDynamicMethod {
         return StaticClassIntrospector.editConstructorMethodHandle(Lookup.unreflectConstructor(lookup,
                 (Constructor<?>)target));
     }
+
+    @Override
+    boolean isConstructor() {
+        return target instanceof Constructor;
+    }
 }
diff --git a/nashorn/src/jdk/internal/dynalink/beans/DynamicMethod.java b/nashorn/src/jdk/internal/dynalink/beans/DynamicMethod.java
index e72ca6dce54..7b7a4d80130 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/DynamicMethod.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/DynamicMethod.java
@@ -147,4 +147,13 @@ abstract class DynamicMethod {
     public String toString() {
         return "[" + getClass().getName() + " " + getName() + "]";
     }
+
+    /**
+     * True if this method happens to be a constructor method.
+     *
+     * @return true if this represents a constructor.
+     */
+    boolean isConstructor() {
+        return false;
+    }
 }
diff --git a/nashorn/src/jdk/internal/dynalink/beans/DynamicMethodLinker.java b/nashorn/src/jdk/internal/dynalink/beans/DynamicMethodLinker.java
index 08f2a2581c1..7067c2ce236 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/DynamicMethodLinker.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/DynamicMethodLinker.java
@@ -114,15 +114,30 @@ class DynamicMethodLinker implements TypeBasedGuardingDynamicLinker {
             return null;
         }
         final String operator = desc.getNameToken(CallSiteDescriptor.OPERATOR);
-        if(operator == "call") {
-            final MethodHandle invocation = ((DynamicMethod)receiver).getInvocation(
+        final DynamicMethod dynMethod = (DynamicMethod)receiver;
+        final boolean constructor = dynMethod.isConstructor();
+        final MethodHandle invocation;
+
+        if (operator == "call" && !constructor) {
+            invocation = dynMethod.getInvocation(
                     CallSiteDescriptorFactory.dropParameterTypes(desc, 0, 1), linkerServices);
-            if(invocation == null) {
+        } else if (operator == "new" && constructor) {
+            final MethodHandle ctorInvocation = dynMethod.getInvocation(desc, linkerServices);
+            if(ctorInvocation == null) {
                 return null;
             }
+
+            // Insert null for StaticClass parameter
+            invocation = MethodHandles.insertArguments(ctorInvocation, 0, (Object)null);
+        } else {
+            return null;
+        }
+
+        if (invocation != null) {
             return new GuardedInvocation(MethodHandles.dropArguments(invocation, 0,
-                    desc.getMethodType().parameterType(0)), Guards.getIdentityGuard(receiver));
+                desc.getMethodType().parameterType(0)), Guards.getIdentityGuard(receiver));
         }
+
         return null;
     }
 }
diff --git a/nashorn/src/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java b/nashorn/src/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java
index 7dc21a2978b..83156e3b136 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java
@@ -236,6 +236,12 @@ class OverloadedDynamicMethod extends DynamicMethod {
         return false;
     }
 
+    @Override
+    public boolean isConstructor() {
+        assert !methods.isEmpty();
+        return methods.getFirst().isConstructor();
+    }
+
     ClassLoader getClassLoader() {
         return classLoader;
     }
@@ -303,6 +309,11 @@ class OverloadedDynamicMethod extends DynamicMethod {
      * @param method a method to add
      */
     public void addMethod(final SingleDynamicMethod method) {
+        assert constructorFlagConsistent(method);
         methods.add(method);
     }
+
+    private boolean constructorFlagConsistent(final SingleDynamicMethod method) {
+        return methods.isEmpty()? true : (methods.getFirst().isConstructor() == method.isConstructor());
+    }
 }
diff --git a/nashorn/src/jdk/internal/dynalink/beans/SimpleDynamicMethod.java b/nashorn/src/jdk/internal/dynalink/beans/SimpleDynamicMethod.java
index 2965cb4e401..f4a8b0a0b5a 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/SimpleDynamicMethod.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/SimpleDynamicMethod.java
@@ -98,6 +98,7 @@ import java.lang.invoke.MethodType;
  */
 class SimpleDynamicMethod extends SingleDynamicMethod {
     private final MethodHandle target;
+    private final boolean constructor;
 
     /**
      * Creates a new simple dynamic method, with a name constructed from the class name, method name, and handle
@@ -108,8 +109,22 @@ class SimpleDynamicMethod extends SingleDynamicMethod {
      * @param name the simple name of the method
      */
     SimpleDynamicMethod(final MethodHandle target, final Class<?> clazz, final String name) {
+        this(target, clazz, name, false);
+    }
+
+    /**
+     * Creates a new simple dynamic method, with a name constructed from the class name, method name, and handle
+     * signature.
+     *
+     * @param target the target method handle
+     * @param clazz the class declaring the method
+     * @param name the simple name of the method
+     * @param constructor does this represent a constructor?
+     */
+    SimpleDynamicMethod(final MethodHandle target, final Class<?> clazz, final String name, final boolean constructor) {
         super(getName(target, clazz, name));
         this.target = target;
+        this.constructor = constructor;
     }
 
     private static String getName(final MethodHandle target, final Class<?> clazz, final String name) {
@@ -130,4 +145,9 @@ class SimpleDynamicMethod extends SingleDynamicMethod {
     MethodHandle getTarget(final Lookup lookup) {
         return target;
     }
+
+    @Override
+    boolean isConstructor() {
+        return constructor;
+    }
 }
diff --git a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java
index 41955bb9e39..f7ffc2abd2f 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java
@@ -160,6 +160,14 @@ class StaticClassLinker implements TypeBasedGuardingDynamicLinker {
             }
             return null;
         }
+
+        DynamicMethod getConstructorMethod(final String signature) {
+            return constructor.getMethodForExactParamTypes(signature);
+        }
+    }
+
+    static Object getConstructorMethod(final Class<?> clazz, final String signature) {
+        return linkers.get(clazz).getConstructorMethod(signature);
     }
 
     static Collection<String> getReadableStaticPropertyNames(final Class<?> clazz) {
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java
index 7f7f5970371..349b8c4bd02 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java
@@ -26,11 +26,13 @@
 package jdk.nashorn.internal.runtime;
 
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid;
+import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.internal.dynalink.beans.BeansLinker;
 import jdk.internal.dynalink.beans.StaticClass;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
@@ -232,6 +234,35 @@ public final class NativeJavaPackage extends ScriptObject {
             //ignored
         }
 
+        // Check for explicit constructor signature use
+        // Example: new (java.awt["Color(int, int,int)"])(2, 3, 4);
+        final int openBrace = propertyName.indexOf('(');
+        final int closeBrace = propertyName.lastIndexOf(')');
+        if (openBrace != -1 || closeBrace != -1) {
+            final int lastChar = propertyName.length() - 1;
+            if (openBrace == -1 || closeBrace != lastChar) {
+                throw typeError("improper.constructor.signature", propertyName);
+            }
+
+            // get the class name and try to load it
+            final String className = name + "." + propertyName.substring(0, openBrace);
+            try {
+                javaClass = context.findClass(className);
+            } catch (final NoClassDefFoundError | ClassNotFoundException e) {
+                throw typeError(e, "no.such.java.class", className);
+            }
+
+            // try to find a matching constructor
+            final Object constructor = BeansLinker.getConstructorMethod(
+                    javaClass, propertyName.substring(openBrace + 1, lastChar));
+            if (constructor != null) {
+                set(propertyName, constructor, false);
+                return constructor;
+            }
+            // we didn't find a matching constructor!
+            throw typeError("no.such.java.constructor", propertyName);
+        }
+
         final Object propertyValue;
         if (javaClass == null) {
             propertyValue = new NativeJavaPackage(fullName, getProto());
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
index 46d818d8668..f859f7bb631 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
@@ -111,6 +111,9 @@ final class NashornBottomLinker implements GuardingDynamicLinker, GuardingTypeCo
                         MH.dropArguments(desc.getLookup().unreflect(m), 1, callType.parameterType(1)),
                         Guards.getInstanceOfGuard(m.getDeclaringClass())), linkerServices, desc);
             }
+            if(BeansLinker.isDynamicConstructor(self)) {
+                throw typeError("constructor.requires.new", ScriptRuntime.safeToString(self));
+            }
             if(BeansLinker.isDynamicMethod(self)) {
                 throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
             }
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
index 53cb4a68290..3a486da4b86 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -92,6 +92,9 @@ type.error.cant.delete.property.of.undefined=Cannot delete property "{0}" of und
 type.error.property.has.no.setter=Cannot set property "{0}" of {1} that has only a getter
 type.error.cant.set.proto.to.non.object=Cannot set Object {0}'s __proto__ to be a non-object like {1}
 type.error.no.such.function={1} has no such function "{0}"
+type.error.no.such.java.class=No such Java class: {0}
+type.error.no.such.java.constructor=No such Java constructor: {0}
+type.error.improper.constructor.signature=Java constructor signature invalid: {0}
 type.error.cant.get.property=Cannot get property "{0}" of {1}
 type.error.cant.set.property=Cannot set property "{0}" of {1}
 type.error.cant.delete.property=Cannot delete property "{0}" of {1}
diff --git a/nashorn/test/script/basic/JDK-8043232.js b/nashorn/test/script/basic/JDK-8043232.js
new file mode 100644
index 00000000000..220ac1eca87
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8043232.js
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8043232: Index selection of overloaded java new constructors
+ *
+ * @test
+ * @run
+ */
+
+// call explicit constructor
+print(new (java.awt["Color(int,int,int)"])(255,0,255));
+// print the constructor itself
+print(java.awt["Color(int,int,int)"]);
+
+// store constructor to call later
+var Color = java.awt["Color(int,int,int)"];
+// call stored constructor
+print(new Color(33, 233, 2))
+
+// check if default constructor works
+var obj = new (java.lang["Object()"])();
+if (obj.class != java.lang.Object.class) {
+    fail("obj is a java.lang.Object");
+}
+
+// expected failure cases.
+function checkIt(func) {
+    try {
+        func();
+        throw new Error("should have thrown TypeError");
+    } catch(e) {
+        if (! (e instanceof TypeError)) {
+            fail("Expected TypeError, got " + e);
+        }
+        print(e);
+    }
+}
+
+// constructor of a non-existent class
+checkIt(function() new (java.lang["NonExistent(String)"])());  
+ 
+// non-existent constructor of an existing class
+checkIt(function() new (java.lang["Object(String)"])());
+
+// garbage signature string
+checkIt(function() new (java.lang["Object()xxxxx"])());
+checkIt(function() new (java.lang["Object("])());
+checkIt(function() new (java.lang["Object)"])());
+
+var System = Java.type("java.lang.System");
+// try to do 'new' on static method
+checkIt(function() new (System.getProperty)("java.version"));
+
+// try to do 'new' on an instance method
+var println = System.out.println;
+checkIt(function() new println("hello"));
+
+// call constructor as normal method (without 'new')
+checkIt(function() Color());
diff --git a/nashorn/test/script/basic/JDK-8043232.js.EXPECTED b/nashorn/test/script/basic/JDK-8043232.js.EXPECTED
new file mode 100644
index 00000000000..af68416fa0a
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8043232.js.EXPECTED
@@ -0,0 +1,11 @@
+java.awt.Color[r=255,g=0,b=255]
+[jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)]
+java.awt.Color[r=33,g=233,b=2]
+TypeError: No such Java class: java.lang.NonExistent
+TypeError: No such Java constructor: Object(String)
+TypeError: Java constructor signature invalid: Object()xxxxx
+TypeError: Java constructor signature invalid: Object(
+TypeError: Java constructor signature invalid: Object)
+TypeError: Java method [jdk.internal.dynalink.beans.OverloadedDynamicMethod java.lang.System.getProperty] cant be used as a constructor.
+TypeError: Java method [jdk.internal.dynalink.beans.OverloadedDynamicMethod java.io.PrintStream.println] cant be used as a constructor.
+TypeError: Constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)] requires new.
-- 
GitLab


From b6e211ab648a4699955277cf23de21ec11eccb12 Mon Sep 17 00:00:00 2001
From: Martin Buchholz <martin@openjdk.org>
Date: Wed, 2 Jul 2014 10:21:23 -0700
Subject: [PATCH 178/192] 8048990: ZipFile.entries() can't handle empty zip
 entry names

GetEntryBytes should never return null pointer for entry names

Reviewed-by: sherman
---
 jdk/src/share/native/java/util/zip/ZipFile.c  |  4 +-
 .../java/util/zip/ZipFile/Assortment.java     | 98 ++++++++++++++-----
 2 files changed, 76 insertions(+), 26 deletions(-)

diff --git a/jdk/src/share/native/java/util/zip/ZipFile.c b/jdk/src/share/native/java/util/zip/ZipFile.c
index 5fd4936a803..4604d8ff229 100644
--- a/jdk/src/share/native/java/util/zip/ZipFile.c
+++ b/jdk/src/share/native/java/util/zip/ZipFile.c
@@ -272,7 +272,9 @@ Java_java_util_zip_ZipFile_getEntryBytes(JNIEnv *env,
     case java_util_zip_ZipFile_JZENTRY_NAME:
         if (ze->name != 0) {
             len = (int)strlen(ze->name);
-            if (len == 0 || (jba = (*env)->NewByteArray(env, len)) == NULL)
+            // Unlike for extra and comment, we never return null for
+            // an (extremely rarely seen) empty name
+            if ((jba = (*env)->NewByteArray(env, len)) == NULL)
                 break;
             (*env)->SetByteArrayRegion(env, jba, 0, len, (jbyte *)ze->name);
         }
diff --git a/jdk/test/java/util/zip/ZipFile/Assortment.java b/jdk/test/java/util/zip/ZipFile/Assortment.java
index d5e9d1f933d..b890b31ff1a 100644
--- a/jdk/test/java/util/zip/ZipFile/Assortment.java
+++ b/jdk/test/java/util/zip/ZipFile/Assortment.java
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4770745 6234507 6303183
+ * @bug 4770745 6234507 6303183 8048990
  * @summary test a variety of zip file entries
  * @author Martin Buchholz
  */
@@ -137,8 +137,11 @@ public class Assortment {
             return fdata;
         }
 
-        void verify(ZipFile f) throws Exception {
-            ZipEntry e = f.getEntry(name);
+        void verify(ZipFile f, ZipEntry e) throws Exception {
+            verify(e, getData(f, e));
+        }
+
+        void verify(ZipEntry e, byte[] eData) throws Exception {
             byte[] data  = (this.data == null) ? new byte[]{} : this.data;
             byte[] extra = (this.extra != null && this.extra.length == 0) ?
                 null : this.extra;
@@ -148,21 +151,23 @@ public class Assortment {
                    && (e.getComment() == null))
                   || comment.equals(e.getComment()));
             check(equalsExtraData(extra, e.getExtra()));
-            check(Arrays.equals(data, getData(f, e)));
+            check(Arrays.equals(data, eData));
             check(e.getSize() == data.length);
             check((method == ZipEntry.DEFLATED) ||
                   (e.getCompressedSize() == data.length));
         }
 
-        void verify(JarInputStream jis) throws Exception {
-            // JarInputStream "automatically" reads the manifest
-            if (name.equals("meta-iNf/ManIfEst.Mf"))
-                return;
-            ZipEntry e = jis.getNextEntry();
+        void verify(ZipFile f) throws Exception {
+            ZipEntry e = f.getEntry(name);
+            verify(e, getData(f, e));
+        }
+
+        void verifyZipInputStream(ZipInputStream s) throws Exception {
+            ZipEntry e = s.getNextEntry();
 
             byte[] data = (this.data == null) ? new byte[]{} : this.data;
             byte[] otherData = new byte[data.length];
-            jis.read(otherData);
+            s.read(otherData);
             check(Arrays.equals(data, otherData));
 
             byte[] extra = (this.extra != null && this.extra.length == 0) ?
@@ -173,7 +178,14 @@ public class Assortment {
             check(e.getSize() == -1 || e.getSize() == data.length);
             check((method == ZipEntry.DEFLATED) ||
                   (e.getCompressedSize() == data.length));
+        }
+
+        void verifyJarInputStream(JarInputStream s) throws Exception {
+            // JarInputStream "automatically" reads the manifest
+            if (name.equals("meta-iNf/ManIfEst.Mf"))
+                return;
 
+            verifyZipInputStream(s);
         }
     }
 
@@ -225,7 +237,7 @@ public class Assortment {
                               "Can manifests have comments??"));
 
         // The emptiest possible entry
-        entries.add(new Entry("", ZipEntry.STORED,   null, null, ""));
+        entries.add(new Entry("", ZipEntry.STORED, null, null, ""));
 
         for (String name : names)
             for (int method : methods)
@@ -246,30 +258,66 @@ public class Assortment {
         }
 
         //----------------------------------------------------------------
-        // Verify zip file contents using JarFile class
+        // Verify zip file contents using ZipFile.getEntry()
+        //----------------------------------------------------------------
+        try (ZipFile f = new ZipFile(zipName)) {
+            for (Entry e : entries)
+                e.verify(f);
+        }
+
+        //----------------------------------------------------------------
+        // Verify zip file contents using JarFile.getEntry()
         //----------------------------------------------------------------
-        JarFile f = new JarFile(zipName);
+        try (JarFile f = new JarFile(zipName)) {
+            check(f.getManifest() != null);
+            for (Entry e : entries)
+                e.verify(f);
+        }
 
-        check(f.getManifest() != null);
+        //----------------------------------------------------------------
+        // Verify zip file contents using ZipFile.entries()
+        //----------------------------------------------------------------
+        try (ZipFile f = new ZipFile(zipName)) {
+            Enumeration<? extends ZipEntry> en = f.entries();
+            for (Entry e : entries)
+                e.verify(f, en.nextElement());
 
-        for (Entry e : entries)
-            e.verify(f);
+            check(!en.hasMoreElements());
+        }
 
-        f.close();
+        //----------------------------------------------------------------
+        // Verify zip file contents using JarFile.entries()
+        //----------------------------------------------------------------
+        try (JarFile f = new JarFile(zipName)) {
+            Enumeration<? extends ZipEntry> en = f.entries();
+            for (Entry e : entries)
+                e.verify(f, en.nextElement());
+
+            check(!en.hasMoreElements());
+        }
 
         //----------------------------------------------------------------
-        // Verify zip file contents using JarInputStream class
+        // Verify zip file contents using ZipInputStream class
         //----------------------------------------------------------------
-        JarInputStream jis = new JarInputStream(
-            new FileInputStream(zipName));
+        try (FileInputStream fis = new FileInputStream(zipName);
+             ZipInputStream s = new ZipInputStream(fis)) {
 
-        // JarInputStream "automatically" reads the manifest
-        check(jis.getManifest() != null);
+            for (Entry e : entries)
+                e.verifyZipInputStream(s);
+        }
+
+        //----------------------------------------------------------------
+        // Verify zip file contents using JarInputStream class
+        //----------------------------------------------------------------
+        try (FileInputStream fis = new FileInputStream(zipName);
+             JarInputStream s = new JarInputStream(fis)) {
 
-        for (Entry e : entries)
-            e.verify(jis);
+            // JarInputStream "automatically" reads the manifest
+            check(s.getManifest() != null);
 
-        jis.close();
+            for (Entry e : entries)
+                e.verifyJarInputStream(s);
+        }
 
 //      String cmd = "unzip -t " + zipName.getPath() + " >/dev/tty";
 //      new ProcessBuilder(new String[]{"/bin/sh", "-c", cmd}).start().waitFor();
-- 
GitLab


From 179fd7be27093fb857bd5918a6ce2b79ff501a66 Mon Sep 17 00:00:00 2001
From: Jeremy Manson <jmanson@openjdk.org>
Date: Wed, 2 Jul 2014 14:14:17 -0700
Subject: [PATCH 179/192] 8048840: File.createTempFile has uninformative
 failure message

Reviewed-by: martin, alanb
---
 jdk/src/share/classes/java/io/File.java | 6 ++++--
 jdk/test/java/io/File/NulFile.java      | 5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/jdk/src/share/classes/java/io/File.java b/jdk/src/share/classes/java/io/File.java
index f0528c73754..306cc84097d 100644
--- a/jdk/src/share/classes/java/io/File.java
+++ b/jdk/src/share/classes/java/io/File.java
@@ -1997,8 +1997,10 @@ public class File
                                       File directory)
         throws IOException
     {
-        if (prefix.length() < 3)
-            throw new IllegalArgumentException("Prefix string too short");
+        if (prefix.length() < 3) {
+            throw new IllegalArgumentException("Prefix string \"" + prefix +
+                "\" too short: length must be at least 3");
+        }
         if (suffix == null)
             suffix = ".tmp";
 
diff --git a/jdk/test/java/io/File/NulFile.java b/jdk/test/java/io/File/NulFile.java
index b61b1d875cf..0b68efafd9d 100644
--- a/jdk/test/java/io/File/NulFile.java
+++ b/jdk/test/java/io/File/NulFile.java
@@ -602,7 +602,10 @@ public class NulFile {
             try {
                 File.createTempFile(prefix, suffix, directory);
             } catch (IllegalArgumentException ex) {
-                if ("Prefix string too short".equals(ex.getMessage()))
+                String actual = ex.getMessage();
+                String expected = "Prefix string \"" + prefix +
+                    "\" too short: length must be at least 3";
+                if (actual != null && actual.equals(expected))
                     exceptionThrown = true;
             } catch (IOException ioe) {
                 System.err.println("IOException happens in testCreateTempFile");
-- 
GitLab


From 913551730c65a84fb9716d3b840efcb3b56b4f16 Mon Sep 17 00:00:00 2001
From: Paul Sandoz <psandoz@openjdk.org>
Date: Thu, 3 Jul 2014 09:30:25 +0200
Subject: [PATCH 180/192] 8043327: Collectors.toMap studentToGPA example uses
 Functions.identity() 8043328: Typo in documentation of package
 java.util.stream

Reviewed-by: alanb, lancea
---
 jdk/src/share/classes/java/util/stream/Collectors.java   | 8 ++++----
 jdk/src/share/classes/java/util/stream/package-info.java | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/jdk/src/share/classes/java/util/stream/Collectors.java b/jdk/src/share/classes/java/util/stream/Collectors.java
index 70d7f286d8d..6f68322119d 100644
--- a/jdk/src/share/classes/java/util/stream/Collectors.java
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java
@@ -1220,7 +1220,7 @@ public final class Collectors {
      * students to their grade point average:
      * <pre>{@code
      *     Map<Student, Double> studentToGPA
-     *         students.stream().collect(toMap(Functions.identity(),
+     *         students.stream().collect(toMap(Function.identity(),
      *                                         student -> computeGPA(student)));
      * }</pre>
      * And the following produces a {@code Map} mapping a unique identifier to
@@ -1228,7 +1228,7 @@ public final class Collectors {
      * <pre>{@code
      *     Map<String, Student> studentIdToStudent
      *         students.stream().collect(toMap(Student::getId,
-     *                                         Functions.identity());
+     *                                         Function.identity());
      * }</pre>
      *
      * @implNote
@@ -1390,7 +1390,7 @@ public final class Collectors {
      * students to their grade point average:
      * <pre>{@code
      *     Map<Student, Double> studentToGPA
-     *         students.stream().collect(toMap(Functions.identity(),
+     *         students.stream().collect(toMap(Function.identity(),
      *                                         student -> computeGPA(student)));
      * }</pre>
      * And the following produces a {@code Map} mapping a unique identifier to
@@ -1398,7 +1398,7 @@ public final class Collectors {
      * <pre>{@code
      *     Map<String, Student> studentIdToStudent
      *         students.stream().collect(toConcurrentMap(Student::getId,
-     *                                                   Functions.identity());
+     *                                                   Function.identity());
      * }</pre>
      *
      * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
diff --git a/jdk/src/share/classes/java/util/stream/package-info.java b/jdk/src/share/classes/java/util/stream/package-info.java
index 016c86dd382..2353870425e 100644
--- a/jdk/src/share/classes/java/util/stream/package-info.java
+++ b/jdk/src/share/classes/java/util/stream/package-info.java
@@ -468,7 +468,7 @@
  * <pre>{@code
  *     int sumOfWeights = widgets.stream()
  *                               .reduce(0,
- *                                       (sum, b) -> sum + b.getWeight())
+ *                                       (sum, b) -> sum + b.getWeight(),
  *                                       Integer::sum);
  * }</pre>
  * though the explicit map-reduce form is more readable and therefore should
-- 
GitLab


From 7620f470688aef4eb962246ab4c78b6189cc7f28 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 3 Jul 2014 11:18:10 +0200
Subject: [PATCH 181/192] 8049222: JSType class exposes public mutable arrays

Reviewed-by: hannesw, sundar
---
 .../internal/codegen/ObjectClassGenerator.java | 10 +++++-----
 .../jdk/nashorn/internal/runtime/JSType.java   | 18 ++++++++++--------
 .../internal/runtime/UserAccessorProperty.java |  2 +-
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
index 1c0ee63703e..815ce271bf6 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
@@ -550,7 +550,7 @@ public final class ObjectClassGenerator implements Loggable {
     }
 
     //no optimism here. we do unconditional conversion to types
-    private static MethodHandle createGetterInner(final Class<?> forType, final Class<?> type, final MethodHandle primitiveGetter, final MethodHandle objectGetter, final MethodHandle[] converters, final int programPoint) {
+    private static MethodHandle createGetterInner(final Class<?> forType, final Class<?> type, final MethodHandle primitiveGetter, final MethodHandle objectGetter, final List<MethodHandle> converters, final int programPoint) {
         final int fti = forType == null ? TYPE_UNDEFINED_INDEX : getAccessorTypeIndex(forType);
         final int ti  = getAccessorTypeIndex(type);
         //this means fail if forType != type
@@ -564,7 +564,7 @@ public final class ObjectClassGenerator implements Loggable {
             if (isOptimistic) {
                 //return undefined if asking for object. otherwise throw UnwarrantedOptimismException
                 if (ti == TYPE_OBJECT_INDEX) {
-                    return MH.dropArguments(GET_UNDEFINED[TYPE_OBJECT_INDEX], 0, Object.class);
+                    return MH.dropArguments(GET_UNDEFINED.get(TYPE_OBJECT_INDEX), 0, Object.class);
                 }
                 //throw exception
                 return MH.asType(
@@ -578,7 +578,7 @@ public final class ObjectClassGenerator implements Loggable {
                     getter.type().changeReturnType(type));
             }
             //return an undefined and coerce it to the appropriate type
-            return MH.dropArguments(GET_UNDEFINED[ti], 0, Object.class);
+            return MH.dropArguments(GET_UNDEFINED.get(ti), 0, Object.class);
         }
 
         assert forType != null;
@@ -604,7 +604,7 @@ public final class ObjectClassGenerator implements Loggable {
                     return MH.filterReturnValue(
                             objectGetter,
                             MH.insertArguments(
-                                    converters[ti],
+                                    converters.get(ti),
                                     1,
                                     programPoint));
                 }
@@ -631,7 +631,7 @@ public final class ObjectClassGenerator implements Loggable {
         final MethodHandle tgetter = getterForType(forType, primitiveGetter, objectGetter);
         if (fti == TYPE_OBJECT_INDEX) {
             if (fti != ti) {
-                return MH.filterReturnValue(tgetter, CONVERT_OBJECT[ti]);
+                return MH.filterReturnValue(tgetter, CONVERT_OBJECT.get(ti));
             }
             return tgetter;
         }
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
index 388761c4655..350c502a4f9 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
@@ -220,23 +220,23 @@ public enum JSType {
     public static final int TYPE_OBJECT_INDEX = 3; //getAccessorTypeIndex(Object.class);
 
     /** object conversion quickies with JS semantics - used for return value and parameter filter */
-    public static final MethodHandle[] CONVERT_OBJECT = {
+    public static final List<MethodHandle> CONVERT_OBJECT = toUnmodifiableList(
         JSType.TO_INT32.methodHandle(),
         JSType.TO_UINT32.methodHandle(),
         JSType.TO_NUMBER.methodHandle(),
         null
-    };
+    );
 
     /**
      * object conversion quickies with JS semantics - used for return value and parameter filter, optimistic
      * throws exception upon incompatible type (asking for a narrower one than the storage)
      */
-    public static final MethodHandle[] CONVERT_OBJECT_OPTIMISTIC = {
+    public static final List<MethodHandle> CONVERT_OBJECT_OPTIMISTIC = toUnmodifiableList(
         JSType.TO_INT32_OPTIMISTIC.methodHandle(),
         JSType.TO_LONG_OPTIMISTIC.methodHandle(),
         JSType.TO_NUMBER_OPTIMISTIC.methodHandle(),
         null
-    };
+    );
 
     /** The value of Undefined cast to an int32 */
     public static final int    UNDEFINED_INT    = 0;
@@ -249,12 +249,12 @@ public enum JSType {
      * Method handles for getters that return undefined coerced
      * to the appropriate type
      */
-    public static final MethodHandle[] GET_UNDEFINED = new MethodHandle[] {
+    public static final List<MethodHandle> GET_UNDEFINED = toUnmodifiableList(
         MH.constant(int.class, UNDEFINED_INT),
         MH.constant(long.class, UNDEFINED_LONG),
         MH.constant(double.class, UNDEFINED_DOUBLE),
-        MH.constant(Object.class, Undefined.getUndefined()),
-    };
+        MH.constant(Object.class, Undefined.getUndefined())
+    );
 
     private static final double INT32_LIMIT = 4294967296.0;
 
@@ -1820,5 +1820,7 @@ public enum JSType {
         }
     }
 
-
+    private static final List<MethodHandle> toUnmodifiableList(final MethodHandle... methodHandles) {
+        return Collections.unmodifiableList(Arrays.asList(methodHandles));
+    }
 }
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
index 0a29d8911a6..ff770ed543c 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
@@ -246,7 +246,7 @@ public final class UserAccessorProperty extends SpillProperty {
                             MH.filterReturnValue(
                                     getter,
                                     MH.insertArguments(
-                                            CONVERT_OBJECT_OPTIMISTIC[getAccessorTypeIndex(type)],
+                                            CONVERT_OBJECT_OPTIMISTIC.get(getAccessorTypeIndex(type)),
                                             1,
                                             programPoint)),
                                     getter.type().changeReturnType(type));
-- 
GitLab


From 1377f6380eb7c5532c68abd12e79cafbb1129d3a Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 3 Jul 2014 11:18:26 +0200
Subject: [PATCH 182/192] 8049223: RewriteException class exposes public
 mutable arrays

Reviewed-by: hannesw, sundar
---
 .../src/jdk/nashorn/internal/runtime/RewriteException.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nashorn/src/jdk/nashorn/internal/runtime/RewriteException.java b/nashorn/src/jdk/nashorn/internal/runtime/RewriteException.java
index 1d4ac2922bc..37d65f2f5e5 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/RewriteException.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RewriteException.java
@@ -331,7 +331,7 @@ public final class RewriteException extends Exception {
      * @return bytecode slot contents.
      */
     public Object[] getByteCodeSlots() {
-        return byteCodeSlots;
+        return byteCodeSlots == null ? null : byteCodeSlots.clone();
     }
 
     /**
@@ -339,7 +339,7 @@ public final class RewriteException extends Exception {
      * function (a rest-of triggering a rest-of triggering a...)
      */
     public int[] getPreviousContinuationEntryPoints() {
-        return previousContinuationEntryPoints;
+        return previousContinuationEntryPoints == null ? null : previousContinuationEntryPoints.clone();
     }
 
     /**
@@ -388,7 +388,7 @@ public final class RewriteException extends Exception {
 
         //slot contents
         if (!isShort) {
-            final Object[] slots = getByteCodeSlots();
+            final Object[] slots = byteCodeSlots;
             if (slots != null) {
                 sb.append("slots=").
                     append(Arrays.asList(slots)).
-- 
GitLab


From c6dda4ed205fdc51caf230e2f155313ba30eab84 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 3 Jul 2014 11:18:38 +0200
Subject: [PATCH 183/192] 8049225: Source class exposes public mutable array

Reviewed-by: hannesw, sundar
---
 .../codegen/OptimisticTypesPersistence.java   |  4 +--
 .../nashorn/internal/runtime/CodeStore.java   | 10 ++-----
 .../jdk/nashorn/internal/runtime/Source.java  | 26 ++++++++++++-------
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
index b90fa026ddb..986795f0604 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
@@ -78,7 +78,7 @@ public final class OptimisticTypesPersistence {
         }
         final StringBuilder b = new StringBuilder(48);
         // Base64-encode the digest of the source, and append the function id.
-        b.append(Base64.getUrlEncoder().encodeToString(source.getDigest())).append('-').append(functionId);
+        b.append(source.getDigest()).append('-').append(functionId);
         // Finally, if this is a parameter-type specialized version of the function, add the parameter types to the file
         // name.
         if(paramTypes != null && paramTypes.length > 0) {
@@ -286,7 +286,7 @@ public final class OptimisticTypesPersistence {
                 for(;;) {
                     final int l = in.read(buf);
                     if(l == -1) {
-                        return Base64.getUrlEncoder().encodeToString(digest.digest());
+                        return Base64.getUrlEncoder().withoutPadding().encodeToString(digest.digest());
                     }
                     digest.update(buf, 0, l);
                 }
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java b/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java
index d32a8c92c36..2f67ce5946b 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/CodeStore.java
@@ -37,7 +37,6 @@ import java.io.Serializable;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import java.util.Base64;
 import java.util.Map;
 
 /**
@@ -48,9 +47,6 @@ final class CodeStore {
     private final File dir;
     private final int minSize;
 
-    // Message digest to file name encoder
-    private final static Base64.Encoder BASE64 = Base64.getUrlEncoder().withoutPadding();
-
     // Default minimum size for storing a compiled script class
     private final static int DEFAULT_MIN_SIZE = 1000;
 
@@ -108,8 +104,7 @@ final class CodeStore {
             return null;
         }
 
-        final String digest = BASE64.encodeToString(source.getDigest());
-        final File file = new File(dir, digest);
+        final File file = new File(dir, source.getDigest());
 
         try {
             return AccessController.doPrivileged(new PrivilegedExceptionAction<CompiledScript>() {
@@ -157,8 +152,7 @@ final class CodeStore {
             }
         }
 
-        final String digest = BASE64.encodeToString(source.getDigest());
-        final File file = new File(dir, digest);
+        final File file = new File(dir, source.getDigest());
         final CompiledScript script = new CompiledScript(source, mainClassName, classBytes, constants);
 
         try {
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Source.java b/nashorn/src/jdk/nashorn/internal/runtime/Source.java
index b5829eee735..2892b71852c 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java
@@ -45,6 +45,7 @@ import java.nio.file.Paths;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.Objects;
 import java.util.WeakHashMap;
 import jdk.nashorn.api.scripting.URLReader;
@@ -52,7 +53,6 @@ import jdk.nashorn.internal.parser.Token;
 import jdk.nashorn.internal.runtime.logging.DebugLogger;
 import jdk.nashorn.internal.runtime.logging.Loggable;
 import jdk.nashorn.internal.runtime.logging.Logger;
-
 /**
  * Source objects track the origin of JavaScript entities.
  */
@@ -61,6 +61,9 @@ public final class Source implements Loggable {
     private static final int BUF_SIZE = 8 * 1024;
     private static final Cache CACHE = new Cache();
 
+    // Message digest to file name encoder
+    private final static Base64.Encoder BASE64 = Base64.getUrlEncoder().withoutPadding();
+
     /**
      * Descriptive name of the source as supplied by the user. Used for error
      * reporting to the user. For example, SyntaxError will use this to print message.
@@ -81,8 +84,8 @@ public final class Source implements Loggable {
     /** Cached hash code */
     private int hash;
 
-    /** Message digest */
-    private byte[] digest;
+    /** Base64-encoded SHA1 digest of this source object */
+    private volatile byte[] digest;
 
     // Do *not* make this public, ever! Trusts the URL and content.
     private Source(final String name, final String base, final Data data) {
@@ -782,12 +785,17 @@ public final class Source implements Loggable {
     }
 
     /**
-     * Get a message digest for this source.
+     * Get a Base64-encoded SHA1 digest for this source.
      *
-     * @return a message digest for this source
+     * @return a Base64-encoded SHA1 digest for this source
      */
-    public synchronized byte[] getDigest() {
-        if (digest == null) {
+    public String getDigest() {
+        return new String(getDigestBytes(), StandardCharsets.US_ASCII);
+    }
+
+    private byte[] getDigestBytes() {
+        byte[] ldigest = digest;
+        if (ldigest == null) {
             final char[] content = data();
             final byte[] bytes = new byte[content.length * 2];
 
@@ -807,12 +815,12 @@ public final class Source implements Loggable {
                 if (getURL() != null) {
                     md.update(getURL().toString().getBytes(StandardCharsets.UTF_8));
                 }
-                digest = md.digest(bytes);
+                digest = ldigest = BASE64.encode(md.digest(bytes));
             } catch (final NoSuchAlgorithmException e) {
                 throw new RuntimeException(e);
             }
         }
-        return digest;
+        return ldigest;
     }
 
     /**
-- 
GitLab


From d9cdc6efec27c94b8095eec0a181b2a7ff98e3e0 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 3 Jul 2014 16:15:33 +0200
Subject: [PATCH 184/192] 8047166: 'do with({}) break ; while(0);' crashes in
 CodeGenerator

Reviewed-by: hannesw, jlaskey
---
 .../internal/codegen/CodeGenerator.java       |  7 ++++-
 nashorn/test/script/basic/JDK-8047166.js      | 31 +++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 nashorn/test/script/basic/JDK-8047166.js

diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index bfb9851c0f3..c890208879c 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -1181,7 +1181,12 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             return;
         }
         assert count > 0; // together with count == 0 check, asserts nonnegative count
-        assert method.hasScope();
+        if (!method.hasScope()) {
+            // We can sometimes invoke this method even if the method has no slot for the scope object. Typical example:
+            // for(;;) { with({}) { break; } }. WithNode normally creates a scope, but if it uses no identifiers and
+            // nothing else forces creation of a scope in the method, we just won't have the :scope local variable.
+            return;
+        }
         method.loadCompilerConstant(SCOPE);
         for(int i = 0; i < count; ++i) {
             method.invoke(ScriptObject.GET_PROTO);
diff --git a/nashorn/test/script/basic/JDK-8047166.js b/nashorn/test/script/basic/JDK-8047166.js
new file mode 100644
index 00000000000..5b31dc319c5
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8047166.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047166: 'do with({}) break ; while(0);' crashes in CodeGenerator
+ *
+ * @test
+ * @run
+ */
+
+(function(){do with({}) break ; while(0);})();
-- 
GitLab


From ade82779ac61a7f7cd75e1eed5d7e7172e5e8c53 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 3 Jul 2014 17:14:38 +0200
Subject: [PATCH 185/192] 8047331: Assertion in CompiledFunction when running
 earley-boyer after Merge

Reviewed-by: hannesw, jlaskey
---
 .../internal/runtime/CompiledFunction.java    | 41 +++++++++----------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java b/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java
index 87e32fc6508..e6dc9bf8659 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunction.java
@@ -595,13 +595,13 @@ final class CompiledFunction {
      * Handles a {@link RewriteException} raised during the execution of this function by recompiling (if needed) the
      * function with an optimistic assumption invalidated at the program point indicated by the exception, and then
      * executing a rest-of method to complete the execution with the deoptimized version.
-     * @param oldOptimismInfo the optimism info of this function. We must store it explicitly as a bound argument in the
-     * method handle, otherwise it would be null for handling a rewrite exception in an outer invocation of a recursive
-     * function when inner invocations of the function have completely deoptimized it.
+     * @param oldOptInfo the optimism info of this function. We must store it explicitly as a bound argument in the
+     * method handle, otherwise it could be null for handling a rewrite exception in an outer invocation of a recursive
+     * function when recursive invocations of the function have completely deoptimized it.
      * @param re the rewrite exception that was raised
      * @return the method handle for the rest-of method, for folding composition.
      */
-    private MethodHandle handleRewriteException(final OptimismInfo oldOptimismInfo, final RewriteException re) {
+    private MethodHandle handleRewriteException(final OptimismInfo oldOptInfo, final RewriteException re) {
         if (log.isEnabled()) {
             log.info(new RecompilationEvent(Level.INFO, re, re.getReturnValueNonDestructive()), "RewriteException ", re.getMessageShort());
         }
@@ -613,38 +613,37 @@ final class CompiledFunction {
         final MethodType callSiteType = type.parameterType(0) == ScriptFunction.class ?
                 type :
                 type.insertParameterTypes(0, ScriptFunction.class);
-        final boolean shouldRecompile = oldOptimismInfo.requestRecompile(re);
-        final boolean  canBeDeoptimized;
+        final OptimismInfo currentOptInfo = optimismInfo;
+        final boolean shouldRecompile = currentOptInfo != null && currentOptInfo.requestRecompile(re);
 
-        FunctionNode fn = oldOptimismInfo.reparse();
-        final Compiler compiler = oldOptimismInfo.getCompiler(fn, callSiteType, re); //set to non rest-of
+        // Effective optimism info, for subsequent use. We'll normally try to use the current (latest) one, but if it
+        // isn't available, we'll use the old one bound into the call site.
+        final OptimismInfo effectiveOptInfo = currentOptInfo != null ? currentOptInfo : oldOptInfo;
+        FunctionNode fn = effectiveOptInfo.reparse();
+        final Compiler compiler = effectiveOptInfo.getCompiler(fn, callSiteType, re); //set to non rest-of
 
         if (!shouldRecompile) {
             // It didn't necessarily recompile, e.g. for an outer invocation of a recursive function if we already
             // recompiled a deoptimized version for an inner invocation.
             // We still need to do the rest of from the beginning
-            canBeDeoptimized = canBeDeoptimized();
-            assert !canBeDeoptimized || optimismInfo == oldOptimismInfo;
-            logRecompile("Rest-of compilation [STANDALONE] ", fn, callSiteType, oldOptimismInfo.invalidatedProgramPoints);
-            return restOfHandle(oldOptimismInfo, compiler.compile(fn, CompilationPhases.COMPILE_ALL_RESTOF), canBeDeoptimized);
+            logRecompile("Rest-of compilation [STANDALONE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints);
+            return restOfHandle(effectiveOptInfo, compiler.compile(fn, CompilationPhases.COMPILE_ALL_RESTOF), currentOptInfo != null);
         }
 
-        logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, callSiteType, oldOptimismInfo.invalidatedProgramPoints);
+        logRecompile("Deoptimizing recompilation (up to bytecode) ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints);
         fn = compiler.compile(fn, CompilationPhases.COMPILE_UPTO_BYTECODE);
         log.info("Reusable IR generated");
 
-        assert optimismInfo == oldOptimismInfo;
-
         // compile the rest of the function, and install it
         log.info("Generating and installing bytecode from reusable IR...");
-        logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, callSiteType, oldOptimismInfo.invalidatedProgramPoints);
+        logRecompile("Rest-of compilation [CODE PIPELINE REUSE] ", fn, callSiteType, effectiveOptInfo.invalidatedProgramPoints);
         final FunctionNode normalFn = compiler.compile(fn, CompilationPhases.COMPILE_FROM_BYTECODE);
 
-        FunctionNode fn2 = oldOptimismInfo.reparse();
+        FunctionNode fn2 = effectiveOptInfo.reparse();
         fn2 = compiler.compile(fn2, CompilationPhases.COMPILE_UPTO_BYTECODE);
         log.info("Done.");
 
-        canBeDeoptimized = normalFn.canBeDeoptimized();
+        final boolean canBeDeoptimized = normalFn.canBeDeoptimized();
 
         if (log.isEnabled()) {
             log.info("Recompiled '", fn.getName(), "' (", Debug.id(this), ") ", canBeDeoptimized ? " can still be deoptimized." : " is completely deoptimized.");
@@ -652,16 +651,16 @@ final class CompiledFunction {
 
         log.info("Looking up invoker...");
 
-        final MethodHandle newInvoker = oldOptimismInfo.data.lookup(fn);
+        final MethodHandle newInvoker = effectiveOptInfo.data.lookup(fn);
         invoker     = newInvoker.asType(type.changeReturnType(newInvoker.type().returnType()));
         constructor = null; // Will be regenerated when needed
 
         log.info("Done: ", invoker);
-        final MethodHandle restOf = restOfHandle(oldOptimismInfo, compiler.compile(fn, CompilationPhases.COMPILE_FROM_BYTECODE_RESTOF), canBeDeoptimized);
+        final MethodHandle restOf = restOfHandle(effectiveOptInfo, compiler.compile(fn, CompilationPhases.COMPILE_FROM_BYTECODE_RESTOF), canBeDeoptimized);
 
         // Note that we only adjust the switch point after we set the invoker/constructor. This is important.
         if (canBeDeoptimized) {
-            oldOptimismInfo.newOptimisticAssumptions(); // Otherwise, set a new switch point.
+            effectiveOptInfo.newOptimisticAssumptions(); // Otherwise, set a new switch point.
         } else {
             optimismInfo = null; // If we got to a point where we no longer have optimistic assumptions, let the optimism info go.
         }
-- 
GitLab


From 7f1cf5327fd6974368e3835011d3240ec047a40e Mon Sep 17 00:00:00 2001
From: Erik Gahlin <egahlin@openjdk.org>
Date: Thu, 3 Jul 2014 18:20:42 +0200
Subject: [PATCH 186/192] 8028474:
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh timeout, leaves
 looping process

Reviewed-by: sla, jbachorik, rriggs
---
 jdk/test/ProblemList.txt                      |   3 -
 .../MonitoredVm/MonitorVmStartTerminate.java  | 415 ++++++++++--------
 .../MonitoredVm/MonitorVmStartTerminate.sh    |  43 --
 .../sun/jvmstat/testlibrary/JavaProcess.java  | 151 -------
 4 files changed, 243 insertions(+), 369 deletions(-)
 delete mode 100644 jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh
 delete mode 100644 jdk/test/sun/jvmstat/testlibrary/JavaProcess.java

diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index a8d232a71a2..254f9fe8d56 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -239,9 +239,6 @@ sun/security/tools/keytool/standard.sh                          solaris-all
 
 # jdk_tools
 
-# 8028474
-sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh      generic-all
-
 # Tests take too long, on sparcs see 7143279
 tools/pack200/CommandLineTests.java                             solaris-all, macosx-all
 tools/pack200/Pack200Test.java                                  solaris-all, macosx-all
diff --git a/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java b/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java
index 9c2f0630fb7..7d9cd4b5521 100644
--- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java
+++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, 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
@@ -21,228 +21,299 @@
  * questions.
  */
 
-import java.util.concurrent.CountDownLatch;
-import java.util.regex.*;
-import java.util.*;
-import java.net.URISyntaxException;
+import java.io.File;
 import java.io.IOException;
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Semaphore;
+
+import jdk.testlibrary.OutputBuffer;
+import jdk.testlibrary.ProcessTools;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredVm;
+import sun.jvmstat.monitor.MonitoredVmUtil;
+import sun.jvmstat.monitor.VmIdentifier;
+import sun.jvmstat.monitor.event.HostEvent;
+import sun.jvmstat.monitor.event.HostListener;
+import sun.jvmstat.monitor.event.VmStatusChangeEvent;
+
+/*
+
+ Test starts ten Java processes, each with a unique id.
+
+ Each process creates a file named after the id and then it waits for
+ the test to remove the file, at which the Java process exits.
+
+ The processes are monitored by the test to make sure notifications
+ are sent when they are started/terminated.
 
-public class MonitorVmStartTerminate {
+ To avoid Java processes being left behind, in case of an unexpected
+ failure, shutdown hooks are installed that remove files when the test
+ exits. If files are not removed, i.e. due to a JVM crash, the Java
+ processes will exit themselves after 1000 s.
 
-    private static final int SLEEPERS = 10;
-    private static final int SLEEPTIME = 5000;     // sleep time for a sleeper
-    private static final int EXECINTERVAL = 3000;   // wait time between exec's
+*/
 
-    public static void main(String args[]) throws Exception {
+/*
+ * @test
+ * @bug 4990825
+ * @summary attach to external but local JVM processes
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main/othervm MonitorVmStartTerminate
+ */
+public final class MonitorVmStartTerminate {
 
-        long now = System.currentTimeMillis();
+    private static final int PROCESS_COUNT = 10;
+    private static final long PROCESS_TIMEOUT_IN_NS = 1000*1000_000_000L;
 
-        String sleeperArgs = SLEEPTIME + " " + now;
-        String sleeperPattern = "Sleeper " + sleeperArgs + " \\d+$";
+    public static void main(String... args) throws Exception {
 
         MonitoredHost host = MonitoredHost.getMonitoredHost("localhost");
-        host.setInterval(200);
+        host.setInterval(1); // 1 ms
 
-        Matcher matcher = Pattern.compile(sleeperPattern).matcher("");
-        SleeperListener listener = new SleeperListener(host, matcher, SLEEPERS);
+        String id = UUID.randomUUID().toString();
+
+        List<JavaProcess> javaProcesses = new ArrayList<>();
+        for (int i = 0; i < PROCESS_COUNT; i++) {
+            javaProcesses.add(new JavaProcess(id + "_" + i));
+        }
+
+        Listener listener = new Listener(host, javaProcesses);
         host.addHostListener(listener);
+        for (JavaProcess javaProcess : javaProcesses) {
+            javaProcess.start();
+        }
 
-        SleeperStarter ss = new SleeperStarter(SLEEPERS, EXECINTERVAL,
-                                               sleeperArgs);
-        ss.start();
+        // Wait for all processes to start before terminating
+        // them, so pids are not reused within a poll interval.
+        System.out.println("Waiting for all processes to get started notification");
+        listener.started.acquire(PROCESS_COUNT);
 
-        System.out.println("Waiting for "
-                           + SLEEPERS + " sleepers to terminate");
-        try {
-            ss.join();
-        } catch (InterruptedException e) {
-            throw new Exception("Timed out waiting for sleepers");
+        for (JavaProcess javaProcess : javaProcesses) {
+            javaProcess.terminate();
         }
-        listener.waitForSleepersToStart();
-        listener.waitForSleepersToTerminate();
-    }
+        System.out.println("Waiting for all processes to get terminated notification");
+        listener.terminated.acquire(PROCESS_COUNT);
 
-    public static class SleeperListener implements HostListener {
+        host.removeHostListener(listener);
+    }
 
-        private final List<Integer> targets =  new ArrayList<>();
-        private final CountDownLatch terminateLatch;
-        private final CountDownLatch startLatch;
+    private static final class Listener implements HostListener {
+        private final Semaphore started = new Semaphore(0);
+        private final Semaphore terminated = new Semaphore(0);
         private final MonitoredHost host;
-        private final Matcher patternMatcher;
+        private final List<JavaProcess> processes;
 
-        public SleeperListener(MonitoredHost host, Matcher matcher, int count) {
+        public Listener(MonitoredHost host, List<JavaProcess> processes) {
             this.host = host;
-            this.patternMatcher = matcher;
-            this.terminateLatch = new CountDownLatch(count);
-            this.startLatch = new CountDownLatch(count);
+            this.processes = processes;
+            printStatus();
         }
 
-        public void waitForSleepersToTerminate() throws InterruptedException {
-            terminateLatch.await();
+        @Override
+        @SuppressWarnings("unchecked")
+        public void vmStatusChanged(VmStatusChangeEvent event) {
+            releaseStarted(event.getStarted());
+            releaseTerminated(event.getTerminated());
+            printStatus();
         }
 
-        public void waitForSleepersToStart() throws InterruptedException {
-            startLatch.await();
+        private void printStatus() {
+            System.out.printf("started=%d, terminated=%d\n",
+                    started.availablePermits(), terminated.availablePermits());
         }
 
-        private void printList(Set<Integer> list, String msg) {
-            System.out.println(msg + ":");
-            for (Integer lvmid : list) {
-                try {
-                    VmIdentifier vmid = new VmIdentifier("//" + lvmid.intValue());
-                    MonitoredVm target = host.getMonitoredVm(vmid);
+        @Override
+        public void disconnected(HostEvent arg0) {
+            // ignore
+        }
 
-                    StringMonitor cmdMonitor =
-                            (StringMonitor)target.findByName("sun.rt.javaCommand");
-                    String cmd = cmdMonitor.stringValue();
+        private void releaseStarted(Set<Integer> ids) {
+            System.out.println("realeaseStarted(" + ids + ")");
+            for (Integer id : ids) {
+                releaseStarted(id);
+            }
+        }
 
-                    System.out.println("\t" + lvmid.intValue() + ": "
-                                       + "\"" + cmd + "\"" + ": ");
-                } catch (URISyntaxException e) {
-                    System.err.println("Unexpected URISyntaxException: "
-                                       + e.getMessage());
-                } catch (MonitorException e) {
-                    System.out.println("\t" + lvmid.intValue()
-                                       + ": error reading monitoring data: "
-                                       + " target possibly terminated?");
+        private void releaseStarted(Integer id) {
+            for (JavaProcess jp : processes) {
+                if (hasMainArgs(id, jp.getMainArgsIdentifier())) {
+                    // store id for terminated identification
+                    jp.setId(id);
+                    System.out.println("RELEASED (id=" + jp.getId() + ", args=" + jp.getMainArgsIdentifier() + ")");
+                    started.release();
+                    return;
                 }
             }
         }
 
+        private void releaseTerminated(Set<Integer> ids) {
+            System.out.println("releaseTerminated(" + ids + ")");
+            for (Integer id : ids) {
+                releaseTerminated(id);
+            }
+        }
 
-        private int addStarted(Set<Integer> started) {
-            int found = 0;
-            for (Integer lvmid : started) {
-                try {
-                    VmIdentifier vmid = new VmIdentifier("//" + lvmid.intValue());
-                    MonitoredVm target = host.getMonitoredVm(vmid);
-
-                    StringMonitor cmdMonitor =
-                            (StringMonitor)target.findByName("sun.rt.javaCommand");
-                    String cmd = cmdMonitor.stringValue();
-
-                    patternMatcher.reset(cmd);
-                    System.out.print("Started: " + lvmid.intValue()
-                                     + ": " + "\"" + cmd + "\"" + ": ");
-
-                    if (patternMatcher.matches()) {
-                        System.out.println("matches pattern - recorded");
-                        targets.add(lvmid);
-                        found++;
-                    }
-                    else {
-                        System.out.println("does not match pattern - ignored");
-                    }
-                } catch (URISyntaxException e) {
-                    System.err.println("Unexpected URISyntaxException: "
-                                       + e.getMessage());
-                } catch (MonitorException e) {
-                    System.err.println("Unexpected MonitorException: "
-                                       + e.getMessage());
+        private void releaseTerminated(Integer id) {
+            for (JavaProcess jp : processes) {
+                if (id.equals(jp.getId())) {
+                    System.out.println("RELEASED (id=" + jp.getId() + ", args=" + jp.getMainArgsIdentifier() + ")");
+                    terminated.release();
+                    return;
                 }
             }
-            return found;
-        }
-
-        private int removeTerminated(Set<Integer> terminated) {
-            int found = 0;
-            for (Integer lvmid : terminated) {
-                /*
-                 * we don't attempt to attach to the target here as it's
-                 * now dead and has no jvmstat share memory file. Just see
-                 * if the process id is among those that we saved when we
-                 * started the targets (note - duplicated allowed and somewhat
-                 * expected on windows);
-                 */
-                System.out.print("Terminated: " + lvmid.intValue() + ": ");
-                if (targets.contains(lvmid)) {
-                    System.out.println("matches pattern - termination recorded");
-                    targets.remove(lvmid);
-                    found++;
-                }
-                else {
-                    System.out.println("does not match pattern - ignored");
+        }
+
+        private boolean hasMainArgs(Integer id, String args) {
+            try {
+                VmIdentifier vmid = new VmIdentifier("//" + id.intValue());
+                MonitoredVm target = host.getMonitoredVm(vmid);
+                String monitoredArgs = MonitoredVmUtil.mainArgs(target);
+                if (monitoredArgs != null && monitoredArgs.contains(args)) {
+                    return true;
                 }
+            } catch (URISyntaxException | MonitorException e) {
+                // ok. process probably not running
             }
-            return found;
+            return false;
         }
+    }
 
-        @SuppressWarnings("unchecked")
-        public void vmStatusChanged(VmStatusChangeEvent ev) {
-            printList(ev.getActive(), "Active");
-            printList(ev.getStarted(), "Started");
-            printList(ev.getTerminated(), "Terminated");
+    public final static class JavaProcess {
 
-            int recentlyStarted = addStarted(ev.getStarted());
-            int recentlyTerminated = removeTerminated(ev.getTerminated());
+        private static final class ShutdownHook extends Thread {
+            private final JavaProcess javaProcess;
 
-            for (int i = 0; i < recentlyTerminated; i++) {
-                terminateLatch.countDown();
+            public ShutdownHook(JavaProcess javaProcess) {
+                this.javaProcess = javaProcess;
             }
-            for (int i = 0; i < recentlyStarted; i++) {
-                startLatch.countDown();
+
+            public void run() {
+                javaProcess.terminate();
             }
         }
 
-        public void disconnected(HostEvent ev) {
+        public static void main(String[] args) throws InterruptedException {
+            try {
+                Path path = Paths.get(args[0]);
+                createFile(path);
+                waitForRemoval(path);
+            } catch (Throwable t) {
+                t.printStackTrace();
+                System.exit(1);
+            }
+        }
+
+        public Integer getId() {
+            return id;
+        }
+
+        public void setId(Integer id) {
+            this.id = id;
+        }
+
+        private static void createFile(Path path) throws IOException {
+            Files.write(path, new byte[0], StandardOpenOption.CREATE);
+            if (!Files.exists(path)) {
+                throw new Error("Newly created file " + path
+                        + " does not exist!");
+            }
+        }
+
+        private static void waitForRemoval(Path path) {
+            long start = System.nanoTime();
+            while (true) {
+                long now = System.nanoTime();
+                long waited = now - start;
+                System.out.println("Waiting for " + path + " to be removed, " + waited + " ns");
+                if (!Files.exists(path)) {
+                    return;
+                }
+                if (waited > PROCESS_TIMEOUT_IN_NS) {
+                    System.out.println("Start: " + start);
+                    System.out.println("Now: " + now);
+                    System.out.print("Process timed out after " + waited + " ns. Abort.");
+                    System.exit(1);
+                }
+                takeNap();
+            }
         }
-    }
 
-    public static class SleeperStarter extends Thread {
+        private static void takeNap() {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignore
+            }
+        }
 
-        private final JavaProcess[] processes;
-        private final int execInterval;
-        private final String args;
+        private final String mainArgsIdentifier;
+        private final ShutdownHook shutdownHook;
+        private volatile Integer id;
 
-        public SleeperStarter(int sleepers, int execInterval, String args) {
-            this.execInterval = execInterval;
-            this.args = args;
-            this.processes = new JavaProcess[sleepers];
+        public JavaProcess(String mainArgsIdentifier) {
+            this.mainArgsIdentifier = mainArgsIdentifier;
+            this.shutdownHook = new ShutdownHook(this);
         }
 
-        private synchronized int active() {
-            int active = processes.length;
-            for(JavaProcess jp : processes) {
-                try {
-                    jp.exitValue();
-                    active--;
-                } catch (IllegalThreadStateException e) {
-                    // process hasn't exited yet
+        /**
+         * Starts a Java process asynchronously.
+         *
+         * The process runs until {@link #stop()} is called. If test exits
+         * unexpectedly the process will be cleaned up by a shutdown hook.
+         *
+         * @throws Exception
+         */
+        public void start() throws Exception {
+            Runtime.getRuntime().addShutdownHook(shutdownHook);
+            System.out.println("Starting " + getMainArgsIdentifier());
+
+            Runnable r = new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        executeJava();
+                    } catch (Throwable t) {
+                        t.printStackTrace();
+                    }
                 }
+            };
+            new Thread(r).start();
+        }
+
+        public void terminate() {
+            try {
+                System.out.println("Terminating " + mainArgsIdentifier);
+                Files.delete(Paths.get(mainArgsIdentifier));
+            } catch (IOException e) {
+                e.printStackTrace();
             }
-            return active;
-        }
-
-        public void run() {
-           System.out.println("Starting " + processes.length + " sleepers");
-
-           String[] classpath = {
-               "-classpath",
-               System.getProperty("java.class.path")
-           };
-
-           for (int i = 0; i < processes.length; i++) {
-               try {
-                   System.out.println("Starting Sleeper " + i);
-                   synchronized(this) {
-                       processes[i] = new JavaProcess("Sleeper", args + " " + i);
-                       processes[i].addOptions(classpath);
-                   }
-                   processes[i].start();
-                   Thread.sleep(execInterval);
-               } catch (InterruptedException ignore) {
-               } catch (IOException e) {
-                   System.err.println(
-                           "IOException trying to start Sleeper " + i + ": "
-                           + e.getMessage());
-               }
-           }
-
-           // spin waiting for the processes to terminate
-           while (active() > 0) ;
+            Runtime.getRuntime().removeShutdownHook(shutdownHook);
+        }
+
+        private void executeJava() throws Exception, IOException {
+            String className = JavaProcess.class.getName();
+            String classPath = System.getProperty("test.classes");
+            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-cp",
+                    classPath, className, mainArgsIdentifier);
+            OutputBuffer ob = ProcessTools.getOutput(pb.start());
+            System.out.println("Java Process " + getMainArgsIdentifier() + " stder:"
+                    + ob.getStderr());
+            System.err.println("Java Process " + getMainArgsIdentifier() + " stdout:"
+                    + ob.getStdout());
+        }
+
+        public String getMainArgsIdentifier() {
+            return mainArgsIdentifier;
         }
     }
 }
-
diff --git a/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh b/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh
deleted file mode 100644
index 152ec9303a9..00000000000
--- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright (c) 2004, 2013, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# @test
-# @bug 4990825
-# @summary attach to external but local JVM processes
-# @library ../../testlibrary
-# @build Sleeper
-# @build JavaProcess
-# @build MonitorVmStartTerminate
-# @run shell MonitorVmStartTerminate.sh
-#
-
-. ${TESTSRC-.}/../../testlibrary/utils.sh
-
-setup
-verify_os
-
-JAVA="${TESTJAVA}/bin/java"
-CP=${TESTJAVA}${FS}lib${FS}tools.jar${PS}${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${FS}..${FS}testlibrary
-
-${JAVA} ${TESTVMOPTS} -classpath ${CP} MonitorVmStartTerminate
diff --git a/jdk/test/sun/jvmstat/testlibrary/JavaProcess.java b/jdk/test/sun/jvmstat/testlibrary/JavaProcess.java
deleted file mode 100644
index 664947b2577..00000000000
--- a/jdk/test/sun/jvmstat/testlibrary/JavaProcess.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2004, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- *
- */
-
-import java.io.*;
-
-public class JavaProcess {
-
-    protected Process process = null;
-
-    private String classname;
-    private StringBuilder classArgs;
-    private StringBuilder javaOptions;
-
-    private static String java = System.getProperty("java.home")
-                                 + File.separator + "bin"
-                                 + File.separator + "java";
-
-    public JavaProcess(String classname) {
-        this(classname, "", "");
-    }
-
-    public JavaProcess(String classname, String classArgs) {
-        this(classname, "", classArgs);
-    }
-
-    public JavaProcess(String classname, String javaOptions, String classArgs) {
-        this.classname = classname;
-        this.javaOptions = new StringBuilder(javaOptions);
-        this.classArgs = new StringBuilder(classArgs);
-    }
-
-    /**
-     * add java options to the java command
-     */
-    public void addOptions(String[] opts) {
-        if (javaOptions != null && javaOptions.length() > 0) {
-            javaOptions.append(" ");
-        }
-
-        for (int i = 0; i < opts.length; i++) {
-            if (i != 0) {
-                javaOptions.append(" ");
-            }
-            javaOptions.append(opts[i]);
-        }
-    }
-
-    /**
-     * add arguments to the class arguments
-     */
-    public void addArguments(String[] args) {
-        if (classArgs != null && classArgs.length() > 0) {
-            classArgs.append(" ");
-        }
-
-        for (int i = 0; i < args.length; i++) {
-            if (i != 0) {
-                classArgs.append(" ");
-            }
-            classArgs.append(args[i]);
-        }
-    }
-
-    /**
-     * start the java process
-     */
-    public void start() throws IOException {
-        if (process != null) {
-            return;
-        }
-
-        String javaCommand = java + " " + javaOptions + " "
-                             + classname + " " + classArgs;
-
-        System.out.println("exec'ing: " + javaCommand);
-
-        process = Runtime.getRuntime().exec(javaCommand);
-    }
-
-    /**
-     * destroy the java process
-     */
-    public void destroy() {
-        if (process != null) {
-            process.destroy();
-        }
-        process = null;
-    }
-
-    public int exitValue() {
-        if (process != null) {
-            return process.exitValue();
-        }
-        throw new RuntimeException("exitValue called with process == null");
-    }
-
-    public InputStream getErrorStream() {
-        if (process != null) {
-            return process.getErrorStream();
-        }
-        throw new RuntimeException(
-                "getErrorStream() called with process == null");
-    }
-
-    public InputStream getInputStream() {
-        if (process != null) {
-            return process.getInputStream();
-        }
-        throw new RuntimeException(
-                "getInputStream() called with process == null");
-    }
-
-    public OutputStream getOutputStream() {
-        if (process != null) {
-            return process.getOutputStream();
-        }
-        throw new RuntimeException(
-                "getOutputStream() called with process == null");
-    }
-
-    public int waitFor() throws InterruptedException {
-        if (process != null) {
-            return process.waitFor();
-        }
-        throw new RuntimeException("waitFor() called with process == null");
-    }
-}
-- 
GitLab


From 14eb01cb47f0b5d45904707b3f679d9998370035 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Thu, 3 Jul 2014 23:03:37 +0530
Subject: [PATCH 187/192] 8049242: Explicit constructor overload selection
 should work with StaticClass as well

Reviewed-by: jlaskey, attila
---
 .../dynalink/beans/AbstractJavaLinker.java    | 30 +++++--
 .../dynalink/beans/StaticClassLinker.java     |  5 +-
 nashorn/test/script/basic/JDK-8043232.js      | 12 +++
 .../test/script/basic/JDK-8043232.js.EXPECTED |  3 +
 nashorn/test/script/basic/JDK-8049242.js      | 78 +++++++++++++++++++
 .../test/script/basic/JDK-8049242.js.EXPECTED | 10 +++
 6 files changed, 128 insertions(+), 10 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8049242.js
 create mode 100644 nashorn/test/script/basic/JDK-8049242.js.EXPECTED

diff --git a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java
index 11b700bac0f..dab6cbf546e 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java
@@ -390,6 +390,10 @@ abstract class AbstractJavaLinker implements GuardingDynamicLinker {
         return new GuardedInvocationComponent(invocation, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
     }
 
+    SingleDynamicMethod getConstructorMethod(final String signature) {
+        return null;
+    }
+
     private MethodHandle getAssignableGuard(final MethodType type) {
         return Guards.asType(assignableGuard, type);
     }
@@ -412,18 +416,18 @@ abstract class AbstractJavaLinker implements GuardingDynamicLinker {
         return inv == null ? null : new GuardedInvocation(inv, getClassGuard(callSiteDescriptor.getMethodType()));
     }
 
-    private static MethodHandle getDynamicMethodInvocation(final CallSiteDescriptor callSiteDescriptor,
+    private MethodHandle getDynamicMethodInvocation(final CallSiteDescriptor callSiteDescriptor,
             final LinkerServices linkerServices, final String methodName, final Map<String, DynamicMethod> methodMap) {
         final DynamicMethod dynaMethod = getDynamicMethod(methodName, methodMap);
         return dynaMethod != null ? dynaMethod.getInvocation(callSiteDescriptor, linkerServices) : null;
     }
 
-    private static DynamicMethod getDynamicMethod(final String methodName, final Map<String, DynamicMethod> methodMap) {
+    private DynamicMethod getDynamicMethod(final String methodName, final Map<String, DynamicMethod> methodMap) {
         final DynamicMethod dynaMethod = methodMap.get(methodName);
         return dynaMethod != null ? dynaMethod : getExplicitSignatureDynamicMethod(methodName, methodMap);
     }
 
-    private static SingleDynamicMethod getExplicitSignatureDynamicMethod(final String methodName,
+    private SingleDynamicMethod getExplicitSignatureDynamicMethod(final String fullName,
             final Map<String, DynamicMethod> methodsMap) {
         // What's below is meant to support the "name(type, type, ...)" syntax that programmers can use in a method name
         // to manually pin down an exact overloaded variant. This is not usually required, as the overloaded method
@@ -433,23 +437,33 @@ abstract class AbstractJavaLinker implements GuardingDynamicLinker {
         // for performance reasons.
 
         // Is the method name lexically of the form "name(types)"?
-        final int lastChar = methodName.length() - 1;
-        if(methodName.charAt(lastChar) != ')') {
+        final int lastChar = fullName.length() - 1;
+        if(fullName.charAt(lastChar) != ')') {
             return null;
         }
-        final int openBrace = methodName.indexOf('(');
+        final int openBrace = fullName.indexOf('(');
         if(openBrace == -1) {
             return null;
         }
 
+        final String name = fullName.substring(0, openBrace);
+        final String signature = fullName.substring(openBrace + 1, lastChar);
+
         // Find an existing method for the "name" part
-        final DynamicMethod simpleNamedMethod = methodsMap.get(methodName.substring(0, openBrace));
+        final DynamicMethod simpleNamedMethod = methodsMap.get(name);
         if(simpleNamedMethod == null) {
+            // explicit signature constructor access
+            // Java.type("java.awt.Color")["(int,int,int)"]
+            // will get Color(int,int,int) constructor of Color class.
+            if (name.isEmpty()) {
+                return getConstructorMethod(signature);
+            }
+
             return null;
         }
 
         // Try to get a narrowed dynamic method for the explicit parameter types.
-        return simpleNamedMethod.getMethodForExactParamTypes(methodName.substring(openBrace + 1, lastChar));
+        return simpleNamedMethod.getMethodForExactParamTypes(signature);
     }
 
     private static final MethodHandle IS_METHOD_HANDLE_NOT_NULL = Guards.isNotNull().asType(MethodType.methodType(
diff --git a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java
index f7ffc2abd2f..ab9c884a7ad 100644
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java
@@ -161,8 +161,9 @@ class StaticClassLinker implements TypeBasedGuardingDynamicLinker {
             return null;
         }
 
-        DynamicMethod getConstructorMethod(final String signature) {
-            return constructor.getMethodForExactParamTypes(signature);
+        @Override
+        SingleDynamicMethod getConstructorMethod(final String signature) {
+            return constructor != null? constructor.getMethodForExactParamTypes(signature) : null;
         }
     }
 
diff --git a/nashorn/test/script/basic/JDK-8043232.js b/nashorn/test/script/basic/JDK-8043232.js
index 220ac1eca87..ec112b891c2 100644
--- a/nashorn/test/script/basic/JDK-8043232.js
+++ b/nashorn/test/script/basic/JDK-8043232.js
@@ -78,3 +78,15 @@ checkIt(function() new println("hello"));
 
 // call constructor as normal method (without 'new')
 checkIt(function() Color());
+
+// try constructor on interface
+checkIt(function() new java.lang["Runnable()"]);
+checkIt(function() new java.lang["Runnable(int)"]);
+
+// try constructor on abstrace class
+try {
+    new java.io["InputStream()"];
+    throw new Error("should have thrown exception!");
+} catch (e) {
+    print(e);
+}
diff --git a/nashorn/test/script/basic/JDK-8043232.js.EXPECTED b/nashorn/test/script/basic/JDK-8043232.js.EXPECTED
index af68416fa0a..5fcfab8e24d 100644
--- a/nashorn/test/script/basic/JDK-8043232.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8043232.js.EXPECTED
@@ -9,3 +9,6 @@ TypeError: Java constructor signature invalid: Object)
 TypeError: Java method [jdk.internal.dynalink.beans.OverloadedDynamicMethod java.lang.System.getProperty] cant be used as a constructor.
 TypeError: Java method [jdk.internal.dynalink.beans.OverloadedDynamicMethod java.io.PrintStream.println] cant be used as a constructor.
 TypeError: Constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)] requires new.
+TypeError: No such Java constructor: Runnable()
+TypeError: No such Java constructor: Runnable(int)
+java.lang.InstantiationException: java.io.InputStream
diff --git a/nashorn/test/script/basic/JDK-8049242.js b/nashorn/test/script/basic/JDK-8049242.js
new file mode 100644
index 00000000000..3e803b3e8be
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8049242.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8049242: Explicit constructor overload selection should work with StaticClass as well
+ *
+ * @test
+ * @run
+ */
+
+// call explicit constructor
+print(new (Java.type("java.awt.Color")["(int,int,int)"])(255,0,255));
+// print the constructor itself
+print(Java.type("java.awt.Color")["(int,int,int)"]);
+
+// store constructor to call later
+var Color = Java.type("java.awt.Color")["(int,int,int)"];
+// call stored constructor
+print(new Color(33, 233, 2))
+
+// check if default constructor works
+var obj = new (Java.type("java.lang.Object")["()"])();
+if (obj.class != Java.type("java.lang.Object").class) {
+    fail("obj is a java.lang.Object");
+}
+
+// expected failure cases.
+function checkIt(func) {
+    try {
+        func();
+        throw new Error("should have thrown TypeError");
+    } catch(e) {
+        if (! (e instanceof TypeError)) {
+            fail("Expected TypeError, got " + e);
+        }
+        print(e);
+    }
+}
+
+// garbage signature string
+checkIt(function() new (Java.type("java.lang.Object")["()xxxxx"])());
+checkIt(function() new (Java.type("java.lang.Object")["("])());
+checkIt(function() new (Java.type("java.lang.Object")[")"])());
+
+// call constructor as normal method (without 'new')
+checkIt(function() Color());
+
+// try constructor on interface
+checkIt(function() new (Java.type("java.lang.Runnable"))["()"]);
+checkIt(function() new (Java.type("java.lang.Runnable"))["(int)"]);
+
+// try constructor on abstrace class
+try {
+    new (Java.type("java.io.InputStream"))["()"];
+    throw new Error("should have thrown exception!");
+} catch (e) {
+    print(e);
+}
diff --git a/nashorn/test/script/basic/JDK-8049242.js.EXPECTED b/nashorn/test/script/basic/JDK-8049242.js.EXPECTED
new file mode 100644
index 00000000000..4aa4627659f
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8049242.js.EXPECTED
@@ -0,0 +1,10 @@
+java.awt.Color[r=255,g=0,b=255]
+[jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)]
+java.awt.Color[r=33,g=233,b=2]
+TypeError: null is not a function
+TypeError: null is not a function
+TypeError: null is not a function
+TypeError: Constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)] requires new.
+TypeError: null is not a function
+TypeError: null is not a function
+java.lang.InstantiationException: java.io.InputStream
-- 
GitLab


From 158b584885b182f4ca7f2dc6fcdc04876ae0b4a5 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 3 Jul 2014 11:36:33 -0700
Subject: [PATCH 188/192] Added tag jdk9-b21 for changeset 4b8db1aec2a3

---
 .hgtags-top-repo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index a6aef895743..3fbd35c6a22 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -263,3 +263,4 @@ cf22a728521f91a4692b433d39d730a0a1b23155 jdk9-b16
 65abab59f783fcf02ff8e133431c252f9e5f07d5 jdk9-b18
 75a08df650eb3126bab0c4d15241f5886162393c jdk9-b19
 ee4fd72b2ec3d92497f37163352f294aa695c6fb jdk9-b20
+9052803f4d01feda28b3d65f2b64dd457d21c7b6 jdk9-b21
-- 
GitLab


From 60a03e02749aa275483da289b92f9f4baee9840e Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 3 Jul 2014 11:36:35 -0700
Subject: [PATCH 189/192] Added tag jdk9-b21 for changeset a36678c24565

---
 corba/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/corba/.hgtags b/corba/.hgtags
index f9ed22e0c47..cdc0dbb61f7 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -263,3 +263,4 @@ e54022d0dd92106fff7f7fe670010cd7e6517ee3 jdk9-b15
 77565aaaa2bb814e94817e92d680168052a25395 jdk9-b18
 eecc1b6adc7e193d00a0641eb0963add5a4c06e8 jdk9-b19
 87f36eecb1665012d01c5cf102494e591c943ea6 jdk9-b20
+3615a4e7f0542ca7552ad6454b742c73ee211d8e jdk9-b21
-- 
GitLab


From 73ca4dab49a36798967fdd8afae6204f23009ee0 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 3 Jul 2014 11:36:49 -0700
Subject: [PATCH 190/192] Added tag jdk9-b21 for changeset 783e13910e74

---
 hotspot/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index b4c3b90e4c2..bc44b8bd401 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -423,3 +423,4 @@ b14e7c0b7d3ec04127f565cda1d84122e205680c jdk9-b16
 871fd128548480095e0dc3fc34c422666baeec75 jdk9-b18
 d4cffb3ae6213c66c7522ebffe0349360a45f0ef jdk9-b19
 c1af79d122ec9f715fa29312b5e91763f3a4dfc4 jdk9-b20
+17b4a5e831b398738feedb0afe75245744510153 jdk9-b21
-- 
GitLab


From 000a943345d60ae93156542eb6602f1056f5ab93 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 3 Jul 2014 11:37:18 -0700
Subject: [PATCH 191/192] Added tag jdk9-b21 for changeset 843911d61b95

---
 jdk/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jdk/.hgtags b/jdk/.hgtags
index 827ca017224..38493c04e7f 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -263,3 +263,4 @@ fd8e675f141b9bdb2f46d1ae8251f4ee3a895d64 jdk9-b17
 6ad17b31f0d30593392b1e8695b9709dbbd7fb70 jdk9-b18
 27561aede285c25a3e9ed8bf8918234ad3bb81e3 jdk9-b19
 f87c5be90e01a7ffb47947108eb3e0b0b1920880 jdk9-b20
+2df45ac1bf491278f38c12e0dfbeebadb6c54c8c jdk9-b21
-- 
GitLab


From 75ac0ce693768809fa292b80a031481904b6d601 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 3 Jul 2014 11:37:57 -0700
Subject: [PATCH 192/192] Added tag jdk9-b21 for changeset e4ffc9bab6f2

---
 nashorn/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 1a1ec8355f0..370fcc1ba8c 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -254,3 +254,4 @@ fed8c83dfba4dce94d2ae1cb82f026634ff2a3e4 jdk9-b16
 893c337bc95fef3885baa3e4ffc30d68f62a829f jdk9-b18
 46e36a92e37c06dea50f8c829549d9d0bfed4e3c jdk9-b19
 d703c59c556f9fcd9604272806ef7acf55c92363 jdk9-b20
+174cf53bce4e93a3d5d880ed7915ce8d0f08bc5e jdk9-b21
-- 
GitLab