changeset 6556:ff80a6b2ae9b

Merge
author lana
date Wed, 13 Feb 2013 11:25:14 -0800
parents 8181be9a3538 b2fc8e31cecc
children a5aad284904e
files
diffstat 24 files changed, 339 insertions(+), 227 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Feb 13 21:06:30 2013 +0400
+++ b/.hgtags	Wed Feb 13 11:25:14 2013 -0800
@@ -197,3 +197,4 @@
 733885f57e14cc27f5a5ff0dffe641d2fa3c704a jdk8-b73
 57d5d954462831ac353a1f40d3bb05ddb4620952 jdk8-b74
 4a67fdb752b7d6329d9be9c28d3f9d6cf7eb9a3c jdk8-b75
+3a263052866137b645ab86498a43693ff5c19e69 jdk8-b76
--- a/make/common/shared/Defs-solaris.gmk	Wed Feb 13 21:06:30 2013 +0400
+++ b/make/common/shared/Defs-solaris.gmk	Wed Feb 13 11:25:14 2013 -0800
@@ -211,7 +211,9 @@
   MAPFILE_EXCEPTIONS = \
     (libjdgaSUNWafb|libjdgaSUNWcg6|libjdgaSUNWffb|libjdgaSUNWm64|libxinerama)
 else
-  MAPFILE_EXCEPTIONS = ()
+  # At present there are no exceptions for non
+  # SPARC.  Use a harmless value.
+  MAPFILE_EXCEPTIONS = (NO_EXCEPTIONS)
 endif
 
 # Macro to check it's input file for banned dependencies and verify the
--- a/make/common/shared/Sanity.gmk	Wed Feb 13 21:06:30 2013 +0400
+++ b/make/common/shared/Sanity.gmk	Wed Feb 13 11:25:14 2013 -0800
@@ -1486,26 +1486,6 @@
 ######################################################
 sane-gcc-compiler:
 ifndef OPENJDK
-  ifeq ($(PLATFORM), solaris)
-	@if [ -r $(GCC_COMPILER_PATH) ]; then \
-	  if [ ! "$(GCC_VER)" = $(REQUIRED_GCC_VER) ]; then \
-	    $(ECHO) "ERROR: The Solaris GCC compiler version must be $(REQUIRED_GCC_VER). \n" \
-	      "      You are using the following compiler version: $(GCC_VER) \n" \
-	      "      The compiler was obtained from the following location: \n" \
-	      "          $(GCC_COMPILER_PATH) \n" \
-	      "      Please change your compiler. \n" \
-	      "" >> $(ERROR_FILE) ; \
-	fi \
-	else \
-	  $(ECHO) "ERROR: You do not have a valid GCC_COMPILER_PATH setting. \n" \
-	    "      Please check your access to \n" \
-	    "          $(GCC_COMPILER_PATH) \n" \
-	    "      and/or check your value of ALT_GCC_COMPILER_PATH. \n" \
-	    "      This will affect you if you build the plugin target. \n" \
-	    "" >> $(ERROR_FILE) ; \
-	fi
-  endif
-
   ifeq ($(PLATFORM), linux)
     ifeq ($(ARCH_DATA_MODEL), 32)
     ifdef ALT_GCC29_COMPILER_PATH
--- a/makefiles/CreateJars.gmk	Wed Feb 13 21:06:30 2013 +0400
+++ b/makefiles/CreateJars.gmk	Wed Feb 13 11:25:14 2013 -0800
@@ -836,7 +836,7 @@
 $(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar
 	$(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
 	$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
-	$(JAVA) $(JAVAC_JARS) \
+	$(JAVA) $(NEW_JAVAC) \
 	    -bootclasspath $(JDK_OUTPUTDIR)/classes \
 	    -XDprocess.packages -proc:only \
 	    -processor com.sun.tools.javac.sym.CreateSymbols \
--- a/makefiles/GensrcSwing.gmk	Wed Feb 13 21:06:30 2013 +0400
+++ b/makefiles/GensrcSwing.gmk	Wed Feb 13 11:25:14 2013 -0800
@@ -71,7 +71,7 @@
 $(JDK_OUTPUTDIR)/gensrc_no_srczip/_the.generated_beaninfo: $(BEANS_SRC) $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing/SwingBeanInfoBase.java $(JDK_OUTPUTDIR)/gensrc/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS)
 	$(ECHO) Generating beaninfo
 	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing
-	$(JAVA) -Djava.awt.headless=true -jar $(JAVADOC_JARS) -doclet GenDocletBeanInfo \
+	$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) -doclet GenDocletBeanInfo \
 	-x $(SWINGBEAN_DEBUG_FLAG) -d $(JDK_OUTPUTDIR)/gensrc_no_srczip/javax/swing \
 	-t $(DOCLETSRC_DIR)/SwingBeanInfo.template -docletpath $(JDK_OUTPUTDIR)/btclasses \
 	-XDignore.symbol.file=true \
