diff --git a/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/AnnotationProcessorWrapper.kt b/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/AnnotationProcessorWrapper.kt index da274bebe28..8345b38d033 100644 --- a/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/AnnotationProcessorWrapper.kt +++ b/libraries/tools/kotlin-annotation-processing/src/main/kotlin/org/jetbrains/kotlin/annotation/AnnotationProcessorWrapper.kt @@ -37,18 +37,18 @@ class AnnotatedClassDescriptor(classFqName: String) : AnnotatedElementDescriptor } class AnnotatedMethodDescriptor(classFqName: String, public val methodName: String) : AnnotatedElementDescriptor(classFqName) { - override fun equals(other: Any?) = other is AnnotatedMethodDescriptor && methodName == other.methodName + override fun equals(other: Any?) = other is AnnotatedMethodDescriptor && methodName == other.methodName && classFqName == other.classFqName - override fun hashCode() = methodName.hashCode() + override fun hashCode() = 31 * classFqName.hashCode() + methodName.hashCode() } class AnnotatedConstructorDescriptor(classFqName: String) : AnnotatedElementDescriptor(classFqName) { // use referential equality } class AnnotatedFieldDescriptor(classFqName: String, public val fieldName: String) : AnnotatedElementDescriptor(classFqName) { - override fun equals(other: Any?) = other is AnnotatedFieldDescriptor && fieldName == other.fieldName + override fun equals(other: Any?) = other is AnnotatedFieldDescriptor && fieldName == other.fieldName && classFqName == other.classFqName - override fun hashCode() = fieldName.hashCode() + override fun hashCode() = 31 * classFqName.hashCode() + fieldName.hashCode() } public abstract class AnnotationProcessorWrapper( diff --git a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/annotations.txt b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/annotations.txt index 93072144e40..f3ee3a6a3c0 100644 --- a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/annotations.txt +++ b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/annotations.txt @@ -5,3 +5,5 @@ a org.jetbrains.annotations.Nullable 1 f 1 0/SomeClass annotatedVal m 1 0/SomeClass getAnnotatedVal f 0 0/SomeClass annotatedVar +f 0 0/OtherClass annotatedVal +f 0 0/OtherClass annotatedVar diff --git a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/parsed.txt b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/parsed.txt index 8abed7682d0..25159dc076a 100644 --- a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/parsed.txt +++ b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/fieldAnnotations/parsed.txt @@ -1,3 +1,5 @@ +javax.inject.Inject org.test.OtherClass annotatedVal +javax.inject.Inject org.test.OtherClass annotatedVar javax.inject.Inject org.test.SomeClass annotatedVal javax.inject.Inject org.test.SomeClass annotatedVar org.jetbrains.annotations.Nullable org.test.SomeClass annotatedVal diff --git a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/annotations.txt b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/annotations.txt index 0df56be2835..b583c66a658 100644 --- a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/annotations.txt +++ b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/annotations.txt @@ -1,5 +1,7 @@ a javax.inject.Inject 0 p org.test 0 m 0 0/SomeClass annotatedFunction +m 0 0/OtherClass annotatedFunction a javax.inject.Named 1 m 1 0/SomeClass$annotatedFunction$1 invoke +m 1 0/OtherClass$annotatedFunction$1 invoke diff --git a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/parsed.txt b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/parsed.txt index bcb6a3ab5ec..b82c065f2bd 100644 --- a/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/parsed.txt +++ b/libraries/tools/kotlin-annotation-processing/src/test/resources/parse/methodAnnotations/parsed.txt @@ -1,2 +1,4 @@ +javax.inject.Inject org.test.OtherClass annotatedFunction javax.inject.Inject org.test.SomeClass annotatedFunction +javax.inject.Named org.test.OtherClass.annotatedFunction.1 invoke javax.inject.Named org.test.SomeClass.annotatedFunction.1 invoke \ No newline at end of file