Skip to content

Commit 87ac38e

Browse files
authored
remove use of pre213 and since213 annotations (#785)
* remove use of pre213 and since213 annotations * more changes
1 parent 1c0cb76 commit 87ac38e

File tree

13 files changed

+1
-239
lines changed

13 files changed

+1
-239
lines changed

build.sbt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ lazy val httpCore = project("http-core")
122122
.settings(scalaMacroSupport)
123123
.enablePlugins(BootstrapGenjavadoc)
124124
.enablePlugins(ReproducibleBuildsPlugin)
125-
.enablePlugins(Pre213Preprocessor).settings(
126-
Pre213Preprocessor.pre213Files := Seq(
127-
"headers.scala", "HttpMessage.scala", "LanguageRange.scala", "CacheDirective.scala", "LinkValue.scala"))
128125
.disablePlugins(ScalafixPlugin)
129126

130127
lazy val http = project("http")
@@ -135,9 +132,6 @@ lazy val http = project("http")
135132
.settings(
136133
Compile / scalacOptions += "-language:_")
137134
.settings(scalaMacroSupport)
138-
.enablePlugins(Pre213Preprocessor).settings(
139-
Pre213Preprocessor.pre213Files := Seq(
140-
"scaladsl/server/directives/FormFieldDirectives.scala", "scaladsl/server/directives/RespondWithDirectives.scala"))
141135
.enablePlugins(BootstrapGenjavadoc, BoilerplatePlugin)
142136
.enablePlugins(ReproducibleBuildsPlugin)
143137

http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/HttpMessage.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import pekko.Done
3030
import pekko.actor.ClassicActorSystemProvider
3131
import org.parboiled2.CharUtils
3232
import pekko.util.{ ByteString, HashCode, OptionVal }
33-
import pekko.http.ccompat.{ pre213, since213 }
3433
import pekko.http.impl.util._
3534
import pekko.http.javadsl.{ model => jm }
3635
import pekko.http.scaladsl.util.FastFuture._
@@ -82,11 +81,6 @@ sealed trait HttpMessage extends jm.HttpMessage {
8281
entity.discardBytes()(SystemMaterializer(system).materializer)
8382

8483
/** Returns a copy of this message with the list of headers set to the given ones. */
85-
@pre213
86-
def withHeaders(headers: HttpHeader*): Self = withHeaders(headers.toList)
87-
88-
/** Returns a copy of this message with the list of headers set to the given ones. */
89-
@since213
9084
def withHeaders(firstHeader: HttpHeader, otherHeaders: HttpHeader*): Self =
9185
withHeaders(firstHeader +: otherHeaders.toList)
9286

@@ -97,10 +91,6 @@ sealed trait HttpMessage extends jm.HttpMessage {
9791
* Returns a new message that contains all of the given default headers which didn't already
9892
* exist (by case-insensitive header name) in this message.
9993
*/
100-
@pre213
101-
def withDefaultHeaders(defaultHeaders: HttpHeader*): Self = withDefaultHeaders(defaultHeaders.toList)
102-
103-
@since213
10494
def withDefaultHeaders(firstHeader: HttpHeader, otherHeaders: HttpHeader*): Self =
10595
withDefaultHeaders(firstHeader +: otherHeaders.toList)
10696

http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/CacheDirective.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import scala.annotation.{ tailrec, varargs }
2020
import scala.collection.immutable
2121
import pekko.http.impl.util._
2222
import pekko.http.javadsl.{ model => jm }
23-
import pekko.http.ccompat.{ pre213, since213 }
2423

2524
sealed trait CacheDirective extends Renderable with jm.headers.CacheDirective {
2625
def value: String
@@ -93,10 +92,6 @@ object CacheDirectives {
9392
* http://tools.ietf.org/html/rfc7234#section-5.2.1.4
9493
*/
9594
case object `no-cache` extends SingletonValueRenderable with RequestDirective with ResponseDirective {
96-
@pre213
97-
def apply(fieldNames: String*): `no-cache` =
98-
new `no-cache`(immutable.Seq(fieldNames: _*))
99-
@since213
10095
def apply(firstFieldName: String, otherFieldNames: String*): `no-cache` =
10196
new `no-cache`(firstFieldName +: otherFieldNames.toList)
10297
}
@@ -148,11 +143,7 @@ object CacheDirectives {
148143
*/
149144
final case class `private`(fieldNames: immutable.Seq[String]) extends FieldNamesDirective with ResponseDirective
150145
object `private` {
151-
@pre213
152-
def apply(fieldNames: String*): `private` = new `private`(immutable.Seq(fieldNames: _*))
153-
@since213
154146
def apply(): `private` = new `private`(immutable.Seq.empty)
155-
@since213
156147
def apply(firstFieldName: String, otherFieldNames: String*): `private` =
157148
new `private`(firstFieldName +: otherFieldNames)
158149
}

http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/LanguageRange.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import pekko.http.impl.util._
2020
import pekko.http.scaladsl.model.WithQValue
2121
import pekko.http.javadsl.{ model => jm }
2222
import pekko.http.impl.util.JavaMapping.Implicits._
23-
import pekko.http.ccompat.{ pre213, since213 }
2423

2524
sealed trait LanguageRange extends jm.headers.LanguageRange with ValueRenderable with WithQValue[LanguageRange] {
2625
def qValue: Float
@@ -82,10 +81,6 @@ object Language {
8281
val tags = compoundTag.split('-')
8382
new Language(tags.head, immutable.Seq(tags.tail: _*))
8483
} else new Language(compoundTag, immutable.Seq.empty)
85-
@pre213
86-
def apply(primaryTag: String, subTags: String*): Language =
87-
new Language(primaryTag, immutable.Seq(subTags: _*))
88-
@since213
8984
def apply(primaryTag: String, firstSubTag: String, otherSubTags: String*): Language =
9085
new Language(primaryTag, firstSubTag +: otherSubTags)
9186

http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/LinkValue.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ package org.apache.pekko.http.scaladsl.model.headers
1515

1616
import scala.collection.immutable
1717
import org.apache.pekko
18-
import org.parboiled2.CharPredicate
1918
import pekko.http.impl.util._
2019
import pekko.http.scaladsl.model._
2120
import pekko.http.javadsl.{ model => jm }
2221
import pekko.http.impl.util.JavaMapping.Implicits._
2322
import UriRendering.UriRenderer
24-
import pekko.http.ccompat.{ pre213, since213 }
23+
import org.parboiled2.CharPredicate
2524

2625
final case class LinkValue(uri: Uri, params: immutable.Seq[LinkParam]) extends jm.headers.LinkValue
2726
with ValueRenderable {
@@ -36,9 +35,6 @@ final case class LinkValue(uri: Uri, params: immutable.Seq[LinkParam]) extends j
3635
}
3736

3837
object LinkValue {
39-
@pre213
40-
def apply(uri: Uri, params: LinkParam*): LinkValue = apply(uri, immutable.Seq(params: _*))
41-
@since213
4238
def apply(uri: Uri, firstParam: LinkParam, otherParams: LinkParam*): LinkValue = apply(uri, firstParam +: otherParams)
4339
}
4440

http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/headers.scala

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import scala.annotation.tailrec
2929
import scala.collection.immutable
3030
import org.parboiled2.util.Base64
3131
import pekko.event.Logging
32-
import pekko.http.ccompat.{ pre213, since213 }
3332
import pekko.http.impl.util._
3433
import pekko.http.impl.model.parser.CharacterClasses.`attr-char`
3534
import pekko.http.javadsl.{ model => jm }
@@ -147,10 +146,6 @@ import pekko.http.impl.util.JavaMapping.Implicits._
147146

148147
// https://tools.ietf.org/html/rfc7231#section-5.3.2
149148
object Accept extends ModeledCompanion[Accept] {
150-
@pre213
151-
def apply(mediaRanges: MediaRange*): Accept =
152-
apply(immutable.Seq(mediaRanges: _*))
153-
@since213
154149
def apply(firstMediaRange: MediaRange, otherMediaRanges: MediaRange*): Accept =
155150
apply(firstMediaRange +: otherMediaRanges)
156151
implicit val mediaRangesRenderer: Renderer[immutable.Iterable[MediaRange]] = Renderer.defaultSeqRenderer[MediaRange] // cache
@@ -185,13 +180,8 @@ final case class `Accept-Charset`(charsetRanges: immutable.Seq[HttpCharsetRange]
185180

186181
// https://tools.ietf.org/html/rfc7231#section-5.3.4
187182
object `Accept-Encoding` extends ModeledCompanion[`Accept-Encoding`] {
188-
@pre213
189-
def apply(encodings: HttpEncodingRange*): `Accept-Encoding` =
190-
apply(immutable.Seq(encodings: _*))
191-
@since213
192183
def apply(): `Accept-Encoding` =
193184
apply(immutable.Seq.empty)
194-
@since213
195185
def apply(firstEncoding: HttpEncodingRange, otherEncodings: HttpEncodingRange*): `Accept-Encoding` =
196186
apply(firstEncoding +: otherEncodings)
197187
implicit val encodingsRenderer: Renderer[immutable.Iterable[HttpEncodingRange]] =
@@ -226,13 +216,8 @@ final case class `Accept-Language`(languages: immutable.Seq[LanguageRange]) exte
226216

227217
// https://tools.ietf.org/html/rfc7233#section-2.3
228218
object `Accept-Ranges` extends ModeledCompanion[`Accept-Ranges`] {
229-
@pre213
230-
def apply(rangeUnits: RangeUnit*): `Accept-Ranges` =
231-
apply(immutable.Seq(rangeUnits: _*))
232-
@since213
233219
def apply(): `Accept-Ranges` =
234220
apply(immutable.Seq.empty)
235-
@since213
236221
def apply(firstRangeUnit: RangeUnit, otherRangeUnits: RangeUnit*): `Accept-Ranges` =
237222
apply(firstRangeUnit +: otherRangeUnits)
238223
implicit val rangeUnitsRenderer: Renderer[immutable.Iterable[RangeUnit]] = Renderer.defaultSeqRenderer[RangeUnit] // cache
@@ -257,10 +242,6 @@ final case class `Access-Control-Allow-Credentials`(allow: Boolean)
257242

258243
// https://www.w3.org/TR/cors/#access-control-allow-headers-response-header
259244
object `Access-Control-Allow-Headers` extends ModeledCompanion[`Access-Control-Allow-Headers`] {
260-
@pre213
261-
def apply(headers: String*): `Access-Control-Allow-Headers` =
262-
apply(immutable.Seq(headers: _*))
263-
@since213
264245
def apply(firstHeader: String, otherHeaders: String*): `Access-Control-Allow-Headers` =
265246
apply(firstHeader +: otherHeaders)
266247
implicit val headersRenderer: Renderer[immutable.Iterable[String]] = Renderer.defaultSeqRenderer[String] // cache
@@ -277,10 +258,6 @@ final case class `Access-Control-Allow-Headers`(headers: immutable.Seq[String])
277258

278259
// https://www.w3.org/TR/cors/#access-control-allow-methods-response-header
279260
object `Access-Control-Allow-Methods` extends ModeledCompanion[`Access-Control-Allow-Methods`] {
280-
@pre213
281-
def apply(methods: HttpMethod*): `Access-Control-Allow-Methods` =
282-
apply(immutable.Seq(methods: _*))
283-
@since213
284261
def apply(firstMethod: HttpMethod, otherMethods: HttpMethod*): `Access-Control-Allow-Methods` =
285262
apply(firstMethod +: otherMethods)
286263
implicit val methodsRenderer: Renderer[immutable.Iterable[HttpMethod]] = Renderer.defaultSeqRenderer[HttpMethod] // cache
@@ -318,10 +295,6 @@ final case class `Access-Control-Allow-Origin` private (range: HttpOriginRange)
318295

319296
// https://www.w3.org/TR/cors/#access-control-expose-headers-response-header
320297
object `Access-Control-Expose-Headers` extends ModeledCompanion[`Access-Control-Expose-Headers`] {
321-
@pre213
322-
def apply(headers: String*): `Access-Control-Expose-Headers` =
323-
apply(immutable.Seq(headers: _*))
324-
@since213
325298
def apply(firstHeader: String, otherHeaders: String*): `Access-Control-Expose-Headers` =
326299
apply(firstHeader +: otherHeaders)
327300
implicit val headersRenderer: Renderer[immutable.Iterable[String]] = Renderer.defaultSeqRenderer[String] // cache
@@ -346,10 +319,6 @@ final case class `Access-Control-Max-Age`(deltaSeconds: Long) extends jm.headers
346319

347320
// https://www.w3.org/TR/cors/#access-control-request-headers-request-header
348321
object `Access-Control-Request-Headers` extends ModeledCompanion[`Access-Control-Request-Headers`] {
349-
@pre213
350-
def apply(headers: String*): `Access-Control-Request-Headers` =
351-
apply(immutable.Seq(headers: _*))
352-
@since213
353322
def apply(firstHeader: String, otherHeaders: String*): `Access-Control-Request-Headers` =
354323
apply(firstHeader +: otherHeaders)
355324
implicit val headersRenderer: Renderer[immutable.Iterable[String]] = Renderer.defaultSeqRenderer[String] // cache
@@ -381,13 +350,8 @@ final case class Age(deltaSeconds: Long) extends jm.headers.Age with ResponseHea
381350

382351
// https://tools.ietf.org/html/rfc7231#section-7.4.1
383352
object Allow extends ModeledCompanion[Allow] {
384-
@pre213
385-
def apply(methods: HttpMethod*): Allow =
386-
apply(immutable.Seq(methods: _*))
387-
@since213
388353
def apply(): `Allow` =
389354
apply(immutable.Seq.empty)
390-
@since213
391355
def apply(firstMethod: HttpMethod, otherMethods: HttpMethod*): Allow =
392356
apply(firstMethod +: otherMethods)
393357
implicit val methodsRenderer: Renderer[immutable.Iterable[HttpMethod]] = Renderer.defaultSeqRenderer[HttpMethod] // cache
@@ -564,9 +528,6 @@ final case class `Content-Type` private[pekko] (contentType: ContentType) extend
564528
object Cookie extends ModeledCompanion[Cookie] {
565529
def apply(first: HttpCookiePair, more: HttpCookiePair*): Cookie = apply(immutable.Seq(first +: more: _*))
566530
def apply(name: String, value: String): Cookie = apply(HttpCookiePair(name, value))
567-
@pre213
568-
def apply(values: (String, String)*): Cookie = apply(values.map(HttpCookiePair(_)).toList)
569-
@since213
570531
def apply(first: (String, String), more: (String, String)*): Cookie = apply((first +: more).map(HttpCookiePair(_)))
571532
implicit val cookiePairsRenderer: Renderer[immutable.Iterable[HttpCookiePair]] =
572533
Renderer.seqRenderer[HttpCookiePair](separator = "; ") // cache
@@ -716,9 +677,6 @@ final case class `Last-Modified`(date: DateTime) extends jm.headers.LastModified
716677
object Link extends ModeledCompanion[Link] {
717678
def apply(uri: Uri, first: LinkParam, more: LinkParam*): Link =
718679
apply(immutable.Seq(LinkValue(uri, first +: more.toList)))
719-
@pre213
720-
def apply(values: LinkValue*): Link = apply(immutable.Seq(values: _*))
721-
@since213
722680
def apply(firstValue: LinkValue, otherValues: LinkValue*): Link = apply(firstValue +: otherValues)
723681

724682
implicit val valuesRenderer: Renderer[immutable.Iterable[LinkValue]] = Renderer.defaultSeqRenderer[LinkValue] // cache
@@ -744,9 +702,6 @@ final case class Location(uri: Uri) extends jm.headers.Location with ResponseHea
744702

745703
// https://tools.ietf.org/html/rfc6454#section-7
746704
object Origin extends ModeledCompanion[Origin] {
747-
@pre213
748-
def apply(origins: HttpOrigin*): Origin = apply(immutable.Seq(origins: _*))
749-
@since213
750705
def apply(firstOrigin: HttpOrigin, otherOrigins: HttpOrigin*): Origin = apply(firstOrigin +: otherOrigins)
751706
}
752707
final case class Origin(origins: immutable.Seq[HttpOrigin]) extends jm.headers.Origin with RequestHeader

http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/FormFieldDirectives.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import scala.collection.immutable
2727
import scala.concurrent.Future
2828
import scala.util.{ Failure, Success }
2929
import BasicDirectives._
30-
import pekko.http.ccompat.pre213
31-
import pekko.http.ccompat.since213
3230

3331
/**
3432
* @groupname form Form field directives

http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/RespondWithDirectives.scala

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package directives
1616

1717
import org.apache.pekko
1818
import pekko.http.scaladsl.model._
19-
import pekko.http.ccompat._
2019
import scala.collection.immutable
2120

2221
/**
@@ -47,11 +46,6 @@ trait RespondWithDirectives {
4746
*
4847
* @group response
4948
*/
50-
@pre213
51-
def respondWithHeaders(responseHeaders: HttpHeader*): Directive0 =
52-
respondWithHeaders(responseHeaders.toList)
53-
54-
@since213
5549
def respondWithHeaders(firstHeader: HttpHeader, otherHeaders: HttpHeader*): Directive0 =
5650
respondWithHeaders(firstHeader +: otherHeaders.toList)
5751

@@ -69,17 +63,6 @@ trait RespondWithDirectives {
6963
*
7064
* @group response
7165
*/
72-
@pre213
73-
def respondWithDefaultHeaders(responseHeaders: HttpHeader*): Directive0 =
74-
respondWithDefaultHeaders(responseHeaders.toList)
75-
76-
/**
77-
* Adds the given response headers to all HTTP responses of its inner Route,
78-
* if a header already exists it is not added again.
79-
*
80-
* @group response
81-
*/
82-
@since213
8366
def respondWithDefaultHeaders(firstHeader: HttpHeader, otherHeaders: HttpHeader*): Directive0 =
8467
respondWithDefaultHeaders(firstHeader +: otherHeaders.toList)
8568

parsing/src/main/scala-2/org/apache/pekko/http/ccompat/pre213macro.scala

Lines changed: 0 additions & 34 deletions
This file was deleted.

parsing/src/main/scala-2/org/apache/pekko/http/ccompat/since213macro.scala

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)