United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7193977 REGRESSION:Java 7's JavaBeans persistence ignoring the "transient" flag on properties
JDK-7193977 : REGRESSION:Java 7's JavaBeans persistence ignoring the "transient" flag on properties

Details
Type:
Bug
Submit Date:
2012-08-24
Status:
Resolved
Updated Date:
2012-10-18
Project Name:
JDK
Resolved Date:
2012-09-25
Component:
client-libs
OS:
windows_7
Sub-Component:
java.beans
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
7u6
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

Description
Java 7's JavaBeans persistence ignoring the "transient" flag on properties

but XMLEncoder is not ignoring "transient".

Rather the JavaBeans Introspector is somehow dropping "transient" from 1 of 2 properties when composing the subclass BeanInfo.  In the parent class' BeanInfo "transient" is present on both properties.  In the subclass, however, it is only present on 1 of the 2 properties.  Java 6 doesn't have this issue.  

Have a BeanInfo class, InfoBeanInfo, for a base class, Info, that
marks the CustomDelegateFactory property (any capitalization thereof)
as transient and PropertyDescriptor.setValue( "transient", Boolean.TRUE ).

This is obeyed just fine in testing with the Java 6 Update 34 when
outputting instances of subclasses of Info.  This seems to be ignored
by the test JDK provided -- resulting in undesirable output.

Checked Java 7 Update 6 and it also seems to ignore this BeanInfo.
Note that although the classes reside in various packages, they're all in one directory 

The test execution is encapsulated in Test.main().

Java 6 Update 34 produces:

    INFO (BASE CLASS) TRANSIENT PROPERTIES:
    ---------------------------------------
    customDelegateFactory
    customDelegateFactoryClass

    SUMMARY (SUB-CLASS) TRANSIENT PROPERTIES:
    -----------------------------------------
    customDelegateFactory
    customDelegateFactoryClass

Java 7 Update 6 produces:

    INFO (BASE CLASS) TRANSIENT PROPERTIES:
    ---------------------------------------
    customDelegateFactory
    customDelegateFactoryClass

    SUMMARY (SUB-CLASS) TRANSIENT PROPERTIES:
    -----------------------------------------
    customDelegateFactoryClass

Note that 'customDelegateFactory' is transient in the Info class' BeanInfo in both cases, but is not transient in the Summary class' BeanInfo in Java 7.

                                    

Comments
EVALUATION

For properties with Generics we should clone property descriptors, not only their names and methods.
                                     
2012-09-05
URL:   http://hg.openjdk.java.net/jdk8/build/jdk/rev/04292c0c943b
User:  katleman
Date:  2012-09-27 06:14:08 +0000

                                     
2012-09-27



Hardware and Software, Engineered to Work Together