Invoking statically imported method with explicit type parameters

后端 未结 5 1993
梦毁少年i
梦毁少年i 2021-01-03 20:03

This is the follow up of my question here: Weird Java generic.

If I have a code like this:

Casts. cast(iterable[index]);
<
5条回答
  •  耶瑟儿~
    2021-01-03 20:19

    Java grammar allows type arguments only with typename specified. See corresponding section in JLS https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-MethodInvocation

提交回复
热议问题