Let's say we have an abstract class with method onPoke(..).
abstract class BaseValuePanel{
void onPoke(int depth){
//blah, blah, ...
}
}
Now, I wish to place a breakpoint on onPoke(..) but only when invoked thro an object of the class EstimationValuePanel.
Because right now, if I placed a breakpoint on onPoke(..), the debugger would stop thousands of instances (because of the extensive descendant classes of BaseValuePanel) and only one of which was due to invocation thro EstimationValuePanel.
What is the sequence of set-up or strategy of breakpoint set-up that I need to employ, in order to allow the debugger to stop only when the method was invoked thro EstimationValuePanel.
What I meant by virtual breakpoint ...:
That is, in Java as opposed to C#, non-private, non-static, (overridable) methods are naturally virtual. Hence, virtual invocation here.
Of course you can override the method in class EstimationValuePanel and set the breakpoint only there.
But you can also use conditional breakpoints: go to the properties of the breakpoint on the method onPoke() (right-click or Ctrl + double-click) and select "Conditional". In the text area below you can enter the following condition:
this instanceof EstimationValuePanel
This means the condition is evaluated everytime the method is entered. So if you experience perfomance issues, you should prefer to override the method in EstimationValuePanel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With