You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2021/06/08 11:28:40 UTC

[GitHub] [groovy] paulk-asert edited a comment on pull request #1591: GROOVY-10099 Behave when varargs method called with null single argument.

paulk-asert edited a comment on pull request #1591:
URL: https://github.com/apache/groovy/pull/1591#issuecomment-856682888


   Excellent work Rachel. You certainly dived deep for your first PR! As Eric said, it will take us some time to digest. I was at first expecting the following program to exhibit the same behavior under Java and Groovy (with your changes):
   ```
   import static org.codehaus.groovy.runtime.DefaultGroovyMethods.dump;
   
   public class Main {
       public static void method(Object... args) {
           System.out.println(dump(args));
           if (args != null) {
               System.out.println(args.length);
               if (args.length > 0) {
                   System.out.println(args[0]);
               }
           }
       }
   
       public static void main(String[] args) {
           method(null);
           method((Object) null);
           method((Object[]) null);
       }
   }
   ```
   But I see you aligned with statically compiled Groovy rather than Java for the no cast case and for that case we have different behavior. I will need to work through our precedence conventions and convince myself that we have that edge case right for statically compiled Groovy. There are a few spots where documentation also needs some finessing but we can cover that once we have sorted the behavior.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org