ZenCodeLang / ZenCode

The ZenCode project.
MIT License
12 stars 8 forks source link

Java: Fix interface expansions #153

Open kindlich opened 3 months ago

kindlich commented 3 months ago

ZenCode offers the functionality to make an existing class implement new interfaces. Example code would be:

public class Point2D {
    public var x as usize;
    public var x as usize;

    public this(x: usize, y: usize) { this.x = x; this.y = y; }
}

public interface CommandStringDisplayable {
    public get commandString as string;
}

public expand MyClass {
    public implements CommandStringDisplayable {
        public get 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: