Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #4632

Re: Java generics and type erasure

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Lew <noone@lewscanon.com>
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 <irn1e0$gtb$1@news.albasani.net> (permalink)
References <9d4c2b16-beb5-40b1-87a2-f03e971efeed@k17g2000vbn.googlegroups.com> <nospam-871A48.22542123052011@news.aioe.org> <irfgkl$lca$1@news.albasani.net> <Xns9EEF8515AF3B6vaj4088ianshef@138.125.254.103> <irh6kb$gse$1@news.albasani.net> <Xns9EEFA3AE378DDvaj4088ianshef@138.125.254.103> <irhhik$9rc$3@dont-email.me> <irjv7c$iv0$5@lust.ihug.co.nz> <irk9dr$j5p$4@dont-email.me> <irkc5t$q84$1@lust.ihug.co.nz> <irkkb6$c29$1@dont-email.me> <irkt4q$41b$2@lust.ihug.co.nz> <4dde10b0$0$67777$c30e37c6@exi-reader.telstra.net> <irlega$3kp$1@news.albasani.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

Show key headers only | View raw


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

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Java generics and type erasure Marcin Pietraszek <m.pietraszek@gmail.com> - 2011-05-23 13:18 -0700
  Re: Java generics and type erasure "John B. Matthews" <nospam@nospam.invalid> - 2011-05-23 22:54 -0400
    Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-24 01:45 -0400
      Re: Java generics and type erasure Marcin Pietraszek <m.pietraszek@gmail.com> - 2011-05-24 12:39 -0700
      Re: Java generics and type erasure Ian Shef <invalid@avoiding.spam> - 2011-05-24 20:04 +0000
        Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-24 17:06 -0400
          Re: Java generics and type erasure Ian Shef <invalid@avoiding.spam> - 2011-05-24 23:05 +0000
            Re: Java generics and type erasure Susan Calvin <s.calvin@usr.invalid> - 2011-05-25 00:13 +0000
              Re: Java generics and type erasure Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-26 10:18 +1200
                Re: Java generics and type erasure Susan Calvin <s.calvin@usr.invalid> - 2011-05-26 01:12 +0000
                Re: Java generics and type erasure Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-26 13:59 +1200
                Re: Java generics and type erasure Susan Calvin <s.calvin@usr.invalid> - 2011-05-26 04:18 +0000
                Re: Java generics and type erasure Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-26 18:48 +1200
                Re: Java generics and type erasure Esmond Pitt <esmond.pitt@bigpond.com> - 2011-05-26 18:34 +1000
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-26 07:45 -0400
                Re: Java generics and type erasure "John B. Matthews" <nospam@nospam.invalid> - 2011-05-26 15:25 -0400
                Re: Java generics and type erasure Esmond Pitt <esmond.pitt@bigpond.com> - 2011-05-27 12:01 +1000
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-26 22:15 -0400
                Re: Java generics and type erasure Esmond Pitt <esmond.pitt@bigpond.com> - 2011-05-27 13:04 +1000
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-27 01:27 -0400
                Re: Java generics and type erasure Esmond Pitt <esmond.pitt@bigpond.com> - 2011-05-27 18:07 +1000
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-27 10:18 -0400
                Re: Java generics and type erasure Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-05-27 17:03 +0000
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-27 13:27 -0400
                Re: Java generics and type erasure Esmond Pitt <esmond.pitt@bigpond.com> - 2011-05-30 15:19 +1000
                Re: Java generics and type erasure Tom McGlynn <taqmcg@gmail.com> - 2011-05-26 19:53 -0700
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-27 01:30 -0400
                Re: Java generics and type erasure Esmond Pitt <esmond.pitt@bigpond.com> - 2011-05-27 18:09 +1000
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-27 10:22 -0400
                Re: Java generics and type erasure Esmond Pitt <esmond.pitt@bigpond.com> - 2011-05-30 15:23 +1000
                Re: Java generics and type erasure Lew <noone@lewscanon.com> - 2011-05-30 02:35 -0400

csiph-web