Bug 375224

Summary: C# importer crashes on enums when they're used before being defined
Product: [Applications] umbrello Reporter: UnremarkableGuy <badpointer0>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal CC: ralf.habacker
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In: 2.21.2 (KDE Applications 16.12.2)

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