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

Missing validation for duplicate name #1841

Closed
joeseibel opened this issue Jun 14, 2019 · 0 comments
Closed

Missing validation for duplicate name #1841

joeseibel opened this issue Jun 14, 2019 · 0 comments

Comments

@joeseibel
Copy link
Contributor

@joeseibel joeseibel commented Jun 14, 2019

If a classifier member has the same name as an inherited member, an error is not reported when also inheriting an unnamed mode transition. The following model should produce an error, but it doesn't:

package duplicate_name
public
  system s
    features
      e: in event port;
    modes
      m1: initial mode;
      m2: mode;
      m1 -[e]-> m2;
  end s;

  system implementation s.i1
    subcomponents
      sub: abstract;
  end s.i1;

  system implementation s.i2 extends s.i1
    subcomponents
      sub: system;
  end s.i2;
end duplicate_name;

Giving the mode transition a name will cause an error to be reported on sub in s.i2. The problem is that the validator assumes that all NamedElements have a non-null name. This results in a NullPointerException which aborts that validation. A null check needs to be added here:

&& ((NamedElement) ownedElement).getName().equalsIgnoreCase(ne.getName())) {

@joeseibel joeseibel self-assigned this Jun 14, 2019
@lwrage lwrage added this to the 2.6.0 milestone Aug 13, 2019
joeseibel added a commit that referenced this issue Aug 14, 2019
@lwrage lwrage closed this in #1948 Aug 15, 2019
@lwrage lwrage added the core label Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants