Friday, July 15, 2011

Generics Suck

Never before have I experienced such rage and failure with Java as I did this week at work. Blah.

Not only did I find finding documentation about it difficult but talking to someone about it proved almost too much. I suck more at knowing the vocabulary then I normally do.

I'm having difficulty articulating what exactly one of the problems was... It had to do with the fact that :
List<subclass> extends List<superclass>
doesn't really work, you need:
List<subclass> extends List<? extends superclass>

All my method and class signatures got super bloated and became obnoxious to read.

Also, while this didn't really factor into how I was fixing the problem, I was boggled to learn something new about the Java language. I may not be great at a lot of things, but to find something totally new after a couple years working with it is... surprising. And perhaps sad.

Anyway, did you know that you can pass type parameters to a method? Like:
fooObject.<X,Y>barMethod();
Woaaaah! Crazy! I'm used to only seeing instance variables and constructors use the <>s when declaring something...

In other news, in other areas where I suck less, I still haven't killed any of my bottled plants. In fact, several seem to be thriving.

Sadly the lettuce (not pictured) is getting rather wilty... so that'll probably be my second failure-- the first being that the catnip NEVER SPROUTED. Everything else I've grown from seed just fine, but the catnip refuses to wake up. Damn.

1 comment:

  1. I am just starting grails (java web framework) for a project at work. I'm liking actually getting back to coding! Real code! Not HTML! Or Javascript!

    ReplyDelete