Bug 130794 - java class import : method and class visibility ignored (treated as public)
Summary: java class import : method and class visibility ignored (treated as public)
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-14 03:07 UTC by JP Fournier
Modified: 2006-07-16 01:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JP Fournier 2006-07-14 03:07:30 UTC
Version:            (using KDE KDE 3.5.0)
Compiler:          gcc 3.4.4 
OS:                Linux

When importing a java class non-public methods are displayed as public. Also the visibility of the class itself is treated as public when it is pakage visible.

Steps to reproduce:

- import class below
- drag class to class diagram
- all methods are labeled as public (+)
- class is also treated as public 

------------------



class Visibility {


	private void privateMethod() {

	}

	public void publicMethod() {

	}

	protected void protectedMethod() {

	}

	void packageMethod() {

	}

}
Comment 1 JP Fournier 2006-07-14 03:09:19 UTC
umbrello version = 1.5.4  - kdesdk-561582
Comment 2 JP Fournier 2006-07-15 15:10:31 UTC
I changed javaimport.cpp to make use of the m_currentAccess.  Seems to work for me. Patch below.  Not obvious to me what should be done about java's package visibility though since it doesn't seem to be defined in the Visibility enum.

regards

jp



jape@puma:~/tmp/uml/kdesdk-561582$ diff -c umbrello-561582/umbrello/javaimport.cpp umbrello/umbrello/javaimport.cpp
*** umbrello-561582/umbrello/javaimport.cpp     2006-07-15 07:24:49.000000000 -0400
--- umbrello/umbrello/javaimport.cpp    2006-07-15 08:43:00.000000000 -0400
***************
*** 315,321 ****
                  break;
              m_srcIndex++;
          }
!         Import_Utils::insertMethod(m_klass, op, Uml::Visibility::Public, typeName,
                                     m_isStatic, m_isAbstract, false /*isFriend*/,
                                     false /*isConstructor*/, m_comment);
          m_isAbstract = m_isStatic = false;
--- 315,321 ----
                  break;
              m_srcIndex++;
          }
!         Import_Utils::insertMethod(m_klass, op, m_currentAccess, typeName,
                                     m_isStatic, m_isAbstract, false /*isFriend*/,
                                     false /*isConstructor*/, m_comment);
          m_isAbstract = m_isStatic = false;




Comment 3 Oliver Kellogg 2006-07-16 01:34:22 UTC
SVN commit 562844 by okellogg:

parseStmt(): Use m_currentAccess at call to Import_Utils::insertMethod().
Thanks to JP Fournier for the patch.
BUG:130794


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


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #562843:562844
@@ -6,6 +6,7 @@
 * Cannot insert transition/association TO fork/join node in activity diagram (129914)
 * Importing java subinterface before superinterface results in superinterface
   not being treated as an interface (130793)
+* Java import: method and class visibility ignored (130794)
 
 Version 1.5.3
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/javaimport.cpp #562843:562844
@@ -315,7 +315,7 @@
                 break;
             m_srcIndex++;
         }
-        Import_Utils::insertMethod(m_klass, op, Uml::Visibility::Public, typeName,
+        Import_Utils::insertMethod(m_klass, op, m_currentAccess, typeName,
                                    m_isStatic, m_isAbstract, false /*isFriend*/,
                                    false /*isConstructor*/, m_comment);
         m_isAbstract = m_isStatic = false;