8

.NET has a couple of handy annotations that instruct a debugger to step through/over certain methods. I would like to know if there is an equivalent that works on the Java platform.

For instance:

@DebuggerStepThrough
public void foo() {
  ..
}

would cause the debugger to not stop in foo when stepping.

What I tried

  • using the SYNTHETIC flag in the classfile. This causes javac to forbid user-code calling such methods.
  • custom attributes. There is no JDI API to retrieve annotations. Also mentioned on this forum.

PS. I am implementing a debugger and have control over the bytecode that is emitted

Henrik Aasted Sørensen
  • 6,966
  • 11
  • 51
  • 60
Iulian Dragos
  • 5,692
  • 23
  • 31

1 Answers1

2

AFAIK, not as a stock feature, no.

Otherwise I can also recommend having a look at eclipse debugger's "Step filter" and "conditional breakpoint" features. It allows you to ignore certain types (step filter) or only halt on certain runtime conditions (conditional breakpoints).

Michael Heß
  • 161
  • 6
  • 1
    Thanks, but that's not what I was looking for. I wanted a platform-level annotation, avoiding the need for me to implement step filters for my language (essentially duplicating the work that the Java IDE team did already for Java). In the meantime I know there is no such thing. – Iulian Dragos Feb 20 '15 at 15:02