Back to Intellij Community

SingletonConstructor

plugins/groovy/groovy-psi/resources/inspectionDescriptions/SingletonConstructor.html

2025.3-rc-2421 B
Original Source

Reports constructors of classes annotated by @Singleton unless it is declared non-strict.

Example:

@Singleton
  class Foo{
      Foo(){
      }
  }

There are two possible quick-fixes: either to remove the constructor or to declare @Singleton non-strict.

After the quick-fix is applied:

@Singleton
  class Foo{
  }

or:

@Singleton(strict = false)
  class Foo{
      Foo(){
      }
  }