File tree 8 files changed +149
-94
lines changed 8 files changed +149
-94
lines changed Original file line number Diff line number Diff line change @@ -10,57 +10,3 @@ java.lang.Object
10
10
11
11
classOf[Object].getCanonicalName()
12
12
java.lang.Object
13
-
14
- classOf[Boolean].getCanonicalName()
15
- boolean
16
-
17
- classOf[Byte].getCanonicalName()
18
- byte
19
-
20
- classOf[Char].getCanonicalName()
21
- char
22
-
23
- classOf[Short].getCanonicalName()
24
- short
25
-
26
- classOf[Int].getCanonicalName()
27
- int
28
-
29
- classOf[Long].getCanonicalName()
30
- long
31
-
32
- classOf[Float].getCanonicalName()
33
- float
34
-
35
- classOf[Double].getCanonicalName()
36
- double
37
-
38
- classOf[Unit].getCanonicalName()
39
- void
40
-
41
- classOf[scala.runtime.Null$].getCanonicalName()
42
- scala.runtime.Null$
43
-
44
- classOf[scala.runtime.Nothing$].getCanonicalName()
45
- scala.runtime.Nothing$
46
-
47
- classOf[String].getCanonicalName()
48
- java.lang.String
49
-
50
- classOf[Foo].getCanonicalName()
51
- Foo
52
-
53
- classOf[Foo#Bar].getCanonicalName()
54
- Foo.Bar
55
-
56
- classOf[Foo.Baz].getCanonicalName()
57
- Foo.Baz
58
-
59
- classOf[foo.Foo].getCanonicalName()
60
- foo.Foo
61
-
62
- classOf[foo.Foo#Bar].getCanonicalName()
63
- foo.Foo.Bar
64
-
65
- classOf[foo.Foo.Baz].getCanonicalName()
66
- foo.Foo.Baz
Original file line number Diff line number Diff line change @@ -19,46 +19,6 @@ object Test {
19
19
test(classOf [Any ])
20
20
test(classOf [AnyRef ])
21
21
test(classOf [AnyVal ])
22
-
23
- // primitives
24
- test(classOf [Boolean ])
25
- test(classOf [Byte ])
26
- test(classOf [Char ])
27
- test(classOf [Short ])
28
- test(classOf [Int ])
29
- test(classOf [Long ])
30
- test(classOf [Float ])
31
- test(classOf [Double ])
32
- test(classOf [Unit ])
33
- test(classOf [Null ])
34
- test(classOf [Nothing ])
35
-
36
- test(classOf [String ])
37
-
38
- test(classOf [Foo ])
39
- test(classOf [Foo # Bar ])
40
- test(classOf [Foo .Baz ])
41
-
42
- test(classOf [foo.Foo ])
43
- test(classOf [foo.Foo # Bar ])
44
- test(classOf [foo.Foo .Baz ])
45
22
}
46
23
47
24
}
48
-
49
- class Foo {
50
- class Bar
51
- }
52
-
53
- object Foo {
54
- class Baz
55
- }
56
-
57
- package foo {
58
- class Foo {
59
- class Bar
60
- }
61
- object Foo {
62
- class Baz
63
- }
64
- }
Original file line number Diff line number Diff line change
1
+
2
+ classOf[Boolean].getCanonicalName()
3
+ boolean
4
+
5
+ classOf[Byte].getCanonicalName()
6
+ byte
7
+
8
+ classOf[Char].getCanonicalName()
9
+ char
10
+
11
+ classOf[Short].getCanonicalName()
12
+ short
13
+
14
+ classOf[Int].getCanonicalName()
15
+ int
16
+
17
+ classOf[Long].getCanonicalName()
18
+ long
19
+
20
+ classOf[Float].getCanonicalName()
21
+ float
22
+
23
+ classOf[Double].getCanonicalName()
24
+ double
25
+
26
+ classOf[Unit].getCanonicalName()
27
+ void
Original file line number Diff line number Diff line change
1
+
2
+ import scala .quoted ._
3
+ import dotty .tools .dotc .quoted .Toolbox ._
4
+
5
+ object Test {
6
+
7
+ def main (args : Array [String ]): Unit = {
8
+
9
+ def test [T ](clazz : java.lang.Class [T ]): Unit = {
10
+ val lclazz = clazz.toExpr
11
+ val name = ' { (~ clazz.toExpr).getCanonicalName }
12
+ println()
13
+ println(name.show)
14
+ println(name.run)
15
+ }
16
+
17
+ // primitives
18
+ test(classOf [Boolean ])
19
+ test(classOf [Byte ])
20
+ test(classOf [Char ])
21
+ test(classOf [Short ])
22
+ test(classOf [Int ])
23
+ test(classOf [Long ])
24
+ test(classOf [Float ])
25
+ test(classOf [Double ])
26
+ test(classOf [Unit ])
27
+ }
28
+
29
+ }
Original file line number Diff line number Diff line change
1
+
2
+ classOf[scala.runtime.Null$].getCanonicalName()
3
+ scala.runtime.Null$
4
+
5
+ classOf[scala.runtime.Nothing$].getCanonicalName()
6
+ scala.runtime.Nothing$
7
+
8
+ classOf[String].getCanonicalName()
9
+ java.lang.String
Original file line number Diff line number Diff line change
1
+
2
+ import scala .quoted ._
3
+ import dotty .tools .dotc .quoted .Toolbox ._
4
+
5
+ object Test {
6
+
7
+ def main (args : Array [String ]): Unit = {
8
+
9
+ def test [T ](clazz : java.lang.Class [T ]): Unit = {
10
+ val lclazz = clazz.toExpr
11
+ val name = ' { (~ clazz.toExpr).getCanonicalName }
12
+ println()
13
+ println(name.show)
14
+ println(name.run)
15
+ }
16
+
17
+ test(classOf [Null ])
18
+ test(classOf [Nothing ])
19
+
20
+ test(classOf [String ])
21
+ }
22
+
23
+ }
Original file line number Diff line number Diff line change
1
+
2
+ classOf[Foo].getCanonicalName()
3
+ Foo
4
+
5
+ classOf[Foo#Bar].getCanonicalName()
6
+ Foo.Bar
7
+
8
+ classOf[Foo.Baz].getCanonicalName()
9
+ Foo.Baz
10
+
11
+ classOf[foo.Foo].getCanonicalName()
12
+ foo.Foo
13
+
14
+ classOf[foo.Foo#Bar].getCanonicalName()
15
+ foo.Foo.Bar
16
+
17
+ classOf[foo.Foo.Baz].getCanonicalName()
18
+ foo.Foo.Baz
Original file line number Diff line number Diff line change
1
+
2
+ import scala .quoted ._
3
+ import dotty .tools .dotc .quoted .Toolbox ._
4
+
5
+ object Test {
6
+
7
+ def main (args : Array [String ]): Unit = {
8
+
9
+ def test [T ](clazz : java.lang.Class [T ]): Unit = {
10
+ val lclazz = clazz.toExpr
11
+ val name = ' { (~ clazz.toExpr).getCanonicalName }
12
+ println()
13
+ println(name.show)
14
+ println(name.run)
15
+ }
16
+
17
+ test(classOf [Foo ])
18
+ test(classOf [Foo # Bar ])
19
+ test(classOf [Foo .Baz ])
20
+
21
+ test(classOf [foo.Foo ])
22
+ test(classOf [foo.Foo # Bar ])
23
+ test(classOf [foo.Foo .Baz ])
24
+ }
25
+
26
+ }
27
+
28
+ class Foo {
29
+ class Bar
30
+ }
31
+
32
+ object Foo {
33
+ class Baz
34
+ }
35
+
36
+ package foo {
37
+ class Foo {
38
+ class Bar
39
+ }
40
+ object Foo {
41
+ class Baz
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments