changeset 5526:91aef25d0bc1

Merge
author lana
date Thu, 02 Aug 2012 16:18:41 -0700
parents 446a7548357b (diff) dd1e513c05b8 (current diff)
children 66ee1ee981c2
files
diffstat 28 files changed, 637 insertions(+), 281 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/com/apple/laf/AquaPanelUI.java	Tue Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaPanelUI.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaRootPaneUI.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaToolBarUI.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaUtils.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/java2d/opengl/CGLLayer.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWRepaintArea.java	Thu Aug 02 16:18:41 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/LWToolkit.java	Tue Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/com/sun/beans/TypeResolver.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/com/sun/beans/finder/MethodFinder.java	Thu Aug 02 16:18:41 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/beans/IndexedPropertyDescriptor.java	Tue Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/java/beans/Introspector.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/java/beans/PropertyDescriptor.java	Thu Aug 02 16:18:41 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/JViewport.java	Tue Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/javax/swing/JViewport.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/javax/swing/RepaintManager.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/share/classes/sun/awt/SunToolkit.java	Thu Aug 02 16:18:41 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 Jul 31 10:43:53 2012 -0700
+++ b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Thu Aug 02 16:18:41 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/windows/native/sun/windows/awt_Component.cpp	Tue Jul 31 10:43:53 2012 -0700
+++ b/src/windows/native/sun/windows/awt_Component.cpp	Thu Aug 02 16:18:41 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);
--- a/test/java/awt/Window/Grab/GrabTest.java	Tue Jul 31 10:43:53 2012 -0700
+++ b/test/java/awt/Window/Grab/GrabTest.java	Thu Aug 02 16:18:41 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/beans/Performance/Test7122740.java	Thu Aug 02 16:18:41 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	Thu Aug 02 16:18:41 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/sun/java2d/OpenGL/bug7181438.java	Thu Aug 02 16:18:41 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;
+    }
+}