作者macbuntu (邀怪)
看板java
标题Re: [问题] generic type parameter bound?
时间Fri May 1 23:37:26 2009
※ 引述《Senkousha ( )》之铭言:
: 可是後面的注解黄字部份让我觉得很奇怪:
: Returns the live ordered list of type bounds of this type parameter.
: For the type parameter to be plausible, there can be at most one class
: in the list, and it must be first, and the remaining ones must be
: interfaces; the list should not contain primitive types
: (but array types and parameterized types are allowed).
: type bound 可以放 array type 吗? :Q
: 在什麽情况下可以放呢?
Java type parameter bounds 应该是不能有 array。
我猜这纯粹是 Eclipse JDT documentation 上的错误...
你如果把 array 当成 bounds,应该连那个 TypeParameter
的 AST Node 都不会建出来吧?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.165.161.253
1F:推 TsaiCF:请比较 List<String[]> 跟 List<String>[]. 何者不合法? 05/02 01:19
2F:→ macbuntu:你写的这两个都没有 type bounds... 05/02 01:23
3F:→ macbuntu:type bound 是像 <T extends A,B> 中的 A 和 B, 不是 T 05/02 01:25
4F:推 TsaiCF:List<? extends Object[]> z = new ArrayList<String[]>(); 05/02 13:37