It appears that you cache a data structure based on hashing but do not check for hash collisions, this looks like sneaky bug to me.
The following is in the SourceLocation companion:
introspekt-runtime/src/commonMain/kotlin/dev/karmakrafts/introspekt/util/SourceLocation.kt
/**
* Gets an existing [SourceLocation] from the cache or creates a new one if it doesn't exist.
*
* This method helps reduce memory usage by reusing instances with the same parameters.
*
* @param module The module name.
* @param file The file name.
* @param line The line number.
* @param column The column number.
* @return A [SourceLocation] instance with the specified parameters.
*/
@IntrospektCompilerApi
internal fun getOrCreate(module: String, file: String, line: Int, column: Int): SourceLocation {
return cache.getOrPut(hash(module, file, line, column)) {
SourceLocation( // @formatter:off
module = module,
file = file,
line = line,
column = column
) // @formatter:on
}
}
It appears that you cache a data structure based on hashing but do not check for hash collisions, this looks like sneaky bug to me.
The following is in the
SourceLocationcompanion:introspekt-runtime/src/commonMain/kotlin/dev/karmakrafts/introspekt/util/SourceLocation.kt