You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jan Hackel (Jira)" <ji...@apache.org> on 2022/06/29 06:18:00 UTC
[jira] [Created] (GROOVY-10671) STC fails to compile AssertJ fluent API expression
| ![](cid:jira-generated-image-avatar-66b1f69e-c6fc-4017-a513-0665349c77bc) |
[Jan
Hackel](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jhunovis)
**created** an issue
---|---
|
---
| [Groovy](https://issues.apache.org/jira/browse/GROOVY) / [![Bug](cid:jira-
generated-image-
avatar-3a47c7b5-036a-42f1-bfd9-c51fd069ff57)](https://issues.apache.org/jira/browse/GROOVY-10671)
[GROOVY-10671](https://issues.apache.org/jira/browse/GROOVY-10671)
---
[STC fails to compile AssertJ fluent API
expression](https://issues.apache.org/jira/browse/GROOVY-10671)
| Issue Type: | ![Bug](cid:jira-generated-image-
avatar-3a47c7b5-036a-42f1-bfd9-c51fd069ff57) Bug
---|---
Affects Versions: | 4.0.3
Assignee: | Unassigned
Created: | 29/Jun/22 06:17
Priority: | ![Major](cid:jira-generated-image-static-major-0d1cbbae-
bfe2-4caf-9119-e57b6748e7d5) Major
Reporter: | [Jan
Hackel](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jhunovis)
|
Groovy 4.0.3 fails to compile this class:
@Grab('org.assertj:assertj-core:3.22.0')
@Grab('org.junit.jupiter:junit-jupiter-api:5.8.2')
import groovy.transform.CompileStatic
import org.junit.jupiter.api.Test
import static org.assertj.core.api.Assertions.assertThat
@CompileStatic
class AssertJSelfTypesWithCollection {
@Test
void chainWithAs() {
def texts = someStrings()
assertThat(texts)
.as('a test')
.containsExactlyInAnyOrderElementsOf(['a', 'b'])
}
private static Collection<String> someStrings() {
return ['a', 'b']
}
}
It produces a message like
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/home/jh/Code/groovy-bugs/src/test/groovy/de/jhunovis/fluentapi/AssertJSelfTypesWithCollection.groovy: 14: [Static type checking] - Cannot find matching method SELF#containsExactlyInAnyOrderElementsOf(java.util.List<java.lang.String>). Please check if the declared type is correct and if the method exists.
@ line 14, column 5.
assertThat(texts)
^
1 error
---
| | [ ![Add Comment](cid:jira-generated-image-static-comment-
icon-59430029-1355-4a0b-9eaa-5b7471b1269a)
](https://issues.apache.org/jira/browse/GROOVY-10671#add-comment "Add
Comment") | [Add
Comment](https://issues.apache.org/jira/browse/GROOVY-10671#add-comment "Add
Comment")
---|---
| This message was sent by Atlassian Jira (v8.20.10#820010-sha1:ace47f9) | |
![Atlassian logo](https://issues.apache.org/jira/images/mail/atlassian-email-
logo.png)
---