| Summary: | [refactoring] [extract method] improve refactoring result when statement sequence that returns | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Mohsen Vakilian <reprogrammer> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | deepakazad, nchen, reprogrammer, snegara2, tip |
| Version: | 3.7.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
|
Description
Mohsen Vakilian
*** Bug 46318 has been marked as a duplicate of this bug. *** (In reply to comment #0) > In summary, there are two techniques to avoid the above error message in most > cases (seven out of eleven): > > 1. When all "return" statements in the selected block return some literal > values, add a "return" statement at the end of the extracted method that > returns a different literal. This different literal will help the tool > determine the condition for returning out of the caller. > 2. If the selected statements contain "return;" statements, change the return > type of the extracted method to "boolean", replace "return;" by "return true", > add "return false" to the end of the extracted method, and return from the > caller when the return value of the callee is "true". Sounds promising, as the semantics of the resultant code will be closer to the original code as compared to the current situation. The message warning the user about change in semantics will remain as the semantics are still not entirely preserved. 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. |