@@ -2,7 +2,6 @@ package com.github.xepozz.ide.introspector.core
22
33import com.github.xepozz.ide.introspector.model.ServiceInfo
44import com.intellij.ide.plugins.IdeaPluginDescriptor
5- import com.intellij.ide.plugins.PluginManagerCore
65import com.intellij.openapi.application.ApplicationManager
76import com.intellij.openapi.components.Service
87import com.intellij.openapi.components.ServiceDescriptor
@@ -25,7 +24,7 @@ object ServiceInspector {
2524 /* * XML-declared services across every installed plugin, all three areas. Deterministic. */
2625 fun listAll (): List <ServiceInfo > {
2726 val out = mutableListOf<ServiceInfo >()
28- for (descriptor in PluginManagerCore .plugins ) {
27+ for (descriptor in PluginLookup .allPlugins() ) {
2928 collectFor(descriptor, out )
3029 }
3130 return out
@@ -65,23 +64,44 @@ object ServiceInspector {
6564 ? : sd.testServiceImplementation
6665 ? : sd.headlessImplementation
6766 ? : return null
67+ // ServiceDescriptor itself is public, but `preload` / `os` / `configurationSchemaKey`
68+ // and the enums they reference (PreloadMode / ExtensionDescriptor.Os) are @ApiStatus.Internal.
69+ // Reach them via reflection so we don't trip the plugin verifier.
6870 return ServiceInfo (
6971 interfaceClass = sd.serviceInterface,
7072 implementationClass = impl,
7173 testServiceImplementation = sd.testServiceImplementation,
7274 headlessImplementation = sd.headlessImplementation,
7375 area = areaTag,
74- preload = sd. preload.name ,
76+ preload = readEnumName(sd, " preload" ) ? : " FALSE " ,
7577 client = sd.client?.toString(),
76- os = sd.os?.name ,
78+ os = readEnumName(sd, " os " ) ,
7779 overrides = sd.overrides,
78- configurationSchemaKey = sd. configurationSchemaKey,
80+ configurationSchemaKey = readField(sd, " configurationSchemaKey" ) as ? String ,
7981 providedByPluginId = pluginId,
8082 providedByPluginName = pluginName,
8183 source = " xml" ,
8284 )
8385 }
8486
87+ private fun readField (target : Any , name : String ): Any? {
88+ var c: Class <* >? = target.javaClass
89+ while (c != null ) {
90+ val f = c.declaredFields.firstOrNull { it.name == name }
91+ if (f != null ) {
92+ return try {
93+ f.isAccessible = true
94+ f.get(target)
95+ } catch (_: Throwable ) { null }
96+ }
97+ c = c.superclass
98+ }
99+ return null
100+ }
101+
102+ private fun readEnumName (target : Any , name : String ): String? =
103+ (readField(target, name) as ? Enum <* >)?.name
104+
85105 /* *
86106 * Best-effort enumeration of already-created light services (`@Service`-annotated, registered
87107 * dynamically by the platform without an XML entry). The result is non-deterministic — it
0 commit comments