[Uml-devel] [Bug 131327] java import - importing interfaces - absent visibility treated as package instead of public

Oliver Kellogg okellogg at users.sourceforge.net
Sun Jul 30 23:09:57 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=131327         
okellogg users sourceforge net changed:

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



------- Additional Comments From okellogg users sourceforge net  2006-07-31 01:09 -------
SVN commit 568047 by okellogg:

Apply attachment 121723 from JP Fournier. Note that this goes to trunk
because the 3.5 branch is currently frozen for release.
BUG:131327


 M  +6 -0      ChangeLog  
 M  +12 -6     umbrello/codeimport/javaimport.cpp  
 M  +5 -0      umbrello/codeimport/javaimport.h  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #568046:568047
 @ -1,3 +1,9  @
+Version 2.0
+
+* Bugs/wishes from http://bugs.kde.org:
+* Java import - importing interfaces - absent visibility treated as package
+  instead of public (131327)
+
 Version 1.5.4
 
 * Bugs/wishes from http://bugs.kde.org:
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #568046:568047
 @ -229,6 +229,11  @
 void JavaImport::parseFile(QString filename) {
     m_currentFileName= filename;
     m_imports.clear();
+    // default visibility is Impl, unless we are an interface, then it is 
+    // public for member vars and methods
+    m_defaultCurrentAccess = Uml::Visibility::Implementation;
+    m_currentAccess = m_defaultCurrentAccess;
+
     NativeImportBase::parseFile(filename);
 }
 
 @ -253,9 +258,6  @
             kError() << "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") {
 @ -271,6 +273,10  @
         // change it.
         m_klass->setInterface(keyword == "interface");
         m_isAbstract = m_isStatic = false;
+        // if no modifier is specified in an interface, then it means public
+        if ( m_klass->isInterface() ) {
+            m_defaultCurrentAccess =  Uml::Visibility::Public;
+        }
         if (advance() == ";")   // forward declaration
             return true;
         if (m_source[m_srcIndex] == "<") {
 @ -466,8 +472,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;
+        // reset the default visibility
+        m_currentAccess = m_defaultCurrentAccess;
         // At this point we do not know whether the method has a body or not.
         do {
             nextToken = advance();
 @ -526,7 +532,7  @
         nextToken = advance();
     }
     // reset visibility to default
-    m_currentAccess = Uml::Visibility::Implementation;
+    m_currentAccess = m_defaultCurrentAccess;
     if (m_source[m_srcIndex] != ";") {
         kError() << "importJava: ignoring trailing items at " << name << endl;
         skipStmt();
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/javaimport.h #568046:568047
 @ -85,7 +85,12  @
      */
     QStringList m_imports;
 
+    /**
+     * The current visibility for when the visibility is absent
+     */
+    Uml::Visibility m_defaultCurrentAccess;
 
+
 };
 
 #endif




More information about the umbrello-devel mailing list