@@ -52,16 +52,15 @@ import java.nio.file.Paths
52
52
/* *
53
53
* Kotlin compiler extension that tracks classes (and corresponding classpath jars) needed to
54
54
* compile current kotlin target. Tracked data should include all classes whose changes could
55
- * affect target's compilation out : direct class dependencies (i.e external classes directly
55
+ * affect target's compilation out : direct class dependencies (i.e. external classes directly
56
56
* used), but also their superclass, interfaces, etc.
57
57
* The primary use of this extension is to improve Kotlin module compilation avoidance in build
58
58
* systems (like Buck).
59
59
*
60
- * Tracking of classes is done with a Remapper, which exposes all object types used by the class
61
- * bytecode being generated. Tracking of the ancestor classes is done via modules and class
60
+ * Tracking of classes and their ancestors is done via modules and class
62
61
* descriptors that got generated during analysis/resolve phase of Kotlin compilation.
63
62
*
64
- * Note: annotation processors dependencies may need to be tracked separatly (and may not need
63
+ * Note: annotation processors dependencies may need to be tracked separately (and may not need
65
64
* per-class ABI change tracking)
66
65
*
67
66
* @param project the current compilation project
@@ -130,10 +129,10 @@ class JdepsGenExtension(
130
129
) {
131
130
when (val resultingDescriptor = resolvedCall.resultingDescriptor) {
132
131
is FunctionImportedFromObject -> {
133
- collectTypeReferences((resolvedCall. resultingDescriptor as FunctionImportedFromObject ) .containingObject.defaultType)
132
+ collectTypeReferences(resultingDescriptor.containingObject.defaultType)
134
133
}
135
134
is PropertyImportedFromObject -> {
136
- collectTypeReferences((resolvedCall. resultingDescriptor as PropertyImportedFromObject ) .containingObject.defaultType)
135
+ collectTypeReferences(resultingDescriptor.containingObject.defaultType)
137
136
}
138
137
is JavaMethodDescriptor -> {
139
138
getClassCanonicalPath((resultingDescriptor.containingDeclaration as ClassDescriptor ).typeConstructor)?.let { explicitClassesCanonicalPaths.add(it) }
@@ -223,26 +222,23 @@ class JdepsGenExtension(
223
222
* types.
224
223
*/
225
224
private fun collectTypeReferences (kotlinType : KotlinType ,
226
- isExplicit : Boolean = true,
227
- collectSuperTypes : Boolean = true) {
225
+ isExplicit : Boolean = true) {
228
226
if (isExplicit) {
229
227
addExplicitDep(kotlinType)
230
228
} else {
231
229
addImplicitDep(kotlinType)
232
230
}
233
231
234
- if (collectSuperTypes) {
235
- kotlinType.supertypes().forEach {
236
- addImplicitDep(it)
237
- }
232
+ kotlinType.supertypes().forEach {
233
+ addImplicitDep(it)
238
234
}
239
235
240
236
collectTypeArguments(kotlinType, isExplicit)
241
237
}
242
238
243
- fun collectTypeArguments (kotlinType : KotlinType ,
244
- isExplicit : Boolean ,
245
- visitedKotlinTypes : MutableSet <KotlinType > = mutableSetOf()) {
239
+ private fun collectTypeArguments (kotlinType : KotlinType ,
240
+ isExplicit : Boolean ,
241
+ visitedKotlinTypes : MutableSet <KotlinType > = mutableSetOf()) {
246
242
visitedKotlinTypes.add(kotlinType)
247
243
kotlinType.arguments.map { it.type }.forEach { typeArgument ->
248
244
if (isExplicit) {
0 commit comments