Skip to content

Method visibility rule is too aggressive classes nested in intefaces #140

Closed
@vpavic

Description

@vpavic

While trying to align Spring Session with Spring Java Format 0.0.15 I've found the newly introduced method visibility rule (introduced in #128) to be too aggressive.

For instance, this rule errors out due to methods of Spring Session's CookieSerializer.CookieValue being public. Complying with this would be a breaking API change. This is quite dangerous for a default check.

Another example are @Bean factory methods on (typically static and package-private) inner @Configuration classes as those are no longer allowed to be public. Personally I'd prefer to have all @Bean factory methods public (possibly due to still having the old behavior in the back of my head - see spring-projects/spring-framework#11829) and find this a bit too prescriptive for being among default checks.

With that in mind, my proposal is to remove method visibility rule from automatically applied checks, and have it enabled manually in projects that prefer it, like Spring Boot. Otherwise I feel it greatly impacts the adoption of this project across Spring projects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions