|
2 | 2 |
|
3 | 3 | import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; |
4 | 4 | import org.embeddedt.modernfix.annotation.RequiresMod; |
5 | | -import org.spongepowered.asm.mixin.*; |
| 5 | +import org.spongepowered.asm.mixin.Final; |
| 6 | +import org.spongepowered.asm.mixin.Mixin; |
| 7 | +import org.spongepowered.asm.mixin.Pseudo; |
| 8 | +import org.spongepowered.asm.mixin.Shadow; |
6 | 9 | import org.spongepowered.asm.mixin.injection.At; |
7 | 10 | import org.spongepowered.asm.mixin.injection.Coerce; |
8 | 11 | import org.spongepowered.asm.mixin.injection.Redirect; |
9 | 12 |
|
10 | | -import java.util.function.BooleanSupplier; |
| 13 | +import java.util.function.Supplier; |
11 | 14 |
|
12 | 15 | /** |
13 | 16 | * Fix getOrCreateFlag accessing the FLAGS map without synchronization by wrapping all calls to it |
|
18 | 21 | @RequiresMod("cofh_core") |
19 | 22 | public class FlagManagerMixin { |
20 | 23 | @Shadow @Final |
21 | | - private static Object2ObjectOpenHashMap<String, BooleanSupplier> FLAGS; |
| 24 | + private static Object2ObjectOpenHashMap<String, Supplier<Boolean>> FLAGS; |
22 | 25 |
|
23 | 26 | @Shadow |
24 | | - private BooleanSupplier getOrCreateFlag(String flag) { |
| 27 | + private Supplier<Boolean> getOrCreateFlag(String flag) { |
25 | 28 | throw new AssertionError(); |
26 | 29 | } |
27 | 30 |
|
28 | 31 | @Redirect(method = "*", at = @At(value = "INVOKE", target = "getOrCreateFlag"), require = 0) |
29 | | - private BooleanSupplier getFlag(@Coerce Object flagHandler, String flag) { |
| 32 | + private Supplier<Boolean> getFlag(@Coerce Object flagHandler, String flag) { |
30 | 33 | if(flagHandler != this) |
31 | 34 | throw new AssertionError("Redirect targeted bad getOrCreateFlag invocation"); |
32 | 35 | synchronized (FLAGS) { |
|
0 commit comments