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

review: fix: prevent renaming CtRootPackage #1523

Merged
merged 6 commits into from
Sep 19, 2017

Conversation

surli
Copy link
Collaborator

@surli surli commented Sep 7, 2017

Fix #1522

@surli
Copy link
Collaborator Author

surli commented Sep 11, 2017

This bug occured because CtRootPackage is renamed: IMHO this package should never be renamed, and trying to rename it should throw an exception, WDYT @monperrus @pvojtechovsky ?

@pvojtechovsky
Copy link
Collaborator

This bug occured because CtRootPackage is renamed: IMHO this package should never be renamed, and trying to rename it should throw an exception

I agree, that call of setSimpleName on root package should fail with exception. May be root package might silently ignore call of setSimpleName(null) and setSimpleName("")

@monperrus
Copy link
Collaborator

monperrus commented Sep 11, 2017 via email

@surli surli changed the title Try to reproduce issue in #1522 review: fix: prevent renaming CtRootPackage Sep 12, 2017
*/
public class ElementProcessor extends AbstractProcessor<CtElement> {
public void process(CtElement element) {
if(element instanceof CtPackage && element != getFactory().Package().getRootPackage()){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a confusion, the goal is that client code indeed never has to write this.

so the implementation RootPackage.setSimpleName would simply be ... empty.

do you see what I mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you see what I mean?

Yes, I just kept going on my initial idea. I'll change that.

@monperrus monperrus merged commit 4107133 into INRIA:master Sep 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants