2 Replies Latest reply on Feb 28, 2008 6:17 AM by Adrian Brock

    Source code tidyup MC project - MetaType generics

    Adrian Brock Master

      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?