Name clash: The method BLAH has the same erasure as type BLAH but does not override it
I was getting the following error in Eclipse IDE 3.1 and Java 1.5 (or 5.0 as some like to call it):
Name clash: The method removeEldestEntry(Map.Entry<K ,V>) of type LRUMap<K ,V> has the
same erasure as removeEldestEntry(Map.Entry<K , V>) of type LinkedHashMap<K , V> but does not
override it
The class in question looked like this:
class LRUMap <K , V> extends LinkedHashMap {
public LRUMap(){
super(10000, .75f, true);
}
protected boolean removeEldestEntry (Entry <K , V> eldest) {
return this.size() > 262144;
}
}
The problem is that I was extending LinkedHashMap without type parameters, not LinkedHashMap >K ,V<. Changing the code to:
class LRUMap <K , V> extends LinkedHashMap <K , V> {
public LRUMap(){
super(10000, .75f, true);
}
protected boolean removeEldestEntry (Entry <K , V> eldest) {
return this.size() > 262144;
}
}
completely fixed the problem! Type erasure is sure a pain, no? I should probably spend more time at home reading the Java Generics Tutorial.
One thing leads to another
I rarely write about my personal life on this blog, but this story is interesting enough to warrant the diversion.
This Christmas, I had carefully planned a trip home to Phoenix to visit my family. I was to fly out Friday evening, and return Wednesday morning. Then, I planned to spend a few days relaxing in NYC before going back to work. I have gifts for all my family members, and my grandparents who were in town for the warm Arizona winter season from icy Canada. A few of my friends from high school also wanted to see me.
Then something new, exciting, and amazing came up.

The girl I had started seriously dating offered to host me with her family in Shanghai. Wow. I was touched by the invitation, but at first I thought it was just a politeness. I checked it out anyway and found that I could buy a ticket from Phoenix to Shanghai on Tuesday, and returning to NYC the next Monday. I thought that if it were possible it would be the best week spent anywhere of my life–something I’d remember forever. When I came to understand that she really wanted me to come, I purchased those tickets and looked forward to the most lovely Christmas of my life!
Then, a minor mishap tumbled up all my plans.
I had to get a rush L tourist visa to visit China, so I went to the embassy in NYC, documents in hand, Friday. I was there when it opened, and they told me to come back at 2 PM. I didn’t realize that they closed there are 2:30 PM, because their website led me to believe something else, and because I was very tired at the time. When I came back they were closed. I couldn’t take the same flight home, and when I got back to Queens, I found by calling airlines and online that there were no tickets to Phoenix, and then back to NYC Monday night / Tuesday morning.
Calling Expedia I found that my Shanghai tickets were not actually issued yet, and that I could have them canceled and buy NYC to Shanghai tickets. So the new plan is to pick up my visa at 9 AM Tuesday, take a cab to JFK, and arrive in Shanghai later (much later, it’s a 16 hour flight) to spend the remainder of Christmas with my girlfriend and her family. I will visit my own family sometime later in February, since I still want to hand-deliver their presents. In spite of this trouble, I am determined to everything possible to make the trip to Wendy work.

At the end of it all, the experience is a jumbled mix of love, disappointment, excitement, my own incompetence, sacrifice, planning, fate, disruption, tranquility, and happiness. I lose the dollar amount of the flight to Phoenix, but I have a chance to see them soon to make it up. I lose the chance to spend Christmas with my family, but I gain the chance to have a wonderful time with Wendy.
Adsense Google Images Incorrect
There’s a UI bug in the new Google Adsense banners that include text links and the image logo. The problem is that the images do not inherit the correct background color:


As you can see in the contrast-enhanced image, the image retains a white background on top of whatever I specified. Where’s the famous Google attention to detail?
Merry Christmas
Merry Christmas Spam Email
Here are some actual spam emails I’ve received, about Merry Christmas, Happy Holidays, etc:
Warm thoughts and sincere wishes for a joyful and wonderful
Holiday Season and a New Year that brings you all the best
I love the animated snow. Of course, the next one is much less interesting:
Hi folks
I hope you and your families have a wonderful and blessed Christmas and a prosperous New Year
Take care
Then there’s the “you won for xmas” scams going around:
Dear Lucky Winner,
We happily announce to you the Xmas Lottery Bonanza draw Thursday 18th December, 2006. It is yet to be unclaimed and you are getting the final NOTIFICATION as regards this. Your e-mail address attached to ticket number: 56475600545 188 with Serial number 1037 drew the lucky numbers: 07-14-29-37-41-45-04 (bonus no.04), which subsequently won you the lottery in the 2nd category i.e. match 5 plus bonus.
Wow! Plz! Send me money!


