summaryrefslogtreecommitdiff
path: root/test/files/run/t9814.scala
blob: 3aef3928f6f9e3d0322a1d86bdb2b6c89f7c73ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.lang.reflect.Modifier

import scala.annotation.strictfp

class Foo extends (() => Unit) {
  def apply(): Unit = synchronized {
    // we're in a specialized subclass
    assert(Thread.currentThread.getStackTrace.apply(1).getMethodName == "apply$mcV$sp")
    assert(Thread.holdsLock(this))
  }
}

class Bar extends (() => Unit) {
  @strictfp def apply(): Unit = synchronized {
    // we're in a specialized subclass
    assert(Thread.currentThread.getStackTrace.apply(1).getMethodName == "apply$mcV$sp")
    assert(Thread.holdsLock(this))
  }
}

object Test {
  def main(args: Array[String]): Unit = {
    new Foo().apply()
    
    val m = classOf[Bar].getDeclaredMethod("apply$mcV$sp")
    assert(Modifier.isStrict(m.getModifiers))
  }
}