Bug 537297 - Validation constraint generation fails if symmetric attribute is set
Summary: Validation constraint generation fails if symmetric attribute is set
Status: RESOLVED FIXED
Alias: None
Product: Viatra
Classification: Modeling
Component: Addons (show other bugs)
Version: 2.0.1   Edit
Hardware: Macintosh Mac OS X
: P3 major
Target Milestone: 2.0.2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-23 11:05 EDT by Zoltan Ujhelyi CLA
Modified: 2018-08-10 10:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Ujhelyi CLA 2018-07-23 11:05:41 EDT
When the symmetric attribute is set for a constraint, the resulting generated constraint class is with a compile error. E.g., the following pattern

@Constraint(key = {hi1, hi2}, message = "Duplicate identifier $hi1.identifier$", severity = "error", symmetric = {hi1, hi2})
pattern nonUniqueInstanceIdentifiers(hi1 : HostInstance, hi2: HostInstance) {
    HostInstance.identifier(hi1, name);
    HostInstance.identifier(hi2, name);
}

generates the following key names method

    @Override
    public Set<List<String>> getSymmetricKeyNames() {
        Set<List<String>> symmetricKeyNamesSet = new HashSet<>(
            Arrays.asList(
            "hi1",
            "hi2"
            )
        );
        return symmetricKeyNamesSet;
    }
    
 This results in a compile error, as the HashSet constructor returns a set of strings instead a set of string lists.
Comment 1 Eclipse Genie CLA 2018-07-23 12:19:19 EDT
New Gerrit change created: https://git.eclipse.org/r/126497
Comment 3 Eclipse Genie CLA 2018-07-30 06:07:53 EDT
New Gerrit change created: https://git.eclipse.org/r/126762
Comment 5 Zoltan Ujhelyi CLA 2018-07-30 10:06:57 EDT
Fixed in master and backported to 2.0-maintenance.
Comment 6 Eclipse Genie CLA 2018-08-09 10:07:22 EDT
New Gerrit change created: https://git.eclipse.org/r/127248