[jboss-dev-forums] [Design the new POJO MicroContainer] - Source code tidyup MC project - MetaType generics

adrian@jboss.org do-not-reply at jboss.com
Mon Feb 18 15:35:57 EST 2008


The MC project had got into a bit of a mess with over 2000 warnings
in my eclipse workspace. It was taking forever to compile/load the projects with
it using so much memory. :-)

Most of them were javadoc or incorrect use of generics.

I've managed to get rid of all but 48 of them. The remaining ones are in the
generated code of the OSGi parser.

Boy did that take longer than expected. ;-)

Anyway. while I was doing it, it occurred to me that the generics
in the MetaType project are mostly useless.
I experimented with getting rid of them altogether. By doing that
I can see only two use cases, one of which is pointless.

1) There is <T extends Serializable) but the same thing is easily achieved
with the setValuie(Serializable value) on the MetaValue.

2) Being able to iterate over arrays (which looking at the tests
only works for single dimensional arrays). I don't see why this
is an important use case? In practice you won't know the array type
at compile time to make use of it?

In fact, it is impossible to write out a correct generic type for the more 
complicated Arrays, e.g. arrays of composite types.

The code looks a lot less cluttered without the generics.
Most places have to do MetaType<?> anyway.
So should we bite the bullet and remove the generics, or does somebody
think they are useful?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130217#4130217

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130217



More information about the jboss-dev-forums mailing list