Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » OQL: calling Java methods
OQL: calling Java methods [message #564948] Sun, 04 July 2010 10:09 Go to next message
Simeon Zverinski is currently offline Simeon Zverinski
Messages: 2
Registered: July 2009
Junior Member
The help system states that it's possible to call methods through reflection

Quote:
> Calling Java methods
>
> [ <alias> . ] @<method>( [ <expression>, <expression> ] ) ...
>
> Adding ( ) forces OQL to interpret this as a Java method call. The call is executed via reflection. Common Java methods.


But I can't get it working. For example, this is the result when trying to call getTime() from the java.util.Date

Quote:
> Executed Query:
> SELECT d.@getTime() FROM java.util.Date d
>
> Problem reported:
> Method getTime not found in object java.util.Date [id=0x647cd5e8]


The same happens with all methods that don't belong to the java.lang.Object class.

Am I doing something wrong or is this feature not supported yet?

Thx!
Re: OQL: calling Java methods [message #564977 is a reply to message #564948] Mon, 05 July 2010 07:55 Go to previous messageGo to next message
Andrew Johnson is currently offline Andrew Johnson
Messages: 119
Registered: July 2009
Senior Member
It doesn't work like that - the methods are on the MAT objects representing the objects or classes in the dump, not your actual methods in your program.

E.g.
IObject is the interface giving access to the MAT view of any object in the dump.

IClass is the interface giving access to the MAT view of any class in the dump.

See the API doc -
help -> reference -> API Reference
to see the methods on IClass, IObject etc.

Try:
SELECT d.getObjectId() FROM java.util.Date d

SELECT toHex(d.getObjectAddress()) FROM java.util.Date d

We should improve the help and provide links to the API doc.
Re: OQL: calling Java methods [message #1064336 is a reply to message #564977] Tue, 18 June 2013 15:15 Go to previous message
Robin Salkeld is currently offline Robin Salkeld
Messages: 8
Registered: June 2013
Junior Member
Hello all,

I know this is an old thread, but I just thought I'd mention that I've actually implemented the ability to invoke the methods in the problem your heap dump is from. It's still in progress (and has taken a long time!) but so far it seems to work very well with a few caveats.

I'm curious as to the context of your original question. What kind of heap dump analysis were you trying to write?

Thanks,
Robin
Previous Topic:Thread Details/Overview won't open: Object 0x2aab50739d48 not found.
Next Topic:Displaying field/attribute names in Dominator Tree
Goto Forum:
  


Current Time: Fri Aug 22 06:02:08 EDT 2014

Powered by FUDForum. Page generated in 0.10497 seconds