Skip to content

Commit 78234c5

Browse files
committed
Ensure constructors don't get nullability annotations
1 parent f5dc515 commit 78234c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,11 @@ open class KotlinFileExtractor(
14841484
linesOfCode?.linesOfCodeInDeclaration(f, id)
14851485

14861486
if (extractAnnotations) {
1487-
val extraAnnotations = listOfNotNull(getNullabilityAnnotation(f.returnType, f.origin, f.annotations, getJavaCallable(f)?.annotations))
1487+
val extraAnnotations =
1488+
if (f.symbol is IrConstructorSymbol)
1489+
listOf()
1490+
else
1491+
listOfNotNull(getNullabilityAnnotation(f.returnType, f.origin, f.annotations, getJavaCallable(f)?.annotations))
14881492
extractAnnotations(f, f.annotations + extraAnnotations, id, extractMethodAndParameterTypeAccesses)
14891493
}
14901494

0 commit comments

Comments
 (0)