New IC: Detect changes to class annotations

Both the new and old incremental compilation (IC) analysis rely on
Kotlin class metadata to detect a change.

However, Kotlin metadata currently doesn't contain info about
annotations (KT-57919), so the IC will not be able to detect a change
to them.

With this commit, we'll fix the new IC such that it can detect a change
to class annotations by not relying only on metadata.

We currently scope this fix to the new IC (cross-module analysis) first.
We'll fix this issue for within-module analysis later.

Performance: There seems to be no performance impact from this change.
Snapshotting the 400MB ideaIC-2022.1.4/app.jar takes 4.1s before and
after this change.

Test: Added ClasspathChangesComputerTest.testChangedAnnotations
^KT-58289: Fixed
This commit is contained in:
Hung Nguyen
2023-04-26 14:47:57 +01:00
committed by Space Team
parent 993925f656
commit 0b09be73c6
22 changed files with 316 additions and 231 deletions
@@ -0,0 +1,20 @@
package com.example
@AnnotationTwo // Changed from @AnnotationOne
class SomeClassWithChangedAnnotation {
val unchangeProperty = 0
fun unchangedFunction() {}
}
class SomeClass {
@AnnotationTwo // Changed from @AnnotationOne
val propertyWithChangedAnnotation = 0
@AnnotationTwo // Changed from @AnnotationOne
fun functionWithChangedAnnotation() {
}
}
annotation class AnnotationOne
annotation class AnnotationTwo
@@ -0,0 +1,20 @@
package com.example
@AnnotationOne // Will change to @AnnotationTwo
class SomeClassWithChangedAnnotation {
val unchangeProperty = 0
fun unchangedFunction() {}
}
class SomeClass {
@AnnotationOne // Will change to @AnnotationTwo
val propertyWithChangedAnnotation = 0
@AnnotationOne // Will change to @AnnotationTwo
fun functionWithChangedAnnotation() {
}
}
annotation class AnnotationOne
annotation class AnnotationTwo
@@ -12,7 +12,7 @@
},
"local": false
},
"classAbiHash": -6515999856905133685,
"classAbiHash": -6381547343043280587,
"classMemberLevelSnapshot": {
"classAbiExcludingMembers": {
"name": "com/example/SimpleClass",
@@ -27,11 +27,11 @@
"methodsAbi": [
{
"name": "\u003cinit\u003e",
"abiHash": 2413123887428571534
"abiHash": 9200648777950343158
},
{
"name": "publicMethod",
"abiHash": 7574889098198027162
"abiHash": -2847179652577921235
}
]
},
@@ -12,7 +12,7 @@
},
"local": false
},
"classAbiHash": -2605231127310346403,
"classAbiHash": 8283317449409255124,
"supertypes": [
{
"internalName": "java/lang/Object"
@@ -12,7 +12,7 @@
},
"local": false
},
"classAbiHash": -2605231127310346403,
"classAbiHash": 8283317449409255124,
"classMemberLevelSnapshot": {
"classId": {
"packageFqName": {
@@ -43,8 +43,11 @@
"privateFunction",
"publicFunction"
],
"constantsMap": {},
"inlineFunctionsAndAccessorsMap": {},
"extraInfo": {
"classSnapshotExcludingMembers": -3712984790086353322,
"constantSnapshots": {},
"inlineFunctionOrAccessorSnapshots": {}
},
"className$delegate": {
"initializer": {},
"_value": {}