Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure that `parents` for java classes have all the ancestors

Currently, only immediate parents classes are picked up for java classes.
This could be problematic, for example, in detecting Fingerprint for test frameworks.
So far, Scala types are not affected –– all the ancestors are available for them.
  • Loading branch information...
commit 34d7ff27817671f8f2f594d7d4ac445b98fcac72 1 parent f870ed7
@indrajitr indrajitr authored committed
Showing with 11 additions and 2 deletions.
  1. +10 −1 compile/api/ClassToAPI.scala
  2. +1 −1  main/Defaults.scala
View
11 compile/api/ClassToAPI.scala
@@ -76,8 +76,17 @@ object ClassToAPI
private val lzyEmptyTpeArray = lzy(emptyTypeArray)
private val lzyEmptyDefArray = lzy(new Array[xsbti.api.Definition](0))
+ private def allSuperclasses(t: Type): Seq[Type] =
+ {
+ def accumulate(t: Type, accum: Seq[Type] = Seq.empty): Seq[Type] = t match {
+ case cl: Class[_] => { val s = cl.getGenericSuperclass ; accumulate(s, accum :+ s) }
+ case _ => accum
+ }
+ accumulate(t)
+ }
+
def parents(c: Class[_]): Seq[api.Type] =
- types(c.getGenericSuperclass +: c.getGenericInterfaces)
+ types(allSuperclasses(c) ++ c.getGenericInterfaces)
def types(ts: Seq[Type]): Array[api.Type] = ts filter (_ ne null) map reference toArray;
def upperBounds(ts: Array[Type]): api.Type =
new api.Structure(lzy(types(ts)), lzyEmptyDefArray, lzyEmptyDefArray)
View
2  main/Defaults.scala
@@ -1138,7 +1138,7 @@ trait BuildExtra extends BuildCommon
/** Disables post-compilation hook for determining tests for tab-completion (such as for 'test-only').
* This is useful for reducing test:compile time when not running test. */
- def noTestCompletion(config: Configuration = Test): Setting[_] = inConfig(config)( Seq(definedTests <<= Defaults.detectTests) ).head
+ def noTestCompletion(config: Configuration = Test): Setting[_] = inConfig(config)( Seq(definedTests <<= detectTests) ).head
def filterKeys(ss: Seq[Setting[_]], transitive: Boolean = false)(f: ScopedKey[_] => Boolean): Seq[Setting[_]] =
ss filter ( s => f(s.key) && (!transitive || s.dependencies.forall(f)) )
Please sign in to comment.
Something went wrong with that request. Please try again.