changeset 5247:355cf1937d08 jdk7u8-b03

Merge
author lana
date Wed, 08 Aug 2012 14:44:18 -0700
parents 88bae220774b 2ae43459258f
children 043839897cd9 d099fc840e6c
files
diffstat 42 files changed, 1165 insertions(+), 363 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/com/apple/laf/AquaPanelUI.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaPanelUI.java	Wed Aug 08 14:44:18 2012 -0700
@@ -32,10 +32,20 @@
 import com.apple.laf.AquaUtils.RecyclableSingleton;
 import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
 
+import java.awt.Graphics;
+
 public class AquaPanelUI extends BasicPanelUI {
     static RecyclableSingleton<AquaPanelUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPanelUI>(AquaPanelUI.class);
 
     public static ComponentUI createUI(final JComponent c) {
         return instance.get();
     }
+
+    @Override
+    public final void update(final Graphics g, final JComponent c) {
+        if (c.isOpaque()) {
+            AquaUtils.fillRect(g, c);
+        }
+        paint(g, c);
+    }
 }
--- a/src/macosx/classes/com/apple/laf/AquaRootPaneUI.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaRootPaneUI.java	Wed Aug 08 14:44:18 2012 -0700
@@ -319,4 +319,12 @@
             updateComponentTreeUIActivation(element, active);
         }
     }
+
+    @Override
+    public final void update(final Graphics g, final JComponent c) {
+        if (c.isOpaque()) {
+            AquaUtils.fillRect(g, c);
+        }
+        paint(g, c);
+    }
 }
--- a/src/macosx/classes/com/apple/laf/AquaToolBarUI.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaToolBarUI.java	Wed Aug 08 14:44:18 2012 -0700
@@ -73,9 +73,7 @@
             g.translate(x, y);
 
             if (c.isOpaque()) {
-                final Color background = c.getBackground();
-                g.setColor(background);
-                g.fillRect(0, 0, w - 1, h - 1);
+                AquaUtils.fillRect(g, c, c.getBackground(), 0, 0, w - 1, h - 1);
             }
 
             final Color oldColor = g.getColor();
@@ -137,4 +135,12 @@
             return true;
         }
     }
+
+    @Override
+    public final void update(final Graphics g, final JComponent c) {
+        if (c.isOpaque()) {
+            AquaUtils.fillRect(g, c);
+        }
+        paint(g, c);
+    }
 }
--- a/src/macosx/classes/com/apple/laf/AquaUtils.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaUtils.java	Wed Aug 08 14:44:18 2012 -0700
@@ -28,18 +28,19 @@
 import java.awt.*;
 import java.awt.image.*;
 import java.lang.ref.SoftReference;
-import java.lang.ref.WeakReference;
 import java.lang.reflect.Method;
 import java.security.PrivilegedAction;
 import java.util.*;
 
 import javax.swing.*;
 import javax.swing.border.Border;
+import javax.swing.plaf.UIResource;
 
 import sun.awt.AppContext;
 
 import sun.lwawt.macosx.CImage;
 import sun.lwawt.macosx.CImage.Creator;
+import sun.lwawt.macosx.CPlatformWindow;
 import sun.swing.SwingUtilities2;
 
 import com.apple.laf.AquaImageFactory.SlicedImageControl;
@@ -389,4 +390,51 @@
             return false;
         }
     }
+
+    protected static boolean isWindowTextured(final Component c) {
+        if (!(c instanceof JComponent)) {
+            return false;
+        }
+        final JRootPane pane = ((JComponent) c).getRootPane();
+        if (pane == null) {
+            return false;
+        }
+        Object prop = pane.getClientProperty(
+                CPlatformWindow.WINDOW_BRUSH_METAL_LOOK);
+        if (prop != null) {
+            return Boolean.parseBoolean(prop.toString());
+        }
+        prop = pane.getClientProperty(CPlatformWindow.WINDOW_STYLE);
+        return prop != null && "textured".equals(prop);
+    }
+
+    private static Color resetAlpha(final Color color) {
+        return new Color(color.getRed(), color.getGreen(), color.getBlue(), 0);
+    }
+
+    protected static void fillRect(final Graphics g, final Component c) {
+        fillRect(g, c, c.getBackground(), 0, 0, c.getWidth(), c.getHeight());
+    }
+
+    protected static void fillRect(final Graphics g, final Component c,
+                                   final Color color, final int x, final int y,
+                                   final int w, final int h) {
+        if (!(g instanceof Graphics2D)) {
+            return;
+        }
+        final Graphics2D cg = (Graphics2D) g.create();
+        try {
+            if (color instanceof UIResource && isWindowTextured(c)
+                    && color.equals(SystemColor.window)) {
+                cg.setComposite(AlphaComposite.Src);
+                cg.setColor(resetAlpha(color));
+            } else {
+                cg.setColor(color);
+            }
+            cg.fillRect(x, y, w, h);
+        } finally {
+            cg.dispose();
+        }
+    }
 }
+
--- a/src/macosx/classes/sun/java2d/opengl/CGLLayer.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/java2d/opengl/CGLLayer.java	Wed Aug 08 14:44:18 2012 -0700
@@ -68,11 +68,12 @@
     }
 
     public boolean isOpaque() {
-        return peer.isOpaque();
+        return !peer.isTranslucent();
     }
 
     public int getTransparency() {
-        return (peer.isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT);
+        return peer.isTranslucent() ? Transparency.TRANSLUCENT :
+               Transparency.OPAQUE;
     }
 
     public Object getDestination() {
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Aug 08 14:44:18 2012 -0700
@@ -424,8 +424,7 @@
 
     @Override
     public final Graphics getGraphics() {
-        Graphics g = getWindowPeerOrSelf().isOpaque() ? getOnscreenGraphics()
-                                                      : getOffscreenGraphics();
+        final Graphics g = getOnscreenGraphics();
         if (g != null) {
             synchronized (getPeerTreeLock()){
                 applyConstrain(g);
@@ -443,13 +442,7 @@
         final LWWindowPeer wp = getWindowPeerOrSelf();
         return wp.getOnscreenGraphics(getForeground(), getBackground(),
                                       getFont());
-    }
 
-    public final Graphics getOffscreenGraphics() {
-        final LWWindowPeer wp = getWindowPeerOrSelf();
-
-        return wp.getOffscreenGraphics(getForeground(), getBackground(),
-                                       getFont());
     }
 
     private void applyConstrain(final Graphics g) {
@@ -463,7 +456,7 @@
     }
 
     //TODO Move this method to SG2D?
-    private void SG2DConstraint(final SunGraphics2D sg2d, Region r) {
+    void SG2DConstraint(final SunGraphics2D sg2d, Region r) {
         sg2d.constrainX = sg2d.transX;
         sg2d.constrainY = sg2d.transY;
 
@@ -710,7 +703,7 @@
         // Obtain the metrics from the offscreen window where this peer is
         // mostly drawn to.
         // TODO: check for "use platform metrics" settings
-        Graphics g = getWindowPeer().getOffscreenGraphics();
+        Graphics g = getWindowPeer().getGraphics();
         try {
             if (g != null) {
                 return g.getFontMetrics(f);
@@ -1011,14 +1004,33 @@
     @Override
     public final void applyShape(final Region shape) {
         synchronized (getStateLock()) {
-            region = shape;
+            if (region == shape || (region != null && region.equals(shape))) {
+                return;
+            }
+        }
+        applyShapeImpl(shape);
+    }
+
+    void applyShapeImpl(final Region shape) {
+        synchronized (getStateLock()) {
+            if (shape != null) {
+                region = Region.WHOLE_REGION.getIntersection(shape);
+            } else {
+                region = null;
+            }
         }
         repaintParent(getBounds());
     }
 
     protected final Region getRegion() {
         synchronized (getStateLock()) {
-            return region == null ? Region.getInstance(getSize()) : region;
+            return isShaped() ? region : Region.getInstance(getSize());
+        }
+    }
+
+    public boolean isShaped() {
+        synchronized (getStateLock()) {
+            return region != null;
         }
     }
 
@@ -1386,11 +1398,6 @@
         }
     }
 
-    // Just a helper method, thus final
-    protected final void flushOffscreenGraphics() {
-        flushOffscreenGraphics(getSize());
-    }
-
     protected static final void flushOnscreenGraphics(){
         final OGLRenderQueue rq = OGLRenderQueue.getInstance();
         rq.lock();
@@ -1401,36 +1408,6 @@
         }
     }
 
-    /*
-     * Flushes the given rectangle from the back buffer to the screen.
-     */
-    protected void flushOffscreenGraphics(Rectangle r) {
-        flushOffscreenGraphics(r.x, r.y, r.width, r.height);
-    }
-
-    private void flushOffscreenGraphics(int x, int y, int width, int height) {
-        Image bb = getWindowPeerOrSelf().getBackBuffer();
-        if (bb != null) {
-            // g is a screen Graphics from the delegate
-            final Graphics g = getOnscreenGraphics();
-
-            if (g != null && g instanceof Graphics2D) {
-                try {
-                    Graphics2D g2d = (Graphics2D)g;
-                    Point p = localToWindow(new Point(0, 0));
-                    Composite composite = g2d.getComposite();
-                    g2d.setComposite(AlphaComposite.Src);
-                    g.drawImage(bb, x, y, x + width, y + height, p.x + x,
-                            p.y + y, p.x + x + width, p.y + y + height,
-                            null);
-                    g2d.setComposite(composite);
-                } finally {
-                    g.dispose();
-                }
-            }
-        }
-    }
-
     /**
      * Used by ContainerPeer to skip all the paint events during layout.
      *
--- a/src/macosx/classes/sun/lwawt/LWRepaintArea.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWRepaintArea.java	Wed Aug 08 14:44:18 2012 -0700
@@ -58,9 +58,6 @@
 
     private static void flushBuffers(final LWComponentPeer peer) {
         if (peer != null) {
-            if (!peer.getWindowPeerOrSelf().isOpaque()) {
-                peer.flushOffscreenGraphics();
-            }
             peer.flushOnscreenGraphics();
         }
     }
--- a/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Wed Aug 08 14:44:18 2012 -0700
@@ -129,16 +129,6 @@
     }
 
     @Override
-    public void setText(final String l) {
-        // Please note that we do not want to post an event
-        // if TextArea.setText() replaces an empty text by an empty text,
-        // that is, if component's text remains unchanged.
-        if (!l.isEmpty() || getTextComponent().getDocument().getLength() != 0) {
-            super.setText(l);
-        }
-    }
-
-    @Override
     public void replaceRange(final String text, final int start,
                              final int end) {
         synchronized (getDelegateLock()) {
--- a/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Wed Aug 08 14:44:18 2012 -0700
@@ -124,7 +124,7 @@
     }
 
     @Override
-    public void setText(final String l) {
+    public final void setText(final String l) {
         synchronized (getDelegateLock()) {
             // JTextArea.setText() posts two different events (remove & insert).
             // Since we make no differences between text events,
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed Aug 08 14:44:18 2012 -0700
@@ -522,12 +522,6 @@
         postEvent(targetToAppContext(event.getSource()), event);
     }
 
-    // use peer's back buffer to implement non-opaque windows.
-    @Override
-    public boolean needUpdateWindow() {
-        return true;
-    }
-
     @Override
     public void grab(Window w) {
         if (w.getPeer() != null) {
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Aug 08 14:44:18 2012 -0700
@@ -37,6 +37,7 @@
 import sun.java2d.*;
 import sun.java2d.loops.Blit;
 import sun.java2d.loops.CompositeType;
+import sun.java2d.pipe.Region;
 import sun.util.logging.PlatformLogger;
 
 public class LWWindowPeer
@@ -109,6 +110,10 @@
 
     private volatile boolean skipNextFocusChange;
 
+    private static final Color nonOpaqueBackground = new Color(0, 0, 0, 0);
+
+    private volatile boolean textured;
+
     /**
      * Current modal blocker or null.
      *
@@ -169,6 +174,11 @@
         setAlwaysOnTop(getTarget().isAlwaysOnTop());
         updateMinimumSize();
 
+        final Shape shape = getTarget().getShape();
+        if (shape != null) {
+            applyShape(Region.getInstance(shape, null));
+        }
+
         final float opacity = getTarget().getOpacity();
         if (opacity < 1.0f) {
             setOpacity(opacity);
@@ -178,7 +188,7 @@
 
         updateInsets(platformWindow.getInsets());
         if (getSurfaceData() == null) {
-            replaceSurfaceData();
+            replaceSurfaceData(false);
         }
     }
 
@@ -279,7 +289,7 @@
             // "buffer", that's why numBuffers - 1
             assert numBuffers > 1;
 
-            replaceSurfaceData(numBuffers - 1, caps);
+            replaceSurfaceData(numBuffers - 1, caps, false);
         } catch (InvalidPipeException z) {
             throw new AWTException(z.toString());
         }
@@ -441,19 +451,44 @@
     public final void setOpaque(final boolean isOpaque) {
         if (this.isOpaque != isOpaque) {
             this.isOpaque = isOpaque;
-            getPlatformWindow().setOpaque(isOpaque);
-            replaceSurfaceData();
-            repaintPeer();
+            updateOpaque();
         }
     }
 
-    public final boolean isOpaque() {
-        return isOpaque;
+    private void updateOpaque() {
+        getPlatformWindow().setOpaque(!isTranslucent());
+        replaceSurfaceData(false);
+        repaintPeer();
     }
 
     @Override
     public void updateWindow() {
-        flushOffscreenGraphics();
+    }
+
+    public final boolean isTextured() {
+        return textured;
+    }
+
+    public final void setTextured(final boolean isTextured) {
+        textured = isTextured;
+    }
+
+    public final boolean isTranslucent() {
+        synchronized (getStateLock()) {
+            /*
+             * Textured window is a special case of translucent window.
+             * The difference is only in nswindow background. So when we set
+             * texture property our peer became fully translucent. It doesn't
+             * fill background, create non opaque backbuffers and layer etc.
+             */
+            return !isOpaque || isShaped() || isTextured();
+        }
+    }
+
+    @Override
+    final void applyShapeImpl(final Region shape) {
+        super.applyShapeImpl(shape);
+        updateOpaque();
     }
 
     @Override
@@ -608,7 +643,20 @@
                                                getFont());
         if (g != null) {
             try {
-                g.clearRect(0, 0, w, h);
+                if (g instanceof Graphics2D) {
+                    ((Graphics2D) g).setComposite(AlphaComposite.Src);
+                }
+                if (isTranslucent()) {
+                    g.setColor(nonOpaqueBackground);
+                    g.fillRect(0, 0, w, h);
+                }
+                if (!isTextured()) {
+                    if (g instanceof SunGraphics2D) {
+                        SG2DConstraint((SunGraphics2D) g, getRegion());
+                    }
+                    g.setColor(getBackground());
+                    g.fillRect(0, 0, w, h);
+                }
             } finally {
                 g.dispose();
             }
@@ -915,35 +963,6 @@
         });
     }
 
-    /**
-     * This method returns a back buffer Graphics to render all the
-     * peers to. After the peer is painted, the back buffer contents
-     * should be flushed to the screen. All the target painting
-     * (Component.paint() method) should be done directly to the screen.
-     */
-    protected final Graphics getOffscreenGraphics(Color fg, Color bg, Font f) {
-        final Image bb = getBackBuffer();
-        if (bb == null) {
-            return null;
-        }
-        if (fg == null) {
-            fg = SystemColor.windowText;
-        }
-        if (bg == null) {
-            bg = SystemColor.window;
-        }
-        if (f == null) {
-            f = DEFAULT_FONT;
-        }
-        final Graphics2D g = (Graphics2D) bb.getGraphics();
-        if (g != null) {
-            g.setColor(fg);
-            g.setBackground(bg);
-            g.setFont(f);
-        }
-        return g;
-    }
-
     /*
      * May be called by delegate to provide SD to Java2D code.
      */