--- a/makefiles/Setup.gmk	Wed Feb 13 21:06:30 2013 +0400
+++ b/makefiles/Setup.gmk	Wed Feb 13 11:25:14 2013 -0800
@@ -23,10 +23,6 @@
 # questions.
 #
 
-JAVAC_JARS ?= "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" -jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar
-JAVAH_JARS ?= "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javah.jar" -jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javah.jar
-JAVADOC_JARS ?= "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javadoc.jar" -jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javadoc.jar
-
 DISABLE_WARNINGS:=-Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
 
 # The generate old bytecode javac setup uses the new compiler to compile for the
@@ -34,7 +30,7 @@
 # Thus we force the target bytecode to 7.
 $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE,\
      JVM:=$(JAVA),\
-     JAVAC:=$(JAVAC_JARS),\
+     JAVAC:=$(NEW_JAVAC),\
      FLAGS:=-source 7 -target 7 -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS),\
      SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
      SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
@@ -43,8 +39,7 @@
 # new jdk. This new bytecode might only be possible to run using the new jvm.
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE,\
      JVM:=$(JAVA),\
-     JAVAC:=$(JAVAC_JARS),\
-     JAVAH:=$(JAVAH_JARS),\
+     JAVAC:=$(NEW_JAVAC),\
      FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes -source 8 -target 8 -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS),\
      SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
      SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
@@ -55,7 +50,7 @@
 # (it will be in "make images") therefore we use classes instead.
 $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE,\
      JVM:=$(JAVA),\
-     JAVAC:=$(JAVAC_JARS),\
+     JAVAC:=$(NEW_JAVAC),\
      FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS),\
      SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
      SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
--- a/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Wed Feb 13 11:25:14 2013 -0800
@@ -88,40 +88,25 @@
         DragGestureEvent trigger = getTrigger();
         InputEvent         triggerEvent = trigger.getTriggerEvent();
 
-        Point dragOrigin = trigger.getDragOrigin();
+        Point dragOrigin = new Point(trigger.getDragOrigin());
         int extModifiers = (triggerEvent.getModifiers() | triggerEvent.getModifiersEx());
         long timestamp   = triggerEvent.getWhen();
         int clickCount   = ((triggerEvent instanceof MouseEvent) ? (((MouseEvent) triggerEvent).getClickCount()) : 1);
 
-        // Get drag source component and its peer:
         Component component = trigger.getComponent();
-        Point componentOffset = new Point();
-        ComponentPeer peer = component.getPeer();
-
-        // For a lightweight component traverse up the hierarchy to the first heavyweight
-        // which will be used as the ComponentModel for the native drag source.
-        if (component.isLightweight()) {
-            Point loc = component.getLocation();
-            componentOffset.translate(loc.x, loc.y);
-
-            for (Component parent = component.getParent(); parent != null; parent = parent.getParent()) {
-                if (parent.isLightweight() == false) {
-                    peer = parent.getPeer();
-                    break;
-                }
-
-                loc = parent.getLocation();
-                componentOffset.translate(loc.x, loc.y);
-            }
+        // For a lightweight component traverse up the hierarchy to the root
+        Point loc = component.getLocation();
+        Component rootComponent = component;
+        while (!(rootComponent instanceof Window)) {
+            dragOrigin.translate(loc.x, loc.y);
+            rootComponent = rootComponent.getParent();
+            loc = rootComponent.getLocation();
         }
 
-        // Make sure the drop target is a ComponentModel:
-        if (!(peer instanceof LWComponentPeer))
-            throw new IllegalArgumentException("DragSource's peer must be a ComponentModel.");
-
-        // Get model pointer (CButton.m and such) and its native peer:
-        LWComponentPeer model = (LWComponentPeer) peer;
-        CPlatformWindow platformWindow = (CPlatformWindow) model.getPlatformWindow();
+        //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:
@@ -155,7 +140,7 @@
         try {
             // Create native dragging source:
             final long nativeDragSource = createNativeDragSource(component, peer, nativeWindowPtr, transferable, triggerEvent,
-                (int) (dragOrigin.getX() + componentOffset.x), (int) (dragOrigin.getY() + componentOffset.y), extModifiers,
+                (int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,
                 clickCount, timestamp, cursor, fDragCImage, dragImageOffset.x, dragImageOffset.y,
                 getDragSourceContext().getSourceActions(), formats, formatMap);
 
@@ -165,8 +150,8 @@
             setNativeContext(nativeDragSource);
 
             CCursorManager.getInstance().startDrag(
-                    (int) (dragOrigin.getX() + componentOffset.x),
-                    (int) (dragOrigin.getY() + componentOffset.y));
+                    (int) (dragOrigin.getX()),
+                    (int) (dragOrigin.getY()));
         }
 
         catch (Exception e) {
--- a/src/macosx/native/sun/awt/AWTWindow.m	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Wed Feb 13 11:25:14 2013 -0800
@@ -813,9 +813,9 @@
         if ([nsWindow isKeyWindow]) [window.javaMenuBar deactivate];
         window.javaMenuBar = menuBar;
 
-        // if ([self isKeyWindow]) {
-        [CMenuBar activate:window.javaMenuBar modallyDisabled:NO];
-        // }
+        if ([nsWindow isKeyWindow]) {
+            [CMenuBar activate:window.javaMenuBar modallyDisabled:NO];
+        }
     }];
 
 JNF_COCOA_EXIT(env);
