Problems parsing and generating static methods in Java interfaces

(System: Eclipse 2020-12 with Java SE 15. Default UML Lab code styles. )

UML Lab seems to be unable to parse a Java interface with a static method plus if such a method is created in the class diagram view, the resultant generated Java code is an illegal syntax.

Error messages:
- "Unable to parse file" --> will bring up a code comparison window that wants to delete part of the code or sometimes, the entire Java source file.
- Sometimes the above error does not appear and only the "Differences occurred between reverse engineered files and the source that would be generated from the model" error message that wants to delete or change the code.

Results: UML Lab if allowed "Apply changes to code" may:
- Delete part of the code
- Replace the code with illegal syntax
- In more complex code, it may even delete the entire Java source file of the interface.

To reproduce: In a Java project with a single interface below defined and added to a class diagram:

public interface ITest {
static void method() {
}
}

"Apply changes to code" will result in the following illegal Java syntax being generated:

public interface ITest {
static void method() ;
}

The above illegal syntax is also generated by UML Lab when using the palette in the class diagram editor to add an operation to the interface and marking it as "static" in the properties pane.

This is a serious issue because it threatens to delete or change large and critical pieces of valid code.

Is there a special UML Lab setting to prevent this problem or is this a bug?

Comments

  • Hello swong,

    great to hear from you and thank you for the report.

    I had a short look into your problem and this seems to be an issue with our Java-Templates we include in UML Lab. I will create a ticket for this issue, but cannot give you an estimation, when we plan to update the templates.

    In general, the dialog you mention is always a hint for a problem with the currently used templates, when the reverse-engineered and the generated code does not match.

    Best regards,
    Andreas
  • Thanks Andreas! Since this is a pretty serious problem for me, I'd be very willing to "test drive" a new Java template if possible.
  • Any progress on this issue? I see that a new version (1.23.0) has been posted but there doesn't seem to be any changes with regards to this issue. Thanks!
Sign In or Register to comment.