feat(fls): read and write a project's own applications as their beans
A project's own applications (classes under projekt/anwendungen, installed on a host) are no longer left out. The decoder now keeps the Java type of every primitive — at setters, constructor and call arguments, also through shared ids like Integer0 — and which properties an object's own getter made. beanCapture.ts turns a decoded bean back into what the writer writes, with the node's system software as a mark the writer replaces by the system software it writes; what the format cannot say is refused, not guessed (an unresolved value, a Field, a factory-made object, an object a getter reaches elsewhere in the file). The reader keeps own applications as captured beans; the corpus no longer warns. The capture first took a setter with another object's getter result for an own getter; the round-trip test found it. The Java oracle did not show whether an application runs on its node's system software, so a mutation writing the mark instead survived; it now reports onItsSystem (true for all 192 applications of the corpus). Checked by Java: from the files written again, FILIUS loads Accumulator and Broadcast installed, switched on and on their node's system software, as in the original. The round-trip test covers every primitive, null, a class, an array, shared objects, getter chains, constructed elements, map reads and static constants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,28 @@ describe('XMLDecoder rules', () => {
|
||||
expect(object(rectangle).properties.get('y')).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps the Java type of each primitive a setter, a constructor or a call gets', () => {
|
||||
// A shared getter result, as in the corpus: a button's measured icon text gap.
|
||||
const [, bean] = decodeJavaBeans(
|
||||
doc(`<object class="filius.gui.netzwerksicht.JSidebarButton"><void id="Integer0" property="iconTextGap"/></object>
|
||||
<object class="example.Bean"><short>3</short><char>x</char>
|
||||
<void property="count"><long>7</long></void>
|
||||
<void property="ratio"><float>0.5</float></void>
|
||||
<void property="gap"><object idref="Integer0"/></void>
|
||||
<void property="shared"><byte id="Byte0">2</byte></void>
|
||||
<void property="again"><object idref="Byte0"/></void>
|
||||
<void property="text"><string>7</string></void>
|
||||
<void property="count2"><int>1</int></void>
|
||||
<void property="count2"><string>no longer a number</string></void>
|
||||
<void method="put"><string>key</string><double>1.0</double></void>
|
||||
</object>`),
|
||||
);
|
||||
|
||||
expect(object(bean).argKinds).toEqual(['short', 'char']);
|
||||
expect(Object.fromEntries(object(bean).propertyKinds)).toEqual({ count: 'long', ratio: 'float', gap: 'int', shared: 'byte', again: 'byte' });
|
||||
expect(object(bean).calls).toEqual([{ method: 'put', args: ['key', 1], kinds: [undefined, 'double'] }]);
|
||||
});
|
||||
|
||||
it('says "unresolved" for a shared getter value it has no measurement for', () => {
|
||||
const [, holder] = decodeJavaBeans(
|
||||
doc(`<object class="com.example.Unknown"><void id="Integer0" property="size"/></object>
|
||||
|
||||
Reference in New Issue
Block a user