Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8074

@CompileStatic class property accessed instead of map property

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.8
    • Fix Version/s: 2.4.12
    • Component/s: Static compilation
    • Labels:
      None

      Description

      class MyMap extends LinkedHashMap {
        def foo = 1
      }
      
      @CompileStatic
      class Main {
        static void main(String[] args) {
          def map = new MyMap()
          map.put('foo', 42)
          println map.foo // 1 is printed, should be 42
        }
      }
      

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user shils opened a pull request:

          https://github.com/apache/groovy/pull/539

          GROOVY-8074: Statically compiled dot property accesses instance prope…

          …rty instead of Map property

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/shils/groovy GROOVY-8074

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/groovy/pull/539.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #539


          commit abff6c7bf8a953f8f41d4f5080004c436757cb7e
          Author: Shil Sinha <shils@apache.org>
          Date: 2017-05-07T18:47:19Z

          GROOVY-8074: Statically compiled dot property accesses instance property instead of Map property


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user shils opened a pull request: https://github.com/apache/groovy/pull/539 GROOVY-8074 : Statically compiled dot property accesses instance prope… …rty instead of Map property You can merge this pull request into a Git repository by running: $ git pull https://github.com/shils/groovy GROOVY-8074 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/539.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #539 commit abff6c7bf8a953f8f41d4f5080004c436757cb7e Author: Shil Sinha <shils@apache.org> Date: 2017-05-07T18:47:19Z GROOVY-8074 : Statically compiled dot property accesses instance property instead of Map property
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user paulk-asert commented on a diff in the pull request:

          https://github.com/apache/groovy/pull/539#discussion_r115862393

          — Diff: src/test/org/codehaus/groovy/classgen/asm/sc/ArraysAndCollectionsStaticCompileTest.groovy —
          @@ -128,6 +128,18 @@ class ArraysAndCollectionsStaticCompileTest extends ArraysAndCollectionsSTCTest
          }
          }

          + void testMapSubclassPropertyStyleAccess() {
          — End diff –

          maybe add in:
          `// GROOVY-8074`

          Show
          githubbot ASF GitHub Bot added a comment - Github user paulk-asert commented on a diff in the pull request: https://github.com/apache/groovy/pull/539#discussion_r115862393 — Diff: src/test/org/codehaus/groovy/classgen/asm/sc/ArraysAndCollectionsStaticCompileTest.groovy — @@ -128,6 +128,18 @@ class ArraysAndCollectionsStaticCompileTest extends ArraysAndCollectionsSTCTest } } + void testMapSubclassPropertyStyleAccess() { — End diff – maybe add in: `// GROOVY-8074 `
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/groovy/pull/539

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/539
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user shils commented on a diff in the pull request:

          https://github.com/apache/groovy/pull/539#discussion_r116149015

          — Diff: src/test/org/codehaus/groovy/classgen/asm/sc/ArraysAndCollectionsStaticCompileTest.groovy —
          @@ -128,6 +128,18 @@ class ArraysAndCollectionsStaticCompileTest extends ArraysAndCollectionsSTCTest
          }
          }

          + void testMapSubclassPropertyStyleAccess() {
          — End diff –

          Added, thanks for the reminder.

          Show
          githubbot ASF GitHub Bot added a comment - Github user shils commented on a diff in the pull request: https://github.com/apache/groovy/pull/539#discussion_r116149015 — Diff: src/test/org/codehaus/groovy/classgen/asm/sc/ArraysAndCollectionsStaticCompileTest.groovy — @@ -128,6 +128,18 @@ class ArraysAndCollectionsStaticCompileTest extends ArraysAndCollectionsSTCTest } } + void testMapSubclassPropertyStyleAccess() { — End diff – Added, thanks for the reminder.

            People

            • Assignee:
              shils Shil Sinha
              Reporter:
              daniilo Daniil Ovchinnikov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development