From 66855d876dfc70846cc574cb5d92357f9a4e9627 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 12 Jan 2016 20:35:50 +0300 Subject: [PATCH] Delete obsolete and unused class_annotation JVM proto extension Original commit: 625c46d5681bb59dbad5624bc835f0ccc775fa8b --- .../jps/incremental/ProtoCompareGenerated.kt | 93 ++++++++----------- .../jps/incremental/protoDifferenceUtils.kt | 3 +- 2 files changed, 39 insertions(+), 57 deletions(-) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt index 4a3907764d2..e09d74d90ab 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt @@ -112,12 +112,6 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (!checkEquals(old.typeTable, new.typeTable)) return false } - if (old.getExtensionCount(JvmProtoBuf.classAnnotation) != new.getExtensionCount(JvmProtoBuf.classAnnotation)) return false - - for(i in 0..old.getExtensionCount(JvmProtoBuf.classAnnotation) - 1) { - if (!checkEquals(old.getExtension(JvmProtoBuf.classAnnotation, i), new.getExtension(JvmProtoBuf.classAnnotation, i))) return false - } - if (old.hasExtension(JvmProtoBuf.classModuleName) != new.hasExtension(JvmProtoBuf.classModuleName)) return false if (old.hasExtension(JvmProtoBuf.classModuleName)) { if (!checkStringEquals(old.getExtension(JvmProtoBuf.classModuleName), new.getExtension(JvmProtoBuf.classModuleName))) return false @@ -138,7 +132,6 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR PROPERTY_LIST, ENUM_ENTRY_LIST, TYPE_TABLE, - CLASS_ANNOTATION_LIST, CLASS_MODULE_NAME } @@ -178,12 +171,6 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (!checkEquals(old.typeTable, new.typeTable)) result.add(ProtoBufClassKind.TYPE_TABLE) } - if (old.getExtensionCount(JvmProtoBuf.classAnnotation) != new.getExtensionCount(JvmProtoBuf.classAnnotation)) result.add(ProtoBufClassKind.CLASS_ANNOTATION_LIST) - - for(i in 0..old.getExtensionCount(JvmProtoBuf.classAnnotation) - 1) { - if (!checkEquals(old.getExtension(JvmProtoBuf.classAnnotation, i), new.getExtension(JvmProtoBuf.classAnnotation, i))) result.add(ProtoBufClassKind.CLASS_ANNOTATION_LIST) - } - if (old.hasExtension(JvmProtoBuf.classModuleName) != new.hasExtension(JvmProtoBuf.classModuleName)) result.add(ProtoBufClassKind.CLASS_MODULE_NAME) if (old.hasExtension(JvmProtoBuf.classModuleName)) { if (!checkStringEquals(old.getExtension(JvmProtoBuf.classModuleName), new.getExtension(JvmProtoBuf.classModuleName))) result.add(ProtoBufClassKind.CLASS_MODULE_NAME) @@ -426,14 +413,6 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR return true } - open fun checkEquals(old: ProtoBuf.Annotation, new: ProtoBuf.Annotation): Boolean { - if (!checkClassIdEquals(old.id, new.id)) return false - - if (!checkEqualsAnnotationArgument(old, new)) return false - - return true - } - open fun checkEquals(old: ProtoBuf.ValueParameter, new: ProtoBuf.ValueParameter): Boolean { if (old.hasFlags() != new.hasFlags()) return false if (old.hasFlags()) { @@ -503,6 +482,14 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR return true } + open fun checkEquals(old: ProtoBuf.Annotation, new: ProtoBuf.Annotation): Boolean { + if (!checkClassIdEquals(old.id, new.id)) return false + + if (!checkEqualsAnnotationArgument(old, new)) return false + + return true + } + open fun checkEquals(old: ProtoBuf.Type.Argument, new: ProtoBuf.Type.Argument): Boolean { if (old.hasProjection() != new.hasProjection()) return false if (old.hasProjection()) { @@ -522,14 +509,6 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR return true } - open fun checkEquals(old: ProtoBuf.Annotation.Argument, new: ProtoBuf.Annotation.Argument): Boolean { - if (!checkStringEquals(old.nameId, new.nameId)) return false - - if (!checkEquals(old.value, new.value)) return false - - return true - } - open fun checkEquals(old: JvmProtoBuf.JvmFieldSignature, new: JvmProtoBuf.JvmFieldSignature): Boolean { if (old.hasName() != new.hasName()) return false if (old.hasName()) { @@ -544,6 +523,14 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR return true } + open fun checkEquals(old: ProtoBuf.Annotation.Argument, new: ProtoBuf.Annotation.Argument): Boolean { + if (!checkStringEquals(old.nameId, new.nameId)) return false + + if (!checkEquals(old.value, new.value)) return false + + return true + } + open fun checkEquals(old: ProtoBuf.Annotation.Argument.Value, new: ProtoBuf.Annotation.Argument.Value): Boolean { if (old.hasType() != new.hasType()) return false if (old.hasType()) { @@ -892,10 +879,6 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes) } - for(i in 0..getExtensionCount(JvmProtoBuf.classAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes) - } - if (hasExtension(JvmProtoBuf.classModuleName)) { hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.classModuleName)) } @@ -1129,18 +1112,6 @@ fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int return hashCode } -fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { - var hashCode = 1 - - hashCode = 31 * hashCode + fqNameIndexes(id) - - for(i in 0..argumentCount - 1) { - hashCode = 31 * hashCode + getArgument(i).hashCode(stringIndexes, fqNameIndexes) - } - - return hashCode -} - fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { var hashCode = 1 @@ -1205,6 +1176,18 @@ fun JvmProtoBuf.JvmPropertySignature.hashCode(stringIndexes: (Int) -> Int, fqNam return hashCode } +fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { + var hashCode = 1 + + hashCode = 31 * hashCode + fqNameIndexes(id) + + for(i in 0..argumentCount - 1) { + hashCode = 31 * hashCode + getArgument(i).hashCode(stringIndexes, fqNameIndexes) + } + + return hashCode +} + fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { var hashCode = 1 @@ -1223,16 +1206,6 @@ fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: return hashCode } -fun ProtoBuf.Annotation.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { - var hashCode = 1 - - hashCode = 31 * hashCode + stringIndexes(nameId) - - hashCode = 31 * hashCode + value.hashCode(stringIndexes, fqNameIndexes) - - return hashCode -} - fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { var hashCode = 1 @@ -1247,6 +1220,16 @@ fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIn return hashCode } +fun ProtoBuf.Annotation.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { + var hashCode = 1 + + hashCode = 31 * hashCode + stringIndexes(nameId) + + hashCode = 31 * hashCode + value.hashCode(stringIndexes, fqNameIndexes) + + return hashCode +} + fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { var hashCode = 1 diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt index 386acf3ad3b..b2d0d43f7a6 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt @@ -158,8 +158,7 @@ private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: Prot ProtoBufClassKind.FLAGS, ProtoBufClassKind.FQ_NAME, ProtoBufClassKind.TYPE_PARAMETER_LIST, - ProtoBufClassKind.SUPERTYPE_LIST, - ProtoBufClassKind.CLASS_ANNOTATION_LIST + ProtoBufClassKind.SUPERTYPE_LIST ) }