Merge
authorlana
Thu, 28 Jan 2010 16:12:06 -0800
changeset 4850 37c9fe9cc397
parent 4849 c83eca4dbb8f (diff)
parent 4710 dcc938ac40cc (current diff)
child 4851 4f7de5eeeac7
Merge
hotspot/src/share/vm/gc_implementation/g1/ptrQueue.inline.hpp
jdk/make/java/redist/FILES.gmk
jdk/make/sun/nio/FILES_java.gmk
jdk/src/share/classes/sun/dyn/util/BytecodeSignature.java
jdk/src/solaris/classes/sun/nio/ch/SctpSocketDispatcher.java
langtools/src/share/classes/com/sun/tools/javac/file/CloseableURLClassLoader.java
--- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Thu Jan 28 16:12:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  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
@@ -146,6 +146,8 @@
      * @param  out The code output stream.
      * @return An expression whose value is <code>oldInstance</code>.
      *
+     * @throws NullPointerException if {@code out} is {@code null}
+     *
      * @see #DefaultPersistenceDelegate(String[])
      */
     protected Expression instantiate(Object oldInstance, Encoder out) {
@@ -367,6 +369,8 @@
      * @param newInstance The instance that is to be modified.
      * @param out The stream to which any initialization statements should be written.
      *
+     * @throws NullPointerException if {@code out} is {@code null}
+     *
      * @see java.beans.Introspector#getBeanInfo
      * @see java.beans.PropertyDescriptor
      */
--- a/jdk/src/share/classes/java/beans/Encoder.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/beans/Encoder.java	Thu Jan 28 16:12:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  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
@@ -112,54 +112,82 @@
 
     /**
      * Returns the persistence delegate for the given type.
-     * The persistence delegate is calculated
-     * by applying the following of rules in order:
-     * <ul>
+     * The persistence delegate is calculated by applying
+     * the following rules in order:
+     * <ol>
+     * <li>
+     * If a persistence delegate is associated with the given type
+     * by using the {@link #setPersistenceDelegate} method
+     * it is returned.
      * <li>
-     * If the type is an array, an internal persistence
-     * delegate is returned which will instantiate an
-     * array of the appropriate type and length, initializing
-     * each of its elements as if they are properties.
+     * A persistence delegate is then looked up by the name
+     * composed of the the fully qualified name of the given type
+     * and the "PersistenceDelegate" postfix.
+     * For example, a persistence delegate for the {@code Bean} class
+     * should be named {@code BeanPersistenceDelegate}
+     * and located in the same package.
+     * <pre>
+     * public class Bean { ... }
+     * public class BeanPersistenceDelegate { ... }</pre>
+     * The instance of the {@code BeanPersistenceDelegate} class
+     * is returned for the {@code Bean} class.
+     * <li>
+     * If the type is {@code null},
+     * a shared internal persistence delegate is returned
+     * that encodes {@code null} value.
      * <li>
-     * If the type is a proxy, an internal persistence
-     * delegate is returned which will instantiate a
-     * new proxy instance using the static
-     * "newProxyInstance" method defined in the
-     * Proxy class.
+     * If the type is a {@code enum} declaration,
+     * a shared internal persistence delegate is returned
+     * that encodes constants of this enumeration
+     * by their names.
+     * <li>
+     * If the type is a primitive type or the corresponding wrapper,
+     * a shared internal persistence delegate is returned
+     * that encodes values of the given type.
+     * <li>
+     * If the type is an array,
+     * a shared internal persistence delegate is returned
+     * that encodes an array of the appropriate type and length,
+     * and each of its elements as if they are properties.
      * <li>
-     * If the BeanInfo for this type has a <code>BeanDescriptor</code>
-     * which defined a "persistenceDelegate" property, this
-     * value is returned.
+     * If the type is a proxy,
+     * a shared internal persistence delegate is returned
+     * that encodes a proxy instance by using
+     * the {@link java.lang.reflect.Proxy#newProxyInstance} method.
      * <li>
-     * In all other cases the default persistence delegate
-     * is returned. The default persistence delegate assumes
-     * the type is a <em>JavaBean</em>, implying that it has a default constructor
-     * and that its state may be characterized by the matching pairs
-     * of "setter" and "getter" methods returned by the Introspector.
+     * If the {@link BeanInfo} for this type has a {@link BeanDescriptor}
+     * which defined a "persistenceDelegate" attribute,
+     * the value of this named attribute is returned.
+     * <li>
+     * In all other cases the default persistence delegate is returned.
+     * The default persistence delegate assumes the type is a <em>JavaBean</em>,
+     * implying that it has a default constructor and that its state
+     * may be characterized by the matching pairs of "setter" and "getter"
+     * methods returned by the {@link Introspector} class.
      * The default constructor is the constructor with the greatest number
      * of parameters that has the {@link ConstructorProperties} annotation.
-     * If none of the constructors have the {@code ConstructorProperties} annotation,
+     * If none of the constructors has the {@code ConstructorProperties} annotation,
      * then the nullary constructor (constructor with no parameters) will be used.
-     * For example, in the following the nullary constructor
-     * for {@code Foo} will be used, while the two parameter constructor
-     * for {@code Bar} will be used.
-     * <code>
-     *   public class Foo {
+     * For example, in the following code fragment, the nullary constructor
+     * for the {@code Foo} class will be used,
+     * while the two-parameter constructor
+     * for the {@code Bar} class will be used.
+     * <pre>
+     * public class Foo {
      *     public Foo() { ... }
      *     public Foo(int x) { ... }
-     *   }
-     *   public class Bar {
+     * }
+     * public class Bar {
      *     public Bar() { ... }
      *     &#64;ConstructorProperties({"x"})
      *     public Bar(int x) { ... }
      *     &#64;ConstructorProperties({"x", "y"})
      *     public Bar(int x, int y) { ... }
-     *   }
-     * </code>
-     * </ul>
+     * }</pre>
+     * </ol>
      *
-     * @param  type The type of the object.
-     * @return The persistence delegate for this type of object.
+     * @param type  the class of the objects
+     * @return the persistence delegate for the given type
      *
      * @see #setPersistenceDelegate
      * @see java.beans.Introspector#getBeanInfo
@@ -176,21 +204,18 @@
     }
 
     /**
-     * Sets the persistence delegate associated with this <code>type</code> to
-     * <code>persistenceDelegate</code>.
+     * Associates the specified persistence delegate with the given type.
      *
-     * @param  type The class of objects that <code>persistenceDelegate</code> applies to.
-     * @param  persistenceDelegate The persistence delegate for instances of <code>type</code>.
+     * @param type  the class of objects that the specified persistence delegate applies to
+     * @param delegate  the persistence delegate for instances of the given type
      *
      * @see #getPersistenceDelegate
      * @see java.beans.Introspector#getBeanInfo
      * @see java.beans.BeanInfo#getBeanDescriptor
      */
-    public void setPersistenceDelegate(Class<?> type,
-                                       PersistenceDelegate persistenceDelegate)
-    {
+    public void setPersistenceDelegate(Class<?> type, PersistenceDelegate delegate) {
         synchronized (this.finder) {
-            this.finder.register(type, persistenceDelegate);
+            this.finder.register(type, delegate);
         }
     }
 
--- a/jdk/src/share/classes/java/beans/Expression.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/beans/Expression.java	Thu Jan 28 16:12:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  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
@@ -51,12 +51,19 @@
     private Object value = unbound;
 
     /**
-     * Creates a new <code>Statement</code> object with a <code>target</code>,
-     * <code>methodName</code> and <code>arguments</code> as per the parameters.
+     * Creates a new {@link Expression} object
+     * for the specified target object to invoke the method
+     * specified by the name and by the array of arguments.
+     * <p>
+     * The {@code target} and the {@code methodName} values should not be {@code null}.
+     * Otherwise an attempt to execute this {@code Expression}
+     * will result in a {@code NullPointerException}.
+     * If the {@code arguments} value is {@code null},
+     * an empty array is used as the value of the {@code arguments} property.
      *
-     * @param target The target of this expression.
-     * @param methodName The methodName of this expression.
-     * @param arguments The arguments of this expression. If <code>null</code> then an empty array will be used.
+     * @param target  the target object of this expression
+     * @param methodName  the name of the method to invoke on the specified target
+     * @param arguments  the array of arguments to invoke the specified method
      *
      * @see #getValue
      */
@@ -66,16 +73,23 @@
     }
 
     /**
-     * Creates a new <code>Expression</code> object for a method
-     * that returns a result. The result will never be calculated
-     * however, since this constructor uses the <code>value</code>
-     * parameter to set the value property by calling the
-     * <code>setValue</code> method.
+     * Creates a new {@link Expression} object with the specified value
+     * for the specified target object to invoke the  method
+     * specified by the name and by the array of arguments.
+     * The {@code value} value is used as the value of the {@code value} property,
+     * so the {@link #getValue} method will return it
+     * without executing this {@code Expression}.
+     * <p>
+     * The {@code target} and the {@code methodName} values should not be {@code null}.
+     * Otherwise an attempt to execute this {@code Expression}
+     * will result in a {@code NullPointerException}.
+     * If the {@code arguments} value is {@code null},
+     * an empty array is used as the value of the {@code arguments} property.
      *
-     * @param value The value of this expression.
-     * @param target The target of this expression.
-     * @param methodName The methodName of this expression.
-     * @param arguments The arguments of this expression. If <code>null</code> then an empty array will be used.
+     * @param value  the value of this expression
+     * @param target  the target object of this expression
+     * @param methodName  the name of the method to invoke on the specified target
+     * @param arguments  the array of arguments to invoke the specified method
      *
      * @see #setValue
      */
--- a/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Thu Jan 28 16:12:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  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
@@ -105,6 +105,8 @@
      *
      * @param oldInstance The instance that will be created by this expression.
      * @param out The stream to which this expression will be written.
+     *
+     * @throws NullPointerException if {@code out} is {@code null}
      */
     public void writeObject(Object oldInstance, Encoder out) {
         Object newInstance = out.get(oldInstance);
@@ -158,6 +160,8 @@
      * @param oldInstance The instance that will be created by this expression.
      * @param out The stream to which this expression will be written.
      * @return An expression whose value is <code>oldInstance</code>.
+     *
+     * @throws NullPointerException if {@code out} is {@code null}
      */
     protected abstract Expression instantiate(Object oldInstance, Encoder out);
 
@@ -196,6 +200,8 @@
      * @param oldInstance The instance to be copied.
      * @param newInstance The instance that is to be modified.
      * @param out The stream to which any initialization statements should be written.
+     *
+     * @throws NullPointerException if {@code out} is {@code null}
      */
     protected void initialize(Class<?> type,
                               Object oldInstance, Object newInstance,
--- a/jdk/src/share/classes/java/beans/Statement.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/beans/Statement.java	Thu Jan 28 16:12:06 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  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
@@ -69,13 +69,19 @@
     ClassLoader loader;
 
     /**
-     * Creates a new <code>Statement</code> object with a <code>target</code>,
-     * <code>methodName</code> and <code>arguments</code> as per the parameters.
+     * Creates a new {@link Statement} object
+     * for the specified target object to invoke the method
+     * specified by the name and by the array of arguments.
+     * <p>
+     * The {@code target} and the {@code methodName} values should not be {@code null}.
+     * Otherwise an attempt to execute this {@code Expression}
+     * will result in a {@code NullPointerException}.
+     * If the {@code arguments} value is {@code null},
+     * an empty array is used as the value of the {@code arguments} property.
      *
-     * @param target The target of this statement.
-     * @param methodName The methodName of this statement.
-     * @param arguments The arguments of this statement. If <code>null</code> then an empty array will be used.
-     *
+     * @param target  the target object of this statement
+     * @param methodName  the name of the method to invoke on the specified target
+     * @param arguments  the array of arguments to invoke the specified method
      */
     @ConstructorProperties({"target", "methodName", "arguments"})
     public Statement(Object target, String methodName, Object[] arguments) {
@@ -85,27 +91,36 @@
     }
 
     /**
-     * Returns the target of this statement.
+     * Returns the target object of this statement.
+     * If this method returns {@code null},
+     * the {@link #execute} method
+     * throws a {@code NullPointerException}.
      *
-     * @return The target of this statement.
+     * @return the target object of this statement
      */
     public Object getTarget() {
         return target;
     }
 
     /**
-     * Returns the name of the method.
+     * Returns the name of the method to invoke.
+     * If this method returns {@code null},
+     * the {@link #execute} method
+     * throws a {@code NullPointerException}.
      *
-     * @return The name of the method.
+     * @return the name of the method
      */
     public String getMethodName() {
         return methodName;
     }
 
     /**
-     * Returns the arguments of this statement.
+     * Returns the arguments for the method to invoke.
+     * The number of arguments and their types
+     * must match the method being  called.
+     * {@code null} can be used as a synonym of an empty array.
      *
-     * @return the arguments of this statement.
+     * @return the array of arguments
      */
     public Object[] getArguments() {
         return arguments;
@@ -154,6 +169,9 @@
         }
 
         Object[] arguments = getArguments();
+        if (arguments == null) {
+            arguments = emptyArray;
+        }
         // Class.forName() won't load classes outside
         // of core from a class inside core. Special
         // case this method.
@@ -285,7 +303,9 @@
         Object target = getTarget();
         String methodName = getMethodName();
         Object[] arguments = getArguments();
-
+        if (arguments == null) {
+            arguments = emptyArray;
+        }
         StringBuffer result = new StringBuffer(instanceName(target) + "." + methodName + "(");
         int n = arguments.length;
         for(int i = 0; i < n; i++) {
--- a/jdk/src/share/classes/java/text/CollationElementIterator.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/text/CollationElementIterator.java	Thu Jan 28 16:12:06 2010 -0800
@@ -232,7 +232,7 @@
                     buffer = makeReorderedBuffer(consonant, value, buffer, true);
                     value = buffer[0];
                     expIndex = 1;
-                } else {
+                } else if (consonant != NormalizerBase.DONE) {
                     text.previous();
                 }
             }
@@ -242,7 +242,7 @@
                     buffer = makeReorderedBuffer(consonant, value, buffer, true);
                     value = buffer[0];
                     expIndex = 1;
-                } else {
+                } else if (consonant != NormalizerBase.DONE) {
                     text.previous();
                 }
             }
--- a/jdk/src/share/classes/java/text/RuleBasedBreakIterator.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/text/RuleBasedBreakIterator.java	Thu Jan 28 16:12:06 2010 -0800
@@ -621,6 +621,8 @@
         return handleNext();
     }
 
+    private int cachedLastKnownBreak = BreakIterator.DONE;
+
     /**
      * Advances the iterator backwards, to the last boundary preceding this one.
      * @return The position of the last boundary position preceding this one.
@@ -638,8 +640,16 @@
         // the current position), but not necessarily the last one before
         // where we started
         int start = current();
-        getPrevious();
-        int lastResult = handlePrevious();
+        int lastResult = cachedLastKnownBreak;
+        if (lastResult >= start || lastResult <= BreakIterator.DONE) {
+            getPrevious();
+            lastResult = handlePrevious();
+        } else {
+            //it might be better to check if handlePrevious() give us closer
+            //safe value but handlePrevious() is slow too
+            //So, this has to be done carefully
+            text.setIndex(lastResult);
+        }
         int result = lastResult;
 
         // iterate forward from the known break position until we pass our
@@ -653,6 +663,7 @@
         // set the current iteration position to be the last break position
         // before where we started, and then return that value
         text.setIndex(lastResult);
+        cachedLastKnownBreak = lastResult;
         return lastResult;
     }
 
@@ -757,7 +768,8 @@
         // then we can just use next() to get our return value
         text.setIndex(offset);
         if (offset == text.getBeginIndex()) {
-            return handleNext();
+            cachedLastKnownBreak = handleNext();
+            return cachedLastKnownBreak;
         }
 
         // otherwise, we have to sync up first.  Use handlePrevious() to back
@@ -767,10 +779,19 @@
         // position at or before our starting position.  Advance forward
         // from here until we've passed the starting position.  The position
         // we stop on will be the first break position after the specified one.
-        int result = handlePrevious();
+        int result = cachedLastKnownBreak;
+        if (result >= offset || result <= BreakIterator.DONE) {
+            result = handlePrevious();
+        } else {
+            //it might be better to check if handlePrevious() give us closer
+            //safe value but handlePrevious() is slow too
+            //So, this has to be done carefully
+            text.setIndex(result);
+        }
         while (result != BreakIterator.DONE && result <= offset) {
             result = handleNext();
         }
+        cachedLastKnownBreak = result;
         return result;
     }
 
@@ -865,6 +886,8 @@
             text = new SafeCharIterator(newText);
         }
         text.first();
+
+        cachedLastKnownBreak = BreakIterator.DONE;
     }
 
 
--- a/jdk/src/share/classes/java/util/Date.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/java/util/Date.java	Thu Jan 28 16:12:06 2010 -0800
@@ -953,7 +953,7 @@
      * without affecting its internal state.
      */
     static final long getMillisOf(Date date) {
-        if (date.cdate == null) {
+        if (date.cdate == null || date.cdate.isNormalized()) {
             return date.fastTime;
         }
         BaseCalendar.Date d = (BaseCalendar.Date) date.cdate.clone();
--- a/jdk/src/share/classes/javax/swing/MultiUIDefaults.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/MultiUIDefaults.java	Thu Jan 28 16:12:06 2010 -0800
@@ -27,6 +27,7 @@
 
 import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -89,11 +90,7 @@
 
     @Override
     public int size() {
-        int n = super.size();
-        for (UIDefaults table : tables) {
-            n += (table != null) ? table.size() : 0;
-        }
-        return n;
+        return entrySet().size();
     }
 
     @Override
@@ -104,40 +101,26 @@
     @Override
     public Enumeration<Object> keys()
     {
-        Enumeration[] enums = new Enumeration[1 + tables.length];
-        enums[0] = super.keys();
-        for(int i = 0; i < tables.length; i++) {
-            UIDefaults table = tables[i];
-            if (table != null) {
-                enums[i + 1] = table.keys();
-            }
-        }
-        return new MultiUIDefaultsEnumerator(enums);
+        return new MultiUIDefaultsEnumerator(
+                MultiUIDefaultsEnumerator.Type.KEYS, entrySet());
     }
 
     @Override
     public Enumeration<Object> elements()
     {
-        Enumeration[] enums = new Enumeration[1 + tables.length];
-        enums[0] = super.elements();
-        for(int i = 0; i < tables.length; i++) {
-            UIDefaults table = tables[i];
-            if (table != null) {
-                enums[i + 1] = table.elements();
-            }
-        }
-        return new MultiUIDefaultsEnumerator(enums);
+        return new MultiUIDefaultsEnumerator(
+                MultiUIDefaultsEnumerator.Type.ELEMENTS, entrySet());
     }
 
     @Override
     public Set<Entry<Object, Object>> entrySet() {
         Set<Entry<Object, Object>> set = new HashSet<Entry<Object, Object>>();
-        if (tables == null) return set;
-        for (UIDefaults table : tables) {
-            if (table != null) {
-                set.addAll(table.entrySet());
+        for (int i = tables.length - 1; i >= 0; i--) {
+            if (tables[i] != null) {
+                set.addAll(tables[i].entrySet());
             }
         }
+        set.addAll(super.entrySet());
         return set;
     }
 
@@ -152,50 +135,46 @@
 
     private static class MultiUIDefaultsEnumerator implements Enumeration<Object>
     {
-        Enumeration[] enums;
-        int n = 0;
+        public static enum Type { KEYS, ELEMENTS };
+        private Iterator<Entry<Object, Object>> iterator;
+        private Type type;
 
-        MultiUIDefaultsEnumerator(Enumeration[] enums) {
-            this.enums = enums;
+        MultiUIDefaultsEnumerator(Type type, Set<Entry<Object, Object>> entries) {
+            this.type = type;
+            this.iterator = entries.iterator();
         }
 
         public boolean hasMoreElements() {
-            for(int i = n; i < enums.length; i++) {
-                Enumeration e = enums[i];
-                if ((e != null) && (e.hasMoreElements())) {
-                    return true;
-                }
-            }
-            return false;
+            return iterator.hasNext();
         }
 
         public Object nextElement() {
-            for(; n < enums.length; n++) {
-                Enumeration e = enums[n];
-                if ((e != null) && (e.hasMoreElements())) {
-                    return e.nextElement();
-                }
+            switch (type) {
+                case KEYS: return iterator.next().getKey();
+                case ELEMENTS: return iterator.next().getValue();
+                default: return null;
             }
-            return null;
         }
     }
 
     @Override
     public Object remove(Object key)
     {
-        Object value = super.remove(key);
-        if (value != null) {
-            return value;
+        Object value = null;
+        for (int i = tables.length - 1; i >= 0; i--) {
+            if (tables[i] != null) {
+                Object v = tables[i].remove(key);
+                if (v != null) {
+                    value = v;
+                }
+            }
+        }
+        Object v = super.remove(key);
+        if (v != null) {
+            value = v;
         }
 
-        for (UIDefaults table : tables) {
-            value = (table != null) ? table.remove(key) : null;
-            if (value != null) {
-                return value;
-            }
-        }
-
-        return null;
+        return value;
     }
 
     @Override
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template	Thu Jan 28 16:12:06 2010 -0800
@@ -90,6 +90,10 @@
      */
     private Map<String, Region> registeredRegions =
             new HashMap<String, Region>();
+
+    private Map<JComponent, Map<Region, SynthStyle>> overridesCache =
+            new WeakHashMap<JComponent, Map<Region, SynthStyle>>();
+    
     /**
      * Our fallback style to avoid NPEs if the proper style cannot be found in
      * this class. Not sure if relying on DefaultSynthStyle is the best choice.
@@ -251,7 +255,11 @@
         }
 
         //return the style, if found, or the default style if not found
-        return foundStyle == null ? defaultStyle : foundStyle.getStyle(comp);
+        return foundStyle == null ? defaultStyle : foundStyle.getStyle(comp, r);
+    }
+
+    public void clearOverridesCache(JComponent c) {
+        overridesCache.remove(c);
     }
 
     /*
@@ -457,15 +465,6 @@
          * Cached shared style.
          */
         private NimbusStyle style;
-        /**
-         * A weakly referenced hash map such that if the reference JComponent
-         * key is garbage collected then the entry is removed from the map.
-         * This cache exists so that when a JComponent has nimbus overrides
-         * in its client map, a unique style will be created and returned
-         * for that JComponent instance, always. In such a situation each
-         * JComponent instance must have its own instance of NimbusStyle.
-         */
-        private WeakHashMap<JComponent, WeakReference<NimbusStyle>> overridesCache;
 
         /**
          * Create a new LazyStyle.
@@ -513,17 +512,21 @@
          * Gets the style. Creates it if necessary.
          * @return the style
          */
-        SynthStyle getStyle(JComponent c) {
+        SynthStyle getStyle(JComponent c, Region r) {
             // if the component has overrides, it gets its own unique style
             // instead of the shared style.
             if (c.getClientProperty("Nimbus.Overrides") != null) {
-                if (overridesCache == null)
-                    overridesCache = new WeakHashMap<JComponent, WeakReference<NimbusStyle>>();
-                WeakReference<NimbusStyle> ref = overridesCache.get(c);
-                NimbusStyle s = ref == null ? null : ref.get();
+                Map<Region, SynthStyle> map = overridesCache.get(c);
+                SynthStyle s = null;
+                if (map == null) {
+                    map = new HashMap<Region, SynthStyle>();
+                    overridesCache.put(c, map);
+                } else {
+                    s = map.get(r);
+                }
                 if (s == null) {
                     s = new NimbusStyle(prefix, c);
-                    overridesCache.put(c, new WeakReference<NimbusStyle>(s));
+                    map.put(r, s);
                 }
                 return s;
             }
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Thu Jan 28 16:12:06 2010 -0800
@@ -280,11 +280,15 @@
     protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) {
         String eName = ev.getPropertyName();
 
-        // Always update when overrides or size variant change
-        if ("Nimbus.Overrides" == eName ||
+        // These properties affect style cached inside NimbusDefaults (6860433)
+        if ("name" == eName ||
+            "ancestor" == eName ||
+            "Nimbus.Overrides" == eName ||
             "Nimbus.Overrides.InheritDefaults" == eName ||
             "JComponent.sizeVariant" == eName) {
 
+            JComponent c = (JComponent) ev.getSource();
+            defaults.clearOverridesCache(c);
             return true;
         }
 
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -237,7 +237,16 @@
     // ********************************
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -250,7 +259,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -264,7 +279,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         AbstractButton b = (AbstractButton)context.getComponent();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -137,7 +137,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -151,7 +160,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -166,7 +181,8 @@
      * This implementation does not perform any actions.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -305,7 +305,16 @@
     // begin ComponentUI Implementation
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -319,7 +328,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -333,7 +348,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         hasFocus = comboBox.hasFocus();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -152,7 +152,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -166,7 +175,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -180,7 +195,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -439,7 +439,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -453,7 +462,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -467,7 +482,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -148,7 +148,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -164,7 +173,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -194,7 +194,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -208,7 +217,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -222,7 +237,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -156,12 +156,16 @@
     }
 
     /**
-     * Notifies this UI delegate that it's time to paint the specified
-     * component.  This method is invoked by <code>JComponent</code>
-     * when the specified component is being painted.
-     */
-    /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -175,7 +179,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -189,7 +199,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JLabel label = (JLabel)context.getComponent();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -57,7 +57,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint
      */
     @Override
     public void update(Graphics g, JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -125,7 +125,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -139,7 +148,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -153,7 +168,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -227,7 +227,16 @@
 
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -240,7 +249,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -254,7 +269,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext accContext = getContext(menuItem,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -227,7 +227,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -241,7 +250,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -255,7 +270,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext accContext = getContext(menuItem,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -149,7 +149,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -163,7 +172,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -177,7 +192,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -136,7 +136,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -150,7 +159,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -164,7 +179,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         // do actual painting
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -132,7 +132,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -146,7 +155,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -160,7 +175,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -193,7 +193,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -208,7 +217,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -222,7 +237,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JProgressBar pBar = (JProgressBar)context.getComponent();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -102,7 +102,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -116,7 +125,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -130,7 +145,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -222,7 +222,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -237,7 +246,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -251,7 +266,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext subcontext = getContext(scrollbar,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -64,7 +64,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -78,7 +87,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -92,7 +107,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         Border vpBorder = scrollpane.getViewportBorder();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -135,7 +135,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -151,7 +160,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -165,7 +180,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JSeparator separator = (JSeparator)context.getComponent();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -788,7 +788,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -802,7 +811,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -815,7 +830,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         recalculateIfInsetsChanged();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -283,7 +283,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -298,7 +307,13 @@
 
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -312,7 +327,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -269,7 +269,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -283,7 +292,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -297,7 +312,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         // This is done to update package private variables in
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -92,8 +92,8 @@
     private SynthStyle tabAreaStyle;
     private SynthStyle tabContentStyle;
 
-    private Rectangle textRect;
-    private Rectangle iconRect;
+    private Rectangle textRect = new Rectangle();
+    private Rectangle iconRect = new Rectangle();
 
     private Rectangle tabAreaBounds = new Rectangle();
 
@@ -115,11 +115,6 @@
         return new SynthTabbedPaneUI();
     }
 
-    private SynthTabbedPaneUI() {
-        textRect = new Rectangle();
-        iconRect = new Rectangle();
-    }
-
     private boolean scrollableTabLayoutEnabled() {
         return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
     }
@@ -362,7 +357,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -409,7 +413,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -423,7 +433,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         int selectedIndex = tabPane.getSelectedIndex();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -123,7 +123,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -137,7 +146,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -151,7 +166,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, context.getComponent());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -256,7 +256,16 @@
 //
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -279,7 +288,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -293,7 +308,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         Rectangle clip = g.getClipBounds();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -123,7 +123,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -140,7 +149,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -161,7 +161,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -182,7 +191,8 @@
      * model to potentially be updated asynchronously.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -198,7 +198,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -213,7 +222,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -258,7 +273,8 @@
      * Paints the toolbar.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         if (handleIcon != null && toolBar.isFloatable()) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -121,7 +121,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -144,7 +153,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -158,7 +173,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JToolTip tip = (JToolTip)context.getComponent();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -250,7 +250,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -273,7 +282,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -287,7 +302,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         paintContext = context;
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Wed Jul 05 17:06:08 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Thu Jan 28 16:12:06 2010 -0800
@@ -150,7 +150,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -174,7 +183,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -188,7 +203,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/Collator/Bug5047314.java	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2009 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5047314
+ * @summary verify that compare() and getCollationKey() don't go into an infinite loop for unfinished Thai/Lao text.
+ * @run main/timeout=60 Bug5047314
+ */
+import java.text.Collator;
+import java.util.Locale;
+
+public class Bug5047314 {
+
+    private static Collator colLao = Collator.getInstance(new Locale("lo"));
+    private static Collator colThai = Collator.getInstance(new Locale("th"));
+
+    private static String[] textLao = {
+        "\u0ec0", "\u0ec1", "\u0ec2", "\u0ec3", "\u0ec4"
+    };
+    private static String[] textThai = {
+        "\u0e40", "\u0e41", "\u0e42", "\u0e43", "\u0e44"
+    };
+
+    public static void main(String[] args) {
+        testLao1();
+        testLao2();
+        testThai1();
+        testThai2();
+    }
+
+    private static void testLao1() {
+        System.out.print("Test(Lao 1) .... ");
+        for (int i = 0; i < textLao.length; i++) {
+            colLao.compare(textLao[i], textLao[i]);
+        }
+        System.out.println("Passed.");
+    }
+
+    private static void testLao2() {
+        System.out.print("Test(Lao 2) .... ");
+        for (int i = 0; i < textLao.length; i++) {
+            colLao.compare(textLao[i], textLao[i]);
+        }
+        System.out.println("Passed.");
+    }
+
+    private static void testThai1() {
+        System.out.print("Test(Thai 1) .... ");
+        for (int i = 0; i < textThai.length; i++) {
+            colThai.compare(textThai[i], textThai[i]);
+        }
+        System.out.println("Passed.");
+    }
+
+    private static void testThai2() {
+        System.out.print("Test(Thai 2) .... ");
+        for (int i = 0; i < textThai.length; i++) {
+            colThai.getCollationKey(textThai[i]);
+        }
+        System.out.println("Passed.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.java	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,42 @@
+/* Testcase for PR381 Stackoverflow error with security manager, signed jars
+ * and -Djava.security.debug set.
+ * Copyright (c) 2009, Red Hat Inc.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.util.Date;
+
+/**
+ * Test class. Create a test keystore and dummy cert, create a jar file to
+ * sign with the test class in it. Sign it run it with the security manager
+ * on, plus accesscontroller debugging, will go into infinite recursion
+ * trying to get enough permissions for printing Date of failing
+ * certificate, unless fix is applied.
+ */
+public class TimeZoneDatePermissionCheck
+{
+  public static void main(String[] args)
+  {
+    System.out.println(new Date());
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,58 @@
+# Testcase for PR381 Stackoverflow error with security manager, signed jars
+# and -Djava.security.debug set.
+#
+# Copyright (c) 2009, Red Hat Inc.
+#
+# This code is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# 
+# 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 for more details.
+# 
+# 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.
+#
+# @test
+# @bug 6584033
+# @summary Stackoverflow error with security manager, signed jars and debug.
+# @build TimeZoneDatePermissionCheck
+# @run shell TimeZoneDatePermissionCheck.sh
+
+# Set default if not run under jtreg from test dir itself
+if [ "${TESTCLASSES}" = "" ] ; then
+  TESTCLASSES="."
+fi
+if [ "${TESTJAVA}" = "" ] ; then
+  TESTJAVA=/usr
+fi
+
+# create a test keystore and dummy cert
+rm -f ${TESTCLASSES}/timezonedatetest.store
+${TESTJAVA}/bin/keytool -genkeypair -alias testcert \
+  -keystore ${TESTCLASSES}/timezonedatetest.store \
+  -storepass testpass -validity 360 \
+  -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \
+  -keypass testpass
+
+# create a jar file to sign with the test class in it.
+rm -f ${TESTCLASSES}/timezonedatetest.jar
+${TESTJAVA}/bin/jar cf \
+  ${TESTCLASSES}/timezonedatetest.jar \
+  -C ${TESTCLASSES} TimeZoneDatePermissionCheck.class
+
+# sign it
+${TESTJAVA}/bin/jarsigner \
+  -keystore ${TESTCLASSES}/timezonedatetest.store \
+  -storepass testpass ${TESTCLASSES}/timezonedatetest.jar testcert
+
+# run it with the security manager on, plus accesscontroller debugging
+# will go into infinite recursion trying to get enough permissions for
+# printing Date of failing certificate unless fix is applied.
+${TESTJAVA}/bin/java -Djava.security.manager \
+  -Djava.security.debug=access,failure,policy \
+  -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/MultiUIDefaults/4300666/bug4300666.html	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,28 @@
+<!--
+ Copyright 2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ CA 95054 USA or visit www.sun.com if you need additional information or
+ have any questions.
+-->
+ 
+<html>
+<body>
+<applet  code="bug4300666.class" width=200 height=200></applet>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/MultiUIDefaults/4300666/bug4300666.java	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 4300666
+   @summary Printing UIDefaults throws NoSuchElementExcept
+   @author Andrey Pikalev
+   @run applet bug4300666.html
+*/
+
+import javax.swing.*;
+
+
+public class bug4300666 extends JApplet {
+
+    public void init() {
+        UIDefaults d = UIManager.getDefaults();
+        d.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/MultiUIDefaults/4331767/bug4331767.java	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 4331767
+   @summary Tests that custom implementation of UIDefaults.getUIError() is
+            called when an UI error occurs
+   @author Peter Zhelezniakov
+   @run main bug4331767
+*/
+import javax.swing.*;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import java.util.Locale;
+
+public class bug4331767
+{
+    private static boolean passed = false;
+
+    public static void main(String[] argv) {
+        try {
+            UIManager.setLookAndFeel(new BrokenLookAndFeel());
+        } catch (Exception e) {
+            throw new Error("Failed to set BrokenLookAndFeel, cannot test", e);
+        }
+
+        // This should call BrokenUIDefaults.getUIError()
+        new JButton();
+
+        if (!passed) {
+            throw new RuntimeException("Failed: Custom getUIError() not called");
+        }
+    }
+
+    static class BrokenUIDefaults extends UIDefaults {
+        UIDefaults defaults;
+
+        public BrokenUIDefaults(UIDefaults def) {
+            defaults = def;
+        }
+
+        public Object get(Object key) {
+            if ("ButtonUI".equals(key)) {
+                System.err.println("[II]  Called BrokenUIDefaults.get(Object)");
+                return "a nonexistent class";
+            }
+            return defaults.get(key);
+        }
+
+        public Object get(Object key, Locale l) {
+            if ("ButtonUI".equals(key)) {
+                System.err.println("[II]  Called BrokenUIDefaults.get(Object, Locale)");
+                return "a nonexistent class";
+            }
+            return defaults.get(key, l);
+        }
+
+        protected void getUIError(String msg) {
+            System.err.println("[II]  BrokenUIDefaults.getUIError() called, test passes");
+            passed = true;
+        }
+    }
+
+    static class BrokenLookAndFeel extends MetalLookAndFeel {
+        UIDefaults defaults;
+
+        public BrokenLookAndFeel() {
+            defaults = new BrokenUIDefaults(super.getDefaults());
+        }
+
+        public UIDefaults getDefaults() {
+            return defaults;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/MultiUIDefaults/Test6860438.java	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6860438
+   @summary Tests various MultiUIDefaults methods
+   @author Peter Zhelezniakov
+   @run main Test6860438
+*/
+
+import java.util.Enumeration;
+import java.util.Map.Entry;
+import java.util.Set;
+import javax.swing.UIManager;
+
+public class Test6860438
+{
+    static final String KEY = "Test6860438.key";
+    static final String VALUE = "Test6860438.value";
+
+    void check(Object key, Object value, boolean present, int size) {
+        check(UIManager.get(key) == value, "UIManager.get()");
+        check(UIManager.getDefaults().size() == size, "MultiUIDefaults.size()");
+
+        checkEnumeration(UIManager.getDefaults().keys(),
+                key, present, "MultiUIDefaults.keys()");
+        checkEnumeration(UIManager.getDefaults().elements(),
+                value, present, "MultiUIDefaults.elements()");
+
+        // check MultiUIDefaults.entrySet()
+        boolean found = false;
+        Set<Entry<Object, Object>> entries = UIManager.getDefaults().entrySet();
+        for (Entry<Object, Object> e: entries) {
+            if (e.getKey() == key) {
+                check(e.getValue() == value, "MultiUIDefaults.entrySet()");
+                found = true;
+            }
+        }
+        check(found == present, "MultiUIDefaults.entrySet()");
+    }
+
+    void checkEnumeration(Enumeration<Object> e, Object elem,
+            boolean present, String error) {
+        boolean found = false;
+        while (e.hasMoreElements()) {
+            if (e.nextElement() == elem) {
+                found = true;
+            }
+        }
+        check(found == present, error);
+    }
+
+    void check(boolean condition, String methodName) {
+        if (! condition) {
+            throw new RuntimeException(methodName + " failed");
+        }
+    }
+
+    void test() {
+        int size = UIManager.getDefaults().size();
+
+        // create a new value, size increases
+        UIManager.getLookAndFeelDefaults().put(KEY, VALUE);
+        check(KEY, VALUE, true, size + 1);
+
+        // override the value, size remains the same
+        UIManager.put(KEY, VALUE);
+        check(KEY, VALUE, true, size + 1);
+
+        // remove the value, size decreases
+        UIManager.getDefaults().remove(KEY);
+        check(KEY, null, false, size);
+    }
+
+    public static void main(String[] args) {
+        new Test6860438().test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/ColorCustomizationTest.java	Thu Jan 28 16:12:06 2010 -0800
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6860433
+   @summary Tests variuos techniques of Nimbus color customization
+   @author Peter Zhelezniakov
+   @run main ColorCustomizationTest
+*/
+
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.nimbus.NimbusLookAndFeel;
+import javax.swing.plaf.synth.Region;
+
+public class ColorCustomizationTest
+{
+    final static int WIDTH = 200;
+    final static int HEIGHT = 100;
+
+    static NimbusLookAndFeel nimbus;
+
+    final JLabel label;
+    final Graphics g;
+
+    ColorCustomizationTest() {
+        label = new JLabel();
+        label.setSize(200, 100);
+
+        g = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB).getGraphics();
+    }
+
+    public static void main(String[] args) throws Exception {
+        nimbus = new NimbusLookAndFeel();
+        try {
+            UIManager.setLookAndFeel(nimbus);
+        } catch (UnsupportedLookAndFeelException e) {
+            throw new Error("Unable to set Nimbus LAF");
+        }
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override public void run() {
+                new ColorCustomizationTest().test();
+            }
+        });
+    }
+
+    void check(Color c) {
+        SwingUtilities.updateComponentTreeUI(label);
+        label.paint(g);
+        if (label.getBackground().getRGB() != c.getRGB()) {
+            System.err.println("Color mismatch!");
+            System.err.println("   found: " + label.getBackground());
+            System.err.println("   expected: " + c);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    void test() {
+        testOverrides();
+        testInheritance();
+        testNames();
+        testBaseColor();
+    }
+
+    void testOverrides() {
+        Color defaultColor = label.getBackground();
+
+        // override default background
+        UIDefaults defs = new UIDefaults();
+        defs.put("Label.background", new ColorUIResource(Color.RED));
+        label.putClientProperty("Nimbus.Overrides", defs);
+        check(Color.RED);
+
+        // change overriding color
+        defs = new UIDefaults();
+        defs.put("Label.background", new ColorUIResource(Color.GREEN));
+        label.putClientProperty("Nimbus.Overrides", defs);
+        check(Color.GREEN);
+
+        // remove override
+        label.putClientProperty("Nimbus.Overrides", null);
+        check(defaultColor);
+    }
+
+    void testInheritance() {
+        Color defaultColor = label.getBackground();
+
+        // more specific setting is in global defaults
+        UIManager.put("Label[Enabled].background", new ColorUIResource(Color.RED));
+
+        // less specific one is in overrides
+        UIDefaults defs = new UIDefaults();
+        defs.put("Label.background", new ColorUIResource(Color.GREEN));
+
+        // global wins
+        label.putClientProperty("Nimbus.Overrides", defs);
+        check(Color.RED);
+
+        // now override wins
+        label.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
+        check(Color.GREEN);
+
+        // global is back
+        label.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
+        check(Color.RED);
+
+        // back to default color
+        UIManager.put("Label[Enabled].background", null);
+        label.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
+        label.putClientProperty("Nimbus.Overrides", null);
+        check(defaultColor);
+    }
+
+    void testNames() {
+        Color defaultColor = label.getBackground();
+
+        UIManager.put("\"BlueLabel\"[Enabled].background",
+                new ColorUIResource(Color.BLUE));
+        UIManager.put("\"RedLabel\"[Enabled].background",
+                new ColorUIResource(Color.RED));
+        nimbus.register(Region.LABEL, "\"BlueLabel\"");
+        nimbus.register(Region.LABEL, "\"RedLabel\"");
+
+        label.setName("BlueLabel");
+        check(Color.BLUE);
+        label.setName("RedLabel");
+        check(Color.RED);
+
+        // remove name, color goes back to default
+        label.setName(null);
+        check(defaultColor);
+    }
+
+    void testBaseColor() {
+        UIManager.put("control", Color.GREEN);
+        check(Color.GREEN);
+    }
+}