Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialized multivalued variables fail to generate variables and initialization #1376

Closed
TimLethbridge opened this issue Sep 25, 2018 · 3 comments
Assignees
Labels
attributes bug Crashes or wrong results Component-SemanticsAndGen Related to code generators in general and the meaning of Umple models Diffic-Med A non-trivial problem that may take over a week or may not be obvious how to fix or require analysis Priority-High This problem or enhancement is likely to be highly visible and or impactful of users

Comments

@TimLethbridge
Copy link
Member

emails and incoming number are not initialized as variables in the following, however the get and other methods appear, and the attributes appear in diagrams

class Office {
   Integer number;
   String[] emails = {"abc@umple.org", "def@umple.org"}
   Integer [] incomingNumber = {765432, 987654}
} 

Regular multivalued attributes (without initialization) seem OK.

@TimLethbridge TimLethbridge added bug Crashes or wrong results Priority-High This problem or enhancement is likely to be highly visible and or impactful of users Component-SemanticsAndGen Related to code generators in general and the meaning of Umple models Diffic-Med A non-trivial problem that may take over a week or may not be obvious how to fix or require analysis attributes labels Sep 25, 2018
@TimLethbridge
Copy link
Member Author

But if a semicolon is added to the end it works. It should either generate and error in all cases or work without the semicolon in all cases.

@TimLethbridge
Copy link
Member Author

In in the following example we have an attempt to initialize a derived attribute that also has a 'List'. This should create an error message saying:

If you have intended to specify a derived attribute there should not be a list indicator []. If you intended to create list initializer, there should be a semicolon on the end.

class X {
  
  String firstName;
  String lastName;
  
  String [] fullName = {firstName+" "+lastName}
}

@TimLethbridge
Copy link
Member Author

TimLethbridge commented Jan 22, 2019

You need to look in UmpleInternalParser_CodeClass.ump analyzeAttribute() starts on line 4315
You will need to ensure that new error 83 is only produced in the spefic casae where we have a 'List' with code as above (i.e. no semicolon).

You will have to add a test in UmpleParserTest.java just after the test for message 81 about line 3042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attributes bug Crashes or wrong results Component-SemanticsAndGen Related to code generators in general and the meaning of Umple models Diffic-Med A non-trivial problem that may take over a week or may not be obvious how to fix or require analysis Priority-High This problem or enhancement is likely to be highly visible and or impactful of users
Projects
None yet
Development

No branches or pull requests

2 participants