-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
7
-
Fix Understood
-
x86
-
windows_xp
XML output could be optimized with already added <field> tag.
Consider expected and actual XML files for the following object:
public class Value {
public int i = 10;
public String s;
}
public class Bean {
private Value value = new Value();
public Value getValue() { return this.value; }
public void setValue(Value value) { this.value = value; }
}
Bean bean = new Bean();
bean.getBean().i = 0;
bean.getBean().s = "name";
Expected:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.7.0-internal" class="java.beans.XMLDecoder">
<object class="Bean">
<void id="Value0" property="value">
<field name="i">
<int>0</int>
</field>
<field name="s">
<string>name</string>
</field>
</void>
</object>
</java>
Actual:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.7.0-internal" class="java.beans.XMLDecoder">
<object class="Bean">
<void id="Value0" property="value">
<void class="Value" method="getField">
<string>i</string>
<void method="set">
<object idref="Value0">
<void class="Value" method="getField">
<string>s</string>
<void method="set">
<object idref="Value0"/>
<string>name</string>
</void>
</void>
</object>
<int>0</int>
</void>
</void>
</void>
</object>
</java>
Consider expected and actual XML files for the following object:
public class Value {
public int i = 10;
public String s;
}
public class Bean {
private Value value = new Value();
public Value getValue() { return this.value; }
public void setValue(Value value) { this.value = value; }
}
Bean bean = new Bean();
bean.getBean().i = 0;
bean.getBean().s = "name";
Expected:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.7.0-internal" class="java.beans.XMLDecoder">
<object class="Bean">
<void id="Value0" property="value">
<field name="i">
<int>0</int>
</field>
<field name="s">
<string>name</string>
</field>
</void>
</object>
</java>
Actual:
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.7.0-internal" class="java.beans.XMLDecoder">
<object class="Bean">
<void id="Value0" property="value">
<void class="Value" method="getField">
<string>i</string>
<void method="set">
<object idref="Value0">
<void class="Value" method="getField">
<string>s</string>
<void method="set">
<object idref="Value0"/>
<string>name</string>
</void>
</void>
</object>
<int>0</int>
</void>
</void>
</void>
</object>
</java>
- relates to
-
JDK-6479191 LTP: XMLEncoder does not update initialized property of GridBagConstraints type
- Resolved