[PlutoLib] Added the ConstantExpression annotation, added annotations for readability
This commit is contained in:
parent
5df8409c1a
commit
8e2da891f8
|
@ -3,10 +3,13 @@
|
||||||
* `[PlutoLib]` Removed `TextIn`, `TextOut`, `ResourceImage` and `ResourceInputStream`
|
* `[PlutoLib]` Removed `TextIn`, `TextOut`, `ResourceImage` and `ResourceInputStream`
|
||||||
* `[PlutoLib]` Made `OutputSplitStream` public as it is now reusable
|
* `[PlutoLib]` Made `OutputSplitStream` public as it is now reusable
|
||||||
* `[PlutoLib]` Added the `@ConstantExpression` annotation
|
* `[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 `RAID#getIDOf` method now returns `OptionalInt` to avoid NPEs
|
||||||
* `[PlutoLib]` The transitive dependency JOML is now provided by `PlutoLib` instead of `PlutoStatic`
|
* `[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
|
## 20.2.0.0-alpha.2
|
||||||
* `build.gradle` Extracted the version numbers into separate variables
|
* `build.gradle` Extracted the version numbers into separate variables
|
||||||
* `build.gradle` **[experimental]** `gradlew` should now automatically download JDK11 when needed
|
* `build.gradle` **[experimental]** `gradlew` should now automatically download JDK11 when needed
|
||||||
|
|
|
@ -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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -21,7 +21,7 @@ public class RAID<E extends IIdentifiable> implements Iterable<E>
|
||||||
this.reverseRaid = new HashMap<>();
|
this.reverseRaid = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(E item)
|
public void register(@Nonnull E item)
|
||||||
{
|
{
|
||||||
var address = item.getStringID();
|
var address = item.getStringID();
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class RAID<E extends IIdentifiable> implements Iterable<E>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public OptionalInt getIDOf(E item)
|
public OptionalInt getIDOf(@Nonnull E item)
|
||||||
{
|
{
|
||||||
return reverseRaid.containsKey(item.getStringID()) ?
|
return reverseRaid.containsKey(item.getStringID()) ?
|
||||||
OptionalInt.of(reverseRaid.get(item.getStringID()))
|
OptionalInt.of(reverseRaid.get(item.getStringID()))
|
||||||
|
|
Loading…
Reference in New Issue