Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Fix interface expansions #153

Open
8 tasks
kindlich opened this issue Jun 7, 2024 · 0 comments
Open
8 tasks

Java: Fix interface expansions #153

kindlich opened this issue Jun 7, 2024 · 0 comments
Labels
bug Something isn't working bytecode All issues that relate to the generation of Java Bytecode JavaIntegration All issues that relate to integrating ZenCode with existing Java Code
Milestone

Comments

@kindlich
Copy link
Member

kindlich commented Jun 7, 2024

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:

  • 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?
@kindlich kindlich added bug Something isn't working bytecode All issues that relate to the generation of Java Bytecode JavaIntegration All issues that relate to integrating ZenCode with existing Java Code labels Jun 7, 2024
@kindlich kindlich added this to the v1.0.0 milestone Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bytecode All issues that relate to the generation of Java Bytecode JavaIntegration All issues that relate to integrating ZenCode with existing Java Code
Projects
None yet
Development

No branches or pull requests

1 participant