Skip to content

GH-11275: Replace unnecessary fully-qualified type references with im… - #11276

Open
ZaheerAhmadDev wants to merge 1 commit into
spring-projects:mainfrom
ZaheerAhmadDev:GH-11275
Open

GH-11275: Replace unnecessary fully-qualified type references with im…#11276
ZaheerAhmadDev wants to merge 1 commit into
spring-projects:mainfrom
ZaheerAhmadDev:GH-11275

Conversation

@ZaheerAhmadDev

@ZaheerAhmadDev ZaheerAhmadDev commented Aug 16, 2026

Copy link
Copy Markdown

Fixes gh-11275

Replaced fullyqualifiedtype referenced with import
It 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.string we can import it, instead of using fullyqualified.

@ZaheerAhmadDev
ZaheerAhmadDev force-pushed the GH-11275 branch 2 times, most recently from 7e14f69 to 6d2030a Compare August 16, 2026 12:33

@artembilan artembilan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZaheerAhmadDev ,

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?

@ZaheerAhmadDev

Copy link
Copy Markdown
Author

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.
if that works for you.?

@artembilan

Copy link
Copy Markdown
Member

Right. Why do we need a separate PR when everything can be addressed here?
More over we cannot separate check and its fix: the project is going to fail until we fix all of them .

@ZaheerAhmadDev

Copy link
Copy Markdown
Author

Right. Why do we need a separate PR when everything can be addressed here? More over we cannot separate check and its fix: the project is going to fail until we fix all of them .

Make sense, lets fix all the violation in this PR.

@ZaheerAhmadDev

Copy link
Copy Markdown
Author

Done fixed all the violations.
@artembilan, please take a look when you get a chance.

@artembilan artembilan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.*;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No asterisk imports, please.
I think there is a respective Checkstyle rule 😁.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this class is deprecated , therefor FQCN for it in the code, pkease

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.*;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

else if (JacksonPresent.isJackson2Present()) {
MessagingMessageConverter messageConverter = new MessagingMessageConverter();
var headerMapper = new org.springframework.kafka.support.DefaultKafkaHeaderMapper();
var headerMapper = new DefaultKafkaHeaderMapper();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.*;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
else if (JacksonPresent.isJackson2Present()) {
var headerMapper = new org.springframework.kafka.support.DefaultKafkaHeaderMapper();
var headerMapper = new DefaultKafkaHeaderMapper();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done revert it to FQCN.

import org.springframework.kafka.support.KafkaUtils;
import org.springframework.kafka.support.LogIfLevelEnabled;
import org.springframework.kafka.support.TopicPartitionOffset;
import org.springframework.kafka.support.*;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
else if (JacksonPresent.isJackson2Present()) {
var headerMapper = new org.springframework.kafka.support.DefaultKafkaHeaderMapper();
var headerMapper = new DefaultKafkaHeaderMapper();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done revert it to fullyqualified.

…erences with imports

Signed-off-by: ZaheerAhmadDev <zk7386048@gmail.com>
@ZaheerAhmadDev

ZaheerAhmadDev commented Aug 17, 2026

Copy link
Copy Markdown
Author

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?

currently check is not yet released it is in review, when we release it with new release, i will add it to then with followup pr.
if we add it now it will gonna show error of not found.
i did fix all of the violation excluding AvroTestClass and deprecated classes, as there is suppression for AvroTestClass in checkstyle-suppression.xml which will exclude this check automatically also but we need to add suppression for deprecated classes will gonna added it when we add check in checkstyle.xml when Checkstyle releases the check,
in a follow up pr.

Screenshot_20260817_132546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FullyQualifiedType usage found by new checkstyle check

2 participants