6 ms·
Level-up your Java Debugging Skills with on-demand Debugging
- loginatnine 3y agoI understand they are remote debugging flags of the agent, but is this somehow different than IntelliJ features: - Pause button (onjcmd=y) - Java Exception Breakpoints with caught/uncaught option (onthrow/onuncaught)
- Brystephor 3y agoConditional 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 :-(
- 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.
- icepat 3y agoThis may be a very ignorant question, but is anyone using Java for new projects these days? Or are most of the projects legacy projects? I've not heard of anyone electing to use it anywhere as their first choice.
- runako 3y agoMost companies > 1000 employees that were founded before 2000 will have most of their critical internal systems written in Java and/or .NET. If you don't know anything about a large company and have a meeting with someone in IT there, it's a safe bet that boning up on Spring Boot before the meeting will be beneficial.
- icepat 3y agoRight, but my question is if new projects, products, and companies are electing to use it now. I'm aware that much of legacy software is still Java.
- bzzzt 3y agoIf there's a lot of Java knowledge around in a company it can certainly be beneficial to use it ;). I set up a simple REST backend service last year using Quarkus and can think of worse frameworks I could have picked. Also, if a new system has to connect to a legacy system using SOAP there are about 2 languages with a complete and interoperable implementation: Java and .NET. There are lots of toy libraries for other languages but I've never found one fully supporting the entire WS-* standard set.
- runako 3y agoSorry, I should have clarified. Yes, if a company has most of its legacy code in Java, it likely also still does new projects in Java. The Java ecosystem is robust, well-supported, and performs well. When you are working in big enterprise tech, third parties with whom you work will often only support Java and .NET as first-class citizens for interop. It's not trendy, but that alone is not enough to overcome the advantages of choosing the fleet standard in a company that already has a substantial investment in Java.
- shardullavekar 3y agowe used the on-demand debugger when creating our sdk extended by lombok and found it very helpful. we also built an IDE plugin that lets you call a Java function directly, without having to expose an http end point, check us here: unlogged.io Disclaimer: I am the founder at unlogged.
- mdaniel 3y agowhat's going on with your Source Code link on the plugin page pointing to a decidedly not source code URL: https://www.unlogged.io/terms-of-service https://www.unlogged.io/terms-of-service ? Or, I guess put another way, since it's cited as GPLv3 to which address should one send a request for the source code?
- shardullavekar 3y agoLink to the source code: https://github.com/unloggedio/unlogged-sdk https://github.com/unloggedio/unlogged-sdk will fix the link on the plugin page, thanks for noticing it.
- mdaniel 3y agoI actually thought about preempting your reply about that GH repo since (a) it's not the IJ plugin (b) it's not GPLv3, but I thought "surely they won't chirp about their linked GitHub repo knowing full well that the plugin isn't in the repo ... surely"