Ensure constructors don't get nullability annotations

This commit is contained in:
Chris Smowton
2022-12-01 10:13:56 +00:00
parent f5dc5155f9
commit 78234c52fd

View File

@@ -1484,7 +1484,11 @@ open class KotlinFileExtractor(
linesOfCode?.linesOfCodeInDeclaration(f, id)
if (extractAnnotations) {
val extraAnnotations = listOfNotNull(getNullabilityAnnotation(f.returnType, f.origin, f.annotations, getJavaCallable(f)?.annotations))
val extraAnnotations =
if (f.symbol is IrConstructorSymbol)
listOf()
else
listOfNotNull(getNullabilityAnnotation(f.returnType, f.origin, f.annotations, getJavaCallable(f)?.annotations))
extractAnnotations(f, f.annotations + extraAnnotations, id, extractMethodAndParameterTypeAccesses)
}