Groovy
  1. Groovy
  2. GROOVY-3335

Exception while evaluating classes with static toString() methods

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6.1, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      Try the following script:

      assert 'class java.text.SimpleDateFormat' == java.text.SimpleDateFormat.toString()
      assert 'class java.lang.Integer' == java.lang.Integer.toString()

      the second statement throws exception:
      Exception thrown: Could not find which method toString() to invoke from this list:
      public static java.lang.String java.lang.Integer#toString(int)
      public static java.lang.String java.lang.Integer#toString(int, int)

      It looks like Class.toString() is not taken into account while trying to evaluate this expression.
      Integer.class.toString() produces the same error.

        Activity

        Sergey Bondarenko created issue -
        Roshan Dawrani made changes -
        Field Original Value New Value
        Assignee Roshan Dawrani [ roshandawrani ]
        Hide
        Jochen Theodorou added a comment -

        Roshan... in your fix you seem to swallow the MethodSelectionException, since that exception contains informations about what methods are available it would be nice if that exception could be thrown at the end instead of a MissingMehodException.

        Show
        Jochen Theodorou added a comment - Roshan... in your fix you seem to swallow the MethodSelectionException, since that exception contains informations about what methods are available it would be nice if that exception could be thrown at the end instead of a MissingMehodException.
        Hide
        Roshan Dawrani added a comment -

        You mean to say that if 1st call to chooseMethod() throws an exception, I should store it and at the time of return, if the method to return is still null, I should throw that previously thrown exception so that information in it can be utilized for whatever purpose?

        Show
        Roshan Dawrani added a comment - You mean to say that if 1st call to chooseMethod() throws an exception, I should store it and at the time of return, if the method to return is still null, I should throw that previously thrown exception so that information in it can be utilized for whatever purpose?
        Hide
        Jochen Theodorou added a comment -

        yes

        Show
        Jochen Theodorou added a comment - yes
        Hide
        Roshan Dawrani added a comment -

        Fixed on 1.5.8, 1.6.1 and 1.7-beta-1 branches.

        Show
        Roshan Dawrani added a comment - Fixed on 1.5.8, 1.6.1 and 1.7-beta-1 branches.
        Roshan Dawrani made changes -
        Fix Version/s 1.5.8 [ 14630 ]
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.6.1 [ 14852 ]
        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 [ 12732331 ] Default workflow, editable Closed status [ 12744162 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12970173 ] Default workflow, editable Closed status [ 12977949 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        23h 22m 1 Roshan Dawrani 04/Feb/09 14:17
        Resolved Resolved Closed Closed
        62d 9h 13m 1 Paul King 08/Apr/09 00:31

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development