| Summary: | java import - static not handled correctly | ||
|---|---|---|---|
| Product: | [Applications] umbrello | Reporter: | JP Fournier <jfournier121> |
| Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Slackware | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
The patch below seems to fix this bug.
regards
jp
jape@puma:~$ diff -c svn/kdesdk/umbrello/umbrello/javaimport.cpp kdesdk/umbrello/umbrello/javaimport.cpp
*** svn/kdesdk/umbrello/umbrello/javaimport.cpp 2006-07-16 09:27:38.000000000 -0400
--- kdesdk/umbrello/umbrello/javaimport.cpp 2006-07-16 13:09:15.000000000 -0400
***************
*** 358,367 ****
}
nextToken = advance();
}
! UMLObject *o = Import_Utils::insertAttribute(m_klass, m_currentAccess, name, typeName, m_comment);
UMLAttribute *attr = static_cast<UMLAttribute*>(o);
! if (nextToken != ",")
break;
name = advance();
nextToken = advance();
}
--- 358,370 ----
}
nextToken = advance();
}
! UMLObject *o = Import_Utils::insertAttribute(m_klass, m_currentAccess, name, typeName, m_comment, m_isStatic);
UMLAttribute *attr = static_cast<UMLAttribute*>(o);
! if (nextToken != ",") {
! // reset the modifiers
! m_isStatic=m_isAbstract=false;
break;
+ }
name = advance();
nextToken = advance();
}
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();
|
Version: svn - 562901 (using KDE KDE 3.5.0) Installed from: Slackware Packages Compiler: gcc 3.4.4 OS: Linux steps to reproduce: - with recent svn version of umbrello import the class below - drag to class diagram problems: - constructor is tagged as static - static field VALUE is not tagged as static package test; abstract class StaticAbstract extends Object { private int privateInt; long packageInt; public static final String VALUE = "aString"; StaticAbstract() { } protected StaticAbstract(int arg ) { } abstract String abstractMethod(String arg) ; private static int getInt() { return 7; } public String toString() { return VALUE; } }