fix: 转义属性值中的 $,避免 Javadoc 格式化异常

This commit is contained in:
Doddddd
2025-06-27 00:54:46 +08:00
parent 99a6e02d1d
commit a16da731cf

View File

@@ -203,11 +203,12 @@ internal class PropertiesAccessorsGenerator {
addMethod( addMethod(
MethodSpec.methodBuilder("get${getOrCreateUsedSuccessiveMethodName(methodName, className).capitalize()}").apply { MethodSpec.methodBuilder("get${getOrCreateUsedSuccessiveMethodName(methodName, className).capitalize()}").apply {
val typedValue = value.parseTypedValue(configs.isEnableTypeAutoConversion) val typedValue = value.parseTypedValue(configs.isEnableTypeAutoConversion)
addJavadoc("Resolve the \"$accessorsName\" value ${typedValue.second}") val safeValueForJavadoc = typedValue.second.replace("$", "$$")
addJavadoc("Resolve the \"$accessorsName\" value $safeValueForJavadoc")
addModifiers(Modifier.PUBLIC, Modifier.FINAL) addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.addAnnotation(Nonnull::class.java) .addAnnotation(Nonnull::class.java)
.returns(typedValue.first.java) .returns(typedValue.first.java)
.addStatement("return ${typedValue.second}") .addStatement("return $safeValueForJavadoc")
}.build() }.build()
) )