Jan Hackel created GROOVY-11057: ----------------------------------- Summary: STC Generic type matching failure Key: GROOVY-11057 URL: https://issues.apache.org/jira/browse/GROOVY-11057 Project: Groovy Issue Type: Bug Components: Compiler Affects Versions: 4.0.12 Reporter: Jan Hackel
With Groovy version 4.0.12 this code will no longer compile: {code:java} import groovy.transform.CompileStatic import org.junit.jupiter.api.Test import org.mockito.Mockito @CompileStatic interface Configuration { Map<String, Object> getSettings() } @CompileStatic class GenericMapStubbing { @Test void stubSettings() { def configuration = Mockito.mock(Configuration).tap { Mockito.when(it.getSettings()).thenReturn([:]) } assert configuration.settings.isEmpty() } } {code} Failure message: 18: [Static type checking] - Cannot find matching method org.mockito.stubbing.OngoingStubbing#thenReturn(java.util.LinkedHashMap<#K, #V>). Please check if the declared type is correct and if the method exists. @ line 16, column 7. Mockito.when(it.getSettings()).thenReturn([:]) -- This message was sent by Atlassian Jira (v8.20.10#820010)