fix KT-8977 Ignore non-public API changes for packages in incremental compilation

#KT-8977 Fixed
This commit is contained in:
Michael Nedzelsky
2015-09-25 16:27:47 +03:00
parent fca9b51548
commit c7b52bfdc1
7 changed files with 46 additions and 12 deletions
@@ -112,6 +112,9 @@ private abstract class DifferenceCalculator() {
val newNames = newList.map { compareObject.newNameResolver.getString(it) }.toSet()
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() {
@@ -211,9 +214,6 @@ private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: Prot
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() {
@@ -240,7 +240,7 @@ private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newDa
for (kind in diff) {
when (kind!!) {
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 ->
throw IllegalArgumentException("Unsupported kind: $kind")
}
@@ -113,6 +113,12 @@ public class ProtoComparisonTestGenerated extends AbstractProtoComparisonTest {
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")
@@ -2,10 +2,12 @@ package test
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() {}
@@ -2,10 +2,12 @@ package test
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() {}
@@ -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) {}
@@ -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) {}
@@ -0,0 +1,2 @@
changes in test/MainKt: NONE
changes in test/TestPackage: NONE