@@ -55,12 +55,19 @@ data class TransformAnnotationData(
5555 ?.takeIf { it.isNotEmpty() }
5656 val suffix = annotationDescriptor.argumentValue(annotationSuffixPropertyName)
5757 ?.accept(AbstractNullableAnnotationArgumentVoidDataVisitor .stringOnly, null )
58- // ?.takeIf { it.isNotEmpty() }
58+
5959 val asProperty = annotationDescriptor.argumentValue(annotationAsPropertyPropertyName)
6060 ?.accept(AbstractNullableAnnotationArgumentVoidDataVisitor .booleanOnly, null )
6161 val functionName = " ${baseName ? : defaultBaseName}${suffix ? : defaultSuffix} "
6262
63- return TransformAnnotationData (annotationDescriptor, baseName, suffix, asProperty, functionName, functionInheritable)
63+ return TransformAnnotationData (
64+ annotationDescriptor,
65+ baseName,
66+ suffix,
67+ asProperty,
68+ functionName,
69+ functionInheritable
70+ )
6471 }
6572 }
6673
@@ -86,11 +93,12 @@ open class FunctionTransformAnnotations(
8693
8794}
8895
89- fun FunctionTransformAnnotations.resolveByFunctionInheritable (): FunctionTransformAnnotations = FunctionTransformAnnotations (
90- jvmBlockingAnnotationData?.takeIf { it.functionInheritable },
91- jvmAsyncAnnotationData?.takeIf { it.functionInheritable },
92- jsAsyncAnnotationData?.takeIf { it.functionInheritable },
93- )
96+ fun FunctionTransformAnnotations.resolveByFunctionInheritable (): FunctionTransformAnnotations =
97+ FunctionTransformAnnotations (
98+ jvmBlockingAnnotationData?.takeIf { it.functionInheritable },
99+ jvmAsyncAnnotationData?.takeIf { it.functionInheritable },
100+ jsAsyncAnnotationData?.takeIf { it.functionInheritable },
101+ )
94102
95103
96104fun FunctionDescriptor.resolveToTransformAnnotations (
@@ -101,6 +109,7 @@ fun FunctionDescriptor.resolveToTransformAnnotations(
101109 val containingAnnotations = containing.annotations.resolveToTransformAnnotations(configuration, baseName)
102110 val functionAnnotations = this .annotations.resolveToTransformAnnotations(configuration, baseName)
103111
112+ // 函数上标记的注解会直接覆盖类上的标记。
104113 return containingAnnotations + functionAnnotations
105114}
106115
@@ -111,9 +120,9 @@ private operator fun FunctionTransformAnnotations.plus(other: FunctionTransformA
111120 if (other.isEmpty) return this
112121
113122 return FunctionTransformAnnotations (
114- jvmBlockingAnnotationData + other.jvmBlockingAnnotationData,
115- jvmAsyncAnnotationData + other.jvmAsyncAnnotationData,
116- jsAsyncAnnotationData + other.jsAsyncAnnotationData,
123+ other. jvmBlockingAnnotationData ? : jvmBlockingAnnotationData, // + other.jvmBlockingAnnotationData,
124+ other. jvmAsyncAnnotationData ? : jvmAsyncAnnotationData, // + other.jvmAsyncAnnotationData,
125+ other. jsAsyncAnnotationData ? : jsAsyncAnnotationData, // + other.jsAsyncAnnotationData,
117126 )
118127}
119128
@@ -134,7 +143,7 @@ private operator fun TransformAnnotationData?.plus(other: TransformAnnotationDat
134143 suffix?.also (::append)
135144 }
136145
137- val functionInheritable = other.functionInheritable.takeIf { it }? : this .functionInheritable
146+ val functionInheritable = other.functionInheritable.takeIf { it } ? : this .functionInheritable
138147
139148 return TransformAnnotationData (
140149 annotationDescriptor = other.annotationDescriptor,
0 commit comments