You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2020/11/18 00:01:00 UTC

[jira] [Created] (GROOVY-9821) STC doesn't recognize interface-based properties

Christopher Smith created GROOVY-9821:
-----------------------------------------

             Summary: STC doesn't recognize interface-based properties
                 Key: GROOVY-9821
                 URL: https://issues.apache.org/jira/browse/GROOVY-9821
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 3.0.6
            Reporter: Christopher Smith


I have been unable to create a more minimal MCVE, but this is reproducable at will using the Spring Security libraries.

The following method definition:

{code:groovy}
def authorities(Authentication auth) {
    auth.authorities*.authority
}
{code}

produces an error

{code}
No such property: authority for class: java.util.Collection <? extends org.springframework.security.core.GrantedAuthority>
{code}

It should be attempting to spread the property access onto the collection's element type, not the collection itself. Using {{*.getAuthority()}} works as expected. I could not replicate with an inline Groovy test case; the resolution works, but invoking against the {{Authentication}} class reliably produces the error.



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