@@ -954,11 +973,16 @@
     }
 
     private void replaceSurfaceData() {
-        replaceSurfaceData(backBufferCount, backBufferCaps);
+        replaceSurfaceData(true);
+    }
+
+    private void replaceSurfaceData(boolean blit) {
+        replaceSurfaceData(backBufferCount, backBufferCaps, blit);
     }
 
     private void replaceSurfaceData(int newBackBufferCount,
-                                                 BufferCapabilities newBackBufferCaps) {
+                                    BufferCapabilities newBackBufferCaps,
+                                    boolean blit) {
         synchronized (surfaceDataLock) {
             final SurfaceData oldData = getSurfaceData();
             surfaceData = platformWindow.replaceSurfaceData();
@@ -971,7 +995,10 @@
             if (getSurfaceData() != null && oldData != getSurfaceData()) {
                 clearBackground(size.width, size.height);
             }
-            blitSurfaceData(oldData, getSurfaceData());
+
+            if (blit) {
+                blitSurfaceData(oldData, getSurfaceData());
+            }
 
             if (oldData != null && oldData != getSurfaceData()) {
                 // TODO: drop oldData for D3D/WGL pipelines
@@ -986,11 +1013,18 @@
                 Graphics g = backBuffer.getGraphics();
                 try {
                     Rectangle r = getBounds();
-                    g.setColor(getBackground());
                     if (g instanceof Graphics2D) {
                         ((Graphics2D) g).setComposite(AlphaComposite.Src);
                     }
+                    g.setColor(nonOpaqueBackground);
                     g.fillRect(0, 0, r.width, r.height);
+                    if (g instanceof SunGraphics2D) {
+                        SG2DConstraint((SunGraphics2D) g, getRegion());
+                    }
+                    if (!isTextured()) {
+                        g.setColor(getBackground());
+                        g.fillRect(0, 0, r.width, r.height);
+                    }
                     if (oldBB != null) {
                         // Draw the old back buffer to the new one
                         g.drawImage(oldBB, 0, 0, null);
@@ -1014,7 +1048,7 @@
                                           CompositeType.Src,
                                           dst.getSurfaceType());
             if (blit != null) {
-                blit.Blit(src, dst, ((Graphics2D) getGraphics()).getComposite(),
+                blit.Blit(src, dst, AlphaComposite.Src,
                           getRegion(), 0, 0, 0, 0, size.width, size.height);
             }
         }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Wed Aug 08 14:44:18 2012 -0700
@@ -117,7 +117,7 @@
         Rectangle r = peer.getBounds();
         Image im = null;
         if (!r.isEmpty()) {
-            int transparency = (peer.isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT);
+            int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
             im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency);
         }
         return im;
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Wed Aug 08 14:44:18 2012 -0700
@@ -64,7 +64,7 @@
     }
 
     public boolean isOpaque() {
-        return peer.isOpaque();
+        return !peer.isTranslucent();
     }
 
     /*
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Aug 08 14:44:18 2012 -0700
@@ -299,7 +299,7 @@
 
         // If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look.
         if (isPopup) {
-            styleBits = SET(styleBits, TEXTURED, true);
+            styleBits = SET(styleBits, TEXTURED, false);
             // Popups in applets don't activate applet's process
             styleBits = SET(styleBits, NONACTIVATING, true);
         }
@@ -373,6 +373,8 @@
             }
         }
 
+        peer.setTextured(IS(TEXTURED, styleBits));
+
         return styleBits;
     }
 
@@ -740,10 +742,19 @@
     @Override
     public void setOpaque(boolean isOpaque) {
         CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
-        if (!isOpaque) {
+        if (!isOpaque && !peer.isTextured()) {
             long clearColor = CWrapper.NSColor.clearColor();
             CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
         }
+
+        //This is a temporary workaround. Looks like after 7124236 will be fixed
+        //the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                invalidateShadow();
+            }
+        });
     }
 
     @Override
@@ -813,6 +824,10 @@
     }
 
 
+    public final void invalidateShadow(){
+        nativeRevalidateNSWindowShadow(getNSWindowPtr());
+    }
+
     // ----------------------------------------------------------------------
     //                          UTILITY METHODS
     // ----------------------------------------------------------------------
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Aug 08 14:44:18 2012 -0700
@@ -759,6 +759,11 @@
     }
 
     @Override
+    public boolean isWindowShapingSupported() {
+        return true;
+    }
+
+    @Override
     public boolean isWindowTranslucencySupported() {
         return true;
     }
@@ -768,6 +773,10 @@
         return true;
     }
 
+    public boolean isSwingBackbufferTranslucencySupported() {
+        return true;
+    }
+
     @Override
     public boolean enableInputMethodsForTextComponent() {
         return true;
--- a/src/macosx/native/sun/awt/AWTWindow.m	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Wed Aug 08 14:44:18 2012 -0700
@@ -1017,14 +1017,17 @@
 (JNIEnv *env, jclass clazz, jlong windowPtr)
 {
 JNF_COCOA_ENTER(env);
-AWT_ASSERT_NOT_APPKIT_THREAD;
 
     NSWindow *nsWindow = OBJC(windowPtr);
-    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
-        AWT_ASSERT_APPKIT_THREAD;
+    if ([NSThread isMainThread]) {
+        [nsWindow invalidateShadow];
+    } else {
+        [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+            AWT_ASSERT_APPKIT_THREAD;
 
-        [nsWindow invalidateShadow];
-    }];
+            [nsWindow invalidateShadow];
+        }];
+    }
 
 JNF_COCOA_EXIT(env);
 }
--- a/src/share/classes/com/sun/beans/TypeResolver.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/com/sun/beans/TypeResolver.java	Wed Aug 08 14:44:18 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -45,6 +45,9 @@
  * @author Sergey Malenkov
  */
 public final class TypeResolver {
+
+    private static final WeakCache<Type, Map<Type, Type>> CACHE = new WeakCache<>();
+
     /**
      * Replaces the given {@code type} in an inherited method
      * with the actual type it has in the given {@code inClass}.
@@ -149,12 +152,55 @@
      * @param formal  the type where occurrences of the variables
      *                in {@code actual} will be replaced by the corresponding bound values
      * @return a resolved type
-     *
-     * @see #TypeResolver(Type)
-     * @see #resolve(Type)
      */
     public static Type resolve(Type actual, Type formal) {
-        return getTypeResolver(actual).resolve(formal);
+        if (formal instanceof Class) {
+            return formal;
+        }
+        if (formal instanceof GenericArrayType) {
+            Type comp = ((GenericArrayType) formal).getGenericComponentType();
+            comp = resolve(actual, comp);
+            return (comp instanceof Class)
+                    ? Array.newInstance((Class<?>) comp, 0).getClass()
+                    : GenericArrayTypeImpl.make(comp);
+        }
+        if (formal instanceof ParameterizedType) {
+            ParameterizedType fpt = (ParameterizedType) formal;
+            Type[] actuals = resolve(actual, fpt.getActualTypeArguments());
+            return ParameterizedTypeImpl.make(
+                    (Class<?>) fpt.getRawType(), actuals, fpt.getOwnerType());
+        }
+        if (formal instanceof WildcardType) {
+            WildcardType fwt = (WildcardType) formal;
+            Type[] upper = resolve(actual, fwt.getUpperBounds());
+            Type[] lower = resolve(actual, fwt.getLowerBounds());
+            return new WildcardTypeImpl(upper, lower);
+        }
+        if (formal instanceof TypeVariable) {
+            Map<Type, Type> map;
+            synchronized (CACHE) {
+                map = CACHE.get(actual);
+                if (map == null) {
+                    map = new HashMap<>();
+                    prepare(map, actual);
+                    CACHE.put(actual, map);
+                }
+            }
+            Type result = map.get(formal);
+            if (result == null || result.equals(formal)) {
+                return formal;
+            }
+            result = fixGenericArray(result);
+            // A variable can be bound to another variable that is itself bound
+            // to something.  For example, given:
+            // class Super<T> {...}
+            // class Mid<X> extends Super<T> {...}
+            // class Sub extends Mid<String>
+            // the variable T is bound to X, which is in turn bound to String.
+            // So if we have to resolve T, we need the tail recursion here.
+            return resolve(actual, result);
+        }
+        throw new IllegalArgumentException("Bad Type kind: " + formal.getClass());
     }
 
     /**
@@ -164,12 +210,14 @@
      * @param actual   the type that supplies bindings for type variables
      * @param formals  the array of types to resolve
      * @return an array of resolved types
-     *
-     * @see #TypeResolver(Type)
-     * @see #resolve(Type[])
      */
     public static Type[] resolve(Type actual, Type[] formals) {
-        return getTypeResolver(actual).resolve(formals);
+        int length = formals.length;
+        Type[] actuals = new Type[length];
+        for (int i = 0; i < length; i++) {
+            actuals[i] = resolve(actual, formals[i]);
+        }
+        return actuals;
     }
 
     /**
@@ -228,32 +276,6 @@
         return classes;
     }
 
-    public static TypeResolver getTypeResolver(Type type) {
-        synchronized (CACHE) {
-            TypeResolver resolver = CACHE.get(type);
-            if (resolver == null) {
-                resolver = new TypeResolver(type);
-                CACHE.put(type, resolver);
-            }
-            return resolver;
-        }
-    }
-
-    private static final WeakCache<Type, TypeResolver> CACHE = new WeakCache<>();
-
-    private final Map<TypeVariable<?>, Type> map = new HashMap<>();
-
-    /**
-     * Constructs the type resolver for the given actual type.
-     *
-     * @param actual  the type that supplies bindings for type variables
-     *
-     * @see #prepare(Type)
-     */
-    private TypeResolver(Type actual) {
-        prepare(actual);
-    }
-
     /**
      * Fills the map from type parameters
      * to types as seen by the given {@code type}.
@@ -265,9 +287,10 @@
      * to a {@link ParameterizedType ParameterizedType} with no parameters,
      * or it represents the erasure of a {@link ParameterizedType ParameterizedType}.
      *
+     * @param map   the mappings of all type variables
      * @param type  the next type in the hierarchy
      */
-    private void prepare(Type type) {
+    private static void prepare(Map<Type, Type> map, Type type) {
         Class<?> raw = (Class<?>)((type instanceof Class<?>)
                 ? type
                 : ((ParameterizedType)type).getRawType());
@@ -280,91 +303,25 @@
 
         assert formals.length == actuals.length;
         for (int i = 0; i < formals.length; i++) {
-            this.map.put(formals[i], actuals[i]);
+            map.put(formals[i], actuals[i]);
         }
         Type gSuperclass = raw.getGenericSuperclass();
         if (gSuperclass != null) {
-            prepare(gSuperclass);
+            prepare(map, gSuperclass);
         }
         for (Type gInterface : raw.getGenericInterfaces()) {
-            prepare(gInterface);
+            prepare(map, gInterface);
         }
         // If type is the raw version of a parameterized class, we type-erase
         // all of its type variables, including inherited ones.
         if (type instanceof Class<?> && formals.length > 0) {
-            for (Map.Entry<TypeVariable<?>, Type> entry : this.map.entrySet()) {
+            for (Map.Entry<Type, Type> entry : map.entrySet()) {
                 entry.setValue(erase(entry.getValue()));
             }
         }
     }
 
     /**
-     * Replaces the given {@code formal} type
-     * with the type it stand for in this type resolver.
-     *
-     * @param formal  the array of types to resolve
-     * @return a resolved type
-     */
-    private Type resolve(Type formal) {
-        if (formal instanceof Class) {
-            return formal;
-        }
-        if (formal instanceof GenericArrayType) {
-            Type comp = ((GenericArrayType)formal).getGenericComponentType();
-            comp = resolve(comp);
-            return (comp instanceof Class)
-                    ? Array.newInstance((Class<?>)comp, 0).getClass()
-                    : GenericArrayTypeImpl.make(comp);
-        }
-        if (formal instanceof ParameterizedType) {
-            ParameterizedType fpt = (ParameterizedType)formal;
-            Type[] actuals = resolve(fpt.getActualTypeArguments());
-            return ParameterizedTypeImpl.make(
-                    (Class<?>)fpt.getRawType(), actuals, fpt.getOwnerType());
-        }
-        if (formal instanceof WildcardType) {
-            WildcardType fwt = (WildcardType)formal;
-            Type[] upper = resolve(fwt.getUpperBounds());
-            Type[] lower = resolve(fwt.getLowerBounds());
-            return new WildcardTypeImpl(upper, lower);
-        }
-        if (!(formal instanceof TypeVariable)) {
-            throw new IllegalArgumentException("Bad Type kind: " + formal.getClass());
-        }
-        Type actual = this.map.get((TypeVariable) formal);
-        if (actual == null || actual.equals(formal)) {
-            return formal;
-        }
-        actual = fixGenericArray(actual);
-        return resolve(actual);
-        // A variable can be bound to another variable that is itself bound
-        // to something.  For example, given:
-        // class Super<T> {...}
-        // class Mid<X> extends Super<T> {...}
-        // class Sub extends Mid<String>
-        // the variable T is bound to X, which is in turn bound to String.
-        // So if we have to resolve T, we need the tail recursion here.
-    }
-
-    /**
-     * Replaces all formal types in the given array
-     * with the types they stand for in this type resolver.
-     *
-     * @param formals  the array of types to resolve
-     * @return an array of resolved types
-     *
-     * @see #resolve(Type)
-     */
-    private Type[] resolve(Type[] formals) {
-        int length = formals.length;
-        Type[] actuals = new Type[length];
-        for (int i = 0; i < length; i++) {
-            actuals[i] = resolve(formals[i]);
-        }
-        return actuals;
-    }
-
-    /**
      * Replaces a {@link GenericArrayType GenericArrayType}
      * with plain array class where it is possible.
      * Bug <a href="http://bugs.sun.com/view_bug.do?bug_id=5041784">5041784</a>
--- a/src/share/classes/com/sun/beans/finder/MethodFinder.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/com/sun/beans/finder/MethodFinder.java	Wed Aug 08 14:44:18 2012 -0700
@@ -164,8 +164,10 @@
                             return findAccessibleMethod(m);
                         }
                         Type[] gpts = m.getGenericParameterTypes();
-                        if (Arrays.equals(params, TypeResolver.erase(TypeResolver.resolve(pt, gpts)))) {
-                            return findAccessibleMethod(m);
+                        if (params.length == gpts.length) {
+                            if (Arrays.equals(params, TypeResolver.erase(TypeResolver.resolve(pt, gpts)))) {
+                                return findAccessibleMethod(m);
+                            }
                         }
                     }
                 }
--- a/src/share/classes/java/awt/TextComponent.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/java/awt/TextComponent.java	Wed Aug 08 14:44:18 2012 -0700
@@ -233,9 +233,14 @@
      * @see         java.awt.TextComponent#getText
      */
     public synchronized void setText(String t) {
+        boolean skipTextEvent = (text == null || text.isEmpty())
+                && (t == null || t.isEmpty());
         text = (t != null) ? t : "";
         TextComponentPeer peer = (TextComponentPeer)this.peer;
-        if (peer != null) {
+        // Please note that we do not want to post an event
+        // if TextArea.setText() or TextField.setText() replaces an empty text
+        // by an empty text, that is, if component's text remains unchanged.
+        if (peer != null && !skipTextEvent) {
             peer.setText(text);
         }
     }
--- a/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Wed Aug 08 14:44:18 2012 -0700
@@ -181,20 +181,21 @@
                 // the Indexed readMethod was explicitly set to null.
                 return null;
             }
+            String nextMethodName = Introspector.GET_PREFIX + getBaseName();
             if (indexedReadMethodName == null) {
                 Class type = getIndexedPropertyType0();
                 if (type == boolean.class || type == null) {
                     indexedReadMethodName = Introspector.IS_PREFIX + getBaseName();
                 } else {
-                    indexedReadMethodName = Introspector.GET_PREFIX + getBaseName();
+                    indexedReadMethodName = nextMethodName;
                 }
             }
 
             Class[] args = { int.class };
             indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
-            if (indexedReadMethod == null) {
+            if ((indexedReadMethod == null) && !indexedReadMethodName.equals(nextMethodName)) {
                 // no "is" method, so look for a "get" method.
-                indexedReadMethodName = Introspector.GET_PREFIX + getBaseName();
+                indexedReadMethodName = nextMethodName;
                 indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
             }
             setIndexedReadMethod0(indexedReadMethod);
--- a/src/share/classes/java/beans/Introspector.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/java/beans/Introspector.java	Wed Aug 08 14:44:18 2012 -0700
@@ -25,6 +25,7 @@
 
 package java.beans;
 
+import com.sun.beans.TypeResolver;
 import com.sun.beans.WeakCache;
 import com.sun.beans.finder.ClassFinder;
 
@@ -34,6 +35,7 @@
 import java.lang.ref.SoftReference;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
 
 import java.util.Map;
 import java.util.ArrayList;
@@ -951,44 +953,61 @@
                     continue;
                 }
 
-                Class argTypes[] = FeatureDescriptor.getParameterTypes(beanClass, method);
-                Class resultType = FeatureDescriptor.getReturnType(beanClass, method);
-
-                if (name.startsWith(ADD_PREFIX) && argTypes.length == 1 &&
-                    resultType == Void.TYPE &&
-                    Introspector.isSubclass(argTypes[0], eventListenerType)) {
-                    String listenerName = name.substring(3);
-                    if (listenerName.length() > 0 &&
-                        argTypes[0].getName().endsWith(listenerName)) {
-                        if (adds == null) {
-                            adds = new HashMap();
+                if (name.startsWith(ADD_PREFIX)) {
+                    Class<?> returnType = method.getReturnType();
+                    if (returnType == void.class) {
+                        Type[] parameterTypes = method.getGenericParameterTypes();
+                        if (parameterTypes.length == 1) {
+                            Class<?> type = TypeResolver.erase(TypeResolver.resolveInClass(beanClass, parameterTypes[0]));
+                            if (Introspector.isSubclass(type, eventListenerType)) {
+                                String listenerName = name.substring(3);
+                                if (listenerName.length() > 0 &&
+                                    type.getName().endsWith(listenerName)) {
+                                    if (adds == null) {
+                                        adds = new HashMap();
+                                    }
+                                    adds.put(listenerName, method);
+                                }
+                            }
                         }
-                        adds.put(listenerName, method);
                     }
                 }
-                else if (name.startsWith(REMOVE_PREFIX) && argTypes.length == 1 &&
-                         resultType == Void.TYPE &&
-                         Introspector.isSubclass(argTypes[0], eventListenerType)) {
-                    String listenerName = name.substring(6);
-                    if (listenerName.length() > 0 &&
-                        argTypes[0].getName().endsWith(listenerName)) {
-                        if (removes == null) {
-                            removes = new HashMap();
+                else if (name.startsWith(REMOVE_PREFIX)) {
+                    Class<?> returnType = method.getReturnType();
+                    if (returnType == void.class) {
+                        Type[] parameterTypes = method.getGenericParameterTypes();
+                        if (parameterTypes.length == 1) {
+                            Class<?> type = TypeResolver.erase(TypeResolver.resolveInClass(beanClass, parameterTypes[0]));
+                            if (Introspector.isSubclass(type, eventListenerType)) {
+                                String listenerName = name.substring(6);
+                                if (listenerName.length() > 0 &&
+                                    type.getName().endsWith(listenerName)) {
+                                    if (removes == null) {
+                                        removes = new HashMap();
+                                    }
+                                    removes.put(listenerName, method);
+                                }
+                            }
                         }
-                        removes.put(listenerName, method);
                     }
                 }
-                else if (name.startsWith(GET_PREFIX) && argTypes.length == 0 &&
-                         resultType.isArray() &&
-                         Introspector.isSubclass(resultType.getComponentType(),
-                                                 eventListenerType)) {
-                    String listenerName  = name.substring(3, name.length() - 1);
-                    if (listenerName.length() > 0 &&
-                        resultType.getComponentType().getName().endsWith(listenerName)) {
-                        if (gets == null) {
-                            gets = new HashMap();
+                else if (name.startsWith(GET_PREFIX)) {
+                    Class<?>[] parameterTypes = method.getParameterTypes();
+                    if (parameterTypes.length == 0) {
+                        Class<?> returnType = FeatureDescriptor.getReturnType(beanClass, method);
+                        if (returnType.isArray()) {
+                            Class<?> type = returnType.getComponentType();
+                            if (Introspector.isSubclass(type, eventListenerType)) {
+                                String listenerName  = name.substring(3, name.length() - 1);
+                                if (listenerName.length() > 0 &&
+                                    type.getName().endsWith(listenerName)) {
+                                    if (gets == null) {
+                                        gets = new HashMap();
+                                    }
+                                    gets.put(listenerName, method);
+                                }
+                            }
                         }
-                        gets.put(listenerName, method);
                     }
                 }
             }
@@ -1240,11 +1259,11 @@
     private boolean isEventHandler(Method m) {
         // We assume that a method is an event handler if it has a single
         // argument, whose type inherit from java.util.Event.
-        Class argTypes[] = FeatureDescriptor.getParameterTypes(beanClass, m);
+        Type argTypes[] = m.getGenericParameterTypes();
         if (argTypes.length != 1) {
             return false;
         }
-        return isSubclass(argTypes[0], EventObject.class);
+        return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
     }
 
     /*
@@ -1296,24 +1315,25 @@
                 }
 
                 // make sure method signature matches.
-                Class params[] = FeatureDescriptor.getParameterTypes(start, method);
-                if (method.getName().equals(methodName) &&
-                    params.length == argCount) {
-                    if (args != null) {
-                        boolean different = false;
-                        if (argCount > 0) {
-                            for (int j = 0; j < argCount; j++) {
-                                if (params[j] != args[j]) {
-                                    different = true;
+                if (method.getName().equals(methodName)) {
+                    Type[] params = method.getGenericParameterTypes();
+                    if (params.length == argCount) {
+                        if (args != null) {
+                            boolean different = false;
+                            if (argCount > 0) {
+                                for (int j = 0; j < argCount; j++) {
+                                    if (TypeResolver.erase(TypeResolver.resolveInClass(start, params[j])) != args[j]) {
+                                        different = true;
+                                        continue;
+                                    }
+                                }
+                                if (different) {
                                     continue;
                                 }
                             }
-                            if (different) {
-                                continue;
-                            }
                         }
+                        return method;
                     }
-                    return method;
                 }
             }
         }
--- a/src/share/classes/java/beans/PropertyDescriptor.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/java/beans/PropertyDescriptor.java	Wed Aug 08 14:44:18 2012 -0700
@@ -210,12 +210,13 @@
                 // The read method was explicitly set to null.
                 return null;
             }
+            String nextMethodName = Introspector.GET_PREFIX + getBaseName();
             if (readMethodName == null) {
                 Class type = getPropertyType0();
                 if (type == boolean.class || type == null) {
                     readMethodName = Introspector.IS_PREFIX + getBaseName();
                 } else {
-                    readMethodName = Introspector.GET_PREFIX + getBaseName();
+                    readMethodName = nextMethodName;
                 }
             }
 
@@ -225,8 +226,8 @@
             // methods.  If an "is" method exists, this is the official
             // reader method so look for this one first.
             readMethod = Introspector.findMethod(cls, readMethodName, 0);
-            if (readMethod == null) {
-                readMethodName = Introspector.GET_PREFIX + getBaseName();
+            if ((readMethod == null) && !readMethodName.equals(nextMethodName)) {
+                readMethodName = nextMethodName;
                 readMethod = Introspector.findMethod(cls, readMethodName, 0);
             }
             try {
--- a/src/share/classes/javax/swing/JComponent.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/javax/swing/JComponent.java	Wed Aug 08 14:44:18 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2636,17 +2636,16 @@
      *    attribute: visualUpdate true
      */
     public void setVisible(boolean aFlag) {
-        if(aFlag != isVisible()) {
+        if (aFlag != isVisible()) {
             super.setVisible(aFlag);
-            Container parent = getParent();
-            if(parent != null) {
-                Rectangle r = getBounds();
-                parent.repaint(r.x,r.y,r.width,r.height);
+            if (aFlag) {
+                Container parent = getParent();
+                if (parent != null) {
+                    Rectangle r = getBounds();
+                    parent.repaint(r.x, r.y, r.width, r.height);
+                }
+                revalidate();
             }
-            // Some (all should) LayoutManagers do not consider components
-            // that are not visible. As such we need to revalidate when the
-            // visible bit changes.
-            revalidate();
         }
     }
 
@@ -5564,4 +5563,22 @@
         ",preferredSize=" + preferredSizeString;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    @Deprecated
+    public void hide() {
+        boolean showing = isShowing();
+        super.hide();
+        if (showing) {
+            Container parent = getParent();
+            if (parent != null) {
+                Rectangle r = getBounds();
+                parent.repaint(r.x, r.y, r.width, r.height);
+            }
+            revalidate();
+        }
+    }
+
 }
--- a/src/share/classes/javax/swing/JViewport.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/javax/swing/JViewport.java	Wed Aug 08 14:44:18 2012 -0700
@@ -1586,10 +1586,18 @@
         int bdx = blitToX - blitFromX;
         int bdy = blitToY - blitFromY;
 
+        Composite oldComposite = null;
         // Shift the scrolled region
+        if (g instanceof Graphics2D) {
+            Graphics2D g2d = (Graphics2D) g;
+            oldComposite = g2d.getComposite();
+            g2d.setComposite(AlphaComposite.Src);
+        }
         rm.copyArea(this, g, blitFromX, blitFromY, blitW, blitH, bdx, bdy,
                     false);
-
+        if (oldComposite != null) {
+            ((Graphics2D) g).setComposite(oldComposite);
+        }
         // Paint the newly exposed region.
         int x = view.getX();
         int y = view.getY();
--- a/src/share/classes/javax/swing/RepaintManager.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/javax/swing/RepaintManager.java	Wed Aug 08 14:44:18 2012 -0700
@@ -119,6 +119,11 @@
     // Whether or not a VolatileImage should be used for double-buffered painting
     static boolean volatileImageBufferEnabled = true;
     /**
+     * Type of VolatileImage which should be used for double-buffered
+     * painting.
+     */
+    private static final int volatileBufferType;
+    /**
      * Value of the system property awt.nativeDoubleBuffering.
      */
     private static boolean nativeDoubleBuffering;
@@ -204,6 +209,13 @@
             ((SunGraphicsEnvironment)ge).addDisplayChangedListener(
                     new DisplayChangedHandler());
         }
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        if ((tk instanceof SunToolkit)
+                && ((SunToolkit) tk).isSwingBackbufferTranslucencySupported()) {
+            volatileBufferType = Transparency.TRANSLUCENT;
+        } else {
+            volatileBufferType = Transparency.OPAQUE;
+        }
     }
 
     /**
@@ -985,7 +997,8 @@
             if (image != null) {
                 image.flush();
             }
-            image = config.createCompatibleVolatileImage(width, height);
+            image = config.createCompatibleVolatileImage(width, height,
+                                                         volatileBufferType);
             volatileMap.put(config, image);
         }
         return image;
@@ -1479,9 +1492,26 @@
                     for(y=clipY, maxy = clipY + clipH; y < maxy ; y += bh) {
                         osg.translate(-x, -y);
                         osg.setClip(x,y,bw,bh);
+                        if (volatileBufferType != Transparency.OPAQUE
+                                && osg instanceof Graphics2D) {
+                            final Graphics2D g2d = (Graphics2D) osg;
+                            final Color oldBg = g2d.getBackground();
+                            g2d.setBackground(c.getBackground());
+                            g2d.clearRect(x, y, bw, bh);
+                            g2d.setBackground(oldBg);
+                        }
                         c.paintToOffscreen(osg, x, y, bw, bh, maxx, maxy);
                         g.setClip(x, y, bw, bh);
-                        g.drawImage(image, x, y, c);
+                        if (volatileBufferType != Transparency.OPAQUE
+                                && g instanceof Graphics2D) {
+                            final Graphics2D g2d = (Graphics2D) g;
+                            final Composite oldComposite = g2d.getComposite();
+                            g2d.setComposite(AlphaComposite.Src);
+                            g2d.drawImage(image, x, y, c);
+                            g2d.setComposite(oldComposite);
+                        } else {
+                            g.drawImage(image, x, y, c);
+                        }
                         osg.translate(x, y);
                     }
                 }
--- a/src/share/classes/sun/awt/SunToolkit.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/classes/sun/awt/SunToolkit.java	Wed Aug 08 14:44:18 2012 -0700
@@ -1976,6 +1976,13 @@
     }
 
     /**
+     * Returns true if swing backbuffer should be translucent.
+     */
+    public boolean isSwingBackbufferTranslucencySupported() {
+        return false;
+    }
+
+    /**
      * Returns whether or not a containing top level window for the passed
      * component is
      * {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}.
--- a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Wed Aug 08 14:44:18 2012 -0700
@@ -393,7 +393,16 @@
                    OGLSDOps *dstOps,
                    jint dx1, jint dy1, jint dx2, jint dy2)
 {
+    jboolean adjustAlpha = (pf != NULL && !pf->hasAlpha);
     j2d_glBindTexture(dstOps->textureTarget, dstOps->textureID);
+
+    if (adjustAlpha) {
+        // if the source surface does not have an alpha channel,
+        // we need to ensure that the alpha values are forced to 1.0f
+        j2d_glPixelTransferf(GL_ALPHA_SCALE, 0.0f);
+        j2d_glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
+    }
+
     // in case pixel stride is not a multiple of scanline stride the copy
     // has to be done line by line (see 6207877)
     if (srcInfo->scanStride % srcInfo->pixelStride != 0) {
@@ -413,6 +422,11 @@
                             dx1, dy1, dx2-dx1, dy2-dy1,
                             pf->format, pf->type, srcInfo->rasBase);
     }
+    if (adjustAlpha) {
+        // restore scale/bias to their original values
+        j2d_glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+        j2d_glPixelTransferf(GL_ALPHA_BIAS, 0.0f);
+    }
 }
 
 /**
--- a/src/solaris/bin/java_md_solinux.c	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/solaris/bin/java_md_solinux.c	Wed Aug 08 14:44:18 2012 -0700
@@ -982,7 +982,18 @@
 int
 ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
     int rslt;
-#ifdef __linux__
+#ifdef __solaris__
+    thread_t tid;
+    long flags = 0;
+    if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
+      void * tmp;
+      thr_join(tid, NULL, &tmp);
+      rslt = (int)tmp;
+    } else {
+      /* See below. Continue in current thread if thr_create() failed */
+      rslt = continuation(args);
+    }
+#else /* ! __solaris__ */
     pthread_t tid;
     pthread_attr_t attr;
     pthread_attr_init(&attr);
@@ -1007,18 +1018,7 @@
     }
 
     pthread_attr_destroy(&attr);
-#else /* ! __linux__ */
-    thread_t tid;
-    long flags = 0;
-    if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
-      void * tmp;
-      thr_join(tid, NULL, &tmp);
-      rslt = (int)tmp;
-    } else {
-      /* See above. Continue in current thread if thr_create() failed */
-      rslt = continuation(args);
-    }
-#endif /* __linux__ */
+#endif /* __solaris__ */
     return rslt;
 }
 
--- a/src/solaris/bin/java_md_solinux.h	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/solaris/bin/java_md_solinux.h	Wed Aug 08 14:44:18 2012 -0700
@@ -54,10 +54,10 @@
 #endif
 
 #include <dlfcn.h>
-#ifdef __linux__
+#ifdef __solaris__
+#include <thread.h>
+#else
 #include <pthread.h>
-#else
-#include <thread.h>
 #endif
 
 #define JVM_DLL         "libjvm.so"
--- a/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Wed Aug 08 14:44:18 2012 -0700
@@ -464,13 +464,6 @@
 
     protected boolean setTextImpl(String txt) {
         if (jtext != null) {
-            // Please note that we do not want to post an event
-            // if setText() replaces an empty text by an empty text,
-            // that is, if component's text remains unchanged.
-            if (jtext.getDocument().getLength() == 0 && txt.length() == 0) {
-                return true;
-            }
-
             // JTextArea.setText() posts two different events (remove & insert).
             // Since we make no differences between text events,
             // the document listener has to be disabled while
--- a/src/solaris/native/sun/nio/ch/DatagramDispatcher.c	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/solaris/native/sun/nio/ch/DatagramDispatcher.c	Wed Aug 08 14:44:18 2012 -0700
@@ -36,6 +36,7 @@
 #include <sys/socket.h>
 
 #include "nio_util.h"
+#include <limits.h>
 
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_DatagramDispatcher_read0(JNIEnv *env, jclass clazz,
@@ -60,23 +61,14 @@
     ssize_t result = 0;
     struct iovec *iov = (struct iovec *)jlong_to_ptr(address);
     struct msghdr m;
-    if (len > 16) {
-        len = 16;
+    if (len > IOV_MAX) {
+        len = IOV_MAX;
     }
 
-    m.msg_name = NULL;
-    m.msg_namelen = 0;
+    // initialize the message
+    memset(&m, 0, sizeof(m));
     m.msg_iov = iov;
     m.msg_iovlen = len;
-#ifdef __solaris__
-    m.msg_accrights = NULL;
-    m.msg_accrightslen = 0;
-#endif
-
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
-    m.msg_control = NULL;
-    m.msg_controllen = 0;
-#endif
 
     result = recvmsg(fd, &m, 0);
     if (result < 0 && errno == ECONNREFUSED) {
@@ -108,23 +100,14 @@
     struct iovec *iov = (struct iovec *)jlong_to_ptr(address);
     struct msghdr m;
     ssize_t result = 0;
-    if (len > 16) {
-        len = 16;
+    if (len > IOV_MAX) {
+        len = IOV_MAX;
     }
 
-    m.msg_name = NULL;
-    m.msg_namelen = 0;
+    // initialize the message
+    memset(&m, 0, sizeof(m));
     m.msg_iov = iov;
     m.msg_iovlen = len;
-#ifdef __solaris__
-    m.msg_accrights = NULL;
-    m.msg_accrightslen = 0;
-#endif
-
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
-    m.msg_control = NULL;
-    m.msg_controllen = 0;
-#endif
 
     result = sendmsg(fd, &m, 0);
     if (result < 0 && errno == ECONNREFUSED) {
--- a/src/solaris/transport/socket/socket_md.c	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/solaris/transport/socket/socket_md.c	Wed Aug 08 14:44:18 2012 -0700
@@ -35,8 +35,7 @@
 #include <sys/time.h>
 #ifdef __solaris__
 #include <thread.h>
-#endif
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#else
 #include <pthread.h>
 #include <sys/poll.h>
 #endif
@@ -306,9 +305,7 @@
     return r;
 }
 
-#endif
-
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#else
 int
 dbgsysTlsAlloc() {
     pthread_key_t key;
--- a/src/windows/native/java/net/NetworkInterface.c	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/windows/native/java/net/NetworkInterface.c	Wed Aug 08 14:44:18 2012 -0700
@@ -504,8 +504,7 @@
      */
     if (netaddrCount < 0) {
         netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
-        if ((*env)->ExceptionOccurred(env)) {
-            free_netaddr(netaddrP);
+        if (netaddrCount == -1) {
             return NULL;
         }
     }
--- a/src/windows/native/java/net/NetworkInterface_winXP.c	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/windows/native/java/net/NetworkInterface_winXP.c	Wed Aug 08 14:44:18 2012 -0700
@@ -194,8 +194,7 @@
     while (curr != NULL) {
         netaddr *netaddrP;
         ret = enumAddresses_win(env, curr, &netaddrP);
-        if ((*env)->ExceptionOccurred(env)) {
-            free_netaddr(netaddrP);
+        if (ret == -1) {
             return -1;
         }
         curr->addrs = netaddrP;
@@ -449,8 +448,7 @@
      */
     if (netaddrCount < 0) {
         netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
-        if ((*env)->ExceptionOccurred(env)) {
-            free_netaddr(netaddrP);
+        if (netaddrCount == -1) {
             return NULL;
         }
     }
--- a/src/windows/native/sun/windows/awt_Component.cpp	Tue Aug 07 14:30:03 2012 -0700
+++ b/src/windows/native/sun/windows/awt_Component.cpp	Wed Aug 08 14:44:18 2012 -0700
@@ -558,6 +558,8 @@
 
     m_hwnd = hwnd;
 
+    ::ImmAssociateContext(m_hwnd, NULL);
+
     SetDrawState((jint)JAWT_LOCK_SURFACE_CHANGED |
         (jint)JAWT_LOCK_BOUNDS_CHANGED |
         (jint)JAWT_LOCK_CLIP_CHANGED);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java	Wed Aug 08 14:44:18 2012 -0700
@@ -0,0 +1,157 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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       6385277
+ * @summary   Tests that override redirect window gets activated on click.
+ * @author    anton.tarasov@sun.com: area=awt.focus
+ * @library   ../../regtesthelpers
+ * @build     Util
+ * @run       main OverrideRedirectWindowActivationTest
+ */
+import java.awt.*;
+import java.awt.event.*;
+import java.util.concurrent.Callable;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+import test.java.awt.regtesthelpers.Util;
+
+public class OverrideRedirectWindowActivationTest {
+
+    private static Frame frame;
+    private static Window window;
+    private static Button fbutton;
+    private static Button wbutton;
+    private static Label label;
+    private static Robot robot;
+    private static SunToolkit toolkit;
+
+    public static void main(String[] args) throws Exception {
+
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            System.out.println("No testing on Motif. Test passed.");
+            return;
+        }
+
+        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+
+            public void eventDispatched(AWTEvent e) {
+                System.out.println(e);
+            }
+        }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK);
+
+        createAndShowWindow();
+        toolkit.realSync();
+
+        createAndShowFrame();
+        toolkit.realSync();
+
+        // click on Frame
+        clickOn(getClickPoint(frame));
+
+        if (!frame.isFocused()) {
+            throw new RuntimeException("Error: a frame couldn't be focused by click.");
+        }
+
+        //click on Label in Window
+        clickOn(getClickPoint(label));
+
+        if (!window.isFocused()) {
+            throw new RuntimeException("Test failed: the window couldn't be activated by click!");
+        }
+
+        // bring focus back to the frame
+        clickOn(getClickPoint(fbutton));
+
+        if (!frame.isFocused()) {
+            throw new RuntimeException("Error: a frame couldn't be focused by click.");
+        }
+
+        // Test 2. Verifies that clicking on a component of unfocusable Window
+        //         won't activate it.
+
+        window.setFocusableWindowState(false);
+        toolkit.realSync();
+
+
+        clickOn(getClickPoint(label));
+
+        if (window.isFocused()) {
+            throw new RuntimeException("Test failed: unfocusable window got activated by click!");
+        }
+        System.out.println("Test passed.");
+
+    }
+
+    private static void createAndShowWindow() {
+
+        frame = new Frame("Test Frame");
+        window = new Window(frame);
+        wbutton = new Button("wbutton");
+        label = new Label("label");
+
+        window.setBounds(800, 200, 200, 100);
+        window.setLayout(new FlowLayout());
+        window.add(wbutton);
+        window.add(label);
+        window.setVisible(true);
+
+    }
+
+    private static void createAndShowFrame() {
+        fbutton = new Button("fbutton");
+
+        frame.setBounds(800, 0, 200, 100);
+        frame.setLayout(new FlowLayout());
+        frame.add(fbutton);
+        frame.setVisible(true);
+
+    }
+
+    static void clickOn(Point point) {
+
+        robot.mouseMove(point.x, point.y);
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        toolkit.realSync();
+    }
+
+    static Point getClickPoint(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+        return new Point(p.x + (int) (d.getWidth() / 2), p.y + (int) (d.getHeight() / 2));
+    }
+
+    static Point getClickPoint(Frame frame) {
+        Point p = frame.getLocationOnScreen();
+        Dimension d = frame.getSize();
+        return new Point(p.x + (int) (d.getWidth() / 2), p.y + (frame.getInsets().top / 2));
+    }
+}
--- a/test/java/awt/Window/Grab/GrabTest.java	Tue Aug 07 14:30:03 2012 -0700
+++ b/test/java/awt/Window/Grab/GrabTest.java	Wed Aug 08 14:44:18 2012 -0700
@@ -65,7 +65,7 @@
             }, sun.awt.SunToolkit.GRAB_EVENT_MASK);
 
         f = new Frame("Frame");
-        f.setSize(200, 200);
+        f.setBounds(0, 0, 300, 300);
         f.addMouseListener(new MouseAdapter() {
                 public void mousePressed(MouseEvent e) {
                     System.out.println(e);
@@ -74,7 +74,7 @@
             });
 
         f1 = new Frame("OtherFrame");
-        f1.setBounds(600, 100, 200, 200);
+        f1.setBounds(700, 100, 200, 200);
 
         w = new Window(f);
         w.setLayout(new FlowLayout());
@@ -86,7 +86,7 @@
                 }
             });
         w.add(b);
-        w.setBounds(300, 100, 200, 200);
+        w.setBounds(400, 100, 200, 200);
         w.setBackground(Color.blue);
         w.addMouseListener(new MouseAdapter() {
                 public void mousePressed(MouseEvent e) {
@@ -175,7 +175,8 @@
 
         // 6. Check that press on the outside area causes ungrab
         Point loc = f.getLocationOnScreen();
-        robot.mouseMove(loc.x + 100, loc.y + f.getSize().height + 300);
+        robot.mouseMove(loc.x + 100, loc.y + f.getSize().height + 1);
+        Util.waitForIdle(robot);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.delay(50);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java	Wed Aug 08 14:44:18 2012 -0700
@@ -0,0 +1,138 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4028580
+ * @summary TextArea does not send TextEvent when setText. Does for insert
+ * @author kdm@sparc.spb.su: area= awt.TextAvent
+ * @run main TextEventSequenceTest
+ */
+import java.awt.*;
+import java.awt.event.*;
+import sun.awt.SunToolkit;
+
+public class TextEventSequenceTest {
+
+    private static Frame f;
+    private static TextField tf;
+    private static TextArea t;
+    private static int cntEmptyStrings = 0;
+    private static int cntNonEmptyStrings = 0;
+
+    public static void main(String[] args) {
+
+        test("non-empty text string");
+        test("");
+        test(null);
+    }
+
+    private static void test(String test) {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        createAndShowGUI(test);
+        toolkit.realSync();
+
+        initCounts();
+        t.setText("Hello ");
+        toolkit.realSync();
+        t.append("World! !");
+        toolkit.realSync();
+        t.insert("from Roger Pham", 13);
+        toolkit.realSync();
+        t.replaceRange("Java Duke", 18, 28);
+        toolkit.realSync();
+        checkCounts(0, 4);
+
+        initCounts();
+        t.setText("");
+        toolkit.realSync();
+        t.setText("");
+        toolkit.realSync();
+        t.setText("");
+        toolkit.realSync();
+        checkCounts(1, 0);
+
+        initCounts();
+        tf.setText("Hello There!");
+        toolkit.realSync();
+        checkCounts(0, 1);
+
+        initCounts();
+        tf.setText("");
+        toolkit.realSync();
+        tf.setText("");
+        toolkit.realSync();
+        tf.setText("");
+        toolkit.realSync();
+        checkCounts(1, 0);
+
+        f.dispose();
+    }
+
+    private static void createAndShowGUI(String text) {
+        f = new Frame("TextEventSequenceTest");
+        f.setLayout(new FlowLayout());
+
+        TextListener listener = new MyTextListener();
+
+        tf = new TextField(text);
+        tf.addTextListener(listener);
+        f.add(tf);
+
+        t = new TextArea(text, 10, 30);
+        t.addTextListener(listener);
+        f.add(t);
+
+        f.pack();
+        f.setVisible(true);
+    }
+
+    static class MyTextListener implements TextListener {
+
+        public synchronized void textValueChanged(TextEvent e) {
+            TextComponent tc = (TextComponent) e.getSource();
+            String text = tc.getText();
+            if (text.length() == 0) {
+                cntEmptyStrings++;
+            } else {
+                cntNonEmptyStrings++;
+            }
+        }
+    }
+
+    synchronized static void initCounts() {
+        cntEmptyStrings = 0;
+        cntNonEmptyStrings = 0;
+    }
+
+    synchronized static void checkCounts(int empty, int nonempty) {
+        if (empty != cntEmptyStrings || nonempty != cntNonEmptyStrings) {
+            throw new RuntimeException(
+                    String.format("Expected events: empty = %d, nonempty = %d, "
+                    + "actual events: empty = %d, nonempty = %d",
+                    empty, nonempty, cntEmptyStrings, cntNonEmptyStrings));
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/beans/Performance/Test7122740.java	Wed Aug 08 14:44:18 2012 -0700
@@ -0,0 +1,57 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7122740
+ * @summary Tests just a benchmark of PropertyDescriptor(String, Class) performance
+ * @author Sergey Malenkov
+ * @run main/manual Test7122740
+ */
+
+import java.beans.PropertyDescriptor;
+
+public class Test7122740 {
+    public static void main(String[] args) throws Exception {
+        long time = System.nanoTime();
+        for (int i = 0; i < 1000; i++) {
+            new PropertyDescriptor("name", PropertyDescriptor.class);
+            new PropertyDescriptor("value", Concrete.class);
+        }
+        time -= System.nanoTime();
+        System.out.println("Time (ms): " + (-time / 1000000));
+    }
+
+    public static class Abstract<T> {
+        private T value;
+        public T getValue() {
+            return this.value;
+        }
+        public void setValue(T value) {
+            this.value = value;
+        }
+    }
+
+    private static class Concrete extends Abstract<String> {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/beans/Performance/Test7184799.java	Wed Aug 08 14:44:18 2012 -0700
@@ -0,0 +1,71 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7184799
+ * @summary Tests just a benchmark of Introspector.getBeanInfo(Class) performance
+ * @author Sergey Malenkov
+ * @run main/manual Test7184799
+ */
+
+import java.beans.Introspector;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class Test7184799 {
+    private static final Class[] TYPES = {
+            Class.class,
+            String.class,
+            Character.class,
+            Boolean.class,
+            Byte.class,
+            Short.class,
+            Integer.class,
+            Long.class,
+            Float.class,
+            Double.class,
+            Collection.class,
+            Set.class,
+            HashSet.class,
+            TreeSet.class,
+            LinkedHashSet.class,
+            Map.class,
+            HashMap.class,
+            TreeMap.class,
+            LinkedHashMap.class,
+            WeakHashMap.class,
+            ConcurrentHashMap.class,
+            Dictionary.class,
+            Exception.class,
+    };
+
+    public static void main(String[] args) throws Exception {
+        long time = System.nanoTime();
+        for (Class type : TYPES) {
+            Introspector.getBeanInfo(type);
+        }
+        time -= System.nanoTime();
+        System.out.println("Time (ms): " + (-time / 1000000));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JComponent/7154030/bug7154030.java	Wed Aug 08 14:44:18 2012 -0700
@@ -0,0 +1,169 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Portions Copyright (c) 2012 IBM Corporation
+ */
+
+import javax.swing.JButton;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+
+import java.awt.AWTException;
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+
+/* @test 1.1 2012/04/12
+ * @bug 7154030
+ * @summary Swing components fail to hide after calling hide()
+ * @author Jonathan Lu
+ * @library ../../regtesthelpers/
+ * @build Util
+ * @run main bug7154030
+ */
+
+public class bug7154030 {
+
+    private static JButton button = null;
+
+    public static void main(String[] args) throws Exception {
+        BufferedImage imageInit = null;
+
+        BufferedImage imageShow = null;
+
+        BufferedImage imageHide = null;
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        Robot robot = new Robot();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                JDesktopPane desktop = new JDesktopPane();
+                button = new JButton("button");
+                JFrame frame = new JFrame();
+
+                button.setSize(200, 200);
+                button.setLocation(100, 100);
+                button.setForeground(Color.RED);
+                button.setBackground(Color.RED);
+                button.setOpaque(true);
+                button.setVisible(false);
+                desktop.add(button);
+
+                frame.setContentPane(desktop);
+                frame.setSize(300, 300);
+                frame.setLocation(0, 0);
+                frame.setVisible(true);
+                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+            }
+        });
+
+        toolkit.realSync();
+        imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                button.show();
+            }
+        });
+
+        toolkit.realSync();
+        imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
+        if (Util.compareBufferedImages(imageInit, imageShow)) {
+            throw new Exception("Failed to show opaque button");
+        }
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                button.hide();
+            }
+        });
+
+        toolkit.realSync();
+        imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
+
+        if (!Util.compareBufferedImages(imageInit, imageHide)) {
+            throw new Exception("Failed to hide opaque button");
+        }
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                button.setOpaque(false);
+                button.setBackground(new Color(128, 128, 0));
+                button.setVisible(false);
+            }
+        });
+
+        toolkit.realSync();
+        imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                button.show();
+            }
+        });
+
+        toolkit.realSync();
+        imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                button.hide();
+            }
+        });
+
+        if (Util.compareBufferedImages(imageInit, imageShow)) {
+            throw new Exception("Failed to show non-opaque button");
+        }
+
+        toolkit.realSync();
+        imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
+
+        if (!Util.compareBufferedImages(imageInit, imageHide)) {
+            throw new Exception("Failed to hide non-opaque button");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/java2d/OpenGL/bug7181438.java	Wed Aug 08 14:44:18 2012 -0700
@@ -0,0 +1,83 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+
+/**
+ * @test
+ * @bug 7181438
+ * @summary Verifies that we get correct alpha, when we draw opaque
+ * BufferedImage to non opaque VolatileImage via intermediate opaque texture.
+ * @author Sergey Bylokhov
+ * @run main/othervm -Dsun.java2d.accthreshold=0 bug7181438
+ */
+public final class bug7181438 {
+
+    private static final int SIZE = 500;
+
+    public static void main(final String[] args) {
+
+        final BufferedImage bi = createBufferedImage();
+        final VolatileImage vi = createVolatileImage();
+        final Graphics s2dVi = vi.getGraphics();
+
+        //sw->texture->surface blit
+        s2dVi.drawImage(bi, 0, 0, null);
+
+        final BufferedImage results = vi.getSnapshot();
+        for (int i = 0; i < SIZE; ++i) {
+            for (int j = 0; j < SIZE; ++j) {
+                //Image should be opaque: (black color and alpha = 255)
+                if (results.getRGB(i, j) != 0xFF000000) {
+                    throw new RuntimeException("Failed: Wrong alpha");
+                }
+            }
+        }
+        System.out.println("Passed");
+    }
+
+
+    private static VolatileImage createVolatileImage() {
+        final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
+        return gc.createCompatibleVolatileImage(SIZE, SIZE,
+                                                Transparency.TRANSLUCENT);
+    }
+
+    private static BufferedImage createBufferedImage() {
+        final BufferedImage bi = new BufferedImage(SIZE, SIZE,
+                                                   BufferedImage.TYPE_INT_RGB);
+        final Graphics bg = bi.getGraphics();
+        //Black color and alpha = 0
+        bg.setColor(new Color(0, 0, 0, 0));
+        bg.fillRect(0, 0, SIZE, SIZE);
+        bg.dispose();
+        return bi;
+    }
+}