serhii.net

In the middle of the desert you can say anything you want

17 Sep 2020

Day 626

Intellij reopening closed windows such as debugging

Reopening closing windows can be done through View -> Tool windows. It has nice shortcuts that are <Alt-N>, with N=0..9. For example, debug window is <Alt-5>.

Additionally - I should use F7 / ‘step into’ much more.

Intellij idea structure

<Alt-7> opens a nice structure window with info about the long class you’re editing. With nice options like show public/fields/..

Gson / json serialization of objects

java - Save state of object in IntelliJ debug? - Stack Overflow - google/gson is the answer. User guide: gson/UserGuide.md at master · google/gson · GitHub

Gson gson = new Gson();
gson.toJson(1);            // ==> 1
gson.toJson("abcd");       // ==> "abcd"
gson.toJson(new Long(10)); // ==> 10
int[] values = { 1 };
gson.toJson(values);       // ==> [1]

// Deserialization
int one = gson.fromJson("1", int.class);
Integer one = gson.fromJson("1", Integer.class);
Long one = gson.fromJson("1", Long.class);
Boolean false = gson.fromJson("false", Boolean.class);
String str = gson.fromJson("\"abc\"", String.class);
String[] anotherStr = gson.fromJson("[\"abc\"]", String[].class);

Not drag-and-drop for more complex stuff though.

Intellj Idea Exceptions Breakpoints

You can create breakpoints at all exceptions of a certain type, even when they are caught. May lead to discovery that there are a lot of them in the code :)

On this topic - “Run to cursor” is nice

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus