[Uml-devel] bug + patch - java import hang : static block containing code

JP Fournier jfournier121 at rogers.com
Sat Aug 5 14:09:17 UTC 2006


Hi,

I tried submitting a bug report, but the bug system choked
searching for related bugs.

Umbrello 1.5.4 svn hangs when I try to import the class below.  It gets 
confused
on the code block within a static block:


package pack1;

public class PackStatic {
    private static int count;

    static {

        for (int counter=0; counter < 7; counter ++ ) {
            count+=counter;
        }
    }

    PackStatic() {

    }

    private int getInt() {
        return 7;
    }

}

This patch fixes this problem:

$ diff -c svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp 
kdesdk/umbrello/umbrello/codeimport/javaimport.cpp
*** svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp      
2006-08-05 09:52:05.000000000 -0400
--- kdesdk/umbrello/umbrello/codeimport/javaimport.cpp  2006-08-05 
09:53:10.000000000 -0400
***************
*** 375,380 ****
--- 375,386 ----
          m_isStatic = true;
          return true;
      }
+     // if we detected static previously and keyword is { then this is 
a static block
+     if ( m_isStatic && keyword == "{") {
+         //reset static flag and jump to end of static block
+         m_isStatic = false;
+         return skipToClosing('{');
+     }
      if (keyword == "abstract") {
          m_isAbstract = true;
          return true;


regards

jp













More information about the umbrello-devel mailing list