Skip to content

Conversation

@dualspiral
Copy link

@dualspiral dualspiral commented Apr 25, 2021

Redirects are added as reference equality checks rather than standard object equality checks because of a stack overflow that can occur if a redirect is to a parent of the current node. If two nodes are redirected to two different nodes that otherwise look the same, then they will not be equal, which is fine because if one of the nodes gains a new child then they won't be equal any more - so I think this is a sensible check to have.

If there is an alternative idea I'd be open to that too - as long as redirects are included in the equality contract somehow - this is just what I think is the most sensible thing to do.

Test included to demonstrate the change.

(See SpongePowered/Sponge#3356 for more info on how this is affecting us.)

They are added as reference equality checks rather than standard object equality checks because of a stack overflow that can occur if a redirect is to a parent of the current node. If two nodes are redirected to two different nodes that otherwise look the same, then they will not be equal, which is fine because if one of the nodes gains a new child then they won't be equal any more - so this is a sensible check to have.

Test included to demonstrate the change.
@liach
Copy link

liach commented Apr 26, 2021

As far as I can see, the argument command nodes can be distinguished by name.

if (!name.equals(that.name)) return false;

Afaik, the name is only used in rendering in command suggestions, like that on the client.
🤔 What prevents you from choosing different names for the command nodes to send to the client to distinguish these nodes?

@chixvv1
Copy link

chixvv1 commented Sep 30, 2023

This fixes MC-137380

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.

4 participants