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

Add deprecation warning to ComponentSerializer.toString(Object) #3662

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Janmm14
Copy link
Contributor

@Janmm14 Janmm14 commented Apr 21, 2024

It taking all objects is error-prone, deprecate it and create overloads for used acceptable types.

It taking all objects is error-prone, deprecate it and create overloads for used acceptable types.
return gson.toJson( content );
}

public static String toString(JsonElement element)
Copy link
Member

Choose a reason for hiding this comment

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

Where is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it is not used, oops. But it refers to the correct overload of gson for json elements.

public static String toString(Object object)
{
return gson.toJson( object );
}

public static String toString(Content content)
Copy link
Member

Choose a reason for hiding this comment

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

Would plugins ever need this? Both seem kind of internal, can they be hidden away, package-private maybe?

Copy link
Contributor Author

@Janmm14 Janmm14 Apr 21, 2024

Choose a reason for hiding this comment

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

Can't make this package-private, its accessed from HoverEvent's deprecated getValue which is in api.chat while the serializer is only in chat.
Yes, plugins won't need it.

I'm not sure how to improve the situation.

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.

None yet

2 participants