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:
@@ -1,7 +1,7 @@
|
||||
// A project's own applications (classes under projekt/anwendungen): Java
|
||||
// installs them when it loads the whole archive (tools/java-oracle, laden);
|
||||
// this package reads, writes and exports them in a later step (B2). Until
|
||||
// then the tests compare Java's views without them.
|
||||
// installs them when it loads the whole archive (tools/java-oracle, laden).
|
||||
// The reader keeps them as beans, without knowing what Java makes of them;
|
||||
// its test compares them by key and class.
|
||||
|
||||
import { FILIUS_APPLICATION_CLASSES } from '../src/index.js';
|
||||
|
||||
@@ -32,6 +32,30 @@ export function withoutOwnApplications<T>(view: T): T {
|
||||
};
|
||||
}
|
||||
|
||||
/** Java's view with each own application as its key, class and whether it runs on its node's system software. */
|
||||
export function withOwnApplicationsByClass<T>(view: T): T {
|
||||
const { nodes } = view as View;
|
||||
if (nodes === undefined) return view;
|
||||
return {
|
||||
...view,
|
||||
nodes: nodes.map((node) =>
|
||||
node.system.applications === undefined
|
||||
? node
|
||||
: {
|
||||
...node,
|
||||
system: {
|
||||
...node.system,
|
||||
applications: (node.system.applications as { key: string; class: string }[]).map((application) =>
|
||||
(FILIUS_APPLICATION_CLASSES as readonly string[]).includes(application.class)
|
||||
? application
|
||||
: { key: application.key, class: application.class, onItsSystem: (application as { onItsSystem?: boolean }).onItsSystem },
|
||||
),
|
||||
},
|
||||
},
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/** Whether Java's view has an own application installed. */
|
||||
export function hasOwnApplications(view: unknown): boolean {
|
||||
return JSON.stringify(withoutOwnApplications(view)) !== JSON.stringify(view);
|
||||
|
||||
Reference in New Issue
Block a user