Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 188388

Summary: Improve force return error messages
Product: [Eclipse Project] JDT Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: chanskw, curtis.windatt.public
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard: stalebug

Description Michael Rennie CLA 2007-05-22 13:20:25 EDT
Using the force return function can cause a confusing error message to be displayed to the user if they try to force return using a code snippet that returns a value other than what is expected. For example consider the following code:
public class Test {
public List<String> doSomething3() {
 List<String> list = new ArrayList<String>();
 list.add("original");
 return list; //breakpoint
}

public static void main (String[] args) {
 Test test = new Test();
 test.doSomething3();
}
}

if we try to force return from the breakpoint using the following code snippet:

List<String> list2 = new ArrayList<String>();
list2.add("new");

we get an error message about the type I specified as a return type is not compatible witrh the method's return type. What makes this confusing is that I have not specified a return type (which in this case is the return value of the add method for the list), and the error message gives me no context of what I am trying to return and what it is looking for.

It would also be nice if there was somwe indication of what to do to resolve the problem: in this case adding a 'return list2;' fixes it and forces return successfully.
Comment 1 Darin Wright CLA 2007-05-29 12:29:02 EDT
not for 3.3
Comment 2 Curtis Windatt CLA 2007-12-11 12:47:33 EST
*** Bug 212624 has been marked as a duplicate of this bug. ***
Comment 3 Curtis Windatt CLA 2007-12-11 12:49:40 EST
The error messages for the force return function need to be returned.  In addition to Mike's problem, Samantha noticed the following:

1.  Stop in main
2.  select anything to do a force early return.

The force early return fails expectedly.  However, the error message is
confusing:
Force return failed.
Details:  Thread has no stack frames.

The error message does not properly explain why the force early return action
has failed.
Comment 4 Eclipse Genie CLA 2020-02-20 12:38:55 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.