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 2020/07/11 06:28:00 UTC

[jira] [Updated] (GROOVY-9562) Base class property causes CCE

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

Paul King updated GROOVY-9562:
------------------------------
    Fix Version/s: 2.5.13

> Base class property causes CCE
> ------------------------------
>
>                 Key: GROOVY-9562
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9562
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.5.11
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.5, 2.5.13
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {code:title=playground.groovy}
> abstract class BaseClass {
>     def prop = 42
> }
> abstract class BaseClass2 {
>     def prop = 69
> }
> @groovy.transform.CompileStatic
> class Impl extends BaseClass {
>     def usage() {
>         new BaseClass2() {
>             def foo() {
>                 prop
>             }
>         }
>     }
> }
> assert new Impl().usage().foo() == 69
> {code}
> Output:
> {noformat}
> Caught: java.lang.ClassCastException: Impl$1 cannot be cast to BaseClass
> java.lang.ClassCastException: Impl$1 cannot be cast to BaseClass
> 	at Impl$1.foo(playground.groovy)
> 	at Impl$1$foo.call(Unknown Source)
> 	at playground.run(playground.groovy:20)
> {noformat}



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