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

What happens when the user defines a class which extends a capsule template? #154

Open
dwtj opened this issue Sep 25, 2016 · 2 comments
Open

Comments

@dwtj
Copy link
Collaborator

dwtj commented Sep 25, 2016

Right now, I don't really know the implications. It seems like any consequences would be benign unless the user somehow modified the capsule system topology using such a capsule.

Should we implement a check to prevent this? I'm pretty sure that it would be straightforward to implement.

@jlmaddox
Copy link
Collaborator

jlmaddox commented Sep 26, 2016

It may be worth it to implement it, since any extenders make the annotations in the template become meaningless to the derived class. An alternative is that we could require the templates to be final classes instead to indicate this explicitly. The same could apply for many of the generated classes such as Console$Thread, which probably shouldn't be extended.

@dwtj
Copy link
Collaborator Author

dwtj commented Oct 3, 2016

Though I like the idea of using final on user-defined templates because it makes the Java compiler do the check for us. But I see three problems with requiring the user to use final:

  1. It adds extra syntax.
  2. It adds an additional rule that the user needs to know about right away and to use every time.
  3. To enforce the use of final we would need to write and maintain another static check. If we are doing so, why not just write a check that looks for subtypes.

But I agree 100% with your idea to mark generated artifacts as final.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants