groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Champeau (JIRA) <j...@apache.org>
Subject [jira] [Updated] (GROOVY-7505) Change In cast operator precedence
Date Fri, 17 Jul 2015 10:25:04 GMT

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

Cédric Champeau updated GROOVY-7505:
------------------------------------
    Summary: Change In cast operator precedence  (was: Change In Static Compiler Behavior)

> Change In cast operator precedence
> ----------------------------------
>
>                 Key: GROOVY-7505
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7505
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>            Reporter: Jeff Scott Brown
>            Assignee: Cédric Champeau
>
> The following code compiles with Groovy 2.4.3 and will not compile with Groovy 2.4.4.
> {code:title=Demo.groovy|borderStyle=solid}
> import groovy.transform.CompileStatic
> @CompileStatic
> class Demo {
>     String[] getStrings(boolean b) {
>         (String[]) b ? methodOne() : methodTwo()
>     }
>     String[] methodOne() {
>         ['Chris Squire'] as String[]
>     }
>     String[] methodTwo() {
>         ['Chris Squire'] as String[]
>     }
> }
> {code}
> {noformat}
> /Users/jeff/expressionquestion/src/main/groovy/demo/Demo.groovy: 9: [Static type checking]
- Inconvertible types: cannot cast boolean to java.lang.String[]
>  @ line 9, column 9.
>            (String[]) b ? methodOne() : methodTwo()
>            ^
> 1 error
> :compileGroovy FAILED
> FAILURE: Build failed with an exception.
> {noformat}
> Is that intentional?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message