RFR: 8310905: [lw5] addressing review comments on null restricted types [v5]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jul 14 00:40:22 UTC 2023


On Thu, 13 Jul 2023 22:00:20 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1288:
>> 
>>> 1286:             @Override
>>> 1287:             public Boolean visitType(Type t, Type s) {
>>> 1288:                 Warner warner = !warnStack.isEmpty() ? warnStack.head : noWarnings;
>> 
>> Good cleanup. I assume that now nullability comparator really has no state, so you could in principle create two instances (with the two comparator functions), and just use those instances, right?
>
> not really, in one case we are using this comparator: `(t1, t2) -> !hasSameNullability(t1, t2)`, see the `!` operator, so we would need three different instances

I see - but still - there is no state in the comparator - right? E.g. in principle clients can allocate a new one and take it from there each time. So perhaps that would be more honest, rather than having a shared instance but then having to call a `reset` method?

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/880#discussion_r1263164205



More information about the valhalla-dev mailing list