changeset 62299:64c4fb7d738e

8249619: Nimbus L&F Fix for 8041701 is causing some Nimbus tests to fail Reviewed-by: prr
author trebari
date Fri, 17 Jul 2020 10:05:38 -0700
parents 552d99324edd
children 1344412a7e68
files src/java.desktop/share/classes/javax/swing/plaf/nimbus/DerivedColor.java src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java test/jdk/javax/swing/JTree/8041701/NimbusPropertiesDoNotImplUIResource.java
diffstat 3 files changed, 2 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/javax/swing/plaf/nimbus/DerivedColor.java	Thu Jul 16 04:47:27 2020 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/nimbus/DerivedColor.java	Fri Jul 17 10:05:38 2020 -0700
@@ -25,7 +25,6 @@
 package javax.swing.plaf.nimbus;
 
 import javax.swing.UIManager;
-import javax.swing.plaf.UIResource;
 import java.awt.Color;
 import java.beans.PropertyChangeSupport;
 import java.beans.PropertyChangeListener;
@@ -40,7 +39,7 @@
  * @author Jasper Potts
  */
 @SuppressWarnings("serial") // Same-version serialization only
-class DerivedColor extends Color implements UIResource {
+class DerivedColor extends Color {
     private final String uiDefaultParentName;
     private final float hOffset, sOffset, bOffset;
     private final int aOffset;
--- a/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java	Thu Jul 16 04:47:27 2020 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java	Fri Jul 17 10:05:38 2020 -0700
@@ -43,7 +43,7 @@
  * An icon that delegates to a painter.
  * @author rbair
  */
-class NimbusIcon implements SynthIcon, UIResource {
+class NimbusIcon implements SynthIcon {
     private int width;
     private int height;
     private String prefix;
--- a/test/jdk/javax/swing/JTree/8041701/NimbusPropertiesDoNotImplUIResource.java	Thu Jul 16 04:47:27 2020 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2020, 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 javax.swing.UIManager;
-import javax.swing.UnsupportedLookAndFeelException;
-import javax.swing.plaf.UIResource;
-
-/**
- * @test
- * @bug 8041701
- * @summary  Nimbus JTree renderer properties persist across L&F changes
- * @key headful
- * @run main NimbusPropertiesDoNotImplUIResource
- */
-
-public class NimbusPropertiesDoNotImplUIResource {
-    private static final String[] defPropertyKeys = new String[] {
-            "Tree.leafIcon", "Tree.closedIcon",
-            "Tree.openIcon", "Tree.selectionForeground",
-            "Tree.textForeground", "Tree.selectionBackground",
-            "Tree.textBackground", "Tree.selectionBorderColor"};
-
-    public static void main(String[] args) throws Exception {
-        UIManager.LookAndFeelInfo[] installedLookAndFeels;
-        installedLookAndFeels = UIManager.getInstalledLookAndFeels();
-
-        for (UIManager.LookAndFeelInfo LF : installedLookAndFeels) {
-            try {
-                UIManager.setLookAndFeel(LF.getClassName());
-                for (String propertyKey : defPropertyKeys) {
-                    verifyProperty(propertyKey);
-                }
-            } catch(UnsupportedLookAndFeelException e) {
-                System.out.println("Note: LookAndFeel " + LF.getClassName()
-                        + " is not supported on this configuration");
-            }
-        }
-
-    }
-
-    private static void verifyProperty(String propertyKey) {
-        Object property = UIManager.get(propertyKey);
-        if (property == null) {
-            return;
-        }
-        if (!(property instanceof UIResource)) {
-            throw new RuntimeException("Property '"+ propertyKey
-                    +"' is instance of '"+property.getClass()
-                    +"' instead of UIResource.");
-        }
-    }
-}