Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does intellij calculate the 4 digit ids of object instances? [duplicate]

When using Intellij's debugger, the variables in scope are displayed using a 4 digit identifier, marked in red in the following screenshot. intellij screenshot

This identifier seems to be calculated based on the object's identity.

What exact code is used to get the 4 digit number for a given object instance?

like image 827
Stefan Armbruster Avatar asked Nov 18 '11 09:11

Stefan Armbruster


1 Answers

I don't think you should rely on that id being calculated in any special way. It's internal to IDEA (or JVM) and I don't think it holds any relevance except to track objects during execution.

However, I find it useful to name objects during debug. I believe the shortcut is F11 (click once on the object in debug window first) and just give it a name that is meaningful for you during debugging. That object will always hold that name during the current session of debugging.

like image 134
Andreas Wederbrand Avatar answered Nov 08 '22 21:11

Andreas Wederbrand