Describe the bug
Consider I want to generate the following code:
class Test {
fun doSomething(): Test? {
// do something
return something as Test?
}
}
kotlinpoet actually generates the following code:
class Test {
fun doSomething(): Test? {
// do something
return something as ?Test
}
}
I highly suspect that this line should be also called on !deferred condition. Otherwise ? is emitted immediately and the type is emitted somewhat later.
To Reproduce
I failed to reproduce this issue with unit test – it seems I lack the knowledge when deferred can be in true state and it is not happening in the simple case.
Please use the following steps to reproduce on a real project:
To debug generator run ./gradlew generateAPI -Dorg.gradle.debug=true and after build start attach debugger.
Describe the bug
Consider I want to generate the following code:
kotlinpoet actually generates the following code:
I highly suspect that this line should be also called on
!deferredcondition. Otherwise?is emitted immediately and the type is emitted somewhat later.To Reproduce
I failed to reproduce this issue with unit test – it seems I lack the knowledge when
deferredcan be intruestate and it is not happening in the simple case.Please use the following steps to reproduce on a real project:
ktdirectory and run./gradlew generateAPItaskControl,Mesh,RenderingDeviceandNodegenerated classes.To debug generator run
./gradlew generateAPI -Dorg.gradle.debug=trueand after build start attach debugger.