[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport
Oliver Kellogg
okellogg at users.sourceforge.net
Thu Aug 3 21:03:52 UTC 2006
SVN commit 569451 by okellogg:
Patch by JP Fournier fixes interface visibility problem (trunk: r568047)
CCBUG:131327
M +12 -6 javaimport.cpp
M +5 -0 javaimport.h
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #569450:569451
@@ -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 @@
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") {
@@ -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] != ";") {
kdError() << "importJava: ignoring trailing items at " << name << endl;
skipStmt();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.h #569450:569451
@@ -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