diff --git a/UPDATE_NOTES.md b/UPDATE_NOTES.md index 7ad7f0a..ab584e9 100644 --- a/UPDATE_NOTES.md +++ b/UPDATE_NOTES.md @@ -3,10 +3,13 @@ * `[PlutoLib]` Removed `TextIn`, `TextOut`, `ResourceImage` and `ResourceInputStream` * `[PlutoLib]` Made `OutputSplitStream` public as it is now reusable * `[PlutoLib]` Added the `@ConstantExpression` annotation -* `[PlutoLib]` Moved `cz.tefek.pluto.io.pluto.pp` to `cz.tefek.pluto.io.plutopackage` * `[PlutoLib]` The `RAID#getIDOf` method now returns `OptionalInt` to avoid NPEs * `[PlutoLib]` The transitive dependency JOML is now provided by `PlutoLib` instead of `PlutoStatic` +Awaiting implementation: +* `[PlutoLib]` Moved `cz.tefek.pluto.io.pluto.pp` to `cz.tefek.pluto.io.plutopackage` +* `[PlutoLib]` Completely reworked the module system + ## 20.2.0.0-alpha.2 * `build.gradle` Extracted the version numbers into separate variables * `build.gradle` **[experimental]** `gradlew` should now automatically download JDK11 when needed diff --git a/plutolib/src/main/java/cz/tefek/pluto/annotation/ConstantExpression.java b/plutolib/src/main/java/cz/tefek/pluto/annotation/ConstantExpression.java new file mode 100644 index 0000000..7bbc10e --- /dev/null +++ b/plutolib/src/main/java/cz/tefek/pluto/annotation/ConstantExpression.java @@ -0,0 +1,22 @@ +package cz.tefek.pluto.annotation; + +import javax.annotation.meta.TypeQualifier; +import java.lang.annotation.*; + +/** + * Denotes that the target field or method should be a constant expression - it is final, has no state + * and always yields the same deterministic result for given input. Generally, annotated methods + * should be thread-safe, however this is not required. + * + * @author 493msi + * + * @since 20.2.0.0-alpha.3 + * */ +@TypeQualifier +@Documented +@Retention(RetentionPolicy.CLASS) +@Target({ ElementType.METHOD, ElementType.FIELD }) +public @interface ConstantExpression +{ + +} diff --git a/plutolib/src/main/java/cz/tefek/pluto/io/asl/resource/raid/RAID.java b/plutolib/src/main/java/cz/tefek/pluto/io/asl/resource/raid/RAID.java index e84b101..9346a3f 100644 --- a/plutolib/src/main/java/cz/tefek/pluto/io/asl/resource/raid/RAID.java +++ b/plutolib/src/main/java/cz/tefek/pluto/io/asl/resource/raid/RAID.java @@ -21,7 +21,7 @@ public class RAID implements Iterable this.reverseRaid = new HashMap<>(); } - public void register(E item) + public void register(@Nonnull E item) { var address = item.getStringID(); @@ -48,7 +48,7 @@ public class RAID implements Iterable } @Nonnull - public OptionalInt getIDOf(E item) + public OptionalInt getIDOf(@Nonnull E item) { return reverseRaid.containsKey(item.getStringID()) ? OptionalInt.of(reverseRaid.get(item.getStringID()))