mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
[devkit] IDEA-298703 fix wording, make EP impl internal
GitOrigin-RevId: 7d7c0d2a1c1f81c1b69a0fd20e7b585cd76e8aeb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e06cf98d6a
commit
64f639be03
@@ -4,20 +4,18 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
|
||||
interface ServiceInterface
|
||||
@Service(Service.Level.APP)
|
||||
class LightApplicationService1
|
||||
|
||||
@Service(Service.Level.APP)
|
||||
class LightApplicationService1 : ServiceInterface
|
||||
|
||||
@Service(Service.Level.APP)
|
||||
class LightApplicationService2 : ServiceInterface {
|
||||
class LightApplicationService2 {
|
||||
companion object {
|
||||
val <warning descr="An explicit 'getInstance()' method should be used to retrieve an application service instead of a property">instance1</warning>: LightApplicationService2
|
||||
val <warning descr="Provide explicit 'getInstance()' method to access application service instead of a property">instance1</warning>: LightApplicationService2
|
||||
get() = service()
|
||||
|
||||
val <warning descr="An explicit 'getInstance()' method should be used to retrieve an application service instead of a property">instance2</warning> = service<LightApplicationService2>()
|
||||
val <warning descr="Provide explicit 'getInstance()' method to access application service instead of a property">instance2</warning> = service<LightApplicationService2>()
|
||||
|
||||
val <warning descr="An explicit 'getInstance()' method should be used to retrieve an application service instead of a property">instance3</warning> = ApplicationManager.getApplication().getService(LightApplicationService2::class.java)
|
||||
val <warning descr="Provide explicit 'getInstance()' method to access application service instead of a property">instance3</warning> = ApplicationManager.getApplication().getService(LightApplicationService2::class.java)
|
||||
|
||||
// not this service instance but still stores a service with a backing field
|
||||
val <warning descr="Application service must not be assigned to a static immutable property with a backing field">instance4</warning> = service<LightApplicationService1>()
|
||||
|
||||
@@ -33,7 +33,7 @@ class AppService(val service3: RegisteredApplicationService = RegisteredApplicat
|
||||
val <warning descr="Application service must not be assigned to a static immutable property with a backing field">service6</warning> = RegisteredApplicationService.getInstance()
|
||||
|
||||
// static property without backing field, but being an instance
|
||||
val <warning descr="An explicit 'getInstance()' method should be used to retrieve an application service instead of a property">service7</warning>: AppService
|
||||
val <warning descr="Provide explicit 'getInstance()' method to access application service instead of a property">service7</warning>: AppService
|
||||
get() = service<AppService>()
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class MyService {
|
||||
companion object {
|
||||
|
||||
@MyAnnotation
|
||||
val <warning descr="An explicit 'getInstance()' method should be used to retrieve an application service instead of a property">companionObjectAppService<caret></warning> = ApplicationManager.getApplication().getService(MyService::class.java)
|
||||
val <warning descr="Provide explicit 'getInstance()' method to access application service instead of a property">companionObjectAppService<caret></warning> = ApplicationManager.getApplication().getService(MyService::class.java)
|
||||
|
||||
|
||||
// to test naming conflicts
|
||||
|
||||
@@ -25,4 +25,4 @@ inspection.light.service.must.not.be.open.message=Light service must not be open
|
||||
inspection.extension.class.should.not.be.open.text=Extension class should not be open
|
||||
|
||||
inspections.application.service.as.static.immutable.property.with.backing.field.message=Application service must not be assigned to a static immutable property with a backing field
|
||||
inspections.an.explicit.method.should.be.used.to.retrieve.an.application.service.message=An explicit 'getInstance()' method should be used to retrieve an application service instead of a property
|
||||
inspections.an.explicit.method.should.be.used.to.retrieve.an.application.service.message=Provide explicit 'getInstance()' method to access application service instead of a property
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.jetbrains.uast.toUElementOfType
|
||||
import java.util.function.Supplier
|
||||
|
||||
|
||||
private class KtAppServiceAsStaticFinalFieldOrPropertyVisitorProvider : AppServiceAsStaticFinalFieldOrPropertyVisitorProvider {
|
||||
internal class KtAppServiceAsStaticFinalFieldOrPropertyVisitorProvider : AppServiceAsStaticFinalFieldOrPropertyVisitorProvider {
|
||||
|
||||
override fun getVisitor(holder: ProblemsHolder): PsiElementVisitor {
|
||||
return object : KtVisitorVoid() {
|
||||
@@ -66,7 +66,7 @@ private class KtAppServiceAsStaticFinalFieldOrPropertyVisitorProvider : AppServi
|
||||
val anchor = property.nameIdentifier ?: property
|
||||
|
||||
// a property is used by service implementation to retrieve a service instance
|
||||
// if it's inside a companion object and returns and instance of containing class
|
||||
// if it's inside a companion object and returns an instance of containing class
|
||||
val isInstance = property.parentOfType<KtObjectDeclaration>()?.isCompanion() == true &&
|
||||
property.containingClass() == typeClassElement
|
||||
|
||||
|
||||
Reference in New Issue
Block a user