Java: How to determine the value of an element in an array?

Using Intellij IDEA, we can easily detect field changes using a field breakpoint. However, if I have an int array int[] array = new int[5]and I want to stop when the program changes array[2]. Can I do this with Intellij IDEA?

+4
source share
1 answer

No, this is not possible in IntelliJ IDEA (or any other Java IDE / debugger, as far as I know).

JDI allows you to set watchpoints for fields and since the field does not change when the array element changes, it will not call. The API cannot set watchpoints for individual elements of an array.

+2

Source: https://habr.com/ru/post/1675173/


All Articles