From c912d019273aac715d75a3e23bfd0d962a253ca7 Mon Sep 17 00:00:00 2001 From: satorg Date: Mon, 18 Apr 2022 00:37:36 -0700 Subject: [PATCH] introduce compat @unused annotation --- .../cats/kernel/compat/unused.scala | 31 +++++++++++++++++++ .../cats/kernel/compat/unused.scala | 25 +++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 kernel/src/main/scala-2.12/cats/kernel/compat/unused.scala create mode 100644 kernel/src/main/scala-2.13+/cats/kernel/compat/unused.scala diff --git a/kernel/src/main/scala-2.12/cats/kernel/compat/unused.scala b/kernel/src/main/scala-2.12/cats/kernel/compat/unused.scala new file mode 100644 index 00000000000..f046b437754 --- /dev/null +++ b/kernel/src/main/scala-2.12/cats/kernel/compat/unused.scala @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2015 Typelevel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package cats.kernel.compat + +/** Simulates the behaviour of `@unused` annotation originally implemented + * in Scala 2.13 and above. + * + * @note copied from + * [[https://github.com/scala/scala-collection-compat/blob/e35e330fca28c78c39fa2d4812fa33ce892f19e3/compat/src/main/scala-2.11_2.12/scala/annotation/unused.scala scala-collection-compat]] + * source code. + */ +final private[cats] class unused extends deprecated("unused", "unused") diff --git a/kernel/src/main/scala-2.13+/cats/kernel/compat/unused.scala b/kernel/src/main/scala-2.13+/cats/kernel/compat/unused.scala new file mode 100644 index 00000000000..008906e437c --- /dev/null +++ b/kernel/src/main/scala-2.13+/cats/kernel/compat/unused.scala @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2015 Typelevel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package cats.kernel.compat + +/** Simply reuse the annotation from Scala Library for Scala 2.13 and above. */ +final private[cats] class unused extends scala.annotation.unused