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

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Jun 29 00:33:15 UTC 2023


On Wed, 28 Jun 2023 20:50:21 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> addressing some review comments related to PR [1]
>> 
>> [1] https://github.com/openjdk/valhalla/pull/872
>
> 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?

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

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



More information about the valhalla-dev mailing list