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 2025/07/18 14:01:00 UTC

[jira] [Assigned] (GROOVY-11677) variable and method with same name creates compile error trying to "call" variable name

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

Eric Milles reassigned GROOVY-11677:
------------------------------------

    Assignee: Eric Milles

> variable and method with same name creates compile error trying to "call" variable name
> ---------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11677
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11677
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation
>    Affects Versions: 5.0.0-alpha-12
>            Reporter: Saravanan
>            Assignee: Eric Milles
>            Priority: Major
>
> {code:java}
> public class SomeClass {
>     public List<String> names() {
>         return new ArrayList<>();
>     }
>     public void printNames(List<String> names) {
>         System.out.println(names);
>         System.out.println(names());
>     }
> }{code}
> Compiling this code with @CompileStatic will result in this compile error
> {noformat}
> testdata/plugins/records/RecordTesting.java: 18: [Static type checking] - Cannot find matching method java.util.List#call(). Please check if the declared type is correct and if the method exists.
>  @ line 18, column 28.
>            System.out.println(names());
>                               ^1 error
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)