Bug 131006 - java import - random import order can result in interface being teated as class
Summary: java import - random import order can result in interface being teated as class
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Slackware Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-18 02:55 UTC by JP Fournier
Modified: 2006-07-18 07:05 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 JP Fournier 2006-07-18 02:55:06 UTC
Version:           svn - 563616 (using KDE KDE 3.5.0)
Installed from:    Slackware Packages
Compiler:          gcc 3.4.4 
OS:                Linux

steps to reproduce:
- import the class Int3 first
- then import Int1

results:
- Int1 is treated as a class and not an interface

---------------
package test;


public interface Int3{


	public void update(Int1 value);

}

-------------------

package test;


public interface Int1{


	public void update();

}
Comment 1 JP Fournier 2006-07-18 02:59:41 UTC
The patch below seems to fix this bug:

diff -c svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp kdesdk/umbrello/umbrello/codeimport/javaimport.cpp
*** svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp      2006-07-17 20:35:57.000000000 -0400
--- kdesdk/umbrello/umbrello/codeimport/javaimport.cpp  2006-07-17 20:55:51.000000000 -0400
***************
*** 156,161 ****
--- 156,164 ----
          m_klass->setAbstract(m_isAbstract);
          m_klass->setStatic(m_isStatic);
          m_klass->setVisibility(m_currentAccess);
+         // the UMLObject found by createUMLObject might originally have been created as a placeholder
+         // with a type of class but if is really an interface, then we need to change it
+         m_klass->setInterface( keyword == "interface" );
          m_isAbstract = m_isStatic = false;
          if (advance() == ";")   // forward declaration
              return true;
Comment 2 Oliver Kellogg 2006-07-18 07:05:54 UTC
SVN commit 563652 by okellogg:

parseStmt(): The UMLObject found by createUMLObject might originally have been
created as a placeholder with a type of ot_Class but if is really an interface,
then we need to change it. Thanks to JP Fournier for the fix.
BUG:131006


 M  +1 -0      ChangeLog  
 M  +4 -0      umbrello/codeimport/javaimport.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #563651:563652
@@ -12,6 +12,7 @@
 * Java import: method and class visibility ignored (130794)
 * Java import - static not handled correctly (130926)
 * Java import - package visibility incorrectly represented (130932)
+* Java import - random import order can result in interface being teated as class (131006)
 
 Version 1.5.3
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #563651:563652
@@ -156,6 +156,10 @@
         m_klass->setAbstract(m_isAbstract);
         m_klass->setStatic(m_isStatic);
         m_klass->setVisibility(m_currentAccess);
+        // The UMLObject found by createUMLObject might originally have been created as a
+        // placeholder with a type of class but if is really an interface, then we need to
+        // change it.
+        m_klass->setInterface(keyword == "interface");
         m_isAbstract = m_isStatic = false;
         if (advance() == ";")   // forward declaration
             return true;