Fix Optional null issue - Fixes #3155
Also check class loader cache before locking to speed up cached hits to avoid the lock wasn't gonna make a unique build just for that but can lump it in here.
This commit is contained in:
@@ -7,7 +7,7 @@ In order to get chunk values, we shouldn't need to create
|
||||
an optional each time.
|
||||
|
||||
diff --git a/src/main/java/com/mojang/datafixers/util/Either.java b/src/main/java/com/mojang/datafixers/util/Either.java
|
||||
index a90adac7b..efae74b71 100644
|
||||
index a90adac7b..4bb621d57 100644
|
||||
--- a/src/main/java/com/mojang/datafixers/util/Either.java
|
||||
+++ b/src/main/java/com/mojang/datafixers/util/Either.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Either<L, R> implements App<Either.Mu<R>, L> {
|
||||
@@ -19,7 +19,7 @@ index a90adac7b..efae74b71 100644
|
||||
|
||||
public Left(final L value) {
|
||||
- this.value = value;
|
||||
+ this.value = value; this.valueOptional = Optional.of(value); // Paper - reduce the optional allocation...
|
||||
+ this.value = value; this.valueOptional = value != null ? Optional.of(value) : Optional.empty(); // Paper - reduce the optional allocation...
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,7 +41,7 @@ index a90adac7b..efae74b71 100644
|
||||
|
||||
public Right(final R value) {
|
||||
- this.value = value;
|
||||
+ this.value = value; this.valueOptional = Optional.of(value); // Paper - reduce the optional allocation...
|
||||
+ this.value = value; this.valueOptional = value != null ? Optional.of(value) : Optional.empty(); // Paper - reduce the optional allocation...
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user