Bug 84739

Summary: umbrello design bug in advanced code generators
Product: [Applications] umbrello Reporter: Jozko Mrkvicka <kde>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal CC: adunstan, ajuc, ch.nolte, franke.daniel, greatbunzinni, g_greg, henrik.steffien, kaplun, krissn
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jozko Mrkvicka 2004-07-08 17:23:44 UTC
Version:           1.2.90 (using KDE 3.1.5)
Installed from:    Gentoo
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice)
OS:                Linux (i686) release 2.4.23

The umbrello in CVS ignores the CPP code generation settings. The code generator creates the document by codeGeneratorFactory.createObject but the settings are read only later by calling g->getPolicy()->setDefaults. I tried to fix the bug but i think that it's a design bug. The document should not be generated when the generator object is created through constructors, or else the document cannot be re-generated. Or the settings should be read earlier (when the constructor is called).

I came across this problem when I tried to disable the accessor generation in the config (which should be off by default because it just makes the members "public").

Joe
Comment 1 Oliver Kellogg 2004-07-08 21:45:04 UTC
*** Bug 81068 has been marked as a duplicate of this bug. ***
Comment 2 Oliver Kellogg 2004-07-08 21:47:35 UTC
Yes. I had given the related bug 81068 a shot but found that
the changes required are non trivial.
Comment 3 Oliver Kellogg 2005-01-15 17:32:51 UTC
Initial stab at removing the siamese twinnage between policy and generator

CVS commit by okellogg: 

Fix the fix.


  M +2 -0      uml.cpp   1.132
  M +1 -10     codegenerators/cppcodegenerationpolicy.cpp   1.13

CVS commit by okellogg: 

For architectural sanity, remove CodeGenerationPolicy classes' dependency on CodeGenerator classes.


  M +15 -4     codegenerationpolicy.cpp   1.11
  M +3 -6      codegenerationpolicy.h   1.8
  M +2 -2      codegenerator.cpp   1.64
  M +1 -1      uml.cpp   1.131
  M +35 -32    codegenerators/cppcodegenerationpolicy.cpp   1.12
  M +2 -14     codegenerators/cppcodegenerationpolicy.h   1.6
  M +15 -3     codegenerators/cppcodegenerationpolicypage.cpp   1.9
  M +1 -1      codegenerators/cppcodegenerator.cpp   1.30
  M +24 -29    codegenerators/javacodegenerationpolicy.cpp   1.10
  M +2 -14     codegenerators/javacodegenerationpolicy.h   1.6
  M +17 -5     codegenerators/javacodegenerationpolicypage.cpp   1.7
  M +3 -3      codegenerators/javacodegenerator.cpp   1.24
Comment 4 Oliver Kellogg 2005-01-16 23:04:26 UTC
*** Bug 97189 has been marked as a duplicate of this bug. ***
Comment 5 greatbunzinni 2006-04-29 20:44:06 UTC
I'm running Umbrello 1.5.2 and there are lots of options in the "code generation options" part of the "code generation wizard" dialog which are ignored. For example, the "comment verbosity" options are always on independent of the checkboxes state and the "Package is a namespace" option from "language options" is always off, independent of the checkbox state.
Comment 6 Oliver Kellogg 2006-04-30 11:42:35 UTC
SVN commit 535733 by okellogg:

Further preparations for merging CodeGenerationPolicy into CodeGenerator.
CCBUG:84739


 M  +87 -38    codegenerationpolicy.cpp  
 M  +44 -16    codegenerationpolicy.h  
 M  +2 -3      codegenerator.cpp  
 M  +2 -1      codegenerator.h  
 M  +7 -25     codegenerators/cppcodegenerationpolicy.cpp  
 M  +1 -14     codegenerators/cppcodegenerationpolicy.h  
 M  +9 -31     codegenerators/javacodegenerationpolicy.cpp  
 M  +1 -19     codegenerators/javacodegenerationpolicy.h  
 M  +2 -2      codegenerators/perlwriter.cpp  
 M  +6 -31     codegenerators/rubycodegenerationpolicy.cpp  
 M  +0 -21     codegenerators/rubycodegenerationpolicy.h  
 M  +9 -15     codegenerators/simplecodegenerator.cpp  
 M  +3 -10     codegenerators/simplecodegenerator.h  
Comment 7 Oliver Kellogg 2006-05-01 13:25:54 UTC
SVN commit 536092 by okellogg:

Further preparations for merging CodeGenerationPolicy into CodeGenerator
CCBUG:84739


 M  +2 -2      codeblock.h  
 M  +2 -2      codeclassfield.h  
 M  +3 -2      codeclassfielddeclarationblock.h  
 M  +7 -24     codedocument.cpp  
 M  +2 -12     codedocument.h  
 M  +7 -8      codegenerators/codegenfactory.cpp  
 M  +5 -6      codegenerators/codegenfactory.h  
 M  +14 -11    codegenerators/cppcodedocumentation.cpp  
 M  +3 -2      codegenerators/cppheadercodedocument.cpp  
 M  +3 -2      codegenerators/javacodeaccessormethod.cpp  
 M  +5 -2      codegenerators/javacodeclassfielddeclarationblock.cpp  
 M  +4 -1      codegenerators/rubycodeaccessormethod.cpp  
 M  +5 -7      codegenerators/rubycodeclassfielddeclarationblock.cpp  
 M  +6 -3      textblock.cpp  
 M  +23 -22    uml.cpp  
 M  +11 -2     uml.h  
 M  +9 -0      umldoc.cpp  
Comment 8 Oliver Kellogg 2006-05-02 22:17:50 UTC
I managed to fix the problem - not by merging CodeGenerationPolicy into
CodeGenerator but by turning it into a standalone class (of which no
other classes inherit) that only deals with the programming language
independent policies (newlineEndingChars etc.)
The {Cpp,Java,Ruby}CodeGenerationPolicy classes now inherit from a
new interface class, CodeGenPolicyExt, which has just a few pure virtual
methods and no state.
However I will have to wait with committing this large changeset because of
the KDE 3.5.3 tag freeze. (I.e. unfortunately the fix isn't making it into
Umbrello-1.5.3)
Comment 9 Oliver Kellogg 2006-05-18 22:51:02 UTC
I was a bit too optimistic - work on this problem has revealed
more and deeper problems.
For the Umbrello-1.5.3 release, I recommend deselecting the
"Use new code generators" option in the General Settings menu
(except if you're adventurous and want to help solve these issues.)
Comment 10 Oliver Kellogg 2006-07-07 12:28:29 UTC
*** Bug 130067 has been marked as a duplicate of this bug. ***
Comment 11 Oliver Kellogg 2006-07-14 08:14:39 UTC
*** Bug 130471 has been marked as a duplicate of this bug. ***
Comment 12 Oliver Kellogg 2006-07-14 08:15:13 UTC
*** Bug 130530 has been marked as a duplicate of this bug. ***
Comment 13 Oliver Kellogg 2006-07-14 08:27:59 UTC
*** Bug 130720 has been marked as a duplicate of this bug. ***
Comment 14 Oliver Kellogg 2006-07-16 15:24:08 UTC
SVN commit 563016 by okellogg:

Disabling newcodegen for the time being to avoid a slew of
redundant bug reports. Notes to assignee of #84739:
1) To work on the bug, #define the symbol BUG84739_FIXED.
2) Make sure all PRs marked duplicate of #84739 pass.
CCBUG:84739


 M  +3 -0      dialogs/settingsdlg.cpp  
 M  +4 -0      uml.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/settingsdlg.cpp #563015:563016
@@ -115,6 +115,9 @@
 
     m_GeneralWidgets.newcodegenCB = new QCheckBox( i18n("Use new C++/Java/Ruby generators"), m_GeneralWidgets.miscGB );
     m_GeneralWidgets.newcodegenCB -> setChecked( m_pOptionState->generalState.newcodegen );
