Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 50061 - [extract method] superfluous return statement
Summary: [extract method] superfluous return statement
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1.1   Edit
Hardware: PC Windows 2000
: P4 normal with 1 vote (vote)
Target Milestone: 4.14 M1   Edit
Assignee: Kenneth Styrberg CLA
QA Contact: Roland Grunberg CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-15 07:12 EST by Thorsten van Ellen CLA
Modified: 2019-10-09 10:41 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thorsten van Ellen CLA 2004-01-15 07:12:58 EST
I extracted a long method from a long code sequence in a finally block.
The extracted seems to be correct and will be called 
at its original place, but after the method call 
a return statement was inserted.
In my case the return statement did not cause a logical error,
but it is superflous and I do not want to have it.

best regards

Thorsten van Ellen
Comment 1 Martin Aeschlimann CLA 2004-01-16 07:13:32 EST
Do you have a code example where this is reproducable?
Comment 2 Dirk Baeumer CLA 2004-03-22 15:17:52 EST
Thorsten, do you have some test cases for this ?
Comment 3 Thorsten van Ellen CLA 2004-03-23 03:59:01 EST
Sorry for my idleness. Here is some reduced code:

public class TestReducedEclipseBug {
  public static void main(String[] args) {
    try {
      System.out.println("bla1");
    } finally {
      System.out.println("bla2");
      return;
    }
  }
}

I know the return is already superfluous,
but without it there is no problem!
The problem is not too serious as far as I can see.

If I extract a method from the contents of the finally block, i get this:

public class TestReducedEclipseBug {
  public static void main(String[] args) {
    try {
      System.out.println("bla1");
    } finally {
      x();
      return;
    }
  }
  private static void x() {
    System.out.println("bla2");
    return;
  }
}

Know I got two superfluous return statements.

best regards

Thorsten van Ellen
Comment 4 Eclipse Genie CLA 2019-05-05 13:48:20 EDT
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.

If you have further information on the current state of the bug, please add it. 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.
Comment 5 Dani Megert CLA 2019-05-06 04:26:00 EDT
Still a problem in 4.12 M1. It should not add a return in the finally block.
Comment 6 Eclipse Genie CLA 2019-08-10 14:58:21 EDT
New Gerrit change created: https://git.eclipse.org/r/147464
Comment 8 Roland Grunberg CLA 2019-10-09 10:41:19 EDT
Verified for 4.14 M1 using I20191009-0600 build.