[Native][tests] Keep reflection package name when renaming packages

The test engine renames packages in test files to allow group many tests
into single compilation for performance reasons.

As a result, reflection APIs return different package names. To deal
with this, the test engine uses certain heuristics to detect tests using
reflection APIs, and disables grouping (and thus package renaming) for
them.

This commit provides an alternative solution for the same problem --
now the test engine instructs the compiler to use original package names
for reflection information, by means of the introduced
`ReflectionPackageName` annotation.
This commit is contained in:
Svyatoslav Scherbina
2022-06-09 13:03:51 +03:00
parent 38723816b7
commit cee0731cef
5 changed files with 68 additions and 16 deletions
@@ -178,3 +178,14 @@ internal annotation class HasFreezeHook
@Retention(value = AnnotationRetention.BINARY)
@InternalForKotlinNative
annotation class GCUnsafeCall(val callee: String)
/**
* Marks a declaration that is internal for Kotlin/Native tests and shouldn't be used externally.
*/
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Retention(value = AnnotationRetention.BINARY)
internal annotation class InternalForKotlinNativeTests
@InternalForKotlinNativeTests
@Target(AnnotationTarget.FILE)
public annotation class ReflectionPackageName(val name: String)