Skip to content

Commit

Permalink
Bump Akka dependency and use ApiMayChange InternalApi annotations akk…
Browse files Browse the repository at this point in the history
…a#727 (akka#858)

* Upgrade Akka dependency and use ApiMayChange InternalApi annotations akka#727

Issue: akka#727
Upgrade Akka dependency
Use ApiMayChange and InternalApi where applicable
Some imports reformatted following standard

* model classes should have DoNotInherit. HostConnectionPoolSetup was not internal

* Apply feedback about right annotations

Provide the right annotations
Move UriJavaAccessor to impl package

Adapt mima filters

* Change type for HttpApp to abstract class

In order to improve binary compatibility, transform HttpApp to an
abstract class
Add filter in MiMa for this

* apply feedback
  • Loading branch information
jlprat authored and jrudolph committed Feb 23, 2017
1 parent 7973b4a commit 3c966af
Show file tree
Hide file tree
Showing 110 changed files with 365 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package akka.http.javadsl.model;

import akka.http.scaladsl.model.Uri;
import akka.http.scaladsl.model.UriJavaAccessor;
import akka.http.impl.model.UriJavaAccessor;

import java.net.InetAddress;
import java.nio.charset.Charset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package akka.http.javadsl.model;

import akka.annotation.DoNotInherit;
import akka.stream.Materializer;
import akka.http.javadsl.model.headers.HttpCredentials;
import akka.util.ByteString;
Expand All @@ -20,6 +21,7 @@
*
* Binary compatibility is only maintained for callers of this trait’s interface.
*/
@DoNotInherit
public interface HttpMessage {
/**
* Is this instance a request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package akka.http.javadsl.model;

import akka.http.impl.model.JavaQuery;
import akka.http.impl.model.UriJavaAccessor;
import akka.http.scaladsl.model.*;
import akka.japi.Pair;
import akka.parboiled2.CharPredicate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.nio.charset.Charset;

import akka.http.impl.model.JavaUri;
import akka.http.scaladsl.model.UriJavaAccessor;
import akka.http.impl.model.UriJavaAccessor;
import akka.parboiled2.ParserInput$;

import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.settings.Serv
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.settings.ServerSettingsImpl#Timeouts.copy")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.settings.ServerSettingsImpl#Timeouts.this")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.util.StreamUtils.absorbCancellation")
ProblemFilters.exclude[MissingClassProblem]("akka.http.impl.util.StreamUtils$AbsorbCancellationStage")
ProblemFilters.exclude[MissingClassProblem]("akka.http.impl.util.StreamUtils$AbsorbCancellationStage")
ProblemFilters.exclude[MissingClassProblem]("akka.http.scaladsl.model.UriJavaAccessor$")
ProblemFilters.exclude[MissingClassProblem]("akka.http.scaladsl.model.UriJavaAccessor")
ProblemFilters.exclude[FinalClassProblem]("akka.http.impl.model.JavaQuery")
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import java.net.InetSocketAddress
import java.util.concurrent.TimeoutException

import akka.NotUsed
import akka.annotation.InternalApi
import akka.stream.scaladsl.{ BidiFlow, Flow }
import akka.util.ByteString

import scala.concurrent.duration.FiniteDuration
import scala.util.control.NoStackTrace

/** INTERNAL API */
@InternalApi
private[akka] object HttpConnectionIdleTimeoutBidi {
def apply(idleTimeout: FiniteDuration, remoteAddress: Option[InetSocketAddress]): BidiFlow[ByteString, ByteString, ByteString, ByteString, NotUsed] = {
val connectionToString = remoteAddress match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package akka.http.impl.engine.client

import akka.NotUsed
import akka.annotation.InternalApi
import akka.http.scaladsl.settings.{ ClientConnectionSettings, ParserSettings }
import akka.stream.impl.ConstantFun

Expand Down Expand Up @@ -33,6 +34,7 @@ import scala.util.control.NoStackTrace
/**
* INTERNAL API
*/
@InternalApi
private[http] object OutgoingConnectionBlueprint {

type BypassData = HttpResponseParser.ResponseContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import java.util.concurrent.atomic.AtomicLong

import akka.Done
import akka.actor.ActorRef
import akka.annotation.InternalApi
import akka.http.impl.engine.client.PoolGateway.{ GatewayIdentifier, SharedGateway }
import akka.http.impl.engine.client.PoolMasterActor._
import akka.http.impl.settings.HostConnectionPoolSetup
Expand Down Expand Up @@ -65,6 +66,7 @@ private[http] final class PoolGateway(gatewayRef: ActorRef, val hcps: HostConnec
override def toString = s"PoolGateway(hcps = $hcps)"

// INTERNAL API (testing only)
@InternalApi
private[client] def poolStatus(): Future[Option[PoolInterfaceStatus]] = {
val statusPromise = Promise[Option[PoolInterfaceStatus]]()
gatewayRef ! PoolStatus(this, statusPromise)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package akka.http.impl.engine.client

import akka.Done
import akka.actor.{ Actor, ActorLogging, ActorRef, DeadLetterSuppression, Deploy, NoSerializationVerificationNeeded, Props, Terminated }
import akka.annotation.InternalApi
import akka.http.impl.engine.client.PoolInterfaceActor.PoolRequest
import akka.http.impl.settings.HostConnectionPoolSetup
import akka.http.scaladsl.HttpExt
Expand All @@ -32,6 +33,7 @@ import scala.concurrent.{ Future, Promise }
* [[HttpExt.newHostConnectionPool]], and will have their dedicated restartable pool.
*
*/
@InternalApi
private[http] final class PoolMasterActor extends Actor with ActorLogging {

import PoolMasterActor._
Expand Down Expand Up @@ -150,7 +152,6 @@ private[http] object PoolMasterActor {
final case class Shutdown(gateway: PoolGateway, shutdownCompletedPromise: Promise[Done]) extends NoSerializationVerificationNeeded with DeadLetterSuppression
final case class ShutdownAll(shutdownCompletedPromise: Promise[Done]) extends NoSerializationVerificationNeeded with DeadLetterSuppression

// INTERNAL API (for testing only)
final case class PoolStatus(gateway: PoolGateway, statusPromise: Promise[Option[PoolInterfaceStatus]]) extends NoSerializationVerificationNeeded
final case class PoolSize(sizePromise: Promise[Int]) extends NoSerializationVerificationNeeded

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package akka.http.impl.engine.parsing

import akka.NotUsed
import akka.annotation.InternalApi

import scala.annotation.tailrec
import akka.event.LoggingAdapter
Expand All @@ -25,6 +26,7 @@ import akka.stream.impl.fusing.SubSource
*
* see: http://tools.ietf.org/html/rfc2046#section-5.1.1
*/
@InternalApi
private[http] final class BodyPartParser(
defaultContentType: ContentType,
boundary: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

package akka.http.impl.engine.parsing

import java.nio.{ CharBuffer, ByteBuffer }
import java.nio.{ ByteBuffer, CharBuffer }
import java.util.Arrays.copyOf
import java.lang.{ StringBuilder JStringBuilder }

import akka.annotation.InternalApi
import akka.event.LoggingAdapter
import akka.http.scaladsl.settings.ParserSettings.IllegalResponseHeaderValueProcessingMode
import akka.http.scaladsl.settings.ParserSettings
Expand Down Expand Up @@ -62,6 +64,7 @@ import akka.http.impl.model.parser.CharacterClasses._
* Since we address them via the nodes MSB and zero is reserved the trie
* cannot hold more then 255 items, so this array has a fixed size of 255.
*/
@InternalApi
private[engine] final class HttpHeaderParser private (
val settings: HttpHeaderParser.Settings,
val log: LoggingAdapter,
Expand Down Expand Up @@ -412,6 +415,7 @@ private[engine] final class HttpHeaderParser private (
/**
* INTERNAL API
*/
@InternalApi
private[http] object HttpHeaderParser {
import SpecializedHeaderValueParsers._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ import akka.http.scaladsl.model._
import headers._
import HttpProtocols._
import ParserOutput._
import akka.annotation.InternalApi
import akka.stream.{ Attributes, FlowShape, Inlet, Outlet }

/**
* INTERNAL API
*
* Common logic for http request and response message parsing
*/
@InternalApi
private[http] trait HttpMessageParser[Output >: MessageOutput <: ParserOutput] {

import HttpMessageParser._
Expand Down Expand Up @@ -345,6 +347,7 @@ private[http] trait HttpMessageParser[Output >: MessageOutput <: ParserOutput] {
/**
* INTERNAL API
*/
@InternalApi
private[http] object HttpMessageParser {
sealed trait StateResult // phantom type for ensuring soundness of our parsing method setup
final case class Trampoline(f: ByteString StateResult) extends StateResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import akka.http.scaladsl.model._
import headers._
import StatusCodes._
import ParserOutput._
import akka.annotation.InternalApi
import akka.http.impl.util.ByteStringParserInput
import akka.stream.{ Attributes, FlowShape, Inlet, Outlet }
import akka.stream.TLSProtocol.SessionBytes
Expand All @@ -23,6 +24,7 @@ import akka.stream.stage.{ GraphStage, GraphStageLogic, InHandler, OutHandler }
/**
* INTERNAL API
*/
@InternalApi
private[http] final class HttpRequestParser(
settings: ParserSettings,
rawRequestUriHeader: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import akka.util.ByteString
import akka.http.scaladsl.model._
import headers._
import ParserOutput._
import akka.annotation.InternalApi

/**
* INTERNAL API
*/
@InternalApi
private[http] class HttpResponseParser(protected val settings: ParserSettings, protected val headerParser: HttpHeaderParser)
extends HttpMessageParser[ResponseOutput] { self
import HttpResponseParser._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package akka.http.impl.engine.parsing

import akka.NotUsed
import akka.annotation.InternalApi
import akka.http.scaladsl.model._
import akka.stream.scaladsl.Source
import akka.util.ByteString
Expand All @@ -13,11 +14,13 @@ import akka.stream.impl.fusing.SubSource
/**
* INTERNAL API
*/
@InternalApi
private[http] sealed trait ParserOutput

/**
* INTERNAL API
*/
@InternalApi
private[http] object ParserOutput {
sealed trait RequestOutput extends ParserOutput
sealed trait ResponseOutput extends ParserOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@

package akka.http.impl.engine.parsing

import akka.annotation.InternalApi

import scala.annotation.tailrec
import akka.util.ByteString
import akka.http.impl.model.parser.CharacterClasses._
import akka.http.scaladsl.model.{ HttpHeader, ErrorInfo }
import akka.http.scaladsl.model.{ ErrorInfo, HttpHeader }
import akka.http.scaladsl.model.headers.`Content-Length`

/**
* INTERNAL API
*/
@InternalApi
private object SpecializedHeaderValueParsers {
import HttpHeaderParser._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ package object parsing {

package parsing {

import akka.annotation.InternalApi

/**
* INTERNAL API
*/
@InternalApi
private[parsing] class ParsingException(
val status: StatusCode,
val info: ErrorInfo) extends RuntimeException(info.formatPretty) {
Expand All @@ -63,6 +66,7 @@ package parsing {
/**
* INTERNAL API
*/
@InternalApi
private[parsing] object NotEnoughDataException extends SingletonException
}

Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import akka.stream.stage._
import akka.util.ByteString
import HttpEntity._
import akka.stream.{ Attributes, FlowShape, Inlet, Outlet }

import java.util.concurrent.ThreadLocalRandom

import akka.annotation.InternalApi

/**
* INTERNAL API
*/
@InternalApi
private[http] object BodyPartRenderer {

def streamed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ import akka.stream.scaladsl.Source
import akka.http.scaladsl.model._
import akka.http.impl.util._
import RenderSupport._
import akka.annotation.InternalApi
import headers._

/**
* INTERNAL API
*/
@InternalApi
private[http] class HttpRequestRendererFactory(
userAgentHeader: Option[headers.`User-Agent`],
requestHeaderSizeHint: Int,
Expand Down Expand Up @@ -175,6 +177,7 @@ private[http] object HttpRequestRendererFactory {
* be completed successfully when the request entity is allowed to go out onto the wire;
* if the future is completed with an error the connection is to be closed.
*/
@InternalApi
private[http] final case class RequestRenderingContext(
request: HttpRequest,
hostHeader: Host,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import akka.http.scaladsl.model._
import akka.http.impl.util._
import RenderSupport._
import HttpProtocols._
import akka.annotation.InternalApi
import headers._

import scala.concurrent.duration._

/**
* INTERNAL API
*/
@InternalApi
private[http] class HttpResponseRendererFactory(
serverHeader: Option[headers.Server],
responseHeaderSizeHint: Int,
Expand Down Expand Up @@ -279,15 +281,18 @@ private[http] class HttpResponseRendererFactory(
/**
* INTERNAL API
*/
@InternalApi
private[http] final case class ResponseRenderingContext(
response: HttpResponse,
requestMethod: HttpMethod = HttpMethods.GET,
requestProtocol: HttpProtocol = HttpProtocols.`HTTP/1.1`,
closeRequested: Boolean = false)

/** INTERNAL API */
@InternalApi
private[http] sealed trait ResponseRenderingOutput
/** INTERNAL API */
@InternalApi
private[http] object ResponseRenderingOutput {
private[http] case class HttpData(bytes: ByteString) extends ResponseRenderingOutput
private[http] case class SwitchToWebSocket(httpResponseBytes: ByteString, handler: Either[Graph[FlowShape[FrameEvent, FrameEvent], Any], Graph[FlowShape[Message, Message], Any]]) extends ResponseRenderingOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package akka.http.impl.engine.rendering

import akka.annotation.InternalApi
import akka.parboiled2.CharUtils
import akka.stream.{ Attributes, SourceShape }
import akka.util.ByteString
Expand All @@ -13,13 +14,13 @@ import akka.stream.scaladsl._
import akka.stream.stage._
import akka.http.scaladsl.model._
import akka.http.impl.util._

import akka.stream.stage.GraphStage
import akka.stream._
import akka.stream.scaladsl.{ Sink, Source, Flow }
import akka.stream.scaladsl.{ Flow, Sink, Source }
/**
* INTERNAL API
*/
@InternalApi
private object RenderSupport {
val DefaultStatusLineBytes = "HTTP/1.1 200 OK\r\n".asciiBytes
val StatusLineStartBytes = "HTTP/1.1 ".asciiBytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ package akka.http.impl.engine.server

import java.net.InetSocketAddress

import akka.annotation.InternalApi
import akka.stream.Attributes

/**
* INTERNAL API
* Internally used attributes set in the HTTP pipeline.
* May potentially be opened up in the future.
*/
@InternalApi
private[akka] object HttpAttributes {
import Attributes._

Expand Down
Loading

0 comments on commit 3c966af

Please sign in to comment.