Groovy
  1. Groovy
  2. GROOVY-4133

@Delegate does not handle native methods correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.2, 1.6.9, 1.8-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      class MyString {
          @Delegate String str
      }
      
      assert MyString != null
      

      The code above fails with the error below

      Caught: java.lang.ClassFormatError: Code attribute in native or abstract methods in class file MyString
      

      It happens because String class has a native intern(). The delegate method that @Delegate adds to MyString continues to be marked native and now has code body added to it, which causes the ClassFormatError.

        Activity

        Roshan Dawrani created issue -
        Roshan Dawrani made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.8-beta-1 [ 16013 ]
        Fix Version/s 1.6.9 [ 16236 ]
        Fix Version/s 1.7.2 [ 16237 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12733079 ] Default workflow, editable Closed status [ 12744803 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12970673 ] Default workflow, editable Closed status [ 12978455 ]

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Roshan Dawrani
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development