Groovy
  1. Groovy
  2. GROOVY-3296

Support for primitive types in categories

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6-rc-1
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      None

      Description

      Currently methods that take primitive types cannot be used through categories. While it might not be an issue for new classes created with the future category use in mind, existing classes frequently cannot be changed from using primitive to wrapper types just to be usable as categories.

      For example the Math class is now not very useful to be used as a Category due to this limitation.
      double number = 10.0
      println Math.log(number)
      use(Math) {
      println number.log()
      }
      This code will throw with "Caught: groovy.lang.MissingMethodException: No signature of method: java.lang.Double.log() is applicable for argument types: () values: {}"

        Activity

        Vaclav Pech created issue -
        Guillaume Delcroix made changes -
        Field Original Value New Value
        Fix Version/s 1.6.1 [ 14852 ]
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.1 [ 14852 ]
        Fix Version/s 1.6.2 [ 15151 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.2 [ 15151 ]
        Fix Version/s 1.6.3 [ 15251 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.3 [ 15251 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Fix Version/s 1.7-beta-x [ 15538 ]
        Jochen Theodorou made changes -
        Fix Version/s 1.7.x [ 15538 ]
        Fix Version/s 1.8.x [ 15750 ]
        Fix Version/s 2.x [ 17013 ]
        Pascal Schumacher made changes -
        Fix Version/s 2.x [ 17013 ]
        Fix Version/s 1.8.x [ 15750 ]
        Jochen Theodorou made changes -
        Component/s groovy-runtime [ 16250 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12732293 ] Default workflow, editable Closed status [ 12742971 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12973041 ] Default workflow, editable Closed status [ 12974487 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Vaclav Pech
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development