On Wed, Oct 16, 2019 at 3:56 PM Joe Darcy <[email protected]> wrote:
>
> > The comments for Condition declarations are still not consistent -
> > every one is known to be Serializable, but they cannot be declared
> > Condition & Serializable because Java does not have first-class
> > support for intersection types.
>
> FWIW, this code compiles in javac
>
> public interface SerializableCondition extends Condition,
> Serializable {
> public static <C extends Condition & Serializable>
> SerializableCondition transform(C
> condition) {
> return condition;
> }
> }
>
> and objects of existing types like
> AbstractQueuedLongSynchronizer.ConditionObject seem to get "converted"
> as desired.
>
Here's another point of view of the same problem:
https://blog.codefx.org/java/intersection-types-var/