Yes, and this is true not only for functional interfaces, but for ArrayList<T> as well; we don’t know if the user really meant List<int> or List<Integer>. So the implementation will guess wrong some of the time.
> On Jul 22, 2022, at 12:16 PM, Remi Forax <[email protected]> wrote: > > I've found where the storage hints model does not work well. > > The storage hints model as its own name says works on implementations, but it > does not work on functional interface types. > > By example, we have functional interfaces in java.util.function where the > same interface say j.u.f.Function is used sometime with the return/parameter > values being nullable sometimes it is used with the return/parameter values > that we hope to be non-nullable. For example, the function in > stream.map(function) wants to be non-nullable but the function in > map.compute(function) allows nullable values. > > Thus when declaring j.u.f.Function we can not decide if the parameter type / > return type should be annotated by the .flat storage hint or not. > Which means that the storage hints model will not provide enough information > for the VM to compute the precise calling convention. > > So the storage hints model is not dead dead but a model based on the type > propagation is more efficient. > > Rémi
