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

make GPath work correctly on arrays

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1-rc-3
    • None
    • None

    Description

      > String.methods.name //ok
      > String.methods*.getName() //groovy.lang.MissingMethodException
      > String.methods.toList()*.getName() //ok

      see

      public static Object invokeMethodNSpreadSafe(Class senderClass, Object 
      receiver, String messageName, Object[] messageArguments) throws Throwable{
               if (receiver==null) return null;
               if (! (receiver instanceof List)) return 
      invokeMethodN(senderClass,receiver,messageName, messageArguments);
      
               List list = (List) receiver;
               List answer = new ArrayList();
               for (Iterator it = list.iterator(); it.hasNext();) {
                   answer.add(invokeMethodNSafe(senderClass, it.next(), 
      messageName, messageArguments));
               }
               return answer;
           }
      

      -> missing receiver.getClass().isArray()

      Attachments

        Activity

          People

            paulk Paul King
            codevise Dierk König
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: