-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
Conversation
This bug occured because |
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("") |
May be root package might silently ignore call of setSimpleName(null) and setSimpleName("")
I like this idea, from the viewpoint of client code, this would be better (no additional check to write)
|
*/ | ||
public class ElementProcessor extends AbstractProcessor<CtElement> { | ||
public void process(CtElement element) { | ||
if(element instanceof CtPackage && element != getFactory().Package().getRootPackage()){ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Fix #1522