|
With the possibility to constrain the wrapper and the value you actually don't need the explicit unwrapping (i.e. UnwrapValidatedValue), do you?
Right, if type annotations would have been always possible, there would never have been a need for UnwrapValidatedValue. UnwrapValidatedValue is basically a workaround for missing type annotations in pre Java 8. Now that we have type annotations in Java 8, we should aim to make these two things work nicely together (avoiding to break the existing functionality).
Also technically, you still need some concept (implicit or explicit) of "unwrapping". If one annotates the value type of an Optional, one still needs a way to access this value. We can provide some default unwrappers (eg for Optional), but that won't work for custom user types.
|