Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Java generics and type erasure Date: Thu, 26 May 2011 22:15:06 -0400 Organization: albasani.net Lines: 32 Message-ID: References: <9d4c2b16-beb5-40b1-87a2-f03e971efeed@k17g2000vbn.googlegroups.com> <4dde10b0$0$67777$c30e37c6@exi-reader.telstra.net> <4ddf0617$0$67777$c30e37c6@exi-reader.telstra.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net xe5zFIp8czWGlfh9isYySm83NQKo3vvp/6lqyCOJmMC/T+Rh1B1sZO/HS0dFwo+nxoR/xsYk8aiBZYX3N8W4DdHWIKVcbvQIth7Ss4eEH5MZx5FrMFElBJzdGqGMWW0L NNTP-Posting-Date: Fri, 27 May 2011 02:14:24 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="Zf7chndvFDlSqcHRMa41TewgCwNxNj/Vq7FeeyCux3na91ldWpHO8ndxRsO3ub0LFb9TtYubjJiU+lBTh9qBN+7PnLIDrBKCblQXji0DkMgrFQ54pEGCT+3pHN5fg1ka"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: <4ddf0617$0$67777$c30e37c6@exi-reader.telstra.net> Cancel-Lock: sha1:9t6Q3cp81om6gTB216VQeEb6qi0= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4632 Esmond Pitt wrote: > Lew wrote: >> Esmond Pitt wrote: >>> The difference is that generic type-signatures are present in .class >>> files for >>> compilation purposes even though generics are erased to their lower >>> bounds at >>> runtime, so that the compiler can enforce the semantics of generics. >> >> This contradicts the statement that Ian Shef made upthread that type >> erasure occurs in compilation. It seems I was correct after all, and >> that it really does happen at runtime. > > No, it doesn't contradict that statement at all. Read what I wrote properly. What parts did you write properly, and what parts did you write improperly? > Types are erased at compile time. They don't appear in the bytecode. Look for > yourself. They do appear in method signatures, for the compiler. I said all > that rather carefully. Here's how I will think of it: Generics make a difference at compile time. They don't make a difference at run time. Then I can ignore what is and isn't in the bytecode. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg