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

Christopher Smith commented on GROOVY-10888:
--------------------------------------------

I just came by to re-report this same problem, apparently, as of 4.0.12. This 
appears to be a bug in the grammar, and it causes problems in conjunction with 
some of the shortcomings in the STC's handling of generics (I can't provide 
witness hints to the type checker about nested stream collectors, since the 
accumulator type is often wildcarded).

> Parser doesn't accept wildcard in type witness
> ----------------------------------------------
>
>                 Key: GROOVY-10888
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10888
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser-antlr4
>    Affects Versions: 4.0.7
>            Reporter: Christopher Smith
>            Priority: Major
>
> In trying to work around issues relating to nested generic inference (in 
> stream collector definitions), I attempted to add a type witness to a 
> {{.collect}} invocation. As I don't care about the accumulator, and the 
> built-in {{Collectors}} tend to use {{A=?}}, I tried a wildcard, but I got a 
> parse error. This replicates the problem.
> {code}
> class Asdf {
>   void run() {
>     ['a', 'b'].stream()
>       .<Map<Boolean, List<String>>, ?> collect(partitioningBy { it == 'a' })
>   }
> }
> {code}



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

Reply via email to