简体   繁体   中英

How do we add empty string array to org.codehaus.groovy.ast.parameter?

I want to make method lets say

`void foo(String[] xyz)`

To do this I am using {{MethodNode}} and for parameters[] args using org.codehaus.groovy.ast.parameter. But after compilation method signature changes to void foo(String... xyz)

How do i get [] not ... Please help.

您可以得到一个空的String数组,如下所示:

org.codehaus.groovy.ast.ClassHelper.STRING_TYPE.makeArray()

Ya that's is what I did but method argument shows string as 'String....' And same piece of code in method body writes 'String []' And I think it's okay to have 'String...' Works without any issue. Thanks for the help ☺️

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM