Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-debug-dev] RE: How to call a (local ?) method from a Watch expression

Q1) What limitations exist on the evaluation of Watch Expressions ?
   Q1a) is there a document defining them ?

The java evaluation engine manage about all the java spec. It doesn't manage try-catch statements, assert statements and switch-case statements. There is no document about it, you should get a explicite message d'error if you try to use one these statement.

Q2) Is there a way of finding out what <error(s) during the evaluation> actually means in this (or any other) case ?

Depends of the version of Eclipse you use. In 3.0, just expand the tree element, its children are the error messages generated during the evaluation. In 2.1.x, there no direct way to get the errors messages. A way to get the error messages is to try the same evaluation in the display view, it will display the errors.

Q3) Is there some way of wrapping the call to allow the Watch Expression parser to accept it ?

If you want to use a non-managed statement, wrap it in a method in you class, or in a static method in a utility class.

Q4) Would it work if the method was in a seperate .jar file ?

The Java evaluation engine uses the java build path defined in the project to compile the snippet, and the classpath of the VM on which you running your application to execute the snippet. So it will work only if the .jar file is both in the build path and in the classpath.

HTH,
Luc



Mike Parfitt wrote:

-----Original Message-----
From: Mike Parfitt Sent: 21 November 2003 08:55
To:	'platform-debug-dev@xxxxxxxxxxx'
Subject:	How to call a (local ?) method from a Watch expression

If this is the wrong forum, please advise - (my first posting)

Within a project I have added a static method which successfully uses the Reflection API to dump (to a file) a formatted print of any given object to a specified (recursive) depth.

When I call it from the java code that executes as a result of an incoming request it works fine, but this requires me to have modified the code ahead of the test to insert the relevant call(s).

What I would like to do, is call it when I am debugging and halted at a checkpoint, or at some subsequent statement that I have stepped to using F5 or F6 etc.

When I put a call into a Watch Expression I get <error(s) during the evaluation> both when the return type is void and when it is a primitive type (int) - I have also tried modifying the number of \ characters after the drive letter in the string defining the file name, but the error(s) remain.

The logic around Watch Expressions must be evaluating expressions on the fly, so I don't understand why it can't execute mine.  I can't be the first to try calling a method in my own project from a Watch Expression - perhaps this is inherently unfeasible, or perhaps there is a document that I haven't found that shows how to do it.

So,

Q1) What limitations exist on the evaluation of Watch Expressions ?
   Q1a) is there a document defining them ?
Q2) Is there a way of finding out what <error(s) during the evaluation> actually means in this (or any other) case ?
Q3) Is there some way of wrapping the call to allow the Watch Expression parser to accept it ?
Q4) Would it work if the method was in a seperate .jar file ?

Many Thanks

Mike Parfitt


Mike Parfitt Developer JMH Demica Ltd Crowne House, 56-58 Southwark Street London SE1 1UN



Back to the top