-
Enhancement
-
Resolution: Fixed
-
P4
-
17
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Currently the section §15.12.4.2 of the JLS (https://docs.oracle.com/javase/specs/jls/se17/html/jls-15.html#jls-15.12.4.2) says:
> The final formal parameter of m necessarily has type T[]
This is slightly misleading because it seems to be the
> formal parameter **of the invocation type (§15.12.2.6)** of m
This can be seen with the following code snippet:
```
<T extends CharSequence> void printArgsType(T... args) {
System.out.println(args.getClass());
}
printArgsType("a");
```
This prints `[Ljava.lang.String` instead of `[Ljava.lang.CharSequence`.
Currently the section §15.12.4.2 of the JLS (https://docs.oracle.com/javase/specs/jls/se17/html/jls-15.html#jls-15.12.4.2) says:
> The final formal parameter of m necessarily has type T[]
This is slightly misleading because it seems to be the
> formal parameter **of the invocation type (§15.12.2.6)** of m
This can be seen with the following code snippet:
```
<T extends CharSequence> void printArgsType(T... args) {
System.out.println(args.getClass());
}
printArgsType("a");
```
This prints `[Ljava.lang.String` instead of `[Ljava.lang.CharSequence`.