#2740: Fix BaseComponent#equals() stack overflow
This commit is contained in:
parent
d2ceccd646
commit
465215686b
@ -13,7 +13,7 @@ import net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention;
|
||||
|
||||
@Setter
|
||||
@ToString(exclude = "parent")
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(exclude = "parent")
|
||||
@NoArgsConstructor
|
||||
public abstract class BaseComponent
|
||||
{
|
||||
|
@ -409,6 +409,30 @@ public class ComponentsTest
|
||||
Assert.assertEquals( text, roundtripLegacyText );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals()
|
||||
{
|
||||
TextComponent first = new TextComponent( "Hello, " );
|
||||
first.addExtra( new TextComponent( "World!" ) );
|
||||
|
||||
TextComponent second = new TextComponent( "Hello, " );
|
||||
second.addExtra( new TextComponent( "World!" ) );
|
||||
|
||||
Assert.assertEquals( first, second );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotEquals()
|
||||
{
|
||||
TextComponent first = new TextComponent( "Hello, " );
|
||||
first.addExtra( new TextComponent( "World." ) );
|
||||
|
||||
TextComponent second = new TextComponent( "Hello, " );
|
||||
second.addExtra( new TextComponent( "World!" ) );
|
||||
|
||||
Assert.assertNotEquals( first, second );
|
||||
}
|
||||
|
||||
private String fromAndToLegacyText(String legacyText)
|
||||
{
|
||||
return BaseComponent.toLegacyText( TextComponent.fromLegacyText( legacyText ) );
|
||||
|
Loading…
Reference in New Issue
Block a user