RFR: 8318160: javac does not reject private method reference with type-variable receiver [v5]
Vicente Romero
vromero at openjdk.org
Tue Oct 17 14:09:10 UTC 2023
On Tue, 17 Oct 2023 12:18:15 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java line 3555:
>>
>>> 3553: MethodReferenceLookupHelper(JCMemberReference referenceTree, Name name, Type site,
>>> 3554: List<Type> argtypes, List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
>>> 3555: super(referenceTree, name, types.skipTypeVars(site, true, true), argtypes, typeargtypes, maxPhase);
>>
>> I believe the right thing here should be to skip captured type variables but not "non-captured" type variables
>
> Not sure... if you have:
>
> class Foo<X> {
> X get()
> }
>
> And then:
>
>
> static Function<?, String> m2(Foo<? extends Test> foo) {
> return foo.get()::asString2;
> }
> ```
>
> Don't you end up with a similar issue?
right nice example thanks
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16210#discussion_r1362093082
More information about the compiler-dev
mailing list