RFR: addressing several issues in the implementation of universal tvars [v9]

Vicente Romero vromero at openjdk.java.net
Wed Jun 8 19:14:51 UTC 2022


On Wed, 8 Jun 2022 18:37:46 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> test/langtools/tools/javac/valhalla/lworld-values/universal-type-variables/UniversalTVarsCompilationTests.java line 671:
>> 
>>> 669:                     T.ref field;
>>> 670:                     void foo(T t, Consumer<? super T> action) {
>>> 671:                         action.accept(field = t);
>> 
>> Why does this fail? Aren't the two types identical (modulo ref/val) ?
>
> well action is parameterized with a wildcard so here we are assigning a ref to a wildcard, `field = t` is not failing though that assignment generates a warning

it could probably be better to write the test as:

field = t;
action.accept(field = t);

what do you think?

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

PR: https://git.openjdk.java.net/valhalla/pull/684



More information about the valhalla-dev mailing list