I've recently adopted the practice of adding inline comments to Collections,
Maps, etc., to indicate what types they contain:  List /* <String> */
getEmailAddresses(), Map /* <String -> Object> */ getParameters(), etc.

I don't want to turn this into a discussion of the proposed java generics
spec/implementation, but I would like to discuss what Idea could do to
support this.  What would it take to augment Idea's internal typing rules to
track the contained types?  What could Idea do with this knowledge that
would help you write better code?

I was trying to answer this question, but I guess it really depends on what
can easily be implemented.  At the one end of the spectrum is full support
for generics (well, at least as full as the upcoming generics spec allows) -
Idea could give me errors or warnings if I try to pull a Number out of a
List /* <String> */, or if I pass a List /* <Object> */ to a method that
expects List /* <Foo> */.  At the other end of the spectrum is nothing at
all (and I'm extremely happy with Idea right now, with nothing at all in
terms of generics support).  Somewhere inbetween is the ability for Idea to
guess the contained type based on comments like these, or built-in support
for the "gj" java compiler (is this still around/maintained?).

Does/could the open API expose enough of the information about the code to
facilitate a useful plugin here?  What would the plugin do?

mike


_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://lists.jetbrains.com/mailman/listinfo/eap-features

Reply via email to