--- a/src/macosx/native/sun/awt/CDragSource.m	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/macosx/native/sun/awt/CDragSource.m	Wed Feb 13 11:25:14 2013 -0800
@@ -443,9 +443,9 @@
     NSGraphicsContext* graphicsContext = [NSGraphicsContext graphicsContextWithWindow:window];
 
     // Convert mouse coordinates to NS:
-    NSPoint location = NSMakePoint(fDragPos.x, fDragPos.y);
-    NSPoint eventLocation = [fView convertPoint:location toView:nil];
-
+    NSPoint eventLocation = [fView convertPoint:NSMakePoint(fDragPos.x, fDragPos.y) toView:nil];
+    eventLocation.y = [[fView window] frame].size.height - eventLocation.y;
+    
     // Convert fTriggerEventTimeStamp to NS - AWTEvent.h defines UTC(nsEvent) as ((jlong)[event timestamp] * 1000):
     NSTimeInterval timeStamp = fTriggerEventTimeStamp / 1000;
 
@@ -497,12 +497,9 @@
     NSImage* dragImage = fDragImage;
 
     // Get drag origin and offset:
-    NSPoint dragOrigin;
-    dragOrigin.x = fDragPos.x;
-    dragOrigin.y = fDragPos.y;
-    dragOrigin = [view convertPoint:[dragEvent locationInWindow] fromView:nil];
+    NSPoint dragOrigin = [dragEvent locationInWindow];
     dragOrigin.x += fDragImageOffset.x;
-    dragOrigin.y += [dragImage size].height + fDragImageOffset.y;
+    dragOrigin.y -= fDragImageOffset.y + [dragImage size].height;
 
     // Drag offset values don't seem to matter:
     NSSize dragOffset = NSMakeSize(0, 0);
@@ -516,7 +513,6 @@
     DLog5(@"  - drag image: %f, %f (%f x %f)", fDragImageOffset.x, fDragImageOffset.y, [dragImage size].width, [dragImage size].height);
     DLog3(@"  - event point (window) %f, %f", [dragEvent locationInWindow].x, [dragEvent locationInWindow].y);
     DLog3(@"  - drag point (view) %f, %f", dragOrigin.x, dragOrigin.y);
-
     // Set up the fDragKeyModifier, so we know if the operation has changed
     // Set up the fDragMouseModifier, so we can |= it later (since CoreDrag doesn't tell us mouse states during a drag)
     fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers];
--- a/src/share/classes/java/awt/Component.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/share/classes/java/awt/Component.java	Wed Feb 13 11:25:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, 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
@@ -8994,7 +8994,10 @@
      *  to the individual objects which extend Component.
      */
 
-    AccessibleContext accessibleContext = null;
+    /**
+     * The {@code AccessibleContext} associated with this {@code Component}.
+     */
+    protected AccessibleContext accessibleContext = null;
 
     /**
      * Gets the <code>AccessibleContext</code> associated
@@ -9034,6 +9037,13 @@
         protected AccessibleAWTComponent() {
         }
 
+        /**
+         * Number of PropertyChangeListener objects registered. It's used
+         * to add/remove ComponentListener and FocusListener to track
+         * target Component's state.
+         */
+        private volatile transient int propertyListenersCount = 0;
+
         protected ComponentListener accessibleAWTComponentHandler = null;
         protected FocusListener accessibleAWTFocusHandler = null;
 
