[Uml-devel] [Bug 130926] java import - static not handled correctly

Oliver Kellogg okellogg at users.sourceforge.net
Sun Jul 16 20:52:58 UTC 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=130926         
okellogg users sourceforge net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From okellogg users sourceforge net  2006-07-16 22:52 -------
SVN commit 563157 by okellogg:

Patches from JP Fournier fix setting of method staticness and package visibility.
BUG:130926
BUG:130932


 M  +3 -0      ChangeLog  
 M  +14 -3     umbrello/codeimport/javaimport.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #563156:563157
 @ -5,10 +5,13  @
 * Fix crash when importing classes from a java file (129107, 130093)
 * Crash after single click on the "UML Model" tree window (126560/129252)
 * Cannot insert transition/association TO fork/join node in activity diagram (129914)
+* Importing java files that reference their own class name crashes (130735)
 * Importing java class (enum pattern) cause umbrello to hang (130792)
 * Importing java subinterface before superinterface results in superinterface
   not being treated as an interface (130793)
 * Java import: method and class visibility ignored (130794)
+* Java import - static not handled correctly (130926)
+* Java import - package visibility incorrectly represented (130932)
 
 Version 1.5.3
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #563156:563157
 @ -143,6 +143,9  @
             kdError() << "importJava: unexpected: " << m_source[m_srcIndex] << endl;
             skipStmt();
         }
+        // The default visibilty for java is implementation, since the absence
+        // of a modifier means package visibility (which maps to implementation).
+        m_currentAccess = Uml::Visibility::Implementation;
         return true;
     }
     if (keyword == "class" || keyword == "interface") {
 @ -152,6 +155,7  @
         m_scope[++m_scopeIndex] = m_klass = static_cast<UMLClassifier*>(ns);
         m_klass->setAbstract(m_isAbstract);
         m_klass->setStatic(m_isStatic);
+        m_klass->setVisibility(m_currentAccess);
         m_isAbstract = m_isStatic = false;
         if (advance() == ";")   // forward declaration
             return true;
 @ -320,6 +324,8  @
                                    m_isStatic, m_isAbstract, false /*isFriend*/,
                                    false /*isConstructor*/, m_comment);
         m_isAbstract = m_isStatic = false;
+        // Default visibility for java is implementation (package vis.)
+        m_currentAccess = Uml::Visibility::Implementation;
         // At this point we do not know whether the method has a body or not.
         do {
             nextToken = advance();
 @ -358,14 +364,19  @
             }
             nextToken = advance();
         }
-        UMLObject *o = Import_Utils::insertAttribute(m_klass, m_currentAccess, name, typeName, m_comment);
+        UMLObject *o = Import_Utils::insertAttribute(m_klass, m_currentAccess, name,
+                                                     typeName, m_comment, m_isStatic);
         UMLAttribute *attr = static_cast<UMLAttribute*>(o);
-        if (nextToken != ",")
+        if (nextToken != ",") {
+            // reset the modifiers
+            m_isStatic = m_isAbstract = false;
             break;
+        }
         name = advance();
         nextToken = advance();
     }
-    m_currentAccess = Uml::Visibility::Public;
+    // reset visibility to default
+    m_currentAccess = Uml::Visibility::Implementation;
     if (m_source[m_srcIndex] != ";") {
         kdError() << "importJava: ignoring trailing items at " << name << endl;
         skipStmt();




More information about the umbrello-devel mailing list