Remove Experimental from TypedKey (#12134)

This commit is contained in:
Jake Potrebic
2025-02-17 15:33:26 -08:00
committed by GitHub
parent b386a8f527
commit f070081825
29 changed files with 43 additions and 74 deletions

View File

@@ -101,7 +101,6 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
.addCode("return $T.create($T.$L, $N);", TypedKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
.returns(returnType);
if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
}
return create;
@@ -157,8 +156,6 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
if (allExperimental) {
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else {
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
}
return typeBuilder.addMethod(createMethod.build()).build();
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.attribute.Attribute;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class AttributeKeys {
/**
* {@code minecraft:armor}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.banner.PatternType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class BannerPatternKeys {
/**
* {@code minecraft:base}
@@ -337,7 +335,6 @@ public final class BannerPatternKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<PatternType> create(final Key key) {
return TypedKey.create(RegistryKey.BANNER_PATTERN, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.Biome;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class BiomeKeys {
/**
* {@code minecraft:badlands}
@@ -491,7 +489,6 @@ public final class BiomeKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<Biome> create(final Key key) {
return TypedKey.create(RegistryKey.BIOME, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.BlockType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class BlockTypeKeys {
/**
* {@code minecraft:acacia_button}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Cat;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class CatVariantKeys {
/**
* {@code minecraft:all_black}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.damage.DamageType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class DamageTypeKeys {
/**
* {@code minecraft:arrow}
@@ -379,7 +377,6 @@ public final class DamageTypeKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<DamageType> create(final Key key) {
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.enchantments.Enchantment;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class EnchantmentKeys {
/**
* {@code minecraft:aqua_affinity}
@@ -330,7 +328,6 @@ public final class EnchantmentKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<Enchantment> create(final Key key) {
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.Fluid;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class FluidKeys {
/**
* {@code minecraft:empty}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Frog;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class FrogVariantKeys {
/**
* {@code minecraft:cold}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.GameEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class GameEventKeys {
/**
* {@code minecraft:block_activate}
@@ -456,7 +454,6 @@ public final class GameEventKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<GameEvent> create(final Key key) {
return TypedKey.create(RegistryKey.GAME_EVENT, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class InstrumentKeys {
/**
* {@code minecraft:admire_goat_horn}
@@ -92,7 +90,6 @@ public final class InstrumentKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<MusicInstrument> create(final Key key) {
return TypedKey.create(RegistryKey.INSTRUMENT, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.ItemType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class ItemTypeKeys {
/**
* {@code minecraft:acacia_boat}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.JukeboxSong;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class JukeboxSongKeys {
/**
* {@code minecraft:11}
@@ -169,7 +167,6 @@ public final class JukeboxSongKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<JukeboxSong> create(final Key key) {
return TypedKey.create(RegistryKey.JUKEBOX_SONG, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.map.MapCursor;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class MapDecorationTypeKeys {
/**
* {@code minecraft:banner_black}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.MenuType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class MenuTypeKeys {
/**
* {@code minecraft:anvil}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class MobEffectKeys {
/**
* {@code minecraft:absorption}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.Art;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class PaintingVariantKeys {
/**
* {@code minecraft:alban}
@@ -386,7 +384,6 @@ public final class PaintingVariantKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<Art> create(final Key key) {
return TypedKey.create(RegistryKey.PAINTING_VARIANT, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.Sound;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class SoundEventKeys {
/**
* {@code minecraft:ambient.basalt_deltas.additions}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.Structure;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class StructureKeys {
/**
* {@code minecraft:ancient_city}
@@ -274,7 +272,6 @@ public final class StructureKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<Structure> create(final Key key) {
return TypedKey.create(RegistryKey.STRUCTURE, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.StructureType;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class StructureTypeKeys {
/**
* {@code minecraft:buried_treasure}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class TrimMaterialKeys {
/**
* {@code minecraft:amethyst}
@@ -113,7 +111,6 @@ public final class TrimMaterialKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<TrimMaterial> create(final Key key) {
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class TrimPatternKeys {
/**
* {@code minecraft:bolt}
@@ -162,7 +160,6 @@ public final class TrimPatternKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<TrimPattern> create(final Key key) {
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Villager;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class VillagerProfessionKeys {
/**
* {@code minecraft:armorer}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Villager;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class VillagerTypeKeys {
/**
* {@code minecraft:desert}

View File

@@ -7,7 +7,6 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Wolf;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
/**
@@ -25,7 +24,6 @@ import org.jspecify.annotations.NullMarked;
})
@GeneratedFrom("1.21.4")
@NullMarked
@ApiStatus.Experimental
public final class WolfVariantKeys {
/**
* {@code minecraft:ashen}
@@ -99,7 +97,6 @@ public final class WolfVariantKeys {
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static TypedKey<Wolf.Variant> create(final Key key) {
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
}

View File

@@ -1,6 +1,7 @@
package io.papermc.paper.registry;
import io.papermc.paper.datacomponent.DataComponentType;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.KeyPattern;
import net.kyori.adventure.key.Keyed;
@@ -209,7 +210,6 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
* @param key the key of the typed key.
* @return the constructed typed key.
*/
@ApiStatus.Experimental
default TypedKey<T> typedKey(final Key key) {
return TypedKey.create(this, key);
}
@@ -220,8 +220,29 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
* @return the constructed typed key.
*/
@ApiStatus.Experimental
default TypedKey<T> typedKey(final @KeyPattern String key) {
default TypedKey<T> typedKey(@KeyPattern final String key) {
return TypedKey.create(this, key);
}
/**
* Constructs a new {@link TagKey} for this registry given the tag key's key.
*
* @param key the key of the typed key.
* @return the constructed tag key.
*/
@ApiStatus.Experimental
default TagKey<T> tagKey(final Key key) {
return TagKey.create(this, key);
}
/**
* Constructs a new {@link TagKey} for this registry given the tag key's key.
*
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
* @return the constructed tag key.
*/
@ApiStatus.Experimental
default TagKey<T> tagKey(@KeyPattern final String key) {
return TagKey.create(this, key);
}
}

View File

@@ -11,7 +11,6 @@ import org.jspecify.annotations.NullMarked;
*
* @param <T> the value type for the registry
*/
@ApiStatus.Experimental
@NullMarked
public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
@@ -39,7 +38,6 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
* @param <T> value type
* @return a new key for the value key and registry key
*/
@ApiStatus.Experimental
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final Key key) {
return new TypedKeyImpl<>(key, registryKey);
}
@@ -53,8 +51,7 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
* @return a new key for the value key and registry key
* @see Key#key(String)
*/
@ApiStatus.Experimental
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final @KeyPattern String key) {
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
return create(registryKey, Key.key(key));
}
}

View File

@@ -1,7 +1,9 @@
package io.papermc.paper.registry.tag;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.KeyPattern;
import net.kyori.adventure.key.Keyed;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
@@ -15,15 +17,29 @@ public sealed interface TagKey<T> extends Keyed permits TagKeyImpl {
* Creates a new tag key for a registry.
*
* @param registryKey the registry for the tag
* @param key the specific key for the tag
* @param key the specific key for the tag
* @param <T> the registry value type
* @return a new tag key
* @param <T> the registry value type
*/
@Contract(value = "_, _ -> new", pure = true)
static <T> TagKey<T> create(final RegistryKey<T> registryKey, final Key key) {
return new TagKeyImpl<>(registryKey, key);
}
/**
* Creates a new tag key for a registry.
*
* @param registryKey the registry for the tag
* @param key the string version of a {@link Key} that will be passed to {@link Key#key(String)} for parsing.
* @param <T> the registry value type
* @return a new tag key
* @see Key#key(String)
*/
@ApiStatus.Experimental
static <T> TagKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
return create(registryKey, Key.key(key));
}
/**
* Get the registry key for this tag key.
*