Kapt: Move out the 'final' fallback for initial field values
This commit is contained in:
+4
-6
@@ -640,7 +640,10 @@ class ClassFileToSourceStubConverter(val kaptContext: KaptContextForStubGenerati
|
|||||||
|
|
||||||
lineMappings.registerField(containingClass, field)
|
lineMappings.registerField(containingClass, field)
|
||||||
|
|
||||||
val initializer = explicitInitializer ?: convertPropertyInitializer(field)
|
val initializer = explicitInitializer
|
||||||
|
?: convertPropertyInitializer(field)
|
||||||
|
?: if (isFinal(field.access)) convertLiteralExpression(getDefaultValue(type)) else null
|
||||||
|
|
||||||
return treeMaker.VarDef(modifiers, treeMaker.name(name), typeExpression, initializer).keepKdocComments(field)
|
return treeMaker.VarDef(modifiers, treeMaker.name(name), typeExpression, initializer).keepKdocComments(field)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,11 +672,6 @@ class ClassFileToSourceStubConverter(val kaptContext: KaptContextForStubGenerati
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFinal(field.access)) {
|
|
||||||
val type = Type.getType(field.desc)
|
|
||||||
return convertLiteralExpression(getDefaultValue(type))
|
|
||||||
}
|
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user