groovy
  1. groovy
  2. GROOVY-3088

Modifiers on local variables are ignored

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6-beta-2
    • Fix Version/s: 1.8.1
    • Component/s: ast builder
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      In Java, at least, the only modifier allowed on local variables is "final." Groovy seems to accept and ignore all modifiers, final or otherwise. For example:

      class Foo {
      def bar()

      { volatile String xxx println xxx }

      }

      Compiles just fine.

      So there are really two issues here: (a) "final" semantics not being represented and enforced, and (b) all other modifiers not generating parse errors.

      For (a), the DeclarationExpression doesn't seem to have a place to hold modifiers; perhaps it should have an isFinal field?

        Issue Links

          Activity

          blackdrag blackdrag made changes -
          Field Original Value New Value
          Fix Version/s 1.5.8 [ 14630 ]
          Assignee Guillaume Laforge [ guillaume ]
          Guillaume Laforge made changes -
          Fix Version/s 1.5.8 [ 14630 ]
          Fix Version/s 1.6.2 [ 15151 ]
          Guillaume Laforge made changes -
          Fix Version/s 1.6.3 [ 15251 ]
          Fix Version/s 1.6.2 [ 15151 ]
          Guillaume Laforge made changes -
          Fix Version/s 1.7-beta-1 [ 14014 ]
          Fix Version/s 1.6.3 [ 15251 ]
          Guillaume Laforge made changes -
          Fix Version/s 1.7-beta-1 [ 14014 ]
          Fix Version/s 1.7-beta-x [ 15538 ]
          Martin C. Martin made changes -
          Link This issue relates to GROOVY-1628 [ GROOVY-1628 ]
          Martin C. Martin made changes -
          Link This issue is related to GROOVY-1628 [ GROOVY-1628 ]
          Paul King made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Paul King [ paulk ]
          Fix Version/s 1.8.1 [ 17223 ]
          Fix Version/s 1.7.x [ 15538 ]
          Resolution Fixed [ 1 ]
          Paul King made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Paul King
              Reporter:
              Martin C. Martin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: