-
Bug
-
Resolution: Fixed
-
P4
-
8
The order in which implicitly-typed lambdas are checked in 18.5.2 depends on the relationship between the "input variables" of one constraint and the "output variables" of another. Currently, a constraint can be resolved if:
"no input variable depends on an output variable of another constraint in C (input variable and output variable are defined below; dependencies between inference variable are defined in 18.4)"
The dependencies between inference variables, defined in 18.4, are inadequate to express all cases in which information might flow from one variable to another. This was recognized when implementing javac, leading to two concepts of dependency: "strong" dependencies for resolution, and "weak" dependencies for ordering constraints. The javac behavior needs to be reflected in JLS.
In particular, a bound of the form 'a <: Foo<b>' generally implies a one-way dependency of 'a' on 'b'. But, for constraint sequencing, it would also be valuable to get more information about 'a' before resolving 'b'.
Example:
<A extends List<B>, B> m(Consumer<B> arg1, Supplier<A> arg2);
m(b -> System.out.println(b.length()), () -> new ArrayList<String>())
"no input variable depends on an output variable of another constraint in C (input variable and output variable are defined below; dependencies between inference variable are defined in 18.4)"
The dependencies between inference variables, defined in 18.4, are inadequate to express all cases in which information might flow from one variable to another. This was recognized when implementing javac, leading to two concepts of dependency: "strong" dependencies for resolution, and "weak" dependencies for ordering constraints. The javac behavior needs to be reflected in JLS.
In particular, a bound of the form 'a <: Foo<b>' generally implies a one-way dependency of 'a' on 'b'. But, for constraint sequencing, it would also be valuable to get more information about 'a' before resolving 'b'.
Example:
<A extends List<B>, B> m(Consumer<B> arg1, Supplier<A> arg2);
m(b -> System.out.println(b.length()), () -> new ArrayList<String>())
- relates to
-
JDK-8054294 18.5.2: Clarify definition of dependencies between constraints
- Open