From 4cb1b0cebc1f2c07ca459099619cb681576a5162 Mon Sep 17 00:00:00 2001
From: yusshu <yushu@unnamed.team>
Date: Mon, 1 Jan 2024 22:40:52 -0500
Subject: [PATCH] feat: deprecate Readable#resource(String) and
 Writable#resource(String)

---
 .../java/team/unnamed/creative/base/Readable.java    | 12 +++++++++++-
 .../java/team/unnamed/creative/base/Writable.java    |  4 ++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/api/src/main/java/team/unnamed/creative/base/Readable.java b/api/src/main/java/team/unnamed/creative/base/Readable.java
index a363cf3f..a2efc3de 100644
--- a/api/src/main/java/team/unnamed/creative/base/Readable.java
+++ b/api/src/main/java/team/unnamed/creative/base/Readable.java
@@ -23,11 +23,18 @@
  */
 package team.unnamed.creative.base;
 
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.OpenOption;
@@ -155,7 +162,10 @@ default void readAndWrite(final @NotNull OutputStream output) {
      * @param name The full resource name
      * @return The {@link Readable} representation
      * @since 1.1.0
+     * @deprecated Use {@link #resource(ClassLoader, String)} instead
      */
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval(inVersion = "2.0.0")
     @CallerSensitive
     static @NotNull Readable resource(final @NotNull String name) {
         requireNonNull(name, "name");
diff --git a/api/src/main/java/team/unnamed/creative/base/Writable.java b/api/src/main/java/team/unnamed/creative/base/Writable.java
index 03d12269..1f072eab 100644
--- a/api/src/main/java/team/unnamed/creative/base/Writable.java
+++ b/api/src/main/java/team/unnamed/creative/base/Writable.java
@@ -23,6 +23,7 @@
  */
 package team.unnamed.creative.base;
 
+import org.jetbrains.annotations.ApiStatus;
 import org.jetbrains.annotations.NotNull;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
@@ -140,7 +141,10 @@ public String toString() {
      * @param name The full resource name
      * @return The {@link Writable} representation
      * @since 1.1.0
+     * @deprecated Use {@link #resource(ClassLoader, String)} instead
      */
+    @Deprecated
+    @ApiStatus.ScheduledForRemoval(inVersion = "2.0.0")
     @CallerSensitive
     static @NotNull Writable resource(final @NotNull String name) {
         requireNonNull(name, "name");