Skip to content

FinalClass and HideUtilityClassConstructor should not apply for Spring Configuration classes #729

@kthoms

Description

@kthoms

The recipes org.openrewrite.staticanalysis.FinalClass and org.openrewrite.staticanalysis.HideUtilityClassConstructor must not be applied on classes that are annotated with org.springframework.context.annotation.Configuration.

Image

What version of OpenRewrite are you using?

I am using

  • Maven/Gradle plugin v6.17.0
  • rewrite-static-analysis v2.16.0

How are you running OpenRewrite?

I am using the Maven plugin. The project can be checked out from https://github.com/operaton/operaton.git.

Remove the exclusions for FinalClass from /pom.xml and run

./mvnw -U org.openrewrite.maven:rewrite-maven-plugin:run

What is the smallest, simplest way to reproduce the problem?

@org.springframework.context.annotation.Configuration
class A {
}

What did you expect to see?

No change.

What did you see instead?

@org.springframework.context.annotation.Configuration
final class A {
}

or for HideUtilityClassConstructor

@org.springframework.context.annotation.Configuration
class A {
  private A () {}
}

Are you interested in contributing a fix to OpenRewrite?

Sorry, too busy for that ATM. We have excluded the few cases as workaround for the moment and are fine with that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions