OQL: Why is the returned object not a String but "com.ibm.wps.state.keymanager.ValueImpl"? [message #1827958] |
Wed, 27 May 2020 16:19  |
Eclipse User |
|
|
|
I'm runnin the following OQL in MAT 1.9.2:
--- snip ---
SELECT x.data.toString() FROM INSTANCEOF "com.ibm.wps.state.keymanager.ValueImpl" x WHERE ((dominatorof(x) != null) and (classof(dominatorof(x)).@name = "com.ibm.wps.util.BidiMapImpl") and (toHex(dominatorof(x).@objectAddress).toString() = "0x6985397b0"))
--- snip ---
and get the expected number of objects back. However the returned objects are not of type String (as I'd expect because of the .toString()) function but ValueImpl. This because if I click on the result I get the attributes of the ValueImpl objects (which are char[] data. int hash) shown and if I try to extract a substring from the selected data I get the following error:
--- snip ---
Executed Query:
SELECT substr(x.data.toString(), 1, 32) FROM INSTANCEOF "com.ibm.wps.state.keymanager.ValueImpl" x WHERE ((dominatorof(x) != null) and (classof(dominatorof(x)).@name = "com.ibm.wps.util.BidiMapImpl") and (toHex(dominatorof(x).@objectAddress).toString() = "0x6985397b0"))
Problem reported:
Method substr(java.lang.String, int, int) not found in object com.ibm.wps.state.keymanager.ValueImpl [id=0x76a7e0c00] of type org.eclipse.mat.parser.model.InstanceImpl
--- snip ---
why does x.data.toString() return a String type here?
Thanks for any advise - Hermann
|
|
|
Re: OQL: Why is the returned object not a String but "com.ibm.wps.state.keymanager.ValueImpl&qu [message #1828026 is a reply to message #1827958] |
Fri, 29 May 2020 11:27  |
Eclipse User |
|
|
|
I think that's expected.
The row holds the object from the FROM claus (whatever x is).
The select item is what is displayed in that column.
If you try
SELECT x,x.value,x.value.toString() FROM INSTANCEOF java.util.HashMap$Entry x WHERE ((dominatorof(x) != null) and (classof(dominatorof(x)).@name = "java.util.HashMap$Entry[]"))
then this has 3 columns, x, x.value (both MAT IObjects) and x.value.toString() (a Java String).
If you used Memory Analyzer 1.10.0 which has some OQL improvements, then the context menu for each row has:
SELECT ... x gives a context menu on the row object, and 'COPY OQL' copies to the clipboard a new OQL query for the whole of that row.
x gives a context menu on the select item x IObject, and 'COPY OQL' copies to the clipboard a new OQL query for that single column of that row.
x.value gives a context menu on the select item x.value IObject, and 'COPY OQL' copies to the clipboard a new OQL query for that single column of that row.
|
|
|
Powered by
FUDForum. Page generated in 0.04113 seconds