+#ifndef BUG84739_FIXED
+    m_GeneralWidgets.newcodegenCB->setEnabled(false);
+#endif
     miscLayout -> addWidget( m_GeneralWidgets.newcodegenCB, 1, 0 );
 
     m_GeneralWidgets.angularLinesCB = new QCheckBox( i18n("Use angular association lines"), m_GeneralWidgets.miscGB );
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #563015:563016
@@ -1077,7 +1077,11 @@
             false
 #endif
                                                                       );
+#if defined (BUG84739_FIXED)
     m_optionState.generalState.newcodegen = m_config -> readBoolEntry("newcodegen", false);
+#else
+    m_optionState.generalState.newcodegen = false;
+#endif
     m_optionState.generalState.angularlines = m_config->readBoolEntry("angularlines", false);
     m_optionState.generalState.autosave = m_config -> readBoolEntry( "autosave", true );
     m_optionState.generalState.time = m_config -> readNumEntry( "time", 0 ); //old autosavetime value kept for compatibility
Comment 15 Oliver Kellogg 2006-07-30 00:14:51 UTC
*** Bug 131528 has been marked as a duplicate of this bug. ***
Comment 16 Oliver Kellogg 2006-08-05 11:04:38 UTC
*** Bug 131866 has been marked as a duplicate of this bug. ***
Comment 17 Oliver Kellogg 2006-09-17 12:03:20 UTC
*** Bug 133911 has been marked as a duplicate of this bug. ***
Comment 18 Oliver Kellogg 2006-10-05 19:36:31 UTC
*** Bug 135154 has been marked as a duplicate of this bug. ***
Comment 19 Oliver Kellogg 2007-03-20 23:17:13 UTC
SVN commit 644781 by okellogg:

It looks as though the bug fixed by commit 644749 may have been causing the
problems with the advanced code generators, too.
I'm experimentally lifting the BUG84739 barrier.
If you feel adventurous and want to help improving Umbrello then go to the
Setting->Configure Umbrello menu and enable "Use new C++/Java/Ruby generators".
Is the advanced-codegen configuration back to stable?  Please send reports to
CCBUG:84739


 M  +0 -3      dialogs/settingsdlg.cpp  
 M  +0 -4      uml.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/settingsdlg.cpp #644780:644781
@@ -115,9 +115,6 @@
 
     m_GeneralWidgets.newcodegenCB = new QCheckBox( i18n("Use new C++/Java/Ruby generators"), m_GeneralWidgets.miscGB );
     m_GeneralWidgets.newcodegenCB -> setChecked( m_pOptionState->generalState.newcodegen );
-#ifndef BUG84739_FIXED
-    m_GeneralWidgets.newcodegenCB->setEnabled(false);
-#endif
     miscLayout -> addWidget( m_GeneralWidgets.newcodegenCB, 1, 0 );
 
     m_GeneralWidgets.angularLinesCB = new QCheckBox( i18n("Use angular association lines"), m_GeneralWidgets.miscGB );
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #644780:644781
@@ -1097,11 +1097,7 @@
     Settings::OptionState& optionState = Settings::getOptionState();
     optionState.generalState.undo = m_config -> readBoolEntry( "undo", true );
     optionState.generalState.tabdiagrams = m_config -> readBoolEntry("tabdiagrams", false);
-#if defined (BUG84739_FIXED)
     optionState.generalState.newcodegen = m_config -> readBoolEntry("newcodegen", false);
-#else
-    optionState.generalState.newcodegen = false;
-#endif
     optionState.generalState.angularlines = m_config->readBoolEntry("angularlines", false);
     optionState.generalState.autosave = m_config -> readBoolEntry( "autosave", true );
     optionState.generalState.time = m_config -> readNumEntry( "time", 0 ); //old autosavetime value kept for compatibility
Comment 20 Oliver Kellogg 2007-03-21 06:57:10 UTC
Fixed by commit 644749.