Thursday, March 2, 2006

Why IDEA Rocks - Reason #714

I've been using IDEA since version 2.5, but still a couple times a week, I stop what I'm doing to laugh a little at some small but brilliant feature that helped save me. The one I found today was even more trivial than usual, but it still made me smile.

When I see the red squigglies I now instinctively mash the keyboard: ALT-ENTER. Before I even read the message; before my brain has even interpreted the line of code my cursor sits on, I mash the keyboard. This time, here's what I saw:

I was looking at this thinking about how the system knew I should call getPredefinedCursor(). I still can't come up with a generic rule that might have been triggered by this situation. Somewhere in IDEA's code, there's a rule waiting for me to pass an integer into a method as a Cursor, so it can popup this intention. Not that is attention to detail!

UPDATE: In a comment (not transfered from MovableType), Keith Lea points out: "The general rule is that for a call to M(X x) passing value of type Y, IDEA suggests any static method in class X which returns X and takes only Y as a parameter."



Post a Comment

<< Home