feat(fls): a writer for the XMLDecoder format, checked by Java
javaBeansWriter.ts writes what java.beans.XMLDecoder reads — the counterpart of javabeans.ts and the base of the .fls writer. Its input says explicitly what Java should do: construct a class with typed arguments, call setters, getters (with statements on their result), methods and indexed access; an object reached twice is written once with an id and referenced after. Unlike XMLEncoder it writes what it is given, defaults included. What XML 1.0 cannot hold (controls, lone surrogates, U+FFFE/F) and a CR, which XML would read as a line break, are written as <char code>. Checked by Java itself: nine files of the writer (strings with every kind of odd unit, all primitive types including NaN, -0.0 and a long beyond 2^53, collections, maps, shared objects, Rectangle, Color, FILIUS beans with getter chains, arrays, indexed access, a static constant) are read by XMLDecoder in the Java oracle (BeansDump), which describes what it got and collects the errors the decoder would only log. Mutation probes regenerate the files and let Java read each mutant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<array class="java.lang.String" length="3">
|
||||
<void index="0">
|
||||
<string>a</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<null/>
|
||||
</void>
|
||||
<void index="2">
|
||||
<string>c</string>
|
||||
</void>
|
||||
</array>
|
||||
<array class="int" length="2">
|
||||
<void index="0">
|
||||
<int>0</int>
|
||||
</void>
|
||||
<void index="1">
|
||||
<int>5</int>
|
||||
</void>
|
||||
</array>
|
||||
</java>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<object class="java.awt.Rectangle">
|
||||
<int>1</int>
|
||||
<int>2</int>
|
||||
<int>3</int>
|
||||
<int>4</int>
|
||||
</object>
|
||||
<object class="java.awt.Color">
|
||||
<int>10</int>
|
||||
<int>20</int>
|
||||
<int>30</int>
|
||||
<int>40</int>
|
||||
</object>
|
||||
</java>
|
||||
@@ -0,0 +1,411 @@
|
||||
{
|
||||
"arrays.xml": {
|
||||
"values": [
|
||||
{
|
||||
"id": 0,
|
||||
"class": "[Ljava.lang.String;",
|
||||
"items": [
|
||||
{
|
||||
"string": "a"
|
||||
},
|
||||
null,
|
||||
{
|
||||
"string": "c"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"class": "[I",
|
||||
"items": [
|
||||
{
|
||||
"int": 0
|
||||
},
|
||||
{
|
||||
"int": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"awt.xml": {
|
||||
"values": [
|
||||
{
|
||||
"rectangle": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
]
|
||||
},
|
||||
{
|
||||
"color": [
|
||||
10,
|
||||
20,
|
||||
30,
|
||||
40
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"beans.xml": {
|
||||
"values": [
|
||||
{
|
||||
"id": 0,
|
||||
"class": "filius.software.system.Datei",
|
||||
"properties": {
|
||||
"dateiInhalt": {
|
||||
"string": "a.de. A 3600 1.2.3.4\\u000A"
|
||||
},
|
||||
"dateiTyp": {
|
||||
"string": "text"
|
||||
},
|
||||
"name": {
|
||||
"string": "hosts"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"class": "filius.software.email.EmailKonto",
|
||||
"properties": {
|
||||
"benutzername": {
|
||||
"string": "bob"
|
||||
},
|
||||
"emailAdresse": null,
|
||||
"nachname": {
|
||||
"string": ""
|
||||
},
|
||||
"nachrichten": {
|
||||
"id": 2,
|
||||
"class": "java.util.LinkedList",
|
||||
"items": [
|
||||
{
|
||||
"id": 3,
|
||||
"class": "filius.software.email.Email",
|
||||
"properties": {
|
||||
"absender": {
|
||||
"id": 4,
|
||||
"class": "filius.software.email.AddressEntry",
|
||||
"properties": {
|
||||
"mailAddress": {
|
||||
"string": "a@x"
|
||||
},
|
||||
"name": {
|
||||
"string": "Alice"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bcc": {
|
||||
"id": 5,
|
||||
"class": "java.util.ArrayList",
|
||||
"items": []
|
||||
},
|
||||
"betreff": {
|
||||
"string": "Hi"
|
||||
},
|
||||
"cc": {
|
||||
"id": 6,
|
||||
"class": "java.util.ArrayList",
|
||||
"items": []
|
||||
},
|
||||
"dateReceived": {
|
||||
"string": ""
|
||||
},
|
||||
"delete": false,
|
||||
"empfaenger": {
|
||||
"id": 7,
|
||||
"class": "java.util.ArrayList",
|
||||
"items": [
|
||||
{
|
||||
"id": 8,
|
||||
"class": "filius.software.email.AddressEntry",
|
||||
"properties": {
|
||||
"mailAddress": {
|
||||
"string": "b@y"
|
||||
},
|
||||
"name": null
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"neu": false,
|
||||
"text": {
|
||||
"string": ""
|
||||
},
|
||||
"versendet": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"passwort": null,
|
||||
"pop3port": null,
|
||||
"pop3server": null,
|
||||
"smtpport": null,
|
||||
"smtpserver": null,
|
||||
"vorname": {
|
||||
"string": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"class": "filius.software.email.Kontakt",
|
||||
"properties": {
|
||||
"email": null,
|
||||
"hausnr": {
|
||||
"int": 12
|
||||
},
|
||||
"name": {
|
||||
"string": "Lang"
|
||||
},
|
||||
"plz": {
|
||||
"int": 0
|
||||
},
|
||||
"strasse": null,
|
||||
"telefon": null,
|
||||
"vorname": null,
|
||||
"wohnort": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"collections.xml": {
|
||||
"values": [
|
||||
{
|
||||
"id": 0,
|
||||
"class": "java.util.Vector",
|
||||
"items": [
|
||||
{
|
||||
"int": 1
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"class": "java.util.ArrayList",
|
||||
"items": [
|
||||
{
|
||||
"string": "nested"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"class": "java.util.HashMap",
|
||||
"entries": [
|
||||
[
|
||||
{
|
||||
"string": "key"
|
||||
},
|
||||
{
|
||||
"int": 8
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"constants.xml": {
|
||||
"values": [
|
||||
{
|
||||
"int": 0
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"indexed.xml": {
|
||||
"values": [
|
||||
{
|
||||
"id": 0,
|
||||
"class": "java.util.LinkedList",
|
||||
"items": [
|
||||
{
|
||||
"id": 1,
|
||||
"class": "filius.software.system.Datei",
|
||||
"properties": {
|
||||
"dateiInhalt": null,
|
||||
"dateiTyp": null,
|
||||
"name": {
|
||||
"string": "renamed"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"string": "replaced"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"numbers.xml": {
|
||||
"values": [
|
||||
{
|
||||
"int": -1
|
||||
},
|
||||
{
|
||||
"int": 2147483647
|
||||
},
|
||||
{
|
||||
"long": "-9007199254740991"
|
||||
},
|
||||
{
|
||||
"long": "9223372036854775807"
|
||||
},
|
||||
{
|
||||
"double": "0.1"
|
||||
},
|
||||
{
|
||||
"double": "-0.0"
|
||||
},
|
||||
{
|
||||
"double": "1.0E300"
|
||||
},
|
||||
{
|
||||
"double": "NaN"
|
||||
},
|
||||
{
|
||||
"double": "-Infinity"
|
||||
},
|
||||
{
|
||||
"float": "1.5"
|
||||
},
|
||||
{
|
||||
"short": -3
|
||||
},
|
||||
{
|
||||
"byte": 127
|
||||
},
|
||||
{
|
||||
"char": 120
|
||||
},
|
||||
{
|
||||
"char": 1
|
||||
},
|
||||
true,
|
||||
false,
|
||||
null,
|
||||
{
|
||||
"class": "java.lang.String"
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"shared.xml": {
|
||||
"values": [
|
||||
{
|
||||
"id": 0,
|
||||
"class": "java.util.LinkedList",
|
||||
"items": [
|
||||
{
|
||||
"id": 1,
|
||||
"class": "java.util.ArrayList",
|
||||
"items": [
|
||||
{
|
||||
"string": "shared"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"class": "java.util.ArrayList",
|
||||
"items": [
|
||||
{
|
||||
"string": "other"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ref": 1
|
||||
},
|
||||
{
|
||||
"ref": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"class": "filius.software.system.Datei",
|
||||
"properties": {
|
||||
"dateiInhalt": {
|
||||
"string": "a.de. A 3600 1.2.3.4\\u000A"
|
||||
},
|
||||
"dateiTyp": {
|
||||
"string": "text"
|
||||
},
|
||||
"name": {
|
||||
"string": "hosts"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ref": 3
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
},
|
||||
"strings.xml": {
|
||||
"values": [
|
||||
{
|
||||
"id": 0,
|
||||
"class": "java.util.LinkedList",
|
||||
"items": [
|
||||
{
|
||||
"string": "plain"
|
||||
},
|
||||
{
|
||||
"string": ""
|
||||
},
|
||||
{
|
||||
"string": " spaced "
|
||||
},
|
||||
{
|
||||
"string": "<&>\"'"
|
||||
},
|
||||
{
|
||||
"string": "]]>"
|
||||
},
|
||||
{
|
||||
"string": "tab\\u0009here"
|
||||
},
|
||||
{
|
||||
"string": "line\\u000Abreak"
|
||||
},
|
||||
{
|
||||
"string": "cr\\u000Dhere"
|
||||
},
|
||||
{
|
||||
"string": "crlf\\u000D\\u000Ahere"
|
||||
},
|
||||
{
|
||||
"string": "\\u0000\\u0001\\u001F\\u007F"
|
||||
},
|
||||
{
|
||||
"string": "\\u0085\\u2028\\u2029"
|
||||
},
|
||||
{
|
||||
"string": "\\uFEFFbom"
|
||||
},
|
||||
{
|
||||
"string": "Gr\\u00FC\\u00DFe \\uD83D\\uDE00"
|
||||
},
|
||||
{
|
||||
"string": "lone \\uD800 high"
|
||||
},
|
||||
{
|
||||
"string": "lone \\uDC00 low"
|
||||
},
|
||||
{
|
||||
"string": "\\uFFFE\\uFFFF"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<object class="filius.software.system.Datei">
|
||||
<void property="name">
|
||||
<string>hosts</string>
|
||||
</void>
|
||||
<void property="dateiTyp">
|
||||
<string>text</string>
|
||||
</void>
|
||||
<void property="dateiInhalt">
|
||||
<string>a.de. A 3600 1.2.3.4
|
||||
</string>
|
||||
</void>
|
||||
</object>
|
||||
<object class="filius.software.email.EmailKonto">
|
||||
<void property="benutzername">
|
||||
<string>bob</string>
|
||||
</void>
|
||||
<void property="passwort">
|
||||
<null/>
|
||||
</void>
|
||||
<void property="nachname">
|
||||
<null/>
|
||||
</void>
|
||||
<void property="nachrichten">
|
||||
<void method="add">
|
||||
<object class="filius.software.email.Email">
|
||||
<void property="absender">
|
||||
<object class="filius.software.email.AddressEntry">
|
||||
<void property="name">
|
||||
<string>Alice</string>
|
||||
</void>
|
||||
<void property="mailAddress">
|
||||
<string>a@x</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void property="empfaenger">
|
||||
<void method="add">
|
||||
<object class="filius.software.email.AddressEntry">
|
||||
<void property="mailAddress">
|
||||
<string>b@y</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
</void>
|
||||
<void property="betreff">
|
||||
<string>Hi</string>
|
||||
</void>
|
||||
<void property="neu">
|
||||
<boolean>false</boolean>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
</void>
|
||||
</object>
|
||||
<object class="filius.software.email.Kontakt">
|
||||
<void property="hausnr">
|
||||
<int>12</int>
|
||||
</void>
|
||||
<void property="name">
|
||||
<string>Lang</string>
|
||||
</void>
|
||||
</object>
|
||||
</java>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<object class="java.util.Vector">
|
||||
<void method="add">
|
||||
<int>1</int>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="java.util.ArrayList">
|
||||
<void method="add">
|
||||
<string>nested</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
</object>
|
||||
<object class="java.util.HashMap">
|
||||
<void method="put">
|
||||
<string>key</string>
|
||||
<int>7</int>
|
||||
</void>
|
||||
<void method="put">
|
||||
<string>key</string>
|
||||
<int>8</int>
|
||||
</void>
|
||||
</object>
|
||||
</java>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<object class="javax.swing.SwingConstants" field="CENTER"/>
|
||||
</java>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<object class="java.util.LinkedList">
|
||||
<void method="add">
|
||||
<object class="filius.software.system.Datei">
|
||||
<void property="name">
|
||||
<string>first</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void index="0">
|
||||
<void property="name">
|
||||
<string>renamed</string>
|
||||
</void>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>second</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>replaced</string>
|
||||
</void>
|
||||
</object>
|
||||
</java>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<int>-1</int>
|
||||
<int>2147483647</int>
|
||||
<long>-9007199254740991</long>
|
||||
<long>9223372036854775807</long>
|
||||
<double>0.1</double>
|
||||
<double>-0.0</double>
|
||||
<double>1e+300</double>
|
||||
<double>NaN</double>
|
||||
<double>-Infinity</double>
|
||||
<float>1.5</float>
|
||||
<short>-3</short>
|
||||
<byte>127</byte>
|
||||
<char>x</char>
|
||||
<char code="#1"/>
|
||||
<boolean>true</boolean>
|
||||
<boolean>false</boolean>
|
||||
<null/>
|
||||
<class>java.lang.String</class>
|
||||
</java>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<object class="java.util.LinkedList">
|
||||
<void method="add">
|
||||
<object class="java.util.ArrayList" id="ArrayList0">
|
||||
<void method="add">
|
||||
<string>shared</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="java.util.ArrayList" id="ArrayList1">
|
||||
<void method="add">
|
||||
<string>other</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object idref="ArrayList0"/>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object idref="ArrayList1"/>
|
||||
</void>
|
||||
</object>
|
||||
<object class="filius.software.system.Datei" id="Datei0">
|
||||
<void property="name">
|
||||
<string>hosts</string>
|
||||
</void>
|
||||
<void property="dateiTyp">
|
||||
<string>text</string>
|
||||
</void>
|
||||
<void property="dateiInhalt">
|
||||
<string>a.de. A 3600 1.2.3.4
|
||||
</string>
|
||||
</void>
|
||||
</object>
|
||||
<object idref="Datei0"/>
|
||||
</java>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="17" class="java.beans.XMLDecoder">
|
||||
<object class="java.util.LinkedList">
|
||||
<void method="add">
|
||||
<string>plain</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string></string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string> spaced </string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string><&>"'</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>]]></string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>tab here</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>line
|
||||
break</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>cr<char code="#D"/>here</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>crlf<char code="#D"/>
|
||||
here</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string><char code="#0"/><char code="#1"/><char code="#1F"/></string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>
</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>bom</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>Grüße 😀</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>lone <char code="#D800"/> high</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string>lone <char code="#DC00"/> low</string>
|
||||
</void>
|
||||
<void method="add">
|
||||
<string><char code="#FFFE"/><char code="#FFFF"/></string>
|
||||
</void>
|
||||
</object>
|
||||
</java>
|
||||
Reference in New Issue
Block a user