Christopher Smith created GROOVY-10887: ------------------------------------------
Summary: groovyc STC loses generic information in extension methods Key: GROOVY-10887 URL: https://issues.apache.org/jira/browse/GROOVY-10887 Project: Groovy Issue Type: Bug Components: Static Type Checker Affects Versions: 4.0.7, 4.0.6 Reporter: Christopher Smith N.B.: This code compiles as expected under GRECLIPSE (both the 2022-12-06 and 2022-12-26 nightlies) but fails under groovyc. I have extension methods that are intended to be applied to Spring Integration DSLs: {code} public final class SpringIntegrationDefaultMethods { public static <C extends AbstractMessageChannel, S extends MessageChannelSpec<S, C>> S markMessagesAsJumpered(S self) { return self.interceptor(new JumperInterceptor()); // returns S } } {code} {code} moduleName = example-util-spring-integration moduleVersion = 0.0.1 extensionClasses = com.example.util.spring.integration.groovy.SpringIntegrationDefaultMethods {code} >From a Groovy configuration class: {code} @Bean(CHANNEL_DISPATCH_MESSAGE) MessageChannel dispatchQueueOutgoing() { // org.springframework.integration.dsl.MessageChannels. publishSubscribe(true) // line 49 .minSubscribers(2) .markMessagesAsJumpered() .get() } {code} In Eclipse, this compiles as expected. In groovyc 4.0.6 and 4.0.7, I get {code} [ERROR] /home/christopher/git/.../DispatchHandlingIntegration.groovy: 49: [Static type checking] - Cannot find matching method S#get(). Please check if the declared type is correct and if the method exists. [ERROR] @ line 49, column 9. [ERROR] publishSubscribe(true) {code} Adding an explicit type witness {code} .<PublishSubscribeChannel, PublishSubscribeChannelSpec<?>> markMessagesAsJumpered() {code} resolves the error in groovyc. -- This message was sent by Atlassian Jira (v8.20.10#820010)