Bug 481749 - Constructor generation not working
Summary: Constructor generation not working
Status: UNCONFIRMED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: UMLGen (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 8
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stephane Begaudeau CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-09 12:27 EST by Víctor López CLA
Modified: 2021-03-04 15:13 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Víctor López CLA 2015-11-09 12:27:08 EST
Hi,

I would say there is an error in the code to generate the constructors:

[template private constructor(aClass : Class)]
[if (ownedOperation->select(anOperation : Operation | anOperation.name.equalsIgnoreCase(aClass.name))->size() = 0)]
/**
 * The constructor.
 */
public [aClass.genName()/]() {
    // [protected ('constructor for ' + aClass.name + ')')]
    super();
    // [/protected]
}
[for (aConstructor : Operation | ownedOperation->select(anOperation : Operation | anOperation.name.equalsIgnoreCase(aClass.name)))]
/**
 * The constructor.
[for (aParameter : Parameter | aConstructor.ownedParameter)]
 * @param [aParameter.genName()/][aParameter.genComment()/]
[/for]
 */
[aConstructor.genVisibility()/][aConstructor.genName()/]([aConstructor.genOperationParameters()/]) {
    // [protected ('constructor with ' + aConstructor.ownedParameter.genName()->sep(', ') + ' for ' + aClass.name + ')')]
    super();
    // [/protected]
}
[/for]
[/if]
[/template]

The template can be easily fixed:

[template private constructor(aClass : Class)]
[if (ownedOperation->select(anOperation : Operation | anOperation.name.equalsIgnoreCase(aClass.name))->size() = 0)]
/**
 * The constructor.
 */
public [aClass.genName()/]() {
    // [protected ('constructor for ' + aClass.name + ')')]
    super();
    // [/protected]
}
[/if]

[for (aConstructor : Operation | ownedOperation->select(anOperation : Operation | anOperation.name.equalsIgnoreCase(aClass.name)))]
/**
 * The constructor.
[for (aParameter : Parameter | aConstructor.ownedParameter)]
 * @param [aParameter.genName()/][aParameter.genComment()/]
[/for]
 */
[aConstructor.genVisibility()/][aConstructor.genName()/]([aConstructor.genOperationParameters()/]) {
    // [protected ('constructor with ' + aConstructor.ownedParameter.genName()->sep(', ') + ' for ' + aClass.name + ')')]
    super();
    // [/protected]
}
[/for]

[/template]

  best,

 Víctor López