Skip to content

Commit

Permalink
fix annotation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed May 29, 2024
1 parent 49ed854 commit 7adb8a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions patches/api/0003-Test-changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f
+ }
+}
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 64e7aef6220097edefdff3b98a771b988365930d..abadff47166722fdc756afdbc6ac7242b6bd4fb0 100644
index 64e7aef6220097edefdff3b98a771b988365930d..a899f63eb2ce58b3cf708e91819cbbdeffda5d9f 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -29,7 +29,13 @@ public class AnnotationTest {
Expand Down Expand Up @@ -132,8 +132,8 @@ index 64e7aef6220097edefdff3b98a771b988365930d..abadff47166722fdc756afdbc6ac7242
for (int i = 0; i < paramTypes.length; i++) {
if (mustBeAnnotated(paramTypes[i]) ^ isWellAnnotated(method.invisibleParameterAnnotations == null ? null : method.invisibleParameterAnnotations[i])) {
+ // Paper start
+ if (method.invisibleTypeAnnotations != null) {
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
+ if (method.invisibleTypeAnnotations != null || method.visibleTypeAnnotations != null) {
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : java.util.Objects.requireNonNullElse(method.invisibleTypeAnnotations, method.visibleTypeAnnotations)) {
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
+ continue dancing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ index 7b2ab0be10a21e0496ad1d485ff8cb2c0b92a2cb..e6037cc5b79b5206e5da8d53c5009932
}
diff --git a/src/main/java/io/papermc/paper/datapack/DatapackRegistrar.java b/src/main/java/io/papermc/paper/datapack/DatapackRegistrar.java
new file mode 100644
index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5cb25b57d
index 0000000000000000000000000000000000000000..cf1fd66e6212b007717e766026b76a5f8040f47a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/datapack/DatapackRegistrar.java
@@ -0,0 +1,122 @@
Expand All @@ -33,9 +33,9 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+import java.nio.file.Path;
+import java.util.function.Consumer;
+import net.kyori.adventure.text.Component;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * The registrar for datapacks. The event for this registrar
Expand All @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * it must always be discovered whenever this event fires.
+ * <p>An example of a plugin loading a datapack from within it's own jar is below</p>
+ * <pre>{@code
+ * class YourPluginBootstrap implements PluginBootstrap {
+ * public class YourPluginBootstrap implements PluginBootstrap {
+ * @Override
+ * public void bootstrap(BoostrapContext context) {
+ * final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
Expand Down Expand Up @@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * @param id a unique id
+ * @throws IOException if any IO error occurs
+ */
+ default void discoverPack(final @NotNull URI uri, final @NotNull String id) throws IOException {
+ default void discoverPack(final @NonNull URI uri, final @NonNull String id) throws IOException {
+ this.discoverPack(uri, id, c -> {});
+ }
+
Expand All @@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * @param configurer a configurer for extra options
+ * @throws IOException if any IO error occurs
+ */
+ void discoverPack(@NotNull URI uri, @NotNull String id, Consumer<Configurer> configurer) throws IOException;
+ void discoverPack(@NonNull URI uri, @NonNull String id, @NonNull Consumer<Configurer> configurer) throws IOException;
+
+ /**
+ * Discovers a datapack at the specified {@link Path} with the id.
Expand All @@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * @param id a unique id
+ * @throws IOException if any IO error occurs
+ */
+ default void discoverPack(final @NotNull Path path, final @NotNull String id) throws IOException {
+ default void discoverPack(final @NonNull Path path, final @NonNull String id) throws IOException {
+ this.discoverPack(path, id, c -> {});
+ }
+
Expand All @@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * @param configurer a configurer for extra options
+ * @throws IOException if any IO error occurs
+ */
+ void discoverPack(@NotNull Path path, @NotNull String id, @NotNull Consumer<Configurer> configurer) throws IOException;
+ void discoverPack(@NonNull Path path, @NonNull String id, @NonNull Consumer<Configurer> configurer) throws IOException;
+
+ /**
+ * Configures additional, optional, details about a datapack.
Expand All @@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * @return the configurer for chaining
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ @NotNull Configurer title(Component title);
+ @NonNull Configurer title(@NonNull Component title);
+
+ /**
+ * Sets if this pack is required. Defaults to false.
Expand All @@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * @return the configurer for chaining
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ @NotNull Configurer required(boolean required);
+ @NonNull Configurer required(boolean required);
+
+ /**
+ * Configures the position in the
Expand All @@ -144,7 +144,7 @@ index 0000000000000000000000000000000000000000..0ba2252d54999108f19a772f65ba75e5
+ * @return the configurer for chaining
+ */
+ @Contract(value = "_, _ -> this", mutates = "this")
+ @NotNull Configurer position(boolean fixed, Datapack.Position position);
+ @NonNull Configurer position(boolean fixed, Datapack.@NonNull Position position);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ index 6c072e44a8144de6658b4eb818c996f0eac5805b..346c9f8dbeda7c48e88b10964e04a89f
public static final LifecycleEventRunner INSTANCE = new LifecycleEventRunner();

diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
index def8ed40ef732b512a07fe50449c77a860b97462..72c39887631916a7e448123fa793057779e75c53 100644
index 1a528e1aa7b12f8b8cffce6c7bc4b5d5865f026b..7fb122b54f365261b95c0ae5e0a91fbedee03b4f 100644
--- a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
+++ b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
@@ -82,6 +82,7 @@ public class ServerPacksSource extends BuiltInPackSource {
@@ -85,6 +85,7 @@ public class ServerPacksSource extends BuiltInPackSource {
public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) {
return new PackRepository(
new ServerPacksSource(symlinkFinder), new FolderRepositorySource(dataPacksPath, PackType.SERVER_DATA, PackSource.WORLD, symlinkFinder)
Expand Down

0 comments on commit 7adb8a5

Please sign in to comment.