4 ms·
Conditional breakpoints in IntelliJ were big for me when I discovered them. It's helpful when there's many iterations of the same function so you can stop at sp
by Brystephor 3y ago
Conditional breakpoints in IntelliJ were big for me when I discovered them. It's helpful when there's many iterations of the same function so you can stop at specific inputs.
- m_0x 3y agonow if I can just figure out how to debug a lambda function and RX stream
- spreiti 3y agoIn Intellij you can add breakpoints to when lambdas are executed [0]. You can also print logs instead of suspending the threads [1]. [0] https://www.jetbrains.com/help/idea/using-breakpoints.html#set-line-breakpoint https://www.jetbrains.com/help/idea/using-breakpoints.html#s... [1] https://www.jetbrains.com/help/idea/using-breakpoints.html#log https://www.jetbrains.com/help/idea/using-breakpoints.html#l...
- eitland 3y agoYou can also visualize streams. I do not prefer IntelliJ (I want a Hilux as my car and NetBeans for IDE) but credit where credit is due.
- loginatnine 3y agoThere's a lot of options you can put on each breakpoint in IntelliJ, every developer should know about them. Right click on the breakpoint and click the "More" link. Using "Run to cursor" is my favorite less known feature in debugging, it's really useful.
- nsxwolf 3y agoDon't forget about "Reset Frame". When you're manually stepping over something and accidentally go too far, this will take you back to the previous stack frame so you can try again.
- dotancohen 3y agoSorry, what?!? I did not know what this does. Thank you.
- cogman10 3y agoI find this to be one of the most useful tools in debugging. For example, if an exception is being logged in some random location (but poorly) I can throw a breakpoint on the log message, pop up several stack frames, look at the inputs into those frames (what are all the local variables) and replay down to whatever level I want or what other breakpoint I want to hit. The only catch is if your functions are mutating input data (or some shared state somewhere), then you could be looking at different executions from one stack to the next. One more reason to prefer pure functions over side-effects.
- dotancohen 3y agoThank you!
- mdaniel 3y agoA winning combination with control-shift-f9 to recompile the function body and then drop-frame to retry with the new code I have lost hope for DCEVM being upstreamed to allow structural changes to the class :-(
- stephankoelle 3y agoDcevm is regularly released from JetBrains as part of their JDK. https://github.com/JetBrains/JetBrainsRuntime https://github.com/JetBrains/JetBrainsRuntime Also with 'Java on Truffle' on GraalVM you can use enhanced class reloading https://www.graalvm.org/latest/reference-manual/java-on-truffle/hotswap/ https://www.graalvm.org/latest/reference-manual/java-on-truf... I think hot code reloading did not look that good in a very long time.
- mdaniel 3y ago
- somehnguy 3y agoI use those & the 'evaluate expression' feature pretty regularly to transform the data into a friendlier format once stopped at my breakpoint. Super useful & quicker than source changes for one off things.