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: Fri, 27 May 2011 01:27:36 -0400 Organization: albasani.net Lines: 40 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> <4ddf14c8$0$67785$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 hStFys3G4o5vL+4BoZ+Yf3x55jzj2KmPD17hP5PEsXWK6MC+Z3fL+MplKY4jKjquLMLkrNEVDEr85qYCvrYVythaWDl8ZDhyOkb49100mKWyHwkE5KFh2SesM6ZgRDYB NNTP-Posting-Date: Fri, 27 May 2011 05:26:54 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="wRJkKdldYpt8CXG/3thvEL0d6uYc2ceQcIagB38glpeNBPBpgk1mUHSAA/XOOVvM2Oz+FAzvl2DE3RtaOSwUNto5MFNBvBQ29Tamz/6ohIKnkqUToAQbRJQQ4t49BWL6"; 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: <4ddf14c8$0$67785$c30e37c6@exi-reader.telstra.net> Cancel-Lock: sha1:I4HUDwJizgdysVYMb1+vTI8p+5M= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4638 On 05/26/2011 11:04 PM, Esmond Pitt wrote: > On 27/05/2011 12:15 PM, Lew wrote: >> Generics make a difference at compile time. They don't make a difference >> at run time. > > Correct. > >> Then I can ignore what is and isn't in the bytecode. > > Unless you are asserting, and I quote, that 'it really does happen at > runtime'. If there is no bytecode that executes that action, it really doesn't > happen at runtime. What I'm asserting is that there are no generics at runtime, and that there are at compile time, so the state of things having been erased already happens at runtime and the state of things not having yet been erased happens at compile time. It follows from this that the erasure itself happens between compile time and runtime, i.e., during the process of compilation as you and Ian said. The meaning of the assertion you cite was that the generics information that is present in the bytecode is ignored at runtime, as you yourself said, so that's the "it" that happens at runtime. My statement thereof was far from clear. I should have indicated that then. I am most emphatically not saying that it is not compilation that performs the erasure. As I stated upthread, my perspective has to do with when generics are relevant, not when they cease to be. They are relevant at compilation; they are not relevant at runtime. It is in that sense that I think of erasure as being a runtime phenomenon. I am more interested in the state of having been erased vs. not having been erased than in the brief moment during which the erasure happens. Pfft. So generics are a compile-time phenomenon; the condition of them having been erased is a runtime phenomenon. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg