Remove source annotations when copy class with kapt2
Writing source annotations enables incremental compilation for kapt2. However they are not needed in bytecode, so we remove them when copying classes. # Conflicts: # compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt # compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java
This commit is contained in:
+1
-9
@@ -43,7 +43,7 @@ import javax.lang.model.element.*
|
||||
class AnnotationProcessingExtensionForTests(
|
||||
val processors: List<Processor>
|
||||
) : AbstractAnnotationProcessingExtension(createTempDir(), createTempDir(), listOf(), true,
|
||||
createIncrementalDataFile(), StubIncrementalCompilationComponents()) {
|
||||
createIncrementalDataFile(), SourceRetentionAnnotationHandlerImpl()) {
|
||||
override fun loadAnnotationProcessors() = processors
|
||||
|
||||
private companion object {
|
||||
@@ -55,14 +55,6 @@ class AnnotationProcessingExtensionForTests(
|
||||
deleteOnExit()
|
||||
}
|
||||
}
|
||||
|
||||
private class StubIncrementalCompilationComponents : IncrementalCompilationComponents {
|
||||
private val sourceRetentionAnnotationHandler = SourceRetentionAnnotationHandlerImpl()
|
||||
|
||||
override fun getIncrementalCache(target: TargetId) = null!!
|
||||
override fun getLookupTracker() = null!!
|
||||
override fun getSourceRetentionAnnotationHandler() = sourceRetentionAnnotationHandler
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractProcessorTest : AbstractBytecodeTextTest() {
|
||||
|
||||
+2
-4
@@ -233,10 +233,8 @@ class ProcessorTests : AbstractProcessorTest() {
|
||||
fun testSourceRetention() {
|
||||
test("SourceRetention", "*") { set, roundEnv, env -> }
|
||||
val ext = getKapt2Extension()
|
||||
val incrementalCompilationComponents = ext.incrementalCompilationComponents
|
||||
assertNotNull(incrementalCompilationComponents)
|
||||
val annotationHandler = incrementalCompilationComponents!!.getSourceRetentionAnnotationHandler()
|
||||
val annotations = (annotationHandler as SourceRetentionAnnotationHandlerImpl).sourceRetentionAnnotations.sorted()
|
||||
val annotationHandler = ext.sourceRetentionAnnotationHandler as SourceRetentionAnnotationHandlerImpl
|
||||
val annotations = annotationHandler.sourceRetentionAnnotations.sorted()
|
||||
assertEquals("Source1, Source2, Source3, Source4, Test5\$Source5", annotations.joinToString())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user