From be8ba763fa2257224646caf70c2b8295901053f0 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 3 Feb 2016 13:49:15 +0100 Subject: [PATCH] Include ONLY non-public members in API hash of traits The previous logic was wrong and included all members of traits in their API hash, which degraded the performance of the incremental compiler. This commit changes this logic so that only the non-public members of traits are included into their API hash. Fixes #2436 --- compile/api/src/main/scala/xsbt/api/HashAPI.scala | 7 ++++++- .../trait-member-modified/{pending => test} | 0 2 files changed, 6 insertions(+), 1 deletion(-) rename sbt/src/sbt-test/source-dependencies/trait-member-modified/{pending => test} (100%) diff --git a/compile/api/src/main/scala/xsbt/api/HashAPI.scala b/compile/api/src/main/scala/xsbt/api/HashAPI.scala index 6ed4054e0..59b59797c 100644 --- a/compile/api/src/main/scala/xsbt/api/HashAPI.scala +++ b/compile/api/src/main/scala/xsbt/api/HashAPI.scala @@ -356,7 +356,12 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include def hashStructure0(structure: Structure, includeDefinitions: Boolean, isTrait: Boolean = false): Unit = { extend(StructureHash) hashTypes(structure.parents, includeDefinitions) - if (includeDefinitions || isTrait) { + if (isTrait && !includeDefinitions) { + def public(d: Definition): Boolean = d.access match { case _: xsbti.api.Public => true; case _ => false } + hashDefinitions(structure.declared.filterNot(public), isTrait) + hashDefinitions(structure.inherited.filterNot(public), isTrait) + } + if (includeDefinitions) { hashDefinitions(structure.declared, isTrait) hashDefinitions(structure.inherited, isTrait) } diff --git a/sbt/src/sbt-test/source-dependencies/trait-member-modified/pending b/sbt/src/sbt-test/source-dependencies/trait-member-modified/test similarity index 100% rename from sbt/src/sbt-test/source-dependencies/trait-member-modified/pending rename to sbt/src/sbt-test/source-dependencies/trait-member-modified/test