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 2022/08/30 20:42:00 UTC
[jira] [Created] (GROOVY-10734) STC doesn't resolve zero-argument method references in nested generics
Christopher Smith created GROOVY-10734:
------------------------------------------
Summary: STC doesn't resolve zero-argument method references in nested generics
Key: GROOVY-10734
URL: https://issues.apache.org/jira/browse/GROOVY-10734
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Affects Versions: 4.0.4
Reporter: Christopher Smith
I have a rather mundane Streams pipeline trying to group some items by a particular property.
{code}
@CompileStatic
class GroovyExample {
String category
String title
static Object organize(Collection<GroovyExample> examples) {
examples.stream()
.collect(groupingBy(GroovyExample::getCategory))
}
}
{code}
This produces
{code}
Failed to find the expected method[getCategory(java.lang.Object)] in the type[GroovyExample]
{code}
This feels similar to GROOVY-9803 in that the apparent problem is a result of a nested generic call that, while unambiguous according to the JLS rules, doesn't get propagated tightly enough for the STC to correctly recognize that the target type is {{GroovyExample}} and thus the zero-argument method is the correct resolution.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)