|
Scala example source code file (primitive-sigs-2.scala)
The Scala primitive-sigs-2.scala source code
trait T[A] {
def f(): A
}
class C extends T[Char] {
def f(): Char = 'a'
}
object Test {
val c1: Class[_] = classOf[T[_]]
val c2: Class[_] = classOf[C]
val c1m = c1.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString)
val c2m = c2.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString)
def main(args: Array[String]): Unit = {
println(c2.getGenericInterfaces.map(_.toString).sorted mkString " ")
println(c1m ++ c2m sorted)
println(new C f)
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala primitive-sigs-2.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.