Skip to content

Commit

Permalink
handle no jvm class file use case for declarationOrdering
Browse files Browse the repository at this point in the history
  • Loading branch information
neetopia committed Jan 30, 2024
1 parent 192212b commit cd59900
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ class ResolverAAImpl(
val classId = (parentClass as KSClassDeclarationImpl).ktClassOrObjectSymbol.classIdIfNonLocal
?: return container.declarations
val virtualFile = analyze {
(fileManager.findClass(classId, analysisScope) as JavaClassImpl).virtualFile
}!!
(fileManager.findClass(classId, analysisScope) as? JavaClassImpl)?.virtualFile
} ?: return container.declarations
val kotlinClass = classBinaryCache.getKotlinBinaryClass(virtualFile) ?: return container.declarations
val declarationOrdering = DeclarationOrdering(kotlinClass)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ class DeclarationOrderProcessor : AbstractTestProcessor() {
}
)
}
result.addAll(
resolver.getDeclarationsInSourceOrder(resolver.getClassDeclarationByName("kotlin.Any")!!).map {
it.toSignature(resolver)
}
)
return emptyList()
}

Expand Down
4 changes: 4 additions & 0 deletions test-utils/testData/api/declarationOrder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
// overloaded:(I)V
// overloaded:()V
// overloaded:(Ljava/lang/String;Ljava/lang/String;)V
// equals:(Ljava/lang/Object;)Z
// hashCode:()I
// toString:()Ljava/lang/String;
// <init>:()V
// END
// MODULE: module1
// FILE: lib/KotlinClass.kt
Expand Down

0 comments on commit cd59900

Please sign in to comment.