Version: 1.1.1 (using KDE KDE 3.1.2) Installed from: Gentoo Packages Compiler: gcc 3.2.2 OS: Linux When creating java classes with static members, they are not marked as static in the source code.
Subject: Re: [Uml-devel] New: static variables in java code are not marked static Moritz Uhlig <moritz.uhlig@jsolution.de> [030601 19:32]: > When creating java classes with static members, they are not marked as > static in the source code. Fix is now in CVS. Steinchen
Static operations (methods) are not marked as static (public static void main(String arg[]), e.g.)
Ouch! For the old Java generator, I get staticpublic void staticOp( ) while for the new Java generator, I get public staticOp ( ) It's beastkill time ;)
SVN commit 520749 by okellogg: Restore code generation for static methods in the old and new generator. Emit "void" for an unspecified return type in the new generator. BUG:59190 M +1 -0 ChangeLog M +2 -0 umbrello/codegenerators/javacodegenerator.cpp M +4 -2 umbrello/codegenerators/javacodeoperation.cpp M +1 -1 umbrello/codegenerators/javawriter.cpp --- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #520748:520749 @@ -1,6 +1,7 @@ Version 1.5.3 * Bugs/wishes from http://bugs.kde.org: +* Static variables in java code are not marked static (5591190) * Save autosave file to a more obvious place (72019) Version 1.5.2 --- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/javacodegenerator.cpp #520748:520749 @@ -142,6 +142,8 @@ // Same thing again for "bool" to "boolean" QString JavaCodeGenerator::fixTypeName(QString string) { + if (string.isEmpty() || string.contains(QRegExp("^\\s+$"))) + return "void"; string.replace(QRegExp("^string$"),"String"); string.replace(QRegExp("^bool$"),"boolean"); return cleanName(string); --- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/javacodeoperation.cpp #520748:520749 @@ -66,9 +66,11 @@ if (paramNum != nrofParam ) paramStr += ", "; } + QString maybeStatic; + if (o->getStatic()) + maybeStatic = "static "; + QString startText = strVis + " " + maybeStatic + returnType + methodName + " (" + paramStr + ")"; - QString startText = strVis + " "+ returnType + methodName + " ( "+paramStr+")"; - // IF the parent is an interface, our operations look different // e.g. they have no body if(isInterface) { --- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/javawriter.cpp #520748:520749 @@ -738,8 +738,8 @@ str = ""; // reset for next method str += ((op->getAbstract() || isInterface) ? "abstract ":""); - str += (op->getStatic() ? "static":""); str += scopeToJavaDecl(op->getVisibility()) + " "; + str += (op->getStatic() ? "static ":""); str += methodReturnType + " " +cleanName(op->getName()) + "( "; atl = op->getParmList();