Bug 375224 - C# importer crashes on enums when they're used before being defined
Summary: C# importer crashes on enums when they're used before being defined
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-18 11:29 UTC by UnremarkableGuy
Modified: 2017-03-12 19:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.21.2 (KDE Applications 16.12.2)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description UnremarkableGuy 2017-01-18 11:29:24 UTC
There's no concept of forward declarations in C#, so it's allowed to use enum types before they're defined but when I try to import this C# code,
umbrello crashes.

namespace TestNamespace
{
    public class TestClass
    {
        void Dispatch(COMMAND com);
    }

    public enum COMMAND
    {
        OPTION1,
        OPTION2,
        OPTION3
    }
}

If I rearange the code like this, it works fine

namespace TestNamespace
{
    public enum COMMAND
    {
        OPTION1,
        OPTION2,
        OPTION3
    }

    public class TestClass
    {
        void Dispatch(COMMAND com);
    }
}
Comment 1 Ralf Habacker 2017-01-18 21:51:47 UTC
Git commit 6c44d5a904c6f2ce4fd20b66f20b5ab14ab6924e by Ralf Habacker.
Committed on 18/01/2017 at 21:50.
Pushed by habacker into branch 'Applications/16.12'.

Fix 'C# importer crashes on enums when they're used before being defined'.

Unknown types are created as UMLClassifier and not as UMLEnum, which is required.
FIXED-IN:2.12.2 (KDE Applications 16.12.2)

M  +4    -1    umbrello/codeimport/csharp/csharpimport.cpp
M  +28   -0    umbrello/codeimport/import_utils.cpp
M  +2    -0    umbrello/codeimport/import_utils.h
M  +4    -17   umbrello/codeimport/javaimport.cpp

https://commits.kde.org/umbrello/6c44d5a904c6f2ce4fd20b66f20b5ab14ab6924e