File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
java/kotlin-extractor/src/main/kotlin Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -820,12 +820,16 @@ open class KotlinFileExtractor(
820
820
821
821
// Taken from declarationBuilders.kt (not available in Kotlin < 1.6):
822
822
private fun addDefaultGetter (p : IrProperty , parentClass : IrClass ) {
823
- val field = p.backingField!!
823
+ val field = p.backingField ? :
824
+ run { logger.warnElement(" Expected property to have a backing field" , p); return }
824
825
p.addGetter {
825
826
origin = IrDeclarationOrigin .DEFAULT_PROPERTY_ACCESSOR
826
827
returnType = field.type
827
828
}.apply {
828
- dispatchReceiverParameter = copyParameterToFunction(parentClass.thisReceiver!! , this )
829
+ val thisReceiever = parentClass.thisReceiver ? :
830
+ run { logger.warnElement(" Expected property's parent class to have a receiver parameter" , parentClass); return }
831
+ val newParam = copyParameterToFunction(thisReceiever, this )
832
+ dispatchReceiverParameter = newParam
829
833
body = factory.createBlockBody(
830
834
UNDEFINED_OFFSET , UNDEFINED_OFFSET , listOf (
831
835
IrReturnImpl (
@@ -838,8 +842,8 @@ open class KotlinFileExtractor(
838
842
field.type,
839
843
IrGetValueImpl (
840
844
UNDEFINED_OFFSET , UNDEFINED_OFFSET ,
841
- dispatchReceiverParameter !! .type,
842
- dispatchReceiverParameter !! .symbol
845
+ newParam .type,
846
+ newParam .symbol
843
847
)
844
848
)
845
849
)
You can’t perform that action at this time.
0 commit comments