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 2018/12/15 04:22:00 UTC

[jira] [Resolved] (GROOVY-8927) String variants for take and drop

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

Paul King resolved GROOVY-8927.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 2.5.5
                   3.0.0-alpha-4

> String variants for take and drop
> ---------------------------------
>
>                 Key: GROOVY-8927
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8927
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> We have {{GString}} but not {{String}} variants for {{take}} and {{drop}}.
> {code}
> @groovy.transform.CompileStatic
> def method() {
>     assert 'Foo Bar'.drop(4).toLowerCase() == 'bar'
>     assert 'Foo Bar'.take(3).toLowerCase() == 'foo'
> }
> method()
> {code}
> You are required to add some superfluous {{.toString()}} calls otherwise you get the following errors:
> {noformat}
> 2 compilation errors:
> [Static type checking] - Cannot find matching method java.lang.CharSequence#toLowerCase(). Please check if the declared type is correct and if the method exists.
>  at line: 3, column: 12
> [Static type checking] - Cannot find matching method java.lang.CharSequence#toLowerCase(). Please check if the declared type is correct and if the method exists.
>  at line: 4, column: 12
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)