RFR: 8334466: Ambiguous method call with generics may cause FunctionDescriptorLookupError
Jan Lahoda
jlahoda at openjdk.org
Mon Aug 12 06:26:37 UTC 2024
On Tue, 23 Jul 2024 14:13:57 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> javac is crashing while compiling code like:
>
>
> import java.util.List;
>
> class Test {
> void m() {
> List<X> list = List.of(new X());
> test(list.get(0));
> }
>
> void test(A<?> a) { }
> void test(B<?> b) { }
>
> interface A<T extends A<T>> { T a(); }
> interface B<T extends B<T>> { T b(); }
> class X implements A<X>, B<X> {
> public X a() { return null; }
> public X b() { return null; }
> }
> }
>
> this is because method Types::findDescriptorType, which is invoked in this particular case, throws `FunctionDescriptorLookupError` which is an internal exception that is supposed to be captured by the client. The client then should interpret the exception depending on the context. This was not happening in the code path stressed by this test case. This PR is fixing this issue
>
> TIA
Looks reasonable to me.
-------------
Marked as reviewed by jlahoda (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20300#pullrequestreview-2232123348
More information about the compiler-dev
mailing list