| Bug 123661: Java import fails at abstract methods or interfaces | (normal) |
| Opened: | 2006-03-15 14:16 |
| Product: | umbrello |
| Component: | general |
| Version: | unspecified |
| Status: | RESOLVED |
| Platform: | unspecified |
| Resolution: | FIXED |
| Reporter: | Harald Herres |
| Assigned to: | Umbrello Development Group |
Version: 1.5.1 (using KDE 3.4.2 Level "b" , SUSE 10.0)
Compiler: Target: x86_64-suse-linux
OS: Linux (x86_64) release 2.6.13-15.8-smp
Importing interfaces will stop after the first method declaration.
After the import finds a method declaration it assumes that this declaration is always stopped by a '}'. But this is not true. Abstract methods are stopped with the trailing ';'.
I have a solution to provide. I'm not familiar with diff/patch so i provide the following snippet. I hope that one of the maintainers can use it.
File: javaimport.cpp Line: 313
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;
// -------------------------------
// At this point we do not know wether the method has a body or not
// 15.3.2006 H. Herres
nextToken = advance();
while (nextToken != "{" && nextToken != ";") {
nextToken = advance();
}
if (nextToken == ";") {
// No body (interface or abstract)
return true;
} else {
return skipToClosing('{');
}
//------------------------------
}
// At this point we know it's some kind of attribute declaration.
while (1) {
while (nextToken != "," && nextToken != ";") {
name += nextToken; // add possible array dimensions to `name'
nextToken = advance();
}
------- Additional Comment #1 From Oliver Kellogg 2006-03-15 20:41 -------
SVN commit 518955 by okellogg:
parseStmt(): Check next token after method profile, it might be a semicolon.
Thanks to Harald Herres <harald.herres_AT_control.de> for the fix.
BUG:123661
M +1 -0 ChangeLog
M +2 -1 THANKS
M +10 -1 umbrello/javaimport.cpp
--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #518954:518955
at at -26,6 +26,7 at at
* Crash when creating a datatype with the same name as a class (122188)
* Memory problem when importing classes from c++ sources (122668)
* Crash when refusing to rename a class on importing typedef (122914)
+* Java import fails at abstract methods or interfaces (123661)
Version 1.5.1
--- branches/KDE/3.5/kdesdk/umbrello/THANKS #518954:518955
at at -33,8 +33,9 at at
Esben Mose Hansen <esben at despammed.com>
Olaf Hartig <OleBowle at gmx.de>
Marius Helf <marius.helf at gmx.de>
+Paul Hensgen <phensgen at bigpond.net.au>
Michel Hermier <michel.hermier at wanadoo.fr>
-Paul Hensgen <phensgen at bigpond.net.au>
+Harald Herres <harald.herres at control.de>
David Hugh-Jones <hughjonesd at yahoo.co.uk>
Pekka Jääskeläinen <pjaaskel at cs.tut.fi>
Klas Kalass <klas.kalass at gmx.de>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/javaimport.cpp #518954:518955
at at -309,7 +309,16 at at
m_isStatic, m_isAbstract, false /*isFriend*/,
false /*isConstructor*/, m_comment);
m_isAbstract = m_isStatic = false;
- return skipToClosing('{');
+ // At this point we do not know whether the method has a body or not.
+ do {
+ nextToken = advance();
+ } while (nextToken != "{" && nextToken != ";");
+ if (nextToken == ";") {
+ // No body (interface or abstract)
+ return true;
+ } else {
+ return skipToClosing('{');
+ }
}
// At this point we know it's some kind of attribute declaration.
while (1) {
| Attachment | Type | Modified | Status | Actions |
|---|---|---|---|---|
| Create a New Attachment (proposed patch, testcase, etc.) | View All | |||
Bugs.KDE.Org Actions
