Inspectopedia Help

New instance of class annotated with @groovy.lang.Singleton

Reports new instance creation of classes annotated with @groovy.lang.Singleton. Such constructions can lead to runtime exception Can't instantiate singleton.

Example:

@Singleton class Foo{ } Foo foo = new Foo()

After the quick-fix is applied:

@Singleton class Foo{ } Foo foo = Foo.instance

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Groovy, 233.SNAPSHOT

Last modified: 13 July 2023