Skip to content

Instantly share code, notes, and snippets.

@seraphr
Created June 26, 2012 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seraphr/2997138 to your computer and use it in GitHub Desktop.
Save seraphr/2997138 to your computer and use it in GitHub Desktop.
// 間違ってたので書換
// 自己参照する型引数を持つtraitを定義
trait A[_E, _A <: A[_A]]{
def m: _A = this.asInstanceOf[_A]
}
// mixin
class B[_E] extends A[_E, B[_E]]
// Java側から、Bのmメソッドを呼び出すと、実行時にjava.lang.NoSuchMethodError
new B<String>().m();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment