Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5989 Inner Class Issues
  3. GROOVY-6299

invokeMethod() not called for static inner classes.

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.6
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      None

      Description

      class Parent {
          def invokeMethod(String name, args) {
              [name: name, args: args]
          }
          
          def m(String a) { "m" }
      }
      
      def s = new Parent()
      assert s.m("1") == "m"
      assert s.m(1) == [name: "m", args: [1]]
      
      class Container {
          static class Parent  {
              def invokeMethod(String name, args) {
                  [name: name, args: args]
              }
              
              def m(String a) { "m" }
          }
      }
      
      s = new Container.Parent()
      assert s.m("1") == "m"
      
      // so far, so good…
      
      // Blows up:
      // Caught: groovy.lang.MissingMethodException: No signature of method: static Container.m() is applicable for argument types: (java.lang.Integer) values: [1]
      assert s.m(1) == [name: "m", args: [1]]
      

      Seems related to GROOVY-5875 (which has a waiting pull request)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ldaley Luke Daley
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: