I’m writing some Java2D code, and I notice that IDEA (my code editor) highlighted parts of my code:

Intelligent Code Analysis

Check out the caption at the bottom of the window. It turns out (as any good Java2D programmer knows) I’m reversing the width and height arguments — but how did IDEA know? Whether its lexical analysis or a special case built into the tool, wow! This kind of stuff is infinitely useful.

8 thoughts on “I Love Intelligent Tools…

  1. I’m not good Java2D programmer, can you explain me why IDEA highlighted that piece of code? Thanks! 🙂

  2. jz: The order is reversed; methods that take height and width arguments take the width first, and then the height (just as x logically precedes y). Admittedly, IDEA’s error could have been clearer, like “It looks like you reversed the width and the height” instead of the message shown.

  3. Hi Ben,

    thank you for explanation (I bad translated word reversing), now I understand. One tip: If IDEA doesn’t analyse this by lexical way, try set width by lesser value than height one 🙂

  4. It’s a feature of the inspection gadgets plugin which is bundled with IDEA. You can even add more name patterns for similar things, just check you inspection configuration.

  5. Pingback: el lady mature

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s