Revert "Kapt: Move out the 'final' fallback for initial field values"
This reverts commit 10e53a2e
This commit is contained in:
+6
-4
@@ -640,10 +640,7 @@ class ClassFileToSourceStubConverter(val kaptContext: KaptContextForStubGenerati
|
|||||||
|
|
||||||
lineMappings.registerField(containingClass, field)
|
lineMappings.registerField(containingClass, field)
|
||||||
|
|
||||||
val initializer = explicitInitializer
|
val initializer = explicitInitializer ?: convertPropertyInitializer(field)
|
||||||
?: 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,6 +669,11 @@ 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