forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.scala
31 lines (28 loc) · 1.06 KB
/
Test.scala
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
29
30
31
// scalajs: --skip
object Test:
def main(args: Array[String]): Unit =
go(classOf[Bean])
go(classOf[Bean2])
def go(cls: Class[?]): Unit =
for c <- cls.getDeclaredConstructors.sortBy(_.getName) do
c.setAccessible(true)
println(s"inspecting constructor ${c.getName}")
for p <- c.getParameters.sortBy(_.getName) do
print(s"inspecting param ${p.getName}")
for a <- p.getAnnotations.sortBy(_.annotationType.toString) do
print(s" @${a.annotationType.getName}")
println()
for (m <- cls.getDeclaredFields.sortBy(_.getName)) {
m.setAccessible(true)
print(s"inspecting field ${m.getName}")
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
print(s" @${a.annotationType.getName}")
println()
}
for (m <- cls.getDeclaredMethods.sortBy(_.getName)) {
m.setAccessible(true)
print(s"inspecting method ${m.getName}")
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
print(s" @${a.annotationType.getName}")
println()
}