score:38
This feature was added to Eclipse version 4.7 M2 under Eclipse bug 40912.
To use it:
- step over the
return
statement (using "Step Over" or "Step Return") - now the first line in the variable view will show the result of the return statement, as "[statement xxx] returned: "
See Eclipse Project Oxygen (4.7) M2 - New and Noteworthy for details.
score:0
Tough one. My experience, outside of Eclipse, is that if you might need to see the return value, it is best to assign it to a local variable in the function so that the return statement is a simple return varname;
and not return(some * expression || other);
. However, that's not dreadfully helpful to you since you say you can't (or don't want to) modify or even recompile the code. So, I don't have a good answer for you - perhaps you need to reconsider your requirement.
score:0
Depending on the return statement, you can highlight the expression that is being returned and from the right-click menu, there should be something like "evaluate expression" (I don't have eclipse in front of me now, but it's something like that). It will show you what is going to be returned.
score:0
This is a bit far-fetched, but as there doesn't seem to be a simple way:
You could use AspectJ to instrument the JAR with aspects that get hold of the return value of the methods you're interested in. According to Eclipse's documentation, AspectJ programs can be debugged like other programs.
There are two options to weave your classes without recompiling the library :
Post-compile weaving if processing the binary JAR is acceptable;
Load-time weaving, which requires activating a weaving agent in the VM.
See the eclipse documentation (link above) and also the AspectJ Development Environment Guide.
score:1
"Now when you return from a method, in the upper method, in the variable view it shows the return value of the previously finished call" [1]
score:2
I am curious about to learn the answer to this question also.
In the past, when dealing with 3rd party library like that, what I did is to create a wrapper class or child class that delegate to the parent class and do my debugging in the wrapper/child class. It takes extra work though.
score:5
This is actually a long standing bug in Eclipse, dating back from the very first days of the IDE: https://bugs.eclipse.org/bugs/show_bug.cgi?id=40912
score:6
That's why I always stick with the following pattern for methods:
MyReturnedType foo() {
MyReturnedType result = null;
// do your stuff, modify the result or not
return result;
}
My rules:
- Only one return statement, only at the end of the method (finally allowed after it)
- Always have a local called result which holds the returned value, starting from a default.
Naturally, the most trivial getters are exempt.
score:35
Found a really good shortcut for this. Select the expression which returns the value and press
Ctrl + Shift + D
This will display the value of the return statement. This is really helpful in cases where you can't or don't want to change just for debugging purpose.
Hope this helps.
Note: Have not tested this with third party libraries, but it is working fine for my code. Tested this on Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 1
Source: stackoverflow.com
Related Query
- Can I find out the return value before returning while debugging in Eclipse?
- How can I find out the value of an Eclipse path variable or string variable ( `${some_var}` )?
- Force return with a specific value while debugging in Eclipse CDT
- Changing the value of a long array while eclipse debugging
- Eclipse : Can we make modifications on to the source code while debugging the Application inside Eclipse
- Where can I find out the classpath of my J2EE application in eclipse
- Moving the instruction pointer while debugging Java in Eclipse
- Where can I find the source code for the Android Development Tools (ADT) plugin for the Eclipse IDE?
- How do i find out the JDK version Eclipse is using?
- How can I zoom out the Timeline Panel in Eclipse SDK?
- Where can I find the setting for folding / unfolding the import statements in java in eclipse by default
- Generate local variable to receive the return value of a method eclipse
- Eclipse CDT: 'can't find a source file' while debugging
- Where can I find the source files of eclipse icons?
- Can I find out if the java program was launched using java or javaw
- Find all instances of a class while debugging in Eclipse
- Stop code execution while debugging in Eclipse without terminating the thread
- viewing canvas/bitmap on the fly while debugging in eclipse
- Eclipse : how to find out the Eclipse Version
- What's the best way to get a return value out of an asyncExec in Eclipse?
- How can I find the version of Scala installed in Eclipse IDE?
- Debugging in Eclipse (Java); can't hover over a variable when breaking to view the value
- In the activator class of an Eclipse plugin how can I find view instances?
- How can I get eclipse to wipe the user data for my app before running it again
- How to change value of a HashMap while debugging in eclipse
- Where can I find the value of JUNIT_CONTAINER in Eclipse?
- How can I find the version of the Eclipse Java compiler (JDT)?
- How to find the caller method when debugging using Eclipse
- How can I return the command which Eclipse uses to execute my main method?
- A short c++ file and makefile: I can make in the shell, but get lots of error while building it in the Eclipse
More Query from same tag
- Eclipse: Make CTRL+. and CTRL+, ignore warnings
- How to animate TabActivity change in Android?
- Java 14 text block leading \r\n inserted when used in Eclipse 4.15.0
- J2ME emulator does not appear to open in Eclipse
- Trim trailing space in jasypt EncryptablePropertyPlaceholderConfigurer
- Composite Primary Key in @ManytoOne in JPA with Linked Class
- eclipse, one classpath for compiling, another for launching
- Swing Designer Eclipse exception
- How to get your Netbeans project into Eclipse
- Exception in thread "main" java.io.IOException: Cannot initialize Cluster
- Eclipse projects doesn't work after moving directory
- Java windowBuilder - How can I show "File already exists" warning?
- Django tags for templates in Eclipse
- Making JButton in one class open seperate JDialog class
- Debugging Android App in Eclipse Doesn't Work
- Eclipse comment auto-generation
- JFrame loading music now running
- See Sun source code on Eclipse
- Acceleo Incremental generation on same file
- cvNamedwindow not working in opencv on eclipse on ubuntu 11.10
- Creating a JMS provider in Eclipse to send/receive JMS messages
- Android: CSS Error when using HTML Unit & Eclipse
- Building Android Project in Eclipse android.support cannot be resolved to a type
- how to show marker in maps v2 with call coordinate in another class?
- trying to use tess4j for the first time with eclipse(any step by step for trully beginner)
- Where is the connection between toolbar description and the code in Eclipse RCP?
- Problem on installing new software on Eclipse Galileo Platform
- How to batch add libraries to a lot of projects
- "Encountered" error which should not be there
- Setting up XDEBUG in my dev environment