[KAPT] Don't fail on empty InsnList
Fix failing on empty methods inline methods (after light generation) #KT-45032 Fixed
This commit is contained in:
@@ -61,7 +61,7 @@ class InsnSequence(val from: AbstractInsnNode, val to: AbstractInsnNode?) : Sequ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun InsnList.asSequence() = InsnSequence(this)
|
fun InsnList.asSequence(): Sequence<AbstractInsnNode> = if (size() == 0) emptySequence() else InsnSequence(this)
|
||||||
|
|
||||||
fun MethodNode.prepareForEmitting() {
|
fun MethodNode.prepareForEmitting() {
|
||||||
stripOptimizationMarkers()
|
stripOptimizationMarkers()
|
||||||
|
|||||||
+17
-1
@@ -287,6 +287,22 @@ open class KaptIncrementalIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testChangeInlineDelegate() {
|
||||||
|
val project = getProject()
|
||||||
|
project.build("build") {
|
||||||
|
assertSuccessful()
|
||||||
|
}
|
||||||
|
|
||||||
|
val file = project.projectDir.getFileByName("Usage.kt")
|
||||||
|
file.modify { "$it//" }
|
||||||
|
|
||||||
|
project.build("build") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertTasksExecuted(":kaptGenerateStubsKotlin", ":compileKotlin")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun CompiledProject.assertCompiledKotlinSourcesHandleKapt3(
|
private fun CompiledProject.assertCompiledKotlinSourcesHandleKapt3(
|
||||||
sources: Iterable<String>,
|
sources: Iterable<String>,
|
||||||
weakTesting: Boolean = false
|
weakTesting: Boolean = false
|
||||||
@@ -319,4 +335,4 @@ open class KaptIncrementalIT : BaseGradleIT() {
|
|||||||
val names = annotatedElementNames.map { it.capitalize() + "Generated" }
|
val names = annotatedElementNames.map { it.capitalize() + "Generated" }
|
||||||
return names.map { it + ".java" }
|
return names.map { it + ".java" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package delegate
|
||||||
|
|
||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
class Delegate() {
|
||||||
|
inline operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
|
||||||
|
return "I'm your val"
|
||||||
|
}
|
||||||
|
|
||||||
|
inline operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
|
||||||
|
println("$value has been assigned to '${property.name}' in $thisRef.")
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package delegate
|
||||||
|
|
||||||
|
object Usage {
|
||||||
|
|
||||||
|
var delegated: String by Delegate()
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user