You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/21 17:06:00 UTC

[jira] [Updated] (GROOVY-9681) Groovy2 indy not backward compatible missingMethod with Groovy3

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

Eric Milles updated GROOVY-9681:
--------------------------------
    Fix Version/s: 3.0.8

> Groovy2 indy not backward compatible missingMethod with Groovy3
> ---------------------------------------------------------------
>
>                 Key: GROOVY-9681
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9681
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>            Reporter: Aleks Tamarkin
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.8, 4.0.0-alpha-3
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> I am getting a
> {code:java}
> Exception in thread "main" java.lang.IllegalArgumentException: array is not of length 1{code}
> To reproduce, compile the following in Groovy 2.5 with
> {code:java}
> groovyOptions.optimizationOptions.indy = true{code}
>  
> {code:java}
> package first
> class Library {   
>     def foo(a, b= '<1>', c= '<2>') {
>         "$a" + b + c     
>     }      
>     def methodMissing(String name, args) {        
>         foo(name, *args[1..<args.size()])     
>     } 
> }{code}
> Then reference the code in Groovy 3.0.5 to reproduce the error
> {code:java}
> package second 
> import first.Library 
> class App { 
>     static void main(String[] args) { 
>         println new Library().bar( 'a' )        
>         println new Library().bin( 'a', 'b')     
>     } 
> }{code}
> {color:#000000} {color}
>  Note that if both are compiled with Groovy2 or Groovy3 the error does not occur.
> This is probably similar to https://issues.apache.org/jira/browse/GROOVY-9515?jql=text%20~%20%22%5C%22array%20is%20not%20of%20length%201%5C%22%22



--
This message was sent by Atlassian Jira
(v8.3.4#803005)