Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
A library for testing Kotlin and Java annotation processors, compiler plugins and code generation
| Date | Stars |
|---|---|
| 2026-07-24 | 712 |
| 2026-07-25 | 712 |
| 2026-07-28 | 712 |
| 2026-07-30 | 712 |
| 2026-08-24 | 711 |
| 2026-08-26 | 710 |
| 2026-08-30 | 710 |
| 2026-09-06 | 710 |
| 2026-09-17 | 711 |
| 2026-09-20 | 711 |
Today
— stars today
This week
+1 stars this week
This month
-1 stars this month
Momentum
0.0
growth rate 0.14%/day
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/06/Kotlin_Icon.svg/512px-Kotlin_Icon.svg.png" align="right" title="Kotlin Logo" width="120">
# Kotlin Compile Testing
[](https://maven-badges.herokuapp.com/maven-central/com.github.tschuchortdev/kotlin-compile-testing)

[](https://shields.io/)
[](https://github.com/tschuchortdev/kotlin-compile-testing/actions)
A library for in-process compilation of Kotlin and Java code, in the spirit of [Google Compile Testing](https://github.com/google/compile-testing). For example, you can use this library to test your annotation processor or compiler plugin.
## Use Cases
- Compile Kotlin and Java code in tests
- Test annotation processors
- Test compiler plugins
- Test Kotlin code generation
## Example
Create sources
```Kotlin
class TestEnvClass {}
@Test
fun `test my annotation processor`() {
val kotlinSource = SourceFile.kotlin(
"KClass.kt", """
class KClass {
fun foo() {
// Classes from the test environment are visible to the compiled sources
val testEnvClass = TestEnvClass()
}
}
"""
)
val javaSource = SourceFile.java(
"JClass.java", """
public class JClass {
public void bar() {
// compiled Kotlin classes are visible to Java sources
KClass kClass = new KClass();
}
}
""")
```
Configure compilation
```Kotlin
val result = KotlinCompilation().apply {
sources = listOf(kotlinSource, javaSource)
// pass your own instance of an annotation processor
annotationProcessors = listOf(MyAnnotationProcessor())
// pass your own instance of a compiler plugin
compilerPlugins = listOf(MyComponentRegistrar())
commandLineProcessors = listOf(MyCommandlineProcessor())
inheritClassPath = true
messageOutputStream = System.out // see diagnostics in real time
}.compile()
```
Assert results
```Kotlin
assertThat(result.exitCode).isEqualTo(ExitCode.OK)
// Test diagnostic output of compiler
assertThat(result.messages).contains("My annotation processor was called")
// Load compiled classes and inspect generated code through reflection
val kClazz = result.classLoader.loadClass("KClass")
assertThat(kClazz).hasDeclaredMethods("foo")
}
```
## Features
- Mixed-source sets: Compile Kotlin and Java source files in a single run
- Annotation processing:
- Run annotation processors on Kotlin and Java sources
- Generate Kotlin and Java sources
- Both Kotlin and Java sources have access to the generated sources
- Provide your own instances of annotation processors directly to the compiler instead of letting the compiler create them with a service locator
- Debug annotation processors: Since the compilation runs in the same process as your application, you can easily debug it instead of having to attach your IDE's debugger manually to the compilation process
- Inherit classpath: Compiled sources have access to classes in your application
- Project Jigsaw compatible: Kotlin-Compile-Testing works with JDK 8 as well as JDK 9 and later
- JDK-crosscompilation: Provide your own JDK to compile the code against, instead of using the host application's JDK. This allows you to easily test your code on all JDK versions
- Find dependencies automatically on the host classpath
## Installation <img src="https://i.imgur.com/iV36acM.png" width="23">
The package is available on Maven CentraExcerpt of 10,756 characters
Read on GitHub188
121
Zac Sweers · @OpenAI · United States
28
25
United States
14
13
6
4
Ralf Wondratschek · OpenAI · United States
4
4
3
3
2
2
2
2
Simon Marquis · @leboncoin · France
2
2
2
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:e898b01989d27502, topic:testing