Bug 131825 - java import - method parameter types not resolved correctly
Summary: java import - method parameter types not resolved correctly
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Slackware Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-04 03:57 UTC by JP Fournier
Modified: 2006-08-05 03:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
java source describing the problem (255 bytes, application/octet-stream)
2006-08-04 03:57 UTC, JP Fournier
Details
patch to fix bug (942 bytes, patch)
2006-08-04 04:02 UTC, JP Fournier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description JP Fournier 2006-08-04 03:57:01 UTC
Version:           1.5.4+ (svn - 569451) (using KDE KDE 3.5.0)
Installed from:    Slackware Packages
Compiler:          gcc 3.4.4 
OS:                Linux

Import the file pack4.Pack4 from the attachment.
pack5.Pack is not resolved correctly.
Comment 1 JP Fournier 2006-08-04 03:57:51 UTC
Created attachment 17219 [details]
java source describing the problem
Comment 2 JP Fournier 2006-08-04 04:02:48 UTC
Created attachment 17220 [details]
patch to fix bug

diff -c svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp
kdesdk/umbrello/umbrello/codeimport/javaimport.cpp > methodres.diff
Comment 3 JP Fournier 2006-08-04 04:04:35 UTC
Original bug description should read:
pack5.Pack5 is not resolved correctly. 
Comment 4 Oliver Kellogg 2006-08-04 08:17:13 UTC
SVN commit 569520 by okellogg:

Patch by JP Fournier helps avoid creation of unwanted placeholder types
for unqualified type names mentioned in method parameters.
BUG:131825


 M  +1 -0      ChangeLog  
 M  +7 -1      umbrello/codeimport/javaimport.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #569519:569520
@@ -4,6 +4,7 @@
 * Java import - importing interfaces - absent visibility treated as package
   instead of public (131327)
 * Python code generation not independent of diagram view (131790)
+* Java import - method parameter types not resolved correctly (131825)
 
 Version 1.5.4
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #569519:569520
@@ -308,7 +308,7 @@
         }
         if (m_source[m_srcIndex] == "extends") {
             const QString& baseName = advance();
-            // try to resove the class we are extending, or if impossible
+            // try to resolve the class we are extending, or if impossible
             // create a placeholder
             UMLObject *parent = resolveClass( baseName );
             if ( parent ) {
@@ -463,6 +463,12 @@
         while (m_srcIndex < srcLength && m_source[m_srcIndex] != ")") {
             QString typeName = joinTypename();
             QString parName = advance();
+            // the Class might not be resolved yet so resolve it if necessary
+            UMLObject *obj = resolveClass(typeName);
+            if (obj) {
+                // by prepending the package, unwanted placeholder types will not get created
+                typeName = obj->getFullyQualifiedName(".");
+            }
             UMLAttribute *att = Import_Utils::addMethodParameter(op, typeName, parName);
             if (advance() != ",")
                 break;
Comment 5 JP Fournier 2006-08-05 02:51:13 UTC
The patch below fixes a related problem with resolving return types:

unix> diff -c svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp kdesdk/umbrello/umbrello/codeimport/javaimport.cpp
*** svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp      2006-08-04 20:43:24.000000000 -0400
--- kdesdk/umbrello/umbrello/codeimport/javaimport.cpp  2006-08-04 20:44:58.000000000 -0400
***************
*** 474,479 ****
--- 474,486 ----
                  break;
              m_srcIndex++;
          }
+         // before adding the method, try resolving the return type
+         //
+         UMLObject *obj = resolveClass(typeName);
+         if (obj) {
+             // using the fully qualified name means that a placeholder type will not be created.
+             typeName = obj->getFullyQualifiedName(".");
+         }
          Import_Utils::insertMethod(m_klass, op, m_currentAccess, typeName,
                                     m_isStatic, m_isAbstract, false /*isFriend*/,
                                     false /*isConstructor*/, m_comment);
Comment 6 Oliver Kellogg 2006-08-05 03:15:15 UTC
SVN commit 569867 by okellogg:

Further patch from JP Fournier applies same change to the return value.
CCBUG:131825


 M  +6 -0      javaimport.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #569866:569867
@@ -474,6 +474,12 @@
                 break;
             m_srcIndex++;
         }
+        // before adding the method, try resolving the return type
+        UMLObject *obj = resolveClass(typeName);
+        if (obj) {
+            // using the fully qualified name means that a placeholder type will not be created.
+            typeName = obj->getFullyQualifiedName(".");
+        }
         Import_Utils::insertMethod(m_klass, op, m_currentAccess, typeName,
                                    m_isStatic, m_isAbstract, false /*isFriend*/,
                                    false /*isConstructor*/, m_comment);