diff --git a/jdk/.hgtags b/jdk/.hgtags
index 5548c0a..ef6e16f 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -206,3 +206,4 @@
 624bcb4800065c6656171948e31ebb2925f25c7a jdk8-b82
 ac519af51769e92c51b597a730974e8607357709 jdk8-b83
 7b4721e4edb4e1c65e9c839a70d7cc67f81c7632 jdk8-b84
+296676d534c52888c36e305a2bf7f345c4ca70f8 jdk8-b85
diff --git a/jdk/make/java/java/FILES_java.gmk b/jdk/make/java/java/FILES_java.gmk
index 8122bdf..47184e3 100644
--- a/jdk/make/java/java/FILES_java.gmk
+++ b/jdk/make/java/java/FILES_java.gmk
@@ -316,6 +316,8 @@
     java/util/concurrent/BrokenBarrierException.java \
     java/util/concurrent/Callable.java \
     java/util/concurrent/CancellationException.java \
+    java/util/concurrent/CompletableFuture.java \
+    java/util/concurrent/CompletionException.java \
     java/util/concurrent/CompletionService.java \
     java/util/concurrent/ConcurrentHashMap.java \
     java/util/concurrent/ConcurrentLinkedDeque.java \
diff --git a/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java b/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java
index 8e71a50..40b2fc2 100644
--- a/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java
+++ b/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -28,27 +28,25 @@
 import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 public final class JRSUIConstants {
     private static native long getPtrForConstant(final int constant);
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     static class Key {
-        protected static final int _value = 20;
+        @Native protected static final int _value = 20;
         public static final Key VALUE = new Key(_value);
 
-        protected static final int _thumbProportion = 24;
+        @Native protected static final int _thumbProportion = 24;
         public static final Key THUMB_PROPORTION = new Key(_thumbProportion);
 
-        protected static final int _thumbStart = 25;
+        @Native protected static final int _thumbStart = 25;
         public static final Key THUMB_START = new Key(_thumbStart);
 
-        protected static final int _windowTitleBarHeight = 28;
+        @Native protected static final int _windowTitleBarHeight = 28;
         public static final Key WINDOW_TITLE_BAR_HEIGHT = new Key(_windowTitleBarHeight);
 
-        protected static final int _animationFrame = 23;
+        @Native protected static final int _animationFrame = 23;
         public static final Key ANIMATION_FRAME = new Key(_animationFrame);
 
         final int constant;
@@ -70,10 +68,8 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     static class DoubleValue {
-        protected static final byte TYPE_CODE = 1;
+        @Native protected static final byte TYPE_CODE = 1;
 
         final double doubleValue;
 
@@ -139,684 +135,634 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Size extends Property {
-        private static final byte SHIFT = 0;
-        private static final byte SIZE = 3;
-        private static final long MASK = (long)0x7 << SHIFT;
+        @Native private static final byte SHIFT = 0;
+        @Native private static final byte SIZE = 3;
+        @Native private static final long MASK = (long)0x7 << SHIFT;
         private static final PropertyEncoding size = new PropertyEncoding(MASK, SHIFT);
 
         Size(final byte value) {
             super(size, value);
         }
 
-        private static final byte _mini = 1;
+        @Native private static final byte _mini = 1;
         public static final Size MINI = new Size(_mini);
-        private static final byte _small = 2;
+        @Native private static final byte _small = 2;
         public static final Size SMALL = new Size(_small);
-        private static final byte _regular = 3;
+        @Native private static final byte _regular = 3;
         public static final Size REGULAR = new Size(_regular);
-        private static final byte _large = 4;
+        @Native private static final byte _large = 4;
         public static final Size LARGE = new Size(_large);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class State extends Property {
-        private static final byte SHIFT = Size.SHIFT + Size.SIZE;
-        private static final byte SIZE = 4;
-        private static final long MASK = (long)0xF << SHIFT;
+        @Native private static final byte SHIFT = Size.SHIFT + Size.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
         private static final PropertyEncoding state = new PropertyEncoding(MASK, SHIFT);
 
         State(final byte value) {
             super(state, value);
         }
 
-        private static final byte _active = 1;
+        @Native private static final byte _active = 1;
         public static final State ACTIVE = new State(_active);
-        private static final byte _inactive = 2;
+        @Native private static final byte _inactive = 2;
         public static final State INACTIVE = new State(_inactive);
-        private static final byte _disabled = 3;
+        @Native private static final byte _disabled = 3;
         public static final State DISABLED = new State(_disabled);
-        private static final byte _pressed = 4;
+        @Native private static final byte _pressed = 4;
         public static final State PRESSED = new State(_pressed);
-        private static final byte _pulsed = 5;
+        @Native private static final byte _pulsed = 5;
         public static final State PULSED = new State(_pulsed);
-        private static final byte _rollover = 6;
+        @Native private static final byte _rollover = 6;
         public static final State ROLLOVER = new State(_rollover);
-        private static final byte _drag = 7;
+        @Native private static final byte _drag = 7;
         public static final State DRAG = new State(_drag);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Direction extends Property {
-        private static final byte SHIFT = State.SHIFT + State.SIZE;
-        private static final byte SIZE = 4;
-        private static final long MASK = (long)0xF << SHIFT;
+        @Native private static final byte SHIFT = State.SHIFT + State.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
         private static final PropertyEncoding direction = new PropertyEncoding(MASK, SHIFT);
 
         Direction(final byte value) {
             super(direction, value);
         }
 
-        private static final byte _none = 1;
+        @Native private static final byte _none = 1;
         public static final Direction NONE = new Direction(_none);
-        private static final byte _up = 2;
+        @Native private static final byte _up = 2;
         public static final Direction UP = new Direction(_up);
-        private static final byte _down = 3;
+        @Native private static final byte _down = 3;
         public static final Direction DOWN = new Direction(_down);
-        private static final byte _left = 4;
+        @Native private static final byte _left = 4;
         public static final Direction LEFT = new Direction(_left);
-        private static final byte _right = 5;
+        @Native private static final byte _right = 5;
         public static final Direction RIGHT = new Direction(_right);
-        private static final byte _north = 6;
+        @Native private static final byte _north = 6;
         public static final Direction NORTH = new Direction(_north);
-        private static final byte _south = 7;
+        @Native private static final byte _south = 7;
         public static final Direction SOUTH = new Direction(_south);
-        private static final byte _east = 8;
+        @Native private static final byte _east = 8;
         public static final Direction EAST = new Direction(_east);
-        private static final byte _west = 9;
+        @Native private static final byte _west = 9;
         public static final Direction WEST = new Direction(_west);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Orientation extends Property {
-        private static final byte SHIFT = Direction.SHIFT + Direction.SIZE;
-        private static final byte SIZE = 2;
-        private static final long MASK = (long)0x3 << SHIFT;
+        @Native private static final byte SHIFT = Direction.SHIFT + Direction.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
         private static final PropertyEncoding orientation = new PropertyEncoding(MASK, SHIFT);
 
         Orientation(final byte value) {
             super(orientation, value);
         }
 
-        private static final byte _horizontal = 1;
+        @Native private static final byte _horizontal = 1;
         public static final Orientation HORIZONTAL = new Orientation(_horizontal);
-        private static final byte _vertical = 2;
+        @Native private static final byte _vertical = 2;
         public static final Orientation VERTICAL = new Orientation(_vertical);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class AlignmentVertical extends Property {
-        private static final byte SHIFT = Orientation.SHIFT + Orientation.SIZE;
-        private static final byte SIZE = 2;
-        private static final long MASK = (long)0x3 << SHIFT;
+        @Native private static final byte SHIFT = Orientation.SHIFT + Orientation.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
         private static final PropertyEncoding alignmentVertical = new PropertyEncoding(MASK, SHIFT);
 
         AlignmentVertical(final byte value){
             super(alignmentVertical, value);
         }
 
-        private static final byte _top = 1;
+        @Native private static final byte _top = 1;
         public static final AlignmentVertical TOP = new AlignmentVertical(_top);
-        private static final byte _center = 2;
+        @Native private static final byte _center = 2;
         public static final AlignmentVertical CENTER = new AlignmentVertical(_center);
-        private static final byte _bottom = 3;
+        @Native private static final byte _bottom = 3;
         public static final AlignmentVertical BOTTOM = new AlignmentVertical(_bottom);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class AlignmentHorizontal extends Property {
-        private static final byte SHIFT = AlignmentVertical.SHIFT + AlignmentVertical.SIZE;
-        private static final byte SIZE = 2;
-        private static final long MASK = (long)0x3 << SHIFT;
+        @Native private static final byte SHIFT = AlignmentVertical.SHIFT + AlignmentVertical.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
         private static final PropertyEncoding alignmentHorizontal = new PropertyEncoding(MASK, SHIFT);
 
         AlignmentHorizontal(final byte value){
             super(alignmentHorizontal, value);
         }
 
-        private static final byte _left = 1;
+        @Native private static final byte _left = 1;
         public static final AlignmentHorizontal LEFT = new AlignmentHorizontal(_left);
-        private static final byte _center =  2;
+        @Native private static final byte _center =  2;
         public static final AlignmentHorizontal CENTER = new AlignmentHorizontal(_center);
-        private static final byte _right = 3;
+        @Native private static final byte _right = 3;
         public static final AlignmentHorizontal RIGHT = new AlignmentHorizontal(_right);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class SegmentPosition extends Property {
-        private static final byte SHIFT = AlignmentHorizontal.SHIFT + AlignmentHorizontal.SIZE;
-        private static final byte SIZE = 3;
-        private static final long MASK = (long)0x7 << SHIFT;
+        @Native private static final byte SHIFT = AlignmentHorizontal.SHIFT + AlignmentHorizontal.SIZE;
+        @Native private static final byte SIZE = 3;
+        @Native private static final long MASK = (long)0x7 << SHIFT;
         private static final PropertyEncoding segmentPosition = new PropertyEncoding(MASK, SHIFT);
 
         SegmentPosition(final byte value) {
             super(segmentPosition, value);
         }
 
-        private static final byte _first = 1;
+        @Native private static final byte _first = 1;
         public static final SegmentPosition FIRST = new SegmentPosition(_first);
-        private static final byte _middle = 2;
+        @Native private static final byte _middle = 2;
         public static final SegmentPosition MIDDLE = new SegmentPosition(_middle);
-        private static final byte _last = 3;
+        @Native private static final byte _last = 3;
         public static final SegmentPosition LAST = new SegmentPosition(_last);
-        private static final byte _only = 4;
+        @Native private static final byte _only = 4;
         public static final SegmentPosition ONLY = new SegmentPosition(_only);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class ScrollBarPart extends Property {
-        private static final byte SHIFT = SegmentPosition.SHIFT + SegmentPosition.SIZE;
-        private static final byte SIZE = 4;
-        private static final long MASK = (long)0xF << SHIFT;
+        @Native private static final byte SHIFT = SegmentPosition.SHIFT + SegmentPosition.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
         private static final PropertyEncoding scrollBarPart = new PropertyEncoding(MASK, SHIFT);
 
         ScrollBarPart(final byte value) {
             super(scrollBarPart, value);
         }
 
-        private static final byte _none = 1;
+        @Native private static final byte _none = 1;
         public static final ScrollBarPart NONE = new ScrollBarPart(_none);
-        private static final byte _thumb = 2;
+        @Native private static final byte _thumb = 2;
         public static final ScrollBarPart THUMB = new ScrollBarPart(_thumb);
-        private static final byte _arrowMin = 3;
+        @Native private static final byte _arrowMin = 3;
         public static final ScrollBarPart ARROW_MIN = new ScrollBarPart(_arrowMin);
-        private static final byte _arrowMax = 4;
+        @Native private static final byte _arrowMax = 4;
         public static final ScrollBarPart ARROW_MAX = new ScrollBarPart(_arrowMax);
-        private static final byte _arrowMaxInside = 5;
+        @Native private static final byte _arrowMaxInside = 5;
         public static final ScrollBarPart ARROW_MAX_INSIDE = new ScrollBarPart(_arrowMaxInside);
-        private static final byte _arrowMinInside = 6;
+        @Native private static final byte _arrowMinInside = 6;
         public static final ScrollBarPart ARROW_MIN_INSIDE = new ScrollBarPart(_arrowMinInside);
-        private static final byte _trackMin = 7;
+        @Native private static final byte _trackMin = 7;
         public static final ScrollBarPart TRACK_MIN = new ScrollBarPart(_trackMin);
-        private static final byte _trackMax = 8;
+        @Native private static final byte _trackMax = 8;
         public static final ScrollBarPart TRACK_MAX = new ScrollBarPart(_trackMax);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Variant extends Property {
-        private static final byte SHIFT = ScrollBarPart.SHIFT + ScrollBarPart.SIZE;
-        private static final byte SIZE = 4;
-        private static final long MASK = (long)0xF << SHIFT;
+        @Native private static final byte SHIFT = ScrollBarPart.SHIFT + ScrollBarPart.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
         private static final PropertyEncoding variant = new PropertyEncoding(MASK, SHIFT);
 
         Variant(final byte value) {
             super(variant, value);
         }
 
-        private static final byte _menuGlyph = 1;
+        @Native private static final byte _menuGlyph = 1;
         public static final Variant MENU_GLYPH = new Variant(_menuGlyph);
-        private static final byte _menuPopup = Variant._menuGlyph + 1;
+        @Native private static final byte _menuPopup = Variant._menuGlyph + 1;
         public static final Variant MENU_POPUP = new Variant(_menuPopup);
-        private static final byte _menuPulldown = Variant._menuPopup + 1;
+        @Native private static final byte _menuPulldown = Variant._menuPopup + 1;
         public static final Variant MENU_PULLDOWN = new Variant(_menuPulldown);
-        private static final byte _menuHierarchical = Variant._menuPulldown + 1;
+        @Native private static final byte _menuHierarchical = Variant._menuPulldown + 1;
         public static final Variant MENU_HIERARCHICAL = new Variant(_menuHierarchical);
 
-        private static final byte _gradientListBackgroundEven = Variant._menuHierarchical + 1;
+        @Native private static final byte _gradientListBackgroundEven = Variant._menuHierarchical + 1;
         public static final Variant GRADIENT_LIST_BACKGROUND_EVEN = new Variant(_gradientListBackgroundEven);
-        private static final byte _gradientListBackgroundOdd = Variant._gradientListBackgroundEven + 1;
+        @Native private static final byte _gradientListBackgroundOdd = Variant._gradientListBackgroundEven + 1;
         public static final Variant GRADIENT_LIST_BACKGROUND_ODD = new Variant(_gradientListBackgroundOdd);
-        private static final byte _gradientSideBar = Variant._gradientListBackgroundOdd + 1;
+        @Native private static final byte _gradientSideBar = Variant._gradientListBackgroundOdd + 1;
         public static final Variant GRADIENT_SIDE_BAR = new Variant(_gradientSideBar);
-        private static final byte _gradientSideBarSelection = Variant._gradientSideBar + 1;
+        @Native private static final byte _gradientSideBarSelection = Variant._gradientSideBar + 1;
         public static final Variant GRADIENT_SIDE_BAR_SELECTION = new Variant(_gradientSideBarSelection);
-        private static final byte _gradientSideBarFocusedSelection = Variant._gradientSideBarSelection + 1;
+        @Native private static final byte _gradientSideBarFocusedSelection = Variant._gradientSideBarSelection + 1;
         public static final Variant GRADIENT_SIDE_BAR_FOCUSED_SELECTION = new Variant(_gradientSideBarFocusedSelection);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class WindowType extends Property {
-        private static final byte SHIFT = Variant.SHIFT + Variant.SIZE;
-        private static final byte SIZE = 2;
-        private static final long MASK = (long)0x3 << SHIFT;
+        @Native private static final byte SHIFT = Variant.SHIFT + Variant.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
         private static final PropertyEncoding windowType = new PropertyEncoding(MASK, SHIFT);
 
         WindowType(final byte value){
             super(windowType, value);
         }
 
-        private static final byte _document = 1;
+        @Native private static final byte _document = 1;
         public static final WindowType DOCUMENT = new WindowType(_document);
-        private static final byte _utility = 2;
+        @Native private static final byte _utility = 2;
         public static final WindowType UTILITY = new WindowType(_utility);
-        private static final byte _titlelessUtility = 3;
+        @Native private static final byte _titlelessUtility = 3;
         public static final WindowType TITLELESS_UTILITY = new WindowType(_titlelessUtility);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Focused extends Property {
-        private static final byte SHIFT = WindowType.SHIFT + WindowType.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = WindowType.SHIFT + WindowType.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
 
         Focused(final byte value) {
             super(focused, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final Focused NO = new Focused(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final Focused YES = new Focused(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class IndicatorOnly extends Property {
-        private static final byte SHIFT = Focused.SHIFT + Focused.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = Focused.SHIFT + Focused.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding indicatorOnly = new PropertyEncoding(MASK, SHIFT);
 
         IndicatorOnly(final byte value) {
             super(indicatorOnly, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final IndicatorOnly NO = new IndicatorOnly(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final IndicatorOnly YES = new IndicatorOnly(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class NoIndicator extends Property {
-        private static final byte SHIFT = IndicatorOnly.SHIFT + IndicatorOnly.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = IndicatorOnly.SHIFT + IndicatorOnly.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding noIndicator = new PropertyEncoding(MASK, SHIFT);
 
         NoIndicator(final byte value) {
             super(noIndicator, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final NoIndicator NO = new NoIndicator(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final NoIndicator YES = new NoIndicator(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class ArrowsOnly extends Property {
-        private static final byte SHIFT = NoIndicator.SHIFT + NoIndicator.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = NoIndicator.SHIFT + NoIndicator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
 
         ArrowsOnly(final byte value) {
             super(focused, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final ArrowsOnly NO = new ArrowsOnly(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final ArrowsOnly YES = new ArrowsOnly(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class FrameOnly extends Property {
-        private static final byte SHIFT = ArrowsOnly.SHIFT + ArrowsOnly.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = ArrowsOnly.SHIFT + ArrowsOnly.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
 
         FrameOnly(final byte value) {
             super(focused, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final FrameOnly NO = new FrameOnly(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final FrameOnly YES = new FrameOnly(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class SegmentTrailingSeparator extends Property {
-        private static final byte SHIFT = FrameOnly.SHIFT + FrameOnly.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = FrameOnly.SHIFT + FrameOnly.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
 
         SegmentTrailingSeparator(final byte value) {
             super(focused, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final SegmentTrailingSeparator NO = new SegmentTrailingSeparator(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final SegmentTrailingSeparator YES = new SegmentTrailingSeparator(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class SegmentLeadingSeparator extends Property {
-        private static final byte SHIFT = SegmentTrailingSeparator.SHIFT + SegmentTrailingSeparator.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = SegmentTrailingSeparator.SHIFT + SegmentTrailingSeparator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding leadingSeparator = new PropertyEncoding(MASK, SHIFT);
 
         SegmentLeadingSeparator(final byte value) {
             super(leadingSeparator, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final SegmentLeadingSeparator NO = new SegmentLeadingSeparator(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final SegmentLeadingSeparator YES = new SegmentLeadingSeparator(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class NothingToScroll extends Property {
-        private static final byte SHIFT = SegmentLeadingSeparator.SHIFT + SegmentLeadingSeparator.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = SegmentLeadingSeparator.SHIFT + SegmentLeadingSeparator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
 
         NothingToScroll(final byte value) {
             super(focused, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final NothingToScroll NO = new NothingToScroll(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final NothingToScroll YES = new NothingToScroll(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class WindowTitleBarSeparator extends Property {
-        private static final byte SHIFT = NothingToScroll.SHIFT + NothingToScroll.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = NothingToScroll.SHIFT + NothingToScroll.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
 
         WindowTitleBarSeparator(final byte value) {
             super(focused, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final WindowTitleBarSeparator NO = new WindowTitleBarSeparator(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final WindowTitleBarSeparator YES = new WindowTitleBarSeparator(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class WindowClipCorners extends Property {
-        private static final byte SHIFT = WindowTitleBarSeparator.SHIFT + WindowTitleBarSeparator.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = WindowTitleBarSeparator.SHIFT + WindowTitleBarSeparator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
 
         WindowClipCorners(final byte value) {
             super(focused, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final WindowClipCorners NO = new WindowClipCorners(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final WindowClipCorners YES = new WindowClipCorners(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class ShowArrows extends Property {
-        private static final byte SHIFT = WindowClipCorners.SHIFT + WindowClipCorners.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = WindowClipCorners.SHIFT + WindowClipCorners.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding showArrows = new PropertyEncoding(MASK, SHIFT);
 
         ShowArrows(final byte value) {
             super(showArrows, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final ShowArrows NO = new ShowArrows(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final ShowArrows YES = new ShowArrows(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class BooleanValue extends Property {
-        private static final byte SHIFT = ShowArrows.SHIFT + ShowArrows.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = ShowArrows.SHIFT + ShowArrows.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding booleanValue = new PropertyEncoding(MASK, SHIFT);
 
         BooleanValue(final byte value) {
             super(booleanValue, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final BooleanValue NO = new BooleanValue(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final BooleanValue YES = new BooleanValue(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Animating extends Property {
-        private static final byte SHIFT = BooleanValue.SHIFT + BooleanValue.SIZE;
-        private static final byte SIZE = 1;
-        private static final long MASK = (long)0x1 << SHIFT;
+        @Native private static final byte SHIFT = BooleanValue.SHIFT + BooleanValue.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
         private static final PropertyEncoding animating = new PropertyEncoding(MASK, SHIFT);
 
         Animating(final byte value) {
             super(animating, value);
         }
 
-        private static final byte _no = 0;
+        @Native private static final byte _no = 0;
         public static final Animating NO = new Animating(_no);
-        private static final byte _yes = 1;
+        @Native private static final byte _yes = 1;
         public static final Animating YES = new Animating(_yes);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Widget extends Property {
-        private static final byte SHIFT = Animating.SHIFT + Animating.SIZE;
-        private static final byte SIZE = 7;
-        private static final long MASK = (long)0x7F << SHIFT;
+        @Native private static final byte SHIFT = Animating.SHIFT + Animating.SIZE;
+        @Native private static final byte SIZE = 7;
+        @Native private static final long MASK = (long)0x7F << SHIFT;
         private static final PropertyEncoding widget = new PropertyEncoding(MASK, SHIFT);
 
         Widget(final byte constant) {
             super(widget, constant);
         }
 
-        private static final byte _background = 1;
+        @Native private static final byte _background = 1;
         public static final Widget BACKGROUND = new Widget(_background);
 
-        private static final byte _buttonBevel = _background + 1;
+        @Native private static final byte _buttonBevel = _background + 1;
         public static final Widget BUTTON_BEVEL = new Widget(_buttonBevel);
-        private static final byte _buttonBevelInset = _buttonBevel + 1;
+        @Native private static final byte _buttonBevelInset = _buttonBevel + 1;
         public static final Widget BUTTON_BEVEL_INSET = new Widget(_buttonBevelInset);
-        private static final byte _buttonBevelRound = _buttonBevelInset + 1;
+        @Native private static final byte _buttonBevelRound = _buttonBevelInset + 1;
         public static final Widget BUTTON_BEVEL_ROUND = new Widget(_buttonBevelRound);
 
-        private static final byte _buttonCheckBox = _buttonBevelRound + 1;
+        @Native private static final byte _buttonCheckBox = _buttonBevelRound + 1;
         public static final Widget BUTTON_CHECK_BOX = new Widget(_buttonCheckBox);
 
-        private static final byte _buttonComboBox = _buttonCheckBox + 1;
+        @Native private static final byte _buttonComboBox = _buttonCheckBox + 1;
         public static final Widget BUTTON_COMBO_BOX = new Widget(_buttonComboBox);
-        private static final byte _buttonComboBoxInset = _buttonComboBox + 1;
+        @Native private static final byte _buttonComboBoxInset = _buttonComboBox + 1;
         public static final Widget BUTTON_COMBO_BOX_INSET = new Widget(_buttonComboBoxInset); // not hooked up in JRSUIConstants.m
 
-        private static final byte _buttonDisclosure = _buttonComboBoxInset + 1;
+        @Native private static final byte _buttonDisclosure = _buttonComboBoxInset + 1;
         public static final Widget BUTTON_DISCLOSURE = new Widget(_buttonDisclosure);
 
-        private static final byte _buttonListHeader = _buttonDisclosure + 1;
+        @Native private static final byte _buttonListHeader = _buttonDisclosure + 1;
         public static final Widget BUTTON_LIST_HEADER = new Widget(_buttonListHeader);
 
-        private static final byte _buttonLittleArrows = _buttonListHeader + 1;
+        @Native private static final byte _buttonLittleArrows = _buttonListHeader + 1;
         public static final Widget BUTTON_LITTLE_ARROWS = new Widget(_buttonLittleArrows);
 
-        private static final byte _buttonPopDown = _buttonLittleArrows + 1;
+        @Native private static final byte _buttonPopDown = _buttonLittleArrows + 1;
         public static final Widget BUTTON_POP_DOWN = new Widget(_buttonPopDown);
-        private static final byte _buttonPopDownInset = _buttonPopDown + 1;
+        @Native private static final byte _buttonPopDownInset = _buttonPopDown + 1;
         public static final Widget BUTTON_POP_DOWN_INSET = new Widget(_buttonPopDownInset);
-        private static final byte _buttonPopDownSquare = _buttonPopDownInset + 1;
+        @Native private static final byte _buttonPopDownSquare = _buttonPopDownInset + 1;
         public static final Widget BUTTON_POP_DOWN_SQUARE = new Widget(_buttonPopDownSquare);
 
-        private static final byte _buttonPopUp = _buttonPopDownSquare + 1;
+        @Native private static final byte _buttonPopUp = _buttonPopDownSquare + 1;
         public static final Widget BUTTON_POP_UP = new Widget(_buttonPopUp);
-        private static final byte _buttonPopUpInset = _buttonPopUp + 1;
+        @Native private static final byte _buttonPopUpInset = _buttonPopUp + 1;
         public static final Widget BUTTON_POP_UP_INSET = new Widget(_buttonPopUpInset);
-        private static final byte _buttonPopUpSquare = _buttonPopUpInset + 1;
+        @Native private static final byte _buttonPopUpSquare = _buttonPopUpInset + 1;
         public static final Widget BUTTON_POP_UP_SQUARE = new Widget(_buttonPopUpSquare);
 
-        private static final byte _buttonPush = _buttonPopUpSquare + 1;
+        @Native private static final byte _buttonPush = _buttonPopUpSquare + 1;
         public static final Widget BUTTON_PUSH = new Widget(_buttonPush);
-        private static final byte _buttonPushScope = _buttonPush + 1;
+        @Native private static final byte _buttonPushScope = _buttonPush + 1;
         public static final Widget BUTTON_PUSH_SCOPE = new Widget(_buttonPushScope);
-        private static final byte _buttonPushScope2 = _buttonPushScope + 1;
+        @Native private static final byte _buttonPushScope2 = _buttonPushScope + 1;
         public static final Widget BUTTON_PUSH_SCOPE2 = new Widget(_buttonPushScope2);
-        private static final byte _buttonPushTextured = _buttonPushScope2 + 1;
+        @Native private static final byte _buttonPushTextured = _buttonPushScope2 + 1;
         public static final Widget BUTTON_PUSH_TEXTURED = new Widget(_buttonPushTextured);
-        private static final byte _buttonPushInset = _buttonPushTextured + 1;
+        @Native private static final byte _buttonPushInset = _buttonPushTextured + 1;
         public static final Widget BUTTON_PUSH_INSET = new Widget(_buttonPushInset);
-        private static final byte _buttonPushInset2 = _buttonPushInset + 1;
+        @Native private static final byte _buttonPushInset2 = _buttonPushInset + 1;
         public static final Widget BUTTON_PUSH_INSET2 = new Widget(_buttonPushInset2);
 
-        private static final byte _buttonRadio = _buttonPushInset2 + 1;
+        @Native private static final byte _buttonRadio = _buttonPushInset2 + 1;
         public static final Widget BUTTON_RADIO = new Widget(_buttonRadio);
 
-        private static final byte _buttonRound = _buttonRadio + 1;
+        @Native private static final byte _buttonRound = _buttonRadio + 1;
         public static final Widget BUTTON_ROUND = new Widget(_buttonRound);
-        private static final byte _buttonRoundHelp = _buttonRound + 1;
+        @Native private static final byte _buttonRoundHelp = _buttonRound + 1;
         public static final Widget BUTTON_ROUND_HELP = new Widget(_buttonRoundHelp);
-        private static final byte _buttonRoundInset = _buttonRoundHelp + 1;
+        @Native private static final byte _buttonRoundInset = _buttonRoundHelp + 1;
         public static final Widget BUTTON_ROUND_INSET = new Widget(_buttonRoundInset);
-        private static final byte _buttonRoundInset2 =_buttonRoundInset + 1;
+        @Native private static final byte _buttonRoundInset2 =_buttonRoundInset + 1;
         public static final Widget BUTTON_ROUND_INSET2 = new Widget(_buttonRoundInset2);
 
-        private static final byte _buttonSearchFieldCancel = _buttonRoundInset2 + 1;
+        @Native private static final byte _buttonSearchFieldCancel = _buttonRoundInset2 + 1;
         public static final Widget BUTTON_SEARCH_FIELD_CANCEL = new Widget(_buttonSearchFieldCancel);
-        private static final byte _buttonSearchFieldFind = _buttonSearchFieldCancel + 1;
+        @Native private static final byte _buttonSearchFieldFind = _buttonSearchFieldCancel + 1;
         public static final Widget BUTTON_SEARCH_FIELD_FIND = new Widget(_buttonSearchFieldFind);
 
-        private static final byte _buttonSegmented = _buttonSearchFieldFind + 1;
+        @Native private static final byte _buttonSegmented = _buttonSearchFieldFind + 1;
         public static final Widget BUTTON_SEGMENTED = new Widget(_buttonSegmented);
-        private static final byte _buttonSegmentedInset = _buttonSegmented + 1;
+        @Native private static final byte _buttonSegmentedInset = _buttonSegmented + 1;
         public static final Widget BUTTON_SEGMENTED_INSET = new Widget(_buttonSegmentedInset);
-        private static final byte _buttonSegmentedInset2 = _buttonSegmentedInset + 1;
+        @Native private static final byte _buttonSegmentedInset2 = _buttonSegmentedInset + 1;
         public static final Widget BUTTON_SEGMENTED_INSET2 = new Widget(_buttonSegmentedInset2);
-        private static final byte _buttonSegmentedSCurve = _buttonSegmentedInset2 + 1;
+        @Native private static final byte _buttonSegmentedSCurve = _buttonSegmentedInset2 + 1;
         public static final Widget BUTTON_SEGMENTED_SCURVE = new Widget(_buttonSegmentedSCurve);
-        private static final byte _buttonSegmentedTextured = _buttonSegmentedSCurve + 1;
+        @Native private static final byte _buttonSegmentedTextured = _buttonSegmentedSCurve + 1;
         public static final Widget BUTTON_SEGMENTED_TEXTURED = new Widget(_buttonSegmentedTextured);
-        private static final byte _buttonSegmentedToolbar = _buttonSegmentedTextured + 1;
+        @Native private static final byte _buttonSegmentedToolbar = _buttonSegmentedTextured + 1;
         public static final Widget BUTTON_SEGMENTED_TOOLBAR = new Widget(_buttonSegmentedToolbar);
 
-        private static final byte _dial = _buttonSegmentedToolbar + 1;
+        @Native private static final byte _dial = _buttonSegmentedToolbar + 1;
         public static final Widget DIAL = new Widget(_dial);
 
-        private static final byte _disclosureTriangle = _dial + 1;
+        @Native private static final byte _disclosureTriangle = _dial + 1;
         public static final Widget DISCLOSURE_TRIANGLE = new Widget(_disclosureTriangle);
 
-        private static final byte _dividerGrabber = _disclosureTriangle + 1;
+        @Native private static final byte _dividerGrabber = _disclosureTriangle + 1;
         public static final Widget DIVIDER_GRABBER = new Widget(_dividerGrabber);
-        private static final byte _dividerSeparatorBar = _dividerGrabber + 1;
+        @Native private static final byte _dividerSeparatorBar = _dividerGrabber + 1;
         public static final Widget DIVIDER_SEPARATOR_BAR = new Widget(_dividerSeparatorBar);
-        private static final byte _dividerSplitter = _dividerSeparatorBar + 1;
+        @Native private static final byte _dividerSplitter = _dividerSeparatorBar + 1;
         public static final Widget DIVIDER_SPLITTER = new Widget(_dividerSplitter);
 
-        private static final byte _focus = _dividerSplitter + 1;
+        @Native private static final byte _focus = _dividerSplitter + 1;
         public static final Widget FOCUS = new Widget(_focus);
 
-        private static final byte _frameGroupBox = _focus + 1;
+        @Native private static final byte _frameGroupBox = _focus + 1;
         public static final Widget FRAME_GROUP_BOX = new Widget(_frameGroupBox);
-        private static final byte _frameGroupBoxSecondary = _frameGroupBox + 1;
+        @Native private static final byte _frameGroupBoxSecondary = _frameGroupBox + 1;
         public static final Widget FRAME_GROUP_BOX_SECONDARY = new Widget(_frameGroupBoxSecondary);
 
-        private static final byte _frameListBox = _frameGroupBoxSecondary + 1;
+        @Native private static final byte _frameListBox = _frameGroupBoxSecondary + 1;
         public static final Widget FRAME_LIST_BOX = new Widget(_frameListBox);
 
-        private static final byte _framePlacard = _frameListBox + 1;
+        @Native private static final byte _framePlacard = _frameListBox + 1;
         public static final Widget FRAME_PLACARD = new Widget(_framePlacard);
 
-        private static final byte _frameTextField = _framePlacard + 1;
+        @Native private static final byte _frameTextField = _framePlacard + 1;
         public static final Widget FRAME_TEXT_FIELD = new Widget(_frameTextField);
-        private static final byte _frameTextFieldRound = _frameTextField + 1;
+        @Native private static final byte _frameTextFieldRound = _frameTextField + 1;
         public static final Widget FRAME_TEXT_FIELD_ROUND = new Widget(_frameTextFieldRound);
 
-        private static final byte _frameWell = _frameTextFieldRound + 1;
+        @Native private static final byte _frameWell = _frameTextFieldRound + 1;
         public static final Widget FRAME_WELL = new Widget(_frameWell);
 
-        private static final byte _growBox = _frameWell + 1;
+        @Native private static final byte _growBox = _frameWell + 1;
         public static final Widget GROW_BOX = new Widget(_growBox);
-        private static final byte _growBoxTextured = _growBox + 1;
+        @Native private static final byte _growBoxTextured = _growBox + 1;
         public static final Widget GROW_BOX_TEXTURED = new Widget(_growBoxTextured);
 
-        private static final byte _gradient = _growBoxTextured + 1;
+        @Native private static final byte _gradient = _growBoxTextured + 1;
         public static final Widget GRADIENT = new Widget(_gradient);
 
-        private static final byte _menu = _gradient + 1;
+        @Native private static final byte _menu = _gradient + 1;
         public static final Widget MENU = new Widget(_menu);
-        private static final byte _menuItem = _menu + 1;
+        @Native private static final byte _menuItem = _menu + 1;
         public static final Widget MENU_ITEM = new Widget(_menuItem);
-        private static final byte _menuBar = _menuItem + 1;
+        @Native private static final byte _menuBar = _menuItem + 1;
         public static final Widget MENU_BAR = new Widget(_menuBar);
-        private static final byte _menuTitle = _menuBar + 1;
+        @Native private static final byte _menuTitle = _menuBar + 1;
         public static final Widget MENU_TITLE = new Widget(_menuTitle);
 
-        private static final byte _progressBar = _menuTitle + 1;
+        @Native private static final byte _progressBar = _menuTitle + 1;
         public static final Widget PROGRESS_BAR = new Widget(_progressBar);
-        private static final byte _progressIndeterminateBar = _progressBar + 1;
+        @Native private static final byte _progressIndeterminateBar = _progressBar + 1;
         public static final Widget PROGRESS_INDETERMINATE_BAR = new Widget(_progressIndeterminateBar);
-        private static final byte _progressRelevance = _progressIndeterminateBar + 1;
+        @Native private static final byte _progressRelevance = _progressIndeterminateBar + 1;
         public static final Widget PROGRESS_RELEVANCE = new Widget(_progressRelevance);
-        private static final byte _progressSpinner = _progressRelevance + 1;
+        @Native private static final byte _progressSpinner = _progressRelevance + 1;
         public static final Widget PROGRESS_SPINNER = new Widget(_progressSpinner);
 
-        private static final byte _scrollBar = _progressSpinner + 1;
+        @Native private static final byte _scrollBar = _progressSpinner + 1;
         public static final Widget SCROLL_BAR = new Widget(_scrollBar);
 
-        private static final byte _scrollColumnSizer = _scrollBar + 1;
+        @Native private static final byte _scrollColumnSizer = _scrollBar + 1;
         public static final Widget SCROLL_COLUMN_SIZER = new Widget(_scrollColumnSizer);
 
-        private static final byte _slider = _scrollColumnSizer + 1;
+        @Native private static final byte _slider = _scrollColumnSizer + 1;
         public static final Widget SLIDER = new Widget(_slider);
-        private static final byte _sliderThumb = _slider + 1;
+        @Native private static final byte _sliderThumb = _slider + 1;
         public static final Widget SLIDER_THUMB = new Widget(_sliderThumb);
 
-        private static final byte _synchronization = _sliderThumb + 1;
+        @Native private static final byte _synchronization = _sliderThumb + 1;
         public static final Widget SYNCHRONIZATION = new Widget(_synchronization);
 
-        private static final byte _tab = _synchronization + 1;
+        @Native private static final byte _tab = _synchronization + 1;
         public static final Widget TAB = new Widget(_tab);
 
-        private static final byte _titleBarCloseBox = _tab + 1;
+        @Native private static final byte _titleBarCloseBox = _tab + 1;
         public static final Widget TITLE_BAR_CLOSE_BOX = new Widget(_titleBarCloseBox);
-        private static final byte _titleBarCollapseBox = _titleBarCloseBox + 1;
+        @Native private static final byte _titleBarCollapseBox = _titleBarCloseBox + 1;
         public static final Widget TITLE_BAR_COLLAPSE_BOX = new Widget(_titleBarCollapseBox);
-        private static final byte _titleBarZoomBox = _titleBarCollapseBox + 1;
+        @Native private static final byte _titleBarZoomBox = _titleBarCollapseBox + 1;
         public static final Widget TITLE_BAR_ZOOM_BOX = new Widget(_titleBarZoomBox);
 
-        private static final byte _titleBarToolbarButton = _titleBarZoomBox + 1;
+        @Native private static final byte _titleBarToolbarButton = _titleBarZoomBox + 1;
         public static final Widget TITLE_BAR_TOOLBAR_BUTTON = new Widget(_titleBarToolbarButton);
 
-        private static final byte _toolbarItemWell = _titleBarToolbarButton + 1;
+        @Native private static final byte _toolbarItemWell = _titleBarToolbarButton + 1;
         public static final Widget TOOLBAR_ITEM_WELL = new Widget(_toolbarItemWell);
 
-        private static final byte _windowFrame = _toolbarItemWell + 1;
+        @Native private static final byte _windowFrame = _toolbarItemWell + 1;
         public static final Widget WINDOW_FRAME = new Widget(_windowFrame);
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Hit {
-        private static final int _unknown = -1;
+        @Native private static final int _unknown = -1;
         public static final Hit UNKNOWN = new Hit(_unknown);
-        private static final int _none = 0;
+        @Native private static final int _none = 0;
         public static final Hit NONE = new Hit(_none);
-        private static final int _hit = 1;
+        @Native private static final int _hit = 1;
         public static final Hit HIT = new Hit(_hit);
 
         final int hit;
@@ -831,24 +777,22 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class ScrollBarHit extends Hit {
-        private static final int _thumb = 2;
+        @Native private static final int _thumb = 2;
         public static final ScrollBarHit THUMB = new ScrollBarHit(_thumb);
 
-        private static final int _trackMin = 3;
+        @Native private static final int _trackMin = 3;
         public static final ScrollBarHit TRACK_MIN = new ScrollBarHit(_trackMin);
-        private static final int _trackMax = 4;
+        @Native private static final int _trackMax = 4;
         public static final ScrollBarHit TRACK_MAX = new ScrollBarHit(_trackMax);
 
-        private static final int _arrowMin = 5;
+        @Native private static final int _arrowMin = 5;
         public static final ScrollBarHit ARROW_MIN = new ScrollBarHit(_arrowMin);
-        private static final int _arrowMax = 6;
+        @Native private static final int _arrowMax = 6;
         public static final ScrollBarHit ARROW_MAX = new ScrollBarHit(_arrowMax);
-        private static final int _arrowMaxInside = 7;
+        @Native private static final int _arrowMaxInside = 7;
         public static final ScrollBarHit ARROW_MAX_INSIDE = new ScrollBarHit(_arrowMaxInside);
-        private static final int _arrowMinInside = 8;
+        @Native private static final int _arrowMinInside = 8;
         public static final ScrollBarHit ARROW_MIN_INSIDE = new ScrollBarHit(_arrowMinInside);
 
         ScrollBarHit(final int hit) { super(hit); }
diff --git a/jdk/src/macosx/classes/com/apple/eawt/FullScreenHandler.java b/jdk/src/macosx/classes/com/apple/eawt/FullScreenHandler.java
index 7ad9364..f5a843b 100644
--- a/jdk/src/macosx/classes/com/apple/eawt/FullScreenHandler.java
+++ b/jdk/src/macosx/classes/com/apple/eawt/FullScreenHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,17 +33,15 @@
 
 import com.apple.eawt.AppEvent.FullScreenEvent;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 final class FullScreenHandler {
     private static final String CLIENT_PROPERTY = "com.apple.eawt.event.internalFullScreenHandler";
 
-    static final int FULLSCREEN_WILL_ENTER = 1;
-    static final int FULLSCREEN_DID_ENTER = 2;
-    static final int FULLSCREEN_WILL_EXIT = 3;
-    static final int FULLSCREEN_DID_EXIT = 4;
+    @Native static final int FULLSCREEN_WILL_ENTER = 1;
+    @Native static final int FULLSCREEN_DID_ENTER = 2;
+    @Native static final int FULLSCREEN_WILL_EXIT = 3;
+    @Native static final int FULLSCREEN_DID_EXIT = 4;
 
     // installs a private instance of the handler, if necessary
     static void addFullScreenListenerTo(final RootPaneContainer window, final FullScreenListener listener) {
diff --git a/jdk/src/macosx/classes/com/apple/eawt/event/GestureHandler.java b/jdk/src/macosx/classes/com/apple/eawt/event/GestureHandler.java
index 3b4d54f..1378a2c 100644
--- a/jdk/src/macosx/classes/com/apple/eawt/event/GestureHandler.java
+++ b/jdk/src/macosx/classes/com/apple/eawt/event/GestureHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -31,18 +31,16 @@
 
 import javax.swing.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 final class GestureHandler {
     private static final String CLIENT_PROPERTY = "com.apple.eawt.event.internalGestureHandler";
 
     // native constants for the supported types of high-level gestures
-    static final int PHASE = 1;
-    static final int ROTATE = 2;
-    static final int MAGNIFY = 3;
-    static final int SWIPE = 4;
+    @Native static final int PHASE = 1;
+    @Native static final int ROTATE = 2;
+    @Native static final int MAGNIFY = 3;
+    @Native static final int SWIPE = 4;
 
     // installs a private instance of GestureHandler, if necessary
     static void addGestureListenerTo(final JComponent component, final GestureListener listener) {
diff --git a/jdk/src/macosx/classes/sun/java2d/OSXSurfaceData.java b/jdk/src/macosx/classes/sun/java2d/OSXSurfaceData.java
index 8844d5a..2592b65 100644
--- a/jdk/src/macosx/classes/sun/java2d/OSXSurfaceData.java
+++ b/jdk/src/macosx/classes/sun/java2d/OSXSurfaceData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -37,13 +37,11 @@
 import sun.java2d.pipe.*;
 import sun.lwawt.macosx.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /*
  * This is the SurfaceData for a CGContextRef.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class OSXSurfaceData extends BufImgSurfaceData {
     final static float UPPER_BND = Float.MAX_VALUE / 2.0f;
     final static float LOWER_BND = -UPPER_BND;
@@ -198,147 +196,147 @@
      // graphics primitives drawing implementation:
 
     // certain primitives don't care about all the states (ex. drawing an image needs not involve setting current paint)
-    static final int kPrimitive = 0;
-    static final int kImage = 1;
-    static final int kText = 2;
-    static final int kCopyArea = 3;
-    static final int kExternal = 4;
+    @Native static final int kPrimitive = 0;
+    @Native static final int kImage = 1;
+    @Native static final int kText = 2;
+    @Native static final int kCopyArea = 3;
+    @Native static final int kExternal = 4;
 
-    static final int kLine = 5; // belongs to kPrimitive
-    static final int kRect = 6; // belongs to kPrimitive
-    static final int kRoundRect = 7; // belongs to kPrimitive
-    static final int kOval = 8; // belongs to kPrimitive
-    static final int kArc = 9; // belongs to kPrimitive
-    static final int kPolygon = 10; // belongs to kPrimitive
-    static final int kShape = 11; // belongs to kPrimitive
+    @Native static final int kLine = 5; // belongs to kPrimitive
+    @Native static final int kRect = 6; // belongs to kPrimitive
+    @Native static final int kRoundRect = 7; // belongs to kPrimitive
+    @Native static final int kOval = 8; // belongs to kPrimitive
+    @Native static final int kArc = 9; // belongs to kPrimitive
+    @Native static final int kPolygon = 10; // belongs to kPrimitive
+    @Native static final int kShape = 11; // belongs to kPrimitive
     // static final int kImage = 12; // belongs to kImage
-    static final int kString = 13; // belongs to kText
-    static final int kGlyphs = 14; // belongs to kText
-    static final int kUnicodes = 15; // belongs to kText
+    @Native static final int kString = 13; // belongs to kText
+    @Native static final int kGlyphs = 14; // belongs to kText
+    @Native static final int kUnicodes = 15; // belongs to kText
     // static final int kCopyArea = 16; // belongs to kCopyArea
     // static final int kExternal = 17; // belongs to kExternal
 
-    static final int kCommonParameterCount = 1 + 1 + 4 + 4; // type + change flags + color info (type(1) align(1) and
+    @Native static final int kCommonParameterCount = 1 + 1 + 4 + 4; // type + change flags + color info (type(1) align(1) and
                                                             // value(2)) + parameters ((x1, y1, x2, y2) OR (x, y, w, h))
-    static final int kLineParametersCount = kCommonParameterCount; // kCommonParameterCount
-    static final int kRectParametersCount = kCommonParameterCount + 1; // kCommonParameterCount + isfill
-    static final int kRoundRectParametersCount = kCommonParameterCount + 2 + 1; // kCommonParameterCount + arcW + arcH +
+    @Native static final int kLineParametersCount = kCommonParameterCount; // kCommonParameterCount
+    @Native static final int kRectParametersCount = kCommonParameterCount + 1; // kCommonParameterCount + isfill
+    @Native static final int kRoundRectParametersCount = kCommonParameterCount + 2 + 1; // kCommonParameterCount + arcW + arcH +
                                                                                 // isfill
-    static final int kOvalParametersCount = kCommonParameterCount + 1; // kCommonParameterCount + isfill
-    static final int kArcParametersCount = kCommonParameterCount + 2 + 1 + 1;// kCommonParameterCount + startAngle +
+    @Native static final int kOvalParametersCount = kCommonParameterCount + 1; // kCommonParameterCount + isfill
+    @Native static final int kArcParametersCount = kCommonParameterCount + 2 + 1 + 1;// kCommonParameterCount + startAngle +
                                                                              // arcAngle + isfill + type
-    static final int kPolygonParametersCount = 0; // not supported
-    static final int kShapeParametersCount = 0; // not supported
-    static final int kImageParametersCount = kCommonParameterCount + 2 + 2 + 4 + 4; // flip horz vert + w&h + src + dst
-    static final int kStringParametersCount = 0; // not supported
-    static final int kGlyphsParametersCount = 0; // not supported
-    static final int kUnicodesParametersCount = 0; // not supported
-    static final int kPixelParametersCount = 0; // not supported
-    static final int kExternalParametersCount = 0; // not supported
+    @Native static final int kPolygonParametersCount = 0; // not supported
+    @Native static final int kShapeParametersCount = 0; // not supported
+    @Native static final int kImageParametersCount = kCommonParameterCount + 2 + 2 + 4 + 4; // flip horz vert + w&h + src + dst
+    @Native static final int kStringParametersCount = 0; // not supported
+    @Native static final int kGlyphsParametersCount = 0; // not supported
+    @Native static final int kUnicodesParametersCount = 0; // not supported
+    @Native static final int kPixelParametersCount = 0; // not supported
+    @Native static final int kExternalParametersCount = 0; // not supported
 
     // for intParameters
     // states info
-    static final int kChangeFlagIndex = 0; // kBoundsChangedBit | .. | kFontChangedBit
+    @Native static final int kChangeFlagIndex = 0; // kBoundsChangedBit | .. | kFontChangedBit
     // bounds info
-    static final int kBoundsXIndex = 1;
-    static final int kBoundsYIndex = 2;
-    static final int kBoundsWidthIndex = 3;
-    static final int kBoundsHeightIndex = 4;
+    @Native static final int kBoundsXIndex = 1;
+    @Native static final int kBoundsYIndex = 2;
+    @Native static final int kBoundsWidthIndex = 3;
+    @Native static final int kBoundsHeightIndex = 4;
     // clip info
-    static final int kClipStateIndex = 5;
-    static final int kClipNumTypesIndex = 6;
-    static final int kClipNumCoordsIndex = 7;
-    static final int kClipWindingRuleIndex = 8;
-    static final int kClipXIndex = 9;
-    static final int kClipYIndex = 10;
-    static final int kClipWidthIndex = 11;
-    static final int kClipHeightIndex = 12;
+    @Native static final int kClipStateIndex = 5;
+    @Native static final int kClipNumTypesIndex = 6;
+    @Native static final int kClipNumCoordsIndex = 7;
+    @Native static final int kClipWindingRuleIndex = 8;
+    @Native static final int kClipXIndex = 9;
+    @Native static final int kClipYIndex = 10;
+    @Native static final int kClipWidthIndex = 11;
+    @Native static final int kClipHeightIndex = 12;
     // ctm info
-    static final int kCTMaIndex = 13;
-    static final int kCTMbIndex = 14;
-    static final int kCTMcIndex = 15;
-    static final int kCTMdIndex = 16;
-    static final int kCTMtxIndex = 17;
-    static final int kCTMtyIndex = 18;
+    @Native static final int kCTMaIndex = 13;
+    @Native static final int kCTMbIndex = 14;
+    @Native static final int kCTMcIndex = 15;
+    @Native static final int kCTMdIndex = 16;
+    @Native static final int kCTMtxIndex = 17;
+    @Native static final int kCTMtyIndex = 18;
     // color info
-    static final int kColorStateIndex = 19; // kColorSimple or kColorGradient or kColorTexture
-    static final int kColorRGBValueIndex = 20; // if kColorSimple
-    static final int kColorIndexValueIndex = 21; // if kColorSystem
-    static final int kColorPointerIndex = 22; //
-    static final int kColorPointerIndex2 = 23; //
-    static final int kColorRGBValue1Index = 24; // if kColorGradient
-    static final int kColorWidthIndex = 25; // if kColorTexture
-    static final int kColorRGBValue2Index = 26; // if kColorGradient
-    static final int kColorHeightIndex = 27; // if kColorTexture
-    static final int kColorIsCyclicIndex = 28; // if kColorGradient (kColorNonCyclic or kColorCyclic)
-    static final int kColorx1Index = 29;
-    static final int kColortxIndex = 30;
-    static final int kColory1Index = 31;
-    static final int kColortyIndex = 32;
-    static final int kColorx2Index = 33;
-    static final int kColorsxIndex = 34;
-    static final int kColory2Index = 35;
-    static final int kColorsyIndex = 36;
+    @Native static final int kColorStateIndex = 19; // kColorSimple or kColorGradient or kColorTexture
+    @Native static final int kColorRGBValueIndex = 20; // if kColorSimple
+    @Native static final int kColorIndexValueIndex = 21; // if kColorSystem
+    @Native static final int kColorPointerIndex = 22; //
+    @Native static final int kColorPointerIndex2 = 23; //
+    @Native static final int kColorRGBValue1Index = 24; // if kColorGradient
+    @Native static final int kColorWidthIndex = 25; // if kColorTexture
+    @Native static final int kColorRGBValue2Index = 26; // if kColorGradient
+    @Native static final int kColorHeightIndex = 27; // if kColorTexture
+    @Native static final int kColorIsCyclicIndex = 28; // if kColorGradient (kColorNonCyclic or kColorCyclic)
+    @Native static final int kColorx1Index = 29;
+    @Native static final int kColortxIndex = 30;
+    @Native static final int kColory1Index = 31;
+    @Native static final int kColortyIndex = 32;
+    @Native static final int kColorx2Index = 33;
+    @Native static final int kColorsxIndex = 34;
+    @Native static final int kColory2Index = 35;
+    @Native static final int kColorsyIndex = 36;
     // composite info
-    static final int kCompositeRuleIndex = 37; // kCGCompositeClear or ... or kCGCompositeXor
-    static final int kCompositeValueIndex = 38;
+    @Native static final int kCompositeRuleIndex = 37; // kCGCompositeClear or ... or kCGCompositeXor
+    @Native static final int kCompositeValueIndex = 38;
     // stroke info
-    static final int kStrokeJoinIndex = 39; // see BasicStroke.java
-    static final int kStrokeCapIndex = 40; // see BasicStroke.java
-    static final int kStrokeWidthIndex = 41;
-    static final int kStrokeDashPhaseIndex = 42;
-    static final int kStrokeLimitIndex = 43;
+    @Native static final int kStrokeJoinIndex = 39; // see BasicStroke.java
+    @Native static final int kStrokeCapIndex = 40; // see BasicStroke.java
+    @Native static final int kStrokeWidthIndex = 41;
+    @Native static final int kStrokeDashPhaseIndex = 42;
+    @Native static final int kStrokeLimitIndex = 43;
     // hints info
-    static final int kHintsAntialiasIndex = 44;
-    static final int kHintsTextAntialiasIndex = 45;
-    static final int kHintsFractionalMetricsIndex = 46;
-    static final int kHintsRenderingIndex = 47;
-    static final int kHintsInterpolationIndex = 48;
+    @Native static final int kHintsAntialiasIndex = 44;
+    @Native static final int kHintsTextAntialiasIndex = 45;
+    @Native static final int kHintsFractionalMetricsIndex = 46;
+    @Native static final int kHintsRenderingIndex = 47;
+    @Native static final int kHintsInterpolationIndex = 48;
     // live resizing info
-    static final int kCanDrawDuringLiveResizeIndex = 49;
+    @Native static final int kCanDrawDuringLiveResizeIndex = 49;
 
-    static final int kSizeOfParameters = kCanDrawDuringLiveResizeIndex + 1;
+    @Native static final int kSizeOfParameters = kCanDrawDuringLiveResizeIndex + 1;
 
     // for objectParameters
-    static final int kClipCoordinatesIndex = 0;
-    static final int kClipTypesIndex = 1;
-    static final int kTextureImageIndex = 2;
-    static final int kStrokeDashArrayIndex = 3;
-    static final int kFontIndex = 4;
-    static final int kFontPaintIndex = 5;
+    @Native static final int kClipCoordinatesIndex = 0;
+    @Native static final int kClipTypesIndex = 1;
+    @Native static final int kTextureImageIndex = 2;
+    @Native static final int kStrokeDashArrayIndex = 3;
+    @Native static final int kFontIndex = 4;
+    @Native static final int kFontPaintIndex = 5;
 
     // possible state changes
-    static final int kBoundsChangedBit = 1 << 0;
-    static final int kBoundsNotChangedBit = ~kBoundsChangedBit;
-    static final int kClipChangedBit = 1 << 1;
-    static final int kClipNotChangedBit = ~kClipChangedBit;
-    static final int kCTMChangedBit = 1 << 2;
-    static final int kCTMNotChangedBit = ~kCTMChangedBit;
-    static final int kColorChangedBit = 1 << 3;
-    static final int kColorNotChangedBit = ~kColorChangedBit;
-    static final int kCompositeChangedBit = 1 << 4;
-    static final int kCompositeNotChangedBit = ~kCompositeChangedBit;
-    static final int kStrokeChangedBit = 1 << 5;
-    static final int kStrokeNotChangedBit = ~kStrokeChangedBit;
-    static final int kHintsChangedBit = 1 << 6;
-    static final int kHintsNotChangedBit = ~kHintsChangedBit;
-    static final int kFontChangedBit = 1 << 7;
-    static final int kFontNotChangedBit = ~kFontChangedBit;
-    static final int kEverythingChangedFlag = 0xffffffff;
+    @Native static final int kBoundsChangedBit = 1 << 0;
+    @Native static final int kBoundsNotChangedBit = ~kBoundsChangedBit;
+    @Native static final int kClipChangedBit = 1 << 1;
+    @Native static final int kClipNotChangedBit = ~kClipChangedBit;
+    @Native static final int kCTMChangedBit = 1 << 2;
+    @Native static final int kCTMNotChangedBit = ~kCTMChangedBit;
+    @Native static final int kColorChangedBit = 1 << 3;
+    @Native static final int kColorNotChangedBit = ~kColorChangedBit;
+    @Native static final int kCompositeChangedBit = 1 << 4;
+    @Native static final int kCompositeNotChangedBit = ~kCompositeChangedBit;
+    @Native static final int kStrokeChangedBit = 1 << 5;
+    @Native static final int kStrokeNotChangedBit = ~kStrokeChangedBit;
+    @Native static final int kHintsChangedBit = 1 << 6;
+    @Native static final int kHintsNotChangedBit = ~kHintsChangedBit;
+    @Native static final int kFontChangedBit = 1 << 7;
+    @Native static final int kFontNotChangedBit = ~kFontChangedBit;
+    @Native static final int kEverythingChangedFlag = 0xffffffff;
 
     // possible color states
-    static final int kColorSimple = 0;
-    static final int kColorSystem = 1;
-    static final int kColorGradient = 2;
-    static final int kColorTexture = 3;
+    @Native static final int kColorSimple = 0;
+    @Native static final int kColorSystem = 1;
+    @Native static final int kColorGradient = 2;
+    @Native static final int kColorTexture = 3;
 
     // possible gradient color states
-    static final int kColorNonCyclic = 0;
-    static final int kColorCyclic = 1;
+    @Native static final int kColorNonCyclic = 0;
+    @Native static final int kColorCyclic = 1;
 
     // possible clip states
-    static final int kClipRect = 0;
-    static final int kClipShape = 1;
+    @Native static final int kClipRect = 0;
+    @Native static final int kClipShape = 1;
 
     static int getRendererTypeForPrimitive(int primitiveType) {
         switch (primitiveType) {
diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
index 052b917..c907804 100644
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
@@ -336,7 +336,7 @@
         return peerTreeLock;
     }
 
-    final T getTarget() {
+    public final T getTarget() {
         return target;
     }
 
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CClipboard.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CClipboard.java
index 882fe55..51fbf52 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CClipboard.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CClipboard.java
@@ -110,4 +110,12 @@
 
     public native void declareTypes(long[] formats, SunClipboard newOwner);
     public native void setData(byte[] data, long format);
+
+    /**
+     * Invokes native check whether a change count on the general pasteboard is different
+     * than when we set it. The different count value means the current owner lost
+     * pasteboard ownership and someone else put data on the clipboard.
+     * @since 1.7
+     */
+    public native void checkPasteboard();
 }
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java
index 6554dc9..1a1f6d5 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CCursorManager.java
@@ -51,15 +51,6 @@
 
     @Override
     protected Point getCursorPosition() {
-        synchronized(this) {
-            if (isDragging) {
-                // during the drag operation, the appkit thread is blocked,
-                // so nativeGetCursorPosition invocation may cause a deadlock.
-                // In order to avoid this, we returns last know cursor position.
-                return new Point(dragPos);
-            }
-        }
-
         final Point2D nativePosition = nativeGetCursorPosition();
         return new Point((int)nativePosition.getX(), (int)nativePosition.getY());
     }
@@ -101,31 +92,4 @@
         // do something special
         throw new RuntimeException("Unimplemented");
     }
-
-    // package private methods to handle cursor change during drag-and-drop
-    private boolean isDragging = false;
-    private Point dragPos = null;
-
-    synchronized void startDrag(int x, int y) {
-        if (isDragging) {
-            throw new RuntimeException("Invalid Drag state in CCursorManager!");
-        }
-        isDragging = true;
-        dragPos = new Point(x, y);
-    }
-
-    synchronized void updateDragPosition(int x, int y) {
-        if (!isDragging) {
-            throw new RuntimeException("Invalid Drag state in CCursorManager!");
-        }
-        dragPos.move(x, y);
-    }
-
-    synchronized void stopDrag() {
-        if (!isDragging) {
-            throw new RuntimeException("Invalid Drag state in CCursorManager!");
-        }
-        isDragging = false;
-        dragPos = null;
-    }
 }
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
index 5b56b19..35c6ef6 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
@@ -174,7 +174,7 @@
                 bytes = Normalizer.normalize(new String(bytes, "UTF8"), Form.NFC).getBytes("UTF8");
             }
 
-            return super.translateBytesOrStream(stream, bytes, flavor, format, transferable);
+            return super.translateBytes(bytes, flavor, format, transferable);
         }
 
 
@@ -257,16 +257,13 @@
     private native byte[] imageDataToPlatformImageBytes(int[] rData, int nW, int nH);
 
     /**
-        * Translates either a byte array or an input stream which contain
+     * Translates a byte array which contains
      * platform-specific image data in the given format into an Image.
      */
-    protected Image platformImageBytesOrStreamToImage(InputStream stream, byte[] bytes, long format) throws IOException {
-        byte[] imageData = bytes;
-
-        if (imageData == null)
-            imageData = inputStreamToByteArray(stream);
-
-        return getImageForByteStream(imageData);
+    protected Image platformImageBytesToImage(byte[] bytes, long format)
+        throws IOException
+    {
+        return getImageForByteStream(bytes);
     }
 
     private native Image getImageForByteStream(byte[] bytes);
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
index b4f9fd7..0c0f3e7 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
@@ -38,8 +38,12 @@
 import javax.accessibility.*;
 
 import java.util.Map;
+import java.util.concurrent.Callable;
+
 import sun.awt.dnd.*;
 import sun.lwawt.LWComponentPeer;
+import sun.lwawt.LWWindowPeer;
+import sun.lwawt.PlatformWindow;
 
 
 public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
@@ -104,13 +108,8 @@
         }
 
         //It sure will be LWComponentPeer instance as rootComponent is a Window
-        LWComponentPeer peer = (LWComponentPeer)rootComponent.getPeer();
-        //Get a pointer to a native window
-        CPlatformWindow platformWindow = (CPlatformWindow) peer.getPlatformWindow();
-        long nativeWindowPtr = platformWindow.getNSWindowPtr();
-
-        // Get drag cursor:
-        Cursor cursor = this.getCursor();
+        PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow();
+        long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
 
         // If there isn't any drag image make one of default appearance:
         if (fDragImage == null)
@@ -139,19 +138,15 @@
 
         try {
             // Create native dragging source:
-            final long nativeDragSource = createNativeDragSource(component, peer, nativeWindowPtr, transferable, triggerEvent,
+            final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent,
                 (int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,
-                clickCount, timestamp, cursor, fDragCImage, dragImageOffset.x, dragImageOffset.y,
+                clickCount, timestamp, fDragCImage, dragImageOffset.x, dragImageOffset.y,
                 getDragSourceContext().getSourceActions(), formats, formatMap);
 
             if (nativeDragSource == 0)
                 throw new InvalidDnDOperationException("");
 
             setNativeContext(nativeDragSource);
-
-            CCursorManager.getInstance().startDrag(
-                    (int) (dragOrigin.getX()),
-                    (int) (dragOrigin.getY()));
         }
 
         catch (Exception e) {
@@ -160,6 +155,8 @@
 
         SunDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(transferable);
 
+        CCursorManager.getInstance().setCursor(getCursor());
+
         // Create a new thread to run the dragging operation since it's synchronous, only coming back
         // after dragging is finished. This leaves the AWT event thread free to handle AWT events which
         // are posted during dragging by native event handlers.
@@ -173,8 +170,6 @@
                     } catch (Exception e) {
                         e.printStackTrace();
                     } finally {
-                        CCursorManager.getInstance().stopDrag();
-
                         releaseNativeDragSource(nativeDragSource);
                         fDragImage = null;
                         if (fDragCImage != null) {
@@ -189,8 +184,6 @@
         }
 
         catch (Exception e) {
-            CCursorManager.getInstance().stopDrag();
-
             final long nativeDragSource = getNativeContext();
             setNativeContext(0);
             releaseNativeDragSource(nativeDragSource);
@@ -416,13 +409,24 @@
                                 final int modifiers,
                                 final int x, final int y) {
 
-        CCursorManager.getInstance().updateDragPosition(x, y);
+        try {
+            Component componentAt = LWCToolkit.invokeAndWait(
+                    new Callable<Component>() {
+                        @Override
+                        public Component call() {
+                            LWWindowPeer mouseEventComponent = LWWindowPeer.getWindowUnderCursor();
+                            if (mouseEventComponent == null) {
+                                return null;
+                            }
+                            Component root = SwingUtilities.getRoot(mouseEventComponent.getTarget());
+                            if (root == null) {
+                                return null;
+                            }
+                            Point rootLocation = root.getLocationOnScreen();
+                            return getDropTargetAt(root, x - rootLocation.x, y - rootLocation.y);
+                        }
+                    }, getComponent());
 
-        Component rootComponent = SwingUtilities.getRoot(getComponent());
-        if(rootComponent != null) {
-            Point componentPoint = new Point(x, y);
-            SwingUtilities.convertPointFromScreen(componentPoint, rootComponent);
-            Component componentAt = SwingUtilities.getDeepestComponentAt(rootComponent, componentPoint.x, componentPoint.y);
             if(componentAt != hoveringComponent) {
                 if(hoveringComponent != null) {
                     dragExit(x, y);
@@ -432,20 +436,36 @@
                 }
                 hoveringComponent = componentAt;
             }
+
+            postDragSourceDragEvent(targetActions, modifiers, x, y,
+                    DISPATCH_MOUSE_MOVED);
+        } catch (Exception e) {
+            throw new InvalidDnDOperationException("Failed to handle DragMouseMoved event");
         }
-        postDragSourceDragEvent(targetActions, modifiers, x, y,
-                                DISPATCH_MOUSE_MOVED);
     }
 
-    /**
-     * upcall from native code
-     */
-    private void dragEnter(final int targetActions,
-                           final int modifiers,
-                           final int x, final int y) {
-        CCursorManager.getInstance().updateDragPosition(x, y);
+    //Returns the first lightweight or heavyweight Component which has a dropTarget ready to accept the drag
+    //Should be called from the EventDispatchThread
+    private static Component getDropTargetAt(Component root, int x, int y) {
+        if (!root.contains(x, y) || !root.isEnabled() || !root.isVisible()) {
+            return null;
+        }
 
-        postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_ENTER);
+        if (root.getDropTarget() != null && root.getDropTarget().isActive()) {
+            return root;
+        }
+
+        if (root instanceof Container) {
+            for (Component comp : ((Container) root).getComponents()) {
+                Point loc = comp.getLocation();
+                Component dropTarget = getDropTargetAt(comp, x - loc.x, y - loc.y);
+                if (dropTarget != null) {
+                    return dropTarget;
+                }
+            }
+        }
+
+        return null;
     }
 
     /**
@@ -455,19 +475,15 @@
         hoveringComponent = null;
     }
 
-    public void setCursor(Cursor c) throws InvalidDnDOperationException {
-        // TODO : BG
-        //AWTLockAccess.awtLock();
-        super.setCursor(c);
-        //AWTLockAccess.awtUnlock();
+    @Override
+    protected void setNativeCursor(long nativeCtxt, Cursor c, int cType) {
+        CCursorManager.getInstance().setCursor(c);
     }
 
-    protected native void setNativeCursor(long nativeCtxt, Cursor c, int cType);
-
     // Native support:
-    private native long createNativeDragSource(Component component, ComponentPeer peer, long nativePeer, Transferable transferable,
+    private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable,
         InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp,
-        Cursor cursor, CImage nsDragImage, int dragImageOffsetX, int dragImageOffsetY,
+        CImage nsDragImage, int dragImageOffsetX, int dragImageOffsetY,
         int sourceActions, long[] formats, Map formatMap);
 
     private native void doDragging(long nativeDragSource);
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java
index 98088fb..1448424 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java
@@ -30,6 +30,7 @@
 import java.awt.dnd.DropTarget;
 
 import sun.lwawt.LWComponentPeer;
+import sun.lwawt.PlatformWindow;
 
 
 public final class CDropTarget {
@@ -50,21 +51,11 @@
         fComponent = component;
         fPeer = peer;
 
-        // Make sure the drop target is a ComponentModel:
-        if (!(peer instanceof LWComponentPeer))
-            throw new IllegalArgumentException("CDropTarget's peer must be a LWComponentPeer.");
-
-        // Get model pointer (CButton.m and such) and its native peer:
-        LWComponentPeer model = (LWComponentPeer) peer;
-        if (model.getPlatformWindow() instanceof CPlatformWindow) {
-            CPlatformWindow platformWindow = (CPlatformWindow) model.getPlatformWindow();
-            long nativePeer = platformWindow.getNSWindowPtr();
-
-            // Create native dragging destination:
-            fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
-            if (fNativeDropTarget == 0) {
-                throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed.");
-            }
+        long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
+        // Create native dragging destination:
+        fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
+        if (fNativeDropTarget == 0) {
+            throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed.");
         }
     }
 
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
index 8fa95a7..427e1a3 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
@@ -112,6 +112,14 @@
 
     public void handleFocusEvent(boolean focused) {
         this.focused = focused;
+        if (focused) {
+            // see bug 8010925
+            // we can't put this to handleWindowFocusEvent because
+            // it won't be invoced if focuse is moved to a html element
+            // on the same page.
+            CClipboard clipboard = (CClipboard) Toolkit.getDefaultToolkit().getSystemClipboard();
+            clipboard.checkPasteboard();
+        }
         if (parentWindowActive) {
             responder.handleWindowFocusEvent(focused, null);
         }
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index 3fb585b..8854efd 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -875,6 +875,21 @@
         }
     }
 
+    /**
+     * Helper method to get a pointer to the native view from the PlatformWindow.
+     */
+    static long getNativeViewPtr(PlatformWindow platformWindow) {
+        long nativePeer = 0L;
+        if (platformWindow instanceof CPlatformWindow) {
+            nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView();
+        } else if (platformWindow instanceof CViewPlatformEmbeddedFrame){
+            nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr();
+        } else {
+            throw new IllegalArgumentException("Unsupported platformWindow implementation");
+        }
+        return nativePeer;
+    }
+
     /*************************************************************
      * Callbacks from the AWTWindow and AWTView objc classes.
      *************************************************************/
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CocoaConstants.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CocoaConstants.java
index a3c4851..e94f512 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CocoaConstants.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CocoaConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,10 +25,7 @@
 
 package sun.lwawt.macosx;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class CocoaConstants {
     private CocoaConstants(){}
 
diff --git a/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs b/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
index 2759733..b9b0070 100644
--- a/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
+++ b/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
@@ -2,7 +2,7 @@
 
 {-
 /*
- * Copyright (c) 2011,2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -34,7 +34,7 @@
 
 import Data.List
 import Data.Maybe
-import Char
+import Data.Char
 
 data Width = W32 | W64
              deriving (Show, Eq, Bounded, Enum)
@@ -196,8 +196,6 @@
 c2java ntype =
     unlines [
  "// native " ++ ntypeS ++ " -> java " ++ jprimS,
- "/* No native methods here, but the constants are needed in the supporting JNI code */",
- "@GenerateNativeHeader",
  "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); }",
@@ -248,13 +246,10 @@
   putStrLn "package com.apple.jobjc;"
 
   putStrLn "import com.apple.jobjc.JObjCRuntime.Width;"
-  putStrLn "import javax.tools.annotation.GenerateNativeHeader;"
 
   putStrLn "// Auto generated by PrimitiveCoder.hs"
   putStrLn "// Do not edit by hand."
 
-  putStrLn "/* No native methods here, but the constants are needed in the supporting JNI code */"
-  putStrLn "@GenerateNativeHeader"
   putStrLn "public abstract class PrimitiveCoder<T> extends Coder<T>{"
 
   putStrLn "\tpublic PrimitiveCoder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim){"
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
index 9f05ed7..5207cf8 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,10 +24,7 @@
  */
 package com.apple.jobjc;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class CFType extends Pointer<Void> {
     protected CFType(long ptr) { super(ptr); }
     protected CFType(Pointer<?> ptr) { super(ptr.ptr); }
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
index eb8387a..9efc76e 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -35,7 +35,6 @@
 import com.apple.jobjc.PrimitiveCoder.SIntCoder;
 import com.apple.jobjc.PrimitiveCoder.SLongLongCoder;
 import com.apple.jobjc.PrimitiveCoder.SShortCoder;
-import javax.tools.annotation.GenerateNativeHeader;
 
 public abstract class Coder<T> {
     private static native long getNativeFFITypePtrForCode(final int code);
@@ -143,8 +142,6 @@
 
     //
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     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); }
@@ -153,8 +150,6 @@
         @Override public void push(JObjCRuntime runtime, long addr, Object x) { throw new RuntimeException("Trying to push a Void."); }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class UnknownCoder extends Coder<Object> {
         public static final UnknownCoder INST = new UnknownCoder();
         public UnknownCoder(){ super(-1, "?", null, null); }
@@ -163,8 +158,6 @@
         @Override public Object pop(JObjCRuntime runtime, long addr) { throw new RuntimeException("Coder not implemented"); }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     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); }
@@ -194,8 +187,6 @@
         @Override public void push(JObjCRuntime runtime, long addr, Long x) { push(runtime, addr, (long) x); }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class PointerCoder extends Coder<Pointer> {
         public static final PointerCoder INST = new PointerCoder();
         public PointerCoder(){ super(FFI_PTR, "^?", Pointer.class); }
@@ -209,8 +200,6 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class SELCoder extends Coder<SEL> {
         public static final SELCoder INST = new SELCoder();
         public SELCoder(){ super(FFI_PTR, ":", SEL.class); }
@@ -224,8 +213,6 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static abstract class StructCoder extends Coder<Struct> {
         private final FFIType ffiType;
         final int sizeof;
@@ -267,8 +254,6 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class IDCoder extends Coder<ID>{
         public static final IDCoder INST = new IDCoder();
         public IDCoder(){ super(FFI_PTR, "@", ID.class); }
@@ -287,8 +272,6 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class NSClassCoder extends Coder<NSClass>{
         public static final NSClassCoder INST = new NSClassCoder();
         public NSClassCoder(){ super(FFI_PTR, "#", NSClass.class); }
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
index 9927edf..dcff003 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -26,10 +26,7 @@
 
 import com.apple.jobjc.Coder.PrimitivePointerCoder;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 class FFIType{
     private static native void makeFFIType(long ffi_type_buf, long elements_buf);
     private static native int  getFFITypeSizeof();
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
index cbbc359..413d8fa 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,10 +24,7 @@
  */
 package com.apple.jobjc;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class Function {
     private static native long getFxnPtrForFunctionName(final String functionName);
     private static native long getFxnPtrForFunctionNameAndLib(final long libPtr, final String functionName);
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
index 084a55f..aa202cf 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -29,10 +29,7 @@
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class ID extends Pointer<Void>{
     static native String getNativeDescription(final long objPtr);
 
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
index 5851843..48ffc98 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -30,18 +30,13 @@
 import com.apple.jobjc.Coder.SELCoder;
 import com.apple.jobjc.Coder.StructCoder;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class Invoke {
     public abstract void invoke(NativeArgumentBuffer argBuf);
     public abstract void invoke(NativeArgumentBuffer buffer, Struct retvalStruct);
 
     //
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class FunCall extends Invoke{
         static native void invoke(long cifPtr, long fxnPtr, long retValPtr, long argsPtr);
 
@@ -78,8 +73,6 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class MsgSend extends Invoke{
         static{ System.load("/usr/lib/libobjc.dylib"); }
 
@@ -165,8 +158,6 @@
         }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static final class MsgSendSuper extends Invoke{
         static{ System.load("/usr/lib/libobjc.dylib"); }
 
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
index e6757ce..5bc01bc 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -31,16 +31,11 @@
 
 import sun.misc.Unsafe;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class JObjCRuntime {
     static { System.loadLibrary("JObjC"); }
 
-    @GenerateNativeHeader
     public static enum Arch{ ppc, i386, x86_64 };
-    @GenerateNativeHeader
     public static enum Width{ W32, W64 };
 
     public static final Arch ARCH = getArch();
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
index bb70553..bd77668 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,10 +25,7 @@
 package com.apple.jobjc;
 
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class MacOSXFramework {
     private static native long retainFramework(final String frameworkName);
     private static native void releaseFramework(final long frameworkPtr);
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
index c116bc6..dfda99a 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -27,13 +27,8 @@
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Constructor;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class NSClass<T extends ID> extends ID {
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class NSClassNotFoundException extends RuntimeException{
         public NSClassNotFoundException(String m){ super(m); }
         public NSClassNotFoundException(String m, Throwable cause){ super(m, cause); }
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
index be6a009..7f8949a 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -28,10 +28,7 @@
 
 import com.apple.jobjc.Coder.PrimitivePointerCoder;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class NativeArgumentBuffer{
     private static final ThreadLocal<NativeArgumentBuffer> threadLocal = new ThreadLocal<NativeArgumentBuffer>();
 
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
index 229a245..8630971 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -27,13 +27,10 @@
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * A wrapper around a direct ByteBuffer and its native pointer. For documentation, @see java.nio.ByteBuffer
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class NativeBuffer {
     static native long getPtrOfBuffer(final ByteBuffer byteBuffer);
 
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
index 78f4ca5..993be33 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,10 +24,7 @@
  */
 package com.apple.jobjc;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class NativeObjectLifecycleManager {
     private static native void retainNativeObject(final long ptr);
     private static native void releaseNativeObject(final long ptr);
@@ -37,8 +34,6 @@
     abstract void end(final long ptr);
     boolean shouldPreRetain() { return false; }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class CFRetainRelease extends NativeObjectLifecycleManager {
         public static final NativeObjectLifecycleManager INST = new CFRetainRelease();
         @Override void begin(final long ptr) { retainNativeObject(ptr); }
@@ -46,16 +41,12 @@
         @Override boolean shouldPreRetain() { return true; }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     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); }
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     public static class Nothing extends NativeObjectLifecycleManager {
         public static final NativeObjectLifecycleManager INST = new Nothing();
         @Override void begin(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
index 1a362d6..fe66848 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,10 +24,7 @@
  */
 package com.apple.jobjc;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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
index 1cd728c..d5b83b9 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,10 +24,7 @@
  */
 package com.apple.jobjc;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class Pointer <T> implements Comparable<Pointer<T>>{
     long ptr;
 
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
index 975b888..eab34a7 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011,2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,11 +24,8 @@
  */
 package com.apple.jobjc;
 import com.apple.jobjc.JObjCRuntime.Width;
-import javax.tools.annotation.GenerateNativeHeader;
 // Auto generated by PrimitiveCoder.hs
 // Do not edit by hand.
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class PrimitiveCoder<T> extends Coder<T>{
     public PrimitiveCoder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim){
         super(ffiTypeCode, objCEncoding, jclass, jprim);
@@ -130,8 +127,6 @@
 
 
 // native BOOL -> java boolean
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -175,8 +170,6 @@
 }
 
 // native schar -> java byte
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -220,8 +213,6 @@
 }
 
 // native uchar -> java byte
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -265,8 +256,6 @@
 }
 
 // native sshort -> java short
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -310,8 +299,6 @@
 }
 
 // native ushort -> java short
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -355,8 +342,6 @@
 }
 
 // native sint -> java int
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -400,8 +385,6 @@
 }
 
 // native uint -> java int
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -445,8 +428,6 @@
 }
 
 // native slong -> java long
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -496,8 +477,6 @@
 }
 
 // native ulong -> java long
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -547,8 +526,6 @@
 }
 
 // native slonglong -> java long
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -592,8 +569,6 @@
 }
 
 // native ulonglong -> java long
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -637,8 +612,6 @@
 }
 
 // native float -> java float
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
@@ -682,8 +655,6 @@
 }
 
 // native double -> java double
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 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); }
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
index 0dfcf3f..7e085f8 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,10 +24,7 @@
  */
 package com.apple.jobjc;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class SEL {
     static native long getSelectorPtr(String selectorName);
     static native String getSelectorName(long ptr);
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
index 1d1ddff..b14e84d 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,13 +24,10 @@
  */
 package com.apple.jobjc;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * A struct is malloced on the C heap and accessed in Java through a ByteBuffer.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class Struct{
     protected final NativeBuffer raw;
     private final JObjCRuntime runtime;
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
index 04961a3..c0e72b1 100644
--- 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
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,10 +33,7 @@
 import com.apple.jobjc.Coder.VoidCoder;
 import com.apple.jobjc.Invoke.MsgSend;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 final class Subclassing {
     static native long allocateClassPair(long superClass, String name);
     static native boolean addIVarForJObj(long clazz);
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/Invoke.m b/jdk/src/macosx/native/jobjc/src/core/native/Invoke.m
index f756034..28a11d9 100644
--- a/jdk/src/macosx/native/jobjc/src/core/native/Invoke.m
+++ b/jdk/src/macosx/native/jobjc/src/core/native/Invoke.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,8 +24,6 @@
  */
 
 #include "com_apple_jobjc_Invoke_FunCall.h"
-#include "com_apple_jobjc_Invoke_MsgSend.h"
-#include "com_apple_jobjc_Invoke_MsgSendSuper.h"
 #include <ffi/ffi.h>
 #include <objc/message.h>
 #include <JavaNativeFoundation/JavaNativeFoundation.h>
diff --git a/jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m b/jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m
index cd4cddd..dfb5b48 100644
--- a/jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m
+++ b/jdk/src/macosx/native/jobjc/src/core/native/JObjCRuntime.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,5 @@
  * questions.
  */
 
-#include "com_apple_jobjc_JObjCRuntime.h"
 #include "Cocoa/Cocoa.h"
 
diff --git a/jdk/src/macosx/native/sun/awt/CClipboard.m b/jdk/src/macosx/native/sun/awt/CClipboard.m
index bfba06b..27000ae 100644
--- a/jdk/src/macosx/native/sun/awt/CClipboard.m
+++ b/jdk/src/macosx/native/sun/awt/CClipboard.m
@@ -189,18 +189,18 @@
 
 - (void) checkPasteboard:(id)application {
     AWT_ASSERT_APPKIT_THREAD;
-
+    
     //NSLog(@"CClipboard checkPasteboard oldCount %d newCount %d newTypes %@", fChangeCount, [[NSPasteboard generalPasteboard] changeCount], [[NSPasteboard generalPasteboard] types]);
-
+    
     // This is called via NSApplicationDidBecomeActiveNotification.
-
+    
     // If the change count on the general pasteboard is different than when we set it
     // someone else put data on the clipboard.  That means the current owner lost ownership.
     NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount];
-
+    
     if (fChangeCount != newChangeCount) {
         fChangeCount = newChangeCount;
-
+        
         [self pasteboardChangedOwner:[NSPasteboard generalPasteboard]];
     }
 }
@@ -371,4 +371,21 @@
     return returnValue;
 }
 
+/*
+ * Class:     sun_lwawt_macosx_CClipboard
+ * Method:    checkPasteboard
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CClipboard_checkPasteboard
+(JNIEnv *env, jobject inObject )
+{
+    JNF_COCOA_ENTER(env);
+
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+        [[CClipboard sharedClipboard] checkPasteboard:nil];
+    }];
+        
+    JNF_COCOA_EXIT(env);
+}
+
 
diff --git a/jdk/src/macosx/native/sun/awt/CDragSource.h b/jdk/src/macosx/native/sun/awt/CDragSource.h
index 7e880cb..483924e 100644
--- a/jdk/src/macosx/native/sun/awt/CDragSource.h
+++ b/jdk/src/macosx/native/sun/awt/CDragSource.h
@@ -33,7 +33,6 @@
 @private
     NSView*        fView;
     jobject            fComponent;
-    jobject            fComponentPeer;
     jobject            fDragSourceContextPeer;
 
     jobject            fTransferable;
@@ -43,8 +42,6 @@
     jint                fClickCount;
     jint                fModifiers;
 
-    jobject            fCursor;
-
     NSImage*        fDragImage;
     NSPoint            fDragImageOffset;
 
@@ -59,12 +56,22 @@
 + (CDragSource *) currentDragSource;
 
 // Common methods:
-- (id)init:(jobject)jdragsourcecontextpeer component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control
-    transferable:(jobject)jtransferable triggerEvent:(jobject)jtrigger
-    dragPosX:(jint)dragPosX dragPosY:(jint)dragPosY modifiers:(jint)extModifiers clickCount:(jint)clickCount timeStamp:(jlong)timeStamp
-    cursor:(jobject)jcursor
-    dragImage:(jobject)jnsdragimage dragImageOffsetX:(jint)jdragimageoffsetx dragImageOffsetY:(jint)jdragimageoffsety
-    sourceActions:(jint)jsourceactions formats:(jlongArray)jformats formatMap:(jobject)jformatmap;
+- (id)        init:(jobject)jDragSourceContextPeer
+         component:(jobject)jComponent
+           control:(id)control
+      transferable:(jobject)jTransferable
+      triggerEvent:(jobject)jTrigger
+          dragPosX:(jint)dragPosX
+          dragPosY:(jint)dragPosY
+         modifiers:(jint)extModifiers
+        clickCount:(jint)clickCount
+         timeStamp:(jlong)timeStamp
+         dragImage:(jobject)jDragImage
+  dragImageOffsetX:(jint)jDragImageOffsetX
+  dragImageOffsetY:(jint)jDragImageOffsetY
+     sourceActions:(jint)jSourceActions
+           formats:(jlongArray)jFormats
+         formatMap:(jobject)jFormatMap;
 
 - (void)removeFromView:(JNIEnv *)env;
 
diff --git a/jdk/src/macosx/native/sun/awt/CDragSource.m b/jdk/src/macosx/native/sun/awt/CDragSource.m
index 6350264..47b6a6b 100644
--- a/jdk/src/macosx/native/sun/awt/CDragSource.m
+++ b/jdk/src/macosx/native/sun/awt/CDragSource.m
@@ -84,12 +84,22 @@
     return sCurrentDragSource;
 }
 
-- (id)init:(jobject)jdragsourcecontextpeer component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control
-    transferable:(jobject)jtransferable triggerEvent:(jobject)jtrigger
-    dragPosX:(jint)dragPosX dragPosY:(jint)dragPosY modifiers:(jint)extModifiers clickCount:(jint)clickCount
-    timeStamp:(jlong)timeStamp cursor:(jobject)jcursor
-    dragImage:(jobject)jnsdragimage dragImageOffsetX:(jint)jdragimageoffsetx dragImageOffsetY:(jint)jdragimageoffsety
-    sourceActions:(jint)jsourceactions formats:(jlongArray)jformats formatMap:(jobject)jformatmap
+- (id)        init:(jobject)jDragSourceContextPeer
+         component:(jobject)jComponent
+           control:(id)control
+      transferable:(jobject)jTransferable
+      triggerEvent:(jobject)jTrigger
+          dragPosX:(jint)dragPosX
+          dragPosY:(jint)dragPosY
+         modifiers:(jint)extModifiers
+        clickCount:(jint)clickCount
+         timeStamp:(jlong)timeStamp
+         dragImage:(jobject)jDragImage
+  dragImageOffsetX:(jint)jDragImageOffsetX
+  dragImageOffsetY:(jint)jDragImageOffsetY
+     sourceActions:(jint)jSourceActions
+           formats:(jlongArray)jFormats
+         formatMap:(jobject)jFormatMap
 {
     self = [super init];
     DLog2(@"[CDragSource init]: %@\n", self);
@@ -100,27 +110,25 @@
     // Construct the object if we have a valid model for it:
     if (control != nil) {
         JNIEnv *env = [ThreadUtilities getJNIEnv];
-        fComponent = JNFNewGlobalRef(env, jcomponent);
-        fComponentPeer = JNFNewGlobalRef(env, jpeer);
-        fDragSourceContextPeer = JNFNewGlobalRef(env, jdragsourcecontextpeer);
+        fComponent = JNFNewGlobalRef(env, jComponent);
+        fDragSourceContextPeer = JNFNewGlobalRef(env, jDragSourceContextPeer);
 
-        fTransferable = JNFNewGlobalRef(env, jtransferable);
-        fTriggerEvent = JNFNewGlobalRef(env, jtrigger);
-        fCursor = JNFNewGlobalRef(env, jcursor);
+        fTransferable = JNFNewGlobalRef(env, jTransferable);
+        fTriggerEvent = JNFNewGlobalRef(env, jTrigger);
 
-        if (jnsdragimage) {
+        if (jDragImage) {
             JNF_MEMBER_CACHE(nsImagePtr, CImageClass, "ptr", "J");
-            jlong imgPtr = JNFGetLongField(env, jnsdragimage, nsImagePtr);
+            jlong imgPtr = JNFGetLongField(env, jDragImage, nsImagePtr);
             fDragImage = (NSImage*) jlong_to_ptr(imgPtr); // Double-casting prevents compiler 'd$|//
 
             [fDragImage retain];
         }
 
-        fDragImageOffset = NSMakePoint(jdragimageoffsetx, jdragimageoffsety);
+        fDragImageOffset = NSMakePoint(jDragImageOffsetX, jDragImageOffsetY);
 
-        fSourceActions = jsourceactions;
-        fFormats = JNFNewGlobalRef(env, jformats);
-        fFormatMap = JNFNewGlobalRef(env, jformatmap);
+        fSourceActions = jSourceActions;
+        fFormats = JNFNewGlobalRef(env, jFormats);
+        fFormatMap = JNFNewGlobalRef(env, jFormatMap);
 
         fTriggerEventTimeStamp = timeStamp;
         fDragPos = NSMakePoint(dragPosX, dragPosY);
@@ -129,9 +137,8 @@
 
         // Set this object as a dragging source:
 
-        AWTView *awtView = [((NSWindow *) control) contentView];
-        fView = [awtView retain];
-        [awtView setDragSource:self];
+        fView = [(AWTView *) control retain];
+        [fView setDragSource:self];
 
         // Let AWTEvent know Java drag is getting underway:
         [NSEvent javaDraggingBegin];
@@ -158,11 +165,6 @@
         fComponent = NULL;
     }
 
-    if (fComponentPeer != NULL) {
-        JNFDeleteGlobalRef(env, fComponentPeer);
-        fComponentPeer = NULL;
-    }
-
     if (fDragSourceContextPeer != NULL) {
         JNFDeleteGlobalRef(env, fDragSourceContextPeer);
         fDragSourceContextPeer = NULL;
@@ -178,11 +180,6 @@
         fTriggerEvent = NULL;
     }
 
-    if (fCursor != NULL) {
-        JNFDeleteGlobalRef(env, fCursor);
-        fCursor = NULL;
-    }
-
     if (fFormats != NULL) {
         JNFDeleteGlobalRef(env, fFormats);
         fFormats = NULL;
@@ -586,11 +583,6 @@
 {
     AWT_ASSERT_NOT_APPKIT_THREAD;
 
-    // Set the drag cursor (or not 3839999)
-    //JNIEnv *env = [ThreadUtilities getJNIEnv];
-    //jobject gCursor = JNFNewGlobalRef(env, fCursor);
-    //[EventFactory setJavaCursor:gCursor withEnv:env];
-
     [self performSelectorOnMainThread:@selector(doDrag) withObject:nil waitUntilDone:YES]; // AWT_THREADING Safe (called from unique asynchronous thread)
 }
 
diff --git a/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m b/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m
index 4678879..97720fb 100644
--- a/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m
+++ b/jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m
@@ -34,12 +34,13 @@
 /*
  * Class:     sun_lwawt_macosx_CDragSourceContextPeer
  * Method:    createNativeDragSource
- * Signature: (Ljava/awt/Component;Ljava/awt/peer/ComponentPeer;JLjava/awt/datatransfer/Transferable;Ljava/awt/event/InputEvent;IIIIJLjava/awt/Cursor;IJIII[JLjava/util/Map;)J
+ * Signature: (Ljava/awt/Component;JLjava/awt/datatransfer/Transferable;
+               Ljava/awt/event/InputEvent;IIIIJIJIII[JLjava/util/Map;)J
  */
 JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource
-  (JNIEnv *env, jobject jthis, jobject jcomponent, jobject jpeer, jlong jnativepeer, jobject jtransferable,
+  (JNIEnv *env, jobject jthis, jobject jcomponent, jlong jnativepeer, jobject jtransferable,
    jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,
-   jobject jcursor, jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
+   jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
    jint jsourceactions, jlongArray jformats, jobject jformatmap)
 {
     id controlObj = (id) jlong_to_ptr(jnativepeer);
@@ -47,12 +48,22 @@
 
 JNF_COCOA_ENTER(env);
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        dragSource = [[CDragSource alloc] init:jthis component:jcomponent peer:jpeer control:controlObj
-            transferable:jtransferable triggerEvent:jtrigger dragPosX:jdragposx
-            dragPosY:jdragposy modifiers:jextmodifiers clickCount:jclickcount timeStamp:jtimestamp
-            cursor:jcursor dragImage:jnsdragimage dragImageOffsetX:jdragimageoffsetx
-            dragImageOffsetY:jdragimageoffsety sourceActions:jsourceactions
-            formats:jformats formatMap:jformatmap];
+        dragSource = [[CDragSource alloc] init:jthis
+                                     component:jcomponent
+                                       control:controlObj
+                                  transferable:jtransferable
+                                  triggerEvent:jtrigger
+                                      dragPosX:jdragposx
+                                      dragPosY:jdragposy
+                                     modifiers:jextmodifiers
+                                    clickCount:jclickcount
+                                     timeStamp:jtimestamp
+                                     dragImage:jnsdragimage
+                              dragImageOffsetX:jdragimageoffsetx
+                              dragImageOffsetY:jdragimageoffsety
+                                 sourceActions:jsourceactions
+                                       formats:jformats
+                                     formatMap:jformatmap];
     }];
 JNF_COCOA_EXIT(env);
 
@@ -94,19 +105,3 @@
     [dragSource removeFromView:env];
 JNF_COCOA_EXIT(env);
 }
-
-/*
- * Class:     sun_lwawt_macosx_CDragSourceContextPeer
- * Method:    setNativeCursor
- * Signature: (JLjava/awt/Cursor;I)V
- */
-JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_setNativeCursor
-  (JNIEnv *env, jobject jthis, jlong nativeDragSourceVal, jobject jcursor, jint jcursortype)
-{
-   //AWT_ASSERT_NOT_APPKIT_THREAD;
-
-//JNF_COCOA_ENTER(env);
-//    jobject gCursor = JNFNewGlobalRef(env, jcursor);
-//    [EventFactory setJavaCursor:gCursor withEnv:env];
-//JNF_COCOA_EXIT(env);
-}
diff --git a/jdk/src/macosx/native/sun/awt/CDropTarget.m b/jdk/src/macosx/native/sun/awt/CDropTarget.m
index 9dda8ae..260bbde 100644
--- a/jdk/src/macosx/native/sun/awt/CDropTarget.m
+++ b/jdk/src/macosx/native/sun/awt/CDropTarget.m
@@ -81,9 +81,8 @@
         fComponent = JNFNewGlobalRef(env, jcomponent);
         fDropTarget = JNFNewGlobalRef(env, jdropTarget);
 
-        AWTView *awtView = [((NSWindow *) control) contentView];
-        fView = [awtView retain];
-        [awtView setDropTarget:self];
+        fView = [((AWTView *) control) retain];
+        [fView setDropTarget:self];
 
 
     } else {
@@ -177,6 +176,10 @@
 {
     DLog2(@"[CDropTarget dealloc]: %@\n", self);
 
+    if(sCurrentDropTarget == self) {
+        sCurrentDropTarget = nil;
+    }
+
     [fView release];
     fView = nil;
 
@@ -490,7 +493,10 @@
         JNF_MEMBER_CACHE(handleEnterMessageMethod, jc_CDropTargetContextPeer, "handleEnterMessage", "(Ljava/awt/Component;IIII[JJ)I");
         if (sDraggingError == FALSE) {
             // Double-casting self gets rid of 'different size' compiler warning:
-            actions = JNFCallIntMethod(env, fDropTargetContextPeer, handleEnterMessageMethod, fComponent, (jint) javaLocation.x, (jint) javaLocation.y, dropAction, actions, formats, ptr_to_jlong(self)); // AWT_THREADING Safe (CToolkitThreadBlockedHandler)
+            // AWT_THREADING Safe (CToolkitThreadBlockedHandler)
+            actions = JNFCallIntMethod(env, fDropTargetContextPeer, handleEnterMessageMethod,
+                                       fComponent, (jint) javaLocation.x, (jint) javaLocation.y,
+                                       dropAction, actions, formats, ptr_to_jlong(self));
         }
 
         if (sDraggingError == FALSE) {
@@ -510,11 +516,6 @@
             // Remember the dragOp for no-op'd update messages:
             sUpdateOperation = dragOp;
         }
-
-        // If we are in the same process as the sender, make the sender post the appropriate message
-        if (sender) {
-            [[CDragSource currentDragSource] postDragEnter];
-        }
     }
 
     // 9-11-02 Note: the native event thread would not handle an exception gracefully:
@@ -608,11 +609,9 @@
         JNF_MEMBER_CACHE(handleExitMessageMethod, jc_CDropTargetContextPeer, "handleExitMessage", "(Ljava/awt/Component;J)V");
         if (sDraggingError == FALSE) {
             DLog3(@"  - dragExit: loc native %f, %f\n", sDraggingLocation.x, sDraggingLocation.y);
-            JNFCallVoidMethod(env, fDropTargetContextPeer, handleExitMessageMethod, fComponent, ptr_to_jlong(self)); // AWT_THREADING Safe (CToolkitThreadBlockedHandler)
-            // If we are in the same process as the sender, make the sender post the appropriate message
-            if (sender) {
-                [[CDragSource currentDragSource] postDragExit];
-            }
+             // AWT_THREADING Safe (CToolkitThreadBlockedHandler) 
+            JNFCallVoidMethod(env, fDropTargetContextPeer,
+                              handleExitMessageMethod, fComponent, ptr_to_jlong(self));
         }
 
         // 5-27-03 Note: [Radar 3270455]
diff --git a/jdk/src/macosx/native/sun/awt/CTextPipe.m b/jdk/src/macosx/native/sun/awt/CTextPipe.m
index 6b1da8d..578bf9c 100644
--- a/jdk/src/macosx/native/sun/awt/CTextPipe.m
+++ b/jdk/src/macosx/native/sun/awt/CTextPipe.m
@@ -501,10 +501,22 @@
         int *uniChars = (int *)malloc(sizeof(int) * length);
         CGSize *advances = (CGSize *)malloc(sizeof(CGSize) * length);
 
-        if (glyphs == NULL || advances == NULL)
+        if (glyphs == NULL || uniChars == NULL || advances == NULL)
         {
             (*env)->DeleteLocalRef(env, glyphsArray);
             [NSException raise:NSMallocException format:@"%s-%s:%d", THIS_FILE, __FUNCTION__, __LINE__];
+            if (glyphs)
+            {
+                free(glyphs);
+            }
+            if (uniChars)
+            {
+                free(uniChars);
+            }
+            if (advances)
+            {
+                free(advances);
+            }
             return;
         }
 
diff --git a/jdk/src/macosx/native/sun/awt/PrinterView.m b/jdk/src/macosx/native/sun/awt/PrinterView.m
index b713409..0400f5e 100644
--- a/jdk/src/macosx/native/sun/awt/PrinterView.m
+++ b/jdk/src/macosx/native/sun/awt/PrinterView.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -26,7 +26,6 @@
 #import "PrinterView.h"
 
 #import "java_awt_print_Pageable.h"
-#import "java_awt_print_Printable.h"
 #import "java_awt_print_PageFormat.h"
 
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
diff --git a/jdk/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c b/jdk/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
index 3e1fda3..5cac939 100644
--- a/jdk/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
+++ b/jdk/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c
@@ -32,8 +32,8 @@
 static CFDateFormatterStyle convertDateFormatterStyle(jint javaStyle);
 static CFNumberFormatterStyle convertNumberFormatterStyle(jint javaStyle);
 static void copyArrayElements(JNIEnv *env, CFArrayRef cfarray, jobjectArray jarray, CFIndex sindex, int dindex, int count);
-static jstring getNumberSymbolString(JNIEnv *env, jstring jdefault, CFStringRef type);
-static jchar getNumberSymbolChar(jchar jdefault, CFStringRef type);
+static jstring getNumberSymbolString(JNIEnv *env, jstring jlangtag, jstring jdefault, CFStringRef type);
+static jchar getNumberSymbolChar(JNIEnv *env, jstring jlangtag, jchar jdefault, CFStringRef type);
 
 // from java_props_macosx.c
 extern char * getMacOSXLocale(int cat);
@@ -322,7 +322,7 @@
  */
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCurrencySymbol
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring currencySymbol) {
-    return getNumberSymbolString(env, currencySymbol, kCFNumberFormatterCurrencySymbol);
+    return getNumberSymbolString(env, jlangtag, currencySymbol, kCFNumberFormatterCurrencySymbol);
 }
 
 /*
@@ -332,7 +332,7 @@
  */
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDecimalSeparator
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar decimalSeparator) {
-    return getNumberSymbolChar(decimalSeparator, kCFNumberFormatterDecimalSeparator);
+    return getNumberSymbolChar(env, jlangtag, decimalSeparator, kCFNumberFormatterDecimalSeparator);
 }
 
 /*
@@ -342,7 +342,7 @@
  */
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getGroupingSeparator
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar groupingSeparator) {
-    return getNumberSymbolChar(groupingSeparator, kCFNumberFormatterGroupingSeparator);
+    return getNumberSymbolChar(env, jlangtag, groupingSeparator, kCFNumberFormatterGroupingSeparator);
 }
 
 /*
@@ -352,7 +352,7 @@
  */
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInfinity
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring infinity) {
-    return getNumberSymbolString(env, infinity, kCFNumberFormatterInfinitySymbol);
+    return getNumberSymbolString(env, jlangtag, infinity, kCFNumberFormatterInfinitySymbol);
 }
 
 /*
@@ -362,7 +362,7 @@
  */
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getInternationalCurrencySymbol
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring internationalCurrencySymbol) {
-    return getNumberSymbolString(env, internationalCurrencySymbol, kCFNumberFormatterInternationalCurrencySymbol);
+    return getNumberSymbolString(env, jlangtag, internationalCurrencySymbol, kCFNumberFormatterInternationalCurrencySymbol);
 }
 
 /*
@@ -372,7 +372,7 @@
  */
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMinusSign
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar minusSign) {
-    return getNumberSymbolChar(minusSign, kCFNumberFormatterMinusSign);
+    return getNumberSymbolChar(env, jlangtag, minusSign, kCFNumberFormatterMinusSign);
 }
 
 /*
@@ -382,7 +382,7 @@
  */
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getMonetaryDecimalSeparator
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar monetaryDecimalSeparator) {
-    return getNumberSymbolChar(monetaryDecimalSeparator, kCFNumberFormatterCurrencyDecimalSeparator);
+    return getNumberSymbolChar(env, jlangtag, monetaryDecimalSeparator, kCFNumberFormatterCurrencyDecimalSeparator);
 }
 
 /*
@@ -392,7 +392,7 @@
  */
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getNaN
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring nan) {
-    return getNumberSymbolString(env, nan, kCFNumberFormatterNaNSymbol);
+    return getNumberSymbolString(env, jlangtag, nan, kCFNumberFormatterNaNSymbol);
 }
 
 /*
@@ -402,7 +402,7 @@
  */
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPercent
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar percent) {
-    return getNumberSymbolChar(percent, kCFNumberFormatterPercentSymbol);
+    return getNumberSymbolChar(env, jlangtag, percent, kCFNumberFormatterPercentSymbol);
 }
 
 /*
@@ -412,7 +412,7 @@
  */
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getPerMill
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar perMill) {
-    return getNumberSymbolChar(perMill, kCFNumberFormatterPerMillSymbol);
+    return getNumberSymbolChar(env, jlangtag, perMill, kCFNumberFormatterPerMillSymbol);
 }
 
 /*
@@ -422,7 +422,36 @@
  */
 JNIEXPORT jchar JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getZeroDigit
   (JNIEnv *env, jclass cls, jstring jlangtag, jchar zeroDigit) {
-    return getNumberSymbolChar(zeroDigit, kCFNumberFormatterZeroSymbol);
+    // The following code *should* work, but not for some reason :o
+    //
+    //return getNumberSymbolChar(env, jlangtag, zeroDigit, kCFNumberFormatterZeroSymbol);
+    //
+    // so here is a workaround.
+    jchar ret = zeroDigit;
+    CFLocaleRef cflocale = CFLocaleCopyCurrent();
+
+    if (cflocale != NULL) {
+        CFNumberFormatterRef nf = CFNumberFormatterCreate(kCFAllocatorDefault,
+                                                  cflocale,
+                                                  kCFNumberFormatterNoStyle);
+        if (nf != NULL) {
+            int zero = 0;
+            CFStringRef str = CFNumberFormatterCreateStringWithValue(kCFAllocatorDefault,
+                              nf, kCFNumberIntType, &zero);
+            if (str != NULL) {
+                if (CFStringGetLength(str) > 0) {
+                    ret = CFStringGetCharacterAtIndex(str, 0);
+                }
+                CFRelease(str);
+            }
+
+            CFRelease(nf);
+        }
+
+        CFRelease(cflocale);
+    }
+
+    return ret;
 }
 
 /*
@@ -432,7 +461,7 @@
  */
 JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getExponentSeparator
   (JNIEnv *env, jclass cls, jstring jlangtag, jstring exponent) {
-    return getNumberSymbolString(env, exponent, kCFNumberFormatterExponentSymbol);
+    return getNumberSymbolString(env, jlangtag, exponent, kCFNumberFormatterExponentSymbol);
 }
 
 /*
@@ -625,7 +654,7 @@
     }
 }
 
-static jstring getNumberSymbolString(JNIEnv *env, jstring jdefault, CFStringRef type) {
+static jstring getNumberSymbolString(JNIEnv *env, jstring jlangtag, jstring jdefault, CFStringRef type) {
     char buf[BUFLEN];
     jstring ret = jdefault;
     CFLocaleRef cflocale = CFLocaleCopyCurrent();
@@ -633,7 +662,7 @@
     if (cflocale != NULL) {
         CFNumberFormatterRef nf = CFNumberFormatterCreate(kCFAllocatorDefault,
                                                   cflocale,
-                                                  kCFNumberFormatterDecimalStyle);
+                                                  kCFNumberFormatterNoStyle);
         if (nf != NULL) {
             CFStringRef str = CFNumberFormatterCopyProperty(nf, type);
             if (str != NULL) {
@@ -651,21 +680,21 @@
     return ret;
 }
 
-static jchar getNumberSymbolChar(jchar jdefault, CFStringRef type) {
-    char buf[BUFLEN];
+static jchar getNumberSymbolChar(JNIEnv *env, jstring jlangtag, jchar jdefault, CFStringRef type) {
     jchar ret = jdefault;
     CFLocaleRef cflocale = CFLocaleCopyCurrent();
 
     if (cflocale != NULL) {
         CFNumberFormatterRef nf = CFNumberFormatterCreate(kCFAllocatorDefault,
                                                   cflocale,
-                                                  kCFNumberFormatterDecimalStyle);
+                                                  kCFNumberFormatterNoStyle);
         if (nf != NULL) {
             CFStringRef str = CFNumberFormatterCopyProperty(nf, type);
             if (str != NULL) {
-                CFStringGetCString(str, buf, BUFLEN, kCFStringEncodingUTF8);
+                if (CFStringGetLength(str) > 0) {
+                    ret = CFStringGetCharacterAtIndex(str, 0);
+                }
                 CFRelease(str);
-                ret = buf[0];
             }
 
             CFRelease(nf);
diff --git a/jdk/src/share/back/export/sys.h b/jdk/src/share/back/export/sys.h
index 4c42ec2..bd4bb9d 100644
--- a/jdk/src/share/back/export/sys.h
+++ b/jdk/src/share/back/export/sys.h
@@ -37,7 +37,7 @@
 
 /* Implemented in linker_md.c */
 
-void    dbgsysBuildLibName(char *, int, char *, char *);
+void    dbgsysBuildLibName(char *, int, const char *, const char *);
 void *  dbgsysLoadLibrary(const char *, char *err_buf, int err_buflen);
 void    dbgsysUnloadLibrary(void *);
 void *  dbgsysFindLibraryEntry(void *, const char *);
diff --git a/jdk/src/share/back/transport.c b/jdk/src/share/back/transport.c
index 1d7335d..20892e3 100644
--- a/jdk/src/share/back/transport.c
+++ b/jdk/src/share/back/transport.c
@@ -97,12 +97,12 @@
 
 /* Load transport library (directory=="" means do system search) */
 static void *
-loadTransportLibrary(char *libdir, char *name)
+loadTransportLibrary(const char *libdir, const char *name)
 {
     void *handle;
     char libname[MAXPATHLEN+2];
     char buf[MAXPATHLEN*2+100];
-    char *plibdir;
+    const char *plibdir;
 
     /* Convert libdir from UTF-8 to platform encoding */
     plibdir = NULL;
@@ -131,12 +131,12 @@
  * JDK 1.2 javai.c v1.61
  */
 static jdwpError
-loadTransport(char *name, jdwpTransportEnv **transportPtr)
+loadTransport(const char *name, jdwpTransportEnv **transportPtr)
 {
     JNIEnv                 *env;
     jdwpTransport_OnLoad_t  onLoad;
     void                   *handle;
-    char                   *libdir;
+    const char             *libdir;
 
     /* Make sure library name is not empty */
     if (name == NULL) {
diff --git a/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java b/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
index a2c6cfd..2f8b584 100644
--- a/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
+++ b/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java
@@ -6,7 +6,7 @@
  * 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.S
+ * 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
diff --git a/jdk/src/share/classes/java/awt/Adjustable.java b/jdk/src/share/classes/java/awt/Adjustable.java
index 53d5152..6193a07 100644
--- a/jdk/src/share/classes/java/awt/Adjustable.java
+++ b/jdk/src/share/classes/java/awt/Adjustable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -27,7 +27,7 @@
 
 import java.awt.event.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * The interface for objects which have an adjustable numeric value
@@ -36,24 +36,22 @@
  * @author Amy Fowler
  * @author Tim Prinzing
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface Adjustable {
 
     /**
      * Indicates that the <code>Adjustable</code> has horizontal orientation.
      */
-    public static final int HORIZONTAL = 0;
+    @Native public static final int HORIZONTAL = 0;
 
     /**
      * Indicates that the <code>Adjustable</code> has vertical orientation.
      */
-    public static final int VERTICAL = 1;
+    @Native public static final int VERTICAL = 1;
 
     /**
      * Indicates that the <code>Adjustable</code> has no orientation.
      */
-    public static final int NO_ORIENTATION = 2;
+    @Native public static final int NO_ORIENTATION = 2;
 
     /**
      * Gets the orientation of the adjustable object.
diff --git a/jdk/src/share/classes/java/awt/AlphaComposite.java b/jdk/src/share/classes/java/awt/AlphaComposite.java
index 0889642..6903e7e 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, 2010, 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
@@ -26,7 +26,7 @@
 package java.awt;
 
 import java.awt.image.ColorModel;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 import sun.java2d.SunCompositeContext;
 
 /**
@@ -350,8 +350,6 @@
  * @see CompositeContext
  */
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class AlphaComposite implements Composite {
     /**
      * Both the color and the alpha of the destination are cleared
@@ -364,7 +362,7 @@
      *  <em>C<sub>r</sub></em> = 0
      *</pre>
      */
-    public static final int     CLEAR           = 1;
+    @Native public static final int     CLEAR           = 1;
 
     /**
      * The source is copied to the destination
@@ -377,7 +375,7 @@
      *  <em>C<sub>r</sub></em> = <em>C<sub>s</sub></em>
      *</pre>
      */
-    public static final int     SRC             = 2;
+    @Native public static final int     SRC             = 2;
 
     /**
      * The destination is left untouched
@@ -390,7 +388,7 @@
      *</pre>
      * @since 1.4
      */
-    public static final int     DST             = 9;
+    @Native public static final int     DST             = 9;
     // Note that DST was added in 1.4 so it is numbered out of order...
 
     /**
@@ -403,7 +401,7 @@
      *  <em>C<sub>r</sub></em> = <em>C<sub>s</sub></em> + <em>C<sub>d</sub></em>*(1-<em>A<sub>s</sub></em>)
      *</pre>
      */
-    public static final int     SRC_OVER        = 3;
+    @Native public static final int     SRC_OVER        = 3;
 
     /**
      * The destination is composited over the source and
@@ -416,7 +414,7 @@
      *  <em>C<sub>r</sub></em> = <em>C<sub>s</sub></em>*(1-<em>A<sub>d</sub></em>) + <em>C<sub>d</sub></em>
      *</pre>
      */
-    public static final int     DST_OVER        = 4;
+    @Native public static final int     DST_OVER        = 4;
 
     /**
      * The part of the source lying inside of the destination replaces
@@ -429,7 +427,7 @@
      *  <em>C<sub>r</sub></em> = <em>C<sub>s</sub></em>*<em>A<sub>d</sub></em>
      *</pre>
      */
-    public static final int     SRC_IN          = 5;
+    @Native public static final int     SRC_IN          = 5;
 
     /**
      * The part of the destination lying inside of the source
@@ -442,7 +440,7 @@
      *  <em>C<sub>r</sub></em> = <em>C<sub>d</sub></em>*<em>A<sub>s</sub></em>
      *</pre>
      */
-    public static final int     DST_IN          = 6;
+    @Native public static final int     DST_IN          = 6;
 
     /**
      * The part of the source lying outside of the destination
@@ -455,7 +453,7 @@
      *  <em>C<sub>r</sub></em> = <em>C<sub>s</sub></em>*(1-<em>A<sub>d</sub></em>)
      *</pre>
      */
-    public static final int     SRC_OUT         = 7;
+    @Native public static final int     SRC_OUT         = 7;
 
     /**
      * The part of the destination lying outside of the source
@@ -468,7 +466,7 @@
      *  <em>C<sub>r</sub></em> = <em>C<sub>d</sub></em>*(1-<em>A<sub>s</sub></em>)
      *</pre>
      */
-    public static final int     DST_OUT         = 8;
+    @Native public static final int     DST_OUT         = 8;
 
     // Rule 9 is DST which is defined above where it fits into the
     // list logically, rather than numerically
@@ -487,7 +485,7 @@
      *</pre>
      * @since 1.4
      */
-    public static final int     SRC_ATOP        = 10;
+    @Native public static final int     SRC_ATOP        = 10;
 
     /**
      * The part of the destination lying inside of the source
@@ -501,7 +499,7 @@
      *</pre>
      * @since 1.4
      */
-    public static final int     DST_ATOP        = 11;
+    @Native public static final int     DST_ATOP        = 11;
 
     /**
      * The part of the source that lies outside of the destination
@@ -516,7 +514,7 @@
      *</pre>
      * @since 1.4
      */
-    public static final int     XOR             = 12;
+    @Native public static final int     XOR             = 12;
 
     /**
      * <code>AlphaComposite</code> object that implements the opaque CLEAR rule
@@ -606,8 +604,8 @@
      */
     public static final AlphaComposite Xor      = new AlphaComposite(XOR);
 
-    private static final int MIN_RULE = CLEAR;
-    private static final int MAX_RULE = XOR;
+    @Native private static final int MIN_RULE = CLEAR;
+    @Native private static final int MAX_RULE = XOR;
 
     float extraAlpha;
     int rule;
diff --git a/jdk/src/share/classes/java/awt/BasicStroke.java b/jdk/src/share/classes/java/awt/BasicStroke.java
index 2e5c8de..55d59d4 100644
--- a/jdk/src/share/classes/java/awt/BasicStroke.java
+++ b/jdk/src/share/classes/java/awt/BasicStroke.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, 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
@@ -27,7 +27,7 @@
 
 import java.beans.ConstructorProperties;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * The <code>BasicStroke</code> class defines a basic set of rendering
@@ -111,47 +111,45 @@
  * @see Graphics2D
  * @author Jim Graham
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class BasicStroke implements Stroke {
 
     /**
      * Joins path segments by extending their outside edges until
      * they meet.
      */
-    public final static int JOIN_MITER = 0;
+    @Native public final static int JOIN_MITER = 0;
 
     /**
      * Joins path segments by rounding off the corner at a radius
      * of half the line width.
      */
-    public final static int JOIN_ROUND = 1;
+    @Native public final static int JOIN_ROUND = 1;
 
     /**
      * Joins path segments by connecting the outer corners of their
      * wide outlines with a straight segment.
      */
-    public final static int JOIN_BEVEL = 2;
+    @Native public final static int JOIN_BEVEL = 2;
 
     /**
      * Ends unclosed subpaths and dash segments with no added
      * decoration.
      */
-    public final static int CAP_BUTT = 0;
+    @Native public final static int CAP_BUTT = 0;
 
     /**
      * Ends unclosed subpaths and dash segments with a round
      * decoration that has a radius equal to half of the width
      * of the pen.
      */
-    public final static int CAP_ROUND = 1;
+    @Native public final static int CAP_ROUND = 1;
 
     /**
      * Ends unclosed subpaths and dash segments with a square
      * projection that extends beyond the end of the segment
      * to a distance equal to half of the line width.
      */
-    public final static int CAP_SQUARE = 2;
+    @Native public final static int CAP_SQUARE = 2;
 
     float width;
 
diff --git a/jdk/src/share/classes/java/awt/Choice.java b/jdk/src/share/classes/java/awt/Choice.java
index 9ef7658..e026953 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, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -34,7 +34,6 @@
 
 import javax.accessibility.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The <code>Choice</code> class presents a pop-up menu of choices.
@@ -71,8 +70,6 @@
  * @author      Arthur van Hoff
  * @since       JDK1.0
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class Choice extends Component implements ItemSelectable, Accessible {
     /**
      * The items for the <code>Choice</code>.
diff --git a/jdk/src/share/classes/java/awt/DisplayMode.java b/jdk/src/share/classes/java/awt/DisplayMode.java
index a4ca0f1..c4bd095 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, 2006, 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
@@ -25,7 +25,7 @@
 
 package java.awt;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * The <code>DisplayMode</code> class encapsulates the bit depth, height,
@@ -46,8 +46,6 @@
  * @since 1.4
  */
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class DisplayMode {
 
     private Dimension size;
@@ -94,7 +92,7 @@
      * display mode.
      * @see #getBitDepth
      */
-    public final static int BIT_DEPTH_MULTI = -1;
+    @Native public final static int BIT_DEPTH_MULTI = -1;
 
     /**
      * Returns the bit depth of the display, in bits per pixel.  This may be
@@ -112,7 +110,7 @@
      * Value of the refresh rate if not known.
      * @see #getRefreshRate
      */
-    public final static int REFRESH_RATE_UNKNOWN = 0;
+    @Native public final static int REFRESH_RATE_UNKNOWN = 0;
 
     /**
      * Returns the refresh rate of the display, in hertz.  This may be
diff --git a/jdk/src/share/classes/java/awt/Image.java b/jdk/src/share/classes/java/awt/Image.java
index 521509d..ce23169 100644
--- a/jdk/src/share/classes/java/awt/Image.java
+++ b/jdk/src/share/classes/java/awt/Image.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -33,7 +33,6 @@
 
 import sun.awt.image.SurfaceManager;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The abstract class <code>Image</code> is the superclass of all
@@ -44,8 +43,6 @@
  * @author      Arthur van Hoff
  * @since       JDK1.0
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class Image {
 
     /**
diff --git a/jdk/src/share/classes/java/awt/List.java b/jdk/src/share/classes/java/awt/List.java
index 562f400..92a1867 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, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -33,7 +33,6 @@
 import java.io.ObjectInputStream;
 import java.io.IOException;
 import javax.accessibility.*;
-import javax.tools.annotation.GenerateNativeHeader;
 
 
 /**
@@ -107,8 +106,6 @@
  * @see         java.awt.event.ActionListener
  * @since       JDK1.0
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class List extends Component implements ItemSelectable, Accessible {
     /**
      * A vector created to contain items which will become
diff --git a/jdk/src/share/classes/java/awt/PopupMenu.java b/jdk/src/share/classes/java/awt/PopupMenu.java
index 1c700a1..0e70063 100644
--- a/jdk/src/share/classes/java/awt/PopupMenu.java
+++ b/jdk/src/share/classes/java/awt/PopupMenu.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -28,7 +28,6 @@
 import java.awt.peer.PopupMenuPeer;
 import javax.accessibility.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 import sun.awt.AWTAccessor;
 
@@ -44,8 +43,6 @@
  *
  * @author      Amy Fowler
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class PopupMenu extends Menu {
 
     private static final String base = "popup";
diff --git a/jdk/src/share/classes/java/awt/SystemColor.java b/jdk/src/share/classes/java/awt/SystemColor.java
index a5e2456..931cf32 100644
--- a/jdk/src/share/classes/java/awt/SystemColor.java
+++ b/jdk/src/share/classes/java/awt/SystemColor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -26,7 +26,7 @@
 
 import java.io.ObjectStreamException;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * A class to encapsulate symbolic colors representing the color of
@@ -49,8 +49,6 @@
  * @author      Carl Quinn
  * @author      Amy Fowler
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class SystemColor extends Color implements java.io.Serializable {
 
    /**
@@ -58,187 +56,187 @@
      * {@link #desktop} system color.
      * @see SystemColor#desktop
      */
-    public final static int DESKTOP = 0;
+    @Native public final static int DESKTOP = 0;
 
     /**
      * The array index for the
      * {@link #activeCaption} system color.
      * @see SystemColor#activeCaption
      */
-    public final static int ACTIVE_CAPTION = 1;
+    @Native public final static int ACTIVE_CAPTION = 1;
 
     /**
      * The array index for the
      * {@link #activeCaptionText} system color.
      * @see SystemColor#activeCaptionText
      */
-    public final static int ACTIVE_CAPTION_TEXT = 2;
+    @Native public final static int ACTIVE_CAPTION_TEXT = 2;
 
     /**
      * The array index for the
      * {@link #activeCaptionBorder} system color.
      * @see SystemColor#activeCaptionBorder
      */
-    public final static int ACTIVE_CAPTION_BORDER = 3;
+    @Native public final static int ACTIVE_CAPTION_BORDER = 3;
 
     /**
      * The array index for the
      * {@link #inactiveCaption} system color.
      * @see SystemColor#inactiveCaption
      */
-    public final static int INACTIVE_CAPTION = 4;
+    @Native public final static int INACTIVE_CAPTION = 4;
 
     /**
      * The array index for the
      * {@link #inactiveCaptionText} system color.
      * @see SystemColor#inactiveCaptionText
      */
-    public final static int INACTIVE_CAPTION_TEXT = 5;
+    @Native public final static int INACTIVE_CAPTION_TEXT = 5;
 
     /**
      * The array index for the
      * {@link #inactiveCaptionBorder} system color.
      * @see SystemColor#inactiveCaptionBorder
      */
-    public final static int INACTIVE_CAPTION_BORDER = 6;
+    @Native public final static int INACTIVE_CAPTION_BORDER = 6;
 
     /**
      * The array index for the
      * {@link #window} system color.
      * @see SystemColor#window
      */
-    public final static int WINDOW = 7;
+    @Native public final static int WINDOW = 7;
 
     /**
      * The array index for the
      * {@link #windowBorder} system color.
      * @see SystemColor#windowBorder
      */
-    public final static int WINDOW_BORDER = 8;
+    @Native public final static int WINDOW_BORDER = 8;
 
     /**
      * The array index for the
      * {@link #windowText} system color.
      * @see SystemColor#windowText
      */
-    public final static int WINDOW_TEXT = 9;
+    @Native public final static int WINDOW_TEXT = 9;
 
     /**
      * The array index for the
      * {@link #menu} system color.
      * @see SystemColor#menu
      */
-    public final static int MENU = 10;
+    @Native public final static int MENU = 10;
 
     /**
      * The array index for the
      * {@link #menuText} system color.
      * @see SystemColor#menuText
      */
-    public final static int MENU_TEXT = 11;
+    @Native public final static int MENU_TEXT = 11;
 
     /**
      * The array index for the
      * {@link #text} system color.
      * @see SystemColor#text
      */
-    public final static int TEXT = 12;
+    @Native public final static int TEXT = 12;
 
     /**
      * The array index for the
      * {@link #textText} system color.
      * @see SystemColor#textText
      */
-    public final static int TEXT_TEXT = 13;
+    @Native public final static int TEXT_TEXT = 13;
 
     /**
      * The array index for the
      * {@link #textHighlight} system color.
      * @see SystemColor#textHighlight
      */
-    public final static int TEXT_HIGHLIGHT = 14;
+    @Native public final static int TEXT_HIGHLIGHT = 14;
 
     /**
      * The array index for the
      * {@link #textHighlightText} system color.
      * @see SystemColor#textHighlightText
      */
-    public final static int TEXT_HIGHLIGHT_TEXT = 15;
+    @Native public final static int TEXT_HIGHLIGHT_TEXT = 15;
 
     /**
      * The array index for the
      * {@link #textInactiveText} system color.
      * @see SystemColor#textInactiveText
      */
-    public final static int TEXT_INACTIVE_TEXT = 16;
+    @Native public final static int TEXT_INACTIVE_TEXT = 16;
 
     /**
      * The array index for the
      * {@link #control} system color.
      * @see SystemColor#control
      */
-    public final static int CONTROL = 17;
+    @Native public final static int CONTROL = 17;
 
     /**
      * The array index for the
      * {@link #controlText} system color.
      * @see SystemColor#controlText
      */
-    public final static int CONTROL_TEXT = 18;
+    @Native public final static int CONTROL_TEXT = 18;
 
     /**
      * The array index for the
      * {@link #controlHighlight} system color.
      * @see SystemColor#controlHighlight
      */
-    public final static int CONTROL_HIGHLIGHT = 19;
+    @Native public final static int CONTROL_HIGHLIGHT = 19;
 
     /**
      * The array index for the
      * {@link #controlLtHighlight} system color.
      * @see SystemColor#controlLtHighlight
      */
-    public final static int CONTROL_LT_HIGHLIGHT = 20;
+    @Native public final static int CONTROL_LT_HIGHLIGHT = 20;
 
     /**
      * The array index for the
      * {@link #controlShadow} system color.
      * @see SystemColor#controlShadow
      */
-    public final static int CONTROL_SHADOW = 21;
+    @Native public final static int CONTROL_SHADOW = 21;
 
     /**
      * The array index for the
      * {@link #controlDkShadow} system color.
      * @see SystemColor#controlDkShadow
      */
-    public final static int CONTROL_DK_SHADOW = 22;
+    @Native public final static int CONTROL_DK_SHADOW = 22;
 
     /**
      * The array index for the
      * {@link #scrollbar} system color.
      * @see SystemColor#scrollbar
      */
-    public final static int SCROLLBAR = 23;
+    @Native public final static int SCROLLBAR = 23;
 
     /**
      * The array index for the
      * {@link #info} system color.
      * @see SystemColor#info
      */
-    public final static int INFO = 24;
+    @Native public final static int INFO = 24;
 
     /**
      * The array index for the
      * {@link #infoText} system color.
      * @see SystemColor#infoText
      */
-    public final static int INFO_TEXT = 25;
+    @Native public final static int INFO_TEXT = 25;
 
     /**
      * The number of system colors in the array.
      */
-    public final static int NUM_COLORS = 26;
+    @Native public final static int NUM_COLORS = 26;
 
     /******************************************************************************************/
 
diff --git a/jdk/src/share/classes/java/awt/TextComponent.java b/jdk/src/share/classes/java/awt/TextComponent.java
index 0a2fe25..7a6cd26 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, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -35,7 +35,6 @@
 import javax.swing.text.AttributeSet;
 import javax.accessibility.*;
 import java.awt.im.InputMethodRequests;
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The <code>TextComponent</code> class is the superclass of
@@ -57,8 +56,6 @@
  * @author      Arthur van Hoff
  * @since       JDK1.0
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class TextComponent extends Component implements Accessible {
 
     /**
diff --git a/jdk/src/share/classes/java/awt/Transparency.java b/jdk/src/share/classes/java/awt/Transparency.java
index e968ebb..2c8f845 100644
--- a/jdk/src/share/classes/java/awt/Transparency.java
+++ b/jdk/src/share/classes/java/awt/Transparency.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, 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
@@ -25,34 +25,32 @@
 
 package java.awt;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * The <code>Transparency</code> interface defines the common transparency
  * modes for implementing classes.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface Transparency {
 
     /**
      * Represents image data that is guaranteed to be completely opaque,
      * meaning that all pixels have an alpha value of 1.0.
      */
-    public final static int OPAQUE            = 1;
+    @Native public final static int OPAQUE            = 1;
 
     /**
      * Represents image data that is guaranteed to be either completely
      * opaque, with an alpha value of 1.0, or completely transparent,
      * with an alpha value of 0.0.
      */
-    public final static int BITMASK = 2;
+    @Native public final static int BITMASK = 2;
 
     /**
      * Represents image data that contains or might contain arbitrary
      * alpha values between and including 0.0 and 1.0.
      */
-    public final static int TRANSLUCENT        = 3;
+    @Native public final static int TRANSLUCENT        = 3;
 
     /**
      * Returns the type of this <code>Transparency</code>.
diff --git a/jdk/src/share/classes/java/awt/color/ColorSpace.java b/jdk/src/share/classes/java/awt/color/ColorSpace.java
index f4ca58b..c0bcb49 100644
--- a/jdk/src/share/classes/java/awt/color/ColorSpace.java
+++ b/jdk/src/share/classes/java/awt/color/ColorSpace.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, 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
@@ -35,7 +35,7 @@
 
 package java.awt.color;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 import sun.java2d.cmm.PCMM;
 import sun.java2d.cmm.CMSManager;
@@ -95,8 +95,6 @@
  * @see ICC_ColorSpace
  */
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class ColorSpace implements java.io.Serializable {
 
     static final long serialVersionUID = -409452704308689724L;
@@ -115,127 +113,127 @@
     /**
      * Any of the family of XYZ color spaces.
      */
-    public static final int TYPE_XYZ = 0;
+    @Native public static final int TYPE_XYZ = 0;
 
     /**
      * Any of the family of Lab color spaces.
      */
-    public static final int TYPE_Lab = 1;
+    @Native public static final int TYPE_Lab = 1;
 
     /**
      * Any of the family of Luv color spaces.
      */
-    public static final int TYPE_Luv = 2;
+    @Native public static final int TYPE_Luv = 2;
 
     /**
      * Any of the family of YCbCr color spaces.
      */
-    public static final int TYPE_YCbCr = 3;
+    @Native public static final int TYPE_YCbCr = 3;
 
     /**
      * Any of the family of Yxy color spaces.
      */
-    public static final int TYPE_Yxy = 4;
+    @Native public static final int TYPE_Yxy = 4;
 
     /**
      * Any of the family of RGB color spaces.
      */
-    public static final int TYPE_RGB = 5;
+    @Native public static final int TYPE_RGB = 5;
 
     /**
      * Any of the family of GRAY color spaces.
      */
-    public static final int TYPE_GRAY = 6;
+    @Native public static final int TYPE_GRAY = 6;
 
     /**
      * Any of the family of HSV color spaces.
      */
-    public static final int TYPE_HSV = 7;
+    @Native public static final int TYPE_HSV = 7;
 
     /**
      * Any of the family of HLS color spaces.
      */
-    public static final int TYPE_HLS = 8;
+    @Native public static final int TYPE_HLS = 8;
 
     /**
      * Any of the family of CMYK color spaces.
      */
-    public static final int TYPE_CMYK = 9;
+    @Native public static final int TYPE_CMYK = 9;
 
     /**
      * Any of the family of CMY color spaces.
      */
-    public static final int TYPE_CMY = 11;
+    @Native public static final int TYPE_CMY = 11;
 
     /**
      * Generic 2 component color spaces.
      */
-    public static final int TYPE_2CLR = 12;
+    @Native public static final int TYPE_2CLR = 12;
 
     /**
      * Generic 3 component color spaces.
      */
-    public static final int TYPE_3CLR = 13;
+    @Native public static final int TYPE_3CLR = 13;
 
     /**
      * Generic 4 component color spaces.
      */
-    public static final int TYPE_4CLR = 14;
+    @Native public static final int TYPE_4CLR = 14;
 
     /**
      * Generic 5 component color spaces.
      */
-    public static final int TYPE_5CLR = 15;
+    @Native public static final int TYPE_5CLR = 15;
 
     /**
      * Generic 6 component color spaces.
      */
-    public static final int TYPE_6CLR = 16;
+    @Native public static final int TYPE_6CLR = 16;
 
     /**
      * Generic 7 component color spaces.
      */
-    public static final int TYPE_7CLR = 17;
+    @Native public static final int TYPE_7CLR = 17;
 
     /**
      * Generic 8 component color spaces.
      */
-    public static final int TYPE_8CLR = 18;
+    @Native public static final int TYPE_8CLR = 18;
 
     /**
      * Generic 9 component color spaces.
      */
-    public static final int TYPE_9CLR = 19;
+    @Native public static final int TYPE_9CLR = 19;
 
     /**
      * Generic 10 component color spaces.
      */
-    public static final int TYPE_ACLR = 20;
+    @Native public static final int TYPE_ACLR = 20;
 
     /**
      * Generic 11 component color spaces.
      */
-    public static final int TYPE_BCLR = 21;
+    @Native public static final int TYPE_BCLR = 21;
 
     /**
      * Generic 12 component color spaces.
      */
-    public static final int TYPE_CCLR = 22;
+    @Native public static final int TYPE_CCLR = 22;
 
     /**
      * Generic 13 component color spaces.
      */
-    public static final int TYPE_DCLR = 23;
+    @Native public static final int TYPE_DCLR = 23;
 
     /**
      * Generic 14 component color spaces.
      */
-    public static final int TYPE_ECLR = 24;
+    @Native public static final int TYPE_ECLR = 24;
 
     /**
      * Generic 15 component color spaces.
      */
-    public static final int TYPE_FCLR = 25;
+    @Native public static final int TYPE_FCLR = 25;
 
     /**
      * The sRGB color space defined at
@@ -243,28 +241,28 @@
      * http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html
      * </A>.
      */
-    public static final int CS_sRGB = 1000;
+    @Native public static final int CS_sRGB = 1000;
 
     /**
      * A built-in linear RGB color space.  This space is based on the
      * same RGB primaries as CS_sRGB, but has a linear tone reproduction curve.
      */
-    public static final int CS_LINEAR_RGB = 1004;
+    @Native public static final int CS_LINEAR_RGB = 1004;
 
     /**
      * The CIEXYZ conversion color space defined above.
      */
-    public static final int CS_CIEXYZ = 1001;
+    @Native public static final int CS_CIEXYZ = 1001;
 
     /**
      * The Photo YCC conversion color space.
      */
-    public static final int CS_PYCC = 1002;
+    @Native public static final int CS_PYCC = 1002;
 
     /**
      * The built-in linear gray scale color space.
      */
-    public static final int CS_GRAY = 1003;
+    @Native public static final int CS_GRAY = 1003;
 
 
     /**
diff --git a/jdk/src/share/classes/java/awt/color/ICC_Profile.java b/jdk/src/share/classes/java/awt/color/ICC_Profile.java
index 321db6c..b459f63 100644
--- a/jdk/src/share/classes/java/awt/color/ICC_Profile.java
+++ b/jdk/src/share/classes/java/awt/color/ICC_Profile.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, 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
@@ -58,7 +58,6 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * A representation of color profile data for device independent and
@@ -90,8 +89,6 @@
  */
 
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class ICC_Profile implements Serializable {
 
     private static final long serialVersionUID = -3938515861990936766L;
diff --git a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java
index 20ead5e..acbc0fe 100644
--- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java
+++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java
@@ -25,7 +25,6 @@
 
 package java.awt.datatransfer;
 
-import java.awt.Toolkit;
 import java.io.*;
 import java.nio.*;
 import java.util.*;
@@ -162,6 +161,18 @@
         }
     }
 
+    /*
+     * private initializer
+     */
+    static private DataFlavor initHtmlDataFlavor(String htmlFlavorType) {
+        try {
+            return new DataFlavor ("text/html; class=java.lang.String;document=" +
+                                       htmlFlavorType + ";charset=Unicode");
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
     /**
      * The <code>DataFlavor</code> representing a Java Unicode String class,
      * where:
@@ -246,6 +257,46 @@
     public static final String javaRemoteObjectMimeType = "application/x-java-remote-object";
 
     /**
+     * Represents a piece of an HTML markup. The markup consists of the part
+     * selected on the source side. Therefore some tags in the markup may be
+     * unpaired. If the flavor is used to represent the data in
+     * a {@link Transferable} instance, no additional changes will be made.
+     * This DataFlavor instance represents the same HTML markup as DataFlavor
+     * instances which content MIME type does not contain document parameter
+     * and representation class is the String class.
+     * <pre>
+     *     representationClass = String
+     *     mimeType           = "text/html"
+     * </pre>
+     */
+    public static DataFlavor selectionHtmlFlavor = initHtmlDataFlavor("selection");
+
+    /**
+     * Represents a piece of an HTML markup. If possible, the markup received
+     * from a native system is supplemented with pair tags to be
+     * a well-formed HTML markup. If the flavor is used to represent the data in
+     * a {@link Transferable} instance, no additional changes will be made.
+     * <pre>
+     *     representationClass = String
+     *     mimeType           = "text/html"
+     * </pre>
+     */
+    public static DataFlavor fragmentHtmlFlavor = initHtmlDataFlavor("fragment");
+
+    /**
+     * Represents a piece of an HTML markup. If possible, the markup
+     * received from a native system is supplemented with additional
+     * tags to make up a well-formed HTML document. If the flavor is used to
+     * represent the data in a {@link Transferable} instance,
+     * no additional changes will be made.
+     * <pre>
+     *     representationClass = String
+     *     mimeType           = "text/html"
+     * </pre>
+     */
+    public static  DataFlavor allHtmlFlavor = initHtmlDataFlavor("all");
+
+    /**
      * Constructs a new <code>DataFlavor</code>.  This constructor is
      * provided only for the purpose of supporting the
      * <code>Externalizable</code> interface.  It is not
@@ -949,24 +1000,35 @@
                 return false;
             }
 
-            if ("text".equals(getPrimaryType()) &&
-                DataTransferer.doesSubtypeSupportCharset(this) &&
-                representationClass != null &&
-                !(isRepresentationClassReader() ||
-                  String.class.equals(representationClass) ||
-                  isRepresentationClassCharBuffer() ||
-                  DataTransferer.charArrayClass.equals(representationClass)))
-            {
-                String thisCharset =
-                    DataTransferer.canonicalName(getParameter("charset"));
-                String thatCharset =
-                    DataTransferer.canonicalName(that.getParameter("charset"));
-                if (thisCharset == null) {
-                    if (thatCharset != null) {
-                        return false;
+            if ("text".equals(getPrimaryType())) {
+                if (DataTransferer.doesSubtypeSupportCharset(this) &&
+                    representationClass != null &&
+                    !(isRepresentationClassReader() ||
+                        String.class.equals(representationClass) ||
+                        isRepresentationClassCharBuffer() ||
+                        DataTransferer.charArrayClass.equals(representationClass)))
+                {
+                    String thisCharset =
+                        DataTransferer.canonicalName(getParameter("charset"));
+                    String thatCharset =
+                        DataTransferer.canonicalName(that.getParameter("charset"));
+                    if (thisCharset == null) {
+                        if (thatCharset != null) {
+                            return false;
+                        }
+                    } else {
+                        if (!thisCharset.equals(thatCharset)) {
+                            return false;
+                        }
                     }
-                } else {
-                    if (!thisCharset.equals(thatCharset)) {
+                }
+
+                if ("html".equals(getSubType()) &&
+                        this.getParameter("document") != null )
+                {
+                   if (!this.getParameter("document").
+                            equals(that.getParameter("document")))
+                    {
                         return false;
                     }
                 }
diff --git a/jdk/src/share/classes/java/awt/datatransfer/StringSelection.java b/jdk/src/share/classes/java/awt/datatransfer/StringSelection.java
index c646015..6036bd8 100644
--- a/jdk/src/share/classes/java/awt/datatransfer/StringSelection.java
+++ b/jdk/src/share/classes/java/awt/datatransfer/StringSelection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -27,7 +27,6 @@
 
 import java.io.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * A <code>Transferable</code> which implements the capability required
@@ -43,8 +42,6 @@
  * @see java.awt.datatransfer.DataFlavor#stringFlavor
  * @see java.awt.datatransfer.DataFlavor#plainTextFlavor
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class StringSelection implements Transferable, ClipboardOwner {
 
     private static final int STRING = 0;
diff --git a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
index eee5c09..fe69767 100644
--- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
+++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
@@ -41,7 +41,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedList;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -101,6 +101,11 @@
     private static final String TEXT_PLAIN_BASE_TYPE = "text/plain";
 
     /**
+     * A String representing text/html MIME type.
+     */
+    private static final String HTML_TEXT_BASE_TYPE = "text/html";
+
+    /**
      * This constant is passed to flavorToNativeLookup() to indicate that a
      * a native should be synthesized, stored, and returned by encoding the
      * DataFlavor's MIME type in case if the DataFlavor is not found in
@@ -113,7 +118,7 @@
      * text DataFlavors).
      * Do not use the field directly, use getNativeToFlavor() instead.
      */
-    private Map nativeToFlavor = new HashMap();
+    private final Map<String, List<DataFlavor>> nativeToFlavor = new HashMap<>();
 
     /**
      * Accessor to nativeToFlavor map.  Since we use lazy initialization we must
@@ -122,7 +127,7 @@
      *
      * @return nativeToFlavor
      */
-    private Map getNativeToFlavor() {
+    private Map<String, List<DataFlavor>> getNativeToFlavor() {
         if (!isMapInitialized) {
             initSystemFlavorMap();
         }
@@ -134,7 +139,7 @@
      * native Strings.
      * Do not use the field directly, use getFlavorToNative() instead.
      */
-    private Map flavorToNative = new HashMap();
+    private final Map flavorToNative = new HashMap();
 
     /**
      * Accessor to flavorToNative map.  Since we use lazy initialization we must
@@ -421,14 +426,17 @@
                         }
                     }
 
-                    // For text/* flavors, store mappings in separate maps to
-                    // enable dynamic mapping generation at a run-time.
+                    final LinkedHashSet<DataFlavor> dfs = new LinkedHashSet<>();
+
+                    dfs.add(flavor);
+
                     if ("text".equals(flavor.getPrimaryType())) {
-                        store(value, key, getFlavorToNative());
-                        store(key, value, getNativeToFlavor());
-                    } else {
-                        store(flavor, key, getFlavorToNative());
-                        store(key, flavor, getNativeToFlavor());
+                        dfs.addAll(convertMimeTypeToDataFlavors(value));
+                    }
+
+                    for (DataFlavor df : dfs) {
+                        store(df, key, getFlavorToNative());
+                        store(key, df, getNativeToFlavor());
                     }
                 }
             }
@@ -530,7 +538,7 @@
      * only if the specified native is encoded as a Java MIME type.
      */
     private List nativeToFlavorLookup(String nat) {
-        List flavors = (List)getNativeToFlavor().get(nat);
+        List<DataFlavor> flavors = getNativeToFlavor().get(nat);
 
         if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
             DataTransferer transferer = DataTransferer.getInstance();
@@ -625,7 +633,7 @@
                 getNativesForFlavorCache.remove(flav);
                 getNativesForFlavorCache.remove(null);
 
-                List flavors = (List)getNativeToFlavor().get(encoded);
+                List<DataFlavor> flavors = getNativeToFlavor().get(encoded);
                 if (flavors == null) {
                     flavors = new ArrayList(1);
                     getNativeToFlavor().put(encoded, flavors);
@@ -681,7 +689,7 @@
         }
 
         if (flav == null) {
-            retval = new ArrayList(getNativeToFlavor().keySet());
+            retval = new ArrayList<String>(getNativeToFlavor().keySet());
         } else if (disabledMappingGenerationKeys.contains(flav)) {
             // In this case we shouldn't synthesize a native for this flavor,
             // since its mappings were explicitly specified.
@@ -809,142 +817,164 @@
             }
         }
 
-        LinkedList retval = new LinkedList();
+        final LinkedHashSet <DataFlavor> returnValue =
+            new LinkedHashSet<>();
 
         if (nat == null) {
-            List natives = getNativesForFlavor(null);
-            HashSet dups = new HashSet(natives.size());
+            final List<String> natives = getNativesForFlavor(null);
 
-            for (Iterator natives_iter = natives.iterator();
-                 natives_iter.hasNext(); )
+            for (String n : natives)
             {
-                List flavors =
-                    getFlavorsForNative((String)natives_iter.next());
-                for (Iterator flavors_iter = flavors.iterator();
-                     flavors_iter.hasNext(); )
+                final List<DataFlavor> flavors = getFlavorsForNative(n);
+
+                for (DataFlavor df : flavors)
                 {
-                    Object flavor = flavors_iter.next();
-                    if (dups.add(flavor)) {
-                        retval.add(flavor);
-                    }
+                    returnValue.add(df);
                 }
             }
         } else {
-            List flavors = nativeToFlavorLookup(nat);
+
+            final List<DataFlavor> flavors = nativeToFlavorLookup(nat);
 
             if (disabledMappingGenerationKeys.contains(nat)) {
                 return flavors;
             }
 
-            HashSet dups = new HashSet(flavors.size());
+            final List<DataFlavor> flavorsAndBaseTypes =
+                nativeToFlavorLookup(nat);
 
-            List flavorsAndbaseTypes = nativeToFlavorLookup(nat);
-
-            for (Iterator flavorsAndbaseTypes_iter =
-                     flavorsAndbaseTypes.iterator();
-                 flavorsAndbaseTypes_iter.hasNext(); )
-            {
-                Object value = flavorsAndbaseTypes_iter.next();
-                if (value instanceof String) {
-                    String baseType = (String)value;
-                    String subType = null;
+            for (DataFlavor df : flavorsAndBaseTypes) {
+                returnValue.add(df);
+                if ("text".equals(df.getPrimaryType())) {
                     try {
-                        MimeType mimeType = new MimeType(baseType);
-                        subType = mimeType.getSubType();
-                    } catch (MimeTypeParseException mtpe) {
-                        // Cannot happen, since we checked all mappings
-                        // on load from flavormap.properties.
-                        assert(false);
-                    }
-                    if (DataTransferer.doesSubtypeSupportCharset(subType,
-                                                                 null)) {
-                        if (TEXT_PLAIN_BASE_TYPE.equals(baseType) &&
-                            dups.add(DataFlavor.stringFlavor))
-                        {
-                            retval.add(DataFlavor.stringFlavor);
-                        }
-
-                        for (int i = 0; i < UNICODE_TEXT_CLASSES.length; i++) {
-                            DataFlavor toAdd = null;
-                            try {
-                                toAdd = new DataFlavor
-                                    (baseType + ";charset=Unicode;class=" +
-                                     UNICODE_TEXT_CLASSES[i]);
-                            } catch (ClassNotFoundException cannotHappen) {
-                            }
-                            if (dups.add(toAdd)) {
-                                retval.add(toAdd);
-                            }
-                        }
-
-                        for (Iterator charset_iter =
-                                 DataTransferer.standardEncodings();
-                             charset_iter.hasNext(); )
-                        {
-                            String charset = (String)charset_iter.next();
-
-                            for (int i = 0; i < ENCODED_TEXT_CLASSES.length;
-                                 i++)
-                            {
-                                DataFlavor toAdd = null;
-                                try {
-                                    toAdd = new DataFlavor
-                                        (baseType + ";charset=" + charset +
-                                         ";class=" + ENCODED_TEXT_CLASSES[i]);
-                                } catch (ClassNotFoundException cannotHappen) {
-                                }
-
-                                // Check for equality to plainTextFlavor so
-                                // that we can ensure that the exact charset of
-                                // plainTextFlavor, not the canonical charset
-                                // or another equivalent charset with a
-                                // different name, is used.
-                                if (toAdd.equals(DataFlavor.plainTextFlavor)) {
-                                    toAdd = DataFlavor.plainTextFlavor;
-                                }
-
-                                if (dups.add(toAdd)) {
-                                    retval.add(toAdd);
-                                }
-                            }
-                        }
-
-                        if (TEXT_PLAIN_BASE_TYPE.equals(baseType) &&
-                            dups.add(DataFlavor.plainTextFlavor))
-                        {
-                            retval.add(DataFlavor.plainTextFlavor);
-                        }
-                    } else {
-                        // Non-charset text natives should be treated as
-                        // opaque, 8-bit data in any of its various
-                        // representations.
-                        for (int i = 0; i < ENCODED_TEXT_CLASSES.length; i++) {
-                            DataFlavor toAdd = null;
-                            try {
-                                toAdd = new DataFlavor(baseType +
-                                     ";class=" + ENCODED_TEXT_CLASSES[i]);
-                            } catch (ClassNotFoundException cannotHappen) {
-                            }
-
-                            if (dups.add(toAdd)) {
-                                retval.add(toAdd);
-                            }
-                        }
-                    }
-                } else {
-                    DataFlavor flavor = (DataFlavor)value;
-                    if (dups.add(flavor)) {
-                        retval.add(flavor);
+                        returnValue.addAll(
+                                convertMimeTypeToDataFlavors(
+                                        new MimeType(df.getMimeType()
+                                        ).getBaseType()));
+                    } catch (MimeTypeParseException e) {
+                        e.printStackTrace();
                     }
                 }
             }
+
         }
 
-        ArrayList arrayList = new ArrayList(retval);
+        final ArrayList arrayList = new ArrayList(returnValue);
         getFlavorsForNativeCache.put(nat, new SoftReference(arrayList));
         return (List)arrayList.clone();
     }
 
+    private static LinkedHashSet<DataFlavor> convertMimeTypeToDataFlavors(
+        final String baseType) {
+
+        final LinkedHashSet<DataFlavor> returnValue =
+            new LinkedHashSet<DataFlavor>();
+
+        String subType = null;
+
+        try {
+            final MimeType mimeType = new MimeType(baseType);
+            subType = mimeType.getSubType();
+        } catch (MimeTypeParseException mtpe) {
+            // Cannot happen, since we checked all mappings
+            // on load from flavormap.properties.
+            assert(false);
+        }
+
+        if (DataTransferer.doesSubtypeSupportCharset(subType, null)) {
+            if (TEXT_PLAIN_BASE_TYPE.equals(baseType))
+            {
+                returnValue.add(DataFlavor.stringFlavor);
+            }
+
+            for (String unicodeClassName : UNICODE_TEXT_CLASSES) {
+                final String mimeType = baseType + ";charset=Unicode;class=" +
+                                            unicodeClassName;
+
+                final LinkedHashSet<String> mimeTypes =
+                    handleHtmlMimeTypes(baseType, mimeType);
+                for (String mt : mimeTypes) {
+                    DataFlavor toAdd = null;
+                    try {
+                        toAdd = new DataFlavor(mt);
+                    } catch (ClassNotFoundException cannotHappen) {
+                    }
+                    returnValue.add(toAdd);
+                }
+            }
+
+            for (String charset : DataTransferer.standardEncodings()) {
+
+                for (String encodedTextClass : ENCODED_TEXT_CLASSES) {
+                    final String mimeType =
+                            baseType + ";charset=" + charset +
+                            ";class=" + encodedTextClass;
+
+                    final LinkedHashSet<String> mimeTypes =
+                        handleHtmlMimeTypes(baseType, mimeType);
+
+                    for (String mt : mimeTypes) {
+
+                        DataFlavor df = null;
+
+                        try {
+                            df = new DataFlavor(mt);
+                            // Check for equality to plainTextFlavor so
+                            // that we can ensure that the exact charset of
+                            // plainTextFlavor, not the canonical charset
+                            // or another equivalent charset with a
+                            // different name, is used.
+                            if (df.equals(DataFlavor.plainTextFlavor)) {
+                                df = DataFlavor.plainTextFlavor;
+                            }
+                        } catch (ClassNotFoundException cannotHappen) {
+                        }
+
+                        returnValue.add(df);
+                    }
+                }
+            }
+
+            if (TEXT_PLAIN_BASE_TYPE.equals(baseType))
+            {
+                returnValue.add(DataFlavor.plainTextFlavor);
+            }
+        } else {
+            // Non-charset text natives should be treated as
+            // opaque, 8-bit data in any of its various
+            // representations.
+            for (String encodedTextClassName : ENCODED_TEXT_CLASSES) {
+                DataFlavor toAdd = null;
+                try {
+                    toAdd = new DataFlavor(baseType +
+                         ";class=" + encodedTextClassName);
+                } catch (ClassNotFoundException cannotHappen) {
+                }
+                returnValue.add(toAdd);
+            }
+        }
+        return returnValue;
+    }
+
+    private static final String [] htmlDocumntTypes =
+        new String [] {"all", "selection", "fragment"};
+
+    private static LinkedHashSet<String> handleHtmlMimeTypes(
+        String baseType, String mimeType) {
+
+        LinkedHashSet<String> returnValues = new LinkedHashSet<>();
+
+        if (HTML_TEXT_BASE_TYPE.equals(baseType)) {
+            for (String documentType : htmlDocumntTypes) {
+                returnValues.add(mimeType + ";document=" + documentType);
+            }
+        } else {
+            returnValues.add(mimeType);
+        }
+
+        return returnValues;
+    }
+
     /**
      * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
      * their most preferred <code>String</code> native. Each native value will
diff --git a/jdk/src/share/classes/java/awt/dnd/DnDConstants.java b/jdk/src/share/classes/java/awt/dnd/DnDConstants.java
index f497332..e4c5fb4 100644
--- a/jdk/src/share/classes/java/awt/dnd/DnDConstants.java
+++ b/jdk/src/share/classes/java/awt/dnd/DnDConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, 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
@@ -25,15 +25,13 @@
 
 package java.awt.dnd;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * This class contains constant values representing
  * the type of action(s) to be performed by a Drag and Drop operation.
  * @since 1.2
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class DnDConstants {
 
     private DnDConstants() {} // define null private constructor.
@@ -41,23 +39,23 @@
     /**
      * An <code>int</code> representing no action.
      */
-    public static final int ACTION_NONE         = 0x0;
+    @Native public static final int ACTION_NONE         = 0x0;
 
     /**
      * An <code>int</code> representing a &quot;copy&quot; action.
      */
-    public static final int ACTION_COPY         = 0x1;
+    @Native public static final int ACTION_COPY         = 0x1;
 
     /**
      * An <code>int</code> representing a &quot;move&quot; action.
      */
-    public static final int ACTION_MOVE         = 0x2;
+    @Native public static final int ACTION_MOVE         = 0x2;
 
     /**
      * An <code>int</code> representing a &quot;copy&quot; or
      * &quot;move&quot; action.
      */
-    public static final int ACTION_COPY_OR_MOVE = ACTION_COPY | ACTION_MOVE;
+    @Native public static final int ACTION_COPY_OR_MOVE = ACTION_COPY | ACTION_MOVE;
 
     /**
      * An <code>int</code> representing a &quot;link&quot; action.
@@ -75,12 +73,12 @@
      * results for the user.
      */
 
-    public static final int ACTION_LINK         = 0x40000000;
+    @Native public static final int ACTION_LINK         = 0x40000000;
 
     /**
      * An <code>int</code> representing a &quot;reference&quot;
      * action (synonym for ACTION_LINK).
      */
-    public static final int ACTION_REFERENCE    = ACTION_LINK;
+    @Native public static final int ACTION_REFERENCE    = ACTION_LINK;
 
 }
diff --git a/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java b/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java
index ed94cee..72a81fc 100644
--- a/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java
+++ b/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java
@@ -36,7 +36,7 @@
 
 public class InvalidDnDOperationException extends IllegalStateException {
 
-    private static final long serialVersionUID = 5156676500247816278L;
+    private static final long serialVersionUID = -6062568741193956678L;
 
     static private String dft_msg = "The operation requested cannot be performed by the DnD system since it is not in the appropriate state";
 
diff --git a/jdk/src/share/classes/java/awt/event/ActionEvent.java b/jdk/src/share/classes/java/awt/event/ActionEvent.java
index 755de2b..08bd8db 100644
--- a/jdk/src/share/classes/java/awt/event/ActionEvent.java
+++ b/jdk/src/share/classes/java/awt/event/ActionEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -27,7 +27,7 @@
 
 import java.awt.AWTEvent;
 import java.awt.Event;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * A semantic event which indicates that a component-defined action occurred.
@@ -57,8 +57,6 @@
  * @author Carl Quinn
  * @since 1.1
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class ActionEvent extends AWTEvent {
 
     /**
@@ -99,7 +97,7 @@
     /**
      * This event id indicates that a meaningful action occured.
      */
-    public static final int ACTION_PERFORMED    = ACTION_FIRST; //Event.ACTION_EVENT
+    @Native public static final int ACTION_PERFORMED    = ACTION_FIRST; //Event.ACTION_EVENT
 
     /**
      * The nonlocalized string that gives more details
diff --git a/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java b/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java
index 669d292..66d54c3 100644
--- a/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java
+++ b/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -27,9 +27,8 @@
 
 import java.awt.Adjustable;
 import java.awt.AWTEvent;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The adjustment event emitted by Adjustable objects like
@@ -57,8 +56,6 @@
  * @author Amy Fowler
  * @since 1.1
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class AdjustmentEvent extends AWTEvent {
 
     /**
@@ -79,27 +76,27 @@
     /**
      * The unit increment adjustment type.
      */
-    public static final int UNIT_INCREMENT      = 1;
+    @Native public static final int UNIT_INCREMENT      = 1;
 
     /**
      * The unit decrement adjustment type.
      */
-    public static final int UNIT_DECREMENT      = 2;
+    @Native public static final int UNIT_DECREMENT      = 2;
 
     /**
      * The block decrement adjustment type.
      */
-    public static final int BLOCK_DECREMENT     = 3;
+    @Native public static final int BLOCK_DECREMENT     = 3;
 
     /**
      * The block increment adjustment type.
      */
-    public static final int BLOCK_INCREMENT     = 4;
+    @Native public static final int BLOCK_INCREMENT     = 4;
 
     /**
      * The absolute tracking adjustment type.
      */
-    public static final int TRACK               = 5;
+    @Native public static final int TRACK               = 5;
 
     /**
      * The adjustable object that fired the event.
diff --git a/jdk/src/share/classes/java/awt/event/ComponentEvent.java b/jdk/src/share/classes/java/awt/event/ComponentEvent.java
index 51c2b68..67149a7 100644
--- a/jdk/src/share/classes/java/awt/event/ComponentEvent.java
+++ b/jdk/src/share/classes/java/awt/event/ComponentEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -28,7 +28,7 @@
 import java.awt.AWTEvent;
 import java.awt.Component;
 import java.awt.Rectangle;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * A low-level event which indicates that a component moved, changed
@@ -65,8 +65,6 @@
  * @author Carl Quinn
  * @since 1.1
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class ComponentEvent extends AWTEvent {
 
     /**
@@ -82,22 +80,22 @@
    /**
      * This event indicates that the component's position changed.
      */
-    public static final int COMPONENT_MOVED     = COMPONENT_FIRST;
+    @Native public static final int COMPONENT_MOVED     = COMPONENT_FIRST;
 
     /**
      * This event indicates that the component's size changed.
      */
-    public static final int COMPONENT_RESIZED   = 1 + COMPONENT_FIRST;
+    @Native public static final int COMPONENT_RESIZED   = 1 + COMPONENT_FIRST;
 
     /**
      * This event indicates that the component was made visible.
      */
-    public static final int COMPONENT_SHOWN     = 2 + COMPONENT_FIRST;
+    @Native public static final int COMPONENT_SHOWN     = 2 + COMPONENT_FIRST;
 
     /**
      * This event indicates that the component was rendered invisible.
      */
-    public static final int COMPONENT_HIDDEN    = 3 + COMPONENT_FIRST;
+    @Native public static final int COMPONENT_HIDDEN    = 3 + COMPONENT_FIRST;
 
     /*
      * JDK 1.1 serialVersionUID
diff --git a/jdk/src/share/classes/java/awt/event/FocusEvent.java b/jdk/src/share/classes/java/awt/event/FocusEvent.java
index f9b1c8d..e70b968 100644
--- a/jdk/src/share/classes/java/awt/event/FocusEvent.java
+++ b/jdk/src/share/classes/java/awt/event/FocusEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -26,7 +26,6 @@
 package java.awt.event;
 
 import java.awt.Component;
-import javax.tools.annotation.GenerateNativeHeader;
 import sun.awt.AppContext;
 import sun.awt.SunToolkit;
 
@@ -64,8 +63,6 @@
  * @author Amy Fowler
  * @since 1.1
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class FocusEvent extends ComponentEvent {
 
     /**
diff --git a/jdk/src/share/classes/java/awt/event/InputMethodEvent.java b/jdk/src/share/classes/java/awt/event/InputMethodEvent.java
index 339078c..ec5548a 100644
--- a/jdk/src/share/classes/java/awt/event/InputMethodEvent.java
+++ b/jdk/src/share/classes/java/awt/event/InputMethodEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -33,7 +33,7 @@
 import java.io.ObjectInputStream;
 import java.text.AttributedCharacterIterator;
 import java.text.CharacterIterator;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * Input method events contain information about text that is being
@@ -56,8 +56,6 @@
  * @author JavaSoft Asia/Pacific
  * @since 1.2
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class InputMethodEvent extends AWTEvent {
 
     /**
@@ -68,25 +66,25 @@
     /**
      * Marks the first integer id for the range of input method event ids.
      */
-    public static final int INPUT_METHOD_FIRST = 1100;
+    @Native public static final int INPUT_METHOD_FIRST = 1100;
 
     /**
      * The event type indicating changed input method text. This event is
      * generated by input methods while processing input.
      */
-    public static final int INPUT_METHOD_TEXT_CHANGED = INPUT_METHOD_FIRST;
+    @Native public static final int INPUT_METHOD_TEXT_CHANGED = INPUT_METHOD_FIRST;
 
     /**
      * The event type indicating a changed insertion point in input method text.
      * This event is
      * generated by input methods while processing input if only the caret changed.
      */
-    public static final int CARET_POSITION_CHANGED = INPUT_METHOD_FIRST + 1;
+    @Native public static final int CARET_POSITION_CHANGED = INPUT_METHOD_FIRST + 1;
 
     /**
      * Marks the last integer id for the range of input method event ids.
      */
-    public static final int INPUT_METHOD_LAST = INPUT_METHOD_FIRST + 1;
+    @Native public static final int INPUT_METHOD_LAST = INPUT_METHOD_FIRST + 1;
 
     /**
      * The time stamp that indicates when the event was created.
diff --git a/jdk/src/share/classes/java/awt/event/MouseWheelEvent.java b/jdk/src/share/classes/java/awt/event/MouseWheelEvent.java
index 2d0228a..b33c723 100644
--- a/jdk/src/share/classes/java/awt/event/MouseWheelEvent.java
+++ b/jdk/src/share/classes/java/awt/event/MouseWheelEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, 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
@@ -27,7 +27,7 @@
 
 import java.awt.Component;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * An event which indicates that the mouse wheel was rotated in a component.
@@ -99,8 +99,6 @@
  * @since 1.4
  */
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class MouseWheelEvent extends MouseEvent {
 
     /**
@@ -109,7 +107,7 @@
      *
      * @see #getScrollType
      */
-    public static final int WHEEL_UNIT_SCROLL = 0;
+    @Native public static final int WHEEL_UNIT_SCROLL = 0;
 
     /**
      * Constant representing scrolling by a "block" (like scrolling
@@ -117,7 +115,7 @@
      *
      * @see #getScrollType
      */
-    public static final int WHEEL_BLOCK_SCROLL = 1;
+    @Native public static final int WHEEL_BLOCK_SCROLL = 1;
 
     /**
      * Indicates what sort of scrolling should take place in response to this
diff --git a/jdk/src/share/classes/java/awt/event/WindowEvent.java b/jdk/src/share/classes/java/awt/event/WindowEvent.java
index 1fee154..49e45f3 100644
--- a/jdk/src/share/classes/java/awt/event/WindowEvent.java
+++ b/jdk/src/share/classes/java/awt/event/WindowEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -26,7 +26,7 @@
 package java.awt.event;
 
 import java.awt.Window;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 import sun.awt.AppContext;
 import sun.awt.SunToolkit;
 
@@ -56,8 +56,6 @@
  *
  * @since JDK1.1
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class WindowEvent extends ComponentEvent {
 
     /**
@@ -69,7 +67,7 @@
      * The window opened event.  This event is delivered only
      * the first time a window is made visible.
      */
-    public static final int WINDOW_OPENED       = WINDOW_FIRST; // 200
+    @Native public static final int WINDOW_OPENED       = WINDOW_FIRST; // 200
 
     /**
      * The "window is closing" event. This event is delivered when
@@ -78,13 +76,13 @@
      * while processing this event, the window close operation will be
      * cancelled.
      */
-    public static final int WINDOW_CLOSING      = 1 + WINDOW_FIRST; //Event.WINDOW_DESTROY
+    @Native public static final int WINDOW_CLOSING      = 1 + WINDOW_FIRST; //Event.WINDOW_DESTROY
 
     /**
      * The window closed event. This event is delivered after
      * the window has been closed as the result of a call to dispose.
      */
-    public static final int WINDOW_CLOSED       = 2 + WINDOW_FIRST;
+    @Native public static final int WINDOW_CLOSED       = 2 + WINDOW_FIRST;
 
     /**
      * The window iconified event. This event is delivered when
@@ -93,13 +91,13 @@
      * the icon specified in the window's iconImage property.
      * @see java.awt.Frame#setIconImage
      */
-    public static final int WINDOW_ICONIFIED    = 3 + WINDOW_FIRST; //Event.WINDOW_ICONIFY
+    @Native public static final int WINDOW_ICONIFIED    = 3 + WINDOW_FIRST; //Event.WINDOW_ICONIFY
 
     /**
      * The window deiconified event type. This event is delivered when
      * the window has been changed from a minimized to a normal state.
      */
-    public static final int WINDOW_DEICONIFIED  = 4 + WINDOW_FIRST; //Event.WINDOW_DEICONIFY
+    @Native public static final int WINDOW_DEICONIFIED  = 4 + WINDOW_FIRST; //Event.WINDOW_DEICONIFY
 
     /**
      * The window-activated event type. This event is delivered when the Window
@@ -109,7 +107,7 @@
      * active Window is always either the focused Window, or the first Frame or
      * Dialog that is an owner of the focused Window.
      */
-    public static final int WINDOW_ACTIVATED    = 5 + WINDOW_FIRST;
+    @Native public static final int WINDOW_ACTIVATED    = 5 + WINDOW_FIRST;
 
     /**
      * The window-deactivated event type. This event is delivered when the
@@ -119,21 +117,21 @@
      * title bar. The active Window is always either the focused Window, or the
      * first Frame or Dialog that is an owner of the focused Window.
      */
-    public static final int WINDOW_DEACTIVATED  = 6 + WINDOW_FIRST;
+    @Native public static final int WINDOW_DEACTIVATED  = 6 + WINDOW_FIRST;
 
     /**
      * The window-gained-focus event type. This event is delivered when the
      * Window becomes the focused Window, which means that the Window, or one
      * of its subcomponents, will receive keyboard events.
      */
-    public static final int WINDOW_GAINED_FOCUS = 7 + WINDOW_FIRST;
+    @Native public static final int WINDOW_GAINED_FOCUS = 7 + WINDOW_FIRST;
 
     /**
      * The window-lost-focus event type. This event is delivered when a Window
      * is no longer the focused Window, which means keyboard events will no
      * longer be delivered to the Window or any of its subcomponents.
      */
-    public static final int WINDOW_LOST_FOCUS   = 8 + WINDOW_FIRST;
+    @Native public static final int WINDOW_LOST_FOCUS   = 8 + WINDOW_FIRST;
 
     /**
      * The window-state-changed event type.  This event is delivered
@@ -141,7 +139,7 @@
      * iconified, maximized etc.
      * @since 1.4
      */
-    public static final int WINDOW_STATE_CHANGED = 9 + WINDOW_FIRST;
+    @Native public static final int WINDOW_STATE_CHANGED = 9 + WINDOW_FIRST;
 
     /**
      * The last number in the range of ids used for window events.
diff --git a/jdk/src/share/classes/java/awt/geom/PathIterator.java b/jdk/src/share/classes/java/awt/geom/PathIterator.java
index 84eb219..75cb228 100644
--- a/jdk/src/share/classes/java/awt/geom/PathIterator.java
+++ b/jdk/src/share/classes/java/awt/geom/PathIterator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, 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
@@ -25,7 +25,7 @@
 
 package java.awt.geom;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * The <code>PathIterator</code> interface provides the mechanism
@@ -59,8 +59,6 @@
  *
  * @author Jim Graham
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface PathIterator {
     /**
      * The winding rule constant for specifying an even-odd rule
@@ -69,7 +67,7 @@
      * path if a ray drawn in any direction from that point to
      * infinity is crossed by path segments an odd number of times.
      */
-    public static final int WIND_EVEN_ODD       = 0;
+    @Native public static final int WIND_EVEN_ODD       = 0;
 
     /**
      * The winding rule constant for specifying a non-zero rule
@@ -80,20 +78,20 @@
      * of times in the counter-clockwise direction than the
      * clockwise direction.
      */
-    public static final int WIND_NON_ZERO       = 1;
+    @Native public static final int WIND_NON_ZERO       = 1;
 
     /**
      * The segment type constant for a point that specifies the
      * starting location for a new subpath.
      */
-    public static final int SEG_MOVETO          = 0;
+    @Native public static final int SEG_MOVETO          = 0;
 
     /**
      * The segment type constant for a point that specifies the
      * end point of a line to be drawn from the most recently
      * specified point.
      */
-    public static final int SEG_LINETO          = 1;
+    @Native public static final int SEG_LINETO          = 1;
 
     /**
      * The segment type constant for the pair of points that specify
@@ -115,7 +113,7 @@
      *               = n! / (m! * (n-m)!)
      * </pre>
      */
-    public static final int SEG_QUADTO          = 2;
+    @Native public static final int SEG_QUADTO          = 2;
 
     /**
      * The segment type constant for the set of 3 points that specify
@@ -139,14 +137,14 @@
      * </pre>
      * This form of curve is commonly known as a B&eacute;zier curve.
      */
-    public static final int SEG_CUBICTO         = 3;
+    @Native public static final int SEG_CUBICTO         = 3;
 
     /**
      * The segment type constant that specifies that
      * the preceding subpath should be closed by appending a line segment
      * back to the point corresponding to the most recent SEG_MOVETO.
      */
-    public static final int SEG_CLOSE           = 4;
+    @Native public static final int SEG_CLOSE           = 4;
 
     /**
      * Returns the winding rule for determining the interior of the
diff --git a/jdk/src/share/classes/java/awt/image/AffineTransformOp.java b/jdk/src/share/classes/java/awt/image/AffineTransformOp.java
index b3f090a..30819ba 100644
--- a/jdk/src/share/classes/java/awt/image/AffineTransformOp.java
+++ b/jdk/src/share/classes/java/awt/image/AffineTransformOp.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, 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
@@ -34,7 +34,7 @@
 import java.awt.Rectangle;
 import java.awt.RenderingHints;
 import java.awt.Transparency;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 import sun.awt.image.ImagingLib;
 
 /**
@@ -63,8 +63,6 @@
  * @see java.awt.RenderingHints#KEY_COLOR_RENDERING
  * @see java.awt.RenderingHints#KEY_DITHERING
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class AffineTransformOp implements BufferedImageOp, RasterOp {
     private AffineTransform xform;
     RenderingHints hints;
@@ -72,17 +70,17 @@
     /**
      * Nearest-neighbor interpolation type.
      */
-    public static final int TYPE_NEAREST_NEIGHBOR = 1;
+    @Native public static final int TYPE_NEAREST_NEIGHBOR = 1;
 
     /**
      * Bilinear interpolation type.
      */
-    public static final int TYPE_BILINEAR = 2;
+    @Native public static final int TYPE_BILINEAR = 2;
 
     /**
      * Bicubic interpolation type.
      */
-    public static final int TYPE_BICUBIC = 3;
+    @Native public static final int TYPE_BICUBIC = 3;
 
     int interpolationType = TYPE_NEAREST_NEIGHBOR;
 
diff --git a/jdk/src/share/classes/java/awt/image/ConvolveOp.java b/jdk/src/share/classes/java/awt/image/ConvolveOp.java
index 20f1c31..1c5e20e 100644
--- a/jdk/src/share/classes/java/awt/image/ConvolveOp.java
+++ b/jdk/src/share/classes/java/awt/image/ConvolveOp.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, 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
@@ -30,7 +30,7 @@
 import java.awt.Rectangle;
 import java.awt.RenderingHints;
 import java.awt.geom.Point2D;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 import sun.awt.image.ImagingLib;
 
 /**
@@ -66,8 +66,6 @@
  * @see java.awt.RenderingHints#KEY_COLOR_RENDERING
  * @see java.awt.RenderingHints#KEY_DITHERING
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class ConvolveOp implements BufferedImageOp, RasterOp {
     Kernel kernel;
     int edgeHint;
@@ -81,13 +79,13 @@
      * is the default.
      */
 
-    public static final int EDGE_ZERO_FILL = 0;
+    @Native public static final int EDGE_ZERO_FILL = 0;
 
     /**
      * Pixels at the edge of the source image are copied to
      * the corresponding pixels in the destination without modification.
      */
-    public static final int EDGE_NO_OP     = 1;
+    @Native public static final int EDGE_NO_OP     = 1;
 
     /**
      * Constructs a ConvolveOp given a Kernel, an edge condition, and a
diff --git a/jdk/src/share/classes/java/awt/image/DataBuffer.java b/jdk/src/share/classes/java/awt/image/DataBuffer.java
index b0e70f2..5bf9652 100644
--- a/jdk/src/share/classes/java/awt/image/DataBuffer.java
+++ b/jdk/src/share/classes/java/awt/image/DataBuffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, 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
@@ -41,7 +41,7 @@
 
 import sun.awt.image.SunWritableRaster;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * This class exists to wrap one or more data arrays.  Each data array in
@@ -67,30 +67,28 @@
  * @see java.awt.image.Raster
  * @see java.awt.image.SampleModel
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class DataBuffer {
 
     /** Tag for unsigned byte data. */
-    public static final int TYPE_BYTE  = 0;
+    @Native public static final int TYPE_BYTE  = 0;
 
     /** Tag for unsigned short data. */
-    public static final int TYPE_USHORT = 1;
+    @Native public static final int TYPE_USHORT = 1;
 
     /** Tag for signed short data.  Placeholder for future use. */
-    public static final int TYPE_SHORT = 2;
+    @Native public static final int TYPE_SHORT = 2;
 
     /** Tag for int data. */
-    public static final int TYPE_INT   = 3;
+    @Native public static final int TYPE_INT   = 3;
 
     /** Tag for float data.  Placeholder for future use. */
-    public static final int TYPE_FLOAT  = 4;
+    @Native public static final int TYPE_FLOAT  = 4;
 
     /** Tag for double data.  Placeholder for future use. */
-    public static final int TYPE_DOUBLE  = 5;
+    @Native public static final int TYPE_DOUBLE  = 5;
 
     /** Tag for undefined data. */
-    public static final int TYPE_UNDEFINED = 32;
+    @Native public static final int TYPE_UNDEFINED = 32;
 
     /** The data type of this DataBuffer. */
     protected int dataType;
diff --git a/jdk/src/share/classes/java/awt/image/ImageConsumer.java b/jdk/src/share/classes/java/awt/image/ImageConsumer.java
index c14d50a..da22310 100644
--- a/jdk/src/share/classes/java/awt/image/ImageConsumer.java
+++ b/jdk/src/share/classes/java/awt/image/ImageConsumer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -27,7 +27,6 @@
 
 import java.util.Hashtable;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The interface for objects expressing interest in image data through
@@ -39,8 +38,6 @@
  *
  * @author      Jim Graham
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface ImageConsumer {
     /**
      * The dimensions of the source image are reported using the
diff --git a/jdk/src/share/classes/java/awt/image/ImageObserver.java b/jdk/src/share/classes/java/awt/image/ImageObserver.java
index 60db15b..1790309 100644
--- a/jdk/src/share/classes/java/awt/image/ImageObserver.java
+++ b/jdk/src/share/classes/java/awt/image/ImageObserver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -27,7 +27,6 @@
 
 import java.awt.Image;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * An asynchronous update interface for receiving notifications about
@@ -35,8 +34,6 @@
  *
  * @author      Jim Graham
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface ImageObserver {
     /**
      * This method is called when information about an image which was
diff --git a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
index 43ef8e5..40f310d 100644
--- a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -32,7 +32,6 @@
 import java.awt.image.ColorModel;
 import java.awt.image.VolatileImage;
 import java.awt.GraphicsConfiguration;
-import javax.tools.annotation.GenerateNativeHeader;
 import sun.awt.CausedFocusEvent;
 import sun.java2d.pipe.Region;
 
@@ -50,8 +49,6 @@
  * nor invoke any of the peer methods directly on the peer
  * instances.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface ComponentPeer {
 
     /**
diff --git a/jdk/src/share/classes/java/awt/print/PageFormat.java b/jdk/src/share/classes/java/awt/print/PageFormat.java
index 8a19b66..0b25201 100644
--- a/jdk/src/share/classes/java/awt/print/PageFormat.java
+++ b/jdk/src/share/classes/java/awt/print/PageFormat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, 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
@@ -29,14 +29,12 @@
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * The <code>PageFormat</code> class describes the size and
  * orientation of a page to be printed.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class PageFormat implements Cloneable
 {
 
@@ -48,21 +46,21 @@
      *  Note that this is not the Macintosh landscape but
      *  is the Window's and PostScript landscape.
      */
-    public static final int LANDSCAPE = 0;
+    @Native public static final int LANDSCAPE = 0;
 
     /**
      *  The origin is at the top left of the paper with
      *  x running to the right and y running down the
      *  paper.
      */
-    public static final int PORTRAIT = 1;
+    @Native public static final int PORTRAIT = 1;
 
     /**
      *  The origin is at the top right of the paper with x
      *  running top to bottom and y running right to left.
      *  Note that this is the Macintosh landscape.
      */
-    public static final int REVERSE_LANDSCAPE = 2;
+    @Native public static final int REVERSE_LANDSCAPE = 2;
 
  /* Instance Variables */
 
diff --git a/jdk/src/share/classes/java/awt/print/Pageable.java b/jdk/src/share/classes/java/awt/print/Pageable.java
index e98f6f4..b87cc7b 100644
--- a/jdk/src/share/classes/java/awt/print/Pageable.java
+++ b/jdk/src/share/classes/java/awt/print/Pageable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -25,7 +25,7 @@
 
 package java.awt.print;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * The <code>Pageable</code> implementation represents a set of
@@ -35,8 +35,6 @@
  * @see java.awt.print.PageFormat
  * @see java.awt.print.Printable
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface Pageable {
 
     /**
@@ -45,7 +43,7 @@
      * method if a <code>Pageable</code> implementation does not know
      * the number of pages in its set.
      */
-    int UNKNOWN_NUMBER_OF_PAGES = -1;
+    @Native int UNKNOWN_NUMBER_OF_PAGES = -1;
 
     /**
      * Returns the number of pages in the set.
diff --git a/jdk/src/share/classes/java/awt/print/Printable.java b/jdk/src/share/classes/java/awt/print/Printable.java
index dacf917..6737aec 100644
--- a/jdk/src/share/classes/java/awt/print/Printable.java
+++ b/jdk/src/share/classes/java/awt/print/Printable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, 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
@@ -27,7 +27,6 @@
 
 import java.awt.Graphics;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The <code>Printable</code> interface is implemented
@@ -100,8 +99,6 @@
  * @see java.awt.print.PageFormat
  * @see java.awt.print.PrinterJob
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface Printable {
 
     /**
diff --git a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java
index 6e4881c..c319fa4 100644
--- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java
+++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java
@@ -236,7 +236,7 @@
         if ((index < 0) || (index >= count)) {
             throw new StringIndexOutOfBoundsException(index);
         }
-        return Character.codePointAt(value, index);
+        return Character.codePointAtImpl(value, index, count);
     }
 
     /**
@@ -265,7 +265,7 @@
         if ((i < 0) || (i >= count)) {
             throw new StringIndexOutOfBoundsException(index);
         }
-        return Character.codePointBefore(value, index);
+        return Character.codePointBeforeImpl(value, index, 0);
     }
 
     /**
@@ -415,7 +415,8 @@
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(String str) {
-        if (str == null) str = "null";
+        if (str == null)
+            return appendNull();
         int len = str.length();
         ensureCapacityInternal(count + len);
         str.getChars(0, len, value, count);
@@ -426,7 +427,7 @@
     // Documentation in subclasses because of synchro difference
     public AbstractStringBuilder append(StringBuffer sb) {
         if (sb == null)
-            return append("null");
+            return appendNull();
         int len = sb.length();
         ensureCapacityInternal(count + len);
         sb.getChars(0, len, value, count);
@@ -439,7 +440,7 @@
      */
     AbstractStringBuilder append(AbstractStringBuilder asb) {
         if (asb == null)
-            return append("null");
+            return appendNull();
         int len = asb.length();
         ensureCapacityInternal(count + len);
         asb.getChars(0, len, value, count);
@@ -451,7 +452,7 @@
     @Override
     public AbstractStringBuilder append(CharSequence s) {
         if (s == null)
-            s = "null";
+            return appendNull();
         if (s instanceof String)
             return this.append((String)s);
         if (s instanceof AbstractStringBuilder)
@@ -460,6 +461,18 @@
         return this.append(s, 0, s.length());
     }
 
+    private AbstractStringBuilder appendNull() {
+        int c = count;
+        ensureCapacityInternal(c + 4);
+        final char[] value = this.value;
+        value[c++] = 'n';
+        value[c++] = 'u';
+        value[c++] = 'l';
+        value[c++] = 'l';
+        count = c;
+        return this;
+    }
+
     /**
      * Appends a subsequence of the specified {@code CharSequence} to this
      * sequence.
@@ -1370,32 +1383,37 @@
      * @return  a reference to this object.
      */
     public AbstractStringBuilder reverse() {
-        boolean hasSurrogate = false;
+        boolean hasSurrogates = false;
         int n = count - 1;
-        for (int j = (n-1) >> 1; j >= 0; --j) {
-            char temp = value[j];
-            char temp2 = value[n - j];
-            if (!hasSurrogate) {
-                hasSurrogate = (temp >= Character.MIN_SURROGATE && temp <= Character.MAX_SURROGATE)
-                    || (temp2 >= Character.MIN_SURROGATE && temp2 <= Character.MAX_SURROGATE);
+        for (int j = (n-1) >> 1; j >= 0; j--) {
+            int k = n - j;
+            char cj = value[j];
+            char ck = value[k];
+            value[j] = ck;
+            value[k] = cj;
+            if (Character.isSurrogate(cj) ||
+                Character.isSurrogate(ck)) {
+                hasSurrogates = true;
             }
-            value[j] = temp2;
-            value[n - j] = temp;
         }
-        if (hasSurrogate) {
-            // Reverse back all valid surrogate pairs
-            for (int i = 0; i < count - 1; i++) {
-                char c2 = value[i];
-                if (Character.isLowSurrogate(c2)) {
-                    char c1 = value[i + 1];
-                    if (Character.isHighSurrogate(c1)) {
-                        value[i++] = c1;
-                        value[i] = c2;
-                    }
+        if (hasSurrogates) {
+            reverseAllValidSurrogatePairs();
+        }
+        return this;
+    }
+
+    /** Outlined helper method for reverse() */
+    private void reverseAllValidSurrogatePairs() {
+        for (int i = 0; i < count - 1; i++) {
+            char c2 = value[i];
+            if (Character.isLowSurrogate(c2)) {
+                char c1 = value[i + 1];
+                if (Character.isHighSurrogate(c1)) {
+                    value[i++] = c1;
+                    value[i] = c2;
                 }
             }
         }
-        return this;
     }
 
     /**
diff --git a/jdk/src/share/classes/java/lang/Character.java b/jdk/src/share/classes/java/lang/Character.java
index 0f44006..531263d 100644
--- a/jdk/src/share/classes/java/lang/Character.java
+++ b/jdk/src/share/classes/java/lang/Character.java
@@ -4862,13 +4862,11 @@
      * @since  1.5
      */
     public static int codePointAt(CharSequence seq, int index) {
-        char c1 = seq.charAt(index++);
-        if (isHighSurrogate(c1)) {
-            if (index < seq.length()) {
-                char c2 = seq.charAt(index);
-                if (isLowSurrogate(c2)) {
-                    return toCodePoint(c1, c2);
-                }
+        char c1 = seq.charAt(index);
+        if (isHighSurrogate(c1) && ++index < seq.length()) {
+            char c2 = seq.charAt(index);
+            if (isLowSurrogate(c2)) {
+                return toCodePoint(c1, c2);
             }
         }
         return c1;
@@ -4931,15 +4929,13 @@
         return codePointAtImpl(a, index, limit);
     }
 
-    // throws ArrayIndexOutofBoundsException if index out of bounds
+    // throws ArrayIndexOutOfBoundsException if index out of bounds
     static int codePointAtImpl(char[] a, int index, int limit) {
-        char c1 = a[index++];
-        if (isHighSurrogate(c1)) {
-            if (index < limit) {
-                char c2 = a[index];
-                if (isLowSurrogate(c2)) {
-                    return toCodePoint(c1, c2);
-                }
+        char c1 = a[index];
+        if (isHighSurrogate(c1) && ++index < limit) {
+            char c2 = a[index];
+            if (isLowSurrogate(c2)) {
+                return toCodePoint(c1, c2);
             }
         }
         return c1;
@@ -4968,12 +4964,10 @@
      */
     public static int codePointBefore(CharSequence seq, int index) {
         char c2 = seq.charAt(--index);
-        if (isLowSurrogate(c2)) {
-            if (index > 0) {
-                char c1 = seq.charAt(--index);
-                if (isHighSurrogate(c1)) {
-                    return toCodePoint(c1, c2);
-                }
+        if (isLowSurrogate(c2) && index > 0) {
+            char c1 = seq.charAt(--index);
+            if (isHighSurrogate(c1)) {
+                return toCodePoint(c1, c2);
             }
         }
         return c2;
@@ -5038,15 +5032,13 @@
         return codePointBeforeImpl(a, index, start);
     }
 
-    // throws ArrayIndexOutofBoundsException if index-1 out of bounds
+    // throws ArrayIndexOutOfBoundsException if index-1 out of bounds
     static int codePointBeforeImpl(char[] a, int index, int start) {
         char c2 = a[--index];
-        if (isLowSurrogate(c2)) {
-            if (index > start) {
-                char c1 = a[--index];
-                if (isHighSurrogate(c1)) {
-                    return toCodePoint(c1, c2);
-                }
+        if (isLowSurrogate(c2) && index > start) {
+            char c1 = a[--index];
+            if (isHighSurrogate(c1)) {
+                return toCodePoint(c1, c2);
             }
         }
         return c2;
diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java
index f0ab8b2..5fd388d 100644
--- a/jdk/src/share/classes/java/lang/Class.java
+++ b/jdk/src/share/classes/java/lang/Class.java
@@ -113,8 +113,7 @@
  * @see     java.lang.ClassLoader#defineClass(byte[], int, int)
  * @since   JDK1.0
  */
-public final
-    class Class<T> implements java.io.Serializable,
+public final class Class<T> implements java.io.Serializable,
                               java.lang.reflect.GenericDeclaration,
                               java.lang.reflect.Type,
                               java.lang.reflect.AnnotatedElement {
@@ -150,6 +149,75 @@
             + getName();
     }
 
+    /**
+     * Returns a string describing this {@code Class}, including
+     * information about modifiers and type parameters.
+     *
+     * The string is formatted as a list of type modifiers, if any,
+     * followed by the kind of type (empty string for primitive types
+     * and {@code class}, {@code enum}, {@code interface}, or {@code
+     * &#64;interface}, as appropriate), followed by the type's name,
+     * followed by an angle-bracketed comma-separated list of the
+     * type's type parameters, if any.
+     *
+     * A space is used to separate modifiers from one another and to
+     * separate any modifiers from the kind of type. The modifiers
+     * occur in canonical order. If there are no type parameters, the
+     * type parameter list is elided.
+     *
+     * <p>Note that since information about the runtime representation
+     * of a type is being generated, modifiers not present on the
+     * originating source code or illegal on the originating source
+     * code may be present.
+     *
+     * @return a string describing this {@code Class}, including
+     * information about modifiers and type parameters
+     *
+     * @since 1.8
+     */
+    public String toGenericString() {
+        if (isPrimitive()) {
+            return toString();
+        } else {
+            StringBuilder sb = new StringBuilder();
+
+            // Class modifiers are a superset of interface modifiers
+            int modifiers = getModifiers() & Modifier.classModifiers();
+            if (modifiers != 0) {
+                sb.append(Modifier.toString(modifiers));
+                sb.append(' ');
+            }
+
+            if (isAnnotation()) {
+                sb.append('@');
+            }
+            if (isInterface()) { // Note: all annotation types are interfaces
+                sb.append("interface");
+            } else {
+                if (isEnum())
+                    sb.append("enum");
+                else
+                    sb.append("class");
+            }
+            sb.append(' ');
+            sb.append(getName());
+
+            TypeVariable<?>[] typeparms = getTypeParameters();
+            if (typeparms.length > 0) {
+                boolean first = true;
+                sb.append('<');
+                for(TypeVariable<?> typeparm: typeparms) {
+                    if (!first)
+                        sb.append(',');
+                    sb.append(typeparm.getTypeName());
+                    first = false;
+                }
+                sb.append('>');
+            }
+
+            return sb.toString();
+        }
+    }
 
     /**
      * Returns the {@code Class} object associated with the class or
@@ -1164,6 +1232,32 @@
     }
 
     /**
+     * Return an informative string for the name of this type.
+     *
+     * @return an informative string for the name of this type
+     * @since 1.8
+     */
+    public String getTypeName() {
+        if (isArray()) {
+            try {
+                Class<?> cl = this;
+                int dimensions = 0;
+                while (cl.isArray()) {
+                    dimensions++;
+                    cl = cl.getComponentType();
+                }
+                StringBuilder sb = new StringBuilder();
+                sb.append(cl.getName());
+                for (int i = 0; i < dimensions; i++) {
+                    sb.append("[]");
+                }
+                return sb.toString();
+            } catch (Throwable e) { /*FALLTHRU*/ }
+        }
+        return getName();
+    }
+
+    /**
      * Character.isDigit answers {@code true} to some non-ascii
      * digits.  This one does not.
      */
diff --git a/jdk/src/share/classes/java/lang/reflect/Constructor.java b/jdk/src/share/classes/java/lang/reflect/Constructor.java
index bdbd7c3..14a515f 100644
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java
@@ -284,16 +284,20 @@
      * modifiers {@code public}, {@code protected} or
      * {@code private}.  Only one of these may appear, or none if the
      * constructor has default (package) access.
+     *
+     * @return a string describing this {@code Constructor}
+     * @jls 8.8.3. Constructor Modifiers
      */
     public String toString() {
         return sharedToString(Modifier.constructorModifiers(),
+                              false,
                               parameterTypes,
                               exceptionTypes);
     }
 
     @Override
     void specificToStringHeader(StringBuilder sb) {
-        sb.append(Field.getTypeName(getDeclaringClass()));
+        sb.append(getDeclaringClass().getTypeName());
     }
 
     /**
@@ -328,10 +332,11 @@
      * include type parameters
      *
      * @since 1.5
+     * @jls 8.8.3. Constructor Modifiers
      */
     @Override
     public String toGenericString() {
-        return sharedToGenericString(Modifier.constructorModifiers());
+        return sharedToGenericString(Modifier.constructorModifiers(), false);
     }
 
     @Override
diff --git a/jdk/src/share/classes/java/lang/reflect/Executable.java b/jdk/src/share/classes/java/lang/reflect/Executable.java
index 1a89968..bd8bac3 100644
--- a/jdk/src/share/classes/java/lang/reflect/Executable.java
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java
@@ -82,27 +82,38 @@
 
     void separateWithCommas(Class<?>[] types, StringBuilder sb) {
         for (int j = 0; j < types.length; j++) {
-            sb.append(Field.getTypeName(types[j]));
+            sb.append(types[j].getTypeName());
             if (j < (types.length - 1))
                 sb.append(",");
         }
 
     }
 
-    void printModifiersIfNonzero(StringBuilder sb, int mask) {
+    void printModifiersIfNonzero(StringBuilder sb, int mask, boolean isDefault) {
         int mod = getModifiers() & mask;
-        if (mod != 0) {
+
+        if (mod != 0 && !isDefault) {
             sb.append(Modifier.toString(mod)).append(' ');
+        } else {
+            int access_mod = mod & Modifier.ACCESS_MODIFIERS;
+            if (access_mod != 0)
+                sb.append(Modifier.toString(access_mod)).append(' ');
+            if (isDefault)
+                sb.append("default ");
+            mod = (mod & ~Modifier.ACCESS_MODIFIERS);
+            if (mod != 0)
+                sb.append(Modifier.toString(mod)).append(' ');
         }
     }
 
     String sharedToString(int modifierMask,
+                          boolean isDefault,
                           Class<?>[] parameterTypes,
                           Class<?>[] exceptionTypes) {
         try {
             StringBuilder sb = new StringBuilder();
 
-            printModifiersIfNonzero(sb, modifierMask);
+            printModifiersIfNonzero(sb, modifierMask, isDefault);
             specificToStringHeader(sb);
 
             sb.append('(');
@@ -124,11 +135,11 @@
      */
     abstract void specificToStringHeader(StringBuilder sb);
 
-    String sharedToGenericString(int modifierMask) {
+    String sharedToGenericString(int modifierMask, boolean isDefault) {
         try {
             StringBuilder sb = new StringBuilder();
 
-            printModifiersIfNonzero(sb, modifierMask);
+            printModifiersIfNonzero(sb, modifierMask, isDefault);
 
             TypeVariable<?>[] typeparms = getTypeParameters();
             if (typeparms.length > 0) {
@@ -150,9 +161,7 @@
             sb.append('(');
             Type[] params = getGenericParameterTypes();
             for (int j = 0; j < params.length; j++) {
-                String param = (params[j] instanceof Class)?
-                    Field.getTypeName((Class)params[j]):
-                    (params[j].toString());
+                String param = params[j].getTypeName();
                 if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
                     param = param.replaceFirst("\\[\\]$", "...");
                 sb.append(param);
diff --git a/jdk/src/share/classes/java/lang/reflect/Field.java b/jdk/src/share/classes/java/lang/reflect/Field.java
index be13b07..bd2b9ef 100644
--- a/jdk/src/share/classes/java/lang/reflect/Field.java
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java
@@ -288,12 +288,15 @@
      * {@code protected} or {@code private} first, and then other
      * modifiers in the following order: {@code static}, {@code final},
      * {@code transient}, {@code volatile}.
+     *
+     * @return a string describing this {@code Field}
+     * @jls 8.3.1 Field Modifiers
      */
     public String toString() {
         int mod = getModifiers();
         return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
-            + getTypeName(getType()) + " "
-            + getTypeName(getDeclaringClass()) + "."
+            + getType().getTypeName() + " "
+            + getDeclaringClass().getTypeName() + "."
             + getName());
     }
 
@@ -315,14 +318,14 @@
      * its generic type
      *
      * @since 1.5
+     * @jls 8.3.1 Field Modifiers
      */
     public String toGenericString() {
         int mod = getModifiers();
         Type fieldType = getGenericType();
         return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
-            +  ((fieldType instanceof Class) ?
-                getTypeName((Class)fieldType): fieldType.toString())+ " "
-            + getTypeName(getDeclaringClass()) + "."
+            + fieldType.getTypeName() + " "
+            + getDeclaringClass().getTypeName() + "."
             + getName());
     }
 
@@ -992,29 +995,6 @@
         }
     }
 
-    /*
-     * Utility routine to paper over array type names
-     */
-    static String getTypeName(Class<?> type) {
-        if (type.isArray()) {
-            try {
-                Class<?> cl = type;
-                int dimensions = 0;
-                while (cl.isArray()) {
-                    dimensions++;
-                    cl = cl.getComponentType();
-                }
-                StringBuffer sb = new StringBuffer();
-                sb.append(cl.getName());
-                for (int i = 0; i < dimensions; i++) {
-                    sb.append("[]");
-                }
-                return sb.toString();
-            } catch (Throwable e) { /*FALLTHRU*/ }
-        }
-        return type.getName();
-    }
-
     /**
      * @throws NullPointerException {@inheritDoc}
      * @since 1.5
diff --git a/jdk/src/share/classes/java/lang/reflect/Method.java b/jdk/src/share/classes/java/lang/reflect/Method.java
index 09438fb..1caddd6 100644
--- a/jdk/src/share/classes/java/lang/reflect/Method.java
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java
@@ -342,19 +342,24 @@
      * specified by "The Java Language Specification".  This is
      * {@code public}, {@code protected} or {@code private} first,
      * and then other modifiers in the following order:
-     * {@code abstract}, {@code static}, {@code final},
+     * {@code abstract}, {@code default}, {@code static}, {@code final},
      * {@code synchronized}, {@code native}, {@code strictfp}.
+     *
+     * @return a string describing this {@code Method}
+     *
+     * @jls 8.4.3 Method Modifiers
      */
     public String toString() {
         return sharedToString(Modifier.methodModifiers(),
+                              isDefault(),
                               parameterTypes,
                               exceptionTypes);
     }
 
     @Override
     void specificToStringHeader(StringBuilder sb) {
-        sb.append(Field.getTypeName(getReturnType())).append(' ');
-        sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+        sb.append(getReturnType().getTypeName()).append(' ');
+        sb.append(getDeclaringClass().getTypeName()).append('.');
         sb.append(getName());
     }
 
@@ -381,34 +386,32 @@
      * class name.  If the method is declared to throw exceptions, the
      * parameter list is followed by a space, followed by the word
      * throws followed by a comma-separated list of the generic thrown
-     * exception types.  If there are no type parameters, the type
-     * parameter list is elided.
+     * exception types.
      *
      * <p>The access modifiers are placed in canonical order as
      * specified by "The Java Language Specification".  This is
      * {@code public}, {@code protected} or {@code private} first,
      * and then other modifiers in the following order:
-     * {@code abstract}, {@code static}, {@code final},
+     * {@code abstract}, {@code default}, {@code static}, {@code final},
      * {@code synchronized}, {@code native}, {@code strictfp}.
      *
      * @return a string describing this {@code Method},
      * include type parameters
      *
      * @since 1.5
+     *
+     * @jls 8.4.3 Method Modifiers
      */
     @Override
     public String toGenericString() {
-        return sharedToGenericString(Modifier.methodModifiers());
+        return sharedToGenericString(Modifier.methodModifiers(), isDefault());
     }
 
     @Override
     void specificToGenericStringHeader(StringBuilder sb) {
         Type genRetType = getGenericReturnType();
-        sb.append( ((genRetType instanceof Class<?>)?
-                    Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
-            .append(' ');
-
-        sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+        sb.append(genRetType.getTypeName()).append(' ');
+        sb.append(getDeclaringClass().getTypeName()).append('.');
         sb.append(getName());
     }
 
diff --git a/jdk/src/share/classes/java/lang/reflect/Modifier.java b/jdk/src/share/classes/java/lang/reflect/Modifier.java
index 8c2b2cc..227beee 100644
--- a/jdk/src/share/classes/java/lang/reflect/Modifier.java
+++ b/jdk/src/share/classes/java/lang/reflect/Modifier.java
@@ -43,8 +43,7 @@
  * @author Nakul Saraiya
  * @author Kenneth Russell
  */
-public
-class Modifier {
+public class Modifier {
 
     /*
      * Bootstrapping protocol between java.lang and java.lang.reflect
@@ -233,7 +232,7 @@
      * represented by {@code mod}
      */
     public static String toString(int mod) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         int len;
 
         if ((mod & PUBLIC) != 0)        sb.append("public ");
@@ -390,6 +389,12 @@
         Modifier.VOLATILE;
 
     /**
+     *
+     */
+    static final int ACCESS_MODIFIERS =
+        Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE;
+
+    /**
      * Return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a class.
      * @return an {@code int} value OR-ing together the source language
diff --git a/jdk/src/share/classes/java/lang/reflect/Parameter.java b/jdk/src/share/classes/java/lang/reflect/Parameter.java
index e479bfd..af10431 100644
--- a/jdk/src/share/classes/java/lang/reflect/Parameter.java
+++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java
@@ -110,21 +110,19 @@
     public String toString() {
         final StringBuilder sb = new StringBuilder();
         final Type type = getParameterizedType();
-        final String typename = (type instanceof Class)?
-            Field.getTypeName((Class)type):
-            (type.toString());
+        final String typename = type.getTypeName();
 
         sb.append(Modifier.toString(getModifiers()));
 
         if(0 != modifiers)
-            sb.append(" ");
+            sb.append(' ');
 
         if(isVarArgs())
             sb.append(typename.replaceFirst("\\[\\]$", "..."));
         else
             sb.append(typename);
 
-        sb.append(" ");
+        sb.append(' ');
         sb.append(getName());
 
         return sb.toString();
diff --git a/jdk/src/share/classes/java/lang/reflect/Type.java b/jdk/src/share/classes/java/lang/reflect/Type.java
index 76b40d6..ecd3527 100644
--- a/jdk/src/share/classes/java/lang/reflect/Type.java
+++ b/jdk/src/share/classes/java/lang/reflect/Type.java
@@ -32,6 +32,17 @@
  *
  * @since 1.5
  */
-
 public interface Type {
+    /**
+     * Returns a string describing this type, including information
+     * about any type parameters.
+     *
+     * @implSpec The default implementation calls {@code toString}.
+     *
+     * @return a string describing this type
+     * @since 1.8
+     */
+    default String getTypeName() {
+        return toString();
+    }
 }
diff --git a/jdk/src/share/classes/java/util/Base64.java b/jdk/src/share/classes/java/util/Base64.java
index 88b1740..92b9cb0 100644
--- a/jdk/src/share/classes/java/util/Base64.java
+++ b/jdk/src/share/classes/java/util/Base64.java
@@ -620,7 +620,10 @@
      * required. So if the final unit of the encoded byte data only has
      * two or three Base64 characters (without the corresponding padding
      * character(s) padded), they are decoded as if followed by padding
-     * character(s).
+     * character(s). If there is padding character present in the
+     * final unit, the correct number of padding character(s) must be
+     * present, otherwise {@code IllegalArgumentException} is thrown
+     * during decoding.
      *
      * <p> Instances of {@link Decoder} class are safe for use by
      * multiple concurrent threads.
@@ -1034,23 +1037,26 @@
                 throw new IllegalArgumentException(
                     "Input byte[] should at least have 2 bytes for base64 bytes");
             }
-            if (src[sl - 1] == '=') {
-                paddings++;
-                if (src[sl - 2] == '=')
-                    paddings++;
-            }
             if (isMIME) {
                 // scan all bytes to fill out all non-alphabet. a performance
                 // trade-off of pre-scan or Arrays.copyOf
                 int n = 0;
                 while (sp < sl) {
                     int b = src[sp++] & 0xff;
-                    if (b == '=')
+                    if (b == '=') {
+                        len -= (sl - sp + 1);
                         break;
+                    }
                     if ((b = base64[b]) == -1)
                         n++;
                 }
                 len -= n;
+            } else {
+                if (src[sl - 1] == '=') {
+                    paddings++;
+                    if (src[sl - 2] == '=')
+                        paddings++;
+                }
             }
             if (paddings == 0 && (len & 0x3) !=  0)
                 paddings = 4 - (len & 0x3);
diff --git a/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java
new file mode 100644
index 0000000..dfcba20
--- /dev/null
+++ b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java
@@ -0,0 +1,3305 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+package java.util.concurrent;
+import java.util.function.Supplier;
+import java.util.function.Consumer;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.BiFunction;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinTask;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.LockSupport;
+
+/**
+ * A {@link Future} that may be explicitly completed (setting its
+ * value and status), and may include dependent functions and actions
+ * that trigger upon its completion.
+ *
+ * <p>When two or more threads attempt to
+ * {@link #complete complete},
+ * {@link #completeExceptionally completeExceptionally}, or
+ * {@link #cancel cancel}
+ * a CompletableFuture, only one of them succeeds.
+ *
+ * <p>Methods are available for adding dependents based on
+ * user-provided Functions, Consumers, or Runnables. The appropriate
+ * form to use depends on whether actions require arguments and/or
+ * produce results.  Completion of a dependent action will trigger the
+ * completion of another CompletableFuture.  Actions may also be
+ * triggered after either or both the current and another
+ * CompletableFuture complete.  Multiple CompletableFutures may also
+ * be grouped as one using {@link #anyOf(CompletableFuture...)} and
+ * {@link #allOf(CompletableFuture...)}.
+ *
+ * <p>CompletableFutures themselves do not execute asynchronously.
+ * However, actions supplied for dependent completions of another
+ * CompletableFuture may do so, depending on whether they are provided
+ * via one of the <em>async</em> methods (that is, methods with names
+ * of the form <tt><var>xxx</var>Async</tt>).  The <em>async</em>
+ * methods provide a way to commence asynchronous processing of an
+ * action using either a given {@link Executor} or by default the
+ * {@link ForkJoinPool#commonPool()}. To simplify monitoring,
+ * debugging, and tracking, all generated asynchronous tasks are
+ * instances of the marker interface {@link AsynchronousCompletionTask}.
+ *
+ * <p>Actions supplied for dependent completions of <em>non-async</em>
+ * methods may be performed by the thread that completes the current
+ * CompletableFuture, or by any other caller of these methods.  There
+ * are no guarantees about the order of processing completions unless
+ * constrained by these methods.
+ *
+ * <p>Since (unlike {@link FutureTask}) this class has no direct
+ * control over the computation that causes it to be completed,
+ * cancellation is treated as just another form of exceptional completion.
+ * Method {@link #cancel cancel} has the same effect as
+ * {@code completeExceptionally(new CancellationException())}.
+ *
+ * <p>Upon exceptional completion (including cancellation), or when a
+ * completion entails an additional computation which terminates
+ * abruptly with an (unchecked) exception or error, then all of their
+ * dependent completions (and their dependents in turn) generally act
+ * as {@code completeExceptionally} with a {@link CompletionException}
+ * holding that exception as its cause.  However, the {@link
+ * #exceptionally exceptionally} and {@link #handle handle}
+ * completions <em>are</em> able to handle exceptional completions of
+ * the CompletableFutures they depend on.
+ *
+ * <p>In case of exceptional completion with a CompletionException,
+ * methods {@link #get()} and {@link #get(long, TimeUnit)} throw an
+ * {@link ExecutionException} with the same cause as held in the
+ * corresponding CompletionException.  However, in these cases,
+ * methods {@link #join()} and {@link #getNow} throw the
+ * CompletionException, which simplifies usage.
+ *
+ * <p>Arguments used to pass a completion result (that is, for parameters
+ * of type {@code T}) may be null, but passing a null value for any other
+ * parameter will result in a {@link NullPointerException} being thrown.
+ *
+ * @author Doug Lea
+ * @since 1.8
+ */
+public class CompletableFuture<T> implements Future<T> {
+
+    /*
+     * Overview:
+     *
+     * 1. Non-nullness of field result (set via CAS) indicates done.
+     * An AltResult is used to box null as a result, as well as to
+     * hold exceptions.  Using a single field makes completion fast
+     * and simple to detect and trigger, at the expense of a lot of
+     * encoding and decoding that infiltrates many methods. One minor
+     * simplification relies on the (static) NIL (to box null results)
+     * being the only AltResult with a null exception field, so we
+     * don't usually need explicit comparisons with NIL. The CF
+     * exception propagation mechanics surrounding decoding rely on
+     * unchecked casts of decoded results really being unchecked,
+     * where user type errors are caught at point of use, as is
+     * currently the case in Java. These are highlighted by using
+     * SuppressWarnings-annotated temporaries.
+     *
+     * 2. Waiters are held in a Treiber stack similar to the one used
+     * in FutureTask, Phaser, and SynchronousQueue. See their
+     * internal documentation for algorithmic details.
+     *
+     * 3. Completions are also kept in a list/stack, and pulled off
+     * and run when completion is triggered. (We could even use the
+     * same stack as for waiters, but would give up the potential
+     * parallelism obtained because woken waiters help release/run
+     * others -- see method postComplete).  Because post-processing
+     * may race with direct calls, class Completion opportunistically
+     * extends AtomicInteger so callers can claim the action via
+     * compareAndSet(0, 1).  The Completion.run methods are all
+     * written a boringly similar uniform way (that sometimes includes
+     * unnecessary-looking checks, kept to maintain uniformity).
+     * There are enough dimensions upon which they differ that
+     * attempts to factor commonalities while maintaining efficiency
+     * require more lines of code than they would save.
+     *
+     * 4. The exported then/and/or methods do support a bit of
+     * factoring (see doThenApply etc). They must cope with the
+     * intrinsic races surrounding addition of a dependent action
+     * versus performing the action directly because the task is
+     * already complete.  For example, a CF may not be complete upon
+     * entry, so a dependent completion is added, but by the time it
+     * is added, the target CF is complete, so must be directly
+     * executed. This is all done while avoiding unnecessary object
+     * construction in safe-bypass cases.
+     */
+
+    // preliminaries
+
+    static final class AltResult {
+        final Throwable ex; // null only for NIL
+        AltResult(Throwable ex) { this.ex = ex; }
+    }
+
+    static final AltResult NIL = new AltResult(null);
+
+    // Fields
+
+    volatile Object result;    // Either the result or boxed AltResult
+    volatile WaitNode waiters; // Treiber stack of threads blocked on get()
+    volatile CompletionNode completions; // list (Treiber stack) of completions
+
+    // Basic utilities for triggering and processing completions
+
+    /**
+     * Removes and signals all waiting threads and runs all completions.
+     */
+    final void postComplete() {
+        WaitNode q; Thread t;
+        while ((q = waiters) != null) {
+            if (UNSAFE.compareAndSwapObject(this, WAITERS, q, q.next) &&
+                (t = q.thread) != null) {
+                q.thread = null;
+                LockSupport.unpark(t);
+            }
+        }
+
+        CompletionNode h; Completion c;
+        while ((h = completions) != null) {
+            if (UNSAFE.compareAndSwapObject(this, COMPLETIONS, h, h.next) &&
+                (c = h.completion) != null)
+                c.run();
+        }
+    }
+
+    /**
+     * Triggers completion with the encoding of the given arguments:
+     * if the exception is non-null, encodes it as a wrapped
+     * CompletionException unless it is one already.  Otherwise uses
+     * the given result, boxed as NIL if null.
+     */
+    final void internalComplete(T v, Throwable ex) {
+        if (result == null)
+            UNSAFE.compareAndSwapObject
+                (this, RESULT, null,
+                 (ex == null) ? (v == null) ? NIL : v :
+                 new AltResult((ex instanceof CompletionException) ? ex :
+                               new CompletionException(ex)));
+        postComplete(); // help out even if not triggered
+    }
+
+    /**
+     * If triggered, helps release and/or process completions.
+     */
+    final void helpPostComplete() {
+        if (result != null)
+            postComplete();
+    }
+
+    /* ------------- waiting for completions -------------- */
+
+    /** Number of processors, for spin control */
+    static final int NCPU = Runtime.getRuntime().availableProcessors();
+
+    /**
+     * Heuristic spin value for waitingGet() before blocking on
+     * multiprocessors
+     */
+    static final int SPINS = (NCPU > 1) ? 1 << 8 : 0;
+
+    /**
+     * Linked nodes to record waiting threads in a Treiber stack.  See
+     * other classes such as Phaser and SynchronousQueue for more
+     * detailed explanation. This class implements ManagedBlocker to
+     * avoid starvation when blocking actions pile up in
+     * ForkJoinPools.
+     */
+    static final class WaitNode implements ForkJoinPool.ManagedBlocker {
+        long nanos;          // wait time if timed
+        final long deadline; // non-zero if timed
+        volatile int interruptControl; // > 0: interruptible, < 0: interrupted
+        volatile Thread thread;
+        volatile WaitNode next;
+        WaitNode(boolean interruptible, long nanos, long deadline) {
+            this.thread = Thread.currentThread();
+            this.interruptControl = interruptible ? 1 : 0;
+            this.nanos = nanos;
+            this.deadline = deadline;
+        }
+        public boolean isReleasable() {
+            if (thread == null)
+                return true;
+            if (Thread.interrupted()) {
+                int i = interruptControl;
+                interruptControl = -1;
+                if (i > 0)
+                    return true;
+            }
+            if (deadline != 0L &&
+                (nanos <= 0L || (nanos = deadline - System.nanoTime()) <= 0L)) {
+                thread = null;
+                return true;
+            }
+            return false;
+        }
+        public boolean block() {
+            if (isReleasable())
+                return true;
+            else if (deadline == 0L)
+                LockSupport.park(this);
+            else if (nanos > 0L)
+                LockSupport.parkNanos(this, nanos);
+            return isReleasable();
+        }
+    }
+
+    /**
+     * Returns raw result after waiting, or null if interruptible and
+     * interrupted.
+     */
+    private Object waitingGet(boolean interruptible) {
+        WaitNode q = null;
+        boolean queued = false;
+        int spins = SPINS;
+        for (Object r;;) {
+            if ((r = result) != null) {
+                if (q != null) { // suppress unpark
+                    q.thread = null;
+                    if (q.interruptControl < 0) {
+                        if (interruptible) {
+                            removeWaiter(q);
+                            return null;
+                        }
+                        Thread.currentThread().interrupt();
+                    }
+                }
+                postComplete(); // help release others
+                return r;
+            }
+            else if (spins > 0) {
+                int rnd = ThreadLocalRandom.nextSecondarySeed();
+                if (rnd == 0)
+                    rnd = ThreadLocalRandom.current().nextInt();
+                if (rnd >= 0)
+                    --spins;
+            }
+            else if (q == null)
+                q = new WaitNode(interruptible, 0L, 0L);
+            else if (!queued)
+                queued = UNSAFE.compareAndSwapObject(this, WAITERS,
+                                                     q.next = waiters, q);
+            else if (interruptible && q.interruptControl < 0) {
+                removeWaiter(q);
+                return null;
+            }
+            else if (q.thread != null && result == null) {
+                try {
+                    ForkJoinPool.managedBlock(q);
+                } catch (InterruptedException ex) {
+                    q.interruptControl = -1;
+                }
+            }
+        }
+    }
+
+    /**
+     * Awaits completion or aborts on interrupt or timeout.
+     *
+     * @param nanos time to wait
+     * @return raw result
+     */
+    private Object timedAwaitDone(long nanos)
+        throws InterruptedException, TimeoutException {
+        WaitNode q = null;
+        boolean queued = false;
+        for (Object r;;) {
+            if ((r = result) != null) {
+                if (q != null) {
+                    q.thread = null;
+                    if (q.interruptControl < 0) {
+                        removeWaiter(q);
+                        throw new InterruptedException();
+                    }
+                }
+                postComplete();
+                return r;
+            }
+            else if (q == null) {
+                if (nanos <= 0L)
+                    throw new TimeoutException();
+                long d = System.nanoTime() + nanos;
+                q = new WaitNode(true, nanos, d == 0L ? 1L : d); // avoid 0
+            }
+            else if (!queued)
+                queued = UNSAFE.compareAndSwapObject(this, WAITERS,
+                                                     q.next = waiters, q);
+            else if (q.interruptControl < 0) {
+                removeWaiter(q);
+                throw new InterruptedException();
+            }
+            else if (q.nanos <= 0L) {
+                if (result == null) {
+                    removeWaiter(q);
+                    throw new TimeoutException();
+                }
+            }
+            else if (q.thread != null && result == null) {
+                try {
+                    ForkJoinPool.managedBlock(q);
+                } catch (InterruptedException ex) {
+                    q.interruptControl = -1;
+                }
+            }
+        }
+    }
+
+    /**
+     * Tries to unlink a timed-out or interrupted wait node to avoid
+     * accumulating garbage.  Internal nodes are simply unspliced
+     * without CAS since it is harmless if they are traversed anyway
+     * by releasers.  To avoid effects of unsplicing from already
+     * removed nodes, the list is retraversed in case of an apparent
+     * race.  This is slow when there are a lot of nodes, but we don't
+     * expect lists to be long enough to outweigh higher-overhead
+     * schemes.
+     */
+    private void removeWaiter(WaitNode node) {
+        if (node != null) {
+            node.thread = null;
+            retry:
+            for (;;) {          // restart on removeWaiter race
+                for (WaitNode pred = null, q = waiters, s; q != null; q = s) {
+                    s = q.next;
+                    if (q.thread != null)
+                        pred = q;
+                    else if (pred != null) {
+                        pred.next = s;
+                        if (pred.thread == null) // check for race
+                            continue retry;
+                    }
+                    else if (!UNSAFE.compareAndSwapObject(this, WAITERS, q, s))
+                        continue retry;
+                }
+                break;
+            }
+        }
+    }
+
+    /* ------------- Async tasks -------------- */
+
+    /**
+     * A marker interface identifying asynchronous tasks produced by
+     * {@code async} methods. This may be useful for monitoring,
+     * debugging, and tracking asynchronous activities.
+     *
+     * @since 1.8
+     */
+    public static interface AsynchronousCompletionTask {
+    }
+
+    /** Base class can act as either FJ or plain Runnable */
+    abstract static class Async extends ForkJoinTask<Void>
+        implements Runnable, AsynchronousCompletionTask {
+        public final Void getRawResult() { return null; }
+        public final void setRawResult(Void v) { }
+        public final void run() { exec(); }
+    }
+
+    static final class AsyncRun extends Async {
+        final Runnable fn;
+        final CompletableFuture<Void> dst;
+        AsyncRun(Runnable fn, CompletableFuture<Void> dst) {
+            this.fn = fn; this.dst = dst;
+        }
+        public final boolean exec() {
+            CompletableFuture<Void> d; Throwable ex;
+            if ((d = this.dst) != null && d.result == null) {
+                try {
+                    fn.run();
+                    ex = null;
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+                d.internalComplete(null, ex);
+            }
+            return true;
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AsyncSupply<U> extends Async {
+        final Supplier<U> fn;
+        final CompletableFuture<U> dst;
+        AsyncSupply(Supplier<U> fn, CompletableFuture<U> dst) {
+            this.fn = fn; this.dst = dst;
+        }
+        public final boolean exec() {
+            CompletableFuture<U> d; U u; Throwable ex;
+            if ((d = this.dst) != null && d.result == null) {
+                try {
+                    u = fn.get();
+                    ex = null;
+                } catch (Throwable rex) {
+                    ex = rex;
+                    u = null;
+                }
+                d.internalComplete(u, ex);
+            }
+            return true;
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AsyncApply<T,U> extends Async {
+        final T arg;
+        final Function<? super T,? extends U> fn;
+        final CompletableFuture<U> dst;
+        AsyncApply(T arg, Function<? super T,? extends U> fn,
+                   CompletableFuture<U> dst) {
+            this.arg = arg; this.fn = fn; this.dst = dst;
+        }
+        public final boolean exec() {
+            CompletableFuture<U> d; U u; Throwable ex;
+            if ((d = this.dst) != null && d.result == null) {
+                try {
+                    u = fn.apply(arg);
+                    ex = null;
+                } catch (Throwable rex) {
+                    ex = rex;
+                    u = null;
+                }
+                d.internalComplete(u, ex);
+            }
+            return true;
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AsyncCombine<T,U,V> extends Async {
+        final T arg1;
+        final U arg2;
+        final BiFunction<? super T,? super U,? extends V> fn;
+        final CompletableFuture<V> dst;
+        AsyncCombine(T arg1, U arg2,
+                     BiFunction<? super T,? super U,? extends V> fn,
+                     CompletableFuture<V> dst) {
+            this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst;
+        }
+        public final boolean exec() {
+            CompletableFuture<V> d; V v; Throwable ex;
+            if ((d = this.dst) != null && d.result == null) {
+                try {
+                    v = fn.apply(arg1, arg2);
+                    ex = null;
+                } catch (Throwable rex) {
+                    ex = rex;
+                    v = null;
+                }
+                d.internalComplete(v, ex);
+            }
+            return true;
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AsyncAccept<T> extends Async {
+        final T arg;
+        final Consumer<? super T> fn;
+        final CompletableFuture<Void> dst;
+        AsyncAccept(T arg, Consumer<? super T> fn,
+                    CompletableFuture<Void> dst) {
+            this.arg = arg; this.fn = fn; this.dst = dst;
+        }
+        public final boolean exec() {
+            CompletableFuture<Void> d; Throwable ex;
+            if ((d = this.dst) != null && d.result == null) {
+                try {
+                    fn.accept(arg);
+                    ex = null;
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+                d.internalComplete(null, ex);
+            }
+            return true;
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AsyncAcceptBoth<T,U> extends Async {
+        final T arg1;
+        final U arg2;
+        final BiConsumer<? super T,? super U> fn;
+        final CompletableFuture<Void> dst;
+        AsyncAcceptBoth(T arg1, U arg2,
+                        BiConsumer<? super T,? super U> fn,
+                        CompletableFuture<Void> dst) {
+            this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst;
+        }
+        public final boolean exec() {
+            CompletableFuture<Void> d; Throwable ex;
+            if ((d = this.dst) != null && d.result == null) {
+                try {
+                    fn.accept(arg1, arg2);
+                    ex = null;
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+                d.internalComplete(null, ex);
+            }
+            return true;
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AsyncCompose<T,U> extends Async {
+        final T arg;
+        final Function<? super T, CompletableFuture<U>> fn;
+        final CompletableFuture<U> dst;
+        AsyncCompose(T arg,
+                     Function<? super T, CompletableFuture<U>> fn,
+                     CompletableFuture<U> dst) {
+            this.arg = arg; this.fn = fn; this.dst = dst;
+        }
+        public final boolean exec() {
+            CompletableFuture<U> d, fr; U u; Throwable ex;
+            if ((d = this.dst) != null && d.result == null) {
+                try {
+                    fr = fn.apply(arg);
+                    ex = (fr == null) ? new NullPointerException() : null;
+                } catch (Throwable rex) {
+                    ex = rex;
+                    fr = null;
+                }
+                if (ex != null)
+                    u = null;
+                else {
+                    Object r = fr.result;
+                    if (r == null)
+                        r = fr.waitingGet(false);
+                    if (r instanceof AltResult) {
+                        ex = ((AltResult)r).ex;
+                        u = null;
+                    }
+                    else {
+                        @SuppressWarnings("unchecked") U ur = (U) r;
+                        u = ur;
+                    }
+                }
+                d.internalComplete(u, ex);
+            }
+            return true;
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    /* ------------- Completions -------------- */
+
+    /**
+     * Simple linked list nodes to record completions, used in
+     * basically the same way as WaitNodes. (We separate nodes from
+     * the Completions themselves mainly because for the And and Or
+     * methods, the same Completion object resides in two lists.)
+     */
+    static final class CompletionNode {
+        final Completion completion;
+        volatile CompletionNode next;
+        CompletionNode(Completion completion) { this.completion = completion; }
+    }
+
+    // Opportunistically subclass AtomicInteger to use compareAndSet to claim.
+    abstract static class Completion extends AtomicInteger implements Runnable {
+    }
+
+    static final class ThenApply<T,U> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final Function<? super T,? extends U> fn;
+        final CompletableFuture<U> dst;
+        final Executor executor;
+        ThenApply(CompletableFuture<? extends T> src,
+                  Function<? super T,? extends U> fn,
+                  CompletableFuture<U> dst,
+                  Executor executor) {
+            this.src = src; this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final Function<? super T,? extends U> fn;
+            final CompletableFuture<U> dst;
+            Object r; T t; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                Executor e = executor;
+                U u = null;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncApply<T,U>(t, fn, dst));
+                        else
+                            u = fn.apply(t);
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(u, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ThenAccept<T> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final Consumer<? super T> fn;
+        final CompletableFuture<Void> dst;
+        final Executor executor;
+        ThenAccept(CompletableFuture<? extends T> src,
+                   Consumer<? super T> fn,
+                   CompletableFuture<Void> dst,
+                   Executor executor) {
+            this.src = src; this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final Consumer<? super T> fn;
+            final CompletableFuture<Void> dst;
+            Object r; T t; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                Executor e = executor;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncAccept<T>(t, fn, dst));
+                        else
+                            fn.accept(t);
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ThenRun extends Completion {
+        final CompletableFuture<?> src;
+        final Runnable fn;
+        final CompletableFuture<Void> dst;
+        final Executor executor;
+        ThenRun(CompletableFuture<?> src,
+                Runnable fn,
+                CompletableFuture<Void> dst,
+                Executor executor) {
+            this.src = src; this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<?> a;
+            final Runnable fn;
+            final CompletableFuture<Void> dst;
+            Object r; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult)
+                    ex = ((AltResult)r).ex;
+                else
+                    ex = null;
+                Executor e = executor;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncRun(fn, dst));
+                        else
+                            fn.run();
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ThenCombine<T,U,V> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final CompletableFuture<? extends U> snd;
+        final BiFunction<? super T,? super U,? extends V> fn;
+        final CompletableFuture<V> dst;
+        final Executor executor;
+        ThenCombine(CompletableFuture<? extends T> src,
+                    CompletableFuture<? extends U> snd,
+                    BiFunction<? super T,? super U,? extends V> fn,
+                    CompletableFuture<V> dst,
+                    Executor executor) {
+            this.src = src; this.snd = snd;
+            this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final CompletableFuture<? extends U> b;
+            final BiFunction<? super T,? super U,? extends V> fn;
+            final CompletableFuture<V> dst;
+            Object r, s; T t; U u; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                (b = this.snd) != null &&
+                (s = b.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                if (ex != null)
+                    u = null;
+                else if (s instanceof AltResult) {
+                    ex = ((AltResult)s).ex;
+                    u = null;
+                }
+                else {
+                    @SuppressWarnings("unchecked") U us = (U) s;
+                    u = us;
+                }
+                Executor e = executor;
+                V v = null;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncCombine<T,U,V>(t, u, fn, dst));
+                        else
+                            v = fn.apply(t, u);
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(v, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ThenAcceptBoth<T,U> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final CompletableFuture<? extends U> snd;
+        final BiConsumer<? super T,? super U> fn;
+        final CompletableFuture<Void> dst;
+        final Executor executor;
+        ThenAcceptBoth(CompletableFuture<? extends T> src,
+                       CompletableFuture<? extends U> snd,
+                       BiConsumer<? super T,? super U> fn,
+                       CompletableFuture<Void> dst,
+                       Executor executor) {
+            this.src = src; this.snd = snd;
+            this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final CompletableFuture<? extends U> b;
+            final BiConsumer<? super T,? super U> fn;
+            final CompletableFuture<Void> dst;
+            Object r, s; T t; U u; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                (b = this.snd) != null &&
+                (s = b.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                if (ex != null)
+                    u = null;
+                else if (s instanceof AltResult) {
+                    ex = ((AltResult)s).ex;
+                    u = null;
+                }
+                else {
+                    @SuppressWarnings("unchecked") U us = (U) s;
+                    u = us;
+                }
+                Executor e = executor;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncAcceptBoth<T,U>(t, u, fn, dst));
+                        else
+                            fn.accept(t, u);
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class RunAfterBoth extends Completion {
+        final CompletableFuture<?> src;
+        final CompletableFuture<?> snd;
+        final Runnable fn;
+        final CompletableFuture<Void> dst;
+        final Executor executor;
+        RunAfterBoth(CompletableFuture<?> src,
+                     CompletableFuture<?> snd,
+                     Runnable fn,
+                     CompletableFuture<Void> dst,
+                     Executor executor) {
+            this.src = src; this.snd = snd;
+            this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<?> a;
+            final CompletableFuture<?> b;
+            final Runnable fn;
+            final CompletableFuture<Void> dst;
+            Object r, s; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                (b = this.snd) != null &&
+                (s = b.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult)
+                    ex = ((AltResult)r).ex;
+                else
+                    ex = null;
+                if (ex == null && (s instanceof AltResult))
+                    ex = ((AltResult)s).ex;
+                Executor e = executor;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncRun(fn, dst));
+                        else
+                            fn.run();
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AndCompletion extends Completion {
+        final CompletableFuture<?> src;
+        final CompletableFuture<?> snd;
+        final CompletableFuture<Void> dst;
+        AndCompletion(CompletableFuture<?> src,
+                      CompletableFuture<?> snd,
+                      CompletableFuture<Void> dst) {
+            this.src = src; this.snd = snd; this.dst = dst;
+        }
+        public final void run() {
+            final CompletableFuture<?> a;
+            final CompletableFuture<?> b;
+            final CompletableFuture<Void> dst;
+            Object r, s; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                (b = this.snd) != null &&
+                (s = b.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult)
+                    ex = ((AltResult)r).ex;
+                else
+                    ex = null;
+                if (ex == null && (s instanceof AltResult))
+                    ex = ((AltResult)s).ex;
+                dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ApplyToEither<T,U> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final CompletableFuture<? extends T> snd;
+        final Function<? super T,? extends U> fn;
+        final CompletableFuture<U> dst;
+        final Executor executor;
+        ApplyToEither(CompletableFuture<? extends T> src,
+                      CompletableFuture<? extends T> snd,
+                      Function<? super T,? extends U> fn,
+                      CompletableFuture<U> dst,
+                      Executor executor) {
+            this.src = src; this.snd = snd;
+            this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final CompletableFuture<? extends T> b;
+            final Function<? super T,? extends U> fn;
+            final CompletableFuture<U> dst;
+            Object r; T t; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (((a = this.src) != null && (r = a.result) != null) ||
+                 ((b = this.snd) != null && (r = b.result) != null)) &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                Executor e = executor;
+                U u = null;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncApply<T,U>(t, fn, dst));
+                        else
+                            u = fn.apply(t);
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(u, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class AcceptEither<T> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final CompletableFuture<? extends T> snd;
+        final Consumer<? super T> fn;
+        final CompletableFuture<Void> dst;
+        final Executor executor;
+        AcceptEither(CompletableFuture<? extends T> src,
+                     CompletableFuture<? extends T> snd,
+                     Consumer<? super T> fn,
+                     CompletableFuture<Void> dst,
+                     Executor executor) {
+            this.src = src; this.snd = snd;
+            this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final CompletableFuture<? extends T> b;
+            final Consumer<? super T> fn;
+            final CompletableFuture<Void> dst;
+            Object r; T t; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (((a = this.src) != null && (r = a.result) != null) ||
+                 ((b = this.snd) != null && (r = b.result) != null)) &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                Executor e = executor;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncAccept<T>(t, fn, dst));
+                        else
+                            fn.accept(t);
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class RunAfterEither extends Completion {
+        final CompletableFuture<?> src;
+        final CompletableFuture<?> snd;
+        final Runnable fn;
+        final CompletableFuture<Void> dst;
+        final Executor executor;
+        RunAfterEither(CompletableFuture<?> src,
+                       CompletableFuture<?> snd,
+                       Runnable fn,
+                       CompletableFuture<Void> dst,
+                       Executor executor) {
+            this.src = src; this.snd = snd;
+            this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<?> a;
+            final CompletableFuture<?> b;
+            final Runnable fn;
+            final CompletableFuture<Void> dst;
+            Object r; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (((a = this.src) != null && (r = a.result) != null) ||
+                 ((b = this.snd) != null && (r = b.result) != null)) &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult)
+                    ex = ((AltResult)r).ex;
+                else
+                    ex = null;
+                Executor e = executor;
+                if (ex == null) {
+                    try {
+                        if (e != null)
+                            e.execute(new AsyncRun(fn, dst));
+                        else
+                            fn.run();
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+                if (e == null || ex != null)
+                    dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class OrCompletion extends Completion {
+        final CompletableFuture<?> src;
+        final CompletableFuture<?> snd;
+        final CompletableFuture<Object> dst;
+        OrCompletion(CompletableFuture<?> src,
+                     CompletableFuture<?> snd,
+                     CompletableFuture<Object> dst) {
+            this.src = src; this.snd = snd; this.dst = dst;
+        }
+        public final void run() {
+            final CompletableFuture<?> a;
+            final CompletableFuture<?> b;
+            final CompletableFuture<Object> dst;
+            Object r, t; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (((a = this.src) != null && (r = a.result) != null) ||
+                 ((b = this.snd) != null && (r = b.result) != null)) &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    t = r;
+                }
+                dst.internalComplete(t, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ExceptionCompletion<T> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final Function<? super Throwable, ? extends T> fn;
+        final CompletableFuture<T> dst;
+        ExceptionCompletion(CompletableFuture<? extends T> src,
+                            Function<? super Throwable, ? extends T> fn,
+                            CompletableFuture<T> dst) {
+            this.src = src; this.fn = fn; this.dst = dst;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final Function<? super Throwable, ? extends T> fn;
+            final CompletableFuture<T> dst;
+            Object r; T t = null; Throwable ex, dx = null;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if ((r instanceof AltResult) &&
+                    (ex = ((AltResult)r).ex) != null)  {
+                    try {
+                        t = fn.apply(ex);
+                    } catch (Throwable rex) {
+                        dx = rex;
+                    }
+                }
+                else {
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                dst.internalComplete(t, dx);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ThenCopy<T> extends Completion {
+        final CompletableFuture<?> src;
+        final CompletableFuture<T> dst;
+        ThenCopy(CompletableFuture<?> src,
+                 CompletableFuture<T> dst) {
+            this.src = src; this.dst = dst;
+        }
+        public final void run() {
+            final CompletableFuture<?> a;
+            final CompletableFuture<T> dst;
+            Object r; T t; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                dst.internalComplete(t, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    // version of ThenCopy for CompletableFuture<Void> dst
+    static final class ThenPropagate extends Completion {
+        final CompletableFuture<?> src;
+        final CompletableFuture<Void> dst;
+        ThenPropagate(CompletableFuture<?> src,
+                      CompletableFuture<Void> dst) {
+            this.src = src; this.dst = dst;
+        }
+        public final void run() {
+            final CompletableFuture<?> a;
+            final CompletableFuture<Void> dst;
+            Object r; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult)
+                    ex = ((AltResult)r).ex;
+                else
+                    ex = null;
+                dst.internalComplete(null, ex);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class HandleCompletion<T,U> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final BiFunction<? super T, Throwable, ? extends U> fn;
+        final CompletableFuture<U> dst;
+        HandleCompletion(CompletableFuture<? extends T> src,
+                         BiFunction<? super T, Throwable, ? extends U> fn,
+                         CompletableFuture<U> dst) {
+            this.src = src; this.fn = fn; this.dst = dst;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final BiFunction<? super T, Throwable, ? extends U> fn;
+            final CompletableFuture<U> dst;
+            Object r; T t; Throwable ex;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                U u = null; Throwable dx = null;
+                try {
+                    u = fn.apply(t, ex);
+                } catch (Throwable rex) {
+                    dx = rex;
+                }
+                dst.internalComplete(u, dx);
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    static final class ThenCompose<T,U> extends Completion {
+        final CompletableFuture<? extends T> src;
+        final Function<? super T, CompletableFuture<U>> fn;
+        final CompletableFuture<U> dst;
+        final Executor executor;
+        ThenCompose(CompletableFuture<? extends T> src,
+                    Function<? super T, CompletableFuture<U>> fn,
+                    CompletableFuture<U> dst,
+                    Executor executor) {
+            this.src = src; this.fn = fn; this.dst = dst;
+            this.executor = executor;
+        }
+        public final void run() {
+            final CompletableFuture<? extends T> a;
+            final Function<? super T, CompletableFuture<U>> fn;
+            final CompletableFuture<U> dst;
+            Object r; T t; Throwable ex; Executor e;
+            if ((dst = this.dst) != null &&
+                (fn = this.fn) != null &&
+                (a = this.src) != null &&
+                (r = a.result) != null &&
+                compareAndSet(0, 1)) {
+                if (r instanceof AltResult) {
+                    ex = ((AltResult)r).ex;
+                    t = null;
+                }
+                else {
+                    ex = null;
+                    @SuppressWarnings("unchecked") T tr = (T) r;
+                    t = tr;
+                }
+                CompletableFuture<U> c = null;
+                U u = null;
+                boolean complete = false;
+                if (ex == null) {
+                    if ((e = executor) != null)
+                        e.execute(new AsyncCompose<T,U>(t, fn, dst));
+                    else {
+                        try {
+                            if ((c = fn.apply(t)) == null)
+                                ex = new NullPointerException();
+                        } catch (Throwable rex) {
+                            ex = rex;
+                        }
+                    }
+                }
+                if (c != null) {
+                    ThenCopy<U> d = null;
+                    Object s;
+                    if ((s = c.result) == null) {
+                        CompletionNode p = new CompletionNode
+                            (d = new ThenCopy<U>(c, dst));
+                        while ((s = c.result) == null) {
+                            if (UNSAFE.compareAndSwapObject
+                                (c, COMPLETIONS, p.next = c.completions, p))
+                                break;
+                        }
+                    }
+                    if (s != null && (d == null || d.compareAndSet(0, 1))) {
+                        complete = true;
+                        if (s instanceof AltResult) {
+                            ex = ((AltResult)s).ex;  // no rewrap
+                            u = null;
+                        }
+                        else {
+                            @SuppressWarnings("unchecked") U us = (U) s;
+                            u = us;
+                        }
+                    }
+                }
+                if (complete || ex != null)
+                    dst.internalComplete(u, ex);
+                if (c != null)
+                    c.helpPostComplete();
+            }
+        }
+        private static final long serialVersionUID = 5232453952276885070L;
+    }
+
+    // public methods
+
+    /**
+     * Creates a new incomplete CompletableFuture.
+     */
+    public CompletableFuture() {
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * by a task running in the {@link ForkJoinPool#commonPool()} with
+     * the value obtained by calling the given Supplier.
+     *
+     * @param supplier a function returning the value to be used
+     * to complete the returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
+        if (supplier == null) throw new NullPointerException();
+        CompletableFuture<U> f = new CompletableFuture<U>();
+        ForkJoinPool.commonPool().
+            execute((ForkJoinTask<?>)new AsyncSupply<U>(supplier, f));
+        return f;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * by a task running in the given executor with the value obtained
+     * by calling the given Supplier.
+     *
+     * @param supplier a function returning the value to be used
+     * to complete the returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier,
+                                                       Executor executor) {
+        if (executor == null || supplier == null)
+            throw new NullPointerException();
+        CompletableFuture<U> f = new CompletableFuture<U>();
+        executor.execute(new AsyncSupply<U>(supplier, f));
+        return f;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * by a task running in the {@link ForkJoinPool#commonPool()} after
+     * it runs the given action.
+     *
+     * @param runnable the action to run before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public static CompletableFuture<Void> runAsync(Runnable runnable) {
+        if (runnable == null) throw new NullPointerException();
+        CompletableFuture<Void> f = new CompletableFuture<Void>();
+        ForkJoinPool.commonPool().
+            execute((ForkJoinTask<?>)new AsyncRun(runnable, f));
+        return f;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * by a task running in the given executor after it runs the given
+     * action.
+     *
+     * @param runnable the action to run before completing the
+     * returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public static CompletableFuture<Void> runAsync(Runnable runnable,
+                                                   Executor executor) {
+        if (executor == null || runnable == null)
+            throw new NullPointerException();
+        CompletableFuture<Void> f = new CompletableFuture<Void>();
+        executor.execute(new AsyncRun(runnable, f));
+        return f;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is already completed with
+     * the given value.
+     *
+     * @param value the value
+     * @return the completed CompletableFuture
+     */
+    public static <U> CompletableFuture<U> completedFuture(U value) {
+        CompletableFuture<U> f = new CompletableFuture<U>();
+        f.result = (value == null) ? NIL : value;
+        return f;
+    }
+
+    /**
+     * Returns {@code true} if completed in any fashion: normally,
+     * exceptionally, or via cancellation.
+     *
+     * @return {@code true} if completed
+     */
+    public boolean isDone() {
+        return result != null;
+    }
+
+    /**
+     * Waits if necessary for this future to complete, and then
+     * returns its result.
+     *
+     * @return the result value
+     * @throws CancellationException if this future was cancelled
+     * @throws ExecutionException if this future completed exceptionally
+     * @throws InterruptedException if the current thread was interrupted
+     * while waiting
+     */
+    public T get() throws InterruptedException, ExecutionException {
+        Object r; Throwable ex, cause;
+        if ((r = result) == null && (r = waitingGet(true)) == null)
+            throw new InterruptedException();
+        if (!(r instanceof AltResult)) {
+            @SuppressWarnings("unchecked") T tr = (T) r;
+            return tr;
+        }
+        if ((ex = ((AltResult)r).ex) == null)
+            return null;
+        if (ex instanceof CancellationException)
+            throw (CancellationException)ex;
+        if ((ex instanceof CompletionException) &&
+            (cause = ex.getCause()) != null)
+            ex = cause;
+        throw new ExecutionException(ex);
+    }
+
+    /**
+     * Waits if necessary for at most the given time for this future
+     * to complete, and then returns its result, if available.
+     *
+     * @param timeout the maximum time to wait
+     * @param unit the time unit of the timeout argument
+     * @return the result value
+     * @throws CancellationException if this future was cancelled
+     * @throws ExecutionException if this future completed exceptionally
+     * @throws InterruptedException if the current thread was interrupted
+     * while waiting
+     * @throws TimeoutException if the wait timed out
+     */
+    public T get(long timeout, TimeUnit unit)
+        throws InterruptedException, ExecutionException, TimeoutException {
+        Object r; Throwable ex, cause;
+        long nanos = unit.toNanos(timeout);
+        if (Thread.interrupted())
+            throw new InterruptedException();
+        if ((r = result) == null)
+            r = timedAwaitDone(nanos);
+        if (!(r instanceof AltResult)) {
+            @SuppressWarnings("unchecked") T tr = (T) r;
+            return tr;
+        }
+        if ((ex = ((AltResult)r).ex) == null)
+            return null;
+        if (ex instanceof CancellationException)
+            throw (CancellationException)ex;
+        if ((ex instanceof CompletionException) &&
+            (cause = ex.getCause()) != null)
+            ex = cause;
+        throw new ExecutionException(ex);
+    }
+
+    /**
+     * Returns the result value when complete, or throws an
+     * (unchecked) exception if completed exceptionally. To better
+     * conform with the use of common functional forms, if a
+     * computation involved in the completion of this
+     * CompletableFuture threw an exception, this method throws an
+     * (unchecked) {@link CompletionException} with the underlying
+     * exception as its cause.
+     *
+     * @return the result value
+     * @throws CancellationException if the computation was cancelled
+     * @throws CompletionException if this future completed
+     * exceptionally or a completion computation threw an exception
+     */
+    public T join() {
+        Object r; Throwable ex;
+        if ((r = result) == null)
+            r = waitingGet(false);
+        if (!(r instanceof AltResult)) {
+            @SuppressWarnings("unchecked") T tr = (T) r;
+            return tr;
+        }
+        if ((ex = ((AltResult)r).ex) == null)
+            return null;
+        if (ex instanceof CancellationException)
+            throw (CancellationException)ex;
+        if (ex instanceof CompletionException)
+            throw (CompletionException)ex;
+        throw new CompletionException(ex);
+    }
+
+    /**
+     * Returns the result value (or throws any encountered exception)
+     * if completed, else returns the given valueIfAbsent.
+     *
+     * @param valueIfAbsent the value to return if not completed
+     * @return the result value, if completed, else the given valueIfAbsent
+     * @throws CancellationException if the computation was cancelled
+     * @throws CompletionException if this future completed
+     * exceptionally or a completion computation threw an exception
+     */
+    public T getNow(T valueIfAbsent) {
+        Object r; Throwable ex;
+        if ((r = result) == null)
+            return valueIfAbsent;
+        if (!(r instanceof AltResult)) {
+            @SuppressWarnings("unchecked") T tr = (T) r;
+            return tr;
+        }
+        if ((ex = ((AltResult)r).ex) == null)
+            return null;
+        if (ex instanceof CancellationException)
+            throw (CancellationException)ex;
+        if (ex instanceof CompletionException)
+            throw (CompletionException)ex;
+        throw new CompletionException(ex);
+    }
+
+    /**
+     * If not already completed, sets the value returned by {@link
+     * #get()} and related methods to the given value.
+     *
+     * @param value the result value
+     * @return {@code true} if this invocation caused this CompletableFuture
+     * to transition to a completed state, else {@code false}
+     */
+    public boolean complete(T value) {
+        boolean triggered = result == null &&
+            UNSAFE.compareAndSwapObject(this, RESULT, null,
+                                        value == null ? NIL : value);
+        postComplete();
+        return triggered;
+    }
+
+    /**
+     * If not already completed, causes invocations of {@link #get()}
+     * and related methods to throw the given exception.
+     *
+     * @param ex the exception
+     * @return {@code true} if this invocation caused this CompletableFuture
+     * to transition to a completed state, else {@code false}
+     */
+    public boolean completeExceptionally(Throwable ex) {
+        if (ex == null) throw new NullPointerException();
+        boolean triggered = result == null &&
+            UNSAFE.compareAndSwapObject(this, RESULT, null, new AltResult(ex));
+        postComplete();
+        return triggered;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when this CompletableFuture completes, with the result of the
+     * given function of this CompletableFuture's result.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied function throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<U> thenApply(Function<? super T,? extends U> fn) {
+        return doThenApply(fn, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when this CompletableFuture completes, with the result of the
+     * given function of this CompletableFuture's result from a
+     * task running in the {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied function throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<U> thenApplyAsync
+        (Function<? super T,? extends U> fn) {
+        return doThenApply(fn, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when this CompletableFuture completes, with the result of the
+     * given function of this CompletableFuture's result from a
+     * task running in the given executor.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied function throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<U> thenApplyAsync
+        (Function<? super T,? extends U> fn,
+         Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doThenApply(fn, executor);
+    }
+
+    private <U> CompletableFuture<U> doThenApply
+        (Function<? super T,? extends U> fn,
+         Executor e) {
+        if (fn == null) throw new NullPointerException();
+        CompletableFuture<U> dst = new CompletableFuture<U>();
+        ThenApply<T,U> d = null;
+        Object r;
+        if ((r = result) == null) {
+            CompletionNode p = new CompletionNode
+                (d = new ThenApply<T,U>(this, fn, dst, e));
+            while ((r = result) == null) {
+                if (UNSAFE.compareAndSwapObject
+                    (this, COMPLETIONS, p.next = completions, p))
+                    break;
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            U u = null;
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncApply<T,U>(t, fn, dst));
+                    else
+                        u = fn.apply(t);
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(u, ex);
+        }
+        helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when this CompletableFuture completes, after performing the given
+     * action with this CompletableFuture's result.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied action throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> thenAccept(Consumer<? super T> block) {
+        return doThenAccept(block, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when this CompletableFuture completes, after performing the given
+     * action with this CompletableFuture's result from a task running
+     * in the {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied action throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> block) {
+        return doThenAccept(block, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when this CompletableFuture completes, after performing the given
+     * action with this CompletableFuture's result from a task running
+     * in the given executor.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied action throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> block,
+                                                   Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doThenAccept(block, executor);
+    }
+
+    private CompletableFuture<Void> doThenAccept(Consumer<? super T> fn,
+                                                 Executor e) {
+        if (fn == null) throw new NullPointerException();
+        CompletableFuture<Void> dst = new CompletableFuture<Void>();
+        ThenAccept<T> d = null;
+        Object r;
+        if ((r = result) == null) {
+            CompletionNode p = new CompletionNode
+                (d = new ThenAccept<T>(this, fn, dst, e));
+            while ((r = result) == null) {
+                if (UNSAFE.compareAndSwapObject
+                    (this, COMPLETIONS, p.next = completions, p))
+                    break;
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncAccept<T>(t, fn, dst));
+                    else
+                        fn.accept(t);
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(null, ex);
+        }
+        helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when this CompletableFuture completes, after performing the given
+     * action.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied action throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> thenRun(Runnable action) {
+        return doThenRun(action, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when this CompletableFuture completes, after performing the given
+     * action from a task running in the {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied action throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> thenRunAsync(Runnable action) {
+        return doThenRun(action, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when this CompletableFuture completes, after performing the given
+     * action from a task running in the given executor.
+     *
+     * <p>If this CompletableFuture completes exceptionally, or the
+     * supplied action throws an exception, then the returned
+     * CompletableFuture completes exceptionally with a
+     * CompletionException holding the exception as its cause.
+     *
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> thenRunAsync(Runnable action,
+                                                Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doThenRun(action, executor);
+    }
+
+    private CompletableFuture<Void> doThenRun(Runnable action,
+                                              Executor e) {
+        if (action == null) throw new NullPointerException();
+        CompletableFuture<Void> dst = new CompletableFuture<Void>();
+        ThenRun d = null;
+        Object r;
+        if ((r = result) == null) {
+            CompletionNode p = new CompletionNode
+                (d = new ThenRun(this, action, dst, e));
+            while ((r = result) == null) {
+                if (UNSAFE.compareAndSwapObject
+                    (this, COMPLETIONS, p.next = completions, p))
+                    break;
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            Throwable ex;
+            if (r instanceof AltResult)
+                ex = ((AltResult)r).ex;
+            else
+                ex = null;
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncRun(action, dst));
+                    else
+                        action.run();
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(null, ex);
+        }
+        helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when both this and the other given CompletableFuture complete,
+     * with the result of the given function of the results of the two
+     * CompletableFutures.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied function throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U,V> CompletableFuture<V> thenCombine
+        (CompletableFuture<? extends U> other,
+         BiFunction<? super T,? super U,? extends V> fn) {
+        return doThenCombine(other, fn, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when both this and the other given CompletableFuture complete,
+     * with the result of the given function of the results of the two
+     * CompletableFutures from a task running in the
+     * {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied function throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U,V> CompletableFuture<V> thenCombineAsync
+        (CompletableFuture<? extends U> other,
+         BiFunction<? super T,? super U,? extends V> fn) {
+        return doThenCombine(other, fn, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when both this and the other given CompletableFuture complete,
+     * with the result of the given function of the results of the two
+     * CompletableFutures from a task running in the given executor.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied function throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public <U,V> CompletableFuture<V> thenCombineAsync
+        (CompletableFuture<? extends U> other,
+         BiFunction<? super T,? super U,? extends V> fn,
+         Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doThenCombine(other, fn, executor);
+    }
+
+    private <U,V> CompletableFuture<V> doThenCombine
+        (CompletableFuture<? extends U> other,
+         BiFunction<? super T,? super U,? extends V> fn,
+         Executor e) {
+        if (other == null || fn == null) throw new NullPointerException();
+        CompletableFuture<V> dst = new CompletableFuture<V>();
+        ThenCombine<T,U,V> d = null;
+        Object r, s = null;
+        if ((r = result) == null || (s = other.result) == null) {
+            d = new ThenCombine<T,U,V>(this, other, fn, dst, e);
+            CompletionNode q = null, p = new CompletionNode(d);
+            while ((r == null && (r = result) == null) ||
+                   (s == null && (s = other.result) == null)) {
+                if (q != null) {
+                    if (s != null ||
+                        UNSAFE.compareAndSwapObject
+                        (other, COMPLETIONS, q.next = other.completions, q))
+                        break;
+                }
+                else if (r != null ||
+                         UNSAFE.compareAndSwapObject
+                         (this, COMPLETIONS, p.next = completions, p)) {
+                    if (s != null)
+                        break;
+                    q = new CompletionNode(d);
+                }
+            }
+        }
+        if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; U u; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            if (ex != null)
+                u = null;
+            else if (s instanceof AltResult) {
+                ex = ((AltResult)s).ex;
+                u = null;
+            }
+            else {
+                @SuppressWarnings("unchecked") U us = (U) s;
+                u = us;
+            }
+            V v = null;
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncCombine<T,U,V>(t, u, fn, dst));
+                    else
+                        v = fn.apply(t, u);
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(v, ex);
+        }
+        helpPostComplete();
+        other.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when both this and the other given CompletableFuture complete,
+     * after performing the given action with the results of the two
+     * CompletableFutures.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied action throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<Void> thenAcceptBoth
+        (CompletableFuture<? extends U> other,
+         BiConsumer<? super T, ? super U> block) {
+        return doThenAcceptBoth(other, block, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when both this and the other given CompletableFuture complete,
+     * after performing the given action with the results of the two
+     * CompletableFutures from a task running in the {@link
+     * ForkJoinPool#commonPool()}.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied action throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<Void> thenAcceptBothAsync
+        (CompletableFuture<? extends U> other,
+         BiConsumer<? super T, ? super U> block) {
+        return doThenAcceptBoth(other, block, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when both this and the other given CompletableFuture complete,
+     * after performing the given action with the results of the two
+     * CompletableFutures from a task running in the given executor.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied action throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<Void> thenAcceptBothAsync
+        (CompletableFuture<? extends U> other,
+         BiConsumer<? super T, ? super U> block,
+         Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doThenAcceptBoth(other, block, executor);
+    }
+
+    private <U> CompletableFuture<Void> doThenAcceptBoth
+        (CompletableFuture<? extends U> other,
+         BiConsumer<? super T,? super U> fn,
+         Executor e) {
+        if (other == null || fn == null) throw new NullPointerException();
+        CompletableFuture<Void> dst = new CompletableFuture<Void>();
+        ThenAcceptBoth<T,U> d = null;
+        Object r, s = null;
+        if ((r = result) == null || (s = other.result) == null) {
+            d = new ThenAcceptBoth<T,U>(this, other, fn, dst, e);
+            CompletionNode q = null, p = new CompletionNode(d);
+            while ((r == null && (r = result) == null) ||
+                   (s == null && (s = other.result) == null)) {
+                if (q != null) {
+                    if (s != null ||
+                        UNSAFE.compareAndSwapObject
+                        (other, COMPLETIONS, q.next = other.completions, q))
+                        break;
+                }
+                else if (r != null ||
+                         UNSAFE.compareAndSwapObject
+                         (this, COMPLETIONS, p.next = completions, p)) {
+                    if (s != null)
+                        break;
+                    q = new CompletionNode(d);
+                }
+            }
+        }
+        if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; U u; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            if (ex != null)
+                u = null;
+            else if (s instanceof AltResult) {
+                ex = ((AltResult)s).ex;
+                u = null;
+            }
+            else {
+                @SuppressWarnings("unchecked") U us = (U) s;
+                u = us;
+            }
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncAcceptBoth<T,U>(t, u, fn, dst));
+                    else
+                        fn.accept(t, u);
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(null, ex);
+        }
+        helpPostComplete();
+        other.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when both this and the other given CompletableFuture complete,
+     * after performing the given action.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied action throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> runAfterBoth(CompletableFuture<?> other,
+                                                Runnable action) {
+        return doRunAfterBoth(other, action, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when both this and the other given CompletableFuture complete,
+     * after performing the given action from a task running in the
+     * {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied action throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> runAfterBothAsync(CompletableFuture<?> other,
+                                                     Runnable action) {
+        return doRunAfterBoth(other, action, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when both this and the other given CompletableFuture complete,
+     * after performing the given action from a task running in the
+     * given executor.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, or the supplied action throws an exception,
+     * then the returned CompletableFuture completes exceptionally
+     * with a CompletionException holding the exception as its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> runAfterBothAsync(CompletableFuture<?> other,
+                                                     Runnable action,
+                                                     Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doRunAfterBoth(other, action, executor);
+    }
+
+    private CompletableFuture<Void> doRunAfterBoth(CompletableFuture<?> other,
+                                                   Runnable action,
+                                                   Executor e) {
+        if (other == null || action == null) throw new NullPointerException();
+        CompletableFuture<Void> dst = new CompletableFuture<Void>();
+        RunAfterBoth d = null;
+        Object r, s = null;
+        if ((r = result) == null || (s = other.result) == null) {
+            d = new RunAfterBoth(this, other, action, dst, e);
+            CompletionNode q = null, p = new CompletionNode(d);
+            while ((r == null && (r = result) == null) ||
+                   (s == null && (s = other.result) == null)) {
+                if (q != null) {
+                    if (s != null ||
+                        UNSAFE.compareAndSwapObject
+                        (other, COMPLETIONS, q.next = other.completions, q))
+                        break;
+                }
+                else if (r != null ||
+                         UNSAFE.compareAndSwapObject
+                         (this, COMPLETIONS, p.next = completions, p)) {
+                    if (s != null)
+                        break;
+                    q = new CompletionNode(d);
+                }
+            }
+        }
+        if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
+            Throwable ex;
+            if (r instanceof AltResult)
+                ex = ((AltResult)r).ex;
+            else
+                ex = null;
+            if (ex == null && (s instanceof AltResult))
+                ex = ((AltResult)s).ex;
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncRun(action, dst));
+                    else
+                        action.run();
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(null, ex);
+        }
+        helpPostComplete();
+        other.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when either this or the other given CompletableFuture completes,
+     * with the result of the given function of either this or the other
+     * CompletableFuture's result.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied function
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<U> applyToEither
+        (CompletableFuture<? extends T> other,
+         Function<? super T, U> fn) {
+        return doApplyToEither(other, fn, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when either this or the other given CompletableFuture completes,
+     * with the result of the given function of either this or the other
+     * CompletableFuture's result from a task running in the
+     * {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied function
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<U> applyToEitherAsync
+        (CompletableFuture<? extends T> other,
+         Function<? super T, U> fn) {
+        return doApplyToEither(other, fn, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when either this or the other given CompletableFuture completes,
+     * with the result of the given function of either this or the other
+     * CompletableFuture's result from a task running in the
+     * given executor.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied function
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param fn the function to use to compute the value of
+     * the returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<U> applyToEitherAsync
+        (CompletableFuture<? extends T> other,
+         Function<? super T, U> fn,
+         Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doApplyToEither(other, fn, executor);
+    }
+
+    private <U> CompletableFuture<U> doApplyToEither
+        (CompletableFuture<? extends T> other,
+         Function<? super T, U> fn,
+         Executor e) {
+        if (other == null || fn == null) throw new NullPointerException();
+        CompletableFuture<U> dst = new CompletableFuture<U>();
+        ApplyToEither<T,U> d = null;
+        Object r;
+        if ((r = result) == null && (r = other.result) == null) {
+            d = new ApplyToEither<T,U>(this, other, fn, dst, e);
+            CompletionNode q = null, p = new CompletionNode(d);
+            while ((r = result) == null && (r = other.result) == null) {
+                if (q != null) {
+                    if (UNSAFE.compareAndSwapObject
+                        (other, COMPLETIONS, q.next = other.completions, q))
+                        break;
+                }
+                else if (UNSAFE.compareAndSwapObject
+                         (this, COMPLETIONS, p.next = completions, p))
+                    q = new CompletionNode(d);
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            U u = null;
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncApply<T,U>(t, fn, dst));
+                    else
+                        u = fn.apply(t);
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(u, ex);
+        }
+        helpPostComplete();
+        other.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when either this or the other given CompletableFuture completes,
+     * after performing the given action with the result of either this
+     * or the other CompletableFuture's result.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied action
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> acceptEither
+        (CompletableFuture<? extends T> other,
+         Consumer<? super T> block) {
+        return doAcceptEither(other, block, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when either this or the other given CompletableFuture completes,
+     * after performing the given action with the result of either this
+     * or the other CompletableFuture's result from a task running in
+     * the {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied action
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> acceptEitherAsync
+        (CompletableFuture<? extends T> other,
+         Consumer<? super T> block) {
+        return doAcceptEither(other, block, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when either this or the other given CompletableFuture completes,
+     * after performing the given action with the result of either this
+     * or the other CompletableFuture's result from a task running in
+     * the given executor.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied action
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param block the action to perform before completing the
+     * returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> acceptEitherAsync
+        (CompletableFuture<? extends T> other,
+         Consumer<? super T> block,
+         Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doAcceptEither(other, block, executor);
+    }
+
+    private CompletableFuture<Void> doAcceptEither
+        (CompletableFuture<? extends T> other,
+         Consumer<? super T> fn,
+         Executor e) {
+        if (other == null || fn == null) throw new NullPointerException();
+        CompletableFuture<Void> dst = new CompletableFuture<Void>();
+        AcceptEither<T> d = null;
+        Object r;
+        if ((r = result) == null && (r = other.result) == null) {
+            d = new AcceptEither<T>(this, other, fn, dst, e);
+            CompletionNode q = null, p = new CompletionNode(d);
+            while ((r = result) == null && (r = other.result) == null) {
+                if (q != null) {
+                    if (UNSAFE.compareAndSwapObject
+                        (other, COMPLETIONS, q.next = other.completions, q))
+                        break;
+                }
+                else if (UNSAFE.compareAndSwapObject
+                         (this, COMPLETIONS, p.next = completions, p))
+                    q = new CompletionNode(d);
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncAccept<T>(t, fn, dst));
+                    else
+                        fn.accept(t);
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(null, ex);
+        }
+        helpPostComplete();
+        other.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed
+     * when either this or the other given CompletableFuture completes,
+     * after performing the given action.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied action
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> runAfterEither(CompletableFuture<?> other,
+                                                  Runnable action) {
+        return doRunAfterEither(other, action, null);
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when either this or the other given CompletableFuture completes,
+     * after performing the given action from a task running in the
+     * {@link ForkJoinPool#commonPool()}.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied action
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> runAfterEitherAsync
+        (CompletableFuture<?> other,
+         Runnable action) {
+        return doRunAfterEither(other, action, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a new CompletableFuture that is asynchronously completed
+     * when either this or the other given CompletableFuture completes,
+     * after performing the given action from a task running in the
+     * given executor.
+     *
+     * <p>If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture may also do so,
+     * with a CompletionException holding one of these exceptions as its
+     * cause.  No guarantees are made about which result or exception is
+     * used in the returned CompletableFuture.  If the supplied action
+     * throws an exception, then the returned CompletableFuture completes
+     * exceptionally with a CompletionException holding the exception as
+     * its cause.
+     *
+     * @param other the other CompletableFuture
+     * @param action the action to perform before completing the
+     * returned CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<Void> runAfterEitherAsync
+        (CompletableFuture<?> other,
+         Runnable action,
+         Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doRunAfterEither(other, action, executor);
+    }
+
+    private CompletableFuture<Void> doRunAfterEither
+        (CompletableFuture<?> other,
+         Runnable action,
+         Executor e) {
+        if (other == null || action == null) throw new NullPointerException();
+        CompletableFuture<Void> dst = new CompletableFuture<Void>();
+        RunAfterEither d = null;
+        Object r;
+        if ((r = result) == null && (r = other.result) == null) {
+            d = new RunAfterEither(this, other, action, dst, e);
+            CompletionNode q = null, p = new CompletionNode(d);
+            while ((r = result) == null && (r = other.result) == null) {
+                if (q != null) {
+                    if (UNSAFE.compareAndSwapObject
+                        (other, COMPLETIONS, q.next = other.completions, q))
+                        break;
+                }
+                else if (UNSAFE.compareAndSwapObject
+                         (this, COMPLETIONS, p.next = completions, p))
+                    q = new CompletionNode(d);
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            Throwable ex;
+            if (r instanceof AltResult)
+                ex = ((AltResult)r).ex;
+            else
+                ex = null;
+            if (ex == null) {
+                try {
+                    if (e != null)
+                        e.execute(new AsyncRun(action, dst));
+                    else
+                        action.run();
+                } catch (Throwable rex) {
+                    ex = rex;
+                }
+            }
+            if (e == null || ex != null)
+                dst.internalComplete(null, ex);
+        }
+        helpPostComplete();
+        other.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a CompletableFuture that upon completion, has the same
+     * value as produced by the given function of the result of this
+     * CompletableFuture.
+     *
+     * <p>If this CompletableFuture completes exceptionally, then the
+     * returned CompletableFuture also does so, with a
+     * CompletionException holding this exception as its cause.
+     * Similarly, if the computed CompletableFuture completes
+     * exceptionally, then so does the returned CompletableFuture.
+     *
+     * @param fn the function returning a new CompletableFuture
+     * @return the CompletableFuture
+     */
+    public <U> CompletableFuture<U> thenCompose
+        (Function<? super T, CompletableFuture<U>> fn) {
+        return doThenCompose(fn, null);
+    }
+
+    /**
+     * Returns a CompletableFuture that upon completion, has the same
+     * value as that produced asynchronously using the {@link
+     * ForkJoinPool#commonPool()} by the given function of the result
+     * of this CompletableFuture.
+     *
+     * <p>If this CompletableFuture completes exceptionally, then the
+     * returned CompletableFuture also does so, with a
+     * CompletionException holding this exception as its cause.
+     * Similarly, if the computed CompletableFuture completes
+     * exceptionally, then so does the returned CompletableFuture.
+     *
+     * @param fn the function returning a new CompletableFuture
+     * @return the CompletableFuture
+     */
+    public <U> CompletableFuture<U> thenComposeAsync
+        (Function<? super T, CompletableFuture<U>> fn) {
+        return doThenCompose(fn, ForkJoinPool.commonPool());
+    }
+
+    /**
+     * Returns a CompletableFuture that upon completion, has the same
+     * value as that produced asynchronously using the given executor
+     * by the given function of this CompletableFuture.
+     *
+     * <p>If this CompletableFuture completes exceptionally, then the
+     * returned CompletableFuture also does so, with a
+     * CompletionException holding this exception as its cause.
+     * Similarly, if the computed CompletableFuture completes
+     * exceptionally, then so does the returned CompletableFuture.
+     *
+     * @param fn the function returning a new CompletableFuture
+     * @param executor the executor to use for asynchronous execution
+     * @return the CompletableFuture
+     */
+    public <U> CompletableFuture<U> thenComposeAsync
+        (Function<? super T, CompletableFuture<U>> fn,
+         Executor executor) {
+        if (executor == null) throw new NullPointerException();
+        return doThenCompose(fn, executor);
+    }
+
+    private <U> CompletableFuture<U> doThenCompose
+        (Function<? super T, CompletableFuture<U>> fn,
+         Executor e) {
+        if (fn == null) throw new NullPointerException();
+        CompletableFuture<U> dst = null;
+        ThenCompose<T,U> d = null;
+        Object r;
+        if ((r = result) == null) {
+            dst = new CompletableFuture<U>();
+            CompletionNode p = new CompletionNode
+                (d = new ThenCompose<T,U>(this, fn, dst, e));
+            while ((r = result) == null) {
+                if (UNSAFE.compareAndSwapObject
+                    (this, COMPLETIONS, p.next = completions, p))
+                    break;
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            if (ex == null) {
+                if (e != null) {
+                    if (dst == null)
+                        dst = new CompletableFuture<U>();
+                    e.execute(new AsyncCompose<T,U>(t, fn, dst));
+                }
+                else {
+                    try {
+                        if ((dst = fn.apply(t)) == null)
+                            ex = new NullPointerException();
+                    } catch (Throwable rex) {
+                        ex = rex;
+                    }
+                }
+            }
+            if (dst == null)
+                dst = new CompletableFuture<U>();
+            if (e == null || ex != null)
+                dst.internalComplete(null, ex);
+        }
+        helpPostComplete();
+        dst.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed when this
+     * CompletableFuture completes, with the result of the given
+     * function of the exception triggering this CompletableFuture's
+     * completion when it completes exceptionally; otherwise, if this
+     * CompletableFuture completes normally, then the returned
+     * CompletableFuture also completes normally with the same value.
+     *
+     * @param fn the function to use to compute the value of the
+     * returned CompletableFuture if this CompletableFuture completed
+     * exceptionally
+     * @return the new CompletableFuture
+     */
+    public CompletableFuture<T> exceptionally
+        (Function<Throwable, ? extends T> fn) {
+        if (fn == null) throw new NullPointerException();
+        CompletableFuture<T> dst = new CompletableFuture<T>();
+        ExceptionCompletion<T> d = null;
+        Object r;
+        if ((r = result) == null) {
+            CompletionNode p =
+                new CompletionNode(d = new ExceptionCompletion<T>(this, fn, dst));
+            while ((r = result) == null) {
+                if (UNSAFE.compareAndSwapObject(this, COMPLETIONS,
+                                                p.next = completions, p))
+                    break;
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            T t = null; Throwable ex, dx = null;
+            if (r instanceof AltResult) {
+                if ((ex = ((AltResult)r).ex) != null)  {
+                    try {
+                        t = fn.apply(ex);
+                    } catch (Throwable rex) {
+                        dx = rex;
+                    }
+                }
+            }
+            else {
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            dst.internalComplete(t, dx);
+        }
+        helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed when this
+     * CompletableFuture completes, with the result of the given
+     * function of the result and exception of this CompletableFuture's
+     * completion.  The given function is invoked with the result (or
+     * {@code null} if none) and the exception (or {@code null} if none)
+     * of this CompletableFuture when complete.
+     *
+     * @param fn the function to use to compute the value of the
+     * returned CompletableFuture
+     * @return the new CompletableFuture
+     */
+    public <U> CompletableFuture<U> handle
+        (BiFunction<? super T, Throwable, ? extends U> fn) {
+        if (fn == null) throw new NullPointerException();
+        CompletableFuture<U> dst = new CompletableFuture<U>();
+        HandleCompletion<T,U> d = null;
+        Object r;
+        if ((r = result) == null) {
+            CompletionNode p =
+                new CompletionNode(d = new HandleCompletion<T,U>(this, fn, dst));
+            while ((r = result) == null) {
+                if (UNSAFE.compareAndSwapObject(this, COMPLETIONS,
+                                                p.next = completions, p))
+                    break;
+            }
+        }
+        if (r != null && (d == null || d.compareAndSet(0, 1))) {
+            T t; Throwable ex;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                @SuppressWarnings("unchecked") T tr = (T) r;
+                t = tr;
+            }
+            U u; Throwable dx;
+            try {
+                u = fn.apply(t, ex);
+                dx = null;
+            } catch (Throwable rex) {
+                dx = rex;
+                u = null;
+            }
+            dst.internalComplete(u, dx);
+        }
+        helpPostComplete();
+        return dst;
+    }
+
+
+    /* ------------- Arbitrary-arity constructions -------------- */
+
+    /*
+     * The basic plan of attack is to recursively form binary
+     * completion trees of elements. This can be overkill for small
+     * sets, but scales nicely. The And/All vs Or/Any forms use the
+     * same idea, but details differ.
+     */
+
+    /**
+     * Returns a new CompletableFuture that is completed when all of
+     * the given CompletableFutures complete.  If any of the given
+     * CompletableFutures complete exceptionally, then the returned
+     * CompletableFuture also does so, with a CompletionException
+     * holding this exception as its cause.  Otherwise, the results,
+     * if any, of the given CompletableFutures are not reflected in
+     * the returned CompletableFuture, but may be obtained by
+     * inspecting them individually. If no CompletableFutures are
+     * provided, returns a CompletableFuture completed with the value
+     * {@code null}.
+     *
+     * <p>Among the applications of this method is to await completion
+     * of a set of independent CompletableFutures before continuing a
+     * program, as in: {@code CompletableFuture.allOf(c1, c2,
+     * c3).join();}.
+     *
+     * @param cfs the CompletableFutures
+     * @return a new CompletableFuture that is completed when all of the
+     * given CompletableFutures complete
+     * @throws NullPointerException if the array or any of its elements are
+     * {@code null}
+     */
+    public static CompletableFuture<Void> allOf(CompletableFuture<?>... cfs) {
+        int len = cfs.length; // Directly handle empty and singleton cases
+        if (len > 1)
+            return allTree(cfs, 0, len - 1);
+        else {
+            CompletableFuture<Void> dst = new CompletableFuture<Void>();
+            CompletableFuture<?> f;
+            if (len == 0)
+                dst.result = NIL;
+            else if ((f = cfs[0]) == null)
+                throw new NullPointerException();
+            else {
+                ThenPropagate d = null;
+                CompletionNode p = null;
+                Object r;
+                while ((r = f.result) == null) {
+                    if (d == null)
+                        d = new ThenPropagate(f, dst);
+                    else if (p == null)
+                        p = new CompletionNode(d);
+                    else if (UNSAFE.compareAndSwapObject
+                             (f, COMPLETIONS, p.next = f.completions, p))
+                        break;
+                }
+                if (r != null && (d == null || d.compareAndSet(0, 1)))
+                    dst.internalComplete(null, (r instanceof AltResult) ?
+                                         ((AltResult)r).ex : null);
+                f.helpPostComplete();
+            }
+            return dst;
+        }
+    }
+
+    /**
+     * Recursively constructs an And'ed tree of CompletableFutures.
+     * Called only when array known to have at least two elements.
+     */
+    private static CompletableFuture<Void> allTree(CompletableFuture<?>[] cfs,
+                                                   int lo, int hi) {
+        CompletableFuture<?> fst, snd;
+        int mid = (lo + hi) >>> 1;
+        if ((fst = (lo == mid   ? cfs[lo] : allTree(cfs, lo,    mid))) == null ||
+            (snd = (hi == mid+1 ? cfs[hi] : allTree(cfs, mid+1, hi))) == null)
+            throw new NullPointerException();
+        CompletableFuture<Void> dst = new CompletableFuture<Void>();
+        AndCompletion d = null;
+        CompletionNode p = null, q = null;
+        Object r = null, s = null;
+        while ((r = fst.result) == null || (s = snd.result) == null) {
+            if (d == null)
+                d = new AndCompletion(fst, snd, dst);
+            else if (p == null)
+                p = new CompletionNode(d);
+            else if (q == null) {
+                if (UNSAFE.compareAndSwapObject
+                    (fst, COMPLETIONS, p.next = fst.completions, p))
+                    q = new CompletionNode(d);
+            }
+            else if (UNSAFE.compareAndSwapObject
+                     (snd, COMPLETIONS, q.next = snd.completions, q))
+                break;
+        }
+        if ((r != null || (r = fst.result) != null) &&
+            (s != null || (s = snd.result) != null) &&
+            (d == null || d.compareAndSet(0, 1))) {
+            Throwable ex;
+            if (r instanceof AltResult)
+                ex = ((AltResult)r).ex;
+            else
+                ex = null;
+            if (ex == null && (s instanceof AltResult))
+                ex = ((AltResult)s).ex;
+            dst.internalComplete(null, ex);
+        }
+        fst.helpPostComplete();
+        snd.helpPostComplete();
+        return dst;
+    }
+
+    /**
+     * Returns a new CompletableFuture that is completed when any of
+     * the given CompletableFutures complete, with the same result.
+     * Otherwise, if it completed exceptionally, the returned
+     * CompletableFuture also does so, with a CompletionException
+     * holding this exception as its cause.  If no CompletableFutures
+     * are provided, returns an incomplete CompletableFuture.
+     *
+     * @param cfs the CompletableFutures
+     * @return a new CompletableFuture that is completed with the
+     * result or exception of any of the given CompletableFutures when
+     * one completes
+     * @throws NullPointerException if the array or any of its elements are
+     * {@code null}
+     */
+    public static CompletableFuture<Object> anyOf(CompletableFuture<?>... cfs) {
+        int len = cfs.length; // Same idea as allOf
+        if (len > 1)
+            return anyTree(cfs, 0, len - 1);
+        else {
+            CompletableFuture<Object> dst = new CompletableFuture<Object>();
+            CompletableFuture<?> f;
+            if (len == 0)
+                ; // skip
+            else if ((f = cfs[0]) == null)
+                throw new NullPointerException();
+            else {
+                ThenCopy<Object> d = null;
+                CompletionNode p = null;
+                Object r;
+                while ((r = f.result) == null) {
+                    if (d == null)
+                        d = new ThenCopy<Object>(f, dst);
+                    else if (p == null)
+                        p = new CompletionNode(d);
+                    else if (UNSAFE.compareAndSwapObject
+                             (f, COMPLETIONS, p.next = f.completions, p))
+                        break;
+                }
+                if (r != null && (d == null || d.compareAndSet(0, 1))) {
+                    Throwable ex; Object t;
+                    if (r instanceof AltResult) {
+                        ex = ((AltResult)r).ex;
+                        t = null;
+                    }
+                    else {
+                        ex = null;
+                        t = r;
+                    }
+                    dst.internalComplete(t, ex);
+                }
+                f.helpPostComplete();
+            }
+            return dst;
+        }
+    }
+
+    /**
+     * Recursively constructs an Or'ed tree of CompletableFutures.
+     */
+    private static CompletableFuture<Object> anyTree(CompletableFuture<?>[] cfs,
+                                                     int lo, int hi) {
+        CompletableFuture<?> fst, snd;
+        int mid = (lo + hi) >>> 1;
+        if ((fst = (lo == mid   ? cfs[lo] : anyTree(cfs, lo,    mid))) == null ||
+            (snd = (hi == mid+1 ? cfs[hi] : anyTree(cfs, mid+1, hi))) == null)
+            throw new NullPointerException();
+        CompletableFuture<Object> dst = new CompletableFuture<Object>();
+        OrCompletion d = null;
+        CompletionNode p = null, q = null;
+        Object r;
+        while ((r = fst.result) == null && (r = snd.result) == null) {
+            if (d == null)
+                d = new OrCompletion(fst, snd, dst);
+            else if (p == null)
+                p = new CompletionNode(d);
+            else if (q == null) {
+                if (UNSAFE.compareAndSwapObject
+                    (fst, COMPLETIONS, p.next = fst.completions, p))
+                    q = new CompletionNode(d);
+            }
+            else if (UNSAFE.compareAndSwapObject
+                     (snd, COMPLETIONS, q.next = snd.completions, q))
+                break;
+        }
+        if ((r != null || (r = fst.result) != null ||
+             (r = snd.result) != null) &&
+            (d == null || d.compareAndSet(0, 1))) {
+            Throwable ex; Object t;
+            if (r instanceof AltResult) {
+                ex = ((AltResult)r).ex;
+                t = null;
+            }
+            else {
+                ex = null;
+                t = r;
+            }
+            dst.internalComplete(t, ex);
+        }
+        fst.helpPostComplete();
+        snd.helpPostComplete();
+        return dst;
+    }
+
+    /* ------------- Control and status methods -------------- */
+
+    /**
+     * If not already completed, completes this CompletableFuture with
+     * a {@link CancellationException}. Dependent CompletableFutures
+     * that have not already completed will also complete
+     * exceptionally, with a {@link CompletionException} caused by
+     * this {@code CancellationException}.
+     *
+     * @param mayInterruptIfRunning this value has no effect in this
+     * implementation because interrupts are not used to control
+     * processing.
+     *
+     * @return {@code true} if this task is now cancelled
+     */
+    public boolean cancel(boolean mayInterruptIfRunning) {
+        boolean cancelled = (result == null) &&
+            UNSAFE.compareAndSwapObject
+            (this, RESULT, null, new AltResult(new CancellationException()));
+        postComplete();
+        return cancelled || isCancelled();
+    }
+
+    /**
+     * Returns {@code true} if this CompletableFuture was cancelled
+     * before it completed normally.
+     *
+     * @return {@code true} if this CompletableFuture was cancelled
+     * before it completed normally
+     */
+    public boolean isCancelled() {
+        Object r;
+        return ((r = result) instanceof AltResult) &&
+            (((AltResult)r).ex instanceof CancellationException);
+    }
+
+    /**
+     * Forcibly sets or resets the value subsequently returned by
+     * method {@link #get()} and related methods, whether or not
+     * already completed. This method is designed for use only in
+     * error recovery actions, and even in such situations may result
+     * in ongoing dependent completions using established versus
+     * overwritten outcomes.
+     *
+     * @param value the completion value
+     */
+    public void obtrudeValue(T value) {
+        result = (value == null) ? NIL : value;
+        postComplete();
+    }
+
+    /**
+     * Forcibly causes subsequent invocations of method {@link #get()}
+     * and related methods to throw the given exception, whether or
+     * not already completed. This method is designed for use only in
+     * recovery actions, and even in such situations may result in
+     * ongoing dependent completions using established versus
+     * overwritten outcomes.
+     *
+     * @param ex the exception
+     */
+    public void obtrudeException(Throwable ex) {
+        if (ex == null) throw new NullPointerException();
+        result = new AltResult(ex);
+        postComplete();
+    }
+
+    /**
+     * Returns the estimated number of CompletableFutures whose
+     * completions are awaiting completion of this CompletableFuture.
+     * This method is designed for use in monitoring system state, not
+     * for synchronization control.
+     *
+     * @return the number of dependent CompletableFutures
+     */
+    public int getNumberOfDependents() {
+        int count = 0;
+        for (CompletionNode p = completions; p != null; p = p.next)
+            ++count;
+        return count;
+    }
+
+    /**
+     * Returns a string identifying this CompletableFuture, as well as
+     * its completion state.  The state, in brackets, contains the
+     * String {@code "Completed Normally"} or the String {@code
+     * "Completed Exceptionally"}, or the String {@code "Not
+     * completed"} followed by the number of CompletableFutures
+     * dependent upon its completion, if any.
+     *
+     * @return a string identifying this CompletableFuture, as well as its state
+     */
+    public String toString() {
+        Object r = result;
+        int count;
+        return super.toString() +
+            ((r == null) ?
+             (((count = getNumberOfDependents()) == 0) ?
+              "[Not completed]" :
+              "[Not completed, " + count + " dependents]") :
+             (((r instanceof AltResult) && ((AltResult)r).ex != null) ?
+              "[Completed exceptionally]" :
+              "[Completed normally]"));
+    }
+
+    // Unsafe mechanics
+    private static final sun.misc.Unsafe UNSAFE;
+    private static final long RESULT;
+    private static final long WAITERS;
+    private static final long COMPLETIONS;
+    static {
+        try {
+            UNSAFE = sun.misc.Unsafe.getUnsafe();
+            Class<?> k = CompletableFuture.class;
+            RESULT = UNSAFE.objectFieldOffset
+                (k.getDeclaredField("result"));
+            WAITERS = UNSAFE.objectFieldOffset
+                (k.getDeclaredField("waiters"));
+            COMPLETIONS = UNSAFE.objectFieldOffset
+                (k.getDeclaredField("completions"));
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+}
diff --git a/jdk/src/share/classes/java/util/concurrent/CompletionException.java b/jdk/src/share/classes/java/util/concurrent/CompletionException.java
new file mode 100644
index 0000000..2a3cfc5
--- /dev/null
+++ b/jdk/src/share/classes/java/util/concurrent/CompletionException.java
@@ -0,0 +1,90 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+package java.util.concurrent;
+
+/**
+ * Exception thrown when an error or other exception is encountered
+ * in the course of completing a result or task.
+ *
+ * @since 1.8
+ * @author Doug Lea
+ */
+public class CompletionException extends RuntimeException {
+    private static final long serialVersionUID = 7830266012832686185L;
+
+    /**
+     * Constructs a {@code CompletionException} with no detail message.
+     * The cause is not initialized, and may subsequently be
+     * initialized by a call to {@link #initCause(Throwable) initCause}.
+     */
+    protected CompletionException() { }
+
+    /**
+     * Constructs a {@code CompletionException} with the specified detail
+     * message. The cause is not initialized, and may subsequently be
+     * initialized by a call to {@link #initCause(Throwable) initCause}.
+     *
+     * @param message the detail message
+     */
+    protected CompletionException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a {@code CompletionException} with the specified detail
+     * message and cause.
+     *
+     * @param  message the detail message
+     * @param  cause the cause (which is saved for later retrieval by the
+     *         {@link #getCause()} method)
+     */
+    public CompletionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructs a {@code CompletionException} with the specified cause.
+     * The detail message is set to {@code (cause == null ? null :
+     * cause.toString())} (which typically contains the class and
+     * detail message of {@code cause}).
+     *
+     * @param  cause the cause (which is saved for later retrieval by the
+     *         {@link #getCause()} method)
+     */
+    public CompletionException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/jdk/src/share/classes/java/util/function/DoublePredicate.java b/jdk/src/share/classes/java/util/function/DoublePredicate.java
index e132f9b..48f45048 100644
--- a/jdk/src/share/classes/java/util/function/DoublePredicate.java
+++ b/jdk/src/share/classes/java/util/function/DoublePredicate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
diff --git a/jdk/src/share/classes/java/util/function/IntPredicate.java b/jdk/src/share/classes/java/util/function/IntPredicate.java
index 17cc49c..4351c75 100644
--- a/jdk/src/share/classes/java/util/function/IntPredicate.java
+++ b/jdk/src/share/classes/java/util/function/IntPredicate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
diff --git a/jdk/src/share/classes/java/util/function/LongPredicate.java b/jdk/src/share/classes/java/util/function/LongPredicate.java
index ca542a4..65f3e69 100644
--- a/jdk/src/share/classes/java/util/function/LongPredicate.java
+++ b/jdk/src/share/classes/java/util/function/LongPredicate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
diff --git a/jdk/src/share/classes/java/util/function/ObjIntConsumer.java b/jdk/src/share/classes/java/util/function/ObjIntConsumer.java
index fa63af5..33f9001 100644
--- a/jdk/src/share/classes/java/util/function/ObjIntConsumer.java
+++ b/jdk/src/share/classes/java/util/function/ObjIntConsumer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java b/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java
index 8826e12..a4a03e6 100644
--- a/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java
+++ b/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java
index a207d1f..736e0c3 100644
--- a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java
+++ b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java
@@ -106,6 +106,11 @@
     }
 
     @Override
+    public int getLevelValue(Object level) {
+        return ((Level) level).intValue();
+    }
+
+    @Override
     public String getProperty(String key) {
         return LogManager.getLogManager().getProperty(key);
     }
diff --git a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
index 91b28a6..0c98082 100644
--- a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java
@@ -43,6 +43,20 @@
 public
 class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
 
+    /**
+     * Whether to use ZIP64 for zip files with more than 64k entries.
+     * Until ZIP64 support in zip implementations is ubiquitous, this
+     * system property allows the creation of zip files which can be
+     * read by legacy zip implementations which tolerate "incorrect"
+     * total entry count fields, such as the ones in jdk6, and even
+     * some in jdk7.
+     */
+    private static final boolean inhibitZip64 =
+        Boolean.parseBoolean(
+            java.security.AccessController.doPrivileged(
+                new sun.security.action.GetPropertyAction(
+                    "jdk.util.zip.inhibitZip64", "false")));
+
     private static class XEntry {
         public final ZipEntry entry;
         public final long offset;
@@ -534,8 +548,10 @@
         }
         int count = xentries.size();
         if (count >= ZIP64_MAGICCOUNT) {
-            count = ZIP64_MAGICCOUNT;
-            hasZip64 = true;
+            hasZip64 |= !inhibitZip64;
+            if (hasZip64) {
+                count = ZIP64_MAGICCOUNT;
+            }
         }
         if (hasZip64) {
             long off64 = written;
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java
index 6020e34..5ea5fee 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java
@@ -508,7 +508,7 @@
      *
      * @param length the length, in bytes, to which the <code>CLOB</code>
      *        value should be truncated
-     * @throws SerialLException if there is an error accessing the
+     * @throws SerialException if there is an error accessing the
      *        <code>CLOB</code> value;
      * if the {@code free} method had been previously called on this object
      */
diff --git a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java
index 0ae1ec7..aacd8c0 100644
--- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java
+++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -34,7 +34,6 @@
 import java.util.Set;
 import java.awt.AWTKeyStroke;
 import java.applet.Applet;
-import javax.tools.annotation.GenerateNativeHeader;
 import sun.applet.AppletPanel;
 
 /**
@@ -54,8 +53,6 @@
  *
  * @author      Thomas Ball
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class EmbeddedFrame extends Frame
                           implements KeyEventDispatcher, PropertyChangeListener {
 
diff --git a/jdk/src/share/classes/sun/awt/SunHints.java b/jdk/src/share/classes/sun/awt/SunHints.java
index 1d8cb54..3e0dff5 100644
--- a/jdk/src/share/classes/sun/awt/SunHints.java
+++ b/jdk/src/share/classes/sun/awt/SunHints.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -26,7 +26,7 @@
 package sun.awt;
 
 import java.awt.RenderingHints;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * This class contains rendering hints that can be used by the
@@ -34,8 +34,6 @@
  * {@link java.awt.image.BufferedImageOp} and
  * {@link java.awt.image.Raster}.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class SunHints {
     /**
      * Defines the type of all keys used to control various
@@ -180,86 +178,86 @@
     /**
      * Rendering hint key and values
      */
-    public static final int INTKEY_RENDERING = 0;
-    public static final int INTVAL_RENDER_DEFAULT = 0;
-    public static final int INTVAL_RENDER_SPEED = 1;
-    public static final int INTVAL_RENDER_QUALITY = 2;
+    @Native public static final int INTKEY_RENDERING = 0;
+    @Native public static final int INTVAL_RENDER_DEFAULT = 0;
+    @Native public static final int INTVAL_RENDER_SPEED = 1;
+    @Native public static final int INTVAL_RENDER_QUALITY = 2;
 
     /**
      * Antialiasing hint key and values
      */
-    public static final int INTKEY_ANTIALIASING = 1;
-    public static final int INTVAL_ANTIALIAS_DEFAULT = 0;
-    public static final int INTVAL_ANTIALIAS_OFF = 1;
-    public static final int INTVAL_ANTIALIAS_ON = 2;
+    @Native public static final int INTKEY_ANTIALIASING = 1;
+    @Native public static final int INTVAL_ANTIALIAS_DEFAULT = 0;
+    @Native public static final int INTVAL_ANTIALIAS_OFF = 1;
+    @Native public static final int INTVAL_ANTIALIAS_ON = 2;
 
     /**
      * Text antialiasing hint key and values
      */
-    public static final int INTKEY_TEXT_ANTIALIASING = 2;
-    public static final int INTVAL_TEXT_ANTIALIAS_DEFAULT = 0;
-    public static final int INTVAL_TEXT_ANTIALIAS_OFF = 1;
-    public static final int INTVAL_TEXT_ANTIALIAS_ON = 2;
-    public static final int INTVAL_TEXT_ANTIALIAS_GASP = 3;
-    public static final int INTVAL_TEXT_ANTIALIAS_LCD_HRGB = 4;
-    public static final int INTVAL_TEXT_ANTIALIAS_LCD_HBGR = 5;
-    public static final int INTVAL_TEXT_ANTIALIAS_LCD_VRGB = 6;
-    public static final int INTVAL_TEXT_ANTIALIAS_LCD_VBGR = 7;
+    @Native public static final int INTKEY_TEXT_ANTIALIASING = 2;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_DEFAULT = 0;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_OFF = 1;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_ON = 2;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_GASP = 3;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_HRGB = 4;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_HBGR = 5;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_VRGB = 6;
+    @Native public static final int INTVAL_TEXT_ANTIALIAS_LCD_VBGR = 7;
 
     /**
      * Font fractional metrics hint key and values
      */
-    public static final int INTKEY_FRACTIONALMETRICS = 3;
-    public static final int INTVAL_FRACTIONALMETRICS_DEFAULT = 0;
-    public static final int INTVAL_FRACTIONALMETRICS_OFF = 1;
-    public static final int INTVAL_FRACTIONALMETRICS_ON = 2;
+    @Native public static final int INTKEY_FRACTIONALMETRICS = 3;
+    @Native public static final int INTVAL_FRACTIONALMETRICS_DEFAULT = 0;
+    @Native public static final int INTVAL_FRACTIONALMETRICS_OFF = 1;
+    @Native public static final int INTVAL_FRACTIONALMETRICS_ON = 2;
 
     /**
      * Dithering hint key and values
      */
-    public static final int INTKEY_DITHERING = 4;
-    public static final int INTVAL_DITHER_DEFAULT = 0;
-    public static final int INTVAL_DITHER_DISABLE = 1;
-    public static final int INTVAL_DITHER_ENABLE = 2;
+    @Native public static final int INTKEY_DITHERING = 4;
+    @Native public static final int INTVAL_DITHER_DEFAULT = 0;
+    @Native public static final int INTVAL_DITHER_DISABLE = 1;
+    @Native public static final int INTVAL_DITHER_ENABLE = 2;
 
     /**
      * Interpolation hint key and values
      */
-    public static final int INTKEY_INTERPOLATION = 5;
-    public static final int INTVAL_INTERPOLATION_NEAREST_NEIGHBOR = 0;
-    public static final int INTVAL_INTERPOLATION_BILINEAR = 1;
-    public static final int INTVAL_INTERPOLATION_BICUBIC = 2;
+    @Native public static final int INTKEY_INTERPOLATION = 5;
+    @Native public static final int INTVAL_INTERPOLATION_NEAREST_NEIGHBOR = 0;
+    @Native public static final int INTVAL_INTERPOLATION_BILINEAR = 1;
+    @Native public static final int INTVAL_INTERPOLATION_BICUBIC = 2;
 
     /**
      * Alpha interpolation hint key and values
      */
-    public static final int INTKEY_ALPHA_INTERPOLATION = 6;
-    public static final int INTVAL_ALPHA_INTERPOLATION_DEFAULT = 0;
-    public static final int INTVAL_ALPHA_INTERPOLATION_SPEED = 1;
-    public static final int INTVAL_ALPHA_INTERPOLATION_QUALITY = 2;
+    @Native public static final int INTKEY_ALPHA_INTERPOLATION = 6;
+    @Native public static final int INTVAL_ALPHA_INTERPOLATION_DEFAULT = 0;
+    @Native public static final int INTVAL_ALPHA_INTERPOLATION_SPEED = 1;
+    @Native public static final int INTVAL_ALPHA_INTERPOLATION_QUALITY = 2;
 
     /**
      * Color rendering hint key and values
      */
-    public static final int INTKEY_COLOR_RENDERING = 7;
-    public static final int INTVAL_COLOR_RENDER_DEFAULT = 0;
-    public static final int INTVAL_COLOR_RENDER_SPEED = 1;
-    public static final int INTVAL_COLOR_RENDER_QUALITY = 2;
+    @Native public static final int INTKEY_COLOR_RENDERING = 7;
+    @Native public static final int INTVAL_COLOR_RENDER_DEFAULT = 0;
+    @Native public static final int INTVAL_COLOR_RENDER_SPEED = 1;
+    @Native public static final int INTVAL_COLOR_RENDER_QUALITY = 2;
 
     /**
      * Stroke normalization control hint key and values
      */
-    public static final int INTKEY_STROKE_CONTROL = 8;
-    public static final int INTVAL_STROKE_DEFAULT = 0;
-    public static final int INTVAL_STROKE_NORMALIZE = 1;
-    public static final int INTVAL_STROKE_PURE = 2;
+    @Native public static final int INTKEY_STROKE_CONTROL = 8;
+    @Native public static final int INTVAL_STROKE_DEFAULT = 0;
+    @Native public static final int INTVAL_STROKE_NORMALIZE = 1;
+    @Native public static final int INTVAL_STROKE_PURE = 2;
 
     /**
      * LCD text contrast control hint key.
      * Value is "100" to make discontiguous with the others which
      * are all enumerative and are of a different class.
      */
-    public static final int INTKEY_AATEXT_LCD_CONTRAST = 100;
+    @Native public static final int INTKEY_AATEXT_LCD_CONTRAST = 100;
 
     /**
      * Rendering hint key and value objects
diff --git a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java
index 7465d52..2c364e4 100644
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java
@@ -171,12 +171,12 @@
      * Lazy initialization of Standard Encodings.
      */
     private static class StandardEncodingsHolder {
-        private static final SortedSet standardEncodings = load();
+        private static final SortedSet<String> standardEncodings = load();
 
-        private static SortedSet load() {
+        private static SortedSet<String> load() {
             final Comparator comparator =
                     new CharsetComparator(IndexedComparator.SELECT_WORST);
-            final SortedSet tempSet = new TreeSet(comparator);
+            final SortedSet<String> tempSet = new TreeSet<String>(comparator);
             tempSet.add("US-ASCII");
             tempSet.add("ISO-8859-1");
             tempSet.add("UTF-8");
@@ -523,8 +523,8 @@
      * So as to avoid loading all available character converters, optional,
      * non-standard, character sets are not included.
      */
-    public static Iterator standardEncodings() {
-        return StandardEncodingsHolder.standardEncodings.iterator();
+    public static Set <String> standardEncodings() {
+        return StandardEncodingsHolder.standardEncodings;
     }
 
     /**
@@ -1068,17 +1068,10 @@
      *
      * Native to Java string conversion
      */
-    private String translateBytesOrStreamToString(InputStream str,  byte[] bytes,
-                                                    long format,
-                                                    Transferable localeTransferable)
+    private String translateBytesToString(byte[] bytes, long format,
+                                          Transferable localeTransferable)
             throws IOException
     {
-        // A String holds all of its data in memory at one time, so
-        // we can't avoid reading the entire InputStream at this point.
-        if (bytes == null) {
-            bytes = inputStreamToByteArray(str);
-        }
-        str.close();
 
         Long lFormat = Long.valueOf(format);
         String charset = getBestCharsetForTextFormat(lFormat, localeTransferable);
@@ -1221,13 +1214,13 @@
                     ("cannot transfer non-text data as Reader");
             }
 
-            Reader r = (Reader)obj;
             StringBuffer buf = new StringBuffer();
-            int c;
-            while ((c = r.read()) != -1) {
-                buf.append((char)c);
+            try (Reader r = (Reader)obj) {
+                int c;
+                while ((c = r.read()) != -1) {
+                    buf.append((char)c);
+                }
             }
-            r.close();
 
             return translateTransferableString(
                 buf.toString(),
@@ -1309,7 +1302,7 @@
             return bytes;
         }
 
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        byte[] theByteArray = null;
 
         // Target data is a file list. Source data must be a
         // java.util.List which contains java.io.File or String instances.
@@ -1324,8 +1317,9 @@
 
             final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
 
-            bos = convertFileListToBytes(fileList);
-
+            try (ByteArrayOutputStream bos = convertFileListToBytes(fileList)) {
+                theByteArray = bos.toByteArray();
+            }
 
         // Target data is a URI list. Source data must be a
         // java.util.List which contains java.io.File or String instances.
@@ -1360,57 +1354,72 @@
               }
 
             byte[] eoln = "\r\n".getBytes(targetCharset);
-            for (int i = 0; i < uriList.size(); i++) {
-                byte[] bytes = uriList.get(i).getBytes(targetCharset);
-                bos.write(bytes, 0, bytes.length);
-                bos.write(eoln, 0, eoln.length);
+
+            try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
+                for (int i = 0; i < uriList.size(); i++) {
+                    byte[] bytes = uriList.get(i).getBytes(targetCharset);
+                    bos.write(bytes, 0, bytes.length);
+                    bos.write(eoln, 0, eoln.length);
+                }
+                theByteArray = bos.toByteArray();
             }
 
         // Source data is an InputStream. For arbitrary flavors, just grab the
         // bytes and dump them into a byte array. For text flavors, decode back
         // to a String and recur to reencode according to the requested format.
         } else if (flavor.isRepresentationClassInputStream()) {
-            InputStream is = (InputStream)obj;
-            boolean eof = false;
-            int avail = is.available();
-            byte[] tmp = new byte[avail > 8192 ? avail : 8192];
-            do {
-                int ret;
-                if (!(eof = (ret = is.read(tmp, 0, tmp.length)) == -1)) {
-                    bos.write(tmp, 0, ret);
+            try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
+                try (InputStream is = (InputStream)obj) {
+                    boolean eof = false;
+                    int avail = is.available();
+                    byte[] tmp = new byte[avail > 8192 ? avail : 8192];
+                    do {
+                        int aValue;
+                        if (!(eof = (aValue = is.read(tmp, 0, tmp.length)) == -1)) {
+                            bos.write(tmp, 0, aValue);
+                        }
+                    } while (!eof);
                 }
-            } while (!eof);
-            is.close();
 
-            if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
-                byte[] bytes = bos.toByteArray();
-                bos.close();
-                String sourceEncoding = DataTransferer.getTextCharset(flavor);
-                return translateTransferableString(
-                    new String(bytes, sourceEncoding),
-                    format);
+                if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
+                    byte[] bytes = bos.toByteArray();
+                    String sourceEncoding = DataTransferer.getTextCharset(flavor);
+                    return translateTransferableString(
+                               new String(bytes, sourceEncoding),
+                               format);
+                }
+                theByteArray = bos.toByteArray();
             }
 
+
+
         // Source data is an RMI object
         } else if (flavor.isRepresentationClassRemote()) {
-            Object mo = RMI.newMarshalledObject(obj);
-            ObjectOutputStream oos = new ObjectOutputStream(bos);
-            oos.writeObject(mo);
-            oos.close();
 
-        // Source data is Serializable
+            Object mo = RMI.newMarshalledObject(obj);
+            theByteArray = convertObjectToBytes(mo);
+
+            // Source data is Serializable
         } else if (flavor.isRepresentationClassSerializable()) {
-            ObjectOutputStream oos = new ObjectOutputStream(bos);
-            oos.writeObject(obj);
-            oos.close();
+
+            theByteArray = convertObjectToBytes(obj);
 
         } else {
             throw new IOException("data translation failed");
         }
 
-        byte[] ret = bos.toByteArray();
-        bos.close();
-        return ret;
+
+
+        return theByteArray;
+    }
+
+    private static byte[] convertObjectToBytes(Object object) throws IOException {
+        try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+             ObjectOutputStream oos = new ObjectOutputStream(bos))
+        {
+            oos.writeObject(object);
+            return bos.toByteArray();
+        }
     }
 
     protected abstract ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) throws IOException;
@@ -1565,38 +1574,8 @@
                                  long format, Transferable localeTransferable)
         throws IOException
     {
-        return translateBytesOrStream(null, bytes, flavor, format,
-                                      localeTransferable);
-    }
 
-    public Object translateStream(InputStream str, DataFlavor flavor,
-                                  long format, Transferable localeTransferable)
-        throws IOException
-    {
-        return translateBytesOrStream(str, null, flavor, format,
-                                      localeTransferable);
-    }
-
-
-    /**
-     * Primary translation function for translating either a byte array or
-     * an InputStream into an Object, given a source format and a target
-     * DataFlavor.
-     *
-     * One of str/bytes is non-null; the other is null.
-     * The conversion from byte[] to InputStream is cheap, so do that
-     * immediately if necessary. The opposite conversion is expensive,
-     * so avoid it if possible.
-     */
-    protected Object translateBytesOrStream(InputStream str, byte[] bytes,
-                                            DataFlavor flavor, long format,
-                                            Transferable localeTransferable)
-        throws IOException
-    {
-
-        if (str == null) {
-            str = new ByteArrayInputStream(bytes);
-        }
+        Object theObject = null;
 
         // Source data is a file list. Use the dragQueryFile native function to
         // do most of the decoding. Then wrap File objects around the String
@@ -1605,12 +1584,8 @@
             if (!DataFlavor.javaFileListFlavor.equals(flavor)) {
                 throw new IOException("data translation failed");
             }
-            if (bytes == null) {
-                bytes = inputStreamToByteArray(str);
-            }
             String[] filenames = dragQueryFile(bytes);
             if (filenames == null) {
-                str.close();
                 return null;
             }
 
@@ -1619,178 +1594,203 @@
             for (int i = 0; i < filenames.length; i++) {
                 files[i] = new File(filenames[i]);
             }
-            str.close();
 
             // Turn the list of Files into a List and return
-            return Arrays.asList(files);
+            theObject = Arrays.asList(files);
 
-        // Source data is a URI list. Convert to DataFlavor.javaFileListFlavor
-        // where possible.
-        } else if (isURIListFormat(format) && DataFlavor.javaFileListFlavor.equals(flavor)) {
-            try {
-                URI uris[] = dragQueryURIs(str, bytes, format, localeTransferable);
-                if (uris == null) {
-                    return null;
-                }
-                ArrayList files = new ArrayList();
-                for (URI uri : uris) {
-                    try {
-                        files.add(new File(uri));
-                    } catch (IllegalArgumentException illegalArg) {
-                        // When converting from URIs to less generic files,
-                        // common practice (Wine, SWT) seems to be to
-                        // silently drop the URIs that aren't local files.
-                    }
-                }
-                return files;
-            } finally {
-                str.close();
-            }
-
-        // Target data is a String. Strip terminating NUL bytes. Decode bytes
-        // into characters. Search-and-replace EOLN.
+            // Target data is a String. Strip terminating NUL bytes. Decode bytes
+            // into characters. Search-and-replace EOLN.
         } else if (String.class.equals(flavor.getRepresentationClass()) &&
-                   isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
+                       isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
 
-            return translateBytesOrStreamToString(
-                str, bytes,
-                format, localeTransferable);
+            theObject = translateBytesToString(bytes, format, localeTransferable);
 
-        // Special hack to maintain backwards-compatibility with the brokenness
-        // of StringSelection. Return a StringReader instead of an InputStream.
-        // Recur to obtain String and encapsulate.
-        } else if (DataFlavor.plainTextFlavor.equals(flavor)) {
-            return new StringReader(translateBytesOrStreamToString(
-                        str, bytes,
-                        format, localeTransferable));
-
-        // Target data is an InputStream. For arbitrary flavors, just return
-        // the raw bytes. For text flavors, decode to strip terminators and
-        // search-and-replace EOLN, then reencode according to the requested
-        // flavor.
-        } else if (flavor.isRepresentationClassInputStream()) {
-            return translateBytesOrStreamToInputStream(str, flavor, format,
-                                                       localeTransferable);
-
-        // Target data is a Reader. Obtain data in InputStream format, encoded
-        // as "Unicode" (utf-16be). Then use an InputStreamReader to decode
-        // back to chars on demand.
+            // Target data is a Reader. Obtain data in InputStream format, encoded
+            // as "Unicode" (utf-16be). Then use an InputStreamReader to decode
+            // back to chars on demand.
         } else if (flavor.isRepresentationClassReader()) {
-            if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
-                throw new IOException
-                    ("cannot transfer non-text data as Reader");
+            try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
+                theObject = translateStream(bais,
+                        flavor, format, localeTransferable);
             }
-
-            InputStream is = (InputStream)
-                translateBytesOrStreamToInputStream
-                    (str, DataFlavor.plainTextFlavor, format,
-                     localeTransferable);
-            String unicode =
-                DataTransferer.getTextCharset(DataFlavor.plainTextFlavor);
-            Reader reader = new InputStreamReader(is, unicode);
-
-            return constructFlavoredObject(reader, flavor, Reader.class);
-
-        // Target data is a CharBuffer. Recur to obtain String and wrap.
+            // Target data is a CharBuffer. Recur to obtain String and wrap.
         } else if (flavor.isRepresentationClassCharBuffer()) {
             if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
                 throw new IOException
-                    ("cannot transfer non-text data as CharBuffer");
+                          ("cannot transfer non-text data as CharBuffer");
             }
 
-            CharBuffer buffer = CharBuffer.wrap(translateBytesOrStreamToString(
-                str, bytes,
-                format, localeTransferable));
+            CharBuffer buffer = CharBuffer.wrap(
+                translateBytesToString(bytes,format, localeTransferable));
 
-            return constructFlavoredObject(buffer, flavor, CharBuffer.class);
+            theObject = constructFlavoredObject(buffer, flavor, CharBuffer.class);
 
-        // Target data is a char array. Recur to obtain String and convert to
-        // char array.
+            // Target data is a char array. Recur to obtain String and convert to
+            // char array.
         } else if (charArrayClass.equals(flavor.getRepresentationClass())) {
             if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
                 throw new IOException
-                    ("cannot transfer non-text data as char array");
+                          ("cannot transfer non-text data as char array");
             }
 
-            return translateBytesOrStreamToString(
-                    str, bytes,
-                    format, localeTransferable).toCharArray();
+            theObject = translateBytesToString(
+                bytes, format, localeTransferable).toCharArray();
 
-        // Target data is a ByteBuffer. For arbitrary flavors, just return
-        // the raw bytes. For text flavors, convert to a String to strip
-        // terminators and search-and-replace EOLN, then reencode according to
-        // the requested flavor.
+            // Target data is a ByteBuffer. For arbitrary flavors, just return
+            // the raw bytes. For text flavors, convert to a String to strip
+            // terminators and search-and-replace EOLN, then reencode according to
+            // the requested flavor.
         } else if (flavor.isRepresentationClassByteBuffer()) {
             if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
-                bytes = translateBytesOrStreamToString(
-                    str, bytes,
-                    format, localeTransferable
-                ).getBytes(
-                    DataTransferer.getTextCharset(flavor)
-                );
-            } else {
-                if (bytes == null) {
-                    bytes = inputStreamToByteArray(str);
-                }
+                bytes = translateBytesToString(
+                    bytes, format, localeTransferable).getBytes(
+                        DataTransferer.getTextCharset(flavor)
+                    );
             }
 
             ByteBuffer buffer = ByteBuffer.wrap(bytes);
-            return constructFlavoredObject(buffer, flavor, ByteBuffer.class);
+            theObject = constructFlavoredObject(buffer, flavor, ByteBuffer.class);
 
-        // Target data is a byte array. For arbitrary flavors, just return
-        // the raw bytes. For text flavors, convert to a String to strip
-        // terminators and search-and-replace EOLN, then reencode according to
-        // the requested flavor.
+            // Target data is a byte array. For arbitrary flavors, just return
+            // the raw bytes. For text flavors, convert to a String to strip
+            // terminators and search-and-replace EOLN, then reencode according to
+            // the requested flavor.
         } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
             if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
-                return translateBytesOrStreamToString(
-                    str, bytes,
-                    format, localeTransferable
-                ).getBytes(
-                    DataTransferer.getTextCharset(flavor)
-                );
+                theObject = translateBytesToString(
+                    bytes, format, localeTransferable
+                ).getBytes(DataTransferer.getTextCharset(flavor));
             } else {
-                return (bytes != null) ? bytes : inputStreamToByteArray(str);
+                theObject = bytes;
             }
 
-        // Target data is an RMI object
-        } else if (flavor.isRepresentationClassRemote()) {
-            try {
-                byte[] ba = inputStreamToByteArray(str);
-                ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(ba));
-                Object ret = RMI.getMarshalledObject(ois.readObject());
-                ois.close();
-                str.close();
-                return ret;
-            } catch (Exception e) {
-                throw new IOException(e.getMessage());
+            // Target data is an InputStream. For arbitrary flavors, just return
+            // the raw bytes. For text flavors, decode to strip terminators and
+            // search-and-replace EOLN, then reencode according to the requested
+            // flavor.
+        } else if (flavor.isRepresentationClassInputStream()) {
+
+            try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
+                theObject = translateStream(bais, flavor, format, localeTransferable);
             }
 
-        // Target data is Serializable
+            // Target data is Serializable
         } else if (flavor.isRepresentationClassSerializable()) {
-            try {
-                byte[] ba = inputStreamToByteArray(str);
-                ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(ba));
-                Object ret = ois.readObject();
-                ois.close();
-                str.close();
-                return ret;
-            } catch (Exception e) {
-                throw new IOException(e.getMessage());
+
+            try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
+                theObject = translateStream(bais, flavor, format, localeTransferable);
             }
 
-        // Target data is Image
+            // Target data is Image
         } else if (DataFlavor.imageFlavor.equals(flavor)) {
             if (!isImageFormat(format)) {
                 throw new IOException("data translation failed");
             }
 
-            Image image = platformImageBytesOrStreamToImage(str, bytes, format);
-            str.close();
-            return image;
+            theObject = platformImageBytesToImage(bytes, format);
         }
 
-        throw new IOException("data translation failed");
+        if (theObject == null) {
+            throw new IOException("data translation failed");
+        }
+
+        return theObject;
+
+    }
+
+    /**
+     * Primary translation function for translating
+     * an InputStream into an Object, given a source format and a target
+     * DataFlavor.
+     */
+    public Object translateStream(InputStream str, DataFlavor flavor,
+                                  long format, Transferable localeTransferable)
+        throws IOException
+    {
+
+        Object theObject = null;
+        // Source data is a URI list. Convert to DataFlavor.javaFileListFlavor
+        // where possible.
+        if (isURIListFormat(format)
+                && DataFlavor.javaFileListFlavor.equals(flavor))
+        {
+
+            URI uris[] = dragQueryURIs(str, format, localeTransferable);
+            if (uris == null) {
+                return null;
+            }
+            ArrayList files = new ArrayList();
+            for (URI uri : uris) {
+                try {
+                    files.add(new File(uri));
+                } catch (IllegalArgumentException illegalArg) {
+                    // When converting from URIs to less generic files,
+                    // common practice (Wine, SWT) seems to be to
+                    // silently drop the URIs that aren't local files.
+                }
+            }
+            theObject = files;
+
+            // Special hack to maintain backwards-compatibility with the brokenness
+            // of StringSelection. Return a StringReader instead of an InputStream.
+            // Recur to obtain String and encapsulate.
+        } else if (DataFlavor.plainTextFlavor.equals(flavor)) {
+            theObject = new StringReader(translateBytesToString(
+                inputStreamToByteArray(str),
+                format, localeTransferable));
+
+            // Target data is an InputStream. For arbitrary flavors, just return
+            // the raw bytes. For text flavors, decode to strip terminators and
+            // search-and-replace EOLN, then reencode according to the requested
+            // flavor.
+        } else if (flavor.isRepresentationClassInputStream()) {
+            theObject = translateStreamToInputStream(str, flavor, format,
+                                                               localeTransferable);
+
+            // Target data is a Reader. Obtain data in InputStream format, encoded
+            // as "Unicode" (utf-16be). Then use an InputStreamReader to decode
+            // back to chars on demand.
+        } else if (flavor.isRepresentationClassReader()) {
+            if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
+                throw new IOException
+                          ("cannot transfer non-text data as Reader");
+            }
+
+            InputStream is = (InputStream)translateStreamToInputStream(
+                    str, DataFlavor.plainTextFlavor,
+                    format, localeTransferable);
+
+            String unicode = DataTransferer.getTextCharset(DataFlavor.plainTextFlavor);
+
+            Reader reader = new InputStreamReader(is, unicode);
+
+            theObject = constructFlavoredObject(reader, flavor, Reader.class);
+
+            // Target data is an RMI object
+        } else if (flavor.isRepresentationClassRemote()) {
+
+            try (ObjectInputStream ois =
+                     new ObjectInputStream(str))
+            {
+                theObject = RMI.getMarshalledObject(ois.readObject());
+            }catch (Exception e) {
+                throw new IOException(e.getMessage());
+            }
+
+            // Target data is Serializable
+        } else if (flavor.isRepresentationClassSerializable()) {
+            try (ObjectInputStream ois =
+                     new ObjectInputStream(str))
+            {
+                theObject = ois.readObject();
+            } catch (Exception e) {
+                throw new IOException(e.getMessage());
+            }
+        }
+
+
+        return theObject;
+
     }
 
     /**
@@ -1798,7 +1798,7 @@
      * ReencodingInputStream will decode and reencode the InputStream on demand
      * so that we can strip terminators and search-and-replace EOLN.
      */
-    private Object translateBytesOrStreamToInputStream
+    private Object translateStreamToInputStream
         (InputStream str, DataFlavor flavor, long format,
          Transferable localeTransferable) throws IOException
     {
@@ -2054,7 +2054,6 @@
      * Decodes URIs from either a byte array or a stream.
      */
     protected URI[] dragQueryURIs(InputStream stream,
-                                  byte[] bytes,
                                   long format,
                                   Transferable localeTransferable)
       throws IOException
@@ -2067,10 +2066,10 @@
      * Translates either a byte array or an input stream which contain
      * platform-specific image data in the given format into an Image.
      */
-    protected abstract Image platformImageBytesOrStreamToImage(InputStream str,
-                                                               byte[] bytes,
-                                                               long format)
-      throws IOException;
+
+
+    protected abstract Image platformImageBytesToImage(
+        byte[] bytes,long format) throws IOException;
 
     /**
      * Translates either a byte array or an input stream which contain
@@ -2078,13 +2077,9 @@
      *
      * @param mimeType image MIME type, such as: image/png, image/jpeg, image/gif
      */
-    protected Image standardImageBytesOrStreamToImage(InputStream inputStream,
-                                                      byte[] bytes,
-                                                      String mimeType)
-      throws IOException {
-        if (inputStream == null) {
-            inputStream = new ByteArrayInputStream(bytes);
-        }
+    protected Image standardImageBytesToImage(
+        byte[] bytes, String mimeType) throws IOException
+    {
 
         Iterator readerIterator = ImageIO.getImageReadersByMIMEType(mimeType);
 
@@ -2097,9 +2092,9 @@
 
         while (readerIterator.hasNext()) {
             ImageReader imageReader = (ImageReader)readerIterator.next();
-            try {
+            try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
                 ImageInputStream imageInputStream =
-                    ImageIO.createImageInputStream(inputStream);
+                    ImageIO.createImageInputStream(bais);
 
                 try {
                     ImageReadParam param = imageReader.getDefaultReadParam();
@@ -2456,15 +2451,16 @@
     protected static byte[] inputStreamToByteArray(InputStream str)
         throws IOException
     {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        int len = 0;
-        byte[] buf = new byte[8192];
+        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+            int len = 0;
+            byte[] buf = new byte[8192];
 
-        while ((len = str.read(buf)) != -1) {
-            baos.write(buf, 0, len);
+            while ((len = str.read(buf)) != -1) {
+                baos.write(buf, 0, len);
+            }
+
+            return baos.toByteArray();
         }
-
-        return baos.toByteArray();
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java
index c5e80b2..67c9cb4 100644
--- a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, 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
@@ -54,7 +54,6 @@
 import sun.awt.datatransfer.DataTransferer;
 import java.awt.datatransfer.DataFlavor;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * <p>
@@ -64,8 +63,6 @@
  * @since JDK1.3.1
  *
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class SunDragSourceContextPeer implements DragSourceContextPeer {
 
     private DragGestureEvent  trigger;
@@ -278,7 +275,7 @@
      * upcall from native code
      */
 
-    private void dragEnter(final int targetActions,
+    protected void dragEnter(final int targetActions,
                            final int modifiers,
                            final int x, final int y) {
         postDragSourceDragEvent(targetActions, modifiers, x, y, DISPATCH_ENTER);
@@ -356,10 +353,6 @@
 
     public static void setDragDropInProgress(boolean b)
       throws InvalidDnDOperationException {
-        if (dragDropInProgress == b) {
-            throw new InvalidDnDOperationException(getExceptionMessage(b));
-        }
-
         synchronized (SunDragSourceContextPeer.class) {
             if (dragDropInProgress == b) {
                 throw new InvalidDnDOperationException(getExceptionMessage(b));
diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
index 360bb9a..66d1bf7 100644
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
@@ -57,7 +57,6 @@
 import sun.awt.SunToolkit;
 import sun.awt.datatransfer.DataTransferer;
 import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
-import sun.security.util.SecurityConstants;
 
 /**
  * <p>
@@ -260,6 +259,7 @@
         }
 
         final long format = lFormat.longValue();
+
         Object ret = getNativeData(format);
 
         if (ret instanceof byte[]) {
@@ -270,11 +270,14 @@
                 throw new InvalidDnDOperationException(e.getMessage());
             }
         } else if (ret instanceof InputStream) {
+            InputStream inputStream = (InputStream)ret;
             try {
                 return DataTransferer.getInstance().
-                    translateStream((InputStream)ret, df, format, this);
+                    translateStream(inputStream, df, format, this);
             } catch (IOException e) {
                 throw new InvalidDnDOperationException(e.getMessage());
+            } finally {
+                inputStream.close();
             }
         } else {
             throw new IOException("no native data was transfered");
diff --git a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java
index 2f8732e..efc4bc9 100644
--- a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java
+++ b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -45,10 +45,7 @@
 import sun.java2d.loops.CompositeType;
 import sun.java2d.loops.RenderLoops;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class BufImgSurfaceData extends SurfaceData {
     BufferedImage bufImg;
     private BufferedImageGraphicsConfig graphicsConfig;
diff --git a/jdk/src/share/classes/sun/font/FontManager.java b/jdk/src/share/classes/sun/font/FontManager.java
index 4238cfa..cace22e 100644
--- a/jdk/src/share/classes/sun/font/FontManager.java
+++ b/jdk/src/share/classes/sun/font/FontManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -32,14 +32,11 @@
 
 import javax.swing.plaf.FontUIResource;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * Interface between Java Fonts (java.awt.Font) and the underlying
  * font files/native font resources and the Java and native font scalers.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface FontManager {
 
     // These constants are used in findFont().
diff --git a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
index 1b2d3d6..ba24604 100644
--- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
+++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -92,7 +92,7 @@
 import sun.java2d.DestSurfaceProvider;
 import sun.misc.PerformanceLogger;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * This is a the master Graphics2D superclass for all of the Sun
@@ -103,8 +103,6 @@
  *
  * @author Jim Graham
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class SunGraphics2D
     extends Graphics2D
     implements ConstrainableGraphics, Cloneable, DestSurfaceProvider
@@ -113,18 +111,29 @@
      * Attribute States
      */
     /* Paint */
+    @Native
     public static final int PAINT_CUSTOM       = 6; /* Any other Paint object */
+    @Native
     public static final int PAINT_TEXTURE      = 5; /* Tiled Image */
+    @Native
     public static final int PAINT_RAD_GRADIENT = 4; /* Color RadialGradient */
+    @Native
     public static final int PAINT_LIN_GRADIENT = 3; /* Color LinearGradient */
+    @Native
     public static final int PAINT_GRADIENT     = 2; /* Color Gradient */
+    @Native
     public static final int PAINT_ALPHACOLOR   = 1; /* Non-opaque Color */
+    @Native
     public static final int PAINT_OPAQUECOLOR  = 0; /* Opaque Color */
 
     /* Composite*/
+    @Native
     public static final int COMP_CUSTOM = 3;/* Custom Composite */
+    @Native
     public static final int COMP_XOR    = 2;/* XOR Mode Composite */
+    @Native
     public static final int COMP_ALPHA  = 1;/* AlphaComposite */
+    @Native
     public static final int COMP_ISCOPY = 0;/* simple stores into destination,
                                              * i.e. Src, SrcOverNoEa, and other
                                              * alpha modes which replace
@@ -132,21 +141,33 @@
                                              */
 
     /* Stroke */
+    @Native
     public static final int STROKE_CUSTOM = 3; /* custom Stroke */
+    @Native
     public static final int STROKE_WIDE   = 2; /* BasicStroke */
+    @Native
     public static final int STROKE_THINDASHED   = 1; /* BasicStroke */
+    @Native
     public static final int STROKE_THIN   = 0; /* BasicStroke */
 
     /* Transform */
+    @Native
     public static final int TRANSFORM_GENERIC = 4; /* any 3x2 */
+    @Native
     public static final int TRANSFORM_TRANSLATESCALE = 3; /* scale XY */
+    @Native
     public static final int TRANSFORM_ANY_TRANSLATE = 2; /* non-int translate */
+    @Native
     public static final int TRANSFORM_INT_TRANSLATE = 1; /* int translate */
+    @Native
     public static final int TRANSFORM_ISIDENT = 0; /* Identity */
 
     /* Clipping */
+    @Native
     public static final int CLIP_SHAPE       = 2; /* arbitrary clip */
+    @Native
     public static final int CLIP_RECTANGULAR = 1; /* rectangular clip */
+    @Native
     public static final int CLIP_DEVICE      = 0; /* no clipping set */
 
     /* The following fields are used when the current Paint is a Color. */
diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
index 684f6fc..ef78a81 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, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -45,10 +45,8 @@
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
 import static sun.java2d.pipe.BufferedOpCodes.*;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 class OGLBlitLoops {
 
     static void register() {
@@ -190,12 +188,12 @@
      * createPackedParams().  (They are also used at the native level when
      * unpacking the params.)
      */
-    private static final int OFFSET_SRCTYPE = 16;
-    private static final int OFFSET_HINT    =  8;
-    private static final int OFFSET_TEXTURE =  3;
-    private static final int OFFSET_RTT     =  2;
-    private static final int OFFSET_XFORM   =  1;
-    private static final int OFFSET_ISOBLIT =  0;
+    @Native private static final int OFFSET_SRCTYPE = 16;
+    @Native private static final int OFFSET_HINT    =  8;
+    @Native private static final int OFFSET_TEXTURE =  3;
+    @Native private static final int OFFSET_RTT     =  2;
+    @Native private static final int OFFSET_XFORM   =  1;
+    @Native private static final int OFFSET_ISOBLIT =  0;
 
     /**
      * Packs the given parameters into a single int value in order to save
diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLContext.java b/jdk/src/share/classes/sun/java2d/opengl/OGLContext.java
index 17c4f8a..e3ac65f 100644
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLContext.java
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -32,7 +32,7 @@
 import static sun.java2d.pipe.BufferedOpCodes.*;
 import static sun.java2d.pipe.hw.ContextCapabilities.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * Note that the RenderQueue lock must be acquired before calling any of
@@ -155,39 +155,44 @@
         rq.flushNow();
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     static class OGLContextCaps extends ContextCapabilities {
         /**
          * Indicates the presence of the GL_EXT_framebuffer_object extension.
          * This cap will only be set if the fbobject system property has been
          * enabled and we are able to create an FBO with depth buffer.
          */
+        @Native
         static final int CAPS_EXT_FBOBJECT     =
                 (CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE);
         /** Indicates that the context supports a stored alpha channel. */
+        @Native
         static final int CAPS_STORED_ALPHA     = CAPS_RT_PLAIN_ALPHA;
         /** Indicates that the context is doublebuffered. */
+        @Native
         static final int CAPS_DOUBLEBUFFERED   = (FIRST_PRIVATE_CAP << 0);
         /**
          * Indicates the presence of the GL_ARB_fragment_shader extension.
          * This cap will only be set if the lcdshader system property has been
          * enabled and the hardware supports the minimum number of texture units
          */
+        @Native
         static final int CAPS_EXT_LCD_SHADER   = (FIRST_PRIVATE_CAP << 1);
         /**
          * Indicates the presence of the GL_ARB_fragment_shader extension.
          * This cap will only be set if the biopshader system property has been
          * enabled and the hardware meets our minimum requirements.
          */
+        @Native
         static final int CAPS_EXT_BIOP_SHADER  = (FIRST_PRIVATE_CAP << 2);
         /**
          * Indicates the presence of the GL_ARB_fragment_shader extension.
          * This cap will only be set if the gradshader system property has been
          * enabled and the hardware meets our minimum requirements.
          */
+        @Native
         static final int CAPS_EXT_GRAD_SHADER  = (FIRST_PRIVATE_CAP << 3);
         /** Indicates the presence of the GL_ARB_texture_rectangle extension. */
+        @Native
         static final int CAPS_EXT_TEXRECT      = (FIRST_PRIVATE_CAP << 4);
 
         OGLContextCaps(int caps, String adapterId) {
diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedContext.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedContext.java
index 6bc3039..75b18be 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedContext.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -37,7 +37,7 @@
 import static sun.java2d.pipe.BufferedOpCodes.*;
 import static sun.java2d.pipe.BufferedRenderPipe.BYTES_PER_SPAN;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * Base context class for managing state in a single-threaded rendering
@@ -49,8 +49,6 @@
  *
  * @see RenderQueue
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class BufferedContext {
 
     /*
@@ -63,19 +61,19 @@
     /**
      * Indicates that no flags are needed; take all default code paths.
      */
-    public static final int NO_CONTEXT_FLAGS = (0 << 0);
+    @Native public static final int NO_CONTEXT_FLAGS = (0 << 0);
     /**
      * Indicates that the source surface (or color value, if it is a simple
      * rendering operation) is opaque (has an alpha value of 1.0).  If this
      * flag is present, it allows us to disable blending in certain
      * situations in order to improve performance.
      */
-    public static final int SRC_IS_OPAQUE    = (1 << 0);
+    @Native public static final int SRC_IS_OPAQUE    = (1 << 0);
     /**
      * Indicates that the operation uses an alpha mask, which may determine
      * the code path that is used when setting up the current paint state.
      */
-    public static final int USE_MASK         = (1 << 1);
+    @Native public static final int USE_MASK         = (1 << 1);
 
     protected RenderQueue rq;
     protected RenderBuffer buf;
diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedOpCodes.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedOpCodes.java
index 78ee323..89acfdf 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedOpCodes.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedOpCodes.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,79 +25,77 @@
 
 package sun.java2d.pipe;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class BufferedOpCodes {
     // draw ops
-    public static final int DRAW_LINE            = 10;
-    public static final int DRAW_RECT            = 11;
-    public static final int DRAW_POLY            = 12;
-    public static final int DRAW_PIXEL           = 13;
-    public static final int DRAW_SCANLINES       = 14;
-    public static final int DRAW_PARALLELOGRAM   = 15;
-    public static final int DRAW_AAPARALLELOGRAM = 16;
+    @Native public static final int DRAW_LINE            = 10;
+    @Native public static final int DRAW_RECT            = 11;
+    @Native public static final int DRAW_POLY            = 12;
+    @Native public static final int DRAW_PIXEL           = 13;
+    @Native public static final int DRAW_SCANLINES       = 14;
+    @Native public static final int DRAW_PARALLELOGRAM   = 15;
+    @Native public static final int DRAW_AAPARALLELOGRAM = 16;
 
     // fill ops
-    public static final int FILL_RECT            = 20;
-    public static final int FILL_SPANS           = 21;
-    public static final int FILL_PARALLELOGRAM   = 22;
-    public static final int FILL_AAPARALLELOGRAM = 23;
+    @Native public static final int FILL_RECT            = 20;
+    @Native public static final int FILL_SPANS           = 21;
+    @Native public static final int FILL_PARALLELOGRAM   = 22;
+    @Native public static final int FILL_AAPARALLELOGRAM = 23;
 
     // copy-related ops
-    public static final int COPY_AREA            = 30;
-    public static final int BLIT                 = 31;
-    public static final int MASK_FILL            = 32;
-    public static final int MASK_BLIT            = 33;
-    public static final int SURFACE_TO_SW_BLIT   = 34;
+    @Native public static final int COPY_AREA            = 30;
+    @Native public static final int BLIT                 = 31;
+    @Native public static final int MASK_FILL            = 32;
+    @Native public static final int MASK_BLIT            = 33;
+    @Native public static final int SURFACE_TO_SW_BLIT   = 34;
 
     // text-related ops
-    public static final int DRAW_GLYPH_LIST      = 40;
+    @Native public static final int DRAW_GLYPH_LIST      = 40;
 
     // state-related ops
-    public static final int SET_RECT_CLIP        = 51;
-    public static final int BEGIN_SHAPE_CLIP     = 52;
-    public static final int SET_SHAPE_CLIP_SPANS = 53;
-    public static final int END_SHAPE_CLIP       = 54;
-    public static final int RESET_CLIP           = 55;
-    public static final int SET_ALPHA_COMPOSITE  = 56;
-    public static final int SET_XOR_COMPOSITE    = 57;
-    public static final int RESET_COMPOSITE      = 58;
-    public static final int SET_TRANSFORM        = 59;
-    public static final int RESET_TRANSFORM      = 60;
+    @Native public static final int SET_RECT_CLIP        = 51;
+    @Native public static final int BEGIN_SHAPE_CLIP     = 52;
+    @Native public static final int SET_SHAPE_CLIP_SPANS = 53;
+    @Native public static final int END_SHAPE_CLIP       = 54;
+    @Native public static final int RESET_CLIP           = 55;
+    @Native public static final int SET_ALPHA_COMPOSITE  = 56;
+    @Native public static final int SET_XOR_COMPOSITE    = 57;
+    @Native public static final int RESET_COMPOSITE      = 58;
+    @Native public static final int SET_TRANSFORM        = 59;
+    @Native public static final int RESET_TRANSFORM      = 60;
 
     // context-related ops
-    public static final int SET_SURFACES         = 70;
-    public static final int SET_SCRATCH_SURFACE  = 71;
-    public static final int FLUSH_SURFACE        = 72;
-    public static final int DISPOSE_SURFACE      = 73;
-    public static final int DISPOSE_CONFIG       = 74;
-    public static final int INVALIDATE_CONTEXT   = 75;
-    public static final int SYNC                 = 76;
-    public static final int RESTORE_DEVICES      = 77;
-    public static final int SAVE_STATE           = 78;
-    public static final int RESTORE_STATE        = 79;
+    @Native public static final int SET_SURFACES         = 70;
+    @Native public static final int SET_SCRATCH_SURFACE  = 71;
+    @Native public static final int FLUSH_SURFACE        = 72;
+    @Native public static final int DISPOSE_SURFACE      = 73;
+    @Native public static final int DISPOSE_CONFIG       = 74;
+    @Native public static final int INVALIDATE_CONTEXT   = 75;
+    @Native public static final int SYNC                 = 76;
+    @Native public static final int RESTORE_DEVICES      = 77;
+    @Native public static final int SAVE_STATE           = 78;
+    @Native public static final int RESTORE_STATE        = 79;
 
     // multibuffering ops
-    public static final int SWAP_BUFFERS         = 80;
+    @Native public static final int SWAP_BUFFERS         = 80;
 
     // special no-op op code (mainly used for achieving 8-byte alignment)
-    public static final int NOOP                 = 90;
+    @Native public static final int NOOP                 = 90;
 
     // paint-related ops
-    public static final int RESET_PAINT               = 100;
-    public static final int SET_COLOR                 = 101;
-    public static final int SET_GRADIENT_PAINT        = 102;
-    public static final int SET_LINEAR_GRADIENT_PAINT = 103;
-    public static final int SET_RADIAL_GRADIENT_PAINT = 104;
-    public static final int SET_TEXTURE_PAINT         = 105;
+    @Native public static final int RESET_PAINT               = 100;
+    @Native public static final int SET_COLOR                 = 101;
+    @Native public static final int SET_GRADIENT_PAINT        = 102;
+    @Native public static final int SET_LINEAR_GRADIENT_PAINT = 103;
+    @Native public static final int SET_RADIAL_GRADIENT_PAINT = 104;
+    @Native public static final int SET_TEXTURE_PAINT         = 105;
 
     // BufferedImageOp-related ops
-    public static final int ENABLE_CONVOLVE_OP     = 120;
-    public static final int DISABLE_CONVOLVE_OP    = 121;
-    public static final int ENABLE_RESCALE_OP      = 122;
-    public static final int DISABLE_RESCALE_OP     = 123;
-    public static final int ENABLE_LOOKUP_OP       = 124;
-    public static final int DISABLE_LOOKUP_OP      = 125;
+    @Native public static final int ENABLE_CONVOLVE_OP     = 120;
+    @Native public static final int DISABLE_CONVOLVE_OP    = 121;
+    @Native public static final int ENABLE_RESCALE_OP      = 122;
+    @Native public static final int DISABLE_RESCALE_OP     = 123;
+    @Native public static final int ENABLE_LOOKUP_OP       = 124;
+    @Native public static final int DISABLE_LOOKUP_OP      = 125;
 }
diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java
index 5737e40..84394e2 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -46,10 +46,8 @@
 import sun.java2d.loops.SurfaceType;
 import static sun.java2d.pipe.BufferedOpCodes.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class BufferedPaints {
 
     static void setPaint(RenderQueue rq, SunGraphics2D sg2d,
@@ -304,7 +302,7 @@
      * shaders.  So for now we will cap this value at 12, but we can
      * re-evaluate this in the future as hardware becomes more capable.
      */
-    public static final int MULTI_MAX_FRACTIONS = 12;
+    @Native public static final int MULTI_MAX_FRACTIONS = 12;
 
     /**
      * Helper function to convert a color component in sRGB space to
diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedTextPipe.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedTextPipe.java
index 8f4a2bf..ce38825 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedTextPipe.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedTextPipe.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -32,24 +32,22 @@
 import sun.java2d.SurfaceData;
 import static sun.java2d.pipe.BufferedOpCodes.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public abstract class BufferedTextPipe extends GlyphListPipe {
 
-    private static final int BYTES_PER_GLYPH_IMAGE = 8;
-    private static final int BYTES_PER_GLYPH_POSITION = 8;
+    @Native private static final int BYTES_PER_GLYPH_IMAGE = 8;
+    @Native private static final int BYTES_PER_GLYPH_POSITION = 8;
 
     /**
      * The following offsets are used to pack the parameters in
      * createPackedParams().  (They are also used at the native level when
      * unpacking the params.)
      */
-    private static final int OFFSET_CONTRAST  = 8;
-    private static final int OFFSET_RGBORDER  = 2;
-    private static final int OFFSET_SUBPIXPOS = 1;
-    private static final int OFFSET_POSITIONS = 0;
+    @Native private static final int OFFSET_CONTRAST  = 8;
+    @Native private static final int OFFSET_RGBORDER  = 2;
+    @Native private static final int OFFSET_SUBPIXPOS = 1;
+    @Native private static final int OFFSET_POSITIONS = 0;
 
     /**
      * Packs the given parameters into a single int value in order to save
diff --git a/jdk/src/share/classes/sun/java2d/pipe/RenderBuffer.java b/jdk/src/share/classes/sun/java2d/pipe/RenderBuffer.java
index 353c8d1..5f5118a 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/RenderBuffer.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/RenderBuffer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -27,7 +27,6 @@
 
 import sun.misc.Unsafe;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The RenderBuffer class is a simplified, high-performance, Unsafe wrapper
@@ -44,8 +43,6 @@
  * single-threaded rendering.  For example, there is no put(double[]) method
  * because we currently have no need for such a method in the STR classes.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class RenderBuffer {
 
     /**
diff --git a/jdk/src/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java b/jdk/src/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java
index 1a3b791..44d4115 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -30,16 +30,13 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * This class is used to notify listeners about accelerated device's
  * events such as device reset or dispose that are about to occur.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class AccelDeviceEventNotifier {
 
     private static AccelDeviceEventNotifier theInstance;
@@ -49,13 +46,13 @@
      * resources associated with the device which are required for the device
      * to be reset.
      */
-    public static final int DEVICE_RESET = 0;
+    @Native public static final int DEVICE_RESET = 0;
 
     /**
      * A device is about to be disposed. The listeners have to release all
      * resources associated with the device.
      */
-    public static final int DEVICE_DISPOSED = 1;
+    @Native public static final int DEVICE_DISPOSED = 1;
 
     private final Map<AccelDeviceEventListener, Integer> listeners;
 
diff --git a/jdk/src/share/classes/sun/java2d/pipe/hw/AccelSurface.java b/jdk/src/share/classes/sun/java2d/pipe/hw/AccelSurface.java
index 6dd5137..8f4e5a3 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/hw/AccelSurface.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/hw/AccelSurface.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -28,41 +28,39 @@
 import java.awt.Rectangle;
 import sun.java2d.Surface;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * Abstraction for a hardware accelerated surface.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public interface AccelSurface extends BufferedContextProvider, Surface {
     /**
      * Undefined
      */
-    public static final int UNDEFINED       = 0;
+    @Native public static final int UNDEFINED       = 0;
     /**
      * Window (or window substitute) surface
      */
-    public static final int WINDOW          = 1;
+    @Native public static final int WINDOW          = 1;
     /**
      * Render-To Plain surface (pbuffer for OpenGL, Render Target surface
      * for Direct3D)
      */
-    public static final int RT_PLAIN        = 2;
+    @Native public static final int RT_PLAIN        = 2;
     /**
      * Texture surface
      */
-    public static final int TEXTURE         = 3;
+    @Native public static final int TEXTURE         = 3;
     /**
      * A back-buffer surface (SwapChain surface for Direct3D, backbuffer for
      * OpenGL)
      */
-    public static final int FLIP_BACKBUFFER = 4;
+    @Native public static final int FLIP_BACKBUFFER = 4;
     /**
      * Render-To Texture surface (fbobject for OpenGL, texture with render-to
      * attribute for Direct3D)
      */
-    public static final int RT_TEXTURE      = 5;
+    @Native public static final int RT_TEXTURE      = 5;
 
     /**
      * Returns {@code int} representing surface's type as defined by constants
diff --git a/jdk/src/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java b/jdk/src/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java
index 0a6ab79..86a9a25 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -25,7 +25,6 @@
 
 package sun.java2d.pipe.hw;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * Represents a set of capabilities of a BufferedContext and associated
@@ -33,8 +32,6 @@
  *
  * @see AccelGraphicsConfig
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class ContextCapabilities {
     /** Indicates that the context has no capabilities. */
     public static final int CAPS_EMPTY             = (0 << 0);
diff --git a/jdk/src/share/classes/sun/misc/Version.java.template b/jdk/src/share/classes/sun/misc/Version.java.template
index 710bf71..6897e0a 100644
--- a/jdk/src/share/classes/sun/misc/Version.java.template
+++ b/jdk/src/share/classes/sun/misc/Version.java.template
@@ -52,8 +52,6 @@
         System.setProperty("java.version", java_version);
         System.setProperty("java.runtime.version", java_runtime_version);
         System.setProperty("java.runtime.name", java_runtime_name);
-        if (java_profile_name.length() > 0)
-            System.setProperty("java.runtime.profile", java_profile_name);
     }
 
     private static boolean versionsInitialized = false;
diff --git a/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java b/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java
index 1d1b26d..babb9f5 100644
--- a/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java
+++ b/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java
@@ -1299,16 +1299,16 @@
      *         <code>null</code> if the command was unsuccessful.
      * @throws IOException if an error occured during the transmission.
      */
-    public OutputStream putFileStream(String name, boolean unique) throws sun.net.ftp.FtpProtocolException, IOException {
+    public OutputStream putFileStream(String name, boolean unique)
+        throws sun.net.ftp.FtpProtocolException, IOException
+    {
         String cmd = unique ? "STOU " : "STOR ";
         Socket s = openDataConnection(cmd + name);
         if (s == null) {
             return null;
         }
-        if (type == TransferType.BINARY) {
-            return s.getOutputStream();
-        }
-        return new sun.net.TelnetOutputStream(s.getOutputStream(), false);
+        boolean bm = (type == TransferType.BINARY);
+        return new sun.net.TelnetOutputStream(s.getOutputStream(), bm);
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java b/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java
index 37fb6c7..0e786fe 100644
--- a/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java
+++ b/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java
@@ -124,6 +124,7 @@
         final String defaultVal;
         static NonProxyInfo ftpNonProxyInfo = new NonProxyInfo("ftp.nonProxyHosts", null, null, defStringVal);
         static NonProxyInfo httpNonProxyInfo = new NonProxyInfo("http.nonProxyHosts", null, null, defStringVal);
+        static NonProxyInfo socksNonProxyInfo = new NonProxyInfo("socksNonProxyHosts", null, null, defStringVal);
 
         NonProxyInfo(String p, String s, RegexpPool pool, String d) {
             property = p;
@@ -186,6 +187,8 @@
             pinfo = NonProxyInfo.httpNonProxyInfo;
         } else if ("ftp".equalsIgnoreCase(protocol)) {
             pinfo = NonProxyInfo.ftpNonProxyInfo;
+        } else if ("socket".equalsIgnoreCase(protocol)) {
+            pinfo = NonProxyInfo.socksNonProxyInfo;
         }
 
         /**
diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
index ff2ee58..cdd5b3c 100644
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, 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
@@ -32,15 +32,12 @@
 import java.nio.channels.*;
 import java.nio.channels.spi.*;
 import java.util.*;
-import javax.tools.annotation.GenerateNativeHeader;
 import sun.net.ResourceManager;
 
 /**
  * An implementation of DatagramChannels.
  */
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 class DatagramChannelImpl
     extends DatagramChannel
     implements SelChImpl
diff --git a/jdk/src/share/classes/sun/nio/ch/sctp/SctpStdSocketOption.java b/jdk/src/share/classes/sun/nio/ch/sctp/SctpStdSocketOption.java
index a7779b0..8bcc1c4 100644
--- a/jdk/src/share/classes/sun/nio/ch/sctp/SctpStdSocketOption.java
+++ b/jdk/src/share/classes/sun/nio/ch/sctp/SctpStdSocketOption.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -25,21 +25,19 @@
 package sun.nio.ch.sctp;
 
 import com.sun.nio.sctp.SctpSocketOption;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class SctpStdSocketOption<T>
     implements SctpSocketOption<T>
 {
     /* for native mapping of int options */
-    public static final int SCTP_DISABLE_FRAGMENTS = 1;
-    public static final int SCTP_EXPLICIT_COMPLETE = 2;
-    public static final int SCTP_FRAGMENT_INTERLEAVE = 3;
-    public static final int SCTP_NODELAY = 4;
-    public static final int SO_SNDBUF = 5;
-    public static final int SO_RCVBUF = 6;
-    public static final int SO_LINGER = 7;
+    @Native public static final int SCTP_DISABLE_FRAGMENTS = 1;
+    @Native public static final int SCTP_EXPLICIT_COMPLETE = 2;
+    @Native public static final int SCTP_FRAGMENT_INTERLEAVE = 3;
+    @Native public static final int SCTP_NODELAY = 4;
+    @Native public static final int SO_SNDBUF = 5;
+    @Native public static final int SO_RCVBUF = 6;
+    @Native public static final int SO_LINGER = 7;
 
     private final String name;
     private final Class<T> type;
diff --git a/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java b/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java
index 530834c..cfc1444 100644
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -45,19 +45,18 @@
      * types.  This matches the return value that must be used for a
      * dynamic proxy, allowing for a simple isInstance test.
      */
-    private final Map<String, Class<?>> memberTypes = new HashMap<String,Class<?>>();
+    private final Map<String, Class<?>> memberTypes;
 
     /**
      * Member name -> default value mapping.
      */
-    private final Map<String, Object> memberDefaults =
-        new HashMap<String, Object>();
+    private final Map<String, Object> memberDefaults;
 
     /**
      * Member name -> Method object mapping. This (and its assoicated
      * accessor) are used only to generate AnnotationTypeMismatchExceptions.
      */
-    private final Map<String, Method> members = new HashMap<String, Method>();
+    private final Map<String, Method> members;
 
     /**
      * The retention policy for this annotation type.
@@ -105,6 +104,9 @@
                 }
             });
 
+        memberTypes = new HashMap<String,Class<?>>(methods.length+1, 1.0f);
+        memberDefaults = new HashMap<String, Object>(0);
+        members = new HashMap<String, Method>(methods.length+1, 1.0f);
 
         for (Method method :  methods) {
             if (method.getParameterTypes().length != 0)
@@ -117,8 +119,6 @@
             Object defaultValue = method.getDefaultValue();
             if (defaultValue != null)
                 memberDefaults.put(name, defaultValue);
-
-            members.put(name, method);
         }
 
         sun.misc.SharedSecrets.getJavaLangAccess().
diff --git a/jdk/src/share/classes/sun/security/pkcs11/Secmod.java b/jdk/src/share/classes/sun/security/pkcs11/Secmod.java
index de4d12e..07651fe 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/Secmod.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/Secmod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -35,7 +35,6 @@
 import sun.security.pkcs11.wrapper.*;
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * The Secmod class defines the interface to the native NSS
@@ -57,8 +56,6 @@
  * @since   1.6
  * @author  Andreas Sterbenz
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public final class Secmod {
 
     private final static boolean DEBUG = false;
diff --git a/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java b/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java
index 0284244..0ada894 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -55,7 +55,6 @@
 import java.security.PrivilegedAction;
 
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
-import javax.tools.annotation.GenerateNativeHeader;
 
 /**
  * This is the default implementation of the PKCS11 interface. IT connects to
@@ -68,8 +67,6 @@
  * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
  * @invariants (pkcs11ModulePath_ <> null)
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class PKCS11 {
 
     /**
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 a33e00a..c8e96eb 100644
--- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java
@@ -1832,9 +1832,9 @@
         if (alias != null) {
             doImportKeyStoreSingle(loadSourceKeyStore(), alias);
         } else {
-            if (dest != null || srckeyPass != null || destKeyPass != null) {
+            if (dest != null || srckeyPass != null) {
                 throw new Exception(rb.getString(
-                        "if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified"));
+                        "if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified"));
             }
             doImportKeyStoreAll(loadSourceKeyStore());
         }
@@ -1888,14 +1888,25 @@
         // using destkeypass. If destkeypass is not provided, the destination
         // entry will be protected with the source entry password."
         // so always try to protect with destKeyPass.
+        char[] newPass = null;
         if (destKeyPass != null) {
+            newPass = destKeyPass;
             pp = new PasswordProtection(destKeyPass);
         } else if (objs.snd != null) {
+            newPass = objs.snd;
             pp = new PasswordProtection(objs.snd);
         }
 
         try {
             keyStore.setEntry(newAlias, entry, pp);
+            // Place the check so that only successful imports are blocked.
+            // For example, we don't block a failed SecretEntry import.
+            if (P12KEYSTORE.equalsIgnoreCase(storetype)) {
+                if (newPass != null && !Arrays.equals(newPass, storePass)) {
+                    throw new Exception(rb.getString(
+                            "The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified."));
+                }
+            }
             return 1;
         } catch (KeyStoreException kse) {
             Object[] source2 = {alias, kse.toString()};
diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Resources.java b/jdk/src/share/classes/sun/security/tools/keytool/Resources.java
index 262fe20..393aa3b 100644
--- a/jdk/src/share/classes/sun/security/tools/keytool/Resources.java
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources.java
@@ -242,8 +242,10 @@
         {"Certification.request.stored.in.file.filename.",
                 "Certification request stored in file <{0}>"},
         {"Submit.this.to.your.CA", "Submit this to your CA"},
-        {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified",
-            "if alias not specified, destalias, srckeypass, and destkeypass must not be specified"},
+        {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified",
+            "if alias not specified, destalias and srckeypass must not be specified"},
+        {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.",
+            "The destination pkcs12 keystore has different storepass and keypass. Please retry with -destkeypass specified."},
         {"Certificate.stored.in.file.filename.",
                 "Certificate stored in file <{0}>"},
         {"Certificate.reply.was.installed.in.keystore",
diff --git a/jdk/src/share/classes/sun/swing/JLightweightFrame.java b/jdk/src/share/classes/sun/swing/JLightweightFrame.java
index f7ea0ae..162186f 100644
--- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java
@@ -72,8 +72,10 @@
     public JLightweightFrame() {
         super();
         add(rootPane, BorderLayout.CENTER);
-        setBackground(new Color(0, 0, 0, 0));
         setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
+        if (getGraphicsConfiguration().isTranslucencyCapable()) {
+            setBackground(new Color(0, 0, 0, 0));
+        }
     }
 
     /**
diff --git a/jdk/src/share/classes/sun/util/logging/LoggingProxy.java b/jdk/src/share/classes/sun/util/logging/LoggingProxy.java
index 5d8e999..41fb7c8 100644
--- a/jdk/src/share/classes/sun/util/logging/LoggingProxy.java
+++ b/jdk/src/share/classes/sun/util/logging/LoggingProxy.java
@@ -61,6 +61,8 @@
 
     public String getLevelName(Object level);
 
+    public int getLevelValue(Object level);
+
     // return the logging property
     public String getProperty(String key);
 }
diff --git a/jdk/src/share/classes/sun/util/logging/LoggingSupport.java b/jdk/src/share/classes/sun/util/logging/LoggingSupport.java
index 27f0109..eed1c8f 100644
--- a/jdk/src/share/classes/sun/util/logging/LoggingSupport.java
+++ b/jdk/src/share/classes/sun/util/logging/LoggingSupport.java
@@ -140,6 +140,11 @@
         return proxy.getLevelName(level);
     }
 
+    public static int getLevelValue(Object level) {
+        ensureAvailable();
+        return proxy.getLevelValue(level);
+    }
+
     private static final String DEFAULT_FORMAT =
         "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%6$s%n";
 
diff --git a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java
index 000a160..9a1b893 100644
--- a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java
+++ b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java
@@ -27,14 +27,12 @@
 package sun.util.logging;
 
 import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.text.MessageFormat;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
@@ -87,7 +85,13 @@
  * @since 1.7
  */
 public class PlatformLogger {
-    // Same values as java.util.logging.Level for easy mapping
+    /*
+     * These constants should be shortcuts to Level enum constants that
+     * the clients of sun.util.logging.PlatformLogger require no source
+     * modification and avoid the conversion from int to Level enum.
+     *
+     * This can be done when JavaFX is converted to use the new PlatformLogger.Level API.
+     */
     public static final int OFF     = Integer.MAX_VALUE;
     public static final int SEVERE  = 1000;
     public static final int WARNING = 900;
@@ -98,7 +102,63 @@
     public static final int FINEST  = 300;
     public static final int ALL     = Integer.MIN_VALUE;
 
-    private static final int defaultLevel = INFO;
+    /**
+     * PlatformLogger logging levels.
+     */
+    public static enum Level {
+        // The name and value must match that of {@code java.util.logging.Level}s.
+        // Declare in ascending order of the given value for binary search.
+        ALL,
+        FINEST,
+        FINER,
+        FINE,
+        CONFIG,
+        INFO,
+        WARNING,
+        SEVERE,
+        OFF;
+
+        /**
+         * Associated java.util.logging.Level lazily initialized in
+         * JavaLoggerProxy's static initializer only once
+         * when java.util.logging is available and enabled.
+         * Only accessed by JavaLoggerProxy.
+         */
+        /* java.util.logging.Level */ Object javaLevel;
+
+        // ascending order for binary search matching the list of enum constants
+        private static final int[] levelValues = new int[] {
+            PlatformLogger.ALL, PlatformLogger.FINEST, PlatformLogger.FINER,
+            PlatformLogger.FINE, PlatformLogger.CONFIG, PlatformLogger.INFO,
+            PlatformLogger.WARNING, PlatformLogger.SEVERE, PlatformLogger.OFF
+        };
+
+        public int intValue() {
+            return levelValues[this.ordinal()];
+        }
+
+        static Level valueOf(int level) {
+            switch (level) {
+                // ordering per the highest occurences in the jdk source
+                // finest, fine, finer, info first
+                case PlatformLogger.FINEST  : return Level.FINEST;
+                case PlatformLogger.FINE    : return Level.FINE;
+                case PlatformLogger.FINER   : return Level.FINER;
+                case PlatformLogger.INFO    : return Level.INFO;
+                case PlatformLogger.WARNING : return Level.WARNING;
+                case PlatformLogger.CONFIG  : return Level.CONFIG;
+                case PlatformLogger.SEVERE  : return Level.SEVERE;
+                case PlatformLogger.OFF     : return Level.OFF;
+                case PlatformLogger.ALL     : return Level.ALL;
+            }
+            // return the nearest Level value >= the given level,
+            // for level > SEVERE, return SEVERE and exclude OFF
+            int i = Arrays.binarySearch(levelValues, 0, levelValues.length-2, level);
+            return values()[i >= 0 ? i : (-i-1)];
+        }
+    }
+
+    private static final Level DEFAULT_LEVEL = Level.INFO;
     private static boolean loggingEnabled;
     static {
         loggingEnabled = AccessController.doPrivileged(
@@ -109,6 +169,20 @@
                     return (cname != null || fname != null);
                 }
             });
+
+        // force loading of all JavaLoggerProxy (sub)classes to make JIT de-optimizations
+        // less probable.  Don't initialize JavaLoggerProxy class since
+        // java.util.logging may not be enabled.
+        try {
+            Class.forName("sun.util.logging.PlatformLogger$DefaultLoggerProxy",
+                          false,
+                          PlatformLogger.class.getClassLoader());
+            Class.forName("sun.util.logging.PlatformLogger$JavaLoggerProxy",
+                          false,   // do not invoke class initializer
+                          PlatformLogger.class.getClassLoader());
+        } catch (ClassNotFoundException ex) {
+            throw new InternalError(ex);
+        }
     }
 
     // Table of known loggers.  Maps names to PlatformLoggers.
@@ -143,27 +217,32 @@
             WeakReference<PlatformLogger> ref = entry.getValue();
             PlatformLogger plog = ref.get();
             if (plog != null) {
-                plog.newJavaLogger();
+                plog.redirectToJavaLoggerProxy();
             }
         }
     }
 
     /**
-     * Creates a new JavaLogger that the platform logger uses
+     * Creates a new JavaLoggerProxy and redirects the platform logger to it
      */
-    private void newJavaLogger() {
-        logger = new JavaLogger(logger.name, logger.effectiveLevel);
+    private void redirectToJavaLoggerProxy() {
+        DefaultLoggerProxy lp = DefaultLoggerProxy.class.cast(this.loggerProxy);
+        JavaLoggerProxy jlp = new JavaLoggerProxy(lp.name, lp.level);
+        // the order of assignments is important
+        this.javaLoggerProxy = jlp;   // isLoggable checks javaLoggerProxy if set
+        this.loggerProxy = jlp;
     }
 
-    // logger may be replaced with a JavaLogger object
-    // when the logging facility is enabled
-    private volatile LoggerProxy logger;
-
+    // DefaultLoggerProxy may be replaced with a JavaLoggerProxy object
+    // when the java.util.logging facility is enabled
+    private volatile LoggerProxy loggerProxy;
+    // javaLoggerProxy is only set when the java.util.logging facility is enabled
+    private volatile JavaLoggerProxy javaLoggerProxy;
     private PlatformLogger(String name) {
         if (loggingEnabled) {
-            this.logger = new JavaLogger(name);
+            this.loggerProxy = this.javaLoggerProxy = new JavaLoggerProxy(name);
         } else {
-            this.logger = new LoggerProxy(name);
+            this.loggerProxy = new DefaultLoggerProxy(name);
         }
     }
 
@@ -172,204 +251,278 @@
      * (i.e. its level is OFF).
      */
     public boolean isEnabled() {
-        return logger.isEnabled();
+        return loggerProxy.isEnabled();
     }
 
     /**
      * Gets the name for this platform logger.
      */
     public String getName() {
-        return logger.name;
+        return loggerProxy.name;
+    }
+
+    /**
+     * Returns true if a message of the given level would actually
+     * be logged by this logger.
+     *
+     * @deprecated Use isLoggable(Level) instead.
+     */
+    @Deprecated
+    public boolean isLoggable(int levelValue) {
+        return isLoggable(Level.valueOf(levelValue));
+    }
+
+    /**
+     * Gets the current log level. Returns 0 if the current effective level is
+     * not set (equivalent to Logger.getLevel() returns null).
+     *
+     * @deprecated Use level() instead
+     */
+    @Deprecated
+    public int getLevel() {
+        Level level = loggerProxy.getLevel();
+        return level != null ? level.intValue() : 0;
+    }
+
+    /**
+     * Sets the log level.
+     *
+     * @deprecated Use setLevel(Level) instead
+     */
+    @Deprecated
+    public void setLevel(int newLevel) {
+        loggerProxy.setLevel(newLevel == 0 ? null : Level.valueOf(newLevel));
     }
 
     /**
      * Returns true if a message of the given level would actually
      * be logged by this logger.
      */
-    public boolean isLoggable(int level) {
-        return logger.isLoggable(level);
+    public boolean isLoggable(Level level) {
+        if (level == null) {
+            throw new NullPointerException();
+        }
+        // performance-sensitive method: use two monomorphic call-sites
+        JavaLoggerProxy jlp = javaLoggerProxy;
+        return jlp != null ? jlp.isLoggable(level) : loggerProxy.isLoggable(level);
     }
 
     /**
-     * Gets the current log level.  Returns 0 if the current effective level
-     * is not set (equivalent to Logger.getLevel() returns null).
+     * Get the log level that has been specified for this PlatformLogger.
+     * The result may be null, which means that this logger's
+     * effective level will be inherited from its parent.
+     *
+     * @return  this PlatformLogger's level
      */
-    public int getLevel() {
-        return logger.getLevel();
+    public Level level() {
+        return loggerProxy.getLevel();
     }
 
     /**
-     * Sets the log level.
+     * Set the log level specifying which message levels will be
+     * logged by this logger.  Message levels lower than this
+     * value will be discarded.  The level value {@link #OFF}
+     * can be used to turn off logging.
+     * <p>
+     * If the new level is null, it means that this node should
+     * inherit its level from its nearest ancestor with a specific
+     * (non-null) level value.
+     *
+     * @param newLevel the new value for the log level (may be null)
      */
-    public void setLevel(int newLevel) {
-        logger.setLevel(newLevel);
+    public void setLevel(Level newLevel) {
+        loggerProxy.setLevel(newLevel);
     }
 
     /**
      * Logs a SEVERE message.
      */
     public void severe(String msg) {
-        logger.doLog(SEVERE, msg);
+        loggerProxy.doLog(Level.SEVERE, msg);
     }
 
     public void severe(String msg, Throwable t) {
-        logger.doLog(SEVERE, msg, t);
+        loggerProxy.doLog(Level.SEVERE, msg, t);
     }
 
     public void severe(String msg, Object... params) {
-        logger.doLog(SEVERE, msg, params);
+        loggerProxy.doLog(Level.SEVERE, msg, params);
     }
 
     /**
      * Logs a WARNING message.
      */
     public void warning(String msg) {
-        logger.doLog(WARNING, msg);
+        loggerProxy.doLog(Level.WARNING, msg);
     }
 
     public void warning(String msg, Throwable t) {
-        logger.doLog(WARNING, msg, t);
+        loggerProxy.doLog(Level.WARNING, msg, t);
     }
 
     public void warning(String msg, Object... params) {
-        logger.doLog(WARNING, msg, params);
+        loggerProxy.doLog(Level.WARNING, msg, params);
     }
 
     /**
      * Logs an INFO message.
      */
     public void info(String msg) {
-        logger.doLog(INFO, msg);
+        loggerProxy.doLog(Level.INFO, msg);
     }
 
     public void info(String msg, Throwable t) {
-        logger.doLog(INFO, msg, t);
+        loggerProxy.doLog(Level.INFO, msg, t);
     }
 
     public void info(String msg, Object... params) {
-        logger.doLog(INFO, msg, params);
+        loggerProxy.doLog(Level.INFO, msg, params);
     }
 
     /**
      * Logs a CONFIG message.
      */
     public void config(String msg) {
-        logger.doLog(CONFIG, msg);
+        loggerProxy.doLog(Level.CONFIG, msg);
     }
 
     public void config(String msg, Throwable t) {
-        logger.doLog(CONFIG, msg, t);
+        loggerProxy.doLog(Level.CONFIG, msg, t);
     }
 
     public void config(String msg, Object... params) {
-        logger.doLog(CONFIG, msg, params);
+        loggerProxy.doLog(Level.CONFIG, msg, params);
     }
 
     /**
      * Logs a FINE message.
      */
     public void fine(String msg) {
-        logger.doLog(FINE, msg);
+        loggerProxy.doLog(Level.FINE, msg);
     }
 
     public void fine(String msg, Throwable t) {
-        logger.doLog(FINE, msg, t);
+        loggerProxy.doLog(Level.FINE, msg, t);
     }
 
     public void fine(String msg, Object... params) {
-        logger.doLog(FINE, msg, params);
+        loggerProxy.doLog(Level.FINE, msg, params);
     }
 
     /**
      * Logs a FINER message.
      */
     public void finer(String msg) {
-        logger.doLog(FINER, msg);
+        loggerProxy.doLog(Level.FINER, msg);
     }
 
     public void finer(String msg, Throwable t) {
-        logger.doLog(FINER, msg, t);
+        loggerProxy.doLog(Level.FINER, msg, t);
     }
 
     public void finer(String msg, Object... params) {
-        logger.doLog(FINER, msg, params);
+        loggerProxy.doLog(Level.FINER, msg, params);
     }
 
     /**
      * Logs a FINEST message.
      */
     public void finest(String msg) {
-        logger.doLog(FINEST, msg);
+        loggerProxy.doLog(Level.FINEST, msg);
     }
 
     public void finest(String msg, Throwable t) {
-        logger.doLog(FINEST, msg, t);
+        loggerProxy.doLog(Level.FINEST, msg, t);
     }
 
     public void finest(String msg, Object... params) {
-        logger.doLog(FINEST, msg, params);
+        loggerProxy.doLog(Level.FINEST, msg, params);
     }
 
     /**
-     * Default platform logging support - output messages to
-     * System.err - equivalent to ConsoleHandler with SimpleFormatter.
+     * Abstract base class for logging support, defining the API and common field.
      */
-    static class LoggerProxy {
-        private static final PrintStream defaultStream = System.err;
-
+    private static abstract class LoggerProxy {
         final String name;
-        volatile int levelValue;
-        volatile int effectiveLevel = 0; // current effective level value
 
-        LoggerProxy(String name) {
-            this(name, defaultLevel);
+        protected LoggerProxy(String name) {
+            this.name = name;
         }
 
-        LoggerProxy(String name, int level) {
-            this.name = name;
-            this.levelValue = level == 0 ? defaultLevel : level;
+        abstract boolean isEnabled();
+
+        abstract Level getLevel();
+        abstract void setLevel(Level newLevel);
+
+        abstract void doLog(Level level, String msg);
+        abstract void doLog(Level level, String msg, Throwable thrown);
+        abstract void doLog(Level level, String msg, Object... params);
+
+        abstract boolean isLoggable(Level level);
+    }
+
+
+    private static final class DefaultLoggerProxy extends LoggerProxy {
+        /**
+         * Default platform logging support - output messages to System.err -
+         * equivalent to ConsoleHandler with SimpleFormatter.
+         */
+        private static PrintStream outputStream() {
+            return System.err;
+        }
+
+        volatile Level effectiveLevel; // effective level (never null)
+        volatile Level level;          // current level set for this node (may be null)
+
+        DefaultLoggerProxy(String name) {
+            super(name);
+            this.effectiveLevel = deriveEffectiveLevel(null);
+            this.level = null;
         }
 
         boolean isEnabled() {
-            return levelValue != OFF;
+            return effectiveLevel != Level.OFF;
         }
 
-        int getLevel() {
-            return effectiveLevel;
+        Level getLevel() {
+            return level;
         }
 
-        void setLevel(int newLevel) {
-            levelValue = newLevel;
-            effectiveLevel = newLevel;
-        }
-
-        void doLog(int level, String msg) {
-            if (level < levelValue || levelValue == OFF) {
-                return;
+        void setLevel(Level newLevel) {
+            Level oldLevel = level;
+            if (oldLevel != newLevel) {
+                level = newLevel;
+                effectiveLevel = deriveEffectiveLevel(newLevel);
             }
-            defaultStream.print(format(level, msg, null));
         }
 
-        void doLog(int level, String msg, Throwable thrown) {
-            if (level < levelValue || levelValue == OFF) {
-                return;
+        void doLog(Level level, String msg) {
+            if (isLoggable(level)) {
+                outputStream().print(format(level, msg, null));
             }
-            defaultStream.print(format(level, msg, thrown));
         }
 
-        void doLog(int level, String msg, Object... params) {
-            if (level < levelValue || levelValue == OFF) {
-                return;
+        void doLog(Level level, String msg, Throwable thrown) {
+            if (isLoggable(level)) {
+                outputStream().print(format(level, msg, thrown));
             }
-            String newMsg = formatMessage(msg, params);
-            defaultStream.print(format(level, newMsg, null));
         }
 
-        public boolean isLoggable(int level) {
-            if (level < levelValue || levelValue == OFF) {
-                return false;
+        void doLog(Level level, String msg, Object... params) {
+            if (isLoggable(level)) {
+                String newMsg = formatMessage(msg, params);
+                outputStream().print(format(level, newMsg, null));
             }
-            return true;
+        }
+
+        boolean isLoggable(Level level) {
+            Level effectiveLevel = this.effectiveLevel;
+            return level.intValue() >= effectiveLevel.intValue() && effectiveLevel != Level.OFF;
+        }
+
+        // derive effective level (could do inheritance search like j.u.l.Logger)
+        private Level deriveEffectiveLevel(Level level) {
+            return level == null ? DEFAULT_LEVEL : level;
         }
 
         // Copied from java.util.logging.Formatter.formatMessage
@@ -401,7 +554,7 @@
 
         // minimize memory allocation
         private Date date = new Date();
-        private synchronized String format(int level, String msg, Throwable thrown) {
+        private synchronized String format(Level level, String msg, Throwable thrown) {
             date.setTime(System.currentTimeMillis());
             String throwable = "";
             if (thrown != null) {
@@ -417,7 +570,7 @@
                                  date,
                                  getCallerInfo(),
                                  name,
-                                 PlatformLogger.getLevelName(level),
+                                 level.name(),
                                  msg,
                                  throwable);
         }
@@ -464,58 +617,41 @@
     }
 
     /**
-     * JavaLogger forwards all the calls to its corresponding
+     * JavaLoggerProxy forwards all the calls to its corresponding
      * java.util.logging.Logger object.
      */
-    static class JavaLogger extends LoggerProxy {
-        private static final Map<Integer, Object> levelObjects =
-            new HashMap<>();
-
+    private static final class JavaLoggerProxy extends LoggerProxy {
+        // initialize javaLevel fields for mapping from Level enum -> j.u.l.Level object
         static {
-            if (LoggingSupport.isAvailable()) {
-                // initialize the map to Level objects
-                getLevelObjects();
+            for (Level level : Level.values()) {
+                level.javaLevel = LoggingSupport.parseLevel(level.name());
             }
         }
 
-        private static void getLevelObjects() {
-            // get all java.util.logging.Level objects
-            int[] levelArray = new int[] {OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL};
-            for (int l : levelArray) {
-                Object level = LoggingSupport.parseLevel(getLevelName(l));
-                levelObjects.put(l, level);
-            }
+        private final /* java.util.logging.Logger */ Object javaLogger;
+
+        JavaLoggerProxy(String name) {
+            this(name, null);
         }
 
-        private final Object javaLogger;
-        JavaLogger(String name) {
-            this(name, 0);
-        }
-
-        JavaLogger(String name, int level) {
-            super(name, level);
+        JavaLoggerProxy(String name, Level level) {
+            super(name);
             this.javaLogger = LoggingSupport.getLogger(name);
-            if (level != 0) {
+            if (level != null) {
                 // level has been updated and so set the Logger's level
-                LoggingSupport.setLevel(javaLogger, levelObjects.get(level));
+                LoggingSupport.setLevel(javaLogger, level.javaLevel);
             }
         }
 
-       /**
-        * Let Logger.log() do the filtering since if the level of a
-        * platform logger is altered directly from
-        * java.util.logging.Logger.setLevel(), the levelValue will
-        * not be updated.
-        */
-        void doLog(int level, String msg) {
-            LoggingSupport.log(javaLogger, levelObjects.get(level), msg);
+        void doLog(Level level, String msg) {
+            LoggingSupport.log(javaLogger, level.javaLevel, msg);
         }
 
-        void doLog(int level, String msg, Throwable t) {
-            LoggingSupport.log(javaLogger, levelObjects.get(level), msg, t);
+        void doLog(Level level, String msg, Throwable t) {
+            LoggingSupport.log(javaLogger, level.javaLevel, msg, t);
         }
 
-        void doLog(int level, String msg, Object... params) {
+        void doLog(Level level, String msg, Object... params) {
             if (!isLoggable(level)) {
                 return;
             }
@@ -526,49 +662,35 @@
             for (int i = 0; i < len; i++) {
                 sparams [i] = String.valueOf(params[i]);
             }
-            LoggingSupport.log(javaLogger, levelObjects.get(level), msg, sparams);
+            LoggingSupport.log(javaLogger, level.javaLevel, msg, sparams);
         }
 
         boolean isEnabled() {
-            Object level = LoggingSupport.getLevel(javaLogger);
-            return level == null || level.equals(levelObjects.get(OFF)) == false;
+            return LoggingSupport.isLoggable(javaLogger, Level.OFF.javaLevel);
         }
 
-        int getLevel() {
-            Object level = LoggingSupport.getLevel(javaLogger);
-            if (level != null) {
-                for (Map.Entry<Integer, Object> l : levelObjects.entrySet()) {
-                    if (level == l.getValue()) {
-                        return l.getKey();
-                    }
-                }
+        /**
+         * Returns the PlatformLogger.Level mapped from j.u.l.Level
+         * set in the logger.  If the j.u.l.Logger is set to a custom Level,
+         * this method will return the nearest Level.
+         */
+        Level getLevel() {
+            Object javaLevel = LoggingSupport.getLevel(javaLogger);
+            if (javaLevel == null) return null;
+
+            try {
+                return Level.valueOf(LoggingSupport.getLevelName(javaLevel));
+            } catch (IllegalArgumentException e) {
+                return Level.valueOf(LoggingSupport.getLevelValue(javaLevel));
             }
-            return 0;
         }
 
-        void setLevel(int newLevel) {
-            levelValue = newLevel;
-            LoggingSupport.setLevel(javaLogger, levelObjects.get(newLevel));
+        void setLevel(Level level) {
+            LoggingSupport.setLevel(javaLogger, level == null ? null : level.javaLevel);
         }
 
-        public boolean isLoggable(int level) {
-            return LoggingSupport.isLoggable(javaLogger, levelObjects.get(level));
+        boolean isLoggable(Level level) {
+            return LoggingSupport.isLoggable(javaLogger, level.javaLevel);
         }
     }
-
-    private static String getLevelName(int level) {
-        switch (level) {
-            case OFF     : return "OFF";
-            case SEVERE  : return "SEVERE";
-            case WARNING : return "WARNING";
-            case INFO    : return "INFO";
-            case CONFIG  : return "CONFIG";
-            case FINE    : return "FINE";
-            case FINER   : return "FINER";
-            case FINEST  : return "FINEST";
-            case ALL     : return "ALL";
-            default      : return "UNKNOWN";
-        }
-    }
-
 }
diff --git a/jdk/src/share/demo/jvmti/hprof/hprof_md.h b/jdk/src/share/demo/jvmti/hprof/hprof_md.h
index b3e66fe..b65cba0 100644
--- a/jdk/src/share/demo/jvmti/hprof/hprof_md.h
+++ b/jdk/src/share/demo/jvmti/hprof/hprof_md.h
@@ -69,7 +69,7 @@
 unsigned md_ntohs(unsigned short s);
 unsigned md_ntohl(unsigned l);
 
-void   md_build_library_name(char *holder, int holderlen, char *pname, char *fname);
+void   md_build_library_name(char *holder, int holderlen, const char *pname, const char *fname);
 void * md_load_library(const char *name, char *err_buf, int err_buflen);
 void   md_unload_library(void *handle);
 void * md_find_library_entry(void *handle, const char *name);
diff --git a/jdk/src/share/lib/security/java.security-linux b/jdk/src/share/lib/security/java.security-linux
index ba0f305..849c024 100644
--- a/jdk/src/share/lib/security/java.security-linux
+++ b/jdk/src/share/lib/security/java.security-linux
@@ -157,6 +157,8 @@
                com.sun.org.apache.xalan.internal.utils.,\
                com.sun.org.glassfish.external.,\
                com.sun.org.glassfish.gmbal.,\
+               com.oracle.xmlns.internal.,\
+               com.oracle.webservices.internal.,\
 	       jdk.internal.,\
 	       jdk.nashorn.internal.,\
 	       jdk.nashorn.tools.
@@ -183,6 +185,8 @@
                    com.sun.org.apache.xalan.internal.utils.,\
                    com.sun.org.glassfish.external.,\
                    com.sun.org.glassfish.gmbal.,\
+                   com.oracle.xmlns.internal.,\
+                   com.oracle.webservices.internal.,\
 		   jdk.internal.,\
 		   jdk.nashorn.internal.,\
 		   jdk.nashorn.tools.
diff --git a/jdk/src/share/lib/security/java.security-macosx b/jdk/src/share/lib/security/java.security-macosx
index f3d10a4..c81128c 100644
--- a/jdk/src/share/lib/security/java.security-macosx
+++ b/jdk/src/share/lib/security/java.security-macosx
@@ -158,6 +158,8 @@
                com.sun.org.apache.xalan.internal.utils.,\
                com.sun.org.glassfish.external.,\
                com.sun.org.glassfish.gmbal.,\
+               com.oracle.xmlns.internal.,\
+               com.oracle.webservices.internal.,\
 	       jdk.internal.,\
 	       jdk.nashorn.internal.,\
 	       jdk.nashorn.tools.,\
@@ -185,6 +187,8 @@
                    com.sun.org.apache.xalan.internal.utils.,\
                    com.sun.org.glassfish.external.,\
                    com.sun.org.glassfish.gmbal.,\
+                   com.oracle.xmlns.internal.,\
+                   com.oracle.webservices.internal.,\
 		   jdk.internal.,\
 		   jdk.nashorn.internal.,\
 		   jdk.nashorn.tools.,\
diff --git a/jdk/src/share/lib/security/java.security-solaris b/jdk/src/share/lib/security/java.security-solaris
index e51581e..25581ba 100644
--- a/jdk/src/share/lib/security/java.security-solaris
+++ b/jdk/src/share/lib/security/java.security-solaris
@@ -159,6 +159,8 @@
                com.sun.org.apache.xalan.internal.utils.,\
                com.sun.org.glassfish.external.,\
                com.sun.org.glassfish.gmbal.,\
+               com.oracle.xmlns.internal.,\
+               com.oracle.webservices.internal.,\
 	       jdk.internal.,\
 	       jdk.nashorn.internal.,\
 	       jdk.nashorn.tools.
@@ -185,6 +187,8 @@
                    com.sun.org.apache.xalan.internal.utils.,\
                    com.sun.org.glassfish.external.,\
                    com.sun.org.glassfish.gmbal.,\
+                   com.oracle.xmlns.internal.,\
+                   com.oracle.webservices.internal.,\
 		   jdk.internal.,\
 		   jdk.nashorn.internal.,\
 		   jdk.nashorn.tools.
diff --git a/jdk/src/share/lib/security/java.security-windows b/jdk/src/share/lib/security/java.security-windows
index a7d74c9..a9b1c38 100644
--- a/jdk/src/share/lib/security/java.security-windows
+++ b/jdk/src/share/lib/security/java.security-windows
@@ -158,6 +158,8 @@
                com.sun.org.apache.xalan.internal.utils.,\
                com.sun.org.glassfish.external.,\
                com.sun.org.glassfish.gmbal.,\
+               com.oracle.xmlns.internal.,\
+               com.oracle.webservices.internal.,\
 	       jdk.internal.,\
 	       jdk.nashorn.internal.,\
 	       jdk.nashorn.tools.
@@ -184,6 +186,8 @@
                    com.sun.org.apache.xalan.internal.utils.,\
                    com.sun.org.glassfish.external.,\
                    com.sun.org.glassfish.gmbal.,\
+                   com.oracle.xmlns.internal.,\
+                   com.oracle.webservices.internal.,\
 		   jdk.internal.,\
 		   jdk.nashorn.internal.,\
 		   jdk.nashorn.tools.
diff --git a/jdk/src/solaris/back/linker_md.c b/jdk/src/solaris/back/linker_md.c
index dbcfc04..07be055 100644
--- a/jdk/src/solaris/back/linker_md.c
+++ b/jdk/src/solaris/back/linker_md.c
@@ -55,34 +55,27 @@
 #endif
 
 static void dll_build_name(char* buffer, size_t buflen,
-                           const char* pname, const char* fname) {
-    // Based on os_solaris.cpp
+                           const char* paths, const char* fname) {
+    char *path, *paths_copy, *next_token;
 
-    char *path_sep = PATH_SEPARATOR;
-    char *pathname = (char *)pname;
-    *buffer = '\0';
-    while (strlen(pathname) > 0) {
-        char *p = strchr(pathname, *path_sep);
-        if (p == NULL) {
-            p = pathname + strlen(pathname);
-        }
-        /* check for NULL path */
-        if (p == pathname) {
-            continue;
-        }
-        (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (int)(p - pathname),
-                       pathname, fname);
+    paths_copy = strdup(paths);
+    if (paths_copy == NULL) {
+        return;
+    }
 
+    next_token = NULL;
+    path = strtok_r(paths_copy, PATH_SEPARATOR, &next_token);
+
+    while (path != NULL) {
+        snprintf(buffer, buflen, "%s/lib%s." LIB_SUFFIX, path, fname);
         if (access(buffer, F_OK) == 0) {
             break;
         }
-        if (*p == '\0') {
-            pathname = p;
-        } else {
-            pathname = p + 1;
-        }
         *buffer = '\0';
+        path = strtok_r(NULL, PATH_SEPARATOR, &next_token);
     }
+
+    free(paths_copy);
 }
 
 /*
@@ -103,7 +96,7 @@
  * appropriate pre and extensions to a filename and the path
  */
 void
-dbgsysBuildLibName(char *holder, int holderlen, char *pname, char *fname)
+dbgsysBuildLibName(char *holder, int holderlen, const char *pname, const char *fname)
 {
     const int pnamelen = pname ? strlen(pname) : 0;
 
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
index 906e9a8..b5c2086 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -70,10 +70,7 @@
 import sun.java2d.BackBufferCapsProvider;
 import sun.java2d.pipe.Region;
 
-import javax.tools.annotation.GenerateNativeHeader;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer,
     BackBufferCapsProvider
 {
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java
index 7b6976b..8e3a0b17 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java
@@ -212,10 +212,9 @@
      * Translates either a byte array or an input stream which contain
      * platform-specific image data in the given format into an Image.
      */
-    protected Image platformImageBytesOrStreamToImage(InputStream inputStream,
-                                                      byte[] bytes,
-                                                      long format)
-      throws IOException {
+    protected Image platformImageBytesToImage(
+        byte[] bytes, long format) throws IOException
+    {
         String mimeType = null;
         if (format == PNG_ATOM.getAtom()) {
             mimeType = "image/png";
@@ -235,7 +234,7 @@
             }
         }
         if (mimeType != null) {
-            return standardImageBytesOrStreamToImage(inputStream, bytes, mimeType);
+            return standardImageBytesToImage(bytes, mimeType);
         } else {
             String nativeFormat = getNativeForFormat(format);
             throw new IOException("Translation from " + nativeFormat +
@@ -330,8 +329,8 @@
      * a valid MIME and return a list of flavors to which the data in this MIME
      * type can be translated by the Data Transfer subsystem.
      */
-    public List getPlatformMappingsForNative(String nat) {
-        List flavors = new ArrayList();
+    public List <DataFlavor> getPlatformMappingsForNative(String nat) {
+        List <DataFlavor> flavors = new ArrayList();
 
         if (nat == null) {
             return flavors;
@@ -346,16 +345,14 @@
             return flavors;
         }
 
-        Object value = df;
+        DataFlavor value = df;
         final String primaryType = df.getPrimaryType();
         final String baseType = primaryType + "/" + df.getSubType();
 
         // For text formats we map natives to MIME strings instead of data
         // flavors to enable dynamic text native-to-flavor mapping generation.
         // See SystemFlavorMap.getFlavorsForNative() for details.
-        if ("text".equals(primaryType)) {
-            value = primaryType + "/" + df.getSubType();
-        } else if ("image".equals(primaryType)) {
+        if ("image".equals(primaryType)) {
             Iterator readers = ImageIO.getImageReadersByMIMEType(baseType);
             if (readers.hasNext()) {
                 flavors.add(DataFlavor.imageFlavor);
@@ -438,16 +435,13 @@
                 }
             }
         } else if (DataTransferer.isFlavorCharsetTextType(df)) {
-            final Iterator iter = DataTransferer.standardEncodings();
-
             // stringFlavor is semantically equivalent to the standard
             // "text/plain" MIME type.
             if (DataFlavor.stringFlavor.equals(df)) {
                 baseType = "text/plain";
             }
 
-            while (iter.hasNext()) {
-                String encoding = (String)iter.next();
+            for (String encoding : DataTransferer.standardEncodings()) {
                 if (!encoding.equals(charset)) {
                     natives.add(baseType + ";charset=" + encoding);
                 }
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
index 0c540b1..2852235 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
@@ -642,5 +642,11 @@
         return getBounds();
     }
 
-    public void emulateActivation(boolean doActivate) {}
+    public void emulateActivation(boolean doActivate) {
+        if (doActivate) {
+            handleWindowFocusIn(0);
+        } else {
+            handleWindowFocusOut(null, 0);
+        }
+    }
 }
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java
new file mode 100644
index 0000000..6292482
--- /dev/null
+++ b/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java
@@ -0,0 +1,65 @@
+/*
+ * 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.  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.X11;
+
+import java.awt.Graphics;
+
+import sun.awt.LightweightFrame;
+
+public class XLightweightFramePeer extends XFramePeer {
+
+    XLightweightFramePeer(LightweightFrame target) {
+        super(target);
+    }
+
+    private LightweightFrame getLwTarget() {
+        return (LightweightFrame)target;
+    }
+
+    @Override
+    public Graphics getGraphics() {
+        return getLwTarget().getGraphics();
+    }
+
+    @Override
+    public void xSetVisible(boolean visible) {
+        this.visible = visible;
+    }
+
+    @Override
+    protected void requestXFocus(long time, boolean timeProvided) {
+        // not sending native focus events to the proxy
+    }
+
+    @Override
+    public void setGrab(boolean grab) {
+        if (grab) {
+            getLwTarget().grabFocus();
+        } else {
+            getLwTarget().ungrabFocus();
+        }
+    }
+}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
index b4fb9c7..220dff1 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
@@ -420,7 +420,9 @@
     }
 
     public FramePeer createLightweightFrame(LightweightFrame target) {
-        return null;
+        FramePeer peer = new XLightweightFramePeer(target);
+        targetCreatedPeer(target, peer);
+        return peer;
     }
 
     public FramePeer createFrame(Frame target) {
diff --git a/jdk/src/solaris/classes/sun/nio/ch/sctp/AssociationChange.java b/jdk/src/solaris/classes/sun/nio/ch/sctp/AssociationChange.java
index 2399a38..79a0805 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/sctp/AssociationChange.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/sctp/AssociationChange.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -26,22 +26,20 @@
 
 import com.sun.nio.sctp.Association;
 import com.sun.nio.sctp.AssociationChangeNotification;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * An implementation of AssociationChangeNotification
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class AssociationChange extends AssociationChangeNotification
     implements SctpNotification
 {
     /* static final ints so that they can be referenced from native */
-    private final static int SCTP_COMM_UP = 1;
-    private final static int SCTP_COMM_LOST = 2;
-    private final static int SCTP_RESTART = 3;
-    private final static int SCTP_SHUTDOWN = 4;
-    private final static int SCTP_CANT_START = 5;
+    @Native private final static int SCTP_COMM_UP = 1;
+    @Native private final static int SCTP_COMM_LOST = 2;
+    @Native private final static int SCTP_RESTART = 3;
+    @Native private final static int SCTP_SHUTDOWN = 4;
+    @Native private final static int SCTP_CANT_START = 5;
 
     private Association association;
 
diff --git a/jdk/src/solaris/classes/sun/nio/ch/sctp/PeerAddrChange.java b/jdk/src/solaris/classes/sun/nio/ch/sctp/PeerAddrChange.java
index 2dac583..55ee10f 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/sctp/PeerAddrChange.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/sctp/PeerAddrChange.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -27,23 +27,21 @@
 import java.net.SocketAddress;
 import com.sun.nio.sctp.Association;
 import com.sun.nio.sctp.PeerAddressChangeNotification;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * An implementation of PeerAddressChangeNotification
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class PeerAddrChange extends PeerAddressChangeNotification
     implements SctpNotification
 {
     /* static final ints so that they can be referenced from native */
-    private final static int SCTP_ADDR_AVAILABLE = 1;
-    private final static int SCTP_ADDR_UNREACHABLE = 2;
-    private final static int SCTP_ADDR_REMOVED = 3;
-    private final static int SCTP_ADDR_ADDED = 4;
-    private final static int SCTP_ADDR_MADE_PRIM = 5;
-    private final static int SCTP_ADDR_CONFIRMED =6;
+    @Native private final static int SCTP_ADDR_AVAILABLE = 1;
+    @Native private final static int SCTP_ADDR_UNREACHABLE = 2;
+    @Native private final static int SCTP_ADDR_REMOVED = 3;
+    @Native private final static int SCTP_ADDR_ADDED = 4;
+    @Native private final static int SCTP_ADDR_MADE_PRIM = 5;
+    @Native private final static int SCTP_ADDR_CONFIRMED =6;
 
     private Association association;
 
diff --git a/jdk/src/solaris/classes/sun/nio/ch/sctp/ResultContainer.java b/jdk/src/solaris/classes/sun/nio/ch/sctp/ResultContainer.java
index dee2f98..229899f 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/sctp/ResultContainer.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/sctp/ResultContainer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -24,22 +24,20 @@
  */
 package sun.nio.ch.sctp;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 
 /**
  * Wraps the actual message or notification so that it can be
  * set and returned from the native receive implementation.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 public class ResultContainer {
     /* static final ints so that they can be referenced from native */
-    static final int NOTHING = 0;
-    static final int MESSAGE = 1;
-    static final int SEND_FAILED = 2;
-    static final int ASSOCIATION_CHANGED = 3;
-    static final int PEER_ADDRESS_CHANGED = 4;
-    static final int SHUTDOWN = 5;
+    @Native static final int NOTHING = 0;
+    @Native static final int MESSAGE = 1;
+    @Native static final int SEND_FAILED = 2;
+    @Native static final int ASSOCIATION_CHANGED = 3;
+    @Native static final int PEER_ADDRESS_CHANGED = 4;
+    @Native static final int SHUTDOWN = 5;
 
     private Object value;
     private int type;
diff --git a/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c b/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c
index 2046363..9cfcc59 100644
--- a/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c
+++ b/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c
@@ -381,38 +381,32 @@
 }
 
 static void dll_build_name(char* buffer, size_t buflen,
-                           const char* pname, const char* fname) {
-    // Loosely based on os_solaris.cpp
+                           const char* paths, const char* fname) {
+    char *path, *paths_copy, *next_token;
 
-      char *pathname = (char *)pname;
-      *buffer = '\0';
-      while (strlen(pathname) > 0) {
-          char *p = strchr(pathname, ':');
-          if (p == NULL) {
-              p = pathname + strlen(pathname);
-          }
-          /* check for NULL path */
-          if (p == pathname) {
-              continue;
-          }
-          (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX,
-                         (int)(p - pathname), pathname, fname);
+    paths_copy = strdup(paths);
+    if (paths_copy == NULL) {
+        return;
+    }
 
-          if (access(buffer, F_OK) == 0) {
-              break;
-          }
-          if (*p == '\0') {
-              pathname = p;
-          } else {
-              pathname = p + 1;
-          }
-          *buffer = '\0';
-      }
+    next_token = NULL;
+    path = strtok_r(paths_copy, ":", &next_token);
+
+    while (path != NULL) {
+        snprintf(buffer, buflen, "%s/lib%s" JNI_LIB_SUFFIX, path, fname);
+        if (access(buffer, F_OK) == 0) {
+            break;
+        }
+        *buffer = '\0';
+        path = strtok_r(NULL, ":", &next_token);
+    }
+
+    free(paths_copy);
 }
 
 /* Create the actual fill filename for a dynamic library.  */
 void
-md_build_library_name(char *holder, int holderlen, char *pname, char *fname)
+md_build_library_name(char *holder, int holderlen, const char *pname, const char *fname)
 {
     int   pnamelen;
 
diff --git a/jdk/src/solaris/native/java/io/io_util_md.c b/jdk/src/solaris/native/java/io/io_util_md.c
index a1acbe5..e74bc12 100644
--- a/jdk/src/solaris/native/java/io/io_util_md.c
+++ b/jdk/src/solaris/native/java/io/io_util_md.c
@@ -200,12 +200,8 @@
             return 0;
     }
 
-    if (size >= current) {
-        *pbytes = size - current;
-        return 1;
-    } else {
-        return 0;
-    }
+    *pbytes = size - current;
+    return 1;
 }
 
 jint
diff --git a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c
index 80da504..5a95455 100644
--- a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c
+++ b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, 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
@@ -36,7 +36,6 @@
 #include "awt_p.h"
 
 #include <sun_awt_X11InputMethod.h>
-#include <sun_awt_X11_XComponentPeer.h>
 #include <sun_awt_X11_XInputMethod.h>
 
 #define THROW_OUT_OF_MEMORY_ERROR() \
diff --git a/jdk/src/solaris/native/sun/awt/fontpath.c b/jdk/src/solaris/native/sun/awt/fontpath.c
index 412c631..24146b9 100644
--- a/jdk/src/solaris/native/sun/awt/fontpath.c
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c
@@ -41,7 +41,6 @@
 #include <jni.h>
 #include <jni_util.h>
 #include <jvm_md.h>
-#include <sun_font_FontManager.h>
 #ifndef HEADLESS
 #include <X11/Xlib.h>
 #include <awt.h>
diff --git a/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c b/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
index 12a4f24..3d805c5 100644
--- a/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
+++ b/jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -104,6 +104,10 @@
     if (hModule == NULL) {
         systemErrorMessage = dlerror();
         exceptionMessage = (char *) malloc(sizeof(char) * (strlen(systemErrorMessage) + strlen(libraryNameStr) + 1));
+        if (exceptionMessage == NULL) {
+            throwOutOfMemoryError(env, 0);
+            return;
+        }
         strcpy(exceptionMessage, systemErrorMessage);
         strcat(exceptionMessage, libraryNameStr);
         throwIOException(env, exceptionMessage);
@@ -134,6 +138,11 @@
      * Get function pointers to all PKCS #11 functions
      */
     moduleData = (ModuleData *) malloc(sizeof(ModuleData));
+    if (moduleData == NULL) {
+        dlclose(hModule);
+        throwOutOfMemoryError(env, 0);
+        return;
+    }
     moduleData->hModule = hModule;
     moduleData->applicationMutexHandler = NULL;
     rv = (C_GetFunctionList)(&(moduleData->ckFunctionListPtr));
diff --git a/jdk/src/windows/back/linker_md.c b/jdk/src/windows/back/linker_md.c
index ad48d3d..52bf494 100644
--- a/jdk/src/windows/back/linker_md.c
+++ b/jdk/src/windows/back/linker_md.c
@@ -39,38 +39,27 @@
 #include "path_md.h"
 
 static void dll_build_name(char* buffer, size_t buflen,
-                           const char* pname, const char* fname) {
-    // Based on os_windows.cpp
+                           const char* paths, const char* fname) {
+    char *path, *paths_copy, *next_token;
 
-    char *path_sep = PATH_SEPARATOR;
-    char *pathname = (char *)pname;
-    *buffer = '\0';
-    while (strlen(pathname) > 0) {
-        char *p = strchr(pathname, *path_sep);
-        if (p == NULL) {
-            p = pathname + strlen(pathname);
-        }
-        /* check for NULL path */
-        if (p == pathname) {
-            continue;
-        }
-        if (*(p-1) == ':' || *(p-1) == '\\') {
-            (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname),
-                            pathname, fname);
-        } else {
-            (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname),
-                            pathname, fname);
-        }
+    paths_copy = strdup(paths);
+    if (paths_copy == NULL) {
+        return;
+    }
+
+    next_token = NULL;
+    path = strtok_s(paths_copy, PATH_SEPARATOR, &next_token);
+
+    while (path != NULL) {
+        _snprintf(buffer, buflen, "%s\\%s.dll", path, fname);
         if (_access(buffer, 0) == 0) {
             break;
         }
-        if (*p == '\0') {
-            pathname = p;
-        } else {
-            pathname = p + 1;
-        }
         *buffer = '\0';
+        path = strtok_s(NULL, PATH_SEPARATOR, &next_token);
     }
+
+    free(paths_copy);
 }
 
 /*
@@ -113,7 +102,7 @@
  * Build a machine dependent library name out of a path and file name.
  */
 void
-dbgsysBuildLibName(char *holder, int holderlen, char *pname, char *fname)
+dbgsysBuildLibName(char *holder, int holderlen, const char *pname, const char *fname)
 {
     const int pnamelen = pname ? (int)strlen(pname) : 0;
 
diff --git a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java
index 10888ed..0ac812d 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java
@@ -87,35 +87,35 @@
  */
 public class WDataTransferer extends DataTransferer {
     private static final String[] predefinedClipboardNames = {
-        "",
-        "TEXT",
-        "BITMAP",
-        "METAFILEPICT",
-        "SYLK",
-        "DIF",
-        "TIFF",
-        "OEM TEXT",
-        "DIB",
-        "PALETTE",
-        "PENDATA",
-        "RIFF",
-        "WAVE",
-        "UNICODE TEXT",
-        "ENHMETAFILE",
-        "HDROP",
-        "LOCALE",
-        "DIBV5"
+            "",
+            "TEXT",
+            "BITMAP",
+            "METAFILEPICT",
+            "SYLK",
+            "DIF",
+            "TIFF",
+            "OEM TEXT",
+            "DIB",
+            "PALETTE",
+            "PENDATA",
+            "RIFF",
+            "WAVE",
+            "UNICODE TEXT",
+            "ENHMETAFILE",
+            "HDROP",
+            "LOCALE",
+            "DIBV5"
     };
 
     private static final Map <String, Long> predefinedClipboardNameMap;
     static {
         Map <String,Long> tempMap =
-            new HashMap <> (predefinedClipboardNames.length, 1.0f);
+                new HashMap <> (predefinedClipboardNames.length, 1.0f);
         for (int i = 1; i < predefinedClipboardNames.length; i++) {
             tempMap.put(predefinedClipboardNames[i], Long.valueOf(i));
         }
         predefinedClipboardNameMap =
-            Collections.synchronizedMap(tempMap);
+                Collections.synchronizedMap(tempMap);
     }
 
     /**
@@ -138,18 +138,18 @@
     //CF_FILECONTENTS supported as mandatory associated clipboard
 
     private static final Long L_CF_LOCALE =
-      predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]);
+            predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]);
 
     private static final DirectColorModel directColorModel =
-        new DirectColorModel(24,
-                             0x00FF0000,  /* red mask   */
-                             0x0000FF00,  /* green mask */
-                             0x000000FF); /* blue mask  */
+            new DirectColorModel(24,
+                    0x00FF0000,  /* red mask   */
+                    0x0000FF00,  /* green mask */
+                    0x000000FF); /* blue mask  */
 
     private static final int[] bandmasks = new int[] {
-        directColorModel.getRedMask(),
-        directColorModel.getGreenMask(),
-        directColorModel.getBlueMask() };
+            directColorModel.getRedMask(),
+            directColorModel.getGreenMask(),
+            directColorModel.getBlueMask() };
 
     /**
      * Singleton constructor
@@ -171,10 +171,10 @@
     }
 
     public SortedMap <Long, DataFlavor> getFormatsForFlavors(
-        DataFlavor[] flavors, FlavorTable map)
+            DataFlavor[] flavors, FlavorTable map)
     {
         SortedMap <Long, DataFlavor> retval =
-            super.getFormatsForFlavors(flavors, map);
+                super.getFormatsForFlavors(flavors, map);
 
         // The Win32 native code does not support exporting LOCALE data, nor
         // should it.
@@ -191,32 +191,60 @@
                                         DataFlavor flavor,
                                         long format) throws IOException
     {
-        byte[] bytes = super.translateTransferable(contents, flavor, format);
-
+        byte[] bytes = null;
         if (format == CF_HTML) {
-            bytes = HTMLCodec.convertToHTMLFormat(bytes);
+            if (contents.isDataFlavorSupported(DataFlavor.selectionHtmlFlavor)) {
+                // if a user provides data represented by
+                // DataFlavor.selectionHtmlFlavor format, we use this
+                // type to store the data in the native clipboard
+                bytes = super.translateTransferable(contents,
+                        DataFlavor.selectionHtmlFlavor,
+                        format);
+            } else if (contents.isDataFlavorSupported(DataFlavor.allHtmlFlavor)) {
+                // if we cannot get data represented by the
+                // DataFlavor.selectionHtmlFlavor format
+                // but the DataFlavor.allHtmlFlavor format is avialable
+                // we belive that the user knows how to represent
+                // the data and how to mark up selection in a
+                // system specific manner. Therefor, we use this data
+                bytes = super.translateTransferable(contents,
+                        DataFlavor.allHtmlFlavor,
+                        format);
+            } else {
+                // handel other html flavor types, including custom and
+                // fragment ones
+                bytes = HTMLCodec.convertToHTMLFormat(bytes);
+            }
+        } else {
+            // we handle non-html types basing on  their
+            // flavors
+            bytes = super.translateTransferable(contents, flavor, format);
         }
         return bytes;
     }
 
-    protected Object translateBytesOrStream(InputStream str, byte[] bytes,
-                                            DataFlavor flavor, long format,
-                                            Transferable localeTransferable)
+    // The stream is closed as a closable object
+    public Object translateStream(InputStream str,
+                                 DataFlavor flavor, long format,
+                                 Transferable localeTransferable)
         throws IOException
     {
         if (format == CF_HTML && flavor.isFlavorTextType()) {
-            if (str == null) {
-                str = new ByteArrayInputStream(bytes);
-                bytes = null;
-            }
+            str = new HTMLCodec(str,
+                                 EHTMLReadMode.getEHTMLReadMode(flavor));
 
-            str = new HTMLCodec(str,  EHTMLReadMode.HTML_READ_SELECTION);
         }
+        return super.translateStream(str, flavor, format,
+                                        localeTransferable);
+
+    }
+
+    public Object translateBytes(byte[] bytes, DataFlavor flavor, long format,
+        Transferable localeTransferable) throws IOException
+    {
+
 
         if (format == CF_FILEGROUPDESCRIPTORA || format == CF_FILEGROUPDESCRIPTORW) {
-            if (null != str ) {
-                str.close();
-            }
             if (bytes == null || !DataFlavor.javaFileListFlavor.equals(flavor)) {
                 throw new IOException("data translation failed");
             }
@@ -238,28 +266,24 @@
         }
 
         if (format == CFSTR_INETURL &&
-            URL.class.equals(flavor.getRepresentationClass()))
+                URL.class.equals(flavor.getRepresentationClass()))
         {
-            if (bytes == null) {
-                bytes = inputStreamToByteArray(str);
-                str = null;
-            }
             String charset = getDefaultTextCharset();
             if (localeTransferable != null && localeTransferable.
-                isDataFlavorSupported(javaTextEncodingFlavor))
+                                                                    isDataFlavorSupported(javaTextEncodingFlavor))
             {
                 try {
                     charset = new String((byte[])localeTransferable.
-                                   getTransferData(javaTextEncodingFlavor),
-                                   "UTF-8");
+                        getTransferData(javaTextEncodingFlavor), "UTF-8");
                 } catch (UnsupportedFlavorException cannotHappen) {
                 }
             }
             return new URL(new String(bytes, charset));
         }
 
-        return super.translateBytesOrStream(str, bytes, flavor, format,
-                                            localeTransferable);
+        return super.translateBytes(bytes , flavor, format,
+                                        localeTransferable);
+
     }
 
     public boolean isLocaleDependentTextFormat(long format) {
@@ -280,18 +304,18 @@
 
     protected String getNativeForFormat(long format) {
         return (format < predefinedClipboardNames.length)
-            ? predefinedClipboardNames[(int)format]
-            : getClipboardFormatName(format);
+                ? predefinedClipboardNames[(int)format]
+                : getClipboardFormatName(format);
     }
 
     private final ToolkitThreadBlockedHandler handler =
-        new WToolkitThreadBlockedHandler();
+            new WToolkitThreadBlockedHandler();
 
     public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
         return handler;
     }
 
-   /**
+    /**
      * Calls the Win32 RegisterClipboardFormat function to register
      * a non-standard format.
      */
@@ -305,12 +329,12 @@
 
     public boolean isImageFormat(long format) {
         return format == CF_DIB || format == CF_ENHMETAFILE ||
-               format == CF_METAFILEPICT || format == CF_PNG ||
-               format == CF_JFIF;
+                format == CF_METAFILEPICT || format == CF_PNG ||
+                format == CF_JFIF;
     }
 
     protected byte[] imageToPlatformBytes(Image image, long format)
-      throws IOException {
+            throws IOException {
         String mimeType = null;
         if (format == CF_PNG) {
             mimeType = "image/png";
@@ -352,11 +376,11 @@
         int[] nBits = {8, 8, 8};
         int[] bOffs = {2, 1, 0};
         ColorModel colorModel =
-            new ComponentColorModel(cs, nBits, false, false,
-                                    Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
+                new ComponentColorModel(cs, nBits, false, false,
+                        Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
         WritableRaster raster =
-            Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height,
-                                           width * 3 + pad, 3, bOffs, null);
+                Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height,
+                        width * 3 + pad, 3, bOffs, null);
 
         BufferedImage bimage = new BufferedImage(colorModel, raster, false, null);
 
@@ -364,7 +388,7 @@
         // top-down DIBs.
         // So we flip the image vertically and create a bottom-up DIB.
         AffineTransform imageFlipTransform =
-            new AffineTransform(1, 0, 0, -1, 0, height);
+                new AffineTransform(1, 0, 0, -1, 0, height);
 
         Graphics2D g2d = bimage.createGraphics();
 
@@ -383,7 +407,7 @@
     private static final byte [] UNICODE_NULL_TERMINATOR =  new byte [] {0,0};
 
     protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList)
-        throws IOException
+            throws IOException
     {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
@@ -407,10 +431,10 @@
         return bos;
     }
 
-   /**
-    * Returns a byte array which contains data special for the given format
-    * and for the given image data.
-    */
+    /**
+     * Returns a byte array which contains data special for the given format
+     * and for the given image data.
+     */
     private native byte[] imageDataToPlatformImageBytes(byte[] imageData,
                                                         int width, int height,
                                                         long format);
@@ -419,10 +443,8 @@
      * Translates either a byte array or an input stream which contain
      * platform-specific image data in the given format into an Image.
      */
-    protected Image platformImageBytesOrStreamToImage(InputStream str,
-                                                      byte[] bytes,
-                                                      long format)
-      throws IOException {
+    protected Image platformImageBytesToImage(byte[] bytes, long format)
+            throws IOException {
         String mimeType = null;
         if (format == CF_PNG) {
             mimeType = "image/png";
@@ -430,11 +452,7 @@
             mimeType = "image/jpeg";
         }
         if (mimeType != null) {
-            return standardImageBytesOrStreamToImage(str, bytes, mimeType);
-        }
-
-        if (bytes == null) {
-            bytes = inputStreamToByteArray(str);
+            return standardImageBytesToImage(bytes, mimeType);
         }
 
         int[] imageData = platformImageBytesToImageData(bytes, format);
@@ -448,8 +466,8 @@
 
         DataBufferInt buffer = new DataBufferInt(imageData, len);
         WritableRaster raster = Raster.createPackedRaster(buffer, width,
-                                                          height, width,
-                                                          bandmasks, null);
+                height, width,
+                bandmasks, null);
 
         return new BufferedImage(directColorModel, raster, false, null);
     }
@@ -462,13 +480,13 @@
      */
     private native int[] platformImageBytesToImageData(byte[] bytes,
                                                        long format)
-      throws IOException;
+            throws IOException;
 
     protected native String[] dragQueryFile(byte[] bytes);
 }
 
 final class WToolkitThreadBlockedHandler extends Mutex
-                       implements ToolkitThreadBlockedHandler {
+        implements ToolkitThreadBlockedHandler {
 
     public void enter() {
         if (!isOwned()) {
@@ -492,7 +510,22 @@
 enum EHTMLReadMode {
     HTML_READ_ALL,
     HTML_READ_FRAGMENT,
-    HTML_READ_SELECTION
+    HTML_READ_SELECTION;
+
+    public static EHTMLReadMode getEHTMLReadMode (DataFlavor df) {
+
+        EHTMLReadMode mode = HTML_READ_SELECTION;
+
+        String parameter = df.getParameter("document");
+
+        if ("all".equals(parameter)) {
+            mode = HTML_READ_ALL;
+        } else if ("fragment".equals(parameter)) {
+            mode = HTML_READ_FRAGMENT;
+        }
+
+        return mode;
+    }
 }
 
 /**
@@ -581,26 +614,24 @@
                     htmlSuffix = "</BODY>" + htmlSuffix;
                 };
             };
-            htmlPrefix = htmlPrefix + START_FRAGMENT_CMT;
-            htmlSuffix = END_FRAGMENT_CMT + htmlSuffix;
         }
 
         String stBaseUrl = DEF_SOURCE_URL;
         int nStartHTML =
-            VERSION.length() + VERSION_NUM.length() + EOLN.length()
-            + START_HTML.length() + PADDED_WIDTH + EOLN.length()
-            + END_HTML.length() + PADDED_WIDTH + EOLN.length()
-            + START_FRAGMENT.length() + PADDED_WIDTH + EOLN.length()
-            + END_FRAGMENT.length() + PADDED_WIDTH + EOLN.length()
-            + SOURCE_URL.length() + stBaseUrl.length() + EOLN.length()
-            ;
+                VERSION.length() + VERSION_NUM.length() + EOLN.length()
+                        + START_HTML.length() + PADDED_WIDTH + EOLN.length()
+                        + END_HTML.length() + PADDED_WIDTH + EOLN.length()
+                        + START_FRAGMENT.length() + PADDED_WIDTH + EOLN.length()
+                        + END_FRAGMENT.length() + PADDED_WIDTH + EOLN.length()
+                        + SOURCE_URL.length() + stBaseUrl.length() + EOLN.length()
+                ;
         int nStartFragment = nStartHTML + htmlPrefix.length();
         int nEndFragment = nStartFragment + bytes.length - 1;
         int nEndHTML = nEndFragment + htmlSuffix.length();
 
         StringBuilder header = new StringBuilder(
-            nStartFragment
-            + START_FRAGMENT_CMT.length()
+                nStartFragment
+                        + START_FRAGMENT_CMT.length()
         );
         //header
         header.append(VERSION);
@@ -639,14 +670,14 @@
         }
 
         byte[] retval = new byte[headerBytes.length + bytes.length +
-                                 trailerBytes.length];
+                trailerBytes.length];
 
         System.arraycopy(headerBytes, 0, retval, 0, headerBytes.length);
         System.arraycopy(bytes, 0, retval, headerBytes.length,
-                       bytes.length - 1);
+                bytes.length - 1);
         System.arraycopy(trailerBytes, 0, retval,
-                         headerBytes.length + bytes.length - 1,
-                         trailerBytes.length);
+                headerBytes.length + bytes.length - 1,
+                trailerBytes.length);
         retval[retval.length-1] = 0;
 
         return retval;
@@ -659,7 +690,7 @@
     private boolean descriptionParsed = false;
     private boolean closed = false;
 
-     // InputStreamReader uses an 8K buffer. The size is not customizable.
+    // InputStreamReader uses an 8K buffer. The size is not customizable.
     public static final int BYTE_BUFFER_LEN = 8192;
 
     // CharToByteUTF8.getMaxBytesPerChar returns 3, so we should not buffer
@@ -667,30 +698,30 @@
     public static final int CHAR_BUFFER_LEN = BYTE_BUFFER_LEN / 3;
 
     private static final String FAILURE_MSG =
-        "Unable to parse HTML description: ";
+            "Unable to parse HTML description: ";
     private static final String INVALID_MSG =
-        " invalid";
+            " invalid";
 
     //HTML header mapping:
     private long   iHTMLStart,// StartHTML -- shift in array to the first byte after the header
-                   iHTMLEnd,  // EndHTML -- shift in array of last byte for HTML syntax analysis
-                   iFragStart,// StartFragment -- shift in array jast after <!--StartFragment-->
-                   iFragEnd,  // EndFragment -- shift in array before start <!--EndFragment-->
-                   iSelStart, // StartSelection -- shift in array of the first char in copied selection
-                   iSelEnd;   // EndSelection -- shift in array of the last char in copied selection
+            iHTMLEnd,  // EndHTML -- shift in array of last byte for HTML syntax analysis
+            iFragStart,// StartFragment -- shift in array jast after <!--StartFragment-->
+            iFragEnd,  // EndFragment -- shift in array before start <!--EndFragment-->
+            iSelStart, // StartSelection -- shift in array of the first char in copied selection
+            iSelEnd;   // EndSelection -- shift in array of the last char in copied selection
     private String stBaseURL; // SourceURL -- base URL for related referenses
     private String stVersion; // Version -- current supported version
 
     //Stream reader markers:
     private long iStartOffset,
-                 iEndOffset,
-                 iReadCount;
+            iEndOffset,
+            iReadCount;
 
     private EHTMLReadMode readMode;
 
     public HTMLCodec(
-        InputStream _bytestream,
-        EHTMLReadMode _readMode) throws IOException
+            InputStream _bytestream,
+            EHTMLReadMode _readMode) throws IOException
     {
         bufferedStream = new BufferedInputStream(_bytestream, BYTE_BUFFER_LEN);
         readMode = _readMode;
@@ -723,31 +754,31 @@
         // initialization of array offset pointers
         // to the same "uninitialized" state.
         iHTMLEnd =
-            iHTMLStart =
-                iFragEnd =
-                    iFragStart =
-                        iSelEnd =
-                            iSelStart = -1;
+                iHTMLStart =
+                        iFragEnd =
+                                iFragStart =
+                                        iSelEnd =
+                                                iSelStart = -1;
 
         bufferedStream.mark(BYTE_BUFFER_LEN);
         String astEntries[] = new String[] {
-            //common
-            VERSION,
-            START_HTML,
-            END_HTML,
-            START_FRAGMENT,
-            END_FRAGMENT,
-            //ver 1.0
-            START_SELECTION,
-            END_SELECTION,
-            SOURCE_URL
+                //common
+                VERSION,
+                START_HTML,
+                END_HTML,
+                START_FRAGMENT,
+                END_FRAGMENT,
+                //ver 1.0
+                START_SELECTION,
+                END_SELECTION,
+                SOURCE_URL
         };
         BufferedReader bufferedReader = new BufferedReader(
-            new InputStreamReader(
-                bufferedStream,
-                ENCODING
-            ),
-            CHAR_BUFFER_LEN
+                new InputStreamReader(
+                        bufferedStream,
+                        ENCODING
+                ),
+                CHAR_BUFFER_LEN
         );
         long iHeadSize = 0;
         long iCRSize = EOLN.length();
@@ -769,30 +800,30 @@
                 if( null!=stValue ) {
                     try{
                         switch( iEntry ){
-                        case 0:
-                            stVersion = stValue;
-                            break;
-                        case 1:
-                            iHTMLStart = Integer.parseInt(stValue);
-                            break;
-                        case 2:
-                            iHTMLEnd = Integer.parseInt(stValue);
-                            break;
-                        case 3:
-                            iFragStart = Integer.parseInt(stValue);
-                            break;
-                        case 4:
-                            iFragEnd = Integer.parseInt(stValue);
-                            break;
-                        case 5:
-                            iSelStart = Integer.parseInt(stValue);
-                            break;
-                        case 6:
-                            iSelEnd = Integer.parseInt(stValue);
-                            break;
-                        case 7:
-                            stBaseURL = stValue;
-                            break;
+                            case 0:
+                                stVersion = stValue;
+                                break;
+                            case 1:
+                                iHTMLStart = Integer.parseInt(stValue);
+                                break;
+                            case 2:
+                                iHTMLEnd = Integer.parseInt(stValue);
+                                break;
+                            case 3:
+                                iFragStart = Integer.parseInt(stValue);
+                                break;
+                            case 4:
+                                iFragEnd = Integer.parseInt(stValue);
+                                break;
+                            case 5:
+                                iSelStart = Integer.parseInt(stValue);
+                                break;
+                            case 6:
+                                iSelEnd = Integer.parseInt(stValue);
+                                break;
+                            case 7:
+                                stBaseURL = stValue;
+                                break;
                         };
                     } catch ( NumberFormatException e ) {
                         throw new IOException(FAILURE_MSG + astEntries[iEntry]+ " value " + e + INVALID_MSG);
@@ -816,19 +847,19 @@
 
         //one of possible modes
         switch( readMode ){
-        case HTML_READ_ALL:
-            iStartOffset = iHTMLStart;
-            iEndOffset = iHTMLEnd;
-            break;
-        case HTML_READ_FRAGMENT:
-            iStartOffset = iFragStart;
-            iEndOffset = iFragEnd;
-            break;
-        case HTML_READ_SELECTION:
-        default:
-            iStartOffset = iSelStart;
-            iEndOffset = iSelEnd;
-            break;
+            case HTML_READ_ALL:
+                iStartOffset = iHTMLStart;
+                iEndOffset = iHTMLEnd;
+                break;
+            case HTML_READ_FRAGMENT:
+                iStartOffset = iFragStart;
+                iEndOffset = iFragEnd;
+                break;
+            case HTML_READ_SELECTION:
+            default:
+                iStartOffset = iSelStart;
+                iEndOffset = iSelEnd;
+                break;
         }
 
         bufferedStream.reset();
diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
index 636dd79..9d05ddb 100644
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -32,7 +32,7 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImageOp;
 import java.lang.ref.WeakReference;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 import sun.java2d.ScreenUpdateManager;
 import sun.java2d.SurfaceData;
 import sun.java2d.loops.Blit;
@@ -48,8 +48,6 @@
 import static sun.java2d.pipe.BufferedOpCodes.*;
 import sun.java2d.windows.GDIWindowSurfaceData;
 
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 class D3DBlitLoops {
 
     static void register() {
@@ -179,12 +177,12 @@
      * createPackedParams().  (They are also used at the native level when
      * unpacking the params.)
      */
-    private static final int OFFSET_SRCTYPE = 16;
-    private static final int OFFSET_HINT    =  8;
-    private static final int OFFSET_TEXTURE =  3;
-    private static final int OFFSET_RTT     =  2;
-    private static final int OFFSET_XFORM   =  1;
-    private static final int OFFSET_ISOBLIT =  0;
+    @Native private static final int OFFSET_SRCTYPE = 16;
+    @Native private static final int OFFSET_HINT    =  8;
+    @Native private static final int OFFSET_TEXTURE =  3;
+    @Native private static final int OFFSET_RTT     =  2;
+    @Native private static final int OFFSET_XFORM   =  1;
+    @Native private static final int OFFSET_ISOBLIT =  0;
 
     /**
      * Packs the given parameters into a single int value in order to save
diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DContext.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DContext.java
index 9eb26b8..4de986c 100644
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DContext.java
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -25,7 +25,7 @@
 
 package sun.java2d.d3d;
 
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 import sun.java2d.pipe.BufferedContext;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
@@ -38,8 +38,6 @@
  * Note that the RenderQueue lock must be acquired before calling any of
  * the methods in this class.
  */
-/* No native methods here, but the constants are needed in the supporting JNI code */
-@GenerateNativeHeader
 class D3DContext extends BufferedContext {
 
     private final D3DGraphicsDevice device;
@@ -143,31 +141,29 @@
         return device;
     }
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     static class D3DContextCaps extends ContextCapabilities {
         /**
          * Indicates the presence of pixel shaders (v2.0 or greater).
          * This cap will only be set if the hardware supports the minimum number
          * of texture units.
          */
-        static final int CAPS_LCD_SHADER       = (FIRST_PRIVATE_CAP << 0);
+    @Native static final int CAPS_LCD_SHADER       = (FIRST_PRIVATE_CAP << 0);
         /**
          * Indicates the presence of pixel shaders (v2.0 or greater).
          * This cap will only be set if the hardware meets our
          * minimum requirements.
          */
-        static final int CAPS_BIOP_SHADER      = (FIRST_PRIVATE_CAP << 1);
+    @Native static final int CAPS_BIOP_SHADER      = (FIRST_PRIVATE_CAP << 1);
         /**
          * Indicates that the device was successfully initialized and can
          * be safely used.
          */
-        static final int CAPS_DEVICE_OK        = (FIRST_PRIVATE_CAP << 2);
+    @Native static final int CAPS_DEVICE_OK        = (FIRST_PRIVATE_CAP << 2);
         /**
          * Indicates that the device has all of the necessary capabilities
          * to support the Antialiasing Pixel Shader program.
          */
-        static final int CAPS_AA_SHADER        = (FIRST_PRIVATE_CAP << 3);
+    @Native static final int CAPS_AA_SHADER        = (FIRST_PRIVATE_CAP << 3);
 
         D3DContextCaps(int caps, String adapterId) {
             super(caps, adapterId);
diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DPaints.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DPaints.java
index a5661bd..53e5976 100644
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DPaints.java
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DPaints.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -33,7 +33,7 @@
 import java.awt.image.BufferedImage;
 import java.util.HashMap;
 import java.util.Map;
-import javax.tools.annotation.GenerateNativeHeader;
+import java.lang.annotation.Native;
 import sun.java2d.SunGraphics2D;
 import sun.java2d.SurfaceData;
 import sun.java2d.loops.CompositeType;
@@ -158,8 +158,6 @@
 
 /****************** Shared MultipleGradientPaint support ********************/
 
-    /* No native methods here, but the constants are needed in the supporting JNI code */
-    @GenerateNativeHeader
     private static abstract class MultiGradient extends D3DPaints {
 
         /**
@@ -170,7 +168,7 @@
          * all versions of the shader can be compiled for PS 2.0 hardware,
          * we need to cap this maximum value at 8.
          */
-        public static final int MULTI_MAX_FRACTIONS_D3D = 8;
+    @Native public static final int MULTI_MAX_FRACTIONS_D3D = 8;
 
         protected MultiGradient() {}
 
diff --git a/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java b/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
index afe980e8..fddffb9 100644
--- a/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
+++ b/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
@@ -303,9 +303,7 @@
                     dfs.setNaN(getNaN(langTag, dfs.getNaN()));
                     dfs.setPercent(getPercent(langTag, dfs.getPercent()));
                     dfs.setPerMill(getPerMill(langTag, dfs.getPerMill()));
-                    if (isNativeDigit(langTag)) {
-                        dfs.setZeroDigit(getZeroDigit(langTag, dfs.getZeroDigit()));
-                    }
+                    dfs.setZeroDigit(getZeroDigit(langTag, dfs.getZeroDigit()));
                     ref = new SoftReference<>(dfs);
                     decimalFormatSymbolsCache.put(locale, ref);
                 }
@@ -420,9 +418,13 @@
             return false;
         }
 
+        int calid = getCalendarID(locale.toLanguageTag());
+        if (calid <= 0 || calid >= calIDToLDML.length) {
+            return false;
+        }
+
         String requestedCalType = locale.getUnicodeLocaleType("ca");
-        String nativeCalType =
-                calIDToLDML[getCalendarID(locale.toLanguageTag())]
+        String nativeCalType = calIDToLDML[calid]
                 .replaceFirst("_.*", ""); // remove locale part.
 
         if (requestedCalType == null) {
diff --git a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c
index 4bd4a40..90e15ed 100644
--- a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c
+++ b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c
@@ -368,42 +368,32 @@
 }
 
 static void dll_build_name(char* buffer, size_t buflen,
-                           const char* pname, const char* fname) {
-    // Loosley based on os_windows.cpp
+                           const char* paths, const char* fname) {
+    char *path, *paths_copy, *next_token;
 
-    char *pathname = (char *)pname;
-    *buffer = '\0';
-    while (strlen(pathname) > 0) {
-        char *p = strchr(pathname, ';');
-        if (p == NULL) {
-            p = pathname + strlen(pathname);
-        }
-        /* check for NULL path */
-        if (p == pathname) {
-            continue;
-        }
-        if (*(p-1) == ':' || *(p-1) == '\\') {
-          (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname),
-                            pathname, fname);
-        } else {
-          (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname),
-                            pathname, fname);
-        }
+    paths_copy = strdup(paths);
+    if (paths_copy == NULL) {
+        return;
+    }
+
+    next_token = NULL;
+    path = strtok_s(paths_copy, ";", &next_token);
+
+    while (path != NULL) {
+        _snprintf(buffer, buflen, "%s\\%s.dll", path, fname);
         if (_access(buffer, 0) == 0) {
             break;
         }
-        if (*p == '\0') {
-            pathname = p;
-        } else {
-            pathname = p + 1;
-        }
         *buffer = '\0';
+        path = strtok_s(NULL, ";", &next_token);
     }
+
+    free(paths_copy);
 }
 
 /* Build a machine dependent library name out of a path and file name.  */
 void
-md_build_library_name(char *holder, int holderlen, char *pname, char *fname)
+md_build_library_name(char *holder, int holderlen, const char *pname, const char *fname)
 {
     int   pnamelen;
 
diff --git a/jdk/src/windows/native/sun/java2d/d3d/D3DContext.h b/jdk/src/windows/native/sun/java2d/d3d/D3DContext.h
index 8075c41..48defe1 100644
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DContext.h
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DContext.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -28,7 +28,6 @@
 
 #include "java_awt_Transparency.h"
 #include "sun_java2d_pipe_BufferedContext.h"
-#include "sun_java2d_d3d_D3DContext.h"
 #include "sun_java2d_d3d_D3DContext_D3DContextCaps.h"
 #include "sun_java2d_d3d_D3DSurfaceData.h"
 #include "sun_java2d_pipe_hw_AccelDeviceEventNotifier.h"
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.h b/jdk/src/windows/native/sun/windows/awt_Component.h
index 8ce8fa3..815843f 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.h
+++ b/jdk/src/windows/native/sun/windows/awt_Component.h
@@ -37,7 +37,6 @@
 #include "java_awt_Component.h"
 #include "sun_awt_windows_WComponentPeer.h"
 #include "java_awt_event_KeyEvent.h"
-#include "java_awt_event_FocusEvent.h"
 #include "java_awt_event_MouseEvent.h"
 #include "java_awt_event_WindowEvent.h"
 #include "java_awt_Dimension.h"
diff --git a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp
index 2d585e0..21c3b17 100644
--- a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, 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
@@ -52,7 +52,6 @@
 
 #include "java_awt_event_InputEvent.h"
 #include "java_awt_dnd_DnDConstants.h"
-#include "sun_awt_dnd_SunDragSourceContextPeer.h"
 #include "sun_awt_windows_WDragSourceContextPeer.h"
 
 #include "awt_ole.h"
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
index 41c5624..5d344e7 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -34,7 +34,6 @@
 #include <windowsx.h>
 
 #include <java_lang_Integer.h>
-#include <sun_awt_EmbeddedFrame.h>
 #include <sun_awt_windows_WEmbeddedFrame.h>
 #include <sun_awt_windows_WEmbeddedFramePeer.h>
 
diff --git a/jdk/src/windows/native/sun/windows/awt_List.h b/jdk/src/windows/native/sun/windows/awt_List.h
index 3751b02..585eed9 100644
--- a/jdk/src/windows/native/sun/windows/awt_List.h
+++ b/jdk/src/windows/native/sun/windows/awt_List.h
@@ -28,7 +28,6 @@
 
 #include "awt_Component.h"
 
-#include "java_awt_List.h"
 #include "sun_awt_windows_WListPeer.h"
 
 
diff --git a/jdk/src/windows/native/sun/windows/awt_PopupMenu.cpp b/jdk/src/windows/native/sun/windows/awt_PopupMenu.cpp
index dee95e2..05fc30d 100644
--- a/jdk/src/windows/native/sun/windows/awt_PopupMenu.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_PopupMenu.cpp
@@ -28,7 +28,6 @@
 #include "awt_Event.h"
 #include "awt_Window.h"
 
-#include <java_awt_PopupMenu.h>
 #include <sun_awt_windows_WPopupMenuPeer.h>
 #include <java_awt_Event.h>
 
diff --git a/jdk/src/windows/native/sun/windows/awt_PopupMenu.h b/jdk/src/windows/native/sun/windows/awt_PopupMenu.h
index ab82768..112645e 100644
--- a/jdk/src/windows/native/sun/windows/awt_PopupMenu.h
+++ b/jdk/src/windows/native/sun/windows/awt_PopupMenu.h
@@ -30,7 +30,6 @@
 
 #include <java_awt_MenuItem.h>
 #include <sun_awt_windows_WMenuItemPeer.h>
-#include <java_awt_PopupMenu.h>
 #include <sun_awt_windows_WPopupMenuPeer.h>
 
 
diff --git a/jdk/src/windows/native/sun/windows/awt_TextComponent.h b/jdk/src/windows/native/sun/windows/awt_TextComponent.h
index cc0fc97..e293e09 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextComponent.h
+++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.h
@@ -28,7 +28,6 @@
 
 #include "awt_Component.h"
 
-#include "java_awt_TextComponent.h"
 #include "sun_awt_windows_WTextComponentPeer.h"
 
 #include <ole2.h>
diff --git a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp
index e8b2d51..8a3ed22 100644
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -62,7 +62,6 @@
 
 #include <java_awt_Toolkit.h>
 #include <java_awt_event_InputMethodEvent.h>
-#include <java_awt_peer_ComponentPeer.h>
 
 extern void initScreens(JNIEnv *env);
 extern "C" void awt_dnd_initialize();
diff --git a/jdk/test/Makefile b/jdk/test/Makefile
index 2b4bfa1..cb8a2e8 100644
--- a/jdk/test/Makefile
+++ b/jdk/test/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 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
@@ -336,7 +336,7 @@
 	@$(ECHO) "Testing completed successfully"
 
 # Prep for output
-prep: clean
+prep:
 	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
 	@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
 
@@ -704,200 +704,6 @@
 
 ################################################################
 
-# packtest
-
-# Expect JPRT to set JPRT_PACKTEST_HOME.
-PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest
-ifdef JPRT_PACKTEST_HOME
-  PACKTEST_HOME = $(JPRT_PACKTEST_HOME)
-endif
-
-packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME)
-	( $(CD) $(PACKTEST_HOME) &&            \
-	    $(PACKTEST_HOME)/ptest             \
-		 -t "$(PRODUCT_HOME)"          \
-	         $(PACKTEST_STRESS_OPTION)     \
-		 $(EXTRA_PACKTEST_OPTIONS)     \
-		 -W $(ABS_TEST_OUTPUT_DIR)     \
-                 $(JAVA_ARGS:%=-J %)           \
-                 $(JAVA_VM_ARGS:%=-J %)        \
-	 ) ; $(BUNDLE_UP_AND_EXIT)
-
-packtest_stress: PACKTEST_STRESS_OPTION=-s
-packtest_stress: packtest
-
-PHONY_LIST += packtest packtest_stress
-
-################################################################
-
-# perftest to collect statistics
-
-# Expect JPRT to set JPRT_PACKTEST_HOME.
-PERFTEST_HOME = $(TEST_ROOT)/perf
-ifdef JPRT_PERFTEST_HOME
-  PERFTEST_HOME = $(JPRT_PERFTEST_HOME)
-endif
-
-perftest: ( $(PERFTEST_HOME)/perftest          \
-                 -t $(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")               \
-                 -w $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)") \
-                 -h $(PERFTEST_HOME) \
-	 ) ; $(BUNDLE_UP_AND_EXIT)
-
-
-PHONY_LIST += perftest
-
-################################################################
-
-# vmsqe tests
-
-# Expect JPRT to set JPRT_VMSQE_HOME.
-VMSQE_HOME = $(SLASH_JAVA)/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm
-ifdef JPRT_VMSQE_HOME
-  VMSQE_HOME = $(JPRT_VMSQE_HOME)
-endif
-
-# Expect JPRT to set JPRT_RUNVMSQE_HOME.
-RUNVMSQE_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/runvmsqe
-ifdef JPRT_RUNVMSQE_HOME
-  RUNVMSQE_HOME = $(JPRT_RUNVMSQE_HOME)
-endif
-
-# Expect JPRT to set JPRT_TONGA3_HOME.
-TONGA3_HOME = $(SLASH_JAVA)/sqe/tools/gtee/harness/tonga
-ifdef JPRT_TONGA3_HOME
-  TONGA3_HOME = $(JPRT_TONGA3_HOME)
-endif
-
-RUNVMSQE_BIN = $(RUNVMSQE_HOME)/bin/runvmsqe
-
-vmsqe_tests: prep $(VMSQE_HOME)/vm $(TONGA3_HOME) $(RUNVMSQE_BIN) $(PRODUCT_HOME)
-	$(RM) -r $(ABS_TEST_OUTPUT_DIR)/vmsqe
-	( $(CD) $(ABS_TEST_OUTPUT_DIR) &&          \
-	    $(RUNVMSQE_BIN)                        \
-		 -jdk "$(PRODUCT_HOME)"            \
-		 -o "$(ABS_TEST_OUTPUT_DIR)/vmsqe" \
-		 -testbase "$(VMSQE_HOME)/vm"      \
-		 -tonga "$(TONGA3_HOME)"           \
-		 -tongajdk "$(ALT_BOOTDIR)"        \
-                 $(JAVA_ARGS)                      \
-                 $(JAVA_VM_ARGS)                   \
-	         $(RUNVMSQE_TEST_OPTION)           \
-		 $(EXTRA_RUNVMSQE_OPTIONS)         \
-	 ) ; $(BUNDLE_UP_AND_EXIT)
-
-vmsqe_jdwp: RUNVMSQE_TEST_OPTION=-jdwp
-vmsqe_jdwp: vmsqe_tests
-
-vmsqe_jdi: RUNVMSQE_TEST_OPTION=-jdi
-vmsqe_jdi: vmsqe_tests
-
-vmsqe_jdb: RUNVMSQE_TEST_OPTION=-jdb
-vmsqe_jdb: vmsqe_tests
-
-vmsqe_quick-jdi: RUNVMSQE_TEST_OPTION=-quick-jdi
-vmsqe_quick-jdi: vmsqe_tests
-
-vmsqe_sajdi: RUNVMSQE_TEST_OPTION=-sajdi
-vmsqe_sajdi: vmsqe_tests
-
-vmsqe_jvmti: RUNVMSQE_TEST_OPTION=-jvmti
-vmsqe_jvmti: vmsqe_tests
-
-vmsqe_hprof: RUNVMSQE_TEST_OPTION=-hprof
-vmsqe_hprof: vmsqe_tests
-
-vmsqe_monitoring: RUNVMSQE_TEST_OPTION=-monitoring
-vmsqe_monitoring: vmsqe_tests
-
-PHONY_LIST += vmsqe_jdwp vmsqe_jdi vmsqe_jdb vmsqe_quick-jdi vmsqe_sajdi \
-              vmsqe_jvmti vmsqe_hprof vmsqe_monitoring vmsqe_tests
-
-################################################################
-
-# jck tests
-
-# Default is to use jck 7 from /java/re
-JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
-
-# Expect JPRT to set JPRT_JCK7COMPILER_HOME.
-JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-7
-ifdef JPRT_JCK7COMPILER_HOME
-  JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)/JCK-compiler-7
-endif
-
-# Expect JPRT to set JPRT_JCK7RUNTIME_HOME.
-JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-7
-ifdef JPRT_JCK7RUNTIME_HOME
-  JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)/JCK-runtime-7
-endif
-
-# Expect JPRT to set JPRT_JCK7DEVTOOLS_HOME.
-JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-7
-ifdef JPRT_JCK7DEVTOOLS_HOME
-  JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)/JCK-devtools-7
-endif
-
-# The jtjck.jar utility to use to run the tests
-JTJCK_JAR = $(JCK_HOME)/lib/jtjck.jar
-JTJCK_JAVA_ARGS =  -XX:MaxPermSize=256m -Xmx512m
-JTJCK_OPTIONS = -headless -v
-
-# Default tests to run
-ifndef JCK_COMPILER_TESTS
-  JCK_COMPILER_TESTS =
-endif
-ifndef JCK_RUNTIME_TESTS
-  JCK_RUNTIME_TESTS  =
-endif
-ifndef JCK_DEVTOOLS_TESTS
-  JCK_DEVTOOLS_TESTS =
-endif
-
-# Generic rule used to run jck tests
-_generic_jck_tests: prep $(PRODUCT_HOME) $(EXCLUDELIST)
-	@$(EXPAND) $(EXCLUDELIST) \
-            | $(CUT) -d' ' -f1 \
-            | $(SED) -e 's@^@Excluding: @'
-	( $(CD) $(ABS_TEST_OUTPUT_DIR) &&          			   \
-	  $(PRODUCT_HOME)/bin/java $(JTJCK_JAVA_ARGS) 			   \
-	    -jar "$(JTJCK_JAR)" 					   \
-	    $(JTJCK_OPTIONS) 						   \
-            -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \
-            -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork    \
-            -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
-	    $(TESTDIRS) 						   \
-        ) ; $(BUNDLE_UP_AND_EXIT)
-
-# JCK7 compiler tests
-jck7compiler:
-	$(MAKE) UNIQUE_DIR=$@ \
-	        JCK_HOME=$(JCK7COMPILER_HOME) \
-	        TESTDIRS="$(JCK_COMPILER_TESTS)" \
-                _generic_jck_tests
-
-# JCK7 runtime tests
-jck7runtime:
-	$(MAKE) UNIQUE_DIR=$@ \
-	        JCK_HOME=$(JCK7RUNTIME_HOME) \
-	        TESTDIRS="$(JCK_RUNTIME_TESTS)" \
-                _generic_jck_tests
-
-# JCK7 devtools tests
-jck7devtools:
-	$(MAKE) UNIQUE_DIR=$@ \
-	        JCK_HOME=$(JCK7DEVTOOLS_HOME) \
-                TESTDIRS="$(JCK_DEVTOOLS_TESTS)" \
-                _generic_jck_tests
-
-# Run all 3 sets of JCK7 tests
-jck_all: jck7runtime jck7devtools jck7compiler
-
-PHONY_LIST += jck_all _generic_jck_tests \
-	      jck7compiler jck7runtime jck7devtools
-
-################################################################
-
 # Phony targets (e.g. these are not filenames)
 .PHONY: all clean prep $(PHONY_LIST)
 
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 90d2982..d139754 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -339,23 +339,6 @@
 # 8007410
 tools/launcher/FXLauncherTest.java                              linux-all
 
-# 8004172
-sun/tools/jstat/jstatGcCapacityOutput1.sh                       generic-all
-sun/tools/jstat/jstatGcCauseOutput1.sh                          generic-all
-sun/tools/jstat/jstatGcOldOutput1.sh                            generic-all
-sun/tools/jstat/jstatGcOutput1.sh                               generic-all
-sun/tools/jstat/jstatGcPermCapacityOutput1.sh                   generic-all
-sun/tools/jstat/jstatLineCounts1.sh                             generic-all
-sun/tools/jstat/jstatLineCounts2.sh                             generic-all
-sun/tools/jstat/jstatLineCounts3.sh                             generic-all
-sun/tools/jstat/jstatLineCounts4.sh                             generic-all
-sun/tools/jstat/jstatOptions1.sh                                generic-all
-sun/tools/jstat/jstatTimeStamp1.sh                              generic-all
-sun/tools/jstatd/jstatdExternalRegistry.sh                      generic-all
-sun/tools/jstatd/jstatdDefaults.sh                              generic-all
-sun/tools/jstatd/jstatdPort.sh                                  generic-all
-sun/tools/jstatd/jstatdServerName.sh                            generic-all
-
 ############################################################################
 
 # jdk_jdi
diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java
new file mode 100644
index 0000000..fa2206b
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java
@@ -0,0 +1,188 @@
+/*
+ * 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 7075105
+  @summary WIN: Provide a way to format HTML on drop
+  @author Denis Fokin: area=datatransfer
+  @build HtmlTransferable PutAllHtmlFlavorsOnClipboard
+  @build PutOnlyAllHtmlFlavorOnClipboard PutSelectionAndFragmentHtmlFlavorsOnClipboard
+  @run main HTMLDataFlavorTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.io.*;
+import java.util.HashMap;
+
+public class HTMLDataFlavorTest {
+
+    private static HashMap<DataFlavor, String> dataFlavors = new HashMap<DataFlavor, String>();
+
+
+    public static void main(String[] args) throws IOException, UnsupportedFlavorException {
+
+        dataFlavors.put(DataFlavor.allHtmlFlavor, HtmlTransferable.ALL_HTML_AS_STRING);
+        dataFlavors.put(DataFlavor.fragmentHtmlFlavor, HtmlTransferable.FRAGMENT_HTML_AS_STRING);
+        dataFlavors.put(DataFlavor.selectionHtmlFlavor, HtmlTransferable.SELECTION_HTML_AS_STRING);
+
+        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+        resetClipboardContent(clipboard);
+
+        // 1. Put all three html flavors on clipboard.
+        //    Get the data within the same JVM
+        //    Expect that the resulted html is the selection
+        //    wrapped in all three types
+
+        clipboard.setContents(new HtmlTransferable(HtmlTransferable.htmlDataFlavors),null);
+
+        // Test local transfer
+        testClipboardContent(clipboard, HtmlTransferable.htmlDataFlavors);
+
+        resetClipboardContent(clipboard);
+
+        // 2. Put only DataFlavor.allHtmlFlavor on clipboard.
+        //    Expect that the resulted html is the all
+        //    wrapped in all three types
+
+        putHtmlInAnotherProcess("PutOnlyAllHtmlFlavorOnClipboard");
+
+        for (DataFlavor df : HtmlTransferable.htmlDataFlavors) {
+            if (!clipboard.isDataFlavorAvailable(df)) {
+                throw new RuntimeException("The data should be available.");
+            }
+        }
+
+        if (!clipboard.getData(DataFlavor.allHtmlFlavor).toString().
+                equals(dataFlavors.get(DataFlavor.allHtmlFlavor).toString()))
+        {
+            throw new RuntimeException("DataFlavor.allHtmlFlavor data " +
+                    "should be identical to the data put on the source side.");
+        }
+
+        resetClipboardContent(clipboard);
+
+        // 3. Put all three html flavors on clipboard.
+        //    Expect that the resulted html is the selection
+        //    wrapped in all three types
+
+        putHtmlInAnotherProcess("PutAllHtmlFlavorsOnClipboard");
+
+        for (DataFlavor df : HtmlTransferable.htmlDataFlavors) {
+            if (!clipboard.isDataFlavorAvailable(df)) {
+                throw new RuntimeException("The data should be available.");
+            }
+        }
+
+        if (!clipboard.getData(DataFlavor.selectionHtmlFlavor).toString().
+                equals(dataFlavors.get(DataFlavor.selectionHtmlFlavor)))
+        {
+            throw new RuntimeException("DataFlavor.allHtmlFlavor data " +
+                    "should be identical to the data put on the source side.");
+        }
+
+    }
+
+    private static void resetClipboardContent(Clipboard clipboard) {
+        clipboard.setContents(
+                new StringSelection("The data is used to empty the clipboard content"
+                ),null);
+    }
+
+
+    private static void putHtmlInAnotherProcess(String putterCommand) {
+        try {
+
+            String command = System.getProperty("java.home") + "/bin/java -cp " +
+                    System.getProperty("test.classes", ".") + " "  +
+                    putterCommand;
+
+            System.out.println("Execute process : " + command);
+
+            Process p = Runtime.getRuntime().exec(command);
+
+            try {
+                p.waitFor();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            System.out.println("The data has been set remotely");
+
+            try (BufferedReader stdstr = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
+                String s;
+                while ((s = stdstr.readLine()) != null) {
+                    s = stdstr.readLine();
+                    System.out.println(s);
+                }
+            }
+
+            try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getErrorStream()))) {
+                String s;
+                while ((s = br.readLine()) != null) {
+                    s = br.readLine();
+                    System.err.println(s);
+                }
+            }
+
+
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void testClipboardContent(Clipboard clipboard,
+                                             DataFlavor [] expectedDataFlavors)
+            throws UnsupportedFlavorException, IOException {
+
+        for (DataFlavor df : clipboard.getAvailableDataFlavors()) {
+            System.out.println("available df: " + df.getMimeType());
+        }
+
+        for (DataFlavor df : expectedDataFlavors) {
+
+            if (!clipboard.isDataFlavorAvailable(df)) {
+                throw new RuntimeException("The data should be available.");
+            }
+
+
+            System.out.println("Checking \"" + df.getParameter("document") + "\" for correspondence");
+
+            if (!dataFlavors.get(df).toString().equals(clipboard.getData(df).toString())) {
+
+                System.err.println("Expected data: " + dataFlavors.get(df).toString());
+                System.err.println("Actual data: " + clipboard.getData(df).toString());
+
+
+                throw new RuntimeException("An html flavor with parameter \"" +
+                        df.getParameter("document") + "\" does not correspond to the transferred data.");
+
+
+            }
+        }
+    }
+
+
+}
diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HtmlTransferable.java b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HtmlTransferable.java
new file mode 100644
index 0000000..6b80f2b
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HtmlTransferable.java
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+
+/**
+ * A transferable that mimic ie html data
+ */
+class HtmlTransferable implements Transferable {
+
+    final static String SOURCE_HTML = "<html><head><title>Simple html content</title></head>" +
+            "<body><ol><li>Dasha</li><li>Masha</li><li>Lida</li></ol></body></html>";
+
+    // Data identical to ie output for the next html without end of lines,
+    // that is gotten by java system clipboard
+    // <html>
+    // <head>
+    // <title>Simple html content</title>
+    // </head>
+    // <body>
+    // <ol>
+    // <li>Dasha</li>
+    // <li>Masha</li>
+    // <li>Lida</li>
+    // </ol>
+    // </body>
+    // </html>
+
+    final static String ALL_HTML_AS_STRING = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" +
+            "\n" +
+            "<HTML><HEAD><TITLE>Simple html content</TITLE></HEAD>\n" +
+            "\n" +
+            "<BODY>\n" +
+            "\n" +
+            "<OL><!--StartFragment--><LI>Masha\n" +
+            "<LI>Lida</LI><!--EndFragment--></OL>\n" +
+            "</BODY>\n" +
+            "</HTML>";
+
+    final static String FRAGMENT_HTML_AS_STRING = "<LI>Masha\n" +
+            "<LI>Lida</LI>";
+
+    final static String SELECTION_HTML_AS_STRING =  "<LI>Masha" +
+            "<LI>Lida</LI>";
+
+    private DataFlavor[] supportedDataFlavors;
+
+    final static DataFlavor[] htmlDataFlavors = new DataFlavor [] {
+            DataFlavor.allHtmlFlavor,
+            DataFlavor.fragmentHtmlFlavor,
+            DataFlavor.selectionHtmlFlavor
+    };
+
+    @Override
+    public DataFlavor[] getTransferDataFlavors() {
+        return supportedDataFlavors;
+    }
+
+    @Override
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        for (DataFlavor supportedDataFlavor : supportedDataFlavors) {
+            if (supportedDataFlavor.equals(flavor)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    HtmlTransferable(DataFlavor[] supportedDataFlavors) {
+        this.supportedDataFlavors = supportedDataFlavors;
+    }
+
+    @Override
+    public Object getTransferData(DataFlavor flavor)
+            throws UnsupportedFlavorException, IOException {
+
+        if (isDataFlavorSupported(flavor)) {
+            if (flavor.equals(DataFlavor.allHtmlFlavor)) {
+                return ALL_HTML_AS_STRING;
+            } else if (flavor.equals(DataFlavor.fragmentHtmlFlavor)) {
+                return FRAGMENT_HTML_AS_STRING;
+            } else if (flavor.equals(DataFlavor.selectionHtmlFlavor)) {
+                return SELECTION_HTML_AS_STRING;
+            }
+        }
+
+        throw new UnsupportedFlavorException(flavor);
+    }
+
+}
diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html
new file mode 100644
index 0000000..ddf65b4
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html
@@ -0,0 +1,20 @@
+<html>
+<!--  
+  @test
+  @bug 7075105
+  @summary WIN: Provide a way to format HTML on drop
+  @author Denis Fokin area=datatransfer
+  @run applet/manual=yesno ManualHTMLDataFlavorTest.html
+  -->
+<head>
+<title>ManualHTMLDataFlavorTest</title>
+</head>
+<body>
+
+<h1>ManualHTMLDataFlavorTest<br>Bug ID: 7075105</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ManualHTMLDataFlavorTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java
new file mode 100644
index 0000000..156bbe4
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java
@@ -0,0 +1,292 @@
+/*
+ * 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 7075105
+  @summary WIN: Provide a way to format HTML on drop
+  @author Denis Fokin: area=datatransfer
+  @run applet/manual=yesno ManualHTMLDataFlavorTest
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.*;
+import java.io.IOException;
+
+public class ManualHTMLDataFlavorTest extends Applet {
+
+    class DropPane extends Panel implements DropTargetListener {
+
+        DropPane() {
+            requestFocus();
+            setBackground(Color.red);
+            setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY, this));
+        }
+
+        @Override
+        public Dimension getPreferredSize() {
+            return new Dimension(200,200);
+        }
+
+        @Override
+        public void dragEnter(DropTargetDragEvent dtde) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+
+        @Override
+        public void dragOver(DropTargetDragEvent dtde) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+
+        @Override
+        public void dropActionChanged(DropTargetDragEvent dtde) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+
+        @Override
+        public void dragExit(DropTargetEvent dte) {}
+
+        @Override
+        public void drop(DropTargetDropEvent dtde) {
+            if (!dtde.isDataFlavorSupported(DataFlavor.allHtmlFlavor)) {
+                Sysout.println("DataFlavor.allHtmlFlavor is not present in the system clipboard");
+                dtde.rejectDrop();
+                return;
+            } else if (!dtde.isDataFlavorSupported(DataFlavor.fragmentHtmlFlavor)) {
+                Sysout.println("DataFlavor.fragmentHtmlFlavor is not present in the system clipboard");
+                dtde.rejectDrop();
+                return;
+            } else if (!dtde.isDataFlavorSupported(DataFlavor.selectionHtmlFlavor)) {
+                Sysout.println("DataFlavor.selectionHtmlFlavor is not present in the system clipboard");
+                dtde.rejectDrop();
+                return;
+            }
+
+            dtde.acceptDrop(DnDConstants.ACTION_COPY);
+
+            Transferable t = dtde.getTransferable();
+            try {
+                Sysout.println("ALL:");
+                Sysout.println(t.getTransferData(DataFlavor.allHtmlFlavor).toString());
+                Sysout.println("FRAGMENT:");
+                Sysout.println(t.getTransferData(DataFlavor.fragmentHtmlFlavor).toString());
+                Sysout.println("SELECTION:");
+                Sysout.println(t.getTransferData(DataFlavor.selectionHtmlFlavor).toString());
+            } catch (UnsupportedFlavorException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+    public void init() {
+
+        String[] instructions =
+            {
+                "1) The test contains a drop-aware panel with a red background",
+                "2) Open some page in a browser, select some text",
+                "   Drag and drop it on the red panel",
+                "   IMPORTANT NOTE: the page should be stored locally.",
+                "   otherwise for instance iexplore can prohibit drag and drop from",
+                "   the browser to other applications because of",
+                "   the protected mode restrictions.",
+                "3) Check the data in the output area of this dialog",
+                "5) The output should not contain information that any of",
+                "   flavors is not present in the system clipboard",
+                "6) The output should contain data in three different formats",
+                "   provided by the system clipboard",
+                "    - Data after the \"ALL:\" marker should include the data",
+                "      from the the \"SELECTION:\" marker",
+                "    - Data after the \"FRAGMENT\" marker should include the data",
+                "      from the \"SELECTION:\" marker and may be some closing",
+                "      tags could be added to the mark-up",
+                "    - Data after the \"SELECTION:\" marker should correspond",
+                "      to the data selected in the browser",
+                "7) If the above requirements are met, the test is passed"
+            };
+
+        add(new DropPane());
+        Sysout.createDialogWithInstructions( instructions );
+
+        new ManualHTMLDataFlavorTest();
+    }
+
+    public void start ()
+    {
+        setSize (200,200);
+        setVisible(true);
+        validate();
+
+    }// start()
+
+}
+
+
+/* Place other classes related to the test after this line */
+
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+ This is part of the standard test machinery.  It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                                                     lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutAllHtmlFlavorsOnClipboard.java b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutAllHtmlFlavorsOnClipboard.java
new file mode 100644
index 0000000..8cf9916
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutAllHtmlFlavorsOnClipboard.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+
+import java.awt.*;
+
+public class PutAllHtmlFlavorsOnClipboard {
+    public static void main(String[] args) {
+        System.out.println("PutAllHtmlFlavorsOnClipboard has been started.");
+        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
+                new HtmlTransferable(HtmlTransferable.htmlDataFlavors), null);
+        System.out.println("Data has been put on clipboard in a separate process");
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutOnlyAllHtmlFlavorOnClipboard.java b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutOnlyAllHtmlFlavorOnClipboard.java
new file mode 100644
index 0000000..9365961
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutOnlyAllHtmlFlavorOnClipboard.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+
+public class PutOnlyAllHtmlFlavorOnClipboard {
+    public static void main(String[] args) {
+        System.out.println("PutOnlyAllHtmlFlavorOnClipboard has been started.");
+        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
+                new HtmlTransferable(new DataFlavor[]{DataFlavor.allHtmlFlavor}), null);
+        System.out.println("Data has been put on clipboard in a separate process");
+    }
+}
diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutSelectionAndFragmentHtmlFlavorsOnClipboard.java b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutSelectionAndFragmentHtmlFlavorsOnClipboard.java
new file mode 100644
index 0000000..35194c9
--- /dev/null
+++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/PutSelectionAndFragmentHtmlFlavorsOnClipboard.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+
+public class PutSelectionAndFragmentHtmlFlavorsOnClipboard {
+    public static void main(String[] args) {
+        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
+                new HtmlTransferable(new DataFlavor[]{DataFlavor.selectionHtmlFlavor,
+                        DataFlavor.fragmentHtmlFlavor}), null);
+    }
+}
diff --git a/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java b/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
new file mode 100644
index 0000000..05cd0d5
--- /dev/null
+++ b/jdk/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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 @summary JVM crash if the frame is disposed in DropTargetListener
+ * @author Petr Pchelko
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile DisposeFrameOnDragTest.java
+ * @run main/othervm DisposeFrameOnDragTest
+ */
+import java.awt.AWTException;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.dnd.DropTargetAdapter;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.event.InputEvent;
+import java.lang.reflect.InvocationTargetException;
+import java.util.TooManyListenersException;
+import javax.swing.JFrame;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
+
+public class DisposeFrameOnDragTest {
+
+    private static JTextArea textArea;
+
+    public static void main(String[] args) throws Throwable {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                constructTestUI();
+            }
+        });
+
+        Util.waitForIdle(null);
+        try {
+            Point loc = textArea.getLocationOnScreen();
+            Util.drag(new Robot(),
+                    new Point((int) loc.x + 3, (int) loc.y + 3),
+                    new Point((int) loc.x + 40, (int) loc.y + 40),
+                    InputEvent.BUTTON1_MASK);
+        } catch (AWTException ex) {
+            throw new RuntimeException("Could not initiate a drag operation");
+        }
+        Util.waitForIdle(null);
+    }
+
+    private static void constructTestUI() {
+        final JFrame frame = new JFrame("Test frame");
+        textArea = new JTextArea("Drag Me!");
+        try {
+            textArea.getDropTarget().addDropTargetListener(new DropTargetAdapter() {
+                @Override
+                public void drop(DropTargetDropEvent dtde) {
+                    //IGNORE
+                }
+
+                @Override
+                public void dragOver(DropTargetDragEvent dtde) {
+                    frame.dispose();
+                }
+            });
+        } catch (TooManyListenersException ex) {
+            throw new RuntimeException(ex);
+        }
+        textArea.setSize(100, 100);
+        textArea.setDragEnabled(true);
+        textArea.select(0, textArea.getText().length());
+        frame.add(textArea);
+        frame.setBounds(100, 100, 100, 100);
+        frame.setVisible(true);
+    }
+}
diff --git a/jdk/test/java/io/FileInputStream/NegativeAvailable.java b/jdk/test/java/io/FileInputStream/NegativeAvailable.java
new file mode 100644
index 0000000..a4dedbc
--- /dev/null
+++ b/jdk/test/java/io/FileInputStream/NegativeAvailable.java
@@ -0,0 +1,90 @@
+/*
+ * 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 8010837
+ * @summary Test if available returns correct value when skipping beyond
+ *          the end of a file.
+ * @author Dan Xu
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+public class NegativeAvailable {
+
+    public static void main(String[] args) throws IOException {
+        final int SIZE = 10;
+        final int SKIP = 5;
+
+        // Create a temporary file with size of 10 bytes.
+        Path tmp = Files.createTempFile(null, null);
+        try (BufferedWriter writer =
+            Files.newBufferedWriter(tmp, Charset.defaultCharset())) {
+            for (int i = 0; i < SIZE; i++) {
+                writer.write('1');
+            }
+        }
+
+        File tempFile = tmp.toFile();
+        try (FileInputStream fis = new FileInputStream(tempFile)) {
+            if (tempFile.length() != SIZE) {
+                throw new RuntimeException("unexpected file size = "
+                    + tempFile.length());
+            }
+            long space = skipBytes(fis, SKIP, SIZE);
+            space = skipBytes(fis, SKIP, space);
+            space = skipBytes(fis, SKIP, space);
+            space = skipBytes(fis, SKIP, space);
+        }
+        Files.deleteIfExists(tmp);
+    }
+
+    /**
+     *  Skip toSkip number of bytes and return the remaining bytes of the file.
+     */
+    private static long skipBytes(FileInputStream fis, int toSkip, long space)
+            throws IOException {
+        long skip = fis.skip(toSkip);
+        if (skip != toSkip) {
+            throw new RuntimeException("skip() returns " + skip
+                + " but expected " + toSkip);
+        }
+        long remaining = space - toSkip;
+        int avail = fis.available();
+        if (avail != remaining) {
+            throw new RuntimeException("available() returns " + avail
+                + " but expected " + remaining);
+        }
+
+        System.out.println("Skipped " + skip + " bytes "
+            + " available() returns " + avail);
+        return remaining;
+    }
+}
diff --git a/jdk/test/java/lang/Class/GenericStringTest.java b/jdk/test/java/lang/Class/GenericStringTest.java
new file mode 100644
index 0000000..cdd8c1a
--- /dev/null
+++ b/jdk/test/java/lang/Class/GenericStringTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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 6298888 6992705
+ * @summary Check Class.toGenericString()
+ * @author Joseph D. Darcy
+ */
+
+import java.lang.reflect.*;
+import java.lang.annotation.*;
+import java.util.*;
+
+@ExpectedGenericString("public class GenericStringTest")
+public class GenericStringTest {
+    public static void main(String... args){
+        int failures = 0;
+
+        failures += checkToGenericString(int.class, "int");
+
+        Class<?>[] types = {
+            GenericStringTest.class,
+            AnInterface.class,
+            LocalMap.class,
+            AnEnum.class,
+            AnotherEnum.class,
+        };
+
+        for(Class<?> clazz : types) {
+            failures += checkToGenericString(clazz, clazz.getAnnotation(ExpectedGenericString.class).value());
+        }
+
+        if (failures > 0) {
+            throw new RuntimeException();
+        }
+    }
+
+    private static int checkToGenericString(Class<?> clazz, String expected) {
+        String genericString = clazz.toGenericString();
+        if (!genericString.equals(expected)) {
+            System.err.printf("Unexpected Class.toGenericString output; expected '%s', got '%s'.%n",
+                              expected,
+                              genericString);
+            return 1;
+        } else
+            return 0;
+    }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ExpectedGenericString {
+    String value();
+}
+
+@ExpectedGenericString("abstract interface AnInterface")
+strictfp interface AnInterface {}
+
+@ExpectedGenericString("abstract interface LocalMap<K,V>")
+interface LocalMap<K,V> {}
+
+@ExpectedGenericString("final enum AnEnum")
+enum AnEnum {
+    FOO;
+}
+
+@ExpectedGenericString("enum AnotherEnum")
+enum AnotherEnum {
+    BAR{};
+}
diff --git a/jdk/test/java/lang/Runtime/exec/WinCommand.java b/jdk/test/java/lang/Runtime/exec/WinCommand.java
index a812bff..6d34a1e 100644
--- a/jdk/test/java/lang/Runtime/exec/WinCommand.java
+++ b/jdk/test/java/lang/Runtime/exec/WinCommand.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -135,19 +135,24 @@
 
         // Win9x systems don't have a cmd.exe
         if (new File(systemDirW, "cmd.exe").exists()) {
-            out.println("Running cmd.exe tests...");
-            writeFile("cdcmd.cmd", "@echo off\r\nCD\r\n");
-            writeFile("cdbat.bat", "@echo off\r\nCD\r\n");
-            checkCD("cmd",
-                    "cmd.exe",
-                    systemDirW + "\\cmd.exe",
-                    // Only the ".exe" extension can be omitted
-                    systemDirW + "\\cmd",
-                    systemDirM + "/cmd.exe",
-                    systemDirM + "/cmd",
-                    "/" + systemDirM + "/cmd",
-                    "cdcmd.cmd", "./cdcmd.cmd", ".\\cdcmd.cmd",
-                    "cdbat.bat", "./cdbat.bat", ".\\cdbat.bat");
+            try {
+                out.println("Running cmd.exe tests...");
+                writeFile("cdcmd.cmd", "@echo off\r\nCD\r\n");
+                writeFile("cdbat.bat", "@echo off\r\nCD\r\n");
+                checkCD("cmd",
+                        "cmd.exe",
+                        systemDirW + "\\cmd.exe",
+                        // Only the ".exe" extension can be omitted
+                        systemDirW + "\\cmd",
+                        systemDirM + "/cmd.exe",
+                        systemDirM + "/cmd",
+                        "/" + systemDirM + "/cmd",
+                        "cdcmd.cmd", "./cdcmd.cmd", ".\\cdcmd.cmd",
+                        "cdbat.bat", "./cdbat.bat", ".\\cdbat.bat");
+            } finally {
+                new File("cdcmd.cmd").delete();
+                new File("cdbat.bat").delete();
+            }
         }
 
         // 16-bit apps like command.com must have a console;
diff --git a/jdk/test/java/lang/StringBuilder/Supplementary.java b/jdk/test/java/lang/StringBuilder/Supplementary.java
index 30ff5e9..f5af9a0 100644
--- a/jdk/test/java/lang/StringBuilder/Supplementary.java
+++ b/jdk/test/java/lang/StringBuilder/Supplementary.java
@@ -37,6 +37,7 @@
         test4();        // Test for appendCodePoint(int codePoint)
         test5();        // Test for codePointCount(int beginIndex, int endIndex)
         test6();        // Test for offsetByCodePoints(int index, int offset)
+        testDontReadOutOfBoundsTrailingSurrogate();
     }
 
     /* Text strings which are used as input data.
@@ -305,6 +306,19 @@
         }
     }
 
+    static void testDontReadOutOfBoundsTrailingSurrogate() {
+        StringBuilder sb = new StringBuilder();
+        int suppl = Character.MIN_SUPPLEMENTARY_CODE_POINT;
+        sb.appendCodePoint(suppl);
+        check(sb.codePointAt(0) != (int) suppl,
+              "codePointAt(0)", sb.codePointAt(0), suppl);
+        check(sb.length() != 2, "sb.length()");
+        sb.setLength(1);
+        check(sb.length() != 1, "sb.length()");
+        check(sb.codePointAt(0) != Character.highSurrogate(suppl),
+              "codePointAt(0)",
+              sb.codePointAt(0), Character.highSurrogate(suppl));
+    }
 
     static final boolean At = true, Before = false;
 
diff --git a/jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh b/jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh
index 4cf6332..4935a0c 100644
--- a/jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh
+++ b/jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 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
diff --git a/jdk/test/java/lang/reflect/Method/DefaultMethodModeling.java b/jdk/test/java/lang/reflect/Method/DefaultMethodModeling.java
new file mode 100644
index 0000000..f05dd02
--- /dev/null
+++ b/jdk/test/java/lang/reflect/Method/DefaultMethodModeling.java
@@ -0,0 +1,224 @@
+/*
+ * 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 8011590
+ * @summary Check modeling of default methods
+ * @author Joseph D. Darcy
+ */
+
+import java.util.Objects;
+import java.lang.reflect.*;
+import java.lang.annotation.*;
+
+import static java.lang.reflect.Modifier.*;
+
+public class DefaultMethodModeling {
+    public static void main(String... args) {
+        int failures = 0;
+
+        Class<?>[] classes = {SuperC.class, SuperCchild.class,
+                              SuperI.class, SuperIchild.class,
+                              SuperIwithDefault.class, SuperIwithDefaultChild.class,
+                              Base.class, Combo1.class, Combo2.class,
+                              SonSuperIwithDefault.class, DaughterSuperIwithDefault.class, GrandchildSuperIwithDefault.class, D.class,
+                              B.class, C.class
+        };
+
+        for(Class<?> clazz : classes) {
+            System.err.println(clazz.toString());
+            for(Method m : clazz.getMethods()) {
+                if (m.getDeclaringClass() != java.lang.Object.class)
+                    failures += testMethod(m);
+            }
+        }
+
+        if (failures > 0)
+            throw new RuntimeException();
+    }
+
+    private static int testMethod(Method m) {
+        ExpectedModel em = Objects.requireNonNull(m.getAnnotation(ExpectedModel.class));
+        boolean failed = false;
+
+        if (m.getModifiers() != em.modifiers()) {
+            failed = true;
+            System.err.printf("Unexpected modifiers %d; expected %d%n", m.getModifiers(), em.modifiers());
+        }
+
+        if (m.isDefault() != em.isDefault()) {
+            failed = true;
+            System.err.printf("Unexpected isDefualt %b; expected b%n", m.isDefault(), em.isDefault());
+        }
+
+        if (!m.getDeclaringClass().equals(em.declaringClass())) {
+            failed = true;
+            System.err.printf("Unexpected isDefualt %s; expected %s%n",
+                              m.getDeclaringClass().toString(), em.declaringClass().toString());
+        }
+
+        return (!failed) ? 0 :1;
+    }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ExpectedModel {
+    boolean isDefault() default false;
+    int modifiers() default PUBLIC;
+    Class<?> declaringClass();
+}
+
+abstract class SuperC {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=SuperC.class)
+    public abstract void foo();
+
+    @ExpectedModel(declaringClass=SuperC.class)
+    public void bar() {
+        ;
+    }
+}
+
+class SuperCchild extends SuperC {
+    @ExpectedModel(declaringClass=SuperCchild.class)
+    @Override
+    public void foo() {;}
+}
+
+// -=-=-=-
+
+interface SuperI {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=SuperI.class)
+    void foo();
+
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=SuperI.class)
+    void bar();
+}
+
+class SuperIchild implements SuperI {
+    @ExpectedModel(declaringClass=SuperIchild.class)
+    public void foo() {;}
+
+    @ExpectedModel(declaringClass=SuperIchild.class)
+    public void bar() {;}
+}
+
+// -=-=-=-
+
+interface SuperIwithDefault {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=SuperIwithDefault.class)
+    void foo();
+
+    @ExpectedModel(isDefault=true, declaringClass=SuperIwithDefault.class)
+    default void bar() {
+        ;
+    }
+}
+
+class SuperIwithDefaultChild implements SuperIwithDefault {
+    @ExpectedModel(declaringClass=SuperIwithDefaultChild.class)
+    @Override
+    public void foo() {;}
+}
+
+// -=-=-=-
+
+abstract class Base {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=Base.class)
+    abstract public void baz();
+
+    @ExpectedModel(declaringClass=Base.class)
+    public void quux() {;}
+}
+
+abstract class Combo1 extends Base implements SuperI {
+    @ExpectedModel(declaringClass=Combo1.class)
+    public void wombat() {}
+}
+
+abstract class Combo2 extends Base implements SuperIwithDefault {
+    @ExpectedModel(declaringClass=Combo2.class)
+    public void wombat() {}
+}
+
+// -=-=-=-
+
+interface SonSuperIwithDefault extends SuperIwithDefault {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=SonSuperIwithDefault.class)
+    void baz();
+
+    @ExpectedModel(isDefault=true, declaringClass=SonSuperIwithDefault.class)
+    default void bazD() {;}
+}
+
+interface DaughterSuperIwithDefault extends SuperIwithDefault {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=DaughterSuperIwithDefault.class)
+    void quux();
+
+    @ExpectedModel(isDefault=true, declaringClass=DaughterSuperIwithDefault.class)
+    default void quuxD() {;}
+}
+
+interface GrandchildSuperIwithDefault extends SonSuperIwithDefault, DaughterSuperIwithDefault {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=GrandchildSuperIwithDefault.class)
+    void wombat();
+
+    @ExpectedModel(isDefault=true, declaringClass=GrandchildSuperIwithDefault.class)
+    default void wombatD() {;}
+
+}
+
+class D implements GrandchildSuperIwithDefault {
+    @ExpectedModel(declaringClass=D.class)
+    public void wombat(){}
+
+    @ExpectedModel(declaringClass=D.class)
+    public void  baz(){}
+
+    @ExpectedModel(declaringClass=D.class)
+    public void foo(){}
+
+    @ExpectedModel(declaringClass=D.class)
+    public void quux(){}
+}
+
+// -=-=-=-
+
+// What does re-abstraction look like?
+
+class A implements SuperIwithDefault {
+    @ExpectedModel(declaringClass=A.class)
+    @Override
+    public void foo(){;}
+}
+
+abstract class B extends A {
+    @ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=B.class)
+    @Override
+    public abstract void bar();
+}
+
+class C extends B implements SuperIwithDefault {
+    @ExpectedModel(declaringClass=C.class)
+    public void bar(){}
+}
diff --git a/jdk/test/java/lang/reflect/Method/GenericStringTest.java b/jdk/test/java/lang/reflect/Method/GenericStringTest.java
index 14c3c62..9e50dca 100644
--- a/jdk/test/java/lang/reflect/Method/GenericStringTest.java
+++ b/jdk/test/java/lang/reflect/Method/GenericStringTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5033583 6316717 6470106
+ * @bug 5033583 6316717 6470106 8004979
  * @summary Check toGenericString() and toString() methods
  * @author Joseph D. Darcy
  */
@@ -39,6 +39,7 @@
         classList.add(TestClass1.class);
         classList.add(TestClass2.class);
         classList.add(Roebling.class);
+        classList.add(TestInterface1.class);
 
 
         for(Class<?> clazz: classList)
@@ -129,6 +130,27 @@
     void varArg(Object ... arg) {}
 }
 
+interface TestInterface1 {
+    @ExpectedGenericString(
+   "public default void TestInterface1.foo()")
+    @ExpectedString(
+   "public default void TestInterface1.foo()")
+    public default void foo(){;}
+
+    @ExpectedString(
+   "public default java.lang.Object TestInterface1.bar()")
+    @ExpectedGenericString(
+   "public default <A> A TestInterface1.bar()")
+    default <A> A bar(){return null;}
+
+    @ExpectedString(
+   "public default strictfp double TestInterface1.quux()")
+    @ExpectedGenericString(
+    "public default strictfp double TestInterface1.quux()")
+    strictfp default double quux(){return 1.0;}
+
+}
+
 @Retention(RetentionPolicy.RUNTIME)
 @interface ExpectedGenericString {
     String value();
diff --git a/jdk/test/java/lang/reflect/Method/IsDefaultTest.java b/jdk/test/java/lang/reflect/Method/IsDefaultTest.java
index 64cb5c2..1dd67ae 100644
--- a/jdk/test/java/lang/reflect/Method/IsDefaultTest.java
+++ b/jdk/test/java/lang/reflect/Method/IsDefaultTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 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
diff --git a/jdk/test/java/net/Socks/SocksProxyVersion.java b/jdk/test/java/net/Socks/SocksProxyVersion.java
index fe4f1c6..bc46c42 100644
--- a/jdk/test/java/net/Socks/SocksProxyVersion.java
+++ b/jdk/test/java/net/Socks/SocksProxyVersion.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6964547
+ * @bug 6964547 5001942
  * @run main/othervm SocksProxyVersion
  * @summary test socksProxyVersion system property
  */
@@ -34,6 +34,7 @@
 import java.net.SocketException;
 import java.io.DataInputStream;
 import java.io.IOException;
+import java.net.InetAddress;
 
 public class SocksProxyVersion implements Runnable {
     final ServerSocket ss;
@@ -56,13 +57,19 @@
         Thread serverThread = new Thread(this);
         serverThread.start();
 
-        System.setProperty("socksProxyHost", "localhost");
+        /*
+         * Retreving the IP Address of the machine
+         * since "localhost" is bypassed as a non-proxy host
+         */
+        String addr = InetAddress.getLocalHost().getHostAddress();
+
+        System.setProperty("socksProxyHost", addr);
         System.setProperty("socksProxyPort", Integer.toString(port));
 
         // SOCKS V4
         System.setProperty("socksProxyVersion", Integer.toString(4));
         try (Socket s = new Socket()) {
-            s.connect(new InetSocketAddress("localhost", port));
+            s.connect(new InetSocketAddress(addr, port));
         } catch (SocketException e) {
             // java.net.SocketException: Malformed reply from SOCKS server
             // This exception is OK, since the "server" does not implement
@@ -72,7 +79,7 @@
         // SOCKS V5
         System.setProperty("socksProxyVersion", Integer.toString(5));
         try (Socket s = new Socket()) {
-            s.connect(new InetSocketAddress("localhost", port));
+            s.connect(new InetSocketAddress(addr, port));
         } catch (SocketException e) { /* OK */ }
 
         serverThread.join();
diff --git a/jdk/test/java/net/URLConnection/RequestProperties.java b/jdk/test/java/net/URLConnection/RequestProperties.java
index af549e2..40946a6 100644
--- a/jdk/test/java/net/URLConnection/RequestProperties.java
+++ b/jdk/test/java/net/URLConnection/RequestProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013 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
diff --git a/jdk/test/java/util/Base64/TestBase64.java b/jdk/test/java/util/Base64/TestBase64.java
index e0af4de..94413a2 100644
--- a/jdk/test/java/util/Base64/TestBase64.java
+++ b/jdk/test/java/util/Base64/TestBase64.java
@@ -22,7 +22,7 @@
  */
 
 /**
- * @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530
+ * @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
  * @summary tests java.util.Base64
  */
 
@@ -107,6 +107,9 @@
         checkIAE(new Runnable() { public void run() {
             Base64.getDecoder().decode(ByteBuffer.wrap(decoded), ByteBuffer.allocateDirect(1024)); }});
 
+        // illegal ending unit
+        checkIAE(new Runnable() { public void run() { Base64.getMimeDecoder().decode("$=#"); }});
+
         // test return value from decode(ByteBuffer, ByteBuffer)
         testDecBufRet();
 
@@ -115,7 +118,6 @@
 
         // test decoding of unpadded data
         testDecodeUnpadded();
-
         // test mime decoding with ignored character after padding
         testDecodeIgnoredAfterPadding();
     }
@@ -384,6 +386,10 @@
                 encoded = Arrays.copyOf(encoded, encoded.length + 1);
                 encoded[encoded.length - 1] = nonBase64;
                 checkEqual(decM.decode(encoded), src[i], "Non-base64 char is not ignored");
+                byte[] decoded = new byte[src[i].length];
+                decM.decode(encoded, decoded);
+                checkEqual(decoded, src[i], "Non-base64 char is not ignored");
+
                 try {
                     dec.decode(encoded);
                     throw new RuntimeException("No IAE for non-base64 char");
diff --git a/jdk/test/java/util/Optional/BasicDouble.java b/jdk/test/java/util/Optional/BasicDouble.java
index 741137c..841dd45 100644
--- a/jdk/test/java/util/Optional/BasicDouble.java
+++ b/jdk/test/java/util/Optional/BasicDouble.java
@@ -3,17 +3,17 @@
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2.0 only, as
+ * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2.0 for more details (a copy is included in the LICENSE file that
+ * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
  * You should have received a copy of the GNU General Public License version
- * 2.0 along with this work; if not, write to the Free Software Foundation,
+ * 2 along with this work; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
diff --git a/jdk/test/java/util/concurrent/CompletableFuture/Basic.java b/jdk/test/java/util/concurrent/CompletableFuture/Basic.java
new file mode 100644
index 0000000..e8ed706
--- /dev/null
+++ b/jdk/test/java/util/concurrent/CompletableFuture/Basic.java
@@ -0,0 +1,761 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/*
+ * @test
+ * @bug 8005696
+ * @summary Basic tests for CompletableFuture
+ * @author Chris Hegarty
+ */
+
+import java.lang.reflect.Array;
+import java.util.concurrent.Phaser;
+import static java.util.concurrent.TimeUnit.*;
+import java.util.concurrent.CompletableFuture;
+import static java.util.concurrent.CompletableFuture.*;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import static java.util.concurrent.ForkJoinPool.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+public class Basic {
+
+    static void checkCompletedNormally(CompletableFuture<?> cf, Object value) {
+        checkCompletedNormally(cf, value == null ? null : new Object[] { value });
+    }
+
+    static void checkCompletedNormally(CompletableFuture<?> cf, Object[] values) {
+        try { equalAnyOf(cf.join(), values); } catch (Throwable x) { unexpected(x); }
+        try { equalAnyOf(cf.getNow(null), values); } catch (Throwable x) { unexpected(x); }
+        try { equalAnyOf(cf.get(), values); } catch (Throwable x) { unexpected(x); }
+        try { equalAnyOf(cf.get(0L, SECONDS), values); } catch (Throwable x) { unexpected(x); }
+        check(cf.isDone(), "Expected isDone to be true, got:" + cf);
+        check(!cf.isCancelled(), "Expected isCancelled to be false");
+        check(!cf.cancel(true), "Expected cancel to return false");
+        check(cf.toString().contains("[Completed normally]"));
+        check(cf.complete(null) == false, "Expected complete() to fail");
+        check(cf.completeExceptionally(new Throwable()) == false,
+              "Expected completeExceptionally() to fail");
+    }
+
+    static <T> void checkCompletedExceptionally(CompletableFuture<T> cf)
+        throws Exception
+    {
+        checkCompletedExceptionally(cf, false);
+    }
+
+    @SuppressWarnings("unchecked")
+    static <T> void checkCompletedExceptionally(CompletableFuture<T> cf, boolean cancelled)
+        throws Exception
+    {
+        try { cf.join(); fail("Excepted exception to be thrown"); }
+        catch (CompletionException x) { if (cancelled) fail(); else pass(); }
+        catch (CancellationException x) { if (cancelled) pass(); else fail(); }
+        try { cf.getNow(null); fail("Excepted exception to be thrown"); }
+        catch (CompletionException x) { if (cancelled) fail(); else pass(); }
+        catch (CancellationException x) { if (cancelled) pass(); else fail(); }
+        try { cf.get(); fail("Excepted exception to be thrown");}
+        catch (CancellationException x) { if (cancelled) pass(); else fail(); }
+        catch (ExecutionException x) { if (cancelled) check(x.getCause() instanceof CancellationException); else pass(); }
+        try { cf.get(0L, SECONDS); fail("Excepted exception to be thrown");}
+        catch (CancellationException x) { if (cancelled) pass(); else fail(); }
+        catch (ExecutionException x) { if (cancelled) check(x.getCause() instanceof CancellationException); else pass(); }
+        check(cf.isDone(), "Expected isDone to be true, got:" + cf);
+        check(cf.isCancelled() == cancelled, "Expected isCancelled: " + cancelled + ", got:"  + cf.isCancelled());
+        check(cf.cancel(true) == cancelled, "Expected cancel: " + cancelled + ", got:"  + cf.cancel(true));
+        check(cf.toString().contains("[Completed exceptionally]"));  // ## TODO: 'E'xceptionally
+        check(cf.complete((T)new Object()) == false, "Expected complete() to fail");
+        check(cf.completeExceptionally(new Throwable()) == false,
+              "Expected completeExceptionally() to fail, already completed");
+    }
+
+    private static void realMain(String[] args) throws Throwable {
+        ExecutorService executor = Executors.newFixedThreadPool(2);
+        try {
+            test(executor);
+        } finally {
+            executor.shutdown();
+            executor.awaitTermination(30, SECONDS);
+        }
+    }
+
+    static AtomicInteger atomicInt = new AtomicInteger(0);
+
+    private static void test(ExecutorService executor) throws Throwable {
+
+        Thread.currentThread().setName("mainThread");
+
+        //----------------------------------------------------------------
+        // supplyAsync tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<String> cf = supplyAsync(() -> "a test string");
+            checkCompletedNormally(cf, cf.join());
+            cf = supplyAsync(() -> "a test string", commonPool());
+            checkCompletedNormally(cf, cf.join());
+            cf = supplyAsync(() -> "a test string", executor);
+            checkCompletedNormally(cf, cf.join());
+            cf = supplyAsync(() -> { throw new RuntimeException(); });
+            checkCompletedExceptionally(cf);
+            cf = supplyAsync(() -> { throw new RuntimeException(); }, commonPool());
+            checkCompletedExceptionally(cf);
+            cf = supplyAsync(() -> { throw new RuntimeException(); }, executor);
+            checkCompletedExceptionally(cf);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // runAsync tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Void> cf = runAsync(() -> { });
+            checkCompletedNormally(cf, cf.join());
+            cf = runAsync(() -> { }, commonPool());
+            checkCompletedNormally(cf, cf.join());
+            cf = runAsync(() -> { }, executor);
+            checkCompletedNormally(cf, cf.join());
+            cf = runAsync(() -> { throw new RuntimeException(); });
+            checkCompletedExceptionally(cf);
+            cf = runAsync(() -> { throw new RuntimeException(); }, commonPool());
+            checkCompletedExceptionally(cf);
+            cf = runAsync(() -> { throw new RuntimeException(); }, executor);
+            checkCompletedExceptionally(cf);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // explicit completion
+        //----------------------------------------------------------------
+        try {
+            final Phaser phaser = new Phaser(1);
+            final int phase = phaser.getPhase();
+            CompletableFuture<Integer> cf;
+            cf = supplyAsync(() -> { phaser.awaitAdvance(phase); return 1; });
+            cf.complete(2);
+            phaser.arrive();
+            checkCompletedNormally(cf, 2);
+
+            cf = supplyAsync(() -> { phaser.awaitAdvance(phase+1); return 1; });
+            cf.completeExceptionally(new Throwable());
+            phaser.arrive();
+            checkCompletedExceptionally(cf);
+
+            cf = supplyAsync(() -> { phaser.awaitAdvance(phase+2); return 1; });
+            cf.cancel(true);
+            phaser.arrive();
+            checkCompletedExceptionally(cf, true);
+
+            cf = supplyAsync(() -> { phaser.awaitAdvance(phase+3); return 1; });
+            check(cf.getNow(2) == 2);
+            phaser.arrive();
+            checkCompletedNormally(cf, 1);
+            check(cf.getNow(2) == 1);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // thenApplyXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Integer> cf2;
+            CompletableFuture<String> cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenApply((x) -> { if (x.equals("a test string")) return 1; else return 0; });
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, 1);
+
+            cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenApplyAsync((x) -> { if (x.equals("a test string")) return 1; else return 0; });
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, 1);
+
+            cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenApplyAsync((x) -> { if (x.equals("a test string")) return 1; else return 0; }, executor);
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, 1);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenApply((x) -> { return 0; } );
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenApplyAsync((x) -> { return 0; } );
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenApplyAsync((x) -> { return 0; }, executor);
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // thenAcceptXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Void> cf2;
+            int before = atomicInt.get();
+            CompletableFuture<String> cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenAccept((x) -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); });
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenAcceptAsync((x) -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); });
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenAcceptAsync((x) -> { if (x.equals("a test string")) { atomicInt.incrementAndGet(); return; } throw new RuntimeException(); }, executor);
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenAccept((x) -> { atomicInt.incrementAndGet(); } );
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenAcceptAsync((x) -> { atomicInt.incrementAndGet(); } );
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenAcceptAsync((x) -> { atomicInt.incrementAndGet(); }, executor );
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // thenRunXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Void> cf2;
+            int before = atomicInt.get();
+            CompletableFuture<String> cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenRun(() -> { atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> "a test string");
+            cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); }, executor);
+            checkCompletedNormally(cf1, "a test string");
+            checkCompletedNormally(cf2, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenRun(() -> { atomicInt.incrementAndGet(); });
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); });
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenRunAsync(() -> { atomicInt.incrementAndGet(); }, executor);
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // thenCombineXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Integer> cf3;
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            CompletableFuture<Integer> cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenCombine(cf2, (x, y) -> { return x + y; });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedNormally(cf3, 2);
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return x + y; });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedNormally(cf3, 2);
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return x + y; }, executor);
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedNormally(cf3, 2);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenCombine(cf2, (x, y) -> { return 0; });
+            checkCompletedExceptionally(cf1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedExceptionally(cf3);
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return 0; });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedExceptionally(cf2);
+            checkCompletedExceptionally(cf3);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf1.thenCombineAsync(cf2, (x, y) -> { return 0; }, executor);
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            checkCompletedExceptionally(cf3);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // thenAcceptBothXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Void> cf3;
+            int before = atomicInt.get();
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            CompletableFuture<Integer> cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenAcceptBoth(cf2, (x, y) -> { check(x + y == 2); atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> { check(x + y == 2); atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> { check(x + y == 2); atomicInt.incrementAndGet(); }, executor);
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.thenAcceptBoth(cf2, (x, y) -> { atomicInt.incrementAndGet(); });
+            checkCompletedExceptionally(cf1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedExceptionally(cf3);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> { atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedExceptionally(cf2);
+            checkCompletedExceptionally(cf3);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf1.thenAcceptBothAsync(cf2, (x, y) -> { atomicInt.incrementAndGet(); }, executor);
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            checkCompletedExceptionally(cf3);
+            check(atomicInt.get() == before);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // runAfterBothXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Void> cf3;
+            int before = atomicInt.get();
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            CompletableFuture<Integer> cf2 = supplyAsync(() -> 1);
+            cf3 = cf1.runAfterBoth(cf2, () -> { check(cf1.isDone()); check(cf2.isDone()); atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            CompletableFuture<Integer> cfa = supplyAsync(() -> 1);
+            CompletableFuture<Integer> cfb = supplyAsync(() -> 1);
+            cf3 = cfa.runAfterBothAsync(cfb, () -> { check(cfa.isDone()); check(cfb.isDone()); atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cfa, 1);
+            checkCompletedNormally(cfb, 1);
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            CompletableFuture<Integer> cfx = supplyAsync(() -> 1);
+            CompletableFuture<Integer> cfy = supplyAsync(() -> 1);
+            cf3 = cfy.runAfterBothAsync(cfx, () -> { check(cfx.isDone()); check(cfy.isDone()); atomicInt.incrementAndGet(); }, executor);
+            checkCompletedNormally(cfx, 1);
+            checkCompletedNormally(cfy, 1);
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            CompletableFuture<Integer> cf4 = supplyAsync(() -> { throw new RuntimeException(); });
+            CompletableFuture<Integer> cf5 = supplyAsync(() -> 1);
+            cf3 = cf5.runAfterBothAsync(cf4, () -> { atomicInt.incrementAndGet(); }, executor);
+            checkCompletedExceptionally(cf4);
+            checkCompletedNormally(cf5, 1);
+            checkCompletedExceptionally(cf3);
+            check(atomicInt.get() == before);
+
+            before = atomicInt.get();
+            cf4 = supplyAsync(() -> 1);
+            cf5 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf5.runAfterBothAsync(cf4, () -> { atomicInt.incrementAndGet(); });
+            checkCompletedNormally(cf4, 1);
+            checkCompletedExceptionally(cf5);
+            checkCompletedExceptionally(cf3);
+            check(atomicInt.get() == before);
+
+            before = atomicInt.get();
+            cf4 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf5 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf5.runAfterBoth(cf4, () -> { atomicInt.incrementAndGet(); });
+            checkCompletedExceptionally(cf4);
+            checkCompletedExceptionally(cf5);
+            checkCompletedExceptionally(cf3);
+            check(atomicInt.get() == before);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // applyToEitherXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Integer> cf3;
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            CompletableFuture<Integer> cf2 = supplyAsync(() -> 2);
+            cf3 = cf1.applyToEither(cf2, (x) -> { check(x == 1 || x == 2); return x; });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, new Object[] {1, 2});
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 2);
+            cf3 = cf1.applyToEitherAsync(cf2, (x) -> { check(x == 1 || x == 2); return x; });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, new Object[] {1, 2});
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 2);
+            cf3 = cf1.applyToEitherAsync(cf2, (x) -> { check(x == 1 || x == 2); return x; }, executor);
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, new Object[] {1, 2});
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> 2);
+            cf3 = cf1.applyToEither(cf2, (x) -> { check(x == 2); return x; });
+            check(cf1.isDone() || cf2.isDone());
+            try { check(cf3.join() == 1); } catch (CompletionException x) { pass(); }
+            check(cf3.isDone());
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf1.applyToEitherAsync(cf2, (x) -> { check(x == 1); return x; });
+            check(cf1.isDone() || cf2.isDone());
+            try { check(cf3.join() == 1); } catch (CompletionException x) { pass(); }
+            check(cf3.isDone());
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf1.applyToEitherAsync(cf2, (x) -> { fail(); return x; });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedExceptionally(cf3);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // acceptEitherXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Void> cf3;
+            int before = atomicInt.get();
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            CompletableFuture<Integer> cf2 = supplyAsync(() -> 2);
+            cf3 = cf1.acceptEither(cf2, (x) -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 2);
+            cf3 = cf1.acceptEitherAsync(cf2, (x) -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> 2);
+            cf3 = cf2.acceptEitherAsync(cf1, (x) -> { check(x == 1 || x == 2); atomicInt.incrementAndGet(); }, executor);
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> 2);
+            cf3 = cf2.acceptEitherAsync(cf1, (x) -> { check(x == 2); }, executor);
+            check(cf1.isDone() || cf2.isDone());
+            try { check(cf3.join() == null); } catch (CompletionException x) { pass(); }
+            check(cf3.isDone());
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf2.acceptEitherAsync(cf1, (x) -> { check(x == 1); });
+            check(cf1.isDone() || cf2.isDone());
+            try { check(cf3.join() == null); } catch (CompletionException x) { pass(); }
+            check(cf3.isDone());
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf2.acceptEitherAsync(cf1, (x) -> { fail(); });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedExceptionally(cf3);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // runAfterEitherXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Void> cf3;
+            int before = atomicInt.get();
+            CompletableFuture<Void> cf1 = runAsync(() -> { });
+            CompletableFuture<Void> cf2 = runAsync(() -> { });
+            cf3 = cf1.runAfterEither(cf2, () -> { atomicInt.incrementAndGet(); });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = runAsync(() -> { });
+            cf2 = runAsync(() -> { });
+            cf3 = cf1.runAfterEitherAsync(cf2, () -> { atomicInt.incrementAndGet(); });
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = runAsync(() -> { });
+            cf2 = runAsync(() -> { });
+            cf3 = cf2.runAfterEitherAsync(cf1, () -> { atomicInt.incrementAndGet(); }, executor);
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedNormally(cf3, null);
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = runAsync(() -> { throw new RuntimeException(); });
+            cf2 = runAsync(() -> { });
+            cf3 = cf2.runAfterEither(cf1, () -> { atomicInt.incrementAndGet(); });
+            check(cf1.isDone() || cf2.isDone());
+            try { check(cf3.join() == null); } catch (CompletionException x) { pass(); }
+            check(cf3.isDone());
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = runAsync(() -> { });
+            cf2 = runAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf1.runAfterEitherAsync(cf2, () -> { atomicInt.incrementAndGet(); });
+            check(cf1.isDone() || cf2.isDone());
+            try { check(cf3.join() == null); } catch (CompletionException x) { pass(); }
+            check(cf3.isDone());
+            check(atomicInt.get() == (before + 1));
+
+            before = atomicInt.get();
+            cf1 = runAsync(() -> { throw new RuntimeException(); });
+            cf2 = runAsync(() -> { throw new RuntimeException(); });
+            cf3 = cf2.runAfterEitherAsync(cf1, () -> { atomicInt.incrementAndGet(); }, executor);
+            check(cf1.isDone() || cf2.isDone());
+            checkCompletedExceptionally(cf3);
+            check(atomicInt.get() == before);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // thenComposeXXX tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Integer> cf2;
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            cf2 = cf1.thenCompose((x) -> { check(x ==1); return CompletableFuture.completedFuture(2); });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 2);
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = cf1.thenComposeAsync((x) -> { check(x ==1); return CompletableFuture.completedFuture(2); });
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 2);
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = cf1.thenComposeAsync((x) -> { check(x ==1); return CompletableFuture.completedFuture(2); }, executor);
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 2);
+
+            int before = atomicInt.get();
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenCompose((x) -> { atomicInt.incrementAndGet(); return CompletableFuture.completedFuture(2); });
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> { throw new RuntimeException(); });
+            cf2 = cf1.thenComposeAsync((x) -> { atomicInt.incrementAndGet(); return CompletableFuture.completedFuture(2); });
+            checkCompletedExceptionally(cf1);
+            checkCompletedExceptionally(cf2);
+            check(atomicInt.get() == before);
+
+            cf1 = supplyAsync(() -> 1);
+            cf2 = cf1.thenComposeAsync((x) -> { throw new RuntimeException(); }, executor);
+            checkCompletedNormally(cf1, 1);
+            checkCompletedExceptionally(cf2);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // anyOf tests
+        //----------------------------------------------------------------
+        //try {
+        //    CompletableFuture<Object> cf3;
+        //    for (int k=0; k < 10; k++){
+        //        CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+        //        CompletableFuture<Integer> cf2 = supplyAsync(() -> 2);
+        //        cf3 = CompletableFuture.anyOf(cf1, cf2);
+        //        check(cf1.isDone() || cf2.isDone());
+        //        checkCompletedNormally(cf3, new Object[] {1, 2});
+        //    }
+        //} catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // allOf tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<?> cf3;
+            for (int k=0; k < 10; k++){
+                CompletableFuture<Integer>[] cfs = (CompletableFuture<Integer>[])
+                        Array.newInstance(CompletableFuture.class, 10);
+                for (int j=0; j < 10; j++) {
+                    final int v = j;
+                    cfs[j] = supplyAsync(() -> v);
+                }
+                cf3 = CompletableFuture.allOf(cfs);
+                for (int j=0; j < 10; j++)
+                    checkCompletedNormally(cfs[j], j);
+                checkCompletedNormally(cf3, null);
+            }
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // exceptionally tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Integer> cf2;
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            cf2 = cf1.exceptionally((t) -> { fail("function should never be called"); return 2;});
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 1);
+
+            final RuntimeException t = new RuntimeException();
+            cf1 = supplyAsync(() -> { throw t; });
+            cf2 = cf1.exceptionally((x) -> { check(x.getCause() == t); return 2;});
+            checkCompletedExceptionally(cf1);
+            checkCompletedNormally(cf2, 2);
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // handle tests
+        //----------------------------------------------------------------
+        try {
+            CompletableFuture<Integer> cf2;
+            CompletableFuture<Integer> cf1 = supplyAsync(() -> 1);
+            cf2 = cf1.handle((x,t) -> x+1);
+            checkCompletedNormally(cf1, 1);
+            checkCompletedNormally(cf2, 2);
+
+            final RuntimeException ex = new RuntimeException();
+            cf1 = supplyAsync(() -> { throw ex; });
+            cf2 = cf1.handle((x,t) -> { check(t.getCause() == ex); return 2;});
+            checkCompletedExceptionally(cf1);
+            checkCompletedNormally(cf2, 2);
+        } catch (Throwable t) { unexpected(t); }
+
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String msg) {System.out.println(msg); fail();}
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    static void check(boolean cond) {if (cond) pass(); else fail();}
+    static void check(boolean cond, String msg) {if (cond) pass(); else fail(msg);}
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    static void equalAnyOf(Object x, Object[] y) {
+        if (x == null && y == null) { pass(); return; }
+        for (Object z : y) { if (x.equals(z)) { pass(); return; } }
+        StringBuilder sb = new StringBuilder();
+        for (Object o : y)
+            sb.append(o).append(" ");
+        fail(x + " not equal to one of [" + sb + "]");}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
diff --git a/jdk/test/java/util/zip/EntryCount64k.java b/jdk/test/java/util/zip/EntryCount64k.java
new file mode 100644
index 0000000..c815efdd
--- /dev/null
+++ b/jdk/test/java/util/zip/EntryCount64k.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2013 Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 Test java.util.zip behavior with ~64k entries
+ * @run main/othervm EntryCount64k
+ * @run main/othervm -Djdk.util.zip.inhibitZip64=true EntryCount64k
+ * @run main/othervm -Djdk.util.zip.inhibitZip64=false EntryCount64k
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.zip.*;
+
+public class EntryCount64k {
+
+    public static void main(String[] args) throws Exception {
+        for (int i = (1 << 16) - 2; i < (1 << 16) + 2; i++)
+            test(i);
+    }
+
+    static void test(int entryCount) throws Exception {
+        File zipFile = new File("EntryCount64k-tmp.zip");
+        zipFile.delete();
+
+        try (ZipOutputStream zos =
+             new ZipOutputStream(
+                new BufferedOutputStream(
+                    new FileOutputStream(zipFile)))) {
+            for (int i = 0; i < entryCount; i++) {
+                ZipEntry e = new ZipEntry(Integer.toString(i));
+                zos.putNextEntry(e);
+                zos.closeEntry();
+            }
+        }
+
+        String p = System.getProperty("jdk.util.zip.inhibitZip64");
+        boolean tooManyEntries = entryCount >= (1 << 16) - 1;
+        boolean shouldUseZip64 = tooManyEntries & !("true".equals(p));
+        boolean usesZip64 = usesZip64(zipFile);
+        String details = String.format
+            ("entryCount=%d shouldUseZip64=%s usesZip64=%s zipSize=%d%n",
+             entryCount, shouldUseZip64, usesZip64, zipFile.length());
+        System.err.println(details);
+        checkCanRead(zipFile, entryCount);
+        if (shouldUseZip64 != usesZip64)
+            throw new Error(details);
+        zipFile.delete();
+    }
+
+    static boolean usesZip64(File zipFile) throws Exception {
+        RandomAccessFile raf = new RandomAccessFile(zipFile, "r");
+        byte[] buf = new byte[4096];
+        raf.seek(raf.length() - buf.length);
+        raf.read(buf);
+        for (int i = 0; i < buf.length - 4; i++) {
+            // Look for ZIP64 End Header Signature
+            // Phil Katz: yes, we will always remember you
+            if (buf[i+0] == 'P' &&
+                buf[i+1] == 'K' &&
+                buf[i+2] == 6   &&
+                buf[i+3] == 6)
+                return true;
+        }
+        return false;
+    }
+
+    static void checkCanRead(File zipFile, int entryCount) throws Exception {
+        // Check ZipInputStream API
+        try (ZipInputStream zis =
+             new ZipInputStream(
+                 new BufferedInputStream(
+                     new FileInputStream(zipFile)))) {
+            for (int i = 0; i < entryCount; i++) {
+                ZipEntry e = zis.getNextEntry();
+                if (Integer.parseInt(e.getName()) != i)
+                    throw new AssertionError();
+            }
+            if (zis.getNextEntry() != null)
+                throw new AssertionError();
+        }
+
+        // Check ZipFile API
+        try (ZipFile zf = new ZipFile(zipFile)) {
+            Enumeration<? extends ZipEntry> en = zf.entries();
+            for (int i = 0; i < entryCount; i++) {
+                ZipEntry e = en.nextElement();
+                if (Integer.parseInt(e.getName()) != i)
+                    throw new AssertionError();
+            }
+            if (en.hasMoreElements()
+                || (zf.size() != entryCount)
+                || (zf.getEntry(Integer.toString(entryCount - 1)) == null)
+                || (zf.getEntry(Integer.toString(entryCount)) != null))
+                throw new AssertionError();
+        }
+    }
+}
diff --git a/jdk/test/javax/script/GetInterfaceTest.java b/jdk/test/javax/script/GetInterfaceTest.java
index dffc74e..654147e 100644
--- a/jdk/test/javax/script/GetInterfaceTest.java
+++ b/jdk/test/javax/script/GetInterfaceTest.java
@@ -22,7 +22,6 @@
  */
 
 /*
- * @run ignore
  * @test
  * @bug 6960211
  * @summary JavaScript engine allows creation of interface although methods not available.
@@ -49,30 +48,30 @@
         }
 
         // now define "run"
-        engine.eval("function run() { println('this is run function'); }");
+        engine.eval("function run() { print('this is run function'); }");
         runnable = ((Invocable)engine).getInterface(Runnable.class);
         // should not return null now!
         runnable.run();
 
         // define only one method of "Foo2"
-        engine.eval("function bar() { println('bar function'); }");
+        engine.eval("function bar() { print('bar function'); }");
         Foo2 foo2 = ((Invocable)engine).getInterface(Foo2.class);
         if (foo2 != null) {
             throw new RuntimeException("foo2 is not null!");
         }
 
         // now define other method of "Foo2"
-        engine.eval("function bar2() { println('bar2 function'); }");
+        engine.eval("function bar2() { print('bar2 function'); }");
         foo2 = ((Invocable)engine).getInterface(Foo2.class);
         foo2.bar();
         foo2.bar2();
     }
 
-    interface Foo {
+    public interface Foo {
         public void bar();
     }
 
-    interface Foo2 extends Foo {
+    public interface Foo2 extends Foo {
         public void bar2();
     }
 }
diff --git a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java
index 7255ccb..075f600 100644
--- a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java
+++ b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -65,7 +65,11 @@
         checkfocus();
 
         // select menu
-        Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_F);
+        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+            Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_F);
+        } else {
+            Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_F);
+        }
         // select submenu
         Util.hitKeys(robot, KeyEvent.VK_S);
         toolkit.realSync();
diff --git a/jdk/test/javax/swing/text/html/7189299/bug7189299.java b/jdk/test/javax/swing/text/html/7189299/bug7189299.java
index 70d2057..8386212 100644
--- a/jdk/test/javax/swing/text/html/7189299/bug7189299.java
+++ b/jdk/test/javax/swing/text/html/7189299/bug7189299.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/test/sun/management/jdp/JdpTest.sh b/jdk/test/sun/management/jdp/JdpTest.sh
index dfdea7c..f42bbda 100644
--- a/jdk/test/sun/management/jdp/JdpTest.sh
+++ b/jdk/test/sun/management/jdp/JdpTest.sh
@@ -1,6 +1,6 @@
 #!/bin/sh -x
 
-# Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+# 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
diff --git a/jdk/test/sun/misc/URLClassPath/JarLoaderTest.java b/jdk/test/sun/misc/URLClassPath/JarLoaderTest.java
index cd9cbc8..24a8ea8 100644
--- a/jdk/test/sun/misc/URLClassPath/JarLoaderTest.java
+++ b/jdk/test/sun/misc/URLClassPath/JarLoaderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/jdk/test/sun/security/tools/keytool/p12importks.sh b/jdk/test/sun/security/tools/keytool/p12importks.sh
new file mode 100644
index 0000000..efdb56a
--- /dev/null
+++ b/jdk/test/sun/security/tools/keytool/p12importks.sh
@@ -0,0 +1,118 @@
+#
+# 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 8010125
+# @summary keytool -importkeystore could create a pkcs12 keystore with
+#  different storepass and keypass
+#
+
+if [ "${TESTJAVA}" = "" ] ; then
+  JAVAC_CMD=`which javac`
+  TESTJAVA=`dirname $JAVAC_CMD`/..
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  Windows_* )
+    FS="\\"
+    ;;
+  * )
+    FS="/"
+    ;;
+esac
+
+LANG=C
+KT=$TESTJAVA${FS}bin${FS}keytool
+
+# Part 1: JKS keystore with same storepass and keypass
+
+rm jks 2> /dev/null
+$KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
+	-storepass pass1111 -keypass pass1111 || exit 11
+
+# Cannot only change storepass
+rm p12 2> /dev/null
+$KT -importkeystore -noprompt \
+    -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
+    -srcstorepass pass1111 \
+    -deststorepass pass2222 \
+        && exit 12
+
+# You can keep storepass unchanged
+rm p12 2> /dev/null
+$KT -importkeystore -noprompt \
+    -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
+    -srcstorepass pass1111 \
+    -deststorepass pass1111 \
+        || exit 13
+$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
+	-storepass pass1111 -keypass pass1111 || exit 14
+
+# Or change storepass and keypass both
+rm p12 2> /dev/null
+$KT -importkeystore -noprompt \
+    -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
+    -srcstorepass pass1111 \
+    -deststorepass pass2222 -destkeypass pass2222 \
+        || exit 15
+$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
+	-storepass pass2222 -keypass pass2222 || exit 16
+
+# Part 2: JKS keystore with different storepass and keypass
+# Must import by alias (-srckeypass is not available when importing all)
+
+rm jks 2> /dev/null
+$KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
+	-storepass pass1111 -keypass pass2222 || exit 21
+
+# Can use old keypass as new storepass so new storepass and keypass are same
+rm p12 2> /dev/null
+$KT -importkeystore -noprompt -srcalias me \
+    -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
+    -srcstorepass pass1111 -srckeypass pass2222  \
+	-deststorepass pass2222 \
+	    || exit 22
+$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
+	-storepass pass2222 -keypass pass2222 || exit 23
+
+# Or specify both storepass and keypass to brand new ones
+rm p12 2> /dev/null
+$KT -importkeystore -noprompt -srcalias me \
+    -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
+    -srcstorepass pass1111 -srckeypass pass2222  \
+	-deststorepass pass3333 -destkeypass pass3333 \
+	    || exit 24
+$KT -certreq -storetype pkcs12 -keystore p12 -alias me \
+	-storepass pass3333 -keypass pass3333 || exit 25
+
+# Anyway you cannot make new storepass and keypass different
+rm p12 2> /dev/null
+$KT -importkeystore -noprompt -srcalias me \
+    -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \
+    -srcstorepass pass1111 -srckeypass pass2222  \
+	-deststorepass pass1111 \
+	    && exit 26
+
+exit 0
diff --git a/jdk/test/sun/util/calendar/zi/ZoneInfoFile.java b/jdk/test/sun/util/calendar/zi/ZoneInfoFile.java
index f0dda48..ae3e38d 100644
--- a/jdk/test/sun/util/calendar/zi/ZoneInfoFile.java
+++ b/jdk/test/sun/util/calendar/zi/ZoneInfoFile.java
@@ -5,7 +5,7 @@
  * This code is free software; you can redistribute 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 "Class-path" exception as provided
+ * 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
diff --git a/jdk/test/sun/util/logging/PlatformLoggerTest.java b/jdk/test/sun/util/logging/PlatformLoggerTest.java
index 2501887..ac399c0 100644
--- a/jdk/test/sun/util/logging/PlatformLoggerTest.java
+++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     6882376 6985460
+ * @bug     6882376 6985460 8010309
  * @summary Test if java.util.logging.Logger is created before and after
  *          logging is enabled.  Also validate some basic PlatformLogger
  *          operations.  othervm mode to make sure java.util.logging
@@ -33,11 +33,12 @@
  * @run main/othervm PlatformLoggerTest
  */
 
+import java.lang.reflect.Field;
 import java.util.logging.*;
 import sun.util.logging.PlatformLogger;
+import static sun.util.logging.PlatformLogger.Level.*;
 
 public class PlatformLoggerTest {
-    private static final int defaultEffectiveLevel = 0;
     public static void main(String[] args) throws Exception {
         final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
         final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
@@ -69,41 +70,65 @@
         checkLogger(GOO_PLATFORM_LOGGER, null);
         checkLogger(BAR_LOGGER, Level.WARNING);
 
-        foo.setLevel(PlatformLogger.SEVERE);
+        foo.setLevel(PlatformLogger.Level.SEVERE);
         checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);
 
+        checkPlatformLoggerLevels(foo, bar);
     }
 
+    // don't use java.util.logging here to prevent it from initialized
     private static void checkPlatformLogger(PlatformLogger logger, String name) {
         if (!logger.getName().equals(name)) {
             throw new RuntimeException("Invalid logger's name " +
                 logger.getName() + " but expected " + name);
         }
 
-        if (logger.getLevel() != defaultEffectiveLevel) {
+        if (logger.level() != null) {
             throw new RuntimeException("Invalid default level for logger " +
-                logger.getName());
+                logger.getName() + ": " + logger.level());
         }
 
-        if (logger.isLoggable(PlatformLogger.FINE) != false) {
-            throw new RuntimeException("isLoggerable(FINE) returns true for logger " +
-                logger.getName() + " but expected false");
-        }
+        checkLoggable(logger, FINE, false);
 
-        logger.setLevel(PlatformLogger.FINER);
-        if (logger.getLevel() != Level.FINER.intValue()) {
-            throw new RuntimeException("Invalid level for logger " +
-                logger.getName() + " " + logger.getLevel());
-        }
-
-        if (logger.isLoggable(PlatformLogger.FINE) != true) {
-            throw new RuntimeException("isLoggerable(FINE) returns false for logger " +
-                logger.getName() + " but expected true");
-        }
+        logger.setLevel(FINER);
+        checkLevel(logger, FINER);
+        checkLoggable(logger, FINER, true);
+        checkLoggable(logger, FINE, true);
+        checkLoggable(logger, FINEST, false);
 
         logger.info("OK: Testing log message");
     }
 
+    private static void checkLoggable(PlatformLogger logger, PlatformLogger.Level level, boolean expected) {
+        if (logger.isLoggable(level) != expected) {
+            throw new RuntimeException("logger " + logger.getName() + ": " + level +
+                (expected ? " not loggable" : " loggable"));
+        }
+
+        if (logger.isLoggable(level.intValue()) != expected) {
+            throw new RuntimeException("logger " + logger.getName() + ": " + level.intValue() +
+                (expected ? " not loggable" : " loggable"));
+        }
+
+        int value = level.intValue() + 5; // custom level value
+        if (expected && !logger.isLoggable(value)) {
+            throw new RuntimeException("logger " + logger.getName() + ": " + value +
+                " not loggable");
+        }
+    }
+
+    private static void checkLevel(PlatformLogger logger, PlatformLogger.Level level) {
+        if (logger.level() != level) {
+            throw new RuntimeException("Invalid level for logger " +
+                logger.getName() + ": " + logger.level() + " != " + level);
+        }
+
+        if (logger.getLevel() != level.intValue()) {
+            throw new RuntimeException("Invalid level for logger " +
+                logger.getName() + ": " + logger.getLevel() + " != " + level.intValue());
+        }
+    }
+
     private static void checkLogger(String name, Level level) {
         Logger logger = LogManager.getLogManager().getLogger(name);
         if (logger == null) {
@@ -125,6 +150,81 @@
         logger.info("Test info(String)");
     }
 
+    private static void checkPlatformLoggerLevels(PlatformLogger... loggers) {
+        final Level[] levels = new Level[] {
+            Level.ALL, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST,
+            Level.INFO, Level.OFF, Level.SEVERE, Level.WARNING
+        };
+
+        int count = PlatformLogger.Level.values().length;
+        if (levels.length != count) {
+            throw new RuntimeException("There are " + count +
+                    " PlatformLogger.Level members, but " + levels.length +
+                    " standard java.util.logging levels - the numbers should be equal.");
+        }
+        // check mappings
+        for (Level level : levels) {
+            checkPlatformLoggerLevelMapping(level);
+        }
+
+        for (Level level : levels) {
+            PlatformLogger.Level platformLevel = PlatformLogger.Level.valueOf(level.getName());
+            for (PlatformLogger logger : loggers) {
+                logger.setLevel(platformLevel);       // setLevel(PlatformLogger.Level)
+                checkLoggerLevel(logger, level);
+
+                logger.setLevel(ALL);  // setLevel(int)
+                checkLoggerLevel(logger, Level.ALL);
+            }
+        }
+    }
+
+    private static void checkLoggerLevel(PlatformLogger logger, Level level) {
+        PlatformLogger.Level plevel = PlatformLogger.Level.valueOf(level.getName());
+        if (plevel != logger.level()) {
+            throw new RuntimeException("Retrieved PlatformLogger level "
+                    + logger.level()
+                    + " is not the same as set level " + plevel);
+        }
+
+        // check the level set in java.util.logging.Logger
+        Logger javaLogger = LogManager.getLogManager().getLogger(logger.getName());
+        Level javaLevel = javaLogger.getLevel();
+        if (javaLogger.getLevel() != level) {
+            throw new RuntimeException("Retrieved backing java.util.logging.Logger level "
+                    + javaLevel + " is not the expected " + level);
+        }
+    }
+
+    private static void checkPlatformLoggerLevelMapping(Level level) {
+        // map the given level to PlatformLogger.Level of the same name and value
+        PlatformLogger.Level platformLevel = PlatformLogger.Level.valueOf(level.getName());
+        if (platformLevel.intValue() != level.intValue()) {
+            throw new RuntimeException("Mismatched level: " + level
+                    + " PlatformLogger.Level" + platformLevel);
+        }
+
+        try {
+            // validate if there is a public static final field in PlatformLogger
+            Field constantField = PlatformLogger.class.getField(level.getName());
+            int l = (int) constantField.get(null);
+            if (l != platformLevel.intValue()) {
+                throw new RuntimeException("static final " + level.getName() + " (" +
+                    l + ") != " + platformLevel.intValue());
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("No public static PlatformLogger." + level.getName() +
+                                       " field", e);
+        }
+        if (!platformLevel.name().equals(level.getName()))
+            throw new RuntimeException("The value of PlatformLogger." + level.getName() + ".name() is "
+                                       + platformLevel.name() + " but expected " + level.getName());
+
+        if (platformLevel.intValue() != level.intValue())
+            throw new RuntimeException("The value of PlatformLogger." + level.intValue() + ".intValue() is "
+                                       + platformLevel.intValue() + " but expected " + level.intValue());
+    }
+
     static Point[] getPoints() {
         Point[] res = new Point[3];
         res[0] = new Point(0,0);
diff --git a/jdk/test/vm/verifier/TestStaticIF.java b/jdk/test/vm/verifier/TestStaticIF.java
index 5a6776f..d3c3239 100644
--- a/jdk/test/vm/verifier/TestStaticIF.java
+++ b/jdk/test/vm/verifier/TestStaticIF.java
@@ -26,7 +26,7 @@
  * @test
  * @bug 8007736
  * @summary Test static interface method.
- * @run main/othervm -Xverify:all -XX:-UseSplitVerifier TestStaticIF
+ * @run main/othervm -Xverify:all TestStaticIF
  */
 
 public class TestStaticIF implements StaticMethodInInterface {
