deinocheirus
deinocheirus

Reputation: 1863

"Step into" inside my own project in Eclipse

When debugging my application the way to get to the immediate next step in my program's execution cycle is by clicking on "Step Into". The problem is that I almost always end up in classes of the Java Class Library, which do not interest me, so I get out of those with "Step Return".

Is there a way to "step into" my code but skipping code that I did not write?

Upvotes: 3

Views: 704

Answers (4)

ADTC
ADTC

Reputation: 10106

Use Step Filtering.

  • In Eclipse, open Preferences > Java > Debug > Step Filtering (or just type step in the Preferences search box).
  • Click Use Step Filters to enable it.
  • Enable the package wildcards you want to avoid stepping into. To avoid Java language - packages, it should be java.*. I recommend the other defaults too like javax.*.
  • You may add more custom filters if you want (for example if you imported a JAR library, you can add its most generic package wildcard, like apache.common.*).
  • You may select additional options below the filters list. Note about Step through filters option:

This option controls step filters to always return from a filtered location or step through to a non-filtered location.
For example, if java.util is a filtered location, stepping into code in HashMap could result in a call-back to your application code to check the equality of an object. If you choose to Step through filters a step into would end up in your application code. However, when the Step through filters option is disabled, a step into HashMap would behave like a step over.
Source

  • Click Apply > OK.

You can easily enable/disable step filters using the Use Step Filters Use Step Filters (Shift+F5) option in the toolbar or the Run menu. Shortcut: Shift-F5.

Upvotes: 5

Fraser
Fraser

Reputation: 1010

I think Step Out would allow you to do this once you hit the Java code. If memory serves, this is shortcut by F7

Upvotes: 0

Kamal
Kamal

Reputation: 5522

Use breakpoints. Say you have code like

lineX
lineY
lineZ

You are currently on line X and know that line Y will do stuff using Java / Library code which does not interest you, you can put a breakpoint at line Z and move directly to that (in eclipse you do F8 to go to next break point). Line Z can be in a different class or method, so you need to know the location of next executable line to apply the breakpoint properly.

Upvotes: 0

Philipp Sander
Philipp Sander

Reputation: 10249

No.

You can not "step into" and skip code you didn't wirte.

BUT, what you can do is using more breakpoints and simply forward to the next breakpoint using "Resume"

Upvotes: 0

Related Questions