You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* While [symbol][org.jetbrains.kotlin.analysis.api.symbols.KaSymbolProvider.symbol] is actually a property from the [KaSymbolProvider][org.jetbrains.kotlin.analysis.api.symbols.KaSymbolProvider]
32
32
* session component, it is usable directly in the [KaSession][org.jetbrains.kotlin.analysis.api.KaSession] context because the property has
33
33
* been mixed into the session.
34
+
*
35
+
* All public API components inherited from [KaSessionComponent] are expected to be direct children of [KaSessionComponent].
36
+
* That's required for the correctness of the Analysis API context parameter bridge checker, which ensures that each API endpoint from
37
+
* session components has a corresponding context parameter bridge in the same file.
* This test was introduced to automatically check that every public API
17
+
* from some [org.jetbrains.kotlin.analysis.api.components.KaSessionComponent] has a corresponding context parameter bridge in the same file.
18
+
*
19
+
* See KT-78093 Add bridges for context parameters
20
+
*
21
+
* The test iterates through all the source directories [sourceDirectories] and
22
+
* for each directory [SourceDirectory.sourcePaths] builds a separate resulting file
23
+
* containing all public API endpoints with no context parameter bridge along with fully qualified names and parameter types.
24
+
*
25
+
* Then the test compares the contents of the resulting file
26
+
* and the master file [SourceDirectory.ForDumpFileComparison.outputFilePath]
27
+
*
28
+
* The test is intended to prevent developers from not implementing context parameter bridges,
29
+
* as it's a vital feature for the users' experience.
30
+
* If the lack of a context parameters bridge for some declaration is intentional,
31
+
* the developer has to manually add this declaration to the master file.
32
+
*
33
+
* The test works as follows:
34
+
* 1. For each file, the test finds all classes that are subtypes of [org.jetbrains.kotlin.analysis.api.components.KaSessionComponent] and collects all public members from them.
35
+
* 2. In the exact same file it collects all top-level callable declarations that have [org.jetbrains.kotlin.analysis.api.KaContextParameterApi] annotation,
36
+
* which marks them as context parameter bridges.
37
+
* 3. For each member declaration from step 1, it checks if there's a corresponding context parameter bridge in the same file.
38
+
* The test checks that the context parameter of the bridge matches the type of [org.jetbrains.kotlin.analysis.api.components.KaSessionComponent] the member belongs to
39
+
* and then checks that their signatures are equivalent.
40
+
* 4. If there's no corresponding context parameter bridge found, the test adds the member to the resulting file.
41
+
*
42
+
* The test also checks that there are no unused context parameter bridges, i.e., a bridge that doesn't have a pairing member declaration
43
+
* and thus points to itself. If such a bridge is found, the test throws an exception.
44
+
*
45
+
* The test relies on two fundamental assumptions:
46
+
* 1. All public children of [org.jetbrains.kotlin.analysis.api.components.KaSessionComponent] have it as their direct supertype.
47
+
* 2. All context parameter bridges are annotated with [org.jetbrains.kotlin.analysis.api.KaContextParameterApi] and are located in the same file as the corresponding component.
0 commit comments