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

Housekeeping: deprecate, replace or remove archaic utilities classes. #6670

Merged
merged 7 commits into from
Jan 1, 2025

Conversation

Moderocky
Copy link
Member

@Moderocky Moderocky commented May 8, 2024

Description

A lot of utility types were left over from Java 6.
Most of these weren't used at all, but a few are still being used in place of the proper equivalent in legacy code.
This pull request is a bulk group task to deprecate all of these for removal, and to replace internal uses of them all with a better thing.

Where possible, compatibility is perfectly preserved, but in some obscure cases (e.g. constructors) parameters have to be changed.

Legacy libraries

Some legacy libraries have been removed, moved, or just deprecated for removal.
Stubs for each one have been left behind (so technically nothing still using them will break).

Legacy functional interfaces

We have a legacy equivalent of Predicate, Consumer and Function, along with some others.

A lot of these can be replaced without any breaking changes. For some, where a method signature has changed, a plugin extending the method would need to be recompiled but wouldn't require any changes: for example, a method accepting Predicate<T> will also accept the deprecated Checker<T> because that is now a predicate itself.

The process is as follows:

  1. Make the legacy class extend its proper replacement (e.g. Checker<T> extends Predicate<T>)
  2. Forward a default method call from the proper method to the legacy method
  3. Replace uses of the legacy class with the proper class (where possible)
  4. Deprecate the legacy class and mark it for removal.

Unused classes

Unused classes have been marked as Deprecated (not for removal), as to encourage addon owners to copy this over to their own addon, so we don't have to deal with it.

Unused methods

Some unused methods have been removed in this PR. A later PR will follow with more targeted deprecated method removal.


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@Moderocky Moderocky added enhancement Feature request, an issue about something that could be improved, or a PR improving something. 2.9 Targeting a 2.9.X version release housekeeping Housekeeping-related issue or task. breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) labels May 8, 2024
@Moderocky Moderocky force-pushed the feature/deprecate-outdated-utils branch from eccdb57 to ebbf61b Compare May 9, 2024 08:01
@Moderocky Moderocky marked this pull request as ready for review May 30, 2024 08:04
@Moderocky Moderocky force-pushed the feature/deprecate-outdated-utils branch from ebbf61b to 24c10f9 Compare May 30, 2024 08:08
@Moderocky Moderocky requested review from APickledWalrus, sovdeeth and UnderscoreTud and removed request for APickledWalrus and sovdeeth May 30, 2024 08:08
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

My primary concerns with these changes are that the Java-equivalent classes have methods for function composition. For any classes implementing these now deprecated classes, they now have these methods which may not be properly implemented (or work how one might expect)

@sovdeeth sovdeeth removed the 2.9 Targeting a 2.9.X version release label Jun 30, 2024
@Moderocky Moderocky mentioned this pull request Nov 21, 2024
@Efnilite Efnilite self-assigned this Dec 15, 2024
@sovdeeth sovdeeth added the 2.10 Targeting a 2.10.X version release label Dec 17, 2024
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

Great work. This is a necessary step for us to take. There are a few instances where deprecated classes (that have Java equivalents) should have Javadocs with the deprecated tag pointing to the replacement.

@sovdeeth
Copy link
Member

fix conflicts please

@Efnilite Efnilite requested a review from sovdeeth December 26, 2024 22:52
Make closeable an auto-closeable and allow try-with-resources.

Deprecate unused case insensitive strings for removal.
* Mark VectorMath as internal

* Replace usages
* Make Setter a Consumer.

* Remove Setter from Option.

* Remove setter from entry validator.

* Remove setter from enum entry validator.

* Remove setter from parsed entry validator.

* Remove setter from parsed section validator.
* Make checker a Java predicate.

* Deprecate unused Njol predicate for removal.

* Make checker extensions use predicate directly.

* Remove checker from expression.

* Remove checker from utils.

* Deprecate Checker for removal.

* Abstract checker to predicate from simple syntax

* Remove remaining uses of checker.
* Mark Validate as internal

* Schedule for removal + change usages

* Use preconditions
@Moderocky Moderocky force-pushed the feature/deprecate-outdated-utils branch from cc774b0 to bf70e64 Compare January 1, 2025 18:27
@Moderocky Moderocky merged commit dadf750 into dev/feature Jan 1, 2025
6 checks passed
@Efnilite Efnilite deleted the feature/deprecate-outdated-utils branch January 1, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.10 Targeting a 2.10.X version release breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) enhancement Feature request, an issue about something that could be improved, or a PR improving something. housekeeping Housekeeping-related issue or task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants