You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/04/27 08:34:00 UTC

[jira] [Closed] (GROOVY-10558) Wrong argument type when using static method from nested class

     [ https://issues.apache.org/jira/browse/GROOVY-10558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-10558.
------------------------------

> Wrong argument type when using static method from nested class
> --------------------------------------------------------------
>
>                 Key: GROOVY-10558
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10558
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.16, 3.0.10, 4.0.1
>            Reporter: Leonard Brünings
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-1, 2.5.17, 3.0.11, 4.0.2
>
>
> {code:groovy}
> class Example {
>     static byte[] hash(byte[] bytes) {
>         bytes
>     }
>     static class Nested {        
>         def getCacheKey(byte[] payload) {
>             hash(payload)
>             // hash(payload as byte[]) fails as well 
>             // Example.hash(payload) works
>         }
>     }
> }
> new Example.Nested().getCacheKey("bar".bytes)
> {code}
> fails with
> {noformat}
> groovy.lang.MissingMethodException: No signature of method: static Example.hash() is applicable for argument types: (ArrayList) values: [[98, 97, 114]]
> Possible solutions: hash([B), each(groovy.lang.Closure), wait(), any(), wait(long), is(java.lang.Object)
> 	at Example$Nested.methodMissing(Script1.groovy)
> 	at Example$Nested.getCacheKey(Script1.groovy:7)
> 	at Example$Nested$getCacheKey.call(Unknown Source)
> 	at Script1.run(Script1.groovy:14)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)