#understanding intelliJ debugger

1 messages · Page 1 of 1 (latest)

hasty pewter
#

i am trying to see how the value of a variable in a for loop changes in each loop
so i added a "watch" to it
but it has so many drop down things , i dont understand these , what are these?

crude heraldBOT
#

<@&987246527741304832> please have a look, thanks.

hasty pewter
#

and each drop down has child drop down things

#

i just want to know the value of the variable

dawn violet
#

but it has so many drop down things , i dont understand these , what are these?
your variable got a specific type and that type has multiple fields in the class, each entry is simply a field of some class

#

for example:

class Computer {
    Memory memory;
    CPU cpu;
    // ...
}

and then imagine you watch a variable of type computer:

Computer myComputer = ...;

I will look like this:

- myComputer
  - memory
    ... (fields of memory variable)
  - cpu
    ... (fields of cpu variable)
drifting vapor
#

thing is, that variable isnt just a string or an int

#

its a complex class consisting of multiple fields who have fields themselves and so on

#

so it shows u all of that

hasty pewter
#

oh i see!

#

that makes sense

#

so i guess i dont need to pay attention to all the fields and subfields ?

dawn violet
#

only the stuff you are interested in
and that depends on the context of why you debug

hasty pewter
#

i want to see the value of the variable

#

here i see that there is a field which is labelled "value"
is this the value?
but then what is the first = mean?

#

like in the first line

#

is this the value?
or is this the value?

dawn violet
#

"value" of the variable

#

what do you even mean

#

you always talk about "value"

#

if your variables holds some type then the value is either null or an instance of that type or subtype

hasty pewter
#

so value of variable is whatever assigned to it , right?

dawn violet
#

yep

#

your variable additionally got a field that is literally called "value"

hasty pewter
#

but why?

#

(okay yes thats a stupid question)

dawn violet
#

because thats the definition of the class

#

it got a field

#

no idea why

#

did you create that class?

#

its just unlucky and adds to confusion here

hasty pewter
#

i should look into the definition of class

hasty pewter
dawn violet
#

its basically just:

class ... {
    ObjectIdentifierValue value;
}

and thus its displayed as "value"

hasty pewter
#

aha

#

this is what is assigned to the variable btw

#

and symbol is this