Doesn't generate code for class associations

49 views
Skip to first unread message

MarekB

unread,
Apr 14, 2025, 4:23:12 AM4/14/25
to StarUML
I tried to generate code for simple model consists of two classes connected 1 to 0..* association (with assiotiacion name and roles specified).  For Java and C# generated code has attributes but not code for association.
Could anyone generate correct code for association?

Oliver Reinhard

unread,
Apr 15, 2025, 3:15:18 AM4/15/25
to MarekB, StarUML
Hi MarekB
You would make it easier for us to try this out if you supplied us with your example.
Thanks, oliver

On Mon, 14 Apr 2025 at 10:23, 'MarekB' via StarUML <sta...@googlegroups.com> wrote:
I tried to generate code for simple model consists of two classes connected 1 to 0..* association (with assiotiacion name and roles specified).  For Java and C# generated code has attributes but not code for association.
Could anyone generate correct code for association?

--
You received this message because you are subscribed to the Google Groups "StarUML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to staruml+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/staruml/24c9ad6a-b47b-43fa-807c-2c9706588e98n%40googlegroups.com.

MarekB

unread,
Apr 15, 2025, 8:34:17 AM4/15/25
to StarUML
Hello,
Frankly speaking, I have never successfuly generated correct code for associations after 4.x version. 
test1.PNG
For very simple model, when I generate Java code, for version 5.0 and above the generated code look like:

import java.util.*;

/**
 *
 */
public class Class1 {

    /**
     * Default constructor
     */
    public Class1() {
    }

    /**
     *
     */
    public int c1;

}

There is no code for associated Class2. However, for version 4.1.6 generated code look correct:

import java.util.*;

/**
 *
 */
public class Class1 {

    /**
     * Default constructor
     */
    public Class1() {
    }

    /**
     *
     */
    public int c1;

    /**
     *
     */
    public Set<Class2> myClass2;

}

Marek
test1.PNG

StarUML

unread,
Apr 15, 2025, 9:55:58 PM4/15/25
to StarUML
Hi,

Can you provide your .mdj file and error dumps in console?

Thanks,

2025년 4월 15일 화요일 오후 9시 34분 17초 UTC+9에 MarekB님이 작성:

MarekB

unread,
Apr 16, 2025, 3:50:44 AM4/16/25
to StarUML

I attached my .mdj file. There are no any errors in the console.
test1.mdj

StarUML

unread,
Apr 16, 2025, 7:25:16 AM4/16/25
to StarUML
Thank you for providing information.

Upon checking, the issue occurred because "navigability" was recently changed to have one of the values "navigable", "unspecified", or "notNavigable" instead of being a boolean.

It has now been resolved, and if you install the new version of the extension, it will be generated correctly.

Thank you,


2025년 4월 16일 수요일 오후 4시 50분 44초 UTC+9에 MarekB님이 작성:
Message has been deleted

MarekB

unread,
Apr 16, 2025, 9:42:34 AM4/16/25
to StarUML
Hello,
After update of the plugin it works. Thak you for your effort.

Marek

Reply all
Reply to author
Forward
0 new messages