Avoid triggering IntelliJ's dead code detection (#29242)
This commit is contained in:
parent
bc68f0d650
commit
9641780054
11 changed files with 28 additions and 31 deletions
|
|
@ -97,10 +97,10 @@ object Configuration {
|
|||
val engine = sslEngineProvider.createClientSSLEngine()
|
||||
val gotAllSupported = enabled.toSet.diff(engine.getSupportedCipherSuites.toSet)
|
||||
val gotAllEnabled = enabled.toSet.diff(engine.getEnabledCipherSuites.toSet)
|
||||
gotAllSupported.isEmpty || (throw new IllegalArgumentException("Cipher Suite not supported: " + gotAllSupported))
|
||||
gotAllEnabled.isEmpty || (throw new IllegalArgumentException("Cipher Suite not enabled: " + gotAllEnabled))
|
||||
engine.getSupportedProtocols.contains(settings.SSLProtocol) ||
|
||||
(throw new IllegalArgumentException("Protocol not supported: " + settings.SSLProtocol))
|
||||
if (gotAllSupported.nonEmpty) throw new IllegalArgumentException("Cipher Suite not supported: " + gotAllSupported)
|
||||
if (gotAllEnabled.nonEmpty) throw new IllegalArgumentException("Cipher Suite not enabled: " + gotAllEnabled)
|
||||
if (!engine.getSupportedProtocols.contains(settings.SSLProtocol))
|
||||
throw new IllegalArgumentException("Protocol not supported: " + settings.SSLProtocol)
|
||||
|
||||
CipherConfig(true, config, cipher, localPort, remotePort, Some(sslEngineProvider))
|
||||
} catch {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ object RemoteDeploymentSpec {
|
|||
}
|
||||
|
||||
class DeadOnArrival extends Actor {
|
||||
throw new Exception("init-crash")
|
||||
if ("confuse IntellIJ dead code checker".length > 2) {
|
||||
throw new Exception("init-crash")
|
||||
}
|
||||
|
||||
def receive = Actor.emptyBehavior
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,15 +45,14 @@ object CipherSuiteSupportCheck {
|
|||
import sslFactoryConfig._
|
||||
val gotAllSupported = SSLEnabledAlgorithms.diff(engine.getSupportedCipherSuites.toSet)
|
||||
val gotAllEnabled = SSLEnabledAlgorithms.diff(engine.getEnabledCipherSuites.toSet)
|
||||
gotAllSupported.isEmpty || (throw new IllegalArgumentException("Cipher Suite not supported: " + gotAllSupported))
|
||||
gotAllEnabled.isEmpty || (throw new IllegalArgumentException("Cipher Suite not enabled: " + gotAllEnabled))
|
||||
if (gotAllSupported.nonEmpty) throw new IllegalArgumentException("Cipher Suite not supported: " + gotAllSupported)
|
||||
if (gotAllEnabled.nonEmpty) throw new IllegalArgumentException("Cipher Suite not enabled: " + gotAllEnabled)
|
||||
}
|
||||
|
||||
private def isProtocolSupported(sslFactoryConfig: SSLEngineConfig, engine: SSLEngine) = {
|
||||
import sslFactoryConfig._
|
||||
engine.getSupportedProtocols.contains(SSLProtocol) ||
|
||||
(throw new IllegalArgumentException("Protocol not supported: " + SSLProtocol))
|
||||
|
||||
if (!engine.getSupportedProtocols.contains(SSLProtocol))
|
||||
throw new IllegalArgumentException("Protocol not supported: " + SSLProtocol)
|
||||
}
|
||||
|
||||
private def buildSslEngine(system: ActorSystem): SSLEngine = {
|
||||
|
|
|
|||
|
|
@ -448,7 +448,6 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
|
|||
.fromPublisher(publisher)
|
||||
.flatMapPrefixMat(2) { prefix =>
|
||||
fail(s"unexpected prefix (length = ${prefix.size})")
|
||||
Flow[Int]
|
||||
}(Keep.right)
|
||||
.toMat(Sink.ignore)(Keep.both)
|
||||
.withAttributes(attributes)
|
||||
|
|
@ -526,7 +525,6 @@ class FlowFlatMapPrefixSpec extends StreamSpec {
|
|||
.flatMapPrefixMat(0) { prefix =>
|
||||
prefix should be(empty)
|
||||
throw TE("not this time my friend!")
|
||||
Flow[Int].mapMaterializedValue(_ => prefix)
|
||||
}(Keep.right)
|
||||
.toMat(Sink.seq)(Keep.both)
|
||||
.withAttributes(attributes)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class FlowFlattenMergeSpec extends StreamSpec {
|
|||
"propagate early failure from main stream" in assertAllStagesStopped {
|
||||
val ex = new Exception("buh")
|
||||
intercept[TestFailedException] {
|
||||
Source.failed(ex).flatMapMerge(1, identity).runWith(Sink.head).futureValue
|
||||
Source.failed(ex).flatMapMerge(1, (i: Int) => Source.single(i)).runWith(Sink.head).futureValue
|
||||
}.cause.get should ===(ex)
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +95,9 @@ class FlowFlattenMergeSpec extends StreamSpec {
|
|||
val out = Outlet[String]("out")
|
||||
val shape = SourceShape(out)
|
||||
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) {
|
||||
throw matFail
|
||||
if ("confuse IntellIJ dead code checker".length > 2) {
|
||||
throw matFail
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class FlowIntersperseSpec extends StreamSpec("""
|
|||
}
|
||||
|
||||
"surround empty stream with []" in {
|
||||
val probe = Source(List()).map(_.toString).intersperse("[", ",", "]").runWith(TestSink.probe)
|
||||
val probe = Source(List()).intersperse("[", ",", "]").runWith(TestSink.probe)
|
||||
|
||||
probe.expectSubscription()
|
||||
probe.toStrict(1.second).mkString("") should ===(List().mkString("[", ",", "]"))
|
||||
|
|
|
|||
|
|
@ -67,12 +67,7 @@ class FlowMapErrorSpec extends StreamSpec("""
|
|||
}
|
||||
|
||||
"finish stream if it's empty" in assertAllStagesStopped {
|
||||
Source.empty
|
||||
.map(identity)
|
||||
.mapError { case _: Throwable => boom }
|
||||
.runWith(TestSink.probe[Int])
|
||||
.request(1)
|
||||
.expectComplete()
|
||||
Source.empty.mapError { case _: Throwable => boom }.runWith(TestSink.probe[Int]).request(1).expectComplete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,12 +56,7 @@ class FlowRecoverSpec extends StreamSpec("""
|
|||
}
|
||||
|
||||
"finish stream if it's empty" in assertAllStagesStopped {
|
||||
Source.empty
|
||||
.map(identity)
|
||||
.recover { case _: Throwable => 0 }
|
||||
.runWith(TestSink.probe[Int])
|
||||
.request(1)
|
||||
.expectComplete()
|
||||
Source.empty.recover { case _: Throwable => 0 }.runWith(TestSink.probe[Int]).request(1).expectComplete()
|
||||
}
|
||||
|
||||
"not log error when exception is thrown from recover block" in assertAllStagesStopped {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@ class LazySinkSpec extends StreamSpec("""
|
|||
val in = Inlet[String]("in")
|
||||
val shape = SinkShape(in)
|
||||
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) {
|
||||
throw matFail
|
||||
if ("confuse IntellIJ dead code checker".length > 2) {
|
||||
throw matFail
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,9 @@ class LazySourceSpec extends StreamSpec with DefaultTimeout with ScalaFutures {
|
|||
val out = Outlet[String]("out")
|
||||
val shape = SourceShape(out)
|
||||
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) {
|
||||
throw matFail
|
||||
if ("confuse IntellIJ dead code checker".length > 2) {
|
||||
throw matFail
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +375,9 @@ class LazySourceSpec extends StreamSpec with DefaultTimeout with ScalaFutures {
|
|||
val out = Outlet[String]("out")
|
||||
val shape = SourceShape(out)
|
||||
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) {
|
||||
throw matFail
|
||||
if ("confuse IntellIJ dead code checker".length > 2) {
|
||||
throw matFail
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class UnfoldResourceAsyncSourceSpec extends StreamSpec(UnboundedMailboxConfig) {
|
|||
.unfoldResourceAsync[Unit, Unit](
|
||||
() => Future.successful(()),
|
||||
_ => Future.successful[Option[Unit]](None),
|
||||
_ => Future.failed(throw TE("")))
|
||||
_ => Future.failed(TE("")))
|
||||
.runWith(Sink.fromSubscriber(probe))
|
||||
probe.ensureSubscription()
|
||||
probe.request(1L)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue