This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 106213 - Prefix for Member Attributes not added to generated code from UML
Summary: Prefix for Member Attributes not added to generated code from UML
Status: NEW
Alias: None
Product: uml
Classification: Unclassified
Component: Code Generation (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@uml
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-10 00:21 UTC by bernie
Modified: 2007-06-18 16:40 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bernie 2007-06-10 00:21:34 UTC
Hi,

I have just had a look at the UML tools in the preview of Version6 M9, and it looks great.
I don't know if I should be raising a bug against a this release, but I noticed that the prefix
character I chose for member attributes ("_") was not added to the generated code.

I think this is a useful feature, since I like to add an underscore to private attributes.

Many thanks

Bernie
Comment 1 Peter Lam 2007-06-11 23:12:01 UTC
I'm unable to reproduce the issue. My generated codes always included "_" when I
used it as prefix to name my member attributes. I have tried on both Windows XP
and Linux platforms. 
Could you please provide more detail and steps to reproduce this problem and the
platform you see the problem on.
Comment 2 bernie 2007-06-12 00:42:49 UTC
Thanks for the response

My OS is Mac (Intel) v10.4.9

Info from Netbeans About:

NetBeans IDE 6.0 Preview (M9, build 070502)
1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
Mac OS X version 10.4.9 running on i386
en_US (nb); MacRoman

UML module versions are 1.2.0

In Advanced Options:
Prefix for Member Attributes => _
Remove Prefix for Accessor Name => Yes

Choose New Project Java-Platform Model
Accept default Name location
Creae class diagram

Create class test , add two attributes via diagram gui
   private int test1
   private int _test2  (wasn't sure if you are supposed to add them, or only generated in code, so did 
both)

The following operators are created
  public in getTest1()
  public void setTest1(int val)
  public int get_test2()
  public void set_test2(int val)

Right clicked class in projects view, and selected generate code...
Then Navigate to Source, get


public class Test {

    private int test1;

    private int _test2;

    public Test () {
    }

    public int get_test2 () {
        return _test2;
    }

    public void set_test2 (int val) {
        this._test2 = val;
    }

    public int getTest1 () {
        return test1;
    }

    public void setTest1 (int val) {
        this.test1 = val;
    }

}

Let me know if these is any more info I can get you. I know in Eclipse, there is a PDE log for the plugins.
Is there an equivalent log in Netbeans? Did not seen any no entry icon in status bar, so presume
this was OK.

Cheers

Bernie

 
Comment 3 bernie 2007-06-12 00:47:44 UTC
By the way, on a seperate point, I was trying a few things out, and noticed that if I have two classes,
with a linking association class, the association class is not generated - is that correct? Can it be
implemented in multiple ways (ie attributes in one of the classes) ?

Cheers

Bernie
Comment 4 Peter Lam 2007-06-13 08:14:26 UTC
Thanks for providing the additional detail. I now understand the issue and can reproduce it. Looks like it's a bug that
setting the prefix has no effect. It's also related to issue 84291 for option "Remove Prefix from Accessor Names".

> Is there an equivalent log in Netbeans? 
You can find the default ide log file from the following.
{user-homedir}/.netbeans/6.0m9/var/log/messages.log

As for association class, there's no code generated for it and it's by design. Currently there's an enhancement request
for this. It's issue 92806.
Comment 5 Andrew Korostelev 2007-06-18 16:40:49 UTC
In current uml version 
'Prefix for Member Attributes' is a prefix used for names of auto-named attributes created as navigable association link.
Add such link from class to class - you will see that attr is named as prefix+target class name.

Remove Prefix for Accessor Name - for attr created as nav. assoc. link accessors will be generated without this prefix.

This means that functionality that is useful for bernie doesn't exist now.
request is:
if attr created by user has prefix specified in special option (similar to 'Prefix for Member Attributes'),
remove this prefix from accessors.