Skip to content

Commit 553ed03

Browse files
udalovSpace Team
authored andcommitted
Kapt: remove obsolete option kapt.keep.kdoc.comments.in.stubs
The only issue where it was necessary (KT-43593) no longer reproduces, so this option and the related test infra code is not needed anymore.
1 parent a001ad5 commit 553ed03

File tree

14 files changed

+12
-638
lines changed

14 files changed

+12
-638
lines changed

libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/Kapt3KotlinGradleSubplugin.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ internal fun buildKaptSubpluginOptions(
447447
"${kaptExtension.strictMode}"
448448
)
449449
pluginOptions += SubpluginOption("stripMetadata", "${kaptExtension.stripMetadata}")
450-
pluginOptions += SubpluginOption("keepKdocCommentsInStubs", "${KaptProperties.isKaptKeepKdocCommentsInStubs(project).get()}")
451450
pluginOptions += SubpluginOption("showProcessorTimings", "${kaptExtension.showProcessorStats}")
452451
pluginOptions += SubpluginOption("detectMemoryLeaks", kaptExtension.detectMemoryLeaks)
453452
pluginOptions += SubpluginOption("useK2", "${KaptProperties.isUseK2(project).get()}")

libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/KaptProperties.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ internal object KaptProperties {
2222
)
2323
private val KAPT_INFO_AS_WARNINGS = BooleanGradleProperty("kapt.info.as.warnings", false)
2424
private val KAPT_INCLUDE_COMPILE_CLASSPATH = BooleanGradleProperty("kapt.include.compile.classpath", true)
25-
private val KAPT_KEEP_KDOC_COMMENTS_IN_STUBS = BooleanGradleProperty("kapt.keep.kdoc.comments.in.stubs", true)
2625
private val KAPT_USE_K2 = BooleanGradleProperty("kapt.use.k2", true)
2726
private val KAPT_DONT_WARN_ANNOTATION_PROCESSOR_DEPENDENCIES = BooleanGradleProperty(
2827
"kapt.dont.warn.annotationProcessor.dependencies",
@@ -47,10 +46,6 @@ internal object KaptProperties {
4746
it.property(KAPT_INCLUDE_COMPILE_CLASSPATH, project)
4847
}
4948

50-
fun isKaptKeepKdocCommentsInStubs(project: Project): Provider<Boolean> = project.propertiesService.flatMap {
51-
it.property(KAPT_KEEP_KDOC_COMMENTS_IN_STUBS, project)
52-
}
53-
5449
fun isUseK2(project: Project): Provider<Boolean> = project.propertiesService.flatMap {
5550
it.property(KAPT_USE_K2, project).map { propValue ->
5651
if (!propValue)
@@ -70,4 +65,4 @@ internal object KaptProperties {
7065
fun getClassloadersCacheSize(project: Project): Provider<Int> = project.propertiesService.flatMap {
7166
it.property(CLASSLOADERS_CACHE_SIZE, project)
7267
}
73-
}
68+
}

plugins/kapt/kapt-base/src/org/jetbrains/kotlin/kapt/base/KaptContext.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ open class KaptContext(val options: KaptOptions, val withJdk: Boolean, val logge
151151
}
152152

153153
compiler = JavaCompiler.instance(context) as KaptJavaCompiler
154-
if (options.flags[KaptFlag.KEEP_KDOC_COMMENTS_IN_STUBS]) {
155-
compiler.keepComments = true
156-
}
154+
compiler.keepComments = true
157155

158156
ClassReader.instance(context).saveParameterNames = true
159157

plugins/kapt/kapt-base/src/org/jetbrains/kotlin/kapt/base/KaptOptions.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ enum class KaptFlag(val description: String, val defaultValue: Boolean = false)
128128
INCLUDE_COMPILE_CLASSPATH("Detect annotation processors in compile classpath", defaultValue = true),
129129
INCREMENTAL_APT("Incremental annotation processing (apt mode)"),
130130
STRIP_METADATA("Strip @Metadata annotations from stubs"),
131-
KEEP_KDOC_COMMENTS_IN_STUBS("Keep KDoc comments in stubs", defaultValue = true),
132131
;
133132
}
134133

plugins/kapt/kapt-cli/src/KaptCliOption.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,6 @@ enum class KaptCliOption(
208208
cliToolOption = CliToolOption("-Kapt-strip-metadata", FLAG)
209209
),
210210

211-
KEEP_KDOC_COMMENTS_IN_STUBS(
212-
"keepKdocCommentsInStubs",
213-
"true | false",
214-
"Keep KDoc comments in stubs"
215-
),
216-
217211
USE_K2(
218212
"useK2",
219213
"true | false",

plugins/kapt/kapt-compiler/src/org/jetbrains/kotlin/kapt/KaptPlugin.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ class KaptCommandLineProcessor : CommandLineProcessor {
121121
INFO_AS_WARNINGS_OPTION -> setFlag(KaptFlag.INFO_AS_WARNINGS, value)
122122
STRICT_MODE_OPTION -> setFlag(KaptFlag.STRICT, value)
123123
STRIP_METADATA_OPTION -> setFlag(KaptFlag.STRIP_METADATA, value)
124-
KEEP_KDOC_COMMENTS_IN_STUBS -> setFlag(KaptFlag.KEEP_KDOC_COMMENTS_IN_STUBS, value)
125124
USE_K2 -> {}
126125

127126
SHOW_PROCESSOR_STATS -> setFlag(KaptFlag.SHOW_PROCESSOR_STATS, value)

plugins/kapt/kapt-compiler/src/org/jetbrains/kotlin/kapt/stubs/KaptStubConverter.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ class KaptStubConverter(val kaptContext: KaptContextForStubGeneration, val gener
153153
private val correctErrorTypes = kaptContext.options[KaptFlag.CORRECT_ERROR_TYPES]
154154
private val strictMode = kaptContext.options[KaptFlag.STRICT]
155155
private val stripMetadata = kaptContext.options[KaptFlag.STRIP_METADATA]
156-
private val keepKdocComments = kaptContext.options[KaptFlag.KEEP_KDOC_COMMENTS_IN_STUBS]
157156

158157
private val mutableBindings = mutableMapOf<String, KaptJavaFileObject>()
159158

@@ -166,7 +165,7 @@ class KaptStubConverter(val kaptContext: KaptContextForStubGeneration, val gener
166165

167166
private val signatureParser = SignatureParser(treeMaker)
168167

169-
private val kdocCommentKeeper = if (keepKdocComments) KaptDocCommentKeeper(kaptContext) else null
168+
private val kdocCommentKeeper = KaptDocCommentKeeper(kaptContext)
170169

171170
private val importsFromRoot by lazy(::collectImportsFromRootPackage)
172171

@@ -286,9 +285,7 @@ class KaptStubConverter(val kaptContext: KaptContextForStubGeneration, val gener
286285
val classes = JavacList.of<JCTree>(classDeclaration)
287286

288287
val topLevel = treeMaker.TopLevelJava9Aware(packageClause, imports + classes)
289-
if (kdocCommentKeeper != null) {
290-
topLevel.docComments = kdocCommentKeeper.getDocTable(topLevel)
291-
}
288+
topLevel.docComments = kdocCommentKeeper.getDocTable(topLevel)
292289

293290
KaptJavaFileObject(topLevel, classDeclaration).apply {
294291
topLevel.sourcefile = this
@@ -1847,7 +1844,7 @@ class KaptStubConverter(val kaptContext: KaptContextForStubGeneration, val gener
18471844
}
18481845

18491846
private fun <T : JCTree> T.keepKdocCommentsIfNecessary(node: Any): T {
1850-
kdocCommentKeeper?.saveKDocComment(this, node)
1847+
kdocCommentKeeper.saveKDocComment(this, node)
18511848
return this
18521849
}
18531850

plugins/kapt/kapt-compiler/testData/converter/commentsRemoved.fir.txt

Lines changed: 0 additions & 262 deletions
This file was deleted.

0 commit comments

Comments
 (0)