@@ -9098,10 +9108,12 @@
         public void addPropertyChangeListener(PropertyChangeListener listener) {
             if (accessibleAWTComponentHandler == null) {
                 accessibleAWTComponentHandler = new AccessibleAWTComponentHandler();
-                Component.this.addComponentListener(accessibleAWTComponentHandler);
             }
             if (accessibleAWTFocusHandler == null) {
                 accessibleAWTFocusHandler = new AccessibleAWTFocusHandler();
+            }
+            if (propertyListenersCount++ == 0) {
+                Component.this.addComponentListener(accessibleAWTComponentHandler);
                 Component.this.addFocusListener(accessibleAWTFocusHandler);
             }
             super.addPropertyChangeListener(listener);
@@ -9115,13 +9127,9 @@
          * @param listener  The PropertyChangeListener to be removed
          */
         public void removePropertyChangeListener(PropertyChangeListener listener) {
-            if (accessibleAWTComponentHandler != null) {
+            if (--propertyListenersCount == 0) {
                 Component.this.removeComponentListener(accessibleAWTComponentHandler);
-                accessibleAWTComponentHandler = null;
-            }
-            if (accessibleAWTFocusHandler != null) {
                 Component.this.removeFocusListener(accessibleAWTFocusHandler);
-                accessibleAWTFocusHandler = null;
             }
             super.removePropertyChangeListener(listener);
         }
--- a/src/share/classes/java/awt/Container.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/share/classes/java/awt/Container.java	Wed Feb 13 11:25:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2010, 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
@@ -3824,6 +3824,12 @@
             return Container.this.getAccessibleAt(p);
         }
 
+        /**
+         * Number of PropertyChangeListener objects registered. It's used
+         * to add/remove ContainerListener to track target Container's state.
+         */
+        private volatile transient int propertyListenersCount = 0;
+
         protected ContainerListener accessibleContainerHandler = null;
 
         /**
@@ -3859,11 +3865,27 @@
         public void addPropertyChangeListener(PropertyChangeListener listener) {
             if (accessibleContainerHandler == null) {
                 accessibleContainerHandler = new AccessibleContainerHandler();
+            }
+            if (propertyListenersCount++ == 0) {
                 Container.this.addContainerListener(accessibleContainerHandler);
             }
             super.addPropertyChangeListener(listener);
         }
 
+        /**
+         * Remove a PropertyChangeListener from the listener list.
+         * This removes a PropertyChangeListener that was registered
+         * for all properties.
+         *
+         * @param listener the PropertyChangeListener to be removed
+         */
+        public void removePropertyChangeListener(PropertyChangeListener listener) {
+            if (--propertyListenersCount == 0) {
+                Container.this.removeContainerListener(accessibleContainerHandler);
+            }
+            super.removePropertyChangeListener(listener);
+        }
+
     } // inner class AccessibleAWTContainer
 
     /**
--- a/src/share/classes/javax/swing/JComponent.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/share/classes/javax/swing/JComponent.java	Wed Feb 13 11:25:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -3644,26 +3644,6 @@
     }
 
     /**
-     * The <code>AccessibleContext</code> associated with this
-     * <code>JComponent</code>.
-     */
-    protected AccessibleContext accessibleContext = null;
-
-    /**
-     * Returns the <code>AccessibleContext</code> associated with this
-     * <code>JComponent</code>.  The method implemented by this base
-     * class returns null.  Classes that extend <code>JComponent</code>
-     * should implement this method to return the
-     * <code>AccessibleContext</code> associated with the subclass.
-     *
-     * @return the <code>AccessibleContext</code> of this
-     *          <code>JComponent</code>
-     */
-    public AccessibleContext getAccessibleContext() {
-        return accessibleContext;
-    }
-
-    /**
      * Inner class of JComponent used to provide default support for
      * accessibility.  This class is not meant to be used directly by
      * application developers, but is instead meant only to be
@@ -3689,7 +3669,18 @@
             super();
         }
 
-        protected ContainerListener accessibleContainerHandler = null;
+        /**
+         * Number of PropertyChangeListener objects registered. It's used
+         * to add/remove ContainerListener and FocusListener to track
+         * target JComponent's state
+         */
+        private volatile transient int propertyListenersCount = 0;
+
+        /**
+         * This field duplicates the one in java.awt.Component.AccessibleAWTComponent,
+         * so it has been deprecated.
+         */
+        @Deprecated
         protected FocusListener accessibleFocusHandler = null;
 
         /**
@@ -3747,10 +3738,12 @@
         public void addPropertyChangeListener(PropertyChangeListener listener) {
             if (accessibleFocusHandler == null) {
                 accessibleFocusHandler = new AccessibleFocusHandler();
-                JComponent.this.addFocusListener(accessibleFocusHandler);
             }
             if (accessibleContainerHandler == null) {
                 accessibleContainerHandler = new AccessibleContainerHandler();
+            }
+            if (propertyListenersCount++ == 0) {
+                JComponent.this.addFocusListener(accessibleFocusHandler);
                 JComponent.this.addContainerListener(accessibleContainerHandler);
             }
             super.addPropertyChangeListener(listener);
@@ -3764,9 +3757,9 @@
          * @param listener  the PropertyChangeListener to be removed
          */
         public void removePropertyChangeListener(PropertyChangeListener listener) {
-            if (accessibleFocusHandler != null) {
+            if (--propertyListenersCount == 0) {
                 JComponent.this.removeFocusListener(accessibleFocusHandler);
-                accessibleFocusHandler = null;
+                JComponent.this.removeContainerListener(accessibleContainerHandler);
             }
             super.removePropertyChangeListener(listener);
         }
--- a/src/share/classes/sun/java2d/pipe/PixelToShapeConverter.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/share/classes/sun/java2d/pipe/PixelToShapeConverter.java	Wed Feb 13 11:25:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1998, 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
@@ -103,12 +103,12 @@
         GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
         if (nPoints > 0) {
             gp.moveTo(xPoints[0], yPoints[0]);
-        }
-        for (int i = 1; i < nPoints; i++) {
-            gp.lineTo(xPoints[i], yPoints[i]);
-        }
-        if (close) {
-            gp.closePath();
+            for (int i = 1; i < nPoints; i++) {
+                gp.lineTo(xPoints[i], yPoints[i]);
+            }
+            if (close) {
+                gp.closePath();
+            }
         }
         return gp;
     }
