groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Theodorou (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (GROOVY-8523) Static type checking instanceof
Date Wed, 28 Mar 2018 23:27:00 GMT

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

Jochen Theodorou edited comment on GROOVY-8523 at 3/28/18 11:26 PM:
--------------------------------------------------------------------

does your fix also handle this?
{code}
@CompileStaticImproved
class Gr {
    void f1(Object obj) {
        if (!(obj instanceof Runnable)) {
            return
        }
        if (!(obj instanceof Serializable)) {
            return
        }
        f3(obj) // call is supposed to be legal

    void f3(Runnable r) {  }
}
{code}



was (Author: blackdrag):
does your fix also handle this?
{code}
@CompileStaticImproved
class Gr {
    void f1(Object obj) {
        if (!(obj instanceof Runnable)) {
            return
        }
        if (!(obj instanceof Runnable)) {
            return
        }
        if (!(obj instanceof Serializable)) {
            return
        }
        f3(obj) // call is supposed to be legal

    void f3(Runnable r) {  }
}
{code}


> Static type checking instanceof
> -------------------------------
>
>                 Key: GROOVY-8523
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8523
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.4.13
>            Reporter: Nikolay Chugunov
>            Priority: Minor
>
> Now following code failed to compile : 
> {code}
> @CompileStaticImproved
> class Gr {
>     void f1(Object obj) {
>         if (!(obj instanceof Runnable)) {
>             return
>         }
>         f3(obj) // failed compiled here  : Cannot find matching method Gr#f3(java.lang.Object).

>     }
>     void f3(Runnable r) {  }
> }
> {code}
> I have implemented fix and can submit fix, if needed.
> Idea doesn't highlight this code as error, but groovy compiler failed.



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

Mime
View raw message