Skip to content

Conversation

@sh-cho
Copy link
Contributor

@sh-cho sh-cho commented May 18, 2025

DeadLetterPublishingRecoverer ctor cannot take Map<Class<?>, KafkaTemplate<?, ?> as parameter, because constructor is Map<Class<?>, KafkaOperations<? extends Object, ? extends Object>>.

$ ./gradlew build
...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler output below.
  /.../config/KafkaConfig.java:161: error: no suitable constructor found for DeadLetterPublishingRecoverer(Map<Class<?>,KafkaTemplate<?,?>>)
          return new DeadLetterPublishingRecoverer(templates);
                 ^
      constructor DeadLetterPublishingRecoverer.DeadLetterPublishingRecoverer(KafkaOperations<? extends Object,? extends Object>) is not applicable
        (argument mismatch; Map<Class<?>,KafkaTemplate<?,?>> cannot be converted to KafkaOperations<? extends Object,? extends Object>)
      constructor DeadLetterPublishingRecoverer.DeadLetterPublishingRecoverer(Map<Class<?>,KafkaOperations<? extends Object,? extends Object>>) is not applicable
        (argument mismatch; Map<Class<?>,KafkaTemplate<?,?>> cannot be converted to Map<Class<?>,KafkaOperations<? extends Object,? extends Object>>)
  Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
  1 error

* Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights.

BUILD FAILED in 981ms
1 actionable task: 1 executed

I guess type should be like this Map<Class<?>, ? extends KafkaOperations<? extends Object, ? extends Object>> to get KafkaTemplate as parameter, but I'm not sure if changing signature is ok. Overloading is not possible because of type erasure.

So I only updated docs first, to upcast explicitly.

Any opinion would be helpful. Thanks

@sobychacko
Copy link
Contributor

@sh-cho Let's start with the docs on this matter as you did in the PR. Please create an issue so that we can track it. We have the opportunity to cleanup things like these in the 4.0.0 version. Let's re-evaluate it later.

@sh-cho
Copy link
Contributor Author

sh-cho commented May 19, 2025

@sobychacko Ok. I made an issue

@sobychacko sobychacko merged commit 56fa428 into spring-projects:main May 19, 2025
3 checks passed
spring-builds pushed a commit that referenced this pull request May 19, 2025
…ns` (#3911)

Signed-off-by: Seonghyeon Cho <[email protected]>
(cherry picked from commit 56fa428)
spring-builds pushed a commit that referenced this pull request May 19, 2025
…ns` (#3911)

Signed-off-by: Seonghyeon Cho <[email protected]>
(cherry picked from commit 56fa428)
@sobychacko sobychacko added this to the 4.0.0-M3 milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants