I tried debugging a junit test in STS (Spring Tool Suite).
When I try to perform 'step-into' in any method of the class under test object I get
com.sun.jdi.InternalException: Got error code in reply:35 occurred retrieving 'this' from stack frame
.
When I do the same in IntelliJ IDEA I get
'this' is not available
.
I tried everything from Using the Eclipse remote debugger throws com.sun.jdi.InternalException but nothing turns out to be useful.
I installed java using
brew cask install adoptopenjdk8
.
STS version is 4.7.0.RELEASE
IntelliJ IDEA Version is 2020.1.2
JUnit version is 4.13
Finally after a lot of debugging and isolating all tools I found that the culprit was
mock-maker-inline
which I added in project's src/test/resources/mockito-extensions directory to mock final classes (ref: https://www.baeldung.com/mockito-final).
Please feel free to comment any better way where I don't have to add that line and still can mock final classes + won't get that exception.