diff options
Diffstat (limited to 'patches/api/0073-AsyncTabCompleteEvent.patch')
-rw-r--r-- | patches/api/0073-AsyncTabCompleteEvent.patch | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/patches/api/0073-AsyncTabCompleteEvent.patch b/patches/api/0073-AsyncTabCompleteEvent.patch index 2ad169a7c5..e78867039c 100644 --- a/patches/api/0073-AsyncTabCompleteEvent.patch +++ b/patches/api/0073-AsyncTabCompleteEvent.patch @@ -356,15 +356,12 @@ index 0000000000000000000000000000000000000000..0482ecf5b84ba8e0260679049f384f34 +} diff --git a/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java new file mode 100644 -index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276118c1c7b +index 0000000000000000000000000000000000000000..488250fdcdc93ca1aba5042f63fb6286db518014 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java -@@ -0,0 +1,169 @@ +@@ -0,0 +1,172 @@ +package io.papermc.paper.util; + -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.jetbrains.annotations.NotNull; -+ +import java.util.AbstractList; +import java.util.Iterator; +import java.util.List; @@ -372,6 +369,8 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 +import java.util.RandomAccess; +import java.util.function.Function; +import java.util.function.Predicate; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; + +import static com.google.common.base.Preconditions.checkNotNull; + @@ -381,7 +380,10 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + * @param <F> backing list element type + * @param <T> transformed list element type + */ ++@NullMarked +public final class TransformingRandomAccessList<F, T> extends AbstractList<T> implements RandomAccess { ++ + final List<F> fromList; + final Function<? super F, ? extends T> toFunction; + final Function<? super T, ? extends F> fromFunction; @@ -389,14 +391,14 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + /** + * Create a new {@link TransformingRandomAccessList}. + * -+ * @param fromList backing list -+ * @param toFunction function mapping backing list element type to transformed list element type ++ * @param fromList backing list ++ * @param toFunction function mapping backing list element type to transformed list element type + * @param fromFunction function mapping transformed list element type to backing list element type + */ + public TransformingRandomAccessList( -+ final @NonNull List<F> fromList, -+ final @NonNull Function<? super F, ? extends T> toFunction, -+ final @NonNull Function<? super T, ? extends F> fromFunction ++ final List<F> fromList, ++ final Function<? super F, ? extends T> toFunction, ++ final Function<? super T, ? extends F> fromFunction + ) { + this.fromList = checkNotNull(fromList); + this.toFunction = checkNotNull(toFunction); @@ -409,25 +411,25 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + } + + @Override -+ public T get(int index) { ++ public T get(final int index) { + return this.toFunction.apply(this.fromList.get(index)); + } + + @Override -+ public @NotNull Iterator<T> iterator() { ++ public Iterator<T> iterator() { + return this.listIterator(); + } + + @Override -+ public @NotNull ListIterator<T> listIterator(int index) { -+ return new TransformedListIterator<F, T>(this.fromList.listIterator(index)) { ++ public ListIterator<T> listIterator(final int index) { ++ return new TransformedListIterator<>(this.fromList.listIterator(index)) { + @Override -+ T transform(F from) { ++ T transform(final F from) { + return TransformingRandomAccessList.this.toFunction.apply(from); + } + + @Override -+ F transformBack(T from) { ++ F transformBack(final T from) { + return TransformingRandomAccessList.this.fromFunction.apply(from); + } + }; @@ -439,13 +441,13 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + } + + @Override -+ public boolean removeIf(Predicate<? super T> filter) { ++ public boolean removeIf(final Predicate<? super T> filter) { + checkNotNull(filter); + return this.fromList.removeIf(element -> filter.test(this.toFunction.apply(element))); + } + + @Override -+ public T remove(int index) { ++ public T remove(final int index) { + return this.toFunction.apply(this.fromList.remove(index)); + } + @@ -455,19 +457,20 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + } + + @Override -+ public T set(int i, T t) { ++ public T set(final int i, final T t) { + return this.toFunction.apply(this.fromList.set(i, this.fromFunction.apply(t))); + } + + @Override -+ public void add(int i, T t) { ++ public void add(final int i, final T t) { + this.fromList.add(i, this.fromFunction.apply(t)); + } + -+ static abstract class TransformedListIterator<F, T> implements ListIterator<T>, Iterator<T> { ++ abstract static class TransformedListIterator<F, T> implements ListIterator<T>, Iterator<T> { ++ + final Iterator<F> backingIterator; + -+ TransformedListIterator(ListIterator<F> backingIterator) { ++ TransformedListIterator(final ListIterator<F> backingIterator) { + this.backingIterator = checkNotNull((Iterator<F>) backingIterator); + } + @@ -475,7 +478,7 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + return cast(this.backingIterator); + } + -+ static <A> ListIterator<A> cast(Iterator<A> iterator) { ++ static <A> ListIterator<A> cast(final Iterator<A> iterator) { + return (ListIterator<A>) iterator; + } + @@ -500,12 +503,12 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + } + + @Override -+ public void set(T element) { ++ public void set(final T element) { + this.backingIterator().set(this.transformBack(element)); + } + + @Override -+ public void add(T element) { ++ public void add(final T element) { + this.backingIterator().add(this.transformBack(element)); + } + |