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)
Signup
groovy
  • groovy
  • GROOVY-4681 implement final for local variables
  • GROOVY-1628

Inconsistent checking of final

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Ubuntu 6.10 Edgy Eft + Groovy r4630
  • Number of attachments :
    0

Description

The following code appears to show that final is being applied inconsistently. A final list can be amended but an object that manipulates a lsit that is final cannot. In the former case the final is being applied to the reference and in the later, it is being applied to the object.

 class Blah {
  def list = []
   public plus ( item ) {
     list += [ item ]
     return this
   }
}

class Foobar {
   final static blah = new Blah ( )
}

final x = []
x += [1]
println ( x )

Foobar.blah += 1
println ( Foobar.blah.list ) 
> groovy finalProblem.groovy
[1]
Caught: java.lang.IllegalAccessException: Field is final
at finalProblem.run(finalProblem.groovy:17)
at finalProblem.main(finalProblem.groovy)

Issue Links

is duplicated by

Bug - A problem which impairs or prevents the functions of the product. GROOVY-2752 final keyword does not work

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

Bug - A problem which impairs or prevents the functions of the product. GROOVY-1416 final modifier ignored in scripts

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
is related to

Bug - A problem which impairs or prevents the functions of the product. GROOVY-3088 Modifiers on local variables are ignored

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
relates to

Sub-task - The sub-task of the issue GROOVY-1475 final modifier on a method parameter is not respected

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

Bug - A problem which impairs or prevents the functions of the product. GROOVY-3088 Modifiers on local variables are ignored

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Guillaume Laforge made changes - 20/Jan/07 3:27 PM
Field Original Value New Value
Assignee Guillaume Laforge [ guillaume ]
blackdrag blackdrag made changes - 03/Jul/07 12:27 PM
Assignee Jochen Theodorou [ blackdrag ]
Paul King made changes - 14/Apr/08 7:48 PM
Link This issue relates to GROOVY-1475 [ GROOVY-1475 ]
Paul King made changes - 14/Apr/08 7:52 PM
Link This issue is duplicated by GROOVY-1416 [ GROOVY-1416 ]
Paul King made changes - 14/Apr/08 7:53 PM
Link This issue is duplicated by GROOVY-2752 [ GROOVY-2752 ]
blackdrag blackdrag made changes - 30/Mar/09 2:26 PM
Fix Version/s 1.7-beta-1 [ 14014 ]
Guillaume Laforge made changes - 31/Jul/09 12:10 PM
Fix Version/s 1.7-beta-x [ 15538 ]
Fix Version/s 1.7-beta-1 [ 14014 ]
Martin C. Martin made changes - 26/Oct/09 5:38 AM
Link This issue is related to GROOVY-3088 [ GROOVY-3088 ]
Martin C. Martin made changes - 26/Oct/09 5:39 AM
Link This issue relates to GROOVY-3088 [ GROOVY-3088 ]
blackdrag blackdrag made changes - 16/Feb/11 7:48 AM
Parent GROOVY-4681 [ 121966 ]
Issue Type Bug [ 1 ] Sub-task [ 7 ]
blackdrag blackdrag made changes - 16/Feb/11 7:48 AM
Fix Version/s 1.7.x [ 15538 ]

People

  • Assignee:
    blackdrag blackdrag
    Reporter:
    Russel Winder
Vote (2)
Watch (5)

Dates

  • Created:
    30/Dec/06 6:11 AM
    Updated:
    16/Jul/11 6:18 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.