This attempt is in the sbt 0.7.x context:
trait unitTestReporting {
this: BasicScalaProject =>
abstract override def testListeners: Seq[TestReportListener] =
super.testListeners ++ Seq(junitXmlListener)
def junitXmlListener: TestReportListener = new
JUnitXmlTestsListener(outputPath.toString())
}
Here's the error, which makes perfect sense:
[error]
/Users/jonsteelman/IdeaProjects/tsthotel/project/build/Project.scala:37:
value testListeners is not a member of java.lang.Object with ScalaObject
[error] abstract override def testListeners: Seq[TestReportListener]
= super.testListeners ++ Seq(junitXmlListener)
If I could specify this: as any descendant of BasicScalaProject, then
the super.testListeners would work.
Thanks,
Jon
Post by martin oderskyPost by Jon SteelmanI take it that the self-type of a Trait can't be a parameter? For
example, I'd like for the trait method to override a method of the self
type and call the super's method within. When attempting it without being
able to use a parameter, you get that the method doesn't exist in Any.
Can you give an example?
Post by Jon SteelmanP.S. For self-type, is either self: or this: preferred? (Is one going to
be eventually deprecated?)
Neither is preferred. self: has the advantage that it gives you a name
for the other trait that you can access in inner classes. If you don't need
that then I prefer this: because it does not spend an unneeded name.
Cheers
-- Martin