Version: 1.5.2 (using KDE Devel) Installed from: Compiled sources Compiler: g++ (GCC) 4.0.1 OS: Linux Java 1.5 allows annotations to be inserted into the code (these are not inside comments, see http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html). Importing the source of a class containing an annotation (such as "@Override") crashes Umbrello.
Created attachment 16030 [details] Example class causing crash on import
SVN commit 541373 by okellogg: parseStmt(): Skip annotations for now. TODO: Investigate how to forward them to the model. BUG:127160 M +1 -0 ChangeLog M +6 -0 umbrello/javaimport.cpp --- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #541372:541373 @@ -14,6 +14,7 @@ * Crash loading xmi file (125331, 126968) * User interaction with UMLWidget improvements (126391) * Comments are cut short when generating PHP code (126480) +* Crash on importing Java 1.5 classes containing annotations (127160) Version 1.5.2 --- branches/KDE/3.5/kdesdk/umbrello/umbrello/javaimport.cpp #541372:541373 @@ -259,6 +259,12 @@ skipStmt(); return true; } + if (keyword == "@") { // annotation + advance(); + if (m_source[m_srcIndex] == "(") + skipToClosing('('); + return true; + } if (keyword == "}") { if (m_scopeIndex) m_klass = dynamic_cast<UMLClassifier*>(m_scope[--m_scopeIndex]);
SVN commit 541374 by okellogg: parseStmt(): Skip normal annotations too. CCBUG:127160 M +3 -1 javaimport.cpp --- branches/KDE/3.5/kdesdk/umbrello/umbrello/javaimport.cpp #541373:541374 @@ -261,8 +261,10 @@ } if (keyword == "@") { // annotation advance(); - if (m_source[m_srcIndex] == "(") + if (m_source[m_srcIndex + 1] == "(") { + advance(); skipToClosing('('); + } return true; } if (keyword == "}") {