Calling static generic methods

前端 未结 1 2040
星月不相逢
星月不相逢 2020-11-28 21:12

I have come across a curious situation involving static generic methods. This is the code:

class Foo
{
    public static  Foo crea         


        
相关标签:
1条回答
  • 2020-11-28 22:00

    Yes, this is type inference based on the target of the assignment, as per JLS section 15.12.2.8. To be explicit, you'd call something like:

    Foo.<String>createFoo();
    
    0 讨论(0)
提交回复
热议问题