In this article I am going to share some cool features I stumbled upon while coding with Intellij. These are not the most popular/productivity improving ones - for these you should watch this video

1. Set debugger breakpoint by pattern

Problem: You want to check if the debugger steps into some code during the run. Usually you suspect where the flow will end up but sometimes finding the exact line could be hard.
Solution: Breakpoints in Debugger pane -> Click (+) -> Java Method Breakpoint -> Fill class/method pattern. 
For example this setting will stop the debugger anytime the code enters any method from any class from com.fasterxml.jackson package.
Image title

2. Attaching custom log file to be followed after Spring Boot app startup.

Problem: You have your app log configured to write to the file after the startup. However, this makes it harder to read that log because now you have to open this file somehow instead of just checking the console output. 
Solution: Run/Debug Configuration -> Your Spring Boot app -> Logs -> Click (+) -> Fill alias and Log File Location. This will open additional pane with file content after you run the configuration that is easy to work with. 
Image title

3. Invoke any code one the screen when in debug mode

Problem: You want to check the result of invoking some code on the screen but you are to lazy to paste it to Evaluate Expression console.
Solution: When the program is paused in debug mode, hit the alt key and click any fragment you want to see the result.
Image title

4. Compare with clipboard

Problem: You would like to compare some text the same way Intellij’s VCS diff shows changes in files.
Solution: Copy text to the clipboard -> Select any other text -> Right Click -> Click Compare With Clipboard.
I think it is worth to have a key assigned to this one.
Image title

5. Shelve changes

Problem: I used to use Git stash command externally to save some changes I didn’t want to commit yet. Is there a way to do this from Intellij? 
Solution: VCS -> Local Changes -> Select the files you want to stash -> Right Click -> Shelve changes.
You can move them back from the shelf by right clicking on the selection and choosing Unshelve.
Image title

Conclusion

I hope you have learned at least one thing that might be helpful at you work. Please share other cool but less know Intellij features in the comment section. 
0

Add a comment

I have recently started implementing different distributed system protocols to get some understanding how they work. I think that using Akka Actors to simulate hosts is a good choice because they are easy to set up. What is more you can kill actors on demand to test some failure scenarios.

When I started working as a Java Developer, me and my teammate got a first task to repair all broken tests (great task for new starters!) in some old project. Replacing some old configuration and upgrading a few libraries helped making the tests status green but there was another problem.

In this article I am going to share some cool features I stumbled upon while coding with Intellij. These are not the most popular/productivity improving ones - for these you should watch this video. 

1.

I have recently pushed very simple Map Reduce concept implementation on my Github account (click). My idea was to focus on the concept and mock the rest.

In this article I will try to map methods of Java’s Optional to Kotlin’ssimilar scattered language features and built-in functions. The code in the examples is written in Kotlin, because the language has all the JDK classes available.

Representation

Let’s start with the representation.

Have you ever scrolled someone’s code and bumped into this weird method called flatMap, not knowing what it actually does from the context? Or maybe you compared it with method map but didn’t really see much difference? If that is the case then this article is for you.

Fact - End-to-end  tests are critical if you want to make sure your software works as it should. To be 100% sure that you covered every (or almost every) possible branch in your business code, it is worth to check what code has been invoked after your E2E suite finished successfully.

Functional Programming in Java

Stream and Optional classes - added to Java 8 - allow you to have some fun with functional programming. The problem is Java still misses quite a lot to be taken as a serious FP language.

In this article, I am going to present you a simple trick that will make using java.util.function.Function.andThen() more useful.

1

Checked exceptions & Java 8

Defining custom exceptions (both checked and unchecked) is a common approach to handling errors in Java applications. It usually leads to creating a new class for every different type of error, marking methods with throws keyword or wrapping code with try-catch blocks.

1
Popular Posts
Popular Posts
About Me
About Me
Labels
Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.