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

Vicente Romero vromero at openjdk.org
Wed Jul 12 19:17:17 UTC 2023


On Wed, 12 Jul 2023 09:49:13 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   adding more regression tests
>
> test/langtools/tools/javac/bang/BangTypesCompilationTests.java line 489:
> 
>> 487:                                 class Box<T> {}
>> 488:                                 class Test {
>> 489:                                     void m(Box<Shape!> lp) {
> 
> This test reminds me of something: capture conversion should probably be tweaked to take nullability into account. Consider this:
> 
> 
> class Foo<X extends Bar!> { 
>     X x() { ... }
> }
> 
> Foo<? extends Object> foo = ...
> Object! restricted = foo.x(); // this should be ok  (e.g. no warnings)
> 
> 
> I'm basing this on the fact that capture conversion already tries to establish some common facts between declaration-site and use-site. This test is similar to when use-site says `<? extends Object>` but the decl site says `<X extends List>`, in which case `List` is used as the bound for the captured variable. In this case, it seems like the null restriction that is present at the declaration site should be carried over to the captured variable as well.  Of course this is all outside the context of this review, but I thought I'd leave a comment to note the issue.

yes, interesting

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

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



More information about the valhalla-dev mailing list