pekko/akka-actor/src/main/scala/akka/util/JavaVersion.scala
Johannes Rudolph c462ecb60f Simple JDK 11 fixes (#26038)
* TLSSpec fix for Java 11 #25739

* =act silence logging in AsyncDns specs

* +act Add internal akka.util.JavaVersion for determining runtime Java version

* =act #25733 run TcpIntegrationSpec peers on different ActorSystems

* pro: add explicit dependency to activation when using dockerClient for JDK 11+

Otherwise, the log is spammed with lots of ClassNotFound exceptions when
running AsyncDnsResolverIntegrationSpec
2018-12-04 15:26:47 +01:00

26 lines
687 B
Scala

/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package akka.util
import akka.annotation.InternalApi
/**
* INTERNAL API
*/
@InternalApi private[akka] object JavaVersion {
val majorVersion: Int = {
// FIXME replace with Runtime.version() when we no longer support Java 8
// See Oracle section 1.5.3 at:
// https://docs.oracle.com/javase/8/docs/technotes/guides/versioning/spec/versioning2.html
val version = System.getProperty("java.specification.version").split('.')
val majorString =
if (version(0) == "1") version(1) // Java 8 will be 1.8
else version(0) // later will be 9, 10, 11 etc
majorString.toInt
}
}