作者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
推 TsaiCF:請比較 List<String[]> 跟 List<String>[]. 何者不合法? 05/02 01:19
→ macbuntu:你寫的這兩個都沒有 type bounds... 05/02 01:23
→ macbuntu:type bound 是像 <T extends A,B> 中的 A 和 B, 不是 T 05/02 01:25
推 TsaiCF:List<? extends Object[]> z = new ArrayList<String[]>(); 05/02 13:37