How to change the value of a variable during debugging in IntelliJ so that the corresponding clock is automatically updated?

I have the following code snippet:

Matcher matchDays = m_daysRegex.matcher(e.getKey()); if (matchDays.matches()){ ... } 

Where e.getKey() is Mon-Fri.

Now I have already completed the first line and inserted the if statement. Using the viewport, I evaluate the expression matchDays.matches() , and then add some hours for the various matchDays methods. Then, using the same viewport, I evaluate the matchDays = m_daysRegex.matcher("Mon,Fri") and matchDays.matches() to see what happens. Unfortunately, the viewport does not update, and it does not have an explicit button for this: enter image description here

In the image above, notice how matchDays.group(0) displays "Mon, Fri," but matchDays.group(1) displays "Mon-Fri." This is because I manually updated the first, but everyone else still shows the old values. I have to manually update them all, which is annoying.

Am I doing something wrong? Is there a proper way to do this, so that the clock expressions are updated automatically? Or is there a way to refresh the entire viewport?

Thanks.

+7
source share
2 answers

This is how I changed the value of a variable at runtime in Intelij

  • Variables are displayed in the Variables window.
  • Right click and select value
  • Update the value and press the enter key.
+8
source

It is not possible to update them automatically, because updating will require calling the actual methods, which may have side effects for the debugger and application semantics. Simple clock values ​​are updated automatically.

See also a similar query in YouTrack .

+3
source

All Articles