Stay in the Code Zone with Eclipse Debug Filtering

When we step through code in Eclipse we want to see this.

Not this.

To stay in the Code Zone we can filter out types and packages in Eclipse. Here’s the Debug Step Filtering Preferences page.

Notice how we’re filtering out org.springframework.* packages and junitX.runner.* packages among others we don’t want to see at the moment.

Here’s another great tip. When encountering a package or type while stepping through code simply filter it on the fly. Bam! Last time you’ll see it until you go into Preferences and unfilter it.

We don’t even want to stop on those packages in the stack, but rather skip right over them. To stay in our code¬†we’ll uncheck the “step through filters” checkbox in Preferences. (#3 below.) #2 demonstrates filtering JUnit packages, while #1 demonstrates how we can filter even CGLIB executions.

Once you discover Debug Step Filtering in Eclipse you’ll wonder why you waited so long. I know I did.