[
https://issues.apache.org/jira/browse/GROOVY-5226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-5226:
--------------------------------
Language: groovy
> Variables which type is determined thanks to instanceof checks should be
> usable as arguments without casts
> ----------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-5226
> URL: https://issues.apache.org/jira/browse/GROOVY-5226
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.0-beta-2
> Reporter: Cédric Champeau
> Assignee: Cédric Champeau
> Priority: Major
> Fix For: 2.0-beta-3
>
>
> The current implementation of the type checker allows to use methods of an
> object without the need of an explicit cast if it is wrapped in a proper
> {{instanceof}} check:
> {code}
> class A {
> void foo() {}
> }
> def o
> ...
> if (o instanceof A) {
> o.foo()
> }
> {code}
> But it doesn't work if the object is used as an argument:
> {code}
> class A {}
> void m(A a) { ... }
> def o
> ...
> if (o instanceof A) {
> m(o) // requires m((A) o) which should not be necessary
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)