Hi Dave, et al.,
Tom Morris wrote:
- A corollary to the above, but complicated by our peculiar API
design, are warnings for untyped collections. Since all of our model
elements are opaque Objects, we have lots of these. I won't change a
List to a List<Object> because that's just silly when it's a
List<ModelElement> and I won't add an annotation to turn off the
warnings because I want to be able to find them if the API ever gets
fixed, so we've got lots of these polluting the source code.
There are many many warnings of this kind. In this instance, what is
wrong
with changing 'List' to 'List<ModelElement>'?
It won't compile. To preserve the opaqueness of the interface, the
JMI, MDR, and even the OMG types (a la
org.omg.uml.foundation.core.ModelElement) aren't visible through the
API. Everything's a lang.Object and nothing more. That's why I used
the word "peculiar."
Arguably the API should have been designed differently, but that's
before my time and ancient history by now. Using wrapper objects
might have been considered too heavyweight, but I bet something fancy
could have been done with reflection or byte code manipulation to
inject a org.argouml.uml.core.ModelElement interface and set of
wrapper methods. This would have had all kinds of benefits including
better type safety, a more friendly programming experience, etc, etc,
but it's probably not worth the effort at this point. If you were
going to go to this amount of work, you'd want to clean up the API,
split the enormous implementation modules, take into account
portability to UML 2.x, and a bunch of other things that would just
make it a giant task. The time to do it would have been when the API
facade was first put in place.
Tom
Indeed, but we are talking about warnings that urge us to replace something
like "List" with "List<Object>" - is there no way to suppress these
warnings?
Checkstyle is very much configurable...
Regards,
Michiel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]