-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Proposed fix : Disallow replacing nodes with themselves #1844
Conversation
And add a test for this edge case closes jhy#1843
Thanks for this correction 💯 |
@FanJups My apologies, I typed the wrong issue number - this is unrelated to your problem of self closing tags. Sorry for getting your hopes up lol |
all right lol |
* @param message Error message to use if the objects are the same | ||
* @throws IllegalArgumentException if the objects are the same | ||
*/ | ||
public static void notStrictlyEqual(Object a, Object b, String message) { |
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.
Personally, I would call this method something like "NotSameObject". To make it clearer that it's an identity check.
Thanks for the PR and the bug report. I think that it would be better to make this a no-op vs a validation error. It follows closer to the developer's intent (whatever that was) and is not surprising. I.e., if And then the new validator is not required either. |
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.
As noted inline -- would be better if it was a no-op vs a Validation Error.
I implemented this with 9bb07d2 |
fixes #1843 :
Node.replaceWith
deletes siblings and creates an invalid state if a node is replaced with itself.Proposed changes :
ValidationException
just as any other invalid parameter would.