jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-140

make "return" optional everywhere in a method

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    all

Description

Currently it seems that the "return" keyword is only optional for the last statement before the closing brace of a method. It would be nice if it were optional everywhere so that the value of the last expression evaluated is returned. For example,

myMethod() {
try { return calculateSomething() } catch (SomeException e) { return calculateSomethingElse() }
}

Currently those return keywords are required.

Issue Links

is depended upon by

Task - A task that needs to be done. GROOVY-762 implement syntax improvements

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Guillaume Laforge added a comment - 02/Nov/07 4:53 AM

Only possible as the last statement.

Show
Guillaume Laforge added a comment - 02/Nov/07 4:53 AM Only possible as the last statement.

People

  • Assignee:
    blackdrag blackdrag
    Reporter:
    R. Mark Volkmann
Vote (0)
Watch (0)

Dates

  • Created:
    20/Jan/04 9:18 AM
    Updated:
    02/Nov/07 4:53 AM
    Resolved:
    02/Nov/07 4:53 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.