GH-11275: Replace unnecessary fully-qualified type references with im… - #11276
GH-11275: Replace unnecessary fully-qualified type references with im…#11276ZaheerAhmadDev wants to merge 1 commit into
Conversation
7e14f69 to
6d2030a
Compare
artembilan
left a comment
There was a problem hiding this comment.
thank you for an update!
May we understand that this PR is going to fix the mentioned issue in full potential?
Or do you anticipate some phases?
|
Not likely, this PR is mostly to get real-world feedback and show the check has practical value it only fixes some part of the violations. Once the check is merged upstream, I can open a new PR to address the rest. |
|
Right. Why do we need a separate PR when everything can be addressed here? |
Make sense, lets fix all the violation in this PR. |
6d2030a to
c7e4272
Compare
|
Done fixed all the violations. |
c7e4272 to
fa6c781
Compare
artembilan
left a comment
There was a problem hiding this comment.
Thanks, but I don’t see an addition to the Checkstyle.xml.
Or do you mean to fix classes first and apply check because there are so many of them?
| import org.springframework.messaging.converter.GenericMessageConverter; | ||
| import org.springframework.messaging.converter.JacksonJsonMessageConverter; | ||
| import org.springframework.messaging.converter.MessageConverter; | ||
| import org.springframework.messaging.converter.*; |
There was a problem hiding this comment.
No asterisk imports, please.
I think there is a respective Checkstyle rule 😁.
There was a problem hiding this comment.
Done revert it.
I think there is a respective Checkstyle rule 😁.
avoidstarimport check does that :).
| import org.springframework.beans.factory.InitializingBean; | ||
| import org.springframework.core.convert.ConversionService; | ||
| import org.springframework.core.convert.support.DefaultConversionService; | ||
| import org.springframework.integration.support.json.Jackson2JsonObjectMapper; |
There was a problem hiding this comment.
I believe that this class is deprecated , therefor FQCN for it in the code, pkease
There was a problem hiding this comment.
Done revert it back to FQCN.
| import org.springframework.http.converter.feed.AtomFeedHttpMessageConverter; | ||
| import org.springframework.http.converter.feed.RssChannelHttpMessageConverter; | ||
| import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter; | ||
| import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
There was a problem hiding this comment.
Done, now all deprecate revert back to FQCN.
| import org.springframework.kafka.support.JacksonPresent; | ||
| import org.springframework.kafka.support.JsonKafkaHeaderMapper; | ||
| import org.springframework.kafka.support.KafkaHeaders; | ||
| import org.springframework.kafka.support.*; |
| else if (JacksonPresent.isJackson2Present()) { | ||
| MessagingMessageConverter messageConverter = new MessagingMessageConverter(); | ||
| var headerMapper = new org.springframework.kafka.support.DefaultKafkaHeaderMapper(); | ||
| var headerMapper = new DefaultKafkaHeaderMapper(); |
There was a problem hiding this comment.
This one is deprecated.
I thought we discussed that with you to skip.
Maybe there is a way for Checkstyle to read a file for such a class usage and spot expected @Deprecated at the class name ?
There was a problem hiding this comment.
I thought we discussed that with you to skip.
i did skip it but some of them have been missed now all deprecated are FQCN.
Maybe there is a way for Checkstyle to read a file for such a class usage and spot expected @deprecated at the class name ?
Suppressionxpath can supress it https://checkstyle.sourceforge.io/filters/suppressionxpathfilter.html .
| import org.springframework.kafka.support.JacksonPresent; | ||
| import org.springframework.kafka.support.JsonKafkaHeaderMapper; | ||
| import org.springframework.kafka.support.KafkaHeaders; | ||
| import org.springframework.kafka.support.*; |
| } | ||
| else if (JacksonPresent.isJackson2Present()) { | ||
| var headerMapper = new org.springframework.kafka.support.DefaultKafkaHeaderMapper(); | ||
| var headerMapper = new DefaultKafkaHeaderMapper(); |
| import org.springframework.kafka.support.KafkaUtils; | ||
| import org.springframework.kafka.support.LogIfLevelEnabled; | ||
| import org.springframework.kafka.support.TopicPartitionOffset; | ||
| import org.springframework.kafka.support.*; |
| } | ||
| else if (JacksonPresent.isJackson2Present()) { | ||
| var headerMapper = new org.springframework.kafka.support.DefaultKafkaHeaderMapper(); | ||
| var headerMapper = new DefaultKafkaHeaderMapper(); |
There was a problem hiding this comment.
Done revert it to fullyqualified.
…erences with imports Signed-off-by: ZaheerAhmadDev <zk7386048@gmail.com>
fa6c781 to
1f3f24f
Compare

Fixes gh-11275
Replaced fullyqualifiedtype referenced with
importIt make code more readeable and consistant.
these violation found in:https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/4bb42ce_2026073849/reports/diff/spring-integration/index.html
Did fix some of the violation, most of the violation is
java.lang.stringwe can import it, instead of using fullyqualified.