McModLauncher / modlauncher

Java 21 mod launcher
Other
171 stars 47 forks source link

Fixed TransformationServicesHandler.alternate nested Optionals #33

Closed GoryMoon closed 5 years ago

GoryMoon commented 5 years ago

This fixes TransformationServicesHandler.alternate no using the second function if both are nonnull.

Before the first Optional.ofNullable() would return an Optional<Optional<R>> and as it's an optional, it should not be null and thus the orElseGet() will always return the value of the first function as an Optional and never the value from the supplier using the second function. Optional doesn't check if there is any nested optional and that they are empty, they only check if the value is null or not.

@cpw This is a probably the fix to the current issue in #31 not calling the name -> URL resolver.

cpw commented 5 years ago

Heh. that probably explains it. Got my optionals confused with my optionals, and put optionals inside my optionals instead of putting optionals around my optionals.