File tree Expand file tree Collapse file tree 7 files changed +106
-0
lines changed
scala-2.12/org/typelevel/scalaccompat/annotation
scala-2.13/org/typelevel/scalaccompat/annotation
scala-3/org/typelevel/scalaccompat/annotation
scala/org/typelevel/scalaccompat/annotation/internal
scala-2/org/typelevel/scalaccompat/annotation
scala-3/org/typelevel/scalaccompat/annotation
scala/org/typelevel/scalaccompat/annotation Expand file tree Collapse file tree 7 files changed +106
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ package object annotation {
27
27
type nowarn213 = nowarnIgnored
28
28
type nowarn3 = nowarnIgnored
29
29
30
+ type static3 = staticIgnored
31
+
30
32
type targetName3 = targetNameIgnored
31
33
32
34
type threadUnsafe3 = threadUnsafeIgnored
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ package object annotation {
27
27
type nowarn213 = nowarn
28
28
type nowarn3 = nowarnIgnored
29
29
30
+ type static3 = staticIgnored
31
+
30
32
type targetName3 = targetNameIgnored
31
33
32
34
type threadUnsafe3 = threadUnsafeIgnored
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ package object annotation {
27
27
type nowarn213 = nowarnIgnored
28
28
type nowarn3 = nowarn
29
29
30
+ type static3 = scala.annotation.static
31
+
30
32
type targetName3 = scala.annotation.targetName
31
33
32
34
type threadUnsafe3 = scala.annotation.threadUnsafe
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2022 Typelevel
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org .typelevel .scalaccompat .annotation
18
+ package internal
19
+
20
+ private [annotation] class staticIgnored extends scala.annotation.Annotation
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2022 Typelevel
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org .typelevel .scalaccompat .annotation
18
+
19
+ object CustomStaticHelper {
20
+ final val isScala3 = false
21
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2022 Typelevel
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org .typelevel .scalaccompat .annotation
18
+
19
+ object CustomStaticHelper {
20
+ final val isScala3 = true
21
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2022 Typelevel
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org .typelevel .scalaccompat .annotation
18
+
19
+ import munit .FunSuite
20
+
21
+ class CustomStaticDemo
22
+ object CustomStaticDemo {
23
+ @ static3 val foo = new Object
24
+ }
25
+
26
+ class CustomStaticSuite extends FunSuite {
27
+
28
+ test(" static3 respected on Scala 3 only" ) {
29
+ val fields = classOf [CustomStaticDemo ].getFields().map(_.getName).toList
30
+
31
+ if (CustomStaticHelper .isScala3) {
32
+ assertEquals(fields, List (" foo" ))
33
+ } else { // Scala 2
34
+ assertEquals(fields, Nil )
35
+ }
36
+ }
37
+
38
+ }
You can’t perform that action at this time.
0 commit comments