Info

Ben is Vice President of Mobile Engineering at Walmart.com, where he works closely with his long-time friend Dion Almaer.

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.

Advertisement

Comments

6 Comments

Post a comment
  1. jz #
    January 18, 2007

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

  2. January 18, 2007

    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. jz #
    January 19, 2007

    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. Kirill Kalishev #
    March 9, 2007

    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.

Trackbacks & Pingbacks

  1. el lady mature
  2. Ben Galbraith’s Blog » Blog Archive » More on the Amazing IntelliJ IDEA

Leave a Reply

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

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

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

Facebook photo

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

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

Follow

Get every new post delivered to your Inbox.