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 2022/03/25 17:03:00 UTC

[jira] [Commented] (GROOVY-7135) non-existing method use with super passes type checker in trait

    [ https://issues.apache.org/jira/browse/GROOVY-7135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17512482#comment-17512482 ] 

Eric Milles commented on GROOVY-7135:
-------------------------------------

Currently {{TraitTypeCheckingExtension#handleMissingMethod}} transforms "$self.Ttrait$super$bar()" into a dynamic call for purposes trait forwarding.

> non-existing method use with super passes type checker in trait
> ---------------------------------------------------------------
>
>                 Key: GROOVY-7135
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7135
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.3.7, 2.4.0-beta-3
>            Reporter: Jochen Theodorou
>            Priority: Major
>              Labels: traits
>
> If a trait uses "super.foo()" then this passes the compiler even if there is no foo method defined in the hierarchy of the current trait. Example :
> {code:Java}
> @groovy.transform.CompileStatic
> trait B {
>     void bar(){super.foo()}
> }
> class X implements B{}
> new X().bar()
> {code}
> The compiler should complain for about the super.foo() call



--
This message was sent by Atlassian Jira
(v8.20.1#820001)