--- a/src/share/native/sun/awt/image/awt_parseImage.c	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/share/native/sun/awt/image/awt_parseImage.c	Wed Feb 13 11:25:14 2013 -0800
@@ -489,6 +489,71 @@
     }
 }
 
+static void
+awt_getBIColorOrder(int type, int *colorOrder) {
+    switch(type) {
+        case java_awt_image_BufferedImage_TYPE_INT_ARGB:
+        case java_awt_image_BufferedImage_TYPE_INT_ARGB_PRE:
+#ifdef _LITTLE_ENDIAN
+            colorOrder[0] = 2;
+            colorOrder[1] = 1;
+            colorOrder[2] = 0;
+            colorOrder[3] = 3;
+#else
+            colorOrder[0] = 1;
+            colorOrder[1] = 2;
+            colorOrder[2] = 3;
+            colorOrder[3] = 0;
+#endif
+            break;
+        case java_awt_image_BufferedImage_TYPE_INT_BGR:
+#ifdef _LITTLE_ENDIAN
+            colorOrder[0] = 0;
+            colorOrder[1] = 1;
+            colorOrder[2] = 2;
+#else
+            colorOrder[0] = 3;
+            colorOrder[1] = 2;
+            colorOrder[2] = 1;
+#endif
+            break;
+        case java_awt_image_BufferedImage_TYPE_INT_RGB:
+#ifdef _LITTLE_ENDIAN
+            colorOrder[0] = 2;
+            colorOrder[1] = 1;
+            colorOrder[2] = 0;
+#else
+            colorOrder[0] = 1;
+            colorOrder[1] = 2;
+            colorOrder[2] = 3;
+#endif
+            break;
+        case java_awt_image_BufferedImage_TYPE_4BYTE_ABGR:
+        case java_awt_image_BufferedImage_TYPE_4BYTE_ABGR_PRE:
+            colorOrder[0] = 3;
+            colorOrder[1] = 2;
+            colorOrder[2] = 1;
+            colorOrder[3] = 0;
+            break;
+        case java_awt_image_BufferedImage_TYPE_3BYTE_BGR:
+            colorOrder[0] = 2;
+            colorOrder[1] = 1;
+            colorOrder[2] = 0;
+            break;
+        case java_awt_image_BufferedImage_TYPE_USHORT_565_RGB:
+        case java_awt_image_BufferedImage_TYPE_USHORT_555_RGB:
+            colorOrder[0] = 0;
+            colorOrder[1] = 1;
+            colorOrder[2] = 2;
+            break;
+        case java_awt_image_BufferedImage_TYPE_BYTE_GRAY:
+        case java_awt_image_BufferedImage_TYPE_USHORT_GRAY:
+        case java_awt_image_BufferedImage_TYPE_BYTE_BINARY:
+        case java_awt_image_BufferedImage_TYPE_BYTE_INDEXED:
+            colorOrder[0] = 0;
+            break;
+    }
+}
 
 static int
 setHints(JNIEnv *env, BufImageS_t *imageP) {
--- a/src/solaris/native/sun/awt/awt_Mlib.c	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/solaris/native/sun/awt/awt_Mlib.c	Wed Feb 13 11:25:14 2013 -0800
@@ -145,52 +145,6 @@
     return stop_timer;
 }
 
