Integrated: 8334466: Ambiguous method call with generics may cause FunctionDescriptorLookupError

Vicente Romero vromero at openjdk.org
Mon Aug 12 13:55:39 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

This pull request has now been integrated.

Changeset: 61d1dc59
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/61d1dc59535a3dc186bc1986a04efdb4e5a8fa18
Stats:     38 lines in 3 files changed: 35 ins; 0 del; 3 mod

8334466: Ambiguous method call with generics may cause FunctionDescriptorLookupError

Reviewed-by: jlahoda

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

PR: https://git.openjdk.org/jdk/pull/20300


More information about the compiler-dev mailing list