Bug 59049 - getters/setters are private in generated java sources
Summary: getters/setters are private in generated java sources
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-27 20:00 UTC by noster
Modified: 2007-02-13 19:55 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 noster 2003-05-27 20:00:34 UTC
Version:           1.2-alpha  (using KDE KDE 3.1.2)
Installed from:    Debian stable Packages
Compiler:          gcc version 2.95.4 20011002 (Debian prerelease)
OS:          Linux

the modifiers for automatically created getters and setters in generated code are the same as the modifiers for the attributes where they should be public.
Comment 1 Brian Thomas 2003-12-01 21:42:26 UTC
I believe that this has been fixed. You can now choose to set the get/set accessor method scope (visibility) according to a fixed choice, or the parent attribute/role visibility.
Comment 2 Sebastian Stein 2003-12-02 10:06:34 UTC
fixed by Brian Thomas some time ago
Comment 3 Dave Jernigan 2007-02-13 19:53:25 UTC
If it is possible to differentiate the accessor method scope from the attribute scope, I don't see a way to indicate this in the interface.

To be truly useful for Java code generation, here are the rules:

- if scope is private, create a private field with *no* accessors.
- if scope is public, create a *private* field with *public*-scope accessors.

// Fields
  private int myPrivateAttribute;
  private int myPublicAttribute;

...

// Accessor methods

// There should be no accessors for myPrivateAttribute!

  /**
   * Set the value of myPublicAttribute
   * @param newVar the new value of myPublicAttribute
   */
  private void setMyPublicAttribute ( int newVar ) {
    myPublicAttribute = newVar;
  }

  /**
   * Get the value of myPublicAttribute
   * @return the value of myPublicAttribute
   */
  private int getMyPublicAttribute ( ) {
    return myPublicAttribute;
  }
Comment 4 Dave Jernigan 2007-02-13 19:55:03 UTC
Aargh! now my comments have the bug:

accessors should be:

  /** 
    * Set the value of myPublicAttribute 
    * @param newVar the new value of myPublicAttribute 
    */ 
   public void setMyPublicAttribute ( int newVar ) { 
     myPublicAttribute = newVar; 
   } 
 
   /** 
    * Get the value of myPublicAttribute 
    * @return the value of myPublicAttribute 
    */ 
   public int getMyPublicAttribute ( ) { 
     return myPublicAttribute; 
   }