src/solaris/classes/sun/awt/X11/XWindow.java

Print this page
rev 9717 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by:

@@ -57,11 +57,11 @@
     // ButtonXXX events stuff
     static int rbutton = 0;
     static int lastX = 0, lastY = 0;
     static long lastTime = 0;
     static long lastButton = 0;
-    static WeakReference lastWindowRef = null;
+    static WeakReference<XWindow> lastWindowRef = null;
     static int clickCount = 0;
 
     // used to check if we need to re-create surfaceData.
     int oldWidth = -1;
     int oldHeight = -1;

@@ -690,11 +690,11 @@
         }
 
         if (type == XConstants.ButtonPress) {
             //Allow this mouse button to generate CLICK event on next ButtonRelease
             mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton);
-            XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
+            XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
             /*
                multiclick checking
             */
             if (eventLog.isLoggable(PlatformLogger.Level.FINEST)) {
                 eventLog.finest("lastWindow = " + lastWindow + ", lastButton "

@@ -703,11 +703,11 @@
             }
             if (lastWindow == this && lastButton == lbutton && (when - lastTime) < XToolkit.getMultiClickTime()) {
                 clickCount++;
             } else {
                 clickCount = 1;
-                lastWindowRef = new WeakReference(this);
+                lastWindowRef = new WeakReference<>(this);
                 lastButton = lbutton;
                 lastX = x;
                 lastY = y;
             }
             lastTime = when;

@@ -818,11 +818,11 @@
         /*
            Fix for 6176814 .  Add multiclick checking.
         */
         int x = xme.get_x();
         int y = xme.get_y();
-        XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
+        XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
 
         if (!(lastWindow == this &&
               (xme.get_time() - lastTime) < XToolkit.getMultiClickTime()  &&
               (Math.abs(lastX - x) < AWT_MULTICLICK_SMUDGE &&
                Math.abs(lastY - y) < AWT_MULTICLICK_SMUDGE))) {