-void awt_getBIColorOrder(int type, int *colorOrder) {
-    switch(type) {
-    case java_awt_image_BufferedImage_TYPE_INT_ARGB:
-    case java_awt_image_BufferedImage_TYPE_INT_ARGB_PRE:
-        colorOrder[0] = 1;
-        colorOrder[1] = 2;
-        colorOrder[2] = 3;
-        colorOrder[3] = 0;
-        break;
-    case java_awt_image_BufferedImage_TYPE_INT_BGR:
-        colorOrder[0] = 2;
-        colorOrder[1] = 1;
-        colorOrder[2] = 0;
-        break;
-    case java_awt_image_BufferedImage_TYPE_4BYTE_ABGR:
-    case java_awt_image_BufferedImage_TYPE_4BYTE_ABGR_PRE:
-        colorOrder[0] = 3;
-        colorOrder[1] = 2;
-        colorOrder[2] = 1;
-        colorOrder[3] = 0;
-        break;
-    case java_awt_image_BufferedImage_TYPE_3BYTE_BGR:
-        colorOrder[0] = 2;
-        colorOrder[1] = 1;
-        colorOrder[2] = 0;
-        break;
-    case java_awt_image_BufferedImage_TYPE_INT_RGB:
-        colorOrder[0] = 1;
-        colorOrder[1] = 2;
-        colorOrder[2] = 3;
-        break;
-    case java_awt_image_BufferedImage_TYPE_USHORT_565_RGB:
-    case java_awt_image_BufferedImage_TYPE_USHORT_555_RGB:
-        colorOrder[0] = 0;
-        colorOrder[1] = 1;
-        colorOrder[2] = 2;
-        break;
-    case java_awt_image_BufferedImage_TYPE_BYTE_GRAY:
-    case java_awt_image_BufferedImage_TYPE_USHORT_GRAY:
-    case java_awt_image_BufferedImage_TYPE_BYTE_BINARY:
-    case java_awt_image_BufferedImage_TYPE_BYTE_INDEXED:
-        colorOrder[0] = 0;
-        break;
-    }
-}
-
 /***************************************************************************
  *                          Static Functions                               *
  ***************************************************************************/
--- a/src/solaris/native/sun/awt/awt_Mlib.h	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/solaris/native/sun/awt/awt_Mlib.h	Wed Feb 13 11:25:14 2013 -0800
@@ -33,6 +33,5 @@
 mlib_status awt_getImagingLib(JNIEnv *, mlibFnS_t *, mlibSysFnS_t *);
 mlib_start_timer awt_setMlibStartTimer();
 mlib_stop_timer awt_setMlibStopTimer();
-void awt_getBIColorOrder(int type, int *colorOrder);
 
 #endif /* _AWT_MLIB_H */
--- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Wed Feb 13 11:25:14 2013 -0800
@@ -135,11 +135,11 @@
           useMitShmPixmaps = JNI_FALSE;
         }
     }
-
-    return JNI_TRUE;
 #endif /* MITSHM */
 
 #endif /* !HEADLESS */
+
+    return JNI_TRUE;
 }
 
 
@@ -468,8 +468,8 @@
         return JNI_FALSE;
     }
 
+#endif /* !HEADLESS */
     return JNI_TRUE;
-#endif /* !HEADLESS */
 }
 
 
--- a/src/windows/native/sun/windows/awt_Mlib.cpp	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/windows/native/sun/windows/awt_Mlib.cpp	Wed Feb 13 11:25:14 2013 -0800
@@ -105,50 +105,4 @@
     mlib_stop_timer awt_setMlibStopTimer() {
         return NULL;
     }
