Bug 173777 - import from java code don't read abstract classes
Summary: import from java code don't read abstract classes
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Ralf Habacker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-28 19:34 UTC by Enzo Cappa
Modified: 2016-08-27 06:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.20.1 (KDE Applications 16.08.1)


Attachments
Print of the class (126.86 KB, image/png)
2016-05-09 20:13 UTC, Lays Rodrigues
Details
testcase (120 bytes, text/x-java-source)
2016-08-26 19:19 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Enzo Cappa 2008-10-28 19:34:25 UTC
Version:           1.5.8 (using KDE 3.5.9)
OS:                Linux
Installed from:    Debian testing/unstable Packages

When importing from java code, the abstract classes are identified like normal classes, not abstracts ones.
Comment 1 Ralf Habacker 2016-05-02 14:30:51 UTC
Please provide working java test case
Comment 2 Enzo Cappa 2016-05-02 17:56:53 UTC
This bug is more than 7 years old.  I don't know if it's still valid, and I'm not using umbrello anymore. I can't provide any further feedback. Feel free to close it if nobody else is interested.
Comment 3 Ralf Habacker 2016-05-05 02:46:45 UTC
@Lays: Please add java files showing this issue to this bug. On the internet there are examples for the usage of abstract classes.
Comment 4 Lays Rodrigues 2016-05-09 20:13:32 UTC
Created attachment 98869 [details]
Print of the class

I had confirmed the bug.
The name of the class isn't appearing using *Italic* font, that is the notation of the Abstract Class in UML.
This is the code that I used like example:
https://paste.kde.org/pelpgwcqe
Comment 5 Lays Rodrigues 2016-05-09 21:34:33 UTC
Previous comment about the confirmation of the bug.
Comment 6 Lays Rodrigues 2016-05-09 22:29:55 UTC
Ralf, i'm looking to the code to try fix this bug, in the part of the code below, i get confused. The type of comparation using QLatin1String isn't more slow that integer comparison?
umlobject.cpp line 1000
if (element.hasAttribute(QLatin1String("abstract"))) {      // for bkwd compat.
        QString abstract = element.attribute(QLatin1String("abstract"), QLatin1String("0"));
        m_bAbstract = (bool)abstract.toInt();
    } else {
        QString isAbstract = element.attribute(QLatin1String("isAbstract"), QLatin1String("false"));
        m_bAbstract = (isAbstract == QLatin1String("true"));
    }
Comment 7 Lays Rodrigues 2016-05-10 14:20:19 UTC
BTW, I think that the status isAbstract isn't being set to the UMLObject.
javaimport.cpp 421
if (keyword == QLatin1String("abstract")) {
        m_isAbstract = true;
        return true;
    }
it returns to:
nativeimportbase.cpp 479
if (! parseStmt())
           skipStmt();
        m_comment.clear();
But I didn't find the place that the data of javaImport is handled, and that I mean, where the data from JavaImport is set to UMLObject.
Comment 8 Ralf Habacker 2016-06-03 20:42:25 UTC
(In reply to Lays Rodrigues from comment #7)
> BTW, I think that the status isAbstract isn't being set to the UMLObject.
> javaimport.cpp 421
> if (keyword == QLatin1String("abstract")) {
>         m_isAbstract = true;
>         return true;
>     }
> it returns to:
> nativeimportbase.cpp 479
> if (! parseStmt())
>            skipStmt();
>         m_comment.clear();
> But I didn't find the place that the data of javaImport is handled, and that
> I mean, where the data from JavaImport is set to UMLObject.
search for m_isAbstract. You will find several occurences in javaimport.cpp

304:       m_klass->setAbstract(m_isAbstract);
549:       Import_Utils::insertMethod(m_klass, op, m_currentAccess, typeName,
                                   m_isStatic, m_isAbstract, false /*isFriend*/,
                                   false /*isConstructor*/, m_comment);
Comment 9 Ralf Habacker 2016-08-26 19:19:20 UTC
Created attachment 100790 [details]
testcase
Comment 10 Ralf Habacker 2016-08-27 06:56:29 UTC
Git commit 27687f8a180685a84729823ce7f84a668c0a3da1 by Ralf Habacker.
Committed on 27/08/2016 at 06:56.
Pushed by habacker into branch 'Applications/16.08'.

Fix 'Import from java code don't read abstract classes'.

Bug is caused by reseting UMLObject::m_isAbstract in
UMLClassifier::setBaseType().

A similar bug in C# import is also fixed with this commit.
FIXED-IN:2.20.1 (KDE Applications 16.08.1)

M  +2    -1    umbrello/codeimport/csharp/csharpimport.cpp
M  +2    -1    umbrello/codeimport/javaimport.cpp

http://commits.kde.org/umbrello/27687f8a180685a84729823ce7f84a668c0a3da1