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

Vicente Romero vromero at openjdk.org
Thu Jun 29 01:03:19 UTC 2023


On Thu, 29 Jun 2023 00:30:43 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   addressing more review comments
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1302:
> 
>> 1300:             @Override
>> 1301:             public Boolean visitType(Type t, Type s) {
>> 1302:                 if (differentNullability.apply(t, s)) {
> 
> Is this truly a recursive visitor? I'm wondering, because if you don't need the visitor capabilities, then you could just drop the use of lambdas which will make the code a bit cleaner. E.g. instead of:
> 
> nullabilityComparator.reset((t1, t2) -> !t1.sameNullabilityAs(t2))
>                             .visit(s, t);
> 
> do:
> 
> if (!s.sameNullabilityAs(t)) {
>      nullabilityComparator.warn(...);
> }
> 
> In which case, maybe NullabilityComparator is just NullabilityWarner?

yes the visitor is needed, I found other test cases for which this approach is not enough, I will be adding another iteration with more test cases

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

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



More information about the valhalla-dev mailing list