--- old/src/java.desktop/share/classes/java/beans/BeanDescriptor.java 2015-05-25 15:38:00.000000000 +0300 +++ new/src/java.desktop/share/classes/java/beans/BeanDescriptor.java 2015-05-25 15:38:00.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,10 +81,7 @@ SwingContainer container = beanClass.getAnnotation(SwingContainer.class); if (container != null) { setValue("isContainer", container.value()); - String delegate = container.delegate(); - if (!delegate.isEmpty()) { - setValue("containerDelegate", delegate); - } + setValue("containerDelegate", container.delegate()); } } --- old/test/java/beans/Introspector/4058433/TestSwingContainer.java 2015-05-25 15:38:01.000000000 +0300 +++ new/test/java/beans/Introspector/4058433/TestSwingContainer.java 2015-05-25 15:38:01.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,24 +20,31 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.beans.BeanDescriptor; import java.beans.BeanInfo; import java.beans.Introspector; import java.util.Objects; import javax.swing.SwingContainer; -/* + +/** * @test * @bug 4058433 * @summary Tests the SwingContainer annotation * @author Sergey Malenkov */ public class TestSwingContainer { + public static void main(String[] args) throws Exception { test(X.class, null, null); - test(T.class, true, null); - test(D.class, true, "method"); - test(F.class, false, null); - test(A.class, false, "method"); + test(H.class, true, ""); + test(G.class, true, ""); + test(F.class, true, "method"); + test(E.class, false, ""); + test(D.class, false, ""); + test(C.class, true, ""); + test(B.class, false, "method"); + test(A.class, true, "method"); } private static void test(Class type, Object iC, Object cD) throws Exception { @@ -50,7 +57,7 @@ private static void test(BeanDescriptor bd, String name, Object expected) { Object value = bd.getValue(name); - System.out.println(name + " = " + value); + System.out.println("\t" + name + " = " + value); if (!Objects.equals(value, expected)) { throw new Error(name + ": expected = " + expected + "; actual = " + value); } @@ -60,18 +67,34 @@ } @SwingContainer() - public static class T { + public static class H { + } + + @SwingContainer(delegate = "") + public static class G { } @SwingContainer(delegate = "method") - public static class D { + public static class F { } @SwingContainer(false) - public static class F { + public static class E { + } + + @SwingContainer(value = false, delegate = "") + public static class D { + } + + @SwingContainer(value = true, delegate = "") + public static class C { } @SwingContainer(value = false, delegate = "method") + public static class B { + } + + @SwingContainer(value = true, delegate = "method") public static class A { } }