[
https://issues.apache.org/jira/browse/GROOVY-9821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-9821.
-----------------------------
> STC: spread-safe and list property access error for CollType<? extends
> ItemType>
> --------------------------------------------------------------------------------
>
> 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
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 2.5.14, 3.0.7, 4.0.0-alpha-2
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> I have been unable to create a more minimal MCVE, but this is reproducible 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. The error occurs in both {{@CompileStatic}} and
> {{@TypeChecked}}.
> Removing static type checking makes Eclipse correctly display the
> interface-based property.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)