CINXE.COM

Neal Gafter's blog: Puzzling Through Erasure: answer section

<!DOCTYPE html> <html xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'> <head> <link href='https://www.blogger.com/static/v1/widgets/55013136-widget_css_bundle.css' rel='stylesheet' type='text/css'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='blogger' name='generator'/> <link href='https://gafter.blogspot.com/favicon.ico' rel='icon' type='image/x-icon'/> <link href='http://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html' rel='canonical'/> <link rel="alternate" type="application/atom+xml" title="Neal Gafter&#39;s blog - Atom" href="https://gafter.blogspot.com/feeds/posts/default" /> <link rel="alternate" type="application/rss+xml" title="Neal Gafter&#39;s blog - RSS" href="https://gafter.blogspot.com/feeds/posts/default?alt=rss" /> <link rel="service.post" type="application/atom+xml" title="Neal Gafter&#39;s blog - Atom" href="https://www.blogger.com/feeds/7803021/posts/default" /> <!--Can't find substitution for tag [blog.ieCssRetrofitLinks]--> <meta content='http://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html' property='og:url'/> <meta content='Puzzling Through Erasure: answer section' property='og:title'/> <meta content='Erasure is the technique that Java 5 uses to implement generics.聽 Basically, the javac compiler performs its type-checking and then erases,...' property='og:description'/> <title>Neal Gafter's blog: Puzzling Through Erasure: answer section</title> <style id='page-skin-1' type='text/css'><!-- /* ----------------------------------------------- Blogger Template Style Name: Stretch Denim Designer: Darren Delaye URL: www.DarrenDelaye.com Date: 11 Jul 2006 ----------------------------------------------- */ body { background: #619bb8; margin: 0; padding: 0px; font: x-small Verdana, Arial; text-align: center; color: #000000; font-size/* */:/**/small; font-size: /**/small; } a:link { color: #215670; } a:visited { color: #215670; } a img { border-width: 0; } #outer-wrapper { font: normal normal 100% Verdana, Arial, Sans-serif;; } /* Header ----------------------------------------------- */ #header-wrapper { margin:0; padding: 0; background-color: #619bb8; text-align: left; } #header { margin: 0 2%; background-color: #215670; color: #efefef; padding: 0; font: normal normal 210% Verdana, Arial, Sans-serif;; position: relative; } h1.title { padding-top: 38px; margin: 0 1% .1em; line-height: 1.2em; font-size: 100%; } h1.title a, h1.title a:visited { color: #efefef; text-decoration: none; } #header .description { display: block; margin: 0 1%; padding: 0 0 40px; line-height: 1.4em; font-size: 50%; } /* Content ----------------------------------------------- */ .clear { clear: both; } #content-wrapper { margin: 0 2%; padding: 0 0 15px; text-align: left; background-color: #efefef; border: 1px solid #cccccc; border-top: 0; } #main-wrapper { margin-left: 1%; width: 64%; float: left; background-color: #efefef; display: inline; /* fix for doubling margin in IE */ word-wrap: break-word; /* fix for long text breaking sidebar float in IE */ overflow: hidden; /* fix for long non-text content breaking IE sidebar float */ } #sidebar-wrapper { margin-right: 1%; width: 29%; float: right; background-color: #efefef; display: inline; /* fix for doubling margin in IE */ word-wrap: break-word; /* fix for long text breaking sidebar float in IE */ overflow: hidden; /* fix for long non-text content breaking IE sidebar float */ } /* Headings ----------------------------------------------- */ h2, h3 { margin: 0; } /* Posts ----------------------------------------------- */ .date-header { margin: 1.5em 0 0; font-weight: normal; color: #666666; font-size: 100%; } .post { margin: 0 0 1.5em; padding-bottom: 1.5em; } .post-title { margin: 0; padding: 0; font-size: 125%; font-weight: bold; line-height: 1.1em; } .post-title a, .post-title a:visited, .post-title strong { text-decoration: none; color: #000000; font-weight: bold; } .post div { margin: 0 0 .75em; line-height: 1.3em; } .post-footer { margin: -.25em 0 0; color: #000000; font-size: 87%; } .post-footer .span { margin-right: .3em; } .post img, table.tr-caption-container { padding: 4px; border: 1px solid #cccccc; } .tr-caption-container img { border: none; padding: 0; } .post blockquote { margin: 1em 20px; } .post blockquote p { margin: .75em 0; } /* Comments ----------------------------------------------- */ #comments h4 { margin: 1em 0; color: #666666; } #comments h4 strong { font-size: 110%; } #comments-block { margin: 1em 0 1.5em; line-height: 1.3em; } #comments-block dt { margin: .5em 0; } #comments-block dd { margin: .25em 0 0; } #comments-block dd.comment-footer { margin: -.25em 0 2em; line-height: 1.4em; font-size: 78%; } #comments-block dd p { margin: 0 0 .75em; } .deleted-comment { font-style:italic; color:gray; } .feed-links { clear: both; line-height: 2.5em; } #blog-pager-newer-link { float: left; } #blog-pager-older-link { float: right; } #blog-pager { text-align: center; } /* Sidebar Content ----------------------------------------------- */ .sidebar h2 { margin: 1.6em 0 .5em; padding: 4px 5px; background-color: #619bb8; font-size: 100%; color: #333333; } .sidebar ul { margin: 0; padding: 0; list-style: none; } .sidebar li { margin: 0; padding-top: 0; padding-right: 0; padding-bottom: .5em; padding-left: 15px; text-indent: -15px; line-height: 1.5em; } .sidebar { color: #000000; line-height:1.3em; } .sidebar .widget { margin-bottom: 1em; } .sidebar .widget-content { margin: 0 5px; } /* Profile ----------------------------------------------- */ .profile-img { float: left; margin-top: 0; margin-right: 5px; margin-bottom: 5px; margin-left: 0; padding: 4px; border: 1px solid #cccccc; } .profile-data { margin:0; text-transform:uppercase; letter-spacing:.1em; font-weight: bold; line-height: 1.6em; font-size: 78%; } .profile-datablock { margin:.5em 0 .5em; } .profile-textblock { margin: 0.5em 0; line-height: 1.6em; } /* Footer ----------------------------------------------- */ #footer { clear: both; text-align: center; color: #000000; } #footer .widget { margin:.5em; padding-top: 20px; font-size: 85%; line-height: 1.5em; text-align: left; } /** Page structure tweaks for layout editor wireframe */ body#layout #header { width: 750px; } --></style> <link href='https://www.blogger.com/dyn-css/authorization.css?targetBlogID=7803021&amp;zx=ad268ed2-a485-4480-8ac7-040cc16a4bf1' media='none' onload='if(media!=&#39;all&#39;)media=&#39;all&#39;' rel='stylesheet'/><noscript><link href='https://www.blogger.com/dyn-css/authorization.css?targetBlogID=7803021&amp;zx=ad268ed2-a485-4480-8ac7-040cc16a4bf1' rel='stylesheet'/></noscript> <meta name='google-adsense-platform-account' content='ca-host-pub-1556223355139109'/> <meta name='google-adsense-platform-domain' content='blogspot.com'/> </head> <body> <div class='navbar section' id='navbar'><div class='widget Navbar' data-version='1' id='Navbar1'><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d7803021\x26blogName\x3dNeal+Gafter\x27s+blog\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dLAYOUTS\x26searchRoot\x3dhttps://gafter.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttps://gafter.blogspot.com/\x26targetPostID\x3d109597019009549811\x26blogPostOrPageUrl\x3dhttps://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html\x26vt\x3d-1974019169439990134', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe", messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER, messageHandlers: { 'blogger-ping': function() {} } }); } }); </script><script type="text/javascript"> (function() { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = '//pagead2.googlesyndication.com/pagead/js/google_top_exp.js'; var head = document.getElementsByTagName('head')[0]; if (head) { head.appendChild(script); }})(); </script> </div></div> <div id='outer-wrapper'><div id='wrap2'> <!-- skip links for text browsers --> <span id='skiplinks' style='display:none;'> <a href='#main'>skip to main </a> | <a href='#sidebar'>skip to sidebar</a> </span> <div id='header-wrapper'> <div class='header section' id='header'><div class='widget Header' data-version='1' id='Header1'> <div id='header-inner'> <div class='titlewrapper'> <h1 class='title'> <a href='https://gafter.blogspot.com/'> Neal Gafter's blog </a> </h1> </div> <div class='descriptionwrapper'> <p class='description'><span>Thoughts about Programming Languages, Science and Philosophy.</span></p> </div> </div> </div></div> </div> <div id='content-wrapper'> <div id='main-wrapper'> <div class='main section' id='main'><div class='widget Blog' data-version='1' id='Blog1'> <div class='blog-posts hfeed'> <div class="date-outer"> <h2 class='date-header'><span>Thursday, September 23, 2004</span></h2> <div class="date-posts"> <div class='post-outer'> <div class='post'> <a name='109597019009549811'></a> <h3 class='post-title'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html'>Puzzling Through Erasure: answer section</a> </h3> <div class='post-header-line-1'></div> <div class='post-body'> <p><p><em>Erasure</em> is the technique that Java 5 uses to implement generics.&nbsp; Basically, the javac compiler performs its type-checking and then erases, or removes, the generic type information from the runtime representation.&nbsp; <em>Reification</em>, on the other hand, is the opposite.&nbsp; A generics implementation based on reification retains the type parameters at runtime as first-class entities, which allows it to perform certain type-based language and reflective operations on type parameters.&nbsp; Sun chose to implement generics using erasure.&nbsp; C# implements generics using reification.&nbsp; A number of questions about <em>erasure</em> and <em>reification</em> have been raised in the context of the new version of the Java language, and misunderstanding and misinformation abounds.&nbsp; I hope this note will help illuminate the issues.</p> <p>Why did Sun go with an erasure scheme to implement generics, rather than reifying type parameters as is done in C#? This is perhaps one of the least understood aspects of the Java generics design, but it is a natural conseqence of the design goals of the language extension. The goal was to provide backwards compatibility of both source and object code, and also <em>migration</em> compatibility. The meaning of backwards compatibility is pretty obvious: you want existing source and class files to continue to be legal and continue to mean what they meant before. Although the definition of backwards compatibility is clear, it is actually very hard to change the language without violating it. </p> <p>The other design constraint is migration compatibility, and this is a big one. I'll explain it by way of an example. </p> <h4>Migration Compatibility</h4> <p>Migration compatibility is the first constraint among the <a href="http://www.jcp.org/en/jsr/detail?id=14">requirements (in section 2.5) for jsr14's design for a generic extension to java</a>: </p> <blockquote> C1) Upward compatibility with existing code. Pre-existing code must work on the new system. This implies not only upward compatibility of the class file format, but also interoperability of old applications with parameterized versions of pre-existing libraries, in particular those used in the platform library and in standard extensions. </blockquote> <p>Consider the following software vendors: Company A sells a Java library for manipulating Audio. Company B sells a Java library for controlling electronic Bugles (I think this product would be called <a href="http://www.minibite.com/oldies/boogiewoogie.htm">Boogie Woogie Boy</a>). Company C sells a software product that is an electronic Bugle which is built on the libraries from A and B. C's customers would normally license all three products. </p> <p>Along comes JDK5, and these companies naturally want to migrate to generics. Companies A and B are in the comfortable position of being at the bottom of this software stack, and can immediately begin developing new versions of their APIs and libraries that take advantage of the new language features. Being a new release of the product, Company A would naturally also add new features. Their new API is called A2. Customers who require library A, for example because they have not modified their source to take advantage of generics yet, can still license it. </p> <p>Company B, similarly, ships two libraries B and B2. </p> <p>What does company C do? First, they cannot migrate to the new version of these libraries until the new libraries are available. And once they are available, C will want to migrate, for two reasons. First, it improves their software development process to use the improved language features. Second, their future customers might license the new (rather than the old) libraries A2 and B2. So company C provides two versions of their product, the old version C based on A and B, and C2 based on A2 and B2. </p> <p>Shortly after releasing C2 (and settling the inevitable trademark infringement lawsuit with <a href="http://www.coca-cola.com/">Coca Cola</a>) Company C discovers that it has left a huge number of its customers out in the cold. These are customers who have licensed the new version of one of the libraries A or B, but not new versions of both. Neither of C's products will work with these combinations. So Company C promptly provides C2a and C2b, two new versions of their product for this subset of customers. </p> <p>Things only get worse as we move up the software stack. First, it will be a very long time before everyone can migrate fully to the new APIs. Second, as a library writer you either require your customers to use the latest version of everything and deprecate your old APIs, or you support an astronomical number of variations of the underlying layers. If you're in the enviable position of controlling the entire software stack then this is no big deal -- except perhaps to your customers. Sun is not in that position and this situation is clearly unacceptable. </p> <p>This is where migration compatibility comes in. Migration compatibility requires that the generic version of an API be <em>compatible</em> with the old version, in the sense that existing clients will continue to compile (for source) and run (for binaries). This requirement constrains the design space significantly.</p> <p>In a system that support migration compatibility, Companies A and B can independently retrofit their libraries with generics, and their customers will be able to use the new library without modifying their source code, even without recompiling it. But those customers only gain the benefit of generics in those libraries when they begin placing type parameters on the generic types. But Companies A and B can now ship a single version of their library. </p> <p>We do not know how to satisfy this constraint in a system that also provides <em>reification</em>, that is, runtime access to type parameters. This is not for lack of trying. In fact, we've explored the design space enough to conjecture that it simply can't be done. The details of that exploration are very interesting but far beyond the scope of this note. <a href="http://mindview.net/WebLog/log-0058">Bruce Eckel's <em>injection</em> idea</a> is often proposed as a starting point, as is <a href="http://www.cs.rice.edu/%7Ejavaplt/nextgen/doc/">NextGen</a>. Neither supports migration compatibility. </p> <h4>Backwards compatibility is hard</h4> <p>I mentioned earlier that even though the phrase "backwards compatibility" is easier to understand than migration compatibility, it is not easy to extend the language without breaking compatibility. Let's take, for example, Bruce's suggestion that some future version of Java would begin reifying type parameters and stop using erasure. His idea is that constructor invocations for generic classes would pass one or more extra parameters - type information for the instantiation's type parameters - which would be stored in the instance. </p> <p>Setting aside the some very difficult implementation and performance issues (do you really want every linked list node to double in size? How do you implement <tt>instanceof</tt> for generic interfaces? How do you implement array store checks?), this isn't really backward compatible. The fundamental problem is that existing Java 5 class files don't follow that convention, and so won't interoperate with new code. Existing code that instantiates <tt>Foo&lt;String&gt;</tt> doesn't in fact pass the extra parameter. Existing subclasses of <tt>Foo</tt> don't pass such data on to the superclass constructor. Existing implementations of a <tt>Foo&lt;T&gt;</tt> interface don't expect to receive that extra parameter in the constructor. </p> <p>I would also like to address some other misconceptions Bruce Eckel's two latest blog entries <a href="http://mindview.net/WebLog/log-0057">here</a> and <a href="http://mindview.net/WebLog/log-0058">here</a>. </p> <h4>Why can't I "new T()"?</h4> <p>For a type parameter <tt>T</tt>, the reason you can't do a "<tt>new T()</tt>" is because not every type has a no-arg constructor. I know Bruce is a big fan of what he calls "latent typing", and he would prefer to get such errors at runtime. But Java is a statically typed language, for better or worse, and you simply can't invoke a no-arg constructor on a type that isn't statically known to have one. It's also true that due to erasure there would be no way to generate this code, but for this construct that is beside the point. </p> <h4>What is the point of type parameters if they are erased</h4> <p>Static type checking! To belabor the point, if you're someone who prefers what Bruce calls latent typing, then you care about what you can do with a type at runtime more than the compile-time utility. If that's the case, any extension to the static type system is ho-hum uninteresting and not worth the brain cycles needed to understand it. </p> <p>But for those of us who want to rely on the compiler to help us get our programs statically correct and prefer our errors be reported early, generics are a huge win. Generics can save you a great deal of work and mental energy that used to be necessary mediating untyped collections with a program that works with concrete types. </p> <h4>How do I create an array of T?</h4> <p>There are two answers - a cheat that isn't typesafe but works in many situations, and a correct answer. Bruce found the cheat, and it's unfortunate that it is widely being copied as the "correct" way to do things. At the risk of sending the wrong message, the cheat is as follows: </p> <pre> T[] a = (T[]) new Object[N]; // Bad style!<br></pre> <p>When you do this sort of thing the compiler will rightfully complain. After all, an <tt>Object</tt> array isn't a <tt>T</tt> array unless <tt>T</tt> happens to be <tt>Object</tt>. You shouldn't ignore this compiler warning. In fact, what you've written here is very dangerous. If you have a method in the API that returns a <tt>T[]</tt> and you return this value, and you have a client for which <tt>T==String</tt> who tries to store it into a variable of type <tt>String[]</tt>, you will get a <tt>ClassCastException</tt> at runtime. </p> <p>But wait, you say, this kind of thing appears in the Collections implementation! So it must be the approved, accepted, proper approach. No. Mea culpa. I was lazy. It would have been better for me to use an <tt>Object</tt> array inside the collection, and add a cast (yes, to <tt>T</tt>) everywhere necessary when an element is removed from the array. In general, this cast is elided by javac and moved into the non-generic client, both by virtue of compiling by erasure. But you still get a complaint from the compiler on each cast. This warning is unavoidable, because at runtime existing clients simply do not provide enough type information to do the cast correctly. That's not due to erasure, it's due to language evolution. </p> <p>But that's not the correct solution. The correction solution requires that you design your API to be aware of generics (unfortunately not possible when retrofitting an exising class) and relies on using the idea of a <em>type token</em>, which I introduced along with the generification of the core APIs. See <a href="http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf">section 8 of Gilad Bracha's Generics Tutorial</a> for more details, as well as the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#checkedCollection%28java.util.Collection,%20java.lang.Class%29">checked collection wrappers in JDK5</a> for a straightforward example. If you're designing an API in which you really, really wish that type parameters were not erased, you can achieve almost the same effect as follows: </p> <pre> class Generic&lt;T&gt; { final private Class&lt;T&gt; tClass; public Generic(Class&lt;T&gt; tClass) { this.tClass = tClass; } }</pre> <p>Now you can instantiate using reflection (<tt>tClass.newInstance()</tt>), create arrays (<tt>Array.newInstance</tt>), cast (<tt>Class.cast</tt>), and do instanceof tests (<tt>Class.isInstance</tt>), though with a slightly different syntax than you might prefer. </p> <p>This technique allows you to get the effect of what Bruce calls "type injection", almost undoing the erasure yourself. Why do I say "almost"? I'll leave that as a puzzle for you to think about. One hint: just as you feared, it has something to do with erasure. </p> <h4>Why can't I put bounds on an instantiation?</h4> <p>What would it mean? If you were able to make a new <tt>List&lt;? extends Foo&gt;()</tt>, then you could place into that list a <tt>Foo</tt> or any subclass of <tt>Foo</tt>. But a sublcass of <tt>Foo</tt> is also a <tt>Foo</tt>, so you could also use a <tt>List&lt;Foo&gt;</tt> for the same purpose. In short, <tt>new List&lt;? extends Foo&gt;()</tt> would mean the same thing as <tt>new List&lt;Foo&gt;()</tt>. </p> <p>To look at it another way, consider method parameters. You can put a type on a method's value parameter, where the parameter's name is defined, but not on an argument to a method call, which is an expression. The same is true of type parameters and arguments: you can put a bound on the type parameter, where its name is defined, but not on the type argument. </p> <h4>Why do you say that C# breaks compatibility with their generics system?</h4> <p>The short answer is: I don't.</p> <p>Microsoft is essentially deprecating the old collections classes by introducing a new, preferred set of generic collections classes. They are creating the kinds of problems described in the Company A-B-C scenario, only it might just be less of a problem for them because they control so much more of the software stack. I do not claim that they break backward compatibility. In fact, generally speaking I prefer reification when it doesn't conflict with the design goals. The other disadvantage (besides abandoning migration compatibility) that I see in the <tt>C#</tt> approach is that it is hard to reconcile with both the bipartite type system and wildcards, though perhaps that problem could be solved. </p> <p>You might not agree with migration compatibility as a goal for the generics extension to Java. That would have been very useful feedback in 1999 when jsr14 was formed, and in fact the issue was discussed at great length at the time. Whatever your feelings, I hope you agree that now, a month before the product ships, is a poor time to reconsider the most fundamental design goals that were set five years earlier for the product and on which the existing design and implementation depends deeply. </p></p> <div style='clear: both;'></div> </div> <div class='post-footer'> <p class='post-footer-line post-footer-line-1'><span class='post-comment-link'> </span> <span class='post-icons'> </span> <span class='post-backlinks post-comment-link'> </span> </p> <p class='post-footer-line post-footer-line-2'></p> <p class='post-footer-line post-footer-line-3'></p> </div> </div> <div class='comments' id='comments'> <a name='comments'></a> <h4>10 comments:</h4> <div id='Blog1_comments-block-wrapper'> <dl class='avatar-comment-indent' id='comments-block'> <dt class='comment-author ' id='c109607485623435664'> <a name='c109607485623435664'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="//resources.blogblog.com/img/blank.gif" width="35" height="35" alt="" title="Anonymous"> </span></div> Anonymous said... </dt> <dd class='comment-body' id='Blog1_cmt-109607485623435664'> <p> Thanks for the clarification.<br /><br />-tinou </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1096074840000#c109607485623435664' title='comment permalink'> September 24, 2004 6:14 PM </a> <span class='item-control blog-admin pid-212544397'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=109607485623435664' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author ' id='c109616065838166335'> <a name='c109616065838166335'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="//resources.blogblog.com/img/blank.gif" width="35" height="35" alt="" title="Anonymous"> </span></div> Anonymous said... </dt> <dd class='comment-body' id='Blog1_cmt-109616065838166335'> <p> Hi Neal,<br /><br />I re-read your explanation. The thing that I would like to know is how common is the migration compatibility issue you talk about. I personally haven't faced this issue (using multiple vendor libraries), and would like to know if this is base on actual cases or more of dealing with potential problems.<br /><br />- tinou </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1096160640000#c109616065838166335' title='comment permalink'> September 25, 2004 6:04 PM </a> <span class='item-control blog-admin pid-212544397'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=109616065838166335' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author blog-author' id='c109625923534973888'> <a name='c109625923534973888'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><a href="https://www.blogger.com/profile/08579466817032124881" target="" rel="nofollow" onclick="" class="avatar-hovercard" id="av-109625923534973888-08579466817032124881"><img src="//www.blogger.com/img/blogger_logo_round_35.png" width="35" height="35" alt="" title="Neal Gafter"> </a></span></div> <a href='https://www.blogger.com/profile/08579466817032124881' rel='nofollow'>Neal Gafter</a> said... </dt> <dd class='comment-body' id='Blog1_cmt-109625923534973888'> <p> If we had actual cases where this had occurred then it would be too late to do anything about it. </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1096259220000#c109625923534973888' title='comment permalink'> September 26, 2004 9:27 PM </a> <span class='item-control blog-admin pid-1177465903'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=109625923534973888' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author ' id='c109635494914751494'> <a name='c109635494914751494'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="//resources.blogblog.com/img/blank.gif" width="35" height="35" alt="" title="Anonymous"> </span></div> Anonymous said... </dt> <dd class='comment-body' id='Blog1_cmt-109635494914751494'> <p> oops, i re-read my question and of course there are no actual cases. what i was trying to gauge was the reasons/origins behind the upward compatibility requirement, whether it was base on actual past experiences (in another language) or whether this really hasn't been a problem in programming/software but Sun felt it might be a problem.<br /><br />-tinou </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1096354920000#c109635494914751494' title='comment permalink'> September 28, 2004 12:02 AM </a> <span class='item-control blog-admin pid-212544397'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=109635494914751494' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author ' id='c109710513658921538'> <a name='c109710513658921538'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="//resources.blogblog.com/img/blank.gif" width="35" height="35" alt="" title="Anonymous"> </span></div> Anonymous said... </dt> <dd class='comment-body' id='Blog1_cmt-109710513658921538'> <p> The problem of migration is, I think, universal among any developer of a large system. Even if your code is entirely autochthonous, it would not be practical to migrate your whole codebase to effectively a new language in one shot. The existing code must be maintained, and all the changes have to be ported over, and then some day, there has to be a big jump. It just isn't realistic.<br /><br />What would really happen is that you would establish a separate project for the migration; over a period of time, the original code would drift, some changes would be successfully ported, others wouldn't, and then when the Big Day arrived, a lot of features would be lost and your customers would be screaming. Or more likely, the migration project would simply be cancelled. </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1097105100000#c109710513658921538' title='comment permalink'> October 06, 2004 4:25 PM </a> <span class='item-control blog-admin pid-212544397'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=109710513658921538' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author ' id='c110487279840884804'> <a name='c110487279840884804'></a> <div class="avatar-image-container vcard"><span dir="ltr"><a href="https://www.blogger.com/profile/06720855854674480999" target="" rel="nofollow" onclick="" class="avatar-hovercard" id="av-110487279840884804-06720855854674480999"><img src="https://resources.blogblog.com/img/blank.gif" width="35" height="35" class="delayLoad" style="display: none;" longdesc="//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRI2ToJpUdcmeQd6DdORWGxgwHe3B-guUzkvKYX_onYZPsmW64vnCJaDLWqtTu_rROG4xbrAEaQAKnWEA6hWW7CMkEbgixHuKLB0Xo6JK-y-9GEcr7Ymq3EBr5wD23PQ/s45-c/me.jpg" alt="" title="Jordan Zimmerman"> <noscript><img src="//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRI2ToJpUdcmeQd6DdORWGxgwHe3B-guUzkvKYX_onYZPsmW64vnCJaDLWqtTu_rROG4xbrAEaQAKnWEA6hWW7CMkEbgixHuKLB0Xo6JK-y-9GEcr7Ymq3EBr5wD23PQ/s45-c/me.jpg" width="35" height="35" class="photo" alt=""></noscript></a></span></div> <a href='https://www.blogger.com/profile/06720855854674480999' rel='nofollow'>Jordan Zimmerman</a> said... </dt> <dd class='comment-body' id='Blog1_cmt-110487279840884804'> <p> Here and elsewhere I've seen your comment (and others') that the design goals required erasure. If so, then the design goals were severly flawed. Migration is a niche concern totally outweighed by how significantly hobbled Java Generics is with erasure. <br /><br />Having started to use Java Generics, I realize that it's a lot of trouble with very little benefit. I'm afraid that this is terribly botched. </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1104872760000#c110487279840884804' title='comment permalink'> January 04, 2005 1:06 PM </a> <span class='item-control blog-admin pid-755410661'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=110487279840884804' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author ' id='c115606653949099950'> <a name='c115606653949099950'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><img src="//resources.blogblog.com/img/blank.gif" width="35" height="35" alt="" title="Anonymous"> </span></div> Anonymous said... </dt> <dd class='comment-body' id='Blog1_cmt-115606653949099950'> <p> Time tells: I'm working with a large 1.4 codebase and I say it's wonderful to just pretend it was generified. OTOH, I feel little use for reified type parameters (very occasionally I have to pass a class object). I say you made a very reasonable choice.<BR/><BR/>"Unchecked" warnings are too prominent, though. I can't sprinkle @SuppressWarnings everywhere. Must ... tame ... IDE.<BR/><BR/>Matthias </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1156066500000#c115606653949099950' title='comment permalink'> August 20, 2006 2:35 AM </a> <span class='item-control blog-admin pid-212544397'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=115606653949099950' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author ' id='c1945207580509111524'> <a name='c1945207580509111524'></a> <div class="avatar-image-container vcard"><span dir="ltr"><a href="https://www.blogger.com/profile/14796620278704618972" target="" rel="nofollow" onclick="" class="avatar-hovercard" id="av-1945207580509111524-14796620278704618972"><img src="https://resources.blogblog.com/img/blank.gif" width="35" height="35" class="delayLoad" style="display: none;" longdesc="//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSSH_TNVFO75tFUEKWAjY_w0qAJG8tCGlfHfMZGM0HaEp-y-sYnThMwZCE31A_EsO1Sy-j2-RuM5bVb_tIDMTEKG06NJdhNpzQi6A0EIAsioV1_Kau2ez6vNL3ZV4Ja0M/s45-c/Craig.jpg" alt="" title="Craig S."> <noscript><img src="//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSSH_TNVFO75tFUEKWAjY_w0qAJG8tCGlfHfMZGM0HaEp-y-sYnThMwZCE31A_EsO1Sy-j2-RuM5bVb_tIDMTEKG06NJdhNpzQi6A0EIAsioV1_Kau2ez6vNL3ZV4Ja0M/s45-c/Craig.jpg" width="35" height="35" class="photo" alt=""></noscript></a></span></div> <a href='https://www.blogger.com/profile/14796620278704618972' rel='nofollow'>Craig S.</a> said... </dt> <dd class='comment-body' id='Blog1_cmt-1945207580509111524'> <p> Well, I highly disagree with the decision to use erasure over reification, but it&#39;s been in Java for at least 3 different releases now (JRE 1.7 is available now), so I guess it&#39;s more or less water over the dam.<br /><br />I wanted to clarify one point in regards to MS&#39;s decision to use reificiation with .NET. While it is true that the decision to use reification does cause &quot;breaking changes&quot; for forward migration of code, MS handled the problem in a way that greatly reduced this problem and did not require significant changes to existing code. As you mentioned, they implemented all new generic collections in a new namespace and prefers that developers use these new collection classes over the older non-generic collection classes. How can they do this and still keep forward migration problems to a minimum? In their BCL, every generic class that implements a generic version of a previously existing collection class implements two interfaces: the non-generic interface and the new generic interface; i.e. ICollection&lt;T&gt; and ICollection, for example. In this way, the BCL generic collections are &quot;forward migration&quot; compatible with older code.<br /><br />It is also MS&#39;s suggestion to API and framework developers that when developing your own generic classes that you implement both the generic interfaces as well as the non-generic interfaces in order to have the highest compatibility.<br /><br />This was a great decision on their part because it does provide for forward migration (as far as I can see). Since the old collection classes are still present, older code can still use them. And since the new collection classes implement the older interfaces, they can still &quot;act like&quot; older collections, when needed. <br /><br />The bad part, if you can say that, is that now programmers must be sure to implement both interfaces. But I see this as a very small trade-off in order to have reification which provides me not only with static type-checking at compile time, but also strongly-type objects at runtime. </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1329157036459#c1945207580509111524' title='comment permalink'> February 13, 2012 10:17 AM </a> <span class='item-control blog-admin pid-582636718'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=1945207580509111524' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author ' id='c2141767066755812585'> <a name='c2141767066755812585'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><a href="https://www.blogger.com/profile/13219237889931824974" target="" rel="nofollow" onclick="" class="avatar-hovercard" id="av-2141767066755812585-13219237889931824974"><img src="//www.blogger.com/img/blogger_logo_round_35.png" width="35" height="35" alt="" title="Unknown"> </a></span></div> <a href='https://www.blogger.com/profile/13219237889931824974' rel='nofollow'>Unknown</a> said... </dt> <dd class='comment-body' id='Blog1_cmt-2141767066755812585'> <p> HI ,<br /><br />I have through your article.<br /><br />Ob=new T(); //Error<br /><br />This above line would be converted into below line as T is unbounded type here<br /><br />Ob=new Object(); <br /><br />Here as you know that Object() has default constructor,why compiler not able to find default constructor for this.Why compiler throwing error.<br /><br /><br /><br /> </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1471195408705#c2141767066755812585' title='comment permalink'> August 14, 2016 10:23 AM </a> <span class='item-control blog-admin pid-1151852037'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=2141767066755812585' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> <dt class='comment-author blog-author' id='c8292711674050684901'> <a name='c8292711674050684901'></a> <div class="avatar-image-container avatar-stock"><span dir="ltr"><a href="https://www.blogger.com/profile/08579466817032124881" target="" rel="nofollow" onclick="" class="avatar-hovercard" id="av-8292711674050684901-08579466817032124881"><img src="//www.blogger.com/img/blogger_logo_round_35.png" width="35" height="35" alt="" title="Neal Gafter"> </a></span></div> <a href='https://www.blogger.com/profile/08579466817032124881' rel='nofollow'>Neal Gafter</a> said... </dt> <dd class='comment-body' id='Blog1_cmt-8292711674050684901'> <p> Hey, alakhya jain, In a Generic, a method that returns a T should return an Integer, not an Object. </p> </dd> <dd class='comment-footer'> <span class='comment-timestamp'> <a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html?showComment=1481862160312#c8292711674050684901' title='comment permalink'> December 15, 2016 8:22 PM </a> <span class='item-control blog-admin pid-1177465903'> <a class='comment-delete' href='https://www.blogger.com/delete-comment.g?blogID=7803021&postID=8292711674050684901' title='Delete Comment'> <img src='https://resources.blogblog.com/img/icon_delete13.gif'/> </a> </span> </span> </dd> </dl> </div> <p class='comment-footer'> <a href='https://www.blogger.com/comment/fullpage/post/7803021/109597019009549811' onclick=''>Post a Comment</a> </p> </div> </div> </div></div> </div> <div class='blog-pager' id='blog-pager'> <span id='blog-pager-newer-link'> <a class='blog-pager-newer-link' href='https://gafter.blogspot.com/2005/02/java-puzzlers-is-coming.html' id='Blog1_blog-pager-newer-link' title='Newer Post'>Newer Post</a> </span> <a class='home-link' href='https://gafter.blogspot.com/'>Home</a> </div> <div class='clear'></div> <div class='post-feeds'> </div> </div></div> </div> <div id='sidebar-wrapper'> <div class='sidebar section' id='sidebar'><div class='widget BlogArchive' data-version='1' id='BlogArchive1'> <h2>Blog Archive</h2> <div class='widget-content'> <div id='ArchiveList'> <div id='BlogArchive1_ArchiveList'> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2024/'> 2024 </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2024/09/'> September </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2023/'> 2023 </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2023/08/'> August </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2020/'> 2020 </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2020/12/'> December </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2019/'> 2019 </a> <span class='post-count' dir='ltr'>(2)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2019/11/'> November </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2019/08/'> August </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2017/'> 2017 </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2017/06/'> June </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2016/'> 2016 </a> <span class='post-count' dir='ltr'>(7)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2016/02/'> February </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2016/01/'> January </a> <span class='post-count' dir='ltr'>(6)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2015/'> 2015 </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2015/12/'> December </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2014/'> 2014 </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2014/11/'> November </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2010/'> 2010 </a> <span class='post-count' dir='ltr'>(2)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2010/08/'> August </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2010/02/'> February </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2009/'> 2009 </a> <span class='post-count' dir='ltr'>(2)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2009/03/'> March </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2009/02/'> February </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2008/'> 2008 </a> <span class='post-count' dir='ltr'>(4)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2008/08/'> August </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2008/03/'> March </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2008/02/'> February </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2008/01/'> January </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/'> 2007 </a> <span class='post-count' dir='ltr'>(18)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/12/'> December </a> <span class='post-count' dir='ltr'>(2)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/11/'> November </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/10/'> October </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/07/'> July </a> <span class='post-count' dir='ltr'>(2)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/05/'> May </a> <span class='post-count' dir='ltr'>(2)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/04/'> April </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/03/'> March </a> <span class='post-count' dir='ltr'>(4)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/02/'> February </a> <span class='post-count' dir='ltr'>(1)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2007/01/'> January </a> <span class='post-count' dir='ltr'>(4)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2006/'> 2006 </a> <span class='post-count' dir='ltr'>(20)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2006/12/'> December </a> <span class='post-count' dir='ltr'>(4)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2006/11/'> November </a> <span class='post-count' dir='ltr'>(4)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2006/10/'> October </a> <span class='post-count' dir='ltr'>(3)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2006/09/'> September </a> <span class='post-count' dir='ltr'>(5)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2006/08/'> August </a> <span class='post-count' dir='ltr'>(4)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2005/'> 2005 </a> <span class='post-count' dir='ltr'>(2)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> &#9658;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2005/02/'> February </a> <span class='post-count' dir='ltr'>(2)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> &#9660;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2004/'> 2004 </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> &#9660;&#160; </span> </a> <a class='post-count-link' href='https://gafter.blogspot.com/2004/09/'> September </a> <span class='post-count' dir='ltr'>(1)</span> <ul class='posts'> <li><a href='https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html'>Puzzling Through Erasure: answer section</a></li> </ul> </li> </ul> </li> </ul> </div> </div> <div class='clear'></div> </div> </div><div class='widget Profile' data-version='1' id='Profile1'> <h2>About Me</h2> <div class='widget-content'> <dl class='profile-datablock'> <dt class='profile-data'> <a class='profile-name-link g-profile' href='https://www.blogger.com/profile/08579466817032124881' rel='author' style='background-image: url(//www.blogger.com/img/logo-16.png);'> Neal Gafter </a> </dt> <dd class='profile-textblock'>Neal Gafter is a Computer Programming Language Designer and Implementer, Amateur Scientist and Philosopher. He works on the Rel compiler at Relational.AI. He previously worked for Microsoft on C#, for Google on Calendar, and for Sun Microsystems on Java. Neal was granted an OpenJDK Community Innovators' Challenge award for his design and implementation of lambda expressions for Java. He is coauthor of <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em> (Addison Wesley, 2005). He was a member of the C++ Standards Committee and led the development of C and C++ compilers at Sun Microsystems, Microtec Research, and Texas Instruments. He holds a Ph.D. in computer science from the University of Rochester.</dd> </dl> <a class='profile-link' href='https://www.blogger.com/profile/08579466817032124881' rel='author'>View my complete profile</a> <div class='clear'></div> </div> </div></div> </div> <!-- spacer for skins that want sidebar and main to be the same height--> <div class='clear'>&#160;</div> </div> <!-- end content-wrapper --> <div id='footer-wrapper'> <div class='footer no-items section' id='footer'></div> </div> </div></div> <!-- end outer-wrapper --> <script src="//www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type='text/javascript'> _uacct = "UA-605497-1"; urchinTracker(); </script> <script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/984859869-widgets.js"></script> <script type='text/javascript'> window['__wavt'] = 'AOuZoY4OWdu5SdaActY7_1WmBIxOicHIew:1733053820197';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d7803021','//gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html','7803021'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '7803021', 'title': 'Neal Gafter\x27s blog', 'url': 'https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html', 'canonicalUrl': 'http://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html', 'homepageUrl': 'https://gafter.blogspot.com/', 'searchUrl': 'https://gafter.blogspot.com/search', 'canonicalHomepageUrl': 'http://gafter.blogspot.com/', 'blogspotFaviconUrl': 'https://gafter.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en', 'localeUnderscoreDelimited': 'en', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': false, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Neal Gafter\x26#39;s blog - Atom\x22 href\x3d\x22https://gafter.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22Neal Gafter\x26#39;s blog - RSS\x22 href\x3d\x22https://gafter.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Neal Gafter\x26#39;s blog - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/7803021/posts/default\x22 /\x3e\n\n', 'meTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': false, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/2fafd358a4bcb2b4', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': 'Share to X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'item', 'postId': '109597019009549811', 'pageName': 'Puzzling Through Erasure: answer section', 'pageTitle': 'Neal Gafter\x27s blog: Puzzling Through Erasure: answer section'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard!', 'ok': 'Ok', 'postLink': 'Post Link'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': 'Custom', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'Puzzling Through Erasure: answer section', 'description': 'Erasure is the technique that Java 5 uses to implement generics.\xa0 Basically, the javac compiler performs its type-checking and then erases,...', 'url': 'https://gafter.blogspot.com/2004/09/puzzling-through-erasure-answer.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 109597019009549811}}]); _WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar', document.getElementById('Navbar1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/2646514562-lbx.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/1964470060-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Loading\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_ProfileView', new _WidgetInfo('Profile1', 'sidebar', document.getElementById('Profile1'), {}, 'displayModeFull')); </script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10