-
-    void awt_getBIColorOrder(int type, int *colorOrder) {
-        switch(type) {
-        case java_awt_image_BufferedImage_TYPE_INT_ARGB:
-        case java_awt_image_BufferedImage_TYPE_INT_ARGB_PRE:
-            colorOrder[0] = 2;
-            colorOrder[1] = 1;
-            colorOrder[2] = 0;
-            colorOrder[3] = 3;
-            break;
-        case java_awt_image_BufferedImage_TYPE_INT_BGR:
-            colorOrder[0] = 0;
-            colorOrder[1] = 1;
-            colorOrder[2] = 2;
-            break;
-        case java_awt_image_BufferedImage_TYPE_INT_RGB:
-            colorOrder[0] = 2;
-            colorOrder[1] = 1;
-            colorOrder[2] = 0;
-            break;
-        case java_awt_image_BufferedImage_TYPE_4BYTE_ABGR:
-        case java_awt_image_BufferedImage_TYPE_4BYTE_ABGR_PRE:
-            colorOrder[0] = 3;
-            colorOrder[1] = 2;
-            colorOrder[2] = 1;
-            colorOrder[3] = 0;
-            break;
-        case java_awt_image_BufferedImage_TYPE_3BYTE_BGR:
-            colorOrder[0] = 2;
-            colorOrder[1] = 1;
-            colorOrder[2] = 0;
-            break;
-        case java_awt_image_BufferedImage_TYPE_USHORT_565_RGB:
-        case java_awt_image_BufferedImage_TYPE_USHORT_555_RGB:
-            colorOrder[0] = 0;
-            colorOrder[1] = 1;
-            colorOrder[2] = 2;
-            break;
-        case java_awt_image_BufferedImage_TYPE_BYTE_GRAY:
-        case java_awt_image_BufferedImage_TYPE_USHORT_GRAY:
-        case java_awt_image_BufferedImage_TYPE_BYTE_BINARY:
-        case java_awt_image_BufferedImage_TYPE_BYTE_INDEXED:
-            colorOrder[0] = 0;
-            break;
-        }
-    }
 }
--- a/src/windows/native/sun/windows/awt_Mlib.h	Wed Feb 13 21:06:30 2013 +0400
+++ b/src/windows/native/sun/windows/awt_Mlib.h	Wed Feb 13 11:25:14 2013 -0800
@@ -38,7 +38,6 @@
                                         mlibSysFnS_t *sMlibSysFns);
 JNIEXPORT mlib_start_timer awt_setMlibStartTimer();
 JNIEXPORT mlib_stop_timer awt_setMlibStopTimer();
-JNIEXPORT void awt_getBIColorOrder(int type, int *colorOrder);
 
 #ifdef __cplusplus
 }; /* end of extern "C" */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/image/LookupOp/IntImageReverseTest.java	Wed Feb 13 11:25:14 2013 -0800
@@ -0,0 +1,99 @@
+/*
+ * 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     8004801
+ * @summary Test verifies that byte lookup table with single lookup
+ *          affects only color components in buffered images with
+ *          integer data type, and that this operation does not distort
+ *          colors in the destination image.
+ * @run     main IntImageReverseTest
+ */
+
+import java.awt.image.BufferedImage;
+import java.awt.image.ByteLookupTable;
+import java.awt.image.LookupOp;
+import java.awt.image.LookupTable;
+
+public class IntImageReverseTest {
+
+    public static void main(String[] args) {
+        LookupTable tbl = createReverseTable();
+        LookupOp op = new LookupOp(tbl, null);
+
+        for (ImageType t : ImageType.values()) {
+            System.out.print(t);
+
+            BufferedImage src = createSourceImage(t);
+
+            BufferedImage dst = op.filter(src, null);
+
+            int rgb = dst.getRGB(0, 0);
+
+            System.out.printf(" Result: 0x%X ", rgb);
+
+            if (rgb != argbReverse) {
+                throw new RuntimeException("Test failed.");
+            }
+            System.out.println("Passed.");
+        }
+    }
+
+    /**
+     * Reverse image color components, leave alpha unchanged.
+     */
+    private static LookupTable createReverseTable() {
+        byte[] data = new byte[256];
+
+        for (int i = 0; i < 256; i++) {
+            data[i] = (byte) (255 - i);
+        }
+
+
+        return new ByteLookupTable(0, data);
+    }
+
+    private static BufferedImage createSourceImage(ImageType type) {
+        BufferedImage img = new BufferedImage(1, 1, type.bi_type);
+
+        img.setRGB(0, 0, argbTest);
+
+        return img;
+    }
+    private static final int argbTest = 0xFFDDAA77;
+    private static final int argbReverse = 0xFF225588;
+
+    private static enum ImageType {
+
+        INT_ARGB(BufferedImage.TYPE_INT_ARGB),
+        INT_ARGB_PRE(BufferedImage.TYPE_INT_ARGB_PRE),
+        INT_RGB(BufferedImage.TYPE_INT_BGR),
+        INT_BGR(BufferedImage.TYPE_INT_BGR);
+
+        private ImageType(int bi_type) {
+            this.bi_type = bi_type;
+        }
+        public final int bi_type;
+    }
+}
--- a/test/javax/swing/JSlider/4252173/bug4252173.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/test/javax/swing/JSlider/4252173/bug4252173.java	Wed Feb 13 11:25:14 2013 -0800
@@ -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
@@ -22,11 +22,11 @@
  */
 
 /* @test
-   @bug 4252173
-   @summary Inability to reuse the HorizontalSliderThumbIcon
-   @author Pavel Porvatov
-   @run main bug4252173
-*/
+ * @bug 4252173 7077259
+ * @summary Inability to reuse the HorizontalSliderThumbIcon
+ * @author Pavel Porvatov
+ * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel bug4252173
+ */
 
 import javax.swing.*;
 import javax.swing.plaf.metal.DefaultMetalTheme;
--- a/test/javax/swing/JSpinner/6532833/bug6532833.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/test/javax/swing/JSpinner/6532833/bug6532833.java	Wed Feb 13 11:25:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 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
@@ -22,10 +22,11 @@
  */
 
 /* @test
-   @bug 6532833
-   @summary PIT: Metal LAF - The right side border is not shown for the Spinner after the removing the buttons
-   @author Pavel Porvatov
-*/
+ * @bug 6532833 7077259
+ * @summary PIT: Metal LAF - The right side border is not shown for the Spinner after the removing the buttons
+ * @author Pavel Porvatov
+ * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel bug6532833
+ */
 
 import javax.swing.*;
 import java.awt.*;
--- a/test/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java	Wed Feb 13 21:06:30 2013 +0400
+++ b/test/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java	Wed Feb 13 11:25:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 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
@@ -23,22 +23,21 @@
 
 /*
  * @test
- * @bug 6657026
+ * @bug 6657026 7077259
  * @summary Tests shared MetalSliderUI in different application contexts
  * @author Sergey Malenkov
+ * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel Test6657026
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.JSlider;
 import javax.swing.UIManager;
 import javax.swing.plaf.metal.MetalLookAndFeel;
 import javax.swing.plaf.metal.MetalSliderUI;
+import sun.awt.SunToolkit;
 
 public class Test6657026 extends MetalSliderUI implements Runnable {
 
     public static void main(String[] args) throws Exception {
-        UIManager.setLookAndFeel(new MetalLookAndFeel());
         JSlider slider = new JSlider();
         test(slider);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/java2d/pipe/Test8004821.java	Wed Feb 13 11:25:14 2013 -0800
@@ -0,0 +1,60 @@
+/*
+ * 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.Graphics2D;
+import java.awt.Polygon;
+import java.awt.image.BufferedImage;
+
+/**
+ * @test
+ * @bug 8004821
+ * @summary Verifies that drawPolygon() works with empty arrays.
+ * @author Sergey Bylokhov
+ */
+public final class Test8004821 {
+
+    public static void main(final String[] args) {
+        final int[] arrEmpty = {};
+        final int[] arr1elem = {150};
+        final BufferedImage bi = new BufferedImage(300, 300,
+                                                   BufferedImage.TYPE_INT_RGB);
+        final Graphics2D g = (Graphics2D) bi.getGraphics();
+        test(g, arrEmpty);
+        test(g, arr1elem);
+        g.translate(2.0, 2.0);
+        test(g, arrEmpty);
+        test(g, arr1elem);
+        g.scale(2.0, 2.0);
+        test(g, arrEmpty);
+        test(g, arr1elem);
+        g.dispose();
+    }
+
+    private static void test(final Graphics2D g, final int[] arr) {
+        g.drawPolygon(arr, arr, arr.length);
+        g.drawPolygon(new Polygon(arr, arr, arr.length));
+        g.fillPolygon(arr, arr, arr.length);
+        g.fillPolygon(new Polygon(arr, arr, arr.length));
+        g.drawPolyline(arr, arr, arr.length);
+    }
+}