Posts Tagged whining

lame java collection erasure problem

Just ran into an example of where Java’s dumb erasure strategy just didn’t cut it.

I wrote a small class to collect up vararg junk into typed collections, something like:

public class Collector {
    public Collection collect( typename... vs ) {...}
    public Collection collect( Collection collection, typename... vs ) {...}
};

This worked fine up until the point where the typename was a typed collection, at which point the second method was invoked instead.

My work around was to rename the latter to “collectInto”

Lame…

Advertisements

Leave a Comment

dear maven, yes! I want to use fckng java 1.5 generics, you ass!

OMG! I am so…. tired of doing this for every new archetype’d project:

<build>
	<plugins>
		<plugin>
			<!-- seriously? -->
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<configuration>
				<source>1.5</source>
				<target>1.5</target>
			</configuration>
		</plugin>
	</plugins>
</build>

The gnashing of teeth!

Leave a Comment