fix KT-8977 Ignore non-public API changes for packages in incremental compilation
#KT-8977 Fixed
This commit is contained in:
@@ -112,6 +112,9 @@ private abstract class DifferenceCalculator() {
|
|||||||
val newNames = newList.map { compareObject.newNameResolver.getString(it) }.toSet()
|
val newNames = newList.map { compareObject.newNameResolver.getString(it) }.toSet()
|
||||||
return HashSetUtil.symmetricDifference(oldNames, newNames)
|
return HashSetUtil.symmetricDifference(oldNames, newNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected val ProtoBuf.Callable.isPrivate: Boolean
|
||||||
|
get() = Visibilities.isPrivate(Deserialization.visibility(Flags.VISIBILITY.get(flags)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
||||||
@@ -211,9 +214,6 @@ private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: Prot
|
|||||||
|
|
||||||
return if (primaryConstructor?.data?.isPrivate ?: false) null else primaryConstructor
|
return if (primaryConstructor?.data?.isPrivate ?: false) null else primaryConstructor
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ProtoBuf.Callable.isPrivate: Boolean
|
|
||||||
get() = Visibilities.isPrivate(Deserialization.visibility(Flags.VISIBILITY.get(flags)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
||||||
@@ -240,7 +240,7 @@ private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newDa
|
|||||||
for (kind in diff) {
|
for (kind in diff) {
|
||||||
when (kind!!) {
|
when (kind!!) {
|
||||||
ProtoCompareGenerated.ProtoBufPackageKind.MEMBER_LIST ->
|
ProtoCompareGenerated.ProtoBufPackageKind.MEMBER_LIST ->
|
||||||
names.addAll(calcDifferenceForMembers(oldProto.memberList, newProto.memberList))
|
names.addAll(calcDifferenceForMembers(oldProto.memberList.filter { !it.isPrivate }, newProto.memberList.filter { !it.isPrivate }))
|
||||||
else ->
|
else ->
|
||||||
throw IllegalArgumentException("Unsupported kind: $kind")
|
throw IllegalArgumentException("Unsupported kind: $kind")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,12 @@ public class ProtoComparisonTestGenerated extends AbstractProtoComparisonTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("packageFacadeDifference")
|
||||||
|
public void testPackageFacadeDifference() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/comparison/classPrivateOnlyChange/packageFacadeDifference/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("jps-plugin/testData/comparison/classMembersOnlyChanged")
|
@TestMetadata("jps-plugin/testData/comparison/classMembersOnlyChanged")
|
||||||
|
|||||||
+6
-4
@@ -2,10 +2,12 @@ package test
|
|||||||
|
|
||||||
public fun unchangedFun() {}
|
public fun unchangedFun() {}
|
||||||
|
|
||||||
private fun addedFun(): Int = 10
|
public fun addedFun(): Int = 10
|
||||||
|
|
||||||
private val addedVal: String = "A"
|
public val addedVal: String = "A"
|
||||||
|
|
||||||
private val changedVal: String = ""
|
public val changedVal: String = ""
|
||||||
|
|
||||||
private fun changedFun(arg: String) {}
|
internal fun changedFun(arg: String) {}
|
||||||
|
|
||||||
|
private fun privateAddedFun() {}
|
||||||
|
|||||||
+6
-4
@@ -2,10 +2,12 @@ package test
|
|||||||
|
|
||||||
public fun unchangedFun() {}
|
public fun unchangedFun() {}
|
||||||
|
|
||||||
private fun removedFun(): Int = 10
|
public fun removedFun(): Int = 10
|
||||||
|
|
||||||
private val removedVal: String = "A"
|
public val removedVal: String = "A"
|
||||||
|
|
||||||
private val changedVal: Int = 20
|
public val changedVal: Int = 20
|
||||||
|
|
||||||
private fun changedFun(arg: Int) {}
|
internal fun changedFun(arg: Int) {}
|
||||||
|
|
||||||
|
private fun privateRemovedFun() {}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public fun unchangedFun() {}
|
||||||
|
|
||||||
|
private fun addedFun(): Int = 10
|
||||||
|
|
||||||
|
private val addedVal: String = "A"
|
||||||
|
|
||||||
|
private val changedVal: String = ""
|
||||||
|
|
||||||
|
private fun changedFun(arg: String) {}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public fun unchangedFun() {}
|
||||||
|
|
||||||
|
private fun removedFun(): Int = 10
|
||||||
|
|
||||||
|
private val removedVal: String = "A"
|
||||||
|
|
||||||
|
private val changedVal: Int = 20
|
||||||
|
|
||||||
|
private fun changedFun(arg: Int) {}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
changes in test/MainKt: NONE
|
||||||
|
changes in test/TestPackage: NONE
|
||||||
Reference in New Issue
Block a user