diff --git a/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt b/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt index df4e466f2a8..794d90bd98b 100644 --- a/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt +++ b/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/KotlinAnnotationProvider.kt @@ -19,15 +19,14 @@ package org.jetbrains.kotlin.annotation import java.io.File import java.io.Reader import java.io.StringReader -import java.util.* import org.jetbrains.kotlin.annotation.CompactNotationType as Notation open class KotlinAnnotationProvider(annotationsReader: Reader) { constructor(annotationsFile: File) : this(annotationsFile.reader().buffered()) constructor() : this(StringReader("")) - protected val kotlinClassesInternal = hashSetOf() - protected val annotatedKotlinElementsInternal = hashMapOf>() + protected val kotlinClassesInternal = linkedSetOf() + protected val annotatedKotlinElementsInternal = linkedMapOf>() init { readAnnotations(annotationsReader) @@ -49,8 +48,8 @@ open class KotlinAnnotationProvider(annotationsReader: Reader) { cache.put(id, name) } - val shortenedAnnotationCache = hashMapOf() - val shortenedPackageNameCache = hashMapOf() + val shortenedAnnotationCache = linkedMapOf() + val shortenedPackageNameCache = linkedMapOf() fun expandAnnotation(s: String) = shortenedAnnotationCache.getOrElse(s) { s } @@ -82,7 +81,7 @@ open class KotlinAnnotationProvider(annotationsReader: Reader) { val classFqName = expandClassName(lineParts[2]).replace('$', '.') val elementName = if (lineParts.size == 4) lineParts[3] else null - val set = annotatedKotlinElementsInternal.getOrPut(annotationName) { HashSet() } + val set = annotatedKotlinElementsInternal.getOrPut(annotationName) { linkedSetOf() } set.add(when (type) { Notation.ANNOTATED_CLASS -> AnnotatedElement.Class(classFqName) Notation.ANNOTATED_FIELD -> { diff --git a/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/mergeFiles/annotations-merged.txt b/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/mergeFiles/annotations-merged.txt index 2a4d29db30a..f7563ce0e4e 100644 --- a/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/mergeFiles/annotations-merged.txt +++ b/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/mergeFiles/annotations-merged.txt @@ -1,15 +1,15 @@ a annotations.Ann 0 p foo 0 +c 0 0/A +m 0 0/A valA$annotations m 0 0/A funA p bar 1 c 0 1/B -c 0 0/A -m 0 1/B funB -m 0 0/A valA$annotations m 0 1/B valB$annotations +m 0 1/B funB a java.lang.annotation.Retention 1 p annotations 2 c 1 2/Ann d 0/A -d 1/B -d 2/Ann \ No newline at end of file +d 2/Ann +d 1/B \ No newline at end of file diff --git a/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/removeClass/annotations-updated.txt b/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/removeClass/annotations-updated.txt index d56364f0eea..a90154fb8f5 100644 --- a/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/removeClass/annotations-updated.txt +++ b/libraries/tools/kotlin-annotation-processing/src/test/resources/mutate/removeClass/annotations-updated.txt @@ -1,8 +1,8 @@ a annotations.Ann 0 p bar 0 c 0 0/B -m 0 0/B funB m 0 0/B valB$annotations +m 0 0/B funB a java.lang.annotation.Retention 1 p annotations 1 c 1 1/Ann