Kapt: Don't create KDocCommentKeeper when not needed

Previously, even if `keepKdocComments=false`, we would still create the
KDocCommentKeeper object unnecessarily.

This commit makes sure we create the object only if
`keepKdocComments=true`.

Bug: Clean-up after commit e252171 for KT-43593
Test: Existing tests
This commit is contained in:
Hung Nguyen
2021-02-02 22:30:03 +00:00
committed by nataliya.valtman
parent 0a72e16451
commit 592c285198
2 changed files with 12 additions and 20 deletions
@@ -150,7 +150,9 @@ open class KaptContext(val options: KaptOptions, val withJdk: Boolean, val logge
}
compiler = JavaCompiler.instance(context) as KaptJavaCompiler
compiler.keepComments = true
if (options.flags[KaptFlag.KEEP_KDOC_COMMENTS_IN_STUBS]) {
compiler.keepComments = true
}
ClassReader.instance(context).saveParameterNames = true