Bug 59190 - static variables in java code are not marked static
Summary: static variables in java code are not marked static
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.1.1
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-31 23:24 UTC by Moritz Uhlig
Modified: 2006-03-20 18:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Uhlig 2003-05-31 23:24:35 UTC
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.
Comment 1 Sebastian Stein 2003-06-16 10:35:45 UTC
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
Comment 2 Walter Weber-Groß 2006-03-20 13:33:35 UTC
Static operations (methods) are not marked as static (public static void main(String arg[]), e.g.)
Comment 3 Oliver Kellogg 2006-03-20 18:17:35 UTC
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 ;)
Comment 4 Oliver Kellogg 2006-03-20 18:43:58 UTC
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();