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 102345

Summary: GoF: incorrect default relation names or default values
Product: uml Reporter: Sergey Petrov <sj-nb>
Component: Design CenterAssignee: issues@uml <issues>
Status: NEW ---    
Severity: blocker    
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: uml project with all GOF design patterns applied

Description Sergey Petrov 2007-04-24 15:38:01 UTC
navigable and and Part ends aren't named but aggregate and association ends are
names in some patterns. It may looks good on diagrams because label are often
located at links center but this issue affect code generation, i.e. attributes
specification isn't complete and also model isn't correct.

patterns:
1) GoF-Chain Of Responsibility
association: Handler-Handler

I can add all similar problems to this bug or file separate issues, just one
pattern is here for now.
Comment 1 Sergey Petrov 2007-04-24 15:38:46 UTC
see also Issue 98020
Comment 2 Andrew Korostelev 2007-05-16 01:56:21 UTC
There are 33 same problems in DP.
The following error message from java compiler gives enough data to understand
what should be fixed in UML.
Message was received on attempt to compile code generated for default design
patterns added into UML project.

Creational\AbstractFactory\Client.java:7: <identifier> expected
    private AbstractFactory ;
Creational\Prototype\Client.java:7: <identifier> expected
    private Prototype ;
Structural\Adapter\Adapter.java:7: <identifier> expected
    private Adaptee ;
Structural\Adapter\Client.java:7: <identifier> expected
    private Target ;
Structural\Bridge\Abstraction.java:7: <identifier> expected
    public static final Implementor ;
Structural\Bridge\Abstraction.java:7: = expected
    public static final Implementor ;
Structural\Composite\Client.java:6: <identifier> expected
    private Component ;
Structural\Composite\Composite.java:7: <identifier> expected
    private Component ;
Structural\Decorator\Decorator.java:7: <identifier> expected
    public static final Component ;
Structural\Decorator\Decorator.java:7: = expected
    public static final Component ;
Structural\Facade\Facade.java:7: <identifier> expected
    private Subsystem ;
Structural\Flyweight\Client.java:7: <identifier> expected
    private FlyweightFactory ;
Structural\Flyweight\FlyweightFactory.java:7: <identifier> expected
    private Flyweight ;
Structural\Proxy\Proxy.java:7: <identifier> expected
    private RealSubject ;
behavioral\ChainOfResponsibility\Client.java:7: <identifier> expected
    private Handler ;
behavioral\ChainOfResponsibility\Handler.java:7: = expected
    private Handler successor;
behavioral\Command\Client.java:7: <identifier> expected
    private Receiver ;
behavioral\Command\Invoker.java:7: <identifier> expected
    private Command ;
behavioral\Interpreter\Client.java:7: <identifier> expected
    private AbstractExpression ;
behavioral\Interpreter\NonterminalExpression.java:7: <identifier> expected
    private AbstractExpression ;
behavioral\Iterator\ConcreteIterator.java:4: <identifier> expected
import Behavioral.boolean;
behavioral\Iterator\ConcreteIterator.java:9: <identifier> expected
    private ConcreteAggregate ;
behavioral\Iterator\Iterator.java:3: <identifier> expected
import Behavioral.boolean;
behavioral\Iterator\Iterator.java:6: <identifier> expected
import Behavioral.boolean;
behavioral\Mediator\Colleague.java:7: <identifier> expected
    public static final Mediator ;
behavioral\Mediator\Colleague.java:7: = expected
    public static final Mediator ;
behavioral\Mediator\ConcreteMediator.java:7: <identifier> expected
    private ConcreteColleague ;
behavioral\Memento\Caretaker.java:7: <identifier> expected
    private Memento ;
behavioral\Observer\ConcreteObserver.java:7: <identifier> expected
    private ConcreteSubject ;
behavioral\Observer\Subject.java:7: = expected
    public static final Observer observers;
behavioral\State\Context.java:7: <identifier> expected
    private State ;
behavioral\Strategy\Context.java:7: <identifier> expected
    private Strategy ;
behavioral\Visitor\ObjectStructure.java:7: <identifier> expected
    private Element ;
Comment 3 Andrew Korostelev 2007-05-16 01:58:13 UTC
Created attachment 42440 [details]
uml project with all GOF design patterns applied
Comment 4 Yang Su 2007-09-13 00:35:55 UTC
I tend to think that this is nothing specific to design pattern library, but rather a generic issue that is better
handled at CG phase. 

Whether or not to set end name is user's preference (Options -> UML -> Java Code Generation / Miscellaneous), even
though a navigable association end is not named its corresponding source attribute name should be created with default
value, e.g "val" instead of blank which results in broken Java source.

Re-categorize it to code generation sub component for evaluation.
Comment 5 Viktor Lapitski 2007-09-14 06:59:32 UTC
In my view an attempt to generate code with unnamed part end still looks like 
a user error, and the bundled patterns should still be corrected to have 
names placed correctly at part ends.  

On the other side, i've implemented the auto-generation of attribute name 
during GC, and this makes the problem less acute/urgent.