forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannot.scala
29 lines (16 loc) · 873 Bytes
/
annot.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
import java.beans.Transient
import annotation.unchecked.uncheckedVariance
class Test {
// testing combinations of annotation syntax
@SuppressWarnings(Array("hi")) def foo() = ??? // evalutation of annotation on type cannot be deferred as requires implicit resolution(only generic Array$.apply applies here)
@SuppressWarnings(Array("hi", "foo")) def foo2() = ??? //can be deferred as there is a non-generic method
@SuppressWarnings(Array("hi")) def foo3() = ??? // can be written in java and is serialized this way in bytecode. doesn't typecheck
@Transient(false) def bar = ???
@Transient() def baz = ???
// testing annotations in types
class A
trait B
val x: A @uncheckedVariance with B @uncheckedVariance = ???
class C extends A @uncheckedVariance () with B @uncheckedVariance { val x = 10 }
val f: (Int => Int) @uncheckedVariance = ???
}