diff --git a/interface/src/main/java/xsbti/AnalysisCallback.java b/interface/src/main/java/xsbti/AnalysisCallback.java
index 0e083d4eb..88b190e80 100644
--- a/interface/src/main/java/xsbti/AnalysisCallback.java
+++ b/interface/src/main/java/xsbti/AnalysisCallback.java
@@ -12,13 +12,29 @@ public interface AnalysisCallback
* passed to this method. Dependencies on classes generated by sources not in the current compilation will
* be passed as class dependencies to the classDependency method.
* If publicInherited is true, this dependency is a result of inheritance by a
- * template accessible outside of the source file. */
+ * template accessible outside of the source file.
+ * @deprecated Use `sourceDependency(File dependsOn, File source, DependencyContext context)` instead. */
+ @Deprecated
public void sourceDependency(File dependsOn, File source, boolean publicInherited);
+ /** Called to indicate that the source file source depends on the source file
+ * dependsOn. Note that only source files included in the current compilation will
+ * passed to this method. Dependencies on classes generated by sources not in the current compilation will
+ * be passed as class dependencies to the classDependency method.
+ * context gives information about the context in which this dependency has been extracted.
+ * See xsbti.DependencyContext for the list of existing dependency contexts. */
+ public void sourceDependency(File dependsOn, File source, DependencyContext context);
/** Called to indicate that the source file source depends on the top-level
* class named name from class or jar file binary.
* If publicInherited is true, this dependency is a result of inheritance by a
- * template accessible outside of the source file. */
+ * template accessible outside of the source file.
+ * @deprecated Use `binaryDependency(File binary, String name, File source, DependencyContext context)` instead. */
+ @Deprecated
public void binaryDependency(File binary, String name, File source, boolean publicInherited);
+ /** Called to indicate that the source file source depends on the top-level
+ * class named name from class or jar file binary.
+ * context gives information about the context in which this dependency has been extracted.
+ * See xsbti.DependencyContext for the list of existing dependency contexts. */
+ public void binaryDependency(File binary, String name, File source, DependencyContext context);
/** Called to indicate that the source file source produces a class file at
* module contain class name.*/
public void generatedClass(File source, File module, String name);
diff --git a/interface/src/main/java/xsbti/DependencyContext.java b/interface/src/main/java/xsbti/DependencyContext.java
new file mode 100644
index 000000000..15cfa76d1
--- /dev/null
+++ b/interface/src/main/java/xsbti/DependencyContext.java
@@ -0,0 +1,22 @@
+package xsbti;
+
+/**
+ * Enumeration of existing dependency contexts.
+ * Dependency contexts represent the various kind of dependencies that
+ * can exist between symbols.
+ */
+public enum DependencyContext {
+ /**
+ * Represents a direct dependency between two symbols :
+ * object Foo
+ * object Bar { def foo = Foo }
+ */
+ DependencyByMemberRef,
+
+ /**
+ * Represents an inheritance dependency between two symbols :
+ * class A
+ * class B extends A
+ */
+ DependencyByInheritance
+}
diff --git a/interface/src/test/scala/xsbti/TestCallback.scala b/interface/src/test/scala/xsbti/TestCallback.scala
index 3ea7e32e1..13b65df79 100644
--- a/interface/src/test/scala/xsbti/TestCallback.scala
+++ b/interface/src/test/scala/xsbti/TestCallback.scala
@@ -3,17 +3,26 @@ package xsbti
import java.io.File
import scala.collection.mutable.ArrayBuffer
import xsbti.api.SourceAPI
+import xsbti.DependencyContext._
class TestCallback(override val nameHashing: Boolean = false) extends AnalysisCallback
{
- val sourceDependencies = new ArrayBuffer[(File, File, Boolean)]
- val binaryDependencies = new ArrayBuffer[(File, String, File, Boolean)]
+ val sourceDependencies = new ArrayBuffer[(File, File, DependencyContext)]
+ val binaryDependencies = new ArrayBuffer[(File, String, File, DependencyContext)]
val products = new ArrayBuffer[(File, File, String)]
val usedNames = scala.collection.mutable.Map.empty[File, Set[String]].withDefaultValue(Set.empty)
val apis: scala.collection.mutable.Map[File, SourceAPI] = scala.collection.mutable.Map.empty
- def sourceDependency(dependsOn: File, source: File, inherited: Boolean) { sourceDependencies += ((dependsOn, source, inherited)) }
- def binaryDependency(binary: File, name: String, source: File, inherited: Boolean) { binaryDependencies += ((binary, name, source, inherited)) }
+ def sourceDependency(dependsOn: File, source: File, inherited: Boolean) {
+ val context = if(inherited) DependencyByInheritance else DependencyByMemberRef
+ sourceDependency(dependsOn, source, context)
+ }
+ def sourceDependency(dependsOn: File, source: File, context: DependencyContext) { sourceDependencies += ((dependsOn, source, context)) }
+ def binaryDependency(binary: File, name: String, source: File, inherited: Boolean) {
+ val context = if(inherited) DependencyByInheritance else DependencyByMemberRef
+ binaryDependency(binary, name, source, context)
+ }
+ def binaryDependency(binary: File, name: String, source: File, context: DependencyContext) { binaryDependencies += ((binary, name, source, context)) }
def generatedClass(source: File, module: File, name: String) { products += ((source, module, name)) }
def usedName(source: File, name: String) { usedNames(source) += name }