diff --git a/src/main/java/com/falsepattern/lib/StableAPI.java b/src/main/java/com/falsepattern/lib/StableAPI.java index d2e0be4..d392e35 100644 --- a/src/main/java/com/falsepattern/lib/StableAPI.java +++ b/src/main/java/com/falsepattern/lib/StableAPI.java @@ -38,7 +38,8 @@ import java.lang.annotation.Target; * fields or non-override methods you may have added if you want to expose those too. *

* NOTICE: You should no longer use this annotation exclusively on classes themselves, and instead, annotate every single - * public or protected member you want to expose as a public API! + * public or protected member you want to expose as a public API! See the {@link Expose} and {@link Internal} annotations + * for extra info. *

* Private members will never be considered stable, and can be removed without notice. *

@@ -48,30 +49,33 @@ import java.lang.annotation.Target; */ @Documented @Retention(RetentionPolicy.RUNTIME) -@Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) +@Target(ElementType.TYPE) @StableAPI(since = "0.6.0") public @interface StableAPI { /** * The version this API was introduced/stabilized in. Used for library version tracking. */ - @StableAPI(since = "0.6.0") String since(); + @StableAPI.Expose + String since(); /** * You may use this annotation if you want a member to have an equal effective {@link #since()} value as its owner * class. *

* Everything else from the {@link StableAPI} class still applies, this is only here for brevity's sake. - * Note that if you add a new field in a version newer than the class, you must use {@link StableAPI} with the - * correct version! + * Note that if you add a method/field in a version newer than the class, you must also specify the correct version! *

* Also note that this only works for class members (methods and fields), * inner classes still need to use {@link StableAPI}. */ @Documented @Retention(RetentionPolicy.RUNTIME) - @Target(value = {ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) + @Target({ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) @StableAPI(since = "0.10.0") - @interface Expose {} + @interface Expose { + @StableAPI.Expose + String since() default "__PARENT__"; + } /** * Use this if you want to explicitly mark specific members of a {@link StableAPI} class as internal-use only. @@ -81,7 +85,7 @@ public @interface StableAPI { */ @Documented @Retention(RetentionPolicy.RUNTIME) - @Target(value = {ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) + @Target({ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) @StableAPI(since = "0.10.0") @interface Internal {} } diff --git a/src/main/java/com/falsepattern/lib/config/ConfigurationManager.java b/src/main/java/com/falsepattern/lib/config/ConfigurationManager.java index 4d05c6e..369ecca 100644 --- a/src/main/java/com/falsepattern/lib/config/ConfigurationManager.java +++ b/src/main/java/com/falsepattern/lib/config/ConfigurationManager.java @@ -43,12 +43,12 @@ import java.util.function.BiConsumer; @StableAPI(since = "0.6.0") public class ConfigurationManager { - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static void initialize(Class... configClasses) throws ConfigException { initialize((a, b) -> {}, configClasses); } - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static void initialize(BiConsumer, Field> validatorErrorCallback, Class... configClasses) throws ConfigException { for (val clazz : configClasses) { @@ -59,12 +59,12 @@ public class ConfigurationManager { } } - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static boolean validate(boolean resetInvalid, Class... configClasses) throws ConfigException { return validate((x, y) -> {}, resetInvalid, configClasses); } - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static boolean validate(BiConsumer, Field> validatorErrorCallback, boolean resetInvalid, Class... configClasses) throws ConfigException { boolean valid = true; @@ -74,14 +74,14 @@ public class ConfigurationManager { return valid; } - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static void loadFromFile(Class... configClasses) throws ConfigException { for (val clazz : configClasses) { ConfigurationManagerImpl.load(clazz); } } - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static void saveToFile(boolean validateAndResetInvalid, Class... configClasses) throws ConfigException { for (val clazz : configClasses) { if (validateAndResetInvalid) { @@ -127,7 +127,7 @@ public class ConfigurationManager { * @return The configuration elements. */ @SuppressWarnings("rawtypes") - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static List getConfigElementsMulti(Class... configClasses) throws ConfigException { switch (configClasses.length) { case 0: diff --git a/src/main/java/com/falsepattern/lib/config/SimpleGuiConfig.java b/src/main/java/com/falsepattern/lib/config/SimpleGuiConfig.java index 07f573f..5e9d243 100644 --- a/src/main/java/com/falsepattern/lib/config/SimpleGuiConfig.java +++ b/src/main/java/com/falsepattern/lib/config/SimpleGuiConfig.java @@ -37,7 +37,7 @@ public class SimpleGuiConfig extends GuiConfig { this(parent, modID, modName, configClass); } - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public SimpleGuiConfig(GuiScreen parent, String modID, String modName, Class... configClasses) throws ConfigException { super(parent, ConfigurationManager.getConfigElementsMulti(configClasses), modID, false, false, diff --git a/src/main/java/com/falsepattern/lib/toasts/SimpleToast.java b/src/main/java/com/falsepattern/lib/toasts/SimpleToast.java index abc62d1..635b2d5 100644 --- a/src/main/java/com/falsepattern/lib/toasts/SimpleToast.java +++ b/src/main/java/com/falsepattern/lib/toasts/SimpleToast.java @@ -115,12 +115,12 @@ public class SimpleToast implements IToast { return background.getIcon().getIconHeight(); } - @StableAPI(since = "0.10.0") + @StableAPI.Expose public void hide() { visibility = IToast.Visibility.HIDE; } - @StableAPI(since = "0.10.0") + @StableAPI.Expose public void setProgress(float progress) { this.currentProgress = progress; } diff --git a/src/main/java/com/falsepattern/lib/util/RenderUtil.java b/src/main/java/com/falsepattern/lib/util/RenderUtil.java index 4a56cca..409cbf9 100644 --- a/src/main/java/com/falsepattern/lib/util/RenderUtil.java +++ b/src/main/java/com/falsepattern/lib/util/RenderUtil.java @@ -49,7 +49,7 @@ public final class RenderUtil { return (Timer) timerField.get(getMinecraft()); } - @StableAPI(since = "0.10.0") + @StableAPI.Expose(since = "0.10.0") public static IIcon getFullTextureIcon(String iconName, int width, int height) { return new IIcon() { @Override