-
Notifications
You must be signed in to change notification settings - Fork 562
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
Migrate Guava Predicates and Functions to Java implementations #6047
base: master
Are you sure you want to change the base?
Conversation
…ardRules predicates
Remove unused parameters of other predicates
Added Added some filter predicates that can be tacked on to When replacing Aggregates.random calls in the quest rewards, I realized I was cleaning up 5 copies of the same method with a different filter, so I ended up merging those into one plus some helper methods. There are some lingering items that have been accumulated on my to-do list - e.g. individual methods that could be rewritten to take advantage of streams but aren't easy replacements, parameters or return types that could be shifted from Iterable to a more concrete collection, simplifying things elsewhere... But I'll probably just leave those alone because I have to draw the line somewhere. The biggest thing I'll probably leave for another PR is a cleanup of That and whatever else I come across at the last minute aside, should be done soon. Need to remove the migration aid classes, resolve merge conflicts, cleanup imports, and spend some time testing it. |
…ods dependent on Java predicates
# Conflicts: # forge-game/src/main/java/forge/game/ability/effects/ManifestBaseEffect.java
# Conflicts: # forge-game/src/main/java/forge/game/ForgeScript.java
# Conflicts: # forge-game/src/main/java/forge/game/phase/PhaseHandler.java
# Conflicts: # forge-ai/src/main/java/forge/ai/ComputerUtil.java # forge-core/src/main/java/forge/card/DeckHints.java # forge-game/src/main/java/forge/game/ability/AbilityFactory.java # forge-game/src/main/java/forge/game/cost/CostUntapType.java # forge-gui/src/main/java/forge/player/HumanCostDecision.java
@Hanmac |
# Conflicts: # forge-gui-mobile/src/forge/adventure/data/AdventureEventData.java
Rewrite `generateParticipants`
# Conflicts: # forge-game/src/main/java/forge/game/GameEntityCounterTable.java # forge-game/src/main/java/forge/game/ability/effects/PumpEffect.java # forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java
@Hanmac is this PR good, I think java is more performant than guava, also do we need guava (I don't know if java covers all other collections guava have) |
@kevlahnota i will look over this MR, but i think it should be good enough? we can't really drop guava fully, i would miss my Table support |
I looked at cutting out more of Guava and recreating the functionality within other util classes, but the scope of that started expanding too quickly for this PR at least. They have a huge number of helper methods that we use, and many of those are implemented through internal helper classes which would either need to be reproduced as well or replaced with inline logic. If we want to further lessen the dependency on Guava, I think a good direction would be expanding the functionality of For performance improvements, as mentioned above, I think |
Per #5717.
Not complete yet but wouldn't hurt to get some eyes on it while it's easier to revise things.
The switch-over of the implementation is done, but still need to finish cleaning up the helper methods. Many can be simplified through method references (e.g.
::equals
and::contains
), but others don't have a good equivalent.The dependency on Guava's
Iterables
is one point of uncertainty at the moment. It's too convenient to get rid of, but a handful of the filter methods still want Guava predicates. Could reimplement these manually in anIterableUtils
class, or could just use thepredicate::test
hack to keep using the original library.