You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZenCode offers the functionality to make an existing class implement new interfaces.
Example code would be:
publicclass Point2D {
publicvar x asusize;
publicvar x asusize;
public this(x: usize, y: usize) { this.x = x; this.y = y; }
}
publicinterface CommandStringDisplayable {
publicget commandString asstring;
}
publicexpand MyClass {
publicimplements CommandStringDisplayable {
publicget commandString => "<point:" + x + ":" + y + ">";
}
}
Currently, while this code (probably) parses and passes validation, it breaks at Java Compilation.
Reason is that this functionality was never implemented for the Java side.
We need to implement this for the Java Bytecode side or decide how to deal with this otherwise
Acceptance criteria:
Have decided on a plan on how to implement this OR Have decided that this should not be possible on ZC Java
How to integrate with Java-Code
what should new MyClass() instanceof CommandStringDisplayable return?
How to add interfaces to existing Java Classes?
Can interfaces be added to final classes?
Edge Cases:
Interface already implemented either by original class or by another expansion => Error
Conflicting method definition in 2 interfaces => Decide: Error or okay?
Activity