Skip to content

InstanceSupplierCodeGenerator fails to detect deprecated type on package private factory method #35486

@snicoll

Description

@snicoll

The algorithm to detect deprecated code to add @SuppressWarnings does not work properly when the factory method isn't public. This impacts the smoke tests with Spring Boot 4.0.0-SNAPSHOT where any MVC app triggers the following warnings:

/Users/snicoll/workspace/work/spring-aot-smoke-tests/main/framework/validation/build/generated/aotSources/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfiguration__BeanDefinitions.java:572: warning: [removal] HandlerMappingIntrospector in org.springframework.web.servlet.handler has been deprecated and marked for removal
    private static BeanInstanceSupplier<HandlerMappingIntrospector> getMvcHandlerMappingIntrospectorInstanceSupplier(
                                        ^
/Users/snicoll/workspace/work/spring-aot-smoke-tests/main/framework/validation/build/generated/aotSources/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfiguration__BeanDefinitions.java:574: warning: [removal] HandlerMappingIntrospector in org.springframework.web.servlet.handler has been deprecated and marked for removal
      return BeanInstanceSupplier.<HandlerMappingIntrospector>forFactoryMethod(WebMvcAutoConfiguration.EnableWebMvcConfiguration.class, "mvcHandlerMappingIntrospector");

If the factory method is public, the warning is correctly detected and a SupressWarnings statement is added as expected.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions