Summary: | java import - method parameter types not resolved correctly | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | JP Fournier <jfournier121> |
Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Slackware | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
java source describing the problem
patch to fix bug |
Description
JP Fournier
2006-08-04 03:57:01 UTC
Created attachment 17219 [details]
java source describing the problem
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
Original bug description should read: pack5.Pack5 is not resolved correctly. 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; 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); 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); |