Skip to content

Commit 8e651a1

Browse files
committed
[base] reduce result jar size by not using empty classes as annotation targets
1 parent 5533438 commit 8e651a1

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

Base/src/main/scala/typeclass/Optionally.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package name.rayrobdod.stringContextParserCombinator
22
package typeclass
33

4-
import scala.annotation.nowarn
54
import scala.reflect.ClassTag
65
import com.eed3si9n.ifdef.ifdef
76

8-
@nowarn("msg=make nowarn used")
9-
private[typeclass] final class Optionally_MakeNowarnUsed
10-
117
/**
128
* Describes how to represent an optional value
139
*
@@ -325,13 +321,13 @@ private[typeclass] trait LowPrioBiOptionally {
325321
(ctx:Ctx) => {
326322
val myBindSingletonContexts = new BindSingletonContexts[Ctx, ctx.type]
327323
import myBindSingletonContexts._
328-
@nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
324+
@annotation.nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
329325
selectTermNames[Option[A]](ctx)("_root_", "scala", "None"): Ctx#Expr[Option[A]]
330326
},
331327
(value, ctx) => {
332328
val myBindSingletonContexts = new BindSingletonContexts[Ctx, ctx.type]
333329
import myBindSingletonContexts._
334-
@nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
330+
@annotation.nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
335331
val value2: ctx.Expr[A] = value
336332
val rootTree = ctx.universe.Ident(ctx.universe.TermName("_root_"))
337333
val namesTree = List("scala", "Some", "apply").foldLeft[ctx.universe.Tree](rootTree)({(folding, name) => ctx.universe.Select(folding, ctx.universe.TermName(name))})

Base/src/main/scala/typeclass/Repeated.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package name.rayrobdod.stringContextParserCombinator
22
package typeclass
33

4-
import scala.annotation.nowarn
54
import com.eed3si9n.ifdef.ifdef
65
import scala.collection.mutable.Builder
76

8-
@nowarn("msg=make nowarn used")
9-
private[typeclass] final class Repeated_MakeNowarnUsed
10-
117
/**
128
* Describes how to combine a homogeneous sequence of zero-or-more values.
139
*
@@ -626,14 +622,14 @@ object BiRepeated extends LowPrioBiRepeated {
626622
(value, ctx) => {
627623
val myBindSingletonContexts = new BindSingletonContexts[Ctx, ctx.type]
628624
import myBindSingletonContexts._
629-
@nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
625+
@annotation.nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
630626
val value2 = value: ctx.Expr[List[A]]
631627
select[List[A], Boolean](ctx)(value2, "nonEmpty"): Ctx#Expr[Boolean]
632628
},
633629
(value, ctx) => {
634630
val myBindSingletonContexts = new BindSingletonContexts[Ctx, ctx.type]
635631
import myBindSingletonContexts._
636-
@nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
632+
@annotation.nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
637633
val value2 = value: ctx.Expr[List[A]]
638634
(
639635
select[List[A], A](ctx)(value2, "head"): Ctx#Expr[A],
@@ -644,7 +640,7 @@ object BiRepeated extends LowPrioBiRepeated {
644640
(value, ctx) => {
645641
val myBindSingletonContexts = new BindSingletonContexts[Ctx, ctx.type]
646642
import myBindSingletonContexts._
647-
@nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
643+
@annotation.nowarn("msg=never used") implicit val typA2:ctx.TypeTag[A] = typA
648644
val value2 = value: ctx.Expr[List[A]]
649645
select[List[A], Boolean](ctx)(value2, "isEmpty"): Ctx#Expr[Boolean]
650646
},

Base/src/main/scala/typeclass/Sequenced.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ package typeclass
33

44
import com.eed3si9n.ifdef.ifdef
55

6-
@ifdef("scalaEpochVersion:2")
7-
private class NoWarnAboutUnusedIfdef {}
8-
96
/**
107
* Describes how to combine two adjacent values into one value
118
*
@@ -93,6 +90,10 @@ object Sequenced extends LowPrioSequenced {
9390
new Apply()
9491
}
9592

93+
@scala.annotation.nowarn("msg=unused")
94+
@ifdef("scalaEpochVersion:2")
95+
private def __do_not_warn_about_unused_ifdef = 0
96+
9697
/**
9798
* @group Support
9899
*/

0 commit comments

Comments
 (0)