Retrieve “id” field values via VisualVM OQL query

浪尽此生 提交于 2019-11-30 20:46:33

问题


Getting obj.id with an OQL query in Java VisualVM (1.8.0_45) returns JavaScript object id (a long value) instead of the value of the Java field. In other words JavaScript id field shadows the Java object id field. Java object value can be seen in the Instances browser, but how to retrieve it via VisualVM OQL?


回答1:


Currently there is no way to access Java object id field. This is a bug in OQL.
You can use the following workaround:

obj["wrapped-object"].getValueOfField("id")


来源:https://stackoverflow.com/questions/40568374/retrieve-id-field-values-via-visualvm-oql-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!