using_kotlin.md: note FileType as notable exception for using 'object'

This commit is contained in:
Yann Cébron 2023-10-31 16:16:47 +01:00
parent 5ea293927e
commit 6814f0334d

View File

@ -172,6 +172,8 @@ When registering an extension, the platform uses a dependency injection framewor
For this reason, plugins *must not* use [Kotlin objects](https://kotlinlang.org/docs/object-declarations.html#object-declarations-overview) (`object` keyword) to implement any <path>[plugin.xml](plugin_configuration_file.md)</path> declarations.
Managing the lifecycle of extensions is the platform responsibility and instantiating these classes as Kotlin singletons may cause issues.
A notable exception is `com.intellij.openapi.fileTypes.FileType` (`com.intellij.fileType` extension point), see also the inspection descriptions below.
Problems are highlighted via these inspections (2023.2):
- <control>Plugin DevKit | Code | Kotlin object registered as extension</control> for Kotlin code
- <control>Plugin DevKit | Plugin descriptor | Extension class is a Kotlin object</control> for <path>plugin.xml</path>