From 7ff064cb8b0bf3c8e2bfd2a84d24328a15efe963 Mon Sep 17 00:00:00 2001 From: Neil Skinner Date: Sat, 11 Feb 2023 23:22:24 +0000 Subject: [PATCH 01/12] scala 2.13 and spark 3.3.1 --- Dockerfile | 2 +- Dockerfile.toree-dev | 2 +- Makefile | 2 +- build.sbt | 2 +- .../kernel/protocol/v5/client/Utilities.scala | 20 +- .../v5/client/socket/HeartbeatClient.scala | 2 +- .../v5/client/socket/IOPubClient.scala | 2 +- .../toree/communication/SocketManager.scala | 2 +- .../security/SignatureCheckerActor.scala | 2 +- .../security/SignatureProducerActor.scala | 2 +- .../socket/ZeroMQSocketRunnable.scala | 4 +- .../communication/utils/OrderedSupport.scala | 2 +- .../dependencies/DependencyDownloader.scala | 8 +- .../IvyDependencyDownloader.scala | 6 +- .../toree/interpreter/Interpreter.scala | 7 +- .../interpreter/broker/BrokerProcess.scala | 2 +- .../interpreter/broker/BrokerService.scala | 2 +- .../interpreter/broker/BrokerState.scala | 4 +- .../apache/toree/kernel/api/KernelLike.scala | 2 +- .../security/KernelSecurityManager.scala | 2 +- .../toree/utils/ArgumentParsingSupport.scala | 2 +- .../apache/toree/utils/MultiClassLoader.scala | 16 +- .../broker/BrokerProcessSpec.scala | 2 +- .../main/scala/org/apache/toree/Main.scala | 2 +- .../toree/boot/CommandLineOptions.scala | 2 +- .../boot/layer/ComponentInitialization.scala | 10 +- .../toree/boot/layer/InterpreterManager.scala | 2 +- .../org/apache/toree/kernel/api/Kernel.scala | 10 +- .../protocol/v5/dispatch/StatusDispatch.scala | 2 +- .../v5/handler/CommCloseHandler.scala | 2 +- .../v5/handler/CommInfoRequestHandler.scala | 4 +- .../protocol/v5/handler/CommMsgHandler.scala | 2 +- .../protocol/v5/handler/CommOpenHandler.scala | 2 +- .../v5/handler/ExecuteRequestHandler.scala | 4 +- .../v5/handler/InputRequestReplyHandler.scala | 2 +- .../v5/interpreter/InterpreterActor.scala | 8 +- .../tasks/CodeCompleteTaskActor.scala | 4 +- .../tasks/ExecuteRequestTaskActor.scala | 16 +- .../tasks/IsCompleteTaskActor.scala | 4 +- .../kernel/protocol/v5/kernel/Utilities.scala | 20 +- .../v5/relay/ExecuteRequestRelay.scala | 4 +- .../apache/toree/magic/builtin/AddDeps.scala | 4 +- .../toree/magic/builtin/Dataframe.scala | 16 +- .../toree/boot/CommandLineOptionsSpec.scala | 2 +- macros/project/plugins.sbt | 2 +- .../org/apache/toree/plugins/Plugin.scala | 12 +- .../apache/toree/plugins/PluginManager.scala | 22 +- .../apache/toree/plugins/PluginMethod.scala | 6 +- .../apache/toree/plugins/PluginSearcher.scala | 8 +- .../dependencies/DependencyManager.scala | 2 +- project/Dependencies.scala | 4 +- project/build.properties | 2 +- project/plugins.sbt | 2 +- .../org/apache/toree/comm/CommWriter.scala | 2 +- .../kernel/protocol/v5/KernelMessage.scala | 2 +- .../toree/kernel/protocol/v5/package.scala | 2 +- .../scala/ScalaInterpreterSpecific.scala | 456 ++++++++++++++++++ .../interpreter/scala/ScalaDisplayers.scala | 2 +- .../interpreter/scala/ScalaInterpreter.scala | 35 +- .../interpreter/sql/SqlInterpreter.scala | 2 +- .../kernel/interpreter/sql/SqlService.scala | 2 +- 61 files changed, 620 insertions(+), 162 deletions(-) create mode 100644 scala-interpreter/src/main/scala-2.13/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala diff --git a/Dockerfile b/Dockerfile index 8154754e7..14c0fa762 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash - && \ # for Apache Spark demos ENV APACHE_SPARK_VERSION 3.3.2 -ENV APACHE_SPARK_CUSTOM_NAME=hadoop3 +ENV APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13 RUN apt-get -y update && \ apt-get -y install software-properties-common diff --git a/Dockerfile.toree-dev b/Dockerfile.toree-dev index fa3fc975b..59f6cabab 100644 --- a/Dockerfile.toree-dev +++ b/Dockerfile.toree-dev @@ -24,7 +24,7 @@ USER root # Spark dependencies ENV APACHE_SPARK_VERSION 3.3.2 -ENV APACHE_SPARK_CUSTOM_NAME=hadoop3 +ENV APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13 RUN apt-get -y update && \ apt-get install -y --no-install-recommends openjdk-8-jdk ca-certificates-java && \ diff --git a/Makefile b/Makefile index 2c0f39c7c..656aa6222 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ SNAPSHOT:=-SNAPSHOT endif APACHE_SPARK_VERSION?=3.3.2 -SCALA_VERSION?=2.12 +SCALA_VERSION?=2.13 IMAGE?=jupyter/all-spark-notebook:latest EXAMPLE_IMAGE?=apache/toree-examples TOREE_DEV_IMAGE?=apache/toree-dev diff --git a/build.sbt b/build.sbt index d3232e8a7..7978987c8 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,7 @@ ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") + (if ((ThisBuild / isSnapshot ).value) "-SNAPSHOT" else "") ThisBuild / isSnapshot := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean ThisBuild / organization := "org.apache.toree.kernel" -ThisBuild / crossScalaVersions := Seq("2.12.15") +ThisBuild / crossScalaVersions := Seq("2.13.10") ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions ).value.head ThisBuild / Dependencies.sparkVersion := { val envVar = "APACHE_SPARK_VERSION" diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala index ff294b132..07f713926 100644 --- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala +++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala @@ -64,7 +64,7 @@ object Utilities extends LogLike { val header = Json.parse(message.frames(delimiterIndex + 2)).as[Header] val parentHeader = Json.parse(message.frames(delimiterIndex + 3)).validate[ParentHeader].fold[ParentHeader]( // TODO: Investigate better solution than setting parentHeader to null for {} - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => null, //HeaderBuilder.empty, + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => null, //HeaderBuilder.empty, (valid: ParentHeader) => valid ) val metadata = Json.parse(message.frames(delimiterIndex + 4)).as[Metadata] @@ -78,20 +78,20 @@ object Utilities extends LogLike { } implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = { - val frames: scala.collection.mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer() - kernelMessage.ids.map((id : Array[Byte]) => frames += ByteString.apply(id) ) - frames += "" - frames += kernelMessage.signature - frames += Json.toJson(kernelMessage.header).toString() - frames += Json.toJson(kernelMessage.parentHeader).toString() - frames += Json.toJson(kernelMessage.metadata).toString - frames += kernelMessage.contentString + var frames: Seq[ByteString] = Seq() + kernelMessage.ids.map((id : Array[Byte]) => frames = frames :+ ByteString.apply(id) ) + frames = frames :+ "" + frames = frames :+ kernelMessage.signature + frames = frames :+ Json.toJson(kernelMessage.header).toString() + frames = frames :+ Json.toJson(kernelMessage.parentHeader).toString() + frames = frames :+ Json.toJson(kernelMessage.metadata).toString + frames = frames :+ kernelMessage.contentString ZMQMessage(frames : _*) } def parseAndHandle[T](json: String, reads: Reads[T], handler: T => Unit) : Unit = { Json.parse(json).validate[T](reads).fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => logger.error(s"Could not parse JSON, ${json}"), (content: T) => handler(content) ) diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala index 8cdaf7b79..48f6b4e85 100644 --- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala +++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/HeartbeatClient.scala @@ -60,7 +60,7 @@ class HeartbeatClient( case HeartbeatMessage => import scala.concurrent.ExecutionContext.Implicits.global val id = java.util.UUID.randomUUID().toString - futureMap += (id -> sender) + futureMap += (id -> sender()) logger.info(s"Heartbeat client send: $id") val future = socket ? ZMQMessage(ByteString(id.getBytes)) future.onComplete { diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala index eee8daad4..17985c57f 100644 --- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala +++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClient.scala @@ -76,7 +76,7 @@ class IOPubClient( } else { logger.warn("Received message with null parent header.") logger.debug(s"Kernel message is: $kernelMessage") - sender.forward(Failure(new RuntimeException(PARENT_HEADER_NULL_MESSAGE))) + sender().forward(Failure(new RuntimeException(PARENT_HEADER_NULL_MESSAGE))) } } diff --git a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala index 7041a58e1..637994286 100644 --- a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala +++ b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap import org.apache.toree.communication.socket._ import org.zeromq.{SocketType, ZMQ} -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ /** * Represents the factory for sockets that also manages ZMQ contexts and diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala index e6b8329ab..fba446962 100644 --- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala +++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureCheckerActor.scala @@ -35,7 +35,7 @@ class SignatureCheckerActor( val isValidSignature = hmacString == signature logger.trace(s"Signature ${signature} validity checked against " + s"hmac ${hmacString} with outcome ${isValidSignature}") - sender ! isValidSignature + sender() ! isValidSignature } } diff --git a/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala index 1e303e5e9..0161c04f5 100644 --- a/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala +++ b/communication/src/main/scala/org/apache/toree/communication/security/SignatureProducerActor.scala @@ -38,7 +38,7 @@ class SignatureProducerActor( Json.stringify(Json.toJson(message.metadata)), message.contentString ) - sender ! signature + sender() ! signature } } diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala index a515e9461..0592bfdc6 100644 --- a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala +++ b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala @@ -20,7 +20,7 @@ import org.apache.toree.utils.LogLike import org.zeromq.{SocketType, ZMsg, ZMQ} import org.zeromq.ZMQ.Context -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.Try /** @@ -170,7 +170,7 @@ class ZeroMQSocketRunnable( socket.close() } catch { case ex: Exception => - logger.error("Failed to close socket!", _: Throwable) + logger.error("Failed to close socket!", ex: Throwable) } } } diff --git a/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala index 31e6c6fda..da9704156 100644 --- a/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala +++ b/communication/src/main/scala/org/apache/toree/communication/utils/OrderedSupport.scala @@ -52,7 +52,7 @@ trait OrderedSupport extends Actor with Stash with LogLike { */ def startProcessing(): Unit = { logger.debug("Actor is in processing state and will stash messages of " + - s"types: ${orderedTypes.mkString(" ")}") + s"types: ${orderedTypes().mkString(" ")}") context.become(waiting, discardOld = false) } diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala index 36f8b50c0..666055fc8 100644 --- a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala @@ -54,14 +54,14 @@ abstract class DependencyDownloader { transitive: Boolean = true, excludeBaseDependencies: Boolean = true, ignoreResolutionErrors: Boolean = true, - extraRepositories: Seq[(URL, Option[Credentials])] = Nil, + extraRepositories: collection.Seq[(URL, Option[Credentials])] = Nil, verbose: Boolean = false, trace: Boolean = false, configuration: Option[String] = None, artifactType: Option[String] = None, artifactClassifier: Option[String] = None, - excludes: Set[(String,String)] = Set.empty - ): Seq[URI] + excludes: collection.Set[(String,String)] = collection.Set.empty + ): collection.Seq[URI] /** * Sets the printstream to log to. @@ -89,7 +89,7 @@ abstract class DependencyDownloader { * * @return The list of repositories as URIs */ - def getRepositories: Seq[URI] + def getRepositories: collection.Seq[URI] /** * Sets the directory where all downloaded jars will be stored. diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala index 47e6da9a8..fb53fdf06 100644 --- a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala @@ -89,14 +89,14 @@ class IvyDependencyDownloader( transitive: Boolean = true, excludeBaseDependencies: Boolean, ignoreResolutionErrors: Boolean, - extraRepositories: Seq[(URL, Option[Credentials])] = Nil, + extraRepositories: collection.Seq[(URL, Option[Credentials])] = Nil, verbose: Boolean, trace: Boolean, configuration: Option[String] = None, artifactType: Option[String] = None, artifactClassifier: Option[String] = None, - excludes: Set[(String,String)] = Set.empty - ): Seq[URI] = { + excludes: collection.Set[(String,String)] = collection.Set.empty + ): collection.Seq[URI] = { // Start building the ivy.xml file val ivyFile = File.createTempFile("ivy-custom", ".xml") ivyFile.deleteOnExit() diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala index 5a02f9d40..97deabfa1 100644 --- a/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala +++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/Interpreter.scala @@ -20,8 +20,7 @@ package org.apache.toree.interpreter import java.net.URL import org.apache.toree.kernel.api.KernelLike - -import scala.tools.nsc.interpreter._ +import java.io.{InputStream, OutputStream} case class LanguageInfo( name: String, @@ -90,7 +89,7 @@ trait Interpreter { * @param value The value of the variable binding * @param modifiers Any annotation, scoping modifiers, etc on the variable */ - def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]) + def bind(variableName: String, typeName: String, value: Any, modifiers: List[String]): Unit /** * Retrieves the contents of the variable with the provided name from the @@ -109,7 +108,7 @@ trait Interpreter { * @param out The new output stream * @param err The new error stream */ - def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream) + def updatePrintStreams(in: InputStream, out: OutputStream, err: OutputStream): Unit /** * Attempts to perform code completion via the command. diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala index 46af0e3f4..917d18d39 100644 --- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala +++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala @@ -23,7 +23,7 @@ import org.apache.commons.exec._ import org.apache.commons.exec.environment.EnvironmentUtils import org.apache.commons.io.{FilenameUtils, IOUtils} import org.slf4j.LoggerFactory -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ /** * Represents the process used to evaluate broker code. diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala index 0be0fc100..64206b7c0 100644 --- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala +++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerService.scala @@ -20,7 +20,7 @@ package org.apache.toree.interpreter.broker import org.apache.toree.interpreter.broker.BrokerTypes.{Code, CodeResults} import scala.concurrent.Future -import scala.tools.nsc.interpreter._ +import java.io.{InputStream, OutputStream} /** * Represents the service that provides the high-level interface between the diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala index 3d1e3abec..f79ddb373 100644 --- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala +++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala @@ -23,7 +23,7 @@ import org.apache.toree.interpreter.broker.BrokerTypes._ import org.slf4j.LoggerFactory import scala.concurrent.{Future, Promise} -import scala.tools.nsc.interpreter.OutputStream +import java.io.{InputStream, OutputStream} /** * Represents the state structure of broker. @@ -35,7 +35,7 @@ import scala.tools.nsc.interpreter.OutputStream class BrokerState(private val maxQueuedCode: Int) { private val logger = LoggerFactory.getLogger(this.getClass) - import scala.collection.JavaConverters._ + import scala.jdk.CollectionConverters._ @volatile private var _isReady: Boolean = false diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala index b2f96e9bd..127bda24b 100644 --- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala +++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelLike.scala @@ -102,7 +102,7 @@ trait KernelLike { def config: Config - def addJars(uris: URI*) + def addJars(uris: URI*): Unit def sparkContext: SparkContext diff --git a/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala index 0b5955430..54d48cfb5 100644 --- a/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala +++ b/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala @@ -70,7 +70,7 @@ object KernelSecurityManager { * the only path by which we should permit System.exit to succeed within the notebook. * Note that dual SIGINTs occur from a non-restricted thread group and are also permitted. */ - def enableRestrictedExit() { + def enableRestrictedExit(): Unit = { val currentGroup = Thread.currentThread().getThreadGroup tlEnableRestrictedExit.set(currentGroup.getName == RestrictedGroupName) } diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala index cd258f6eb..c65c5ab74 100644 --- a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala +++ b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala @@ -18,7 +18,7 @@ package org.apache.toree.utils import joptsimple.{OptionSpec, OptionParser} -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.language.implicitConversions import java.io.{PrintStream, OutputStream} diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala index 624273535..864eefbdc 100644 --- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala @@ -22,7 +22,7 @@ import java.net.{URL, URLClassLoader} import java.util import org.slf4j.LoggerFactory -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.{Failure, Success, Try} import scala.language.existentials @@ -38,11 +38,11 @@ import scala.language.existentials * implementations of this class loader */ class MultiClassLoader( - private val urls: Seq[URL], - private val classLoaders: Seq[ClassLoader] + private val urls: collection.Seq[URL], + private val classLoaders: collection.Seq[ClassLoader] ) extends URLClassLoader( classLoaders.flatMap({ - case urlClassLoader: URLClassLoader => urlClassLoader.getURLs.toSeq + case urlClassLoader: URLClassLoader => urlClassLoader.getURLs.to(collection.Seq) case _ => Nil }).distinct.toArray, /* Create a parent chain based on a each classloader's parent */ { @@ -77,20 +77,20 @@ class MultiClassLoader( } // NOTE: Using iterator to evaluate elements one at a time - classLoaders.toIterator + classLoaders.iterator .map(classLoader => tryFindClass(classLoader, name)) .find(_.isSuccess) .map(_.get) .getOrElse(throw new ClassNotFoundException(name)) } - override protected def findResource(name: String): URL = { + override def findResource(name: String): URL = { // NOTE: Using iterator to evaluate elements one at a time - classLoaders.toIterator.map(cl => _findResource(cl, name)).find(_ != null) + classLoaders.iterator.map(cl => _findResource(cl, name)).find(_ != null) .getOrElse(super.findResource(name)) } - override protected def findResources(name: String): util.Enumeration[URL] = { + override def findResources(name: String): util.Enumeration[URL] = { val internalResources = classLoaders .flatMap(cl => Try(_findResources(cl, name)).toOption) .map(_.asScala) diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala index dde4cd598..418744256 100644 --- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala +++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala @@ -205,7 +205,7 @@ class BrokerProcessSpec extends AnyFunSpec with Matchers brokerProcess.start() verify(mockExecutor).execute(any(),environmentCaptor.capture() , any()) - import scala.collection.JavaConverters._ + import scala.jdk.CollectionConverters._ val environment = environmentCaptor.getValue.asScala environment should contain theSameElementsAs TestEnvironment diff --git a/kernel/src/main/scala/org/apache/toree/Main.scala b/kernel/src/main/scala/org/apache/toree/Main.scala index 575633637..0e304a000 100644 --- a/kernel/src/main/scala/org/apache/toree/Main.scala +++ b/kernel/src/main/scala/org/apache/toree/Main.scala @@ -22,7 +22,7 @@ import org.apache.toree.boot.{CommandLineOptions, KernelBootstrap} import org.apache.toree.kernel.BuildInfo object Main extends App { - private val options = new CommandLineOptions(args) + private val options = new CommandLineOptions(args.toIndexedSeq) if (options.help) { options.printHelpOn(System.out) diff --git a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala index 59c04371b..882bf7221 100644 --- a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala +++ b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala @@ -23,7 +23,7 @@ import com.typesafe.config.{Config, ConfigFactory} import joptsimple.{OptionParser, OptionSpec} import joptsimple.util.RegexMatcher._ -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ class CommandLineOptions(args: Seq[String]) { private val parser = new OptionParser() diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala index 47d2ac0dd..241f441a0 100644 --- a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala +++ b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala @@ -33,7 +33,7 @@ import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader import org.apache.toree.magic.MagicManager import org.apache.toree.plugins.PluginManager import org.apache.toree.utils.{LogLike, FileUtils} -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import org.apache.toree.plugins.AllInterpretersReady /** @@ -217,17 +217,19 @@ trait StandardComponentInitialization extends ComponentInitialization { // Load internal plugins under kernel module logger.debug("Loading internal plugins") val internalPlugins = pluginManager.initialize() - logger.info(internalPlugins.size + " internal plugins loaded") + val internalPluginsSize = internalPlugins.size + logger.info(s"$internalPluginsSize internal plugins loaded") // Load external plugins if provided logger.debug("Loading external plugins") val externalPlugins = if (magicUrlArray.nonEmpty) { val externalPlugins = pluginManager.loadPlugins( - magicUrlArray.map(_.getFile).map(new File(_)): _* + magicUrlArray.map(_.getFile).map(new File(_)).toIndexedSeq: _* ) pluginManager.initializePlugins(externalPlugins) externalPlugins } else Nil - logger.info(externalPlugins.size + " external plugins loaded") + val externalPluginsSize = externalPlugins.size + logger.info(s"$externalPluginsSize external plugins loaded") } } diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala index b1e5fa9a1..1b5e0f3af 100644 --- a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala +++ b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala @@ -20,7 +20,7 @@ package org.apache.toree.boot.layer import org.apache.toree.kernel.api.KernelLike import com.typesafe.config.Config import org.apache.toree.interpreter._ -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import org.slf4j.LoggerFactory diff --git a/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala index cb90b81e4..3b410b6a7 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/api/Kernel.scala @@ -138,9 +138,9 @@ class Kernel ( val (success, result) = output success match { case Results.Success => - (true, result.left.get) + (true, result.swap.toOption.get) case Results.Error => - (false, Map("text/plain" -> result.right.getOrElse("").toString)) + (false, Map("text/plain" -> result.getOrElse("").toString)) case Results.Aborted => (false, Map("text/plain" -> "Aborted!")) case Results.Incomplete => @@ -413,7 +413,7 @@ class Kernel ( if(config.getString("spark_context_initialization_mode") == "eager") { // explicitly enable eager initialization of spark context - SparkSession.builder.config(defaultSparkConf).getOrCreate + SparkSession.builder().config(defaultSparkConf).getOrCreate() } else { // default lazy initialization of spark context defaultSparkConf.getOption("spark.master") match { @@ -425,7 +425,7 @@ class Kernel ( // default timeout is 100ms and it is specified in reference.conf. import scala.concurrent.ExecutionContext.Implicits.global val sessionFuture = Future { - SparkSession.builder.config(defaultSparkConf).getOrCreate + SparkSession.builder().config(defaultSparkConf).getOrCreate() } try { @@ -441,7 +441,7 @@ class Kernel ( } case _ => - SparkSession.builder.config(defaultSparkConf).getOrCreate + SparkSession.builder().config(defaultSparkConf).getOrCreate() } } } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala index 7a793e78c..2e59517dc 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/dispatch/StatusDispatch.scala @@ -26,7 +26,7 @@ import org.apache.toree.utils.LogLike import play.api.libs.json.Json class StatusDispatch(actorLoader: ActorLoader) extends Actor with LogLike { - private def sendStatusMessage(kernelStatus: KernelStatusType, parentHeader: Header) { + private def sendStatusMessage(kernelStatus: KernelStatusType, parentHeader: Header): Unit = { // Create the status message and send it to the relay val km : KernelMessage = KMBuilder() .withIds(Seq(MessageType.Outgoing.Status.toString.getBytes)) diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala index 7f27177c3..7f6d4b2f0 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala @@ -78,7 +78,7 @@ class CommCloseHandler( } } - private def handleParseError(invalid: Seq[(JsPath, Seq[JsonValidationError])]) = { + private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) = { // TODO: Determine proper response for a parse failure logger.warn("Parse error for Comm Close! Not responding!") } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala index eeda71833..4c049cd6a 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala @@ -53,14 +53,14 @@ class CommInfoRequestHandler( override def process(kernelMessage: KernelMessage): Future[_] = Future { logKernelMessageAction("Initiating CommInfo request for", kernelMessage) - + import scala.language.existentials val commMap = (Json.parse(kernelMessage.contentString) \ "target_name").asOpt[String] match { case Some(targetName) => { buildCommMap(targetName) } case None => { //target_name is missing from the kernel message so return all comms over every target - commStorage.getTargets().map(buildCommMap(_)).reduce(_ ++ _) + commStorage.getTargets().map(buildCommMap(_)) } } val commInfoReply = CommInfoReplyOk(commMap.asInstanceOf[Map[String, Map[String, String]]]) diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala index 37e958961..be3d37bfe 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala @@ -78,7 +78,7 @@ class CommMsgHandler( } } - private def handleParseError(invalid: Seq[(JsPath, Seq[JsonValidationError])]) = { + private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) = { // TODO: Determine proper response for a parse failure logger.warn("Parse error for Comm Msg! Not responding!") } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala index 6590eefaf..60d02889b 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala @@ -82,7 +82,7 @@ class CommOpenHandler( } } - private def handleParseError(invalid: Seq[(JsPath, Seq[JsonValidationError])]) = { + private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) = { // TODO: Determine proper response for a parse failure logger.warn("Parse error for Comm Open! Not responding!") } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala index 4f2fd5e7b..82465b1d5 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/ExecuteRequestHandler.scala @@ -131,7 +131,7 @@ class ExecuteRequestHandler( } } - def parseErrorHandler(invalid: Seq[(JsPath, Seq[JsonValidationError])]) = { + def parseErrorHandler(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) = { val errs = invalid.map (e => s"JSPath ${e._1} has error ${e._2}").toList logger.error(s"Validation errors when parsing ExecuteRequest: ${errs}") val replyError: ExecuteReply = ExecuteReplyError( @@ -161,7 +161,7 @@ class ExecuteRequestHandler( */ def relayErrorMessages(relayActor: ActorSelection, replyError: ExecuteReply, - skeletonBuilder: KMBuilder) { + skeletonBuilder: KMBuilder): Unit = { val executeReplyMsg = skeletonBuilder .withHeader(MessageType.Outgoing.ExecuteReply) .withMetadata(Metadata("status" -> replyError.status)) diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala index 94595d1c0..33e290f43 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/InputRequestReplyHandler.scala @@ -53,7 +53,7 @@ class InputRequestReplyHandler( // Is this an outgoing message to request data? if (kernelMessageType == inputRequestType) { val session = kernelMessage.parentHeader.session - responseMap(session) = sender + responseMap(session) = sender() logger.debug("Associating input request with session " + session) diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala index c95e10595..dd8eef30e 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/InterpreterActor.scala @@ -63,7 +63,7 @@ class InterpreterActor( /** * Initializes all child actors performing tasks for the interpreter. */ - override def preStart = { + override def preStart() = { executeRequestTask = interpreterTaskFactory.ExecuteRequestTask( context, InterpreterChildActorType.ExecuteRequestTask.toString) completeCodeTask = interpreterTaskFactory.CodeCompleteTask( @@ -85,7 +85,7 @@ class InterpreterActor( ex.getLocalizedMessage, ex.getStackTrace.map(_.toString).toList) ) - } pipeTo sender + } pipeTo sender() case (completeRequest: CompleteRequest) => logger.debug(s"InterpreterActor requesting code completion for code " + s"${completeRequest.code}") @@ -98,7 +98,7 @@ class InterpreterActor( ex.getLocalizedMessage, ex.getStackTrace.map(_.toString).toList) ) - } pipeTo sender + } pipeTo sender() case (isCompleteRequest: IsCompleteRequest) => logger.debug(s"InterpreterActor requesting is complete code ${isCompleteRequest.code}") (isCompleteTask ? isCompleteRequest) recover { @@ -106,6 +106,6 @@ class InterpreterActor( logger.warn(s"Could not determine completeness for code ${isCompleteRequest.code}: " + s"${ex.getMessage}") Left(IsCompleteReply("unknown", "")) - } pipeTo sender + } pipeTo sender() } } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala index dfe26c32e..7cc3a9429 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/CodeCompleteTaskActor.scala @@ -34,8 +34,8 @@ class CodeCompleteTaskActor(interpreter: Interpreter) override def receive: Receive = { case completeRequest: CompleteRequest => logger.debug("Invoking the interpreter completion") - sender ! interpreter.completion(completeRequest.code, completeRequest.cursor_pos) + sender() ! interpreter.completion(completeRequest.code, completeRequest.cursor_pos) case _ => - sender ! "Unknown message" // TODO: Provide a failure message type to be passed around? + sender() ! "Unknown message" // TODO: Provide a failure message type to be passed around? } } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala index 0905871fa..d32220c71 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/ExecuteRequestTaskActor.scala @@ -82,25 +82,25 @@ class ExecuteRequestTaskActor(interpreter: Interpreter) extends Actor with LogLi logger.debug(s"Interpreter execution result was ${success}") success match { case Results.Success => - val output = result.left.get - sender ! Left(output) + val output = result.swap.toOption.get + sender() ! Left(output) case Results.Error => - val error = result.right.get - sender ! Right(error) + val error = result.toOption.get + sender() ! Right(error) case Results.Aborted => - sender ! Right(new ExecuteAborted) + sender() ! Right(new ExecuteAborted) case Results.Incomplete => // If we get an incomplete it's most likely a syntax error, so // let the user know. - sender ! Right(new ExecuteError("Syntax Error.", "", List())) + sender() ! Right(new ExecuteError("Syntax Error.", "", List())) } } else { // If we get empty code from a cell then just return ExecuteReplyOk - sender ! Left("") + sender() ! Left("") } case unknownValue => logger.warn(s"Received unknown message type ${unknownValue}") - sender ! "Unknown message" // TODO: Provide a failure message type to be passed around? + sender() ! "Unknown message" // TODO: Provide a failure message type to be passed around? } private def buildOutputStream( diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/IsCompleteTaskActor.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/IsCompleteTaskActor.scala index 3bfef8e20..78a668061 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/IsCompleteTaskActor.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/interpreter/tasks/IsCompleteTaskActor.scala @@ -34,8 +34,8 @@ class IsCompleteTaskActor(interpreter: Interpreter) override def receive: Receive = { case req: IsCompleteRequest => logger.debug("Invoking the interpreter completion") - sender ! interpreter.isComplete(req.code) + sender() ! interpreter.isComplete(req.code) case _ => - sender ! "Unknown message" // TODO: Provide a failure message type to be passed around? + sender() ! "Unknown message" // TODO: Provide a failure message type to be passed around? } } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala index 6dd1224e9..b1f785954 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala @@ -77,21 +77,21 @@ object Utilities extends LogLike { } implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = { - val frames: scala.collection.mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer() - kernelMessage.ids.map((id : Array[Byte]) => frames += ByteString.apply(id) ) - frames += "" - frames += kernelMessage.signature - frames += Json.toJson(kernelMessage.header).toString() - frames += Json.toJson(kernelMessage.parentHeader).toString() - frames += Json.toJson(kernelMessage.metadata).toString - frames += kernelMessage.contentString + var frames: Seq[ByteString] = Seq() + kernelMessage.ids.map((id : Array[Byte]) => frames = frames :+ ByteString.apply(id) ) + frames = frames :+ "" + frames = frames :+ kernelMessage.signature + frames = frames :+ Json.toJson(kernelMessage.header).toString() + frames = frames :+ Json.toJson(kernelMessage.parentHeader).toString() + frames = frames :+ Json.toJson(kernelMessage.metadata).toString + frames = frames :+ kernelMessage.contentString ZMQMessage(frames : _*) } def parseAndHandle[T, U](json: String, reads: Reads[T], handler: T => U) : U = { parseAndHandle(json, reads, handler, - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => { + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => { logger.error(s"Could not parse JSON, ${json}") throw new Throwable(s"Could not parse JSON, ${json}") } @@ -100,7 +100,7 @@ object Utilities extends LogLike { def parseAndHandle[T, U](json: String, reads: Reads[T], handler: T => U, - errHandler: Seq[(JsPath, Seq[JsonValidationError])] => U) : U = { + errHandler: collection.Seq[(JsPath, collection.Seq[JsonValidationError])] => U) : U = { Json.parse(json).validate[T](reads).fold( errHandler, (content: T) => handler(content) diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala index 4284a0a1c..d00923c1c 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/relay/ExecuteRequestRelay.scala @@ -75,13 +75,13 @@ case class ExecuteRequestRelay( future: Future[Either[ExecuteOutput, ExecuteFailure]] ): Future[(ExecuteReply, ExecuteResult)] = future.map { value => if (value.isLeft) { - val data = value.left.get + val data = value.swap.toOption.get ( ExecuteReplyOk(1, Some(Payloads()), Some(UserExpressions())), ExecuteResult(1, data, Metadata()) ) } else { - failureMatch(value.right.get) + failureMatch(value.toOption.get) } } diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala index 913d64e2c..eb0112760 100644 --- a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala +++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala @@ -91,7 +91,7 @@ class AddDeps extends LineMagic with IncludeInterpreter } else { (x, "*") } - }: (String, String)).toSet + }: (String, String)).to(collection.Set) val repositoriesWithCreds = dependencyDownloader.resolveRepositoriesAndCredentials(repository, credentials) @@ -112,7 +112,7 @@ class AddDeps extends LineMagic with IncludeInterpreter ) // pass the new Jars to the kernel - kernel.addJars(uris.filter(_.getPath.endsWith(".jar")): _*) + kernel.addJars(uris.filter(_.getPath.endsWith(".jar")).toSeq: _*) } else { printHelp(printStream, """%AddDeps my.company artifact-id version""") } diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/Dataframe.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/Dataframe.scala index 3f00f820a..bf51390ba 100644 --- a/kernel/src/main/scala/org/apache/toree/magic/builtin/Dataframe.scala +++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/Dataframe.scala @@ -84,7 +84,7 @@ class DataFrame extends CellMagic with IncludeKernelInterpreter } private def outputTypeToMimeType(): String = { - outputTypeMap.getOrElse(outputType, MIMEType.PlainText) + outputTypeMap.getOrElse(outputType(), MIMEType.PlainText) } private def convertToJson(rddCode: String): CellMagicOutput = { @@ -95,20 +95,20 @@ class DataFrame extends CellMagic with IncludeKernelInterpreter kernelInterpreter.read(rddVarName).map(variableVal => { _dataFrameConverter.convert( variableVal.asInstanceOf[org.apache.spark.sql.DataFrame], - outputType, - limit + outputType(), + limit() ).map(output => - CellMagicOutput(outputTypeToMimeType -> output) + CellMagicOutput(outputTypeToMimeType() -> output) ).get }).getOrElse(CellMagicOutput(MIMEType.PlainText -> DataFrameResponses.NoVariableFound(rddVarName))) case Results.Aborted => - logger.error(DataFrameResponses.ErrorMessage(outputType, DataFrameResponses.MagicAborted)) + logger.error(DataFrameResponses.ErrorMessage(outputType(), DataFrameResponses.MagicAborted)) CellMagicOutput( - MIMEType.PlainText -> DataFrameResponses.ErrorMessage(outputType, DataFrameResponses.MagicAborted) + MIMEType.PlainText -> DataFrameResponses.ErrorMessage(outputType(), DataFrameResponses.MagicAborted) ) case Results.Error => - val error = message.right.get.asInstanceOf[ExecuteError] - val errorMessage = DataFrameResponses.ErrorMessage(outputType, error.value) + val error = message.toOption.get.asInstanceOf[ExecuteError] + val errorMessage = DataFrameResponses.ErrorMessage(outputType(), error.value) logger.error(errorMessage) CellMagicOutput(MIMEType.PlainText -> errorMessage) case Results.Incomplete => diff --git a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala index fbacfbaeb..4d85e15a2 100644 --- a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala +++ b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala @@ -24,7 +24,7 @@ import joptsimple.OptionException import org.scalatest.funspec.AnyFunSpec import org.scalatest.matchers.should.Matchers -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ class CommandLineOptionsSpec extends AnyFunSpec with Matchers { diff --git a/macros/project/plugins.sbt b/macros/project/plugins.sbt index 982bb4ede..69d839d1c 100644 --- a/macros/project/plugins.sbt +++ b/macros/project/plugins.sbt @@ -16,4 +16,4 @@ */ resolvers += Resolver.sonatypeRepo("releases") -addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full) +addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full) diff --git a/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala b/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala index 42f0eb82c..f933c13b2 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala @@ -70,31 +70,31 @@ trait Plugin { _internalPluginManager /** Represents all @init methods in the plugin. */ - @Internal private[plugins] final lazy val initMethods: Seq[PluginMethod] = { + @Internal private[plugins] final lazy val initMethods: collection.Seq[PluginMethod] = { allMethods.filter(_.isInit) } /** Represents all @destroy methods in the plugin. */ - @Internal private[plugins] final lazy val destroyMethods: Seq[PluginMethod] = { + @Internal private[plugins] final lazy val destroyMethods: collection.Seq[PluginMethod] = { allMethods.filter(_.isDestroy) } /** Represents all @event methods in the plugin. */ - @Internal private[plugins] final lazy val eventMethods: Seq[PluginMethod] = { + @Internal private[plugins] final lazy val eventMethods: collection.Seq[PluginMethod] = { allMethods.filter(_.isEvent) } /** Represents all @events methods in the plugin. */ - @Internal private[plugins] final lazy val eventsMethods: Seq[PluginMethod] = { + @Internal private[plugins] final lazy val eventsMethods: collection.Seq[PluginMethod] = { allMethods.filter(_.isEvents) } /** Represents all public/protected methods contained by this plugin. */ - private final lazy val allMethods: Seq[PluginMethod] = + private final lazy val allMethods: collection.Seq[PluginMethod] = getClass.getMethods.map(PluginMethod.apply(this, _: Method)) /** Represents mapping of event names to associated plugin methods. */ - @Internal private[plugins] final lazy val eventMethodMap: Map[String, Seq[PluginMethod]] = { + @Internal private[plugins] final lazy val eventMethodMap: Map[String, collection.Seq[PluginMethod]] = { val allEventMethods = (eventMethods ++ eventsMethods).distinct val allEventNames = allEventMethods.flatMap(_.eventNames).distinct allEventNames.map(name => diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala index 25deefed0..05a474722 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap import org.apache.toree.plugins.dependencies._ import org.slf4j.LoggerFactory -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.{Failure, Success, Try} /** @@ -76,7 +76,7 @@ class PluginManager( * * @return The collection of loaded plugins */ - def initialize(): Seq[Plugin] = { + def initialize(): collection.Seq[Plugin] = { val newPlugins = internalPlugins.flatMap(t => loadPlugin(t._1, t._2).toOption ).toSeq @@ -96,7 +96,7 @@ class PluginManager( // Search for plugins in our new paths, then add loaded plugins to list // NOTE: Iterator returned from plugin searcher, so avoid building a // large collection by performing all tasks together - @volatile var newPlugins = collection.mutable.Seq[Plugin]() + @volatile var newPlugins = collection.Seq[Plugin]() pluginSearcher.search(paths: _*).foreach(ci => { // Add valid path to class loader pluginClassLoader.addURL(ci.location.toURI.toURL) @@ -110,7 +110,7 @@ class PluginManager( // Load the plugin using the given name and class loadPlugin(ci.name, klass).foreach(newPlugins :+= _) }) - newPlugins + newPlugins.toSeq } /** @@ -162,7 +162,7 @@ class PluginManager( def initializePlugins( plugins: Seq[Plugin], scopedDependencyManager: DependencyManager = DependencyManager.Empty - ): Seq[PluginMethodResult] = { + ): collection.Seq[PluginMethodResult] = { val pluginMethods = plugins.flatMap(_.initMethods) val results = invokePluginMethods( pluginMethods, @@ -199,7 +199,7 @@ class PluginManager( plugins: Seq[Plugin], scopedDependencyManager: DependencyManager = DependencyManager.Empty, destroyOnFailure: Boolean = true - ): Seq[PluginMethodResult] = { + ): collection.Seq[PluginMethodResult] = { val pluginMethods = plugins.flatMap(_.destroyMethods) val results = invokePluginMethods( pluginMethods, @@ -278,7 +278,7 @@ class PluginManager( def fireEvent( eventName: String, scopedDependencies: Dependency[_ <: AnyRef]* - ): Seq[PluginMethodResult] = { + ): collection.Seq[PluginMethodResult] = { val dependencyManager = new DependencyManager scopedDependencies.foreach(d => dependencyManager.add(d)) fireEvent(eventName, dependencyManager) @@ -295,7 +295,7 @@ class PluginManager( def fireEvent( eventName: String, scopedDependencyManager: DependencyManager = DependencyManager.Empty - ): Seq[PluginMethodResult] = { + ): collection.Seq[PluginMethodResult] = { val methods = plugins.flatMap(_.eventMethodMap.getOrElse(eventName, Nil)) invokePluginMethods(methods.toSeq, scopedDependencyManager) @@ -313,9 +313,9 @@ class PluginManager( * @return The collection of results in order of priority */ private def invokePluginMethods( - pluginMethods: Seq[PluginMethod], + pluginMethods: collection.Seq[PluginMethod], scopedDependencyManager: DependencyManager - ): Seq[PluginMethodResult] = { + ): collection.Seq[PluginMethodResult] = { // Continue trying to invoke plugins until we finish them all or // we reach a state where no plugin can be completed val completedMethods = Array.ofDim[PluginMethodResult](pluginMethods.size) @@ -360,7 +360,7 @@ class PluginManager( * @param pluginMethods The collection of plugin methods to sort * @return The sorted plugin methods */ - private def prioritizePluginMethods(pluginMethods: Seq[PluginMethod]) = + private def prioritizePluginMethods(pluginMethods: collection.Seq[PluginMethod]) = pluginMethods .groupBy(_.priority) .flatMap(_._2.sortWith(_.plugin.priority > _.plugin.priority)) diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala index 50aafe34b..9f07eaddd 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala @@ -34,7 +34,7 @@ case class PluginMethod( method: Method ) { /** Represents the collection of names of events this method supports. */ - lazy val eventNames: Seq[String] = { + lazy val eventNames: collection.Seq[String] = { Option(method.getAnnotation(classOf[Event])) .map(_.name()).map(Seq(_)).getOrElse(Nil) ++ Option(method.getAnnotation(classOf[Events])) @@ -110,11 +110,11 @@ case class PluginMethod( } } // Validate arguments - val arguments: Seq[AnyRef] = dependencies.map(_.value.asInstanceOf[AnyRef]) + val arguments: Seq[Object] = dependencies.map(_.value.asInstanceOf[Object]).toSeq // Invoke plugin method method.invoke(plugin, arguments: _*) - }).map(SuccessPluginMethodResult.apply(this, _: AnyRef)).recover { + }).map(SuccessPluginMethodResult.apply(this, _: Object)).recover { case i: InvocationTargetException => FailurePluginMethodResult(this, i.getTargetException) case throwable: Throwable => diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala index b63545d24..9ed47058c 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala @@ -75,8 +75,8 @@ class PluginSearcher { s"Failed to load class info from classpath: ${classFinder.classpath.mkString(",")}", _: Throwable )) - val stream = tryStream.getOrElse(Stream.empty) - ClassFinder.classInfoMap(stream.toIterator) + val stream = tryStream.getOrElse(LazyList.empty) + ClassFinder.classInfoMap(stream.iterator) } /** @@ -105,7 +105,7 @@ class PluginSearcher { extraClasses: Map[String, ClassInfo] ): Iterator[ClassInfo] = { @tailrec def classMatches( - classesToCheck: Seq[ClassInfo] + classesToCheck: collection.Seq[ClassInfo] ): Boolean = { if (classesToCheck.isEmpty) false else if (classesToCheck.exists(_.name == ancestor)) true @@ -120,7 +120,7 @@ class PluginSearcher { } } - classes.values.toIterator + classes.values.iterator .filter(_.isConcrete) .filter(c => classMatches(Seq(c))) } diff --git a/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala b/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala index 6348cd22e..09278e0e7 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala @@ -17,7 +17,7 @@ package org.apache.toree.plugins.dependencies import java.util.concurrent.ConcurrentHashMap -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.reflect.runtime.universe.{Type, TypeTag} import scala.util.Try diff --git a/project/Dependencies.scala b/project/Dependencies.scala index e873a48e0..55d63ed76 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -43,7 +43,7 @@ object Dependencies { val jeroMq = "org.zeromq" % "jeromq" % "0.5.3" // MPL v2 - val joptSimple = "net.sf.jopt-simple" % "jopt-simple" % "4.9" // MIT + val joptSimple = "net.sf.jopt-simple" % "jopt-simple" % "5.0.4" // MIT val playJson = "com.typesafe.play" %% "play-json" % "2.7.4" // Apache v2 @@ -65,7 +65,7 @@ object Dependencies { val sparkSql = Def.setting{ "org.apache.spark" %% "spark-sql" % sparkVersion.value } // Apache v2 val sparkStreaming = Def.setting{ "org.apache.spark" %% "spark-streaming" % sparkVersion.value } // Apache v2 - val springCore = "org.springframework" % "spring-core" % "5.2.2.RELEASE"// Apache v2 + val springCore = "org.springframework" % "spring-core" % "5.2.22.RELEASE"// Apache v2 // TOREE-552 Align Guava with Spark val guava = "com.google.guava" % "guava" % "14.0.1" // Apache v2 diff --git a/project/build.properties b/project/build.properties index f7cc74b56..8d0f8d84b 100644 --- a/project/build.properties +++ b/project/build.properties @@ -15,4 +15,4 @@ # limitations under the License # -sbt.version=1.5.5 +sbt.version=1.8.2 diff --git a/project/plugins.sbt b/project/plugins.sbt index eb746b2ac..aa7714a8f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -30,4 +30,4 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") // Provides the ability to generate dependency graphs -addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1") +addDependencyTreePlugin diff --git a/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala index 8a668a869..ef146a1be 100644 --- a/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala +++ b/protocol/src/main/scala/org/apache/toree/comm/CommWriter.scala @@ -108,5 +108,5 @@ abstract class CommWriter( */ protected[comm] def sendCommKernelMessage[ T <: KernelMessageContent with CommContent - ](commContent: T) + ](commContent: T): Unit } diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala index 8eeb5368f..feb8a4497 100644 --- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala +++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala @@ -32,7 +32,7 @@ case class KernelMessage( var i = ids.length while ( equal && ( 0 < i ) ) { i = i - 1 - equal = (ids(i).deep == km.ids(i).deep ) + equal = (java.util.Objects.deepEquals(ids(i), km.ids(i))) } equal = true equal diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala index 466a3ec9a..71864d528 100644 --- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala +++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala @@ -36,7 +36,7 @@ package object v5 { Map.empty } else { // triple quotes due https://github.com/scala/bug/issues/6476 - kv.toMap.mapValues(v => Json.parse(s""""$v"""")) + kv.toMap.view.mapValues(v => Json.parse(s""""$v"""")).toMap } } diff --git a/scala-interpreter/src/main/scala-2.13/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala b/scala-interpreter/src/main/scala-2.13/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala new file mode 100644 index 000000000..177eb54db --- /dev/null +++ b/scala-interpreter/src/main/scala-2.13/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala @@ -0,0 +1,456 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package org.apache.toree.kernel.interpreter.scala + +import java.io._ +import java.net.URL + +import org.apache.toree.global.StreamState +import org.apache.toree.interpreter.imports.printers.{WrapperConsole, WrapperSystem} +import org.apache.toree.interpreter.{ExecuteError, Interpreter} +import scala.tools.nsc.interpreter._ +import scala.tools.nsc.interpreter.shell._ +import scala.language.postfixOps +import scala.concurrent.Future +import scala.tools.nsc.{Global, Settings, util} +import scala.util.Try + +trait ScalaInterpreterSpecific extends SettingsProducerLike { this: ScalaInterpreter => + private val ExecutionExceptionName = "lastException" + + private[toree] var iMain: IMain = _ + private var completer: Completion = _ + private val exceptionHack = new ExceptionHack() + + def _runtimeClassloader = { + _thisClassloader + } + + protected def newIMain(settings: Settings, out: PrintWriter): IMain = { + val s = new IMain(settings, new ReplReporterImpl(settings, out)) + s.initializeCompiler() + s + } + + protected def convertAnnotationsToModifiers( + annotationInfos: List[Global#AnnotationInfo] + ) = annotationInfos map { + case a if a.toString == "transient" => "@transient" + case a => + logger.debug(s"Ignoring unknown annotation: $a") + "" + } filterNot { + _.isEmpty + } + + protected def convertScopeToModifiers(scopeSymbol: Global#Symbol) = { + (if (scopeSymbol.isImplicit) "implicit" else "") :: + Nil + } + + protected def buildModifierList(termNameString: String) = { + import scala.language.existentials + val termSymbol = iMain.symbolOfTerm(termNameString) + + + convertAnnotationsToModifiers( + if (termSymbol.hasAccessorFlag) termSymbol.accessed.annotations + else termSymbol.annotations + ) ++ convertScopeToModifiers(termSymbol) + } + + + protected def refreshDefinitions(): Unit = { + iMain.definedTerms.foreach(termName => { + val termNameString = termName.toString + val termTypeString = iMain.typeOfTerm(termNameString).toLongString + iMain.valueOfTerm(termNameString) match { + case Some(termValue) => + val modifiers = buildModifierList(termNameString) + logger.debug(s"Rebinding of $termNameString as " + + s"${modifiers.mkString(" ")} $termTypeString") + Try(iMain.beQuietDuring { + iMain.bind( + termNameString, termTypeString, termValue, modifiers + ) + }) + case None => + logger.debug(s"Ignoring rebinding of $termNameString") + } + }) + } + + protected def reinitializeSymbols(): Unit = { + val global = iMain.global + import global._ + new Run // Initializes something needed for Scala classes + } + + /** + * Adds jars to the runtime and compile time classpaths. Does not work with + * directories or expanding star in a path. + * @param jars The list of jar locations + */ + override def addJars(jars: URL*): Unit = { + iMain.addUrlsToClassPath(jars:_*) + // the Scala interpreter will invalidate definitions for any package defined in + // the new Jars. This can easily include org.* and make the kernel inaccessible + // because it is bound using the previous package definition. To avoid problems, + // it is necessary to refresh variable definitions to use the new packages and + // to rebind the global definitions. + refreshDefinitions() + bindVariables() + } + + /** + * Binds a variable in the interpreter to a value. + * @param variableName The name to expose the value in the interpreter + * @param typeName The type of the variable, must be the fully qualified class name + * @param value The value of the variable binding + * @param modifiers Any annotation, scoping modifiers, etc on the variable + */ + override def bind( + variableName: String, + typeName: String, + value: Any, + modifiers: List[String] + ): Unit = { + logger.warn(s"Binding $modifiers $variableName $typeName $value") + require(iMain != null) + val sIMain = iMain + + val bindRep = new sIMain.ReadEvalPrint() + iMain.interpret(s"import $typeName") + bindRep.compile(""" + |object %s { + | var value: %s = _ + | def set(x: Any) = value = x.asInstanceOf[%s] + |} + """.stripMargin.format(bindRep.evalName, typeName, typeName) + ) + bindRep.callEither("set", value) match { + case Left(ex) => + logger.error("Set failed in bind(%s, %s, %s)".format(variableName, typeName, value)) + logger.error(util.stackTraceString(ex)) + Results.Error + + case Right(_) => + val line = "%sval %s = %s.value".format(modifiers map (_ + " ") mkString, variableName, bindRep.evalPath) + logger.debug("Interpreting: " + line) + iMain.interpret(line) + } + + } + + + /** + * Executes body and will not print anything to the console during the execution + * @param body The function to execute + * @tparam T The return type of body + * @return The return value of body + */ + override def doQuietly[T](body: => T): T = { + require(iMain != null) + iMain.withoutWarnings[T](body) + } + + + /** + * Stops the interpreter, removing any previous internal state. + * @return A reference to the interpreter + */ + override def stop(): Interpreter = { + logger.info("Shutting down interpreter") + + // Shut down the task manager (kills current execution + if (taskManager != null) taskManager.stop() + taskManager = null + + // Erase our completer + completer = null + + // Close the entire interpreter (loses all state) + if (iMain != null) iMain.close() + iMain = null + + this + } + + /** + * Returns the name of the variable created from the last execution. + * @return Some String name if a variable was created, otherwise None + */ + override def lastExecutionVariableName: Option[String] = { + require(iMain != null) + + // TODO: Get this API method changed back to public in Apache Spark + val lastRequestMethod = classOf[IMain].getDeclaredMethod("lastRequest") + lastRequestMethod.setAccessible(true) + + val mostRecentVariableName = iMain.mostRecentVar + + iMain.allDefinedNames.map(_.toString).find(_ == mostRecentVariableName) + } + + /** + * Mask the Console and System objects with our wrapper implementations + * and dump the Console methods into the public namespace (similar to + * the Predef approach). + * @param in The new input stream + * @param out The new output stream + * @param err The new error stream + */ + override def updatePrintStreams( + in: InputStream, + out: OutputStream, + err: OutputStream + ): Unit = { + val inReader = new BufferedReader(new InputStreamReader(in)) + val outPrinter = new PrintStream(out) + val errPrinter = new PrintStream(err) + + iMain.beQuietDuring { + iMain.bind( + "Console", classOf[WrapperConsole].getName, + new WrapperConsole(inReader, outPrinter, errPrinter), + List("""@transient""") + ) + iMain.bind( + "System", classOf[WrapperSystem].getName, + new WrapperSystem(in, out, err), + List("""@transient""") + ) + iMain.interpret("import Console._") + } + } + + /** + * Retrieves the contents of the variable with the provided name from the + * interpreter. + * @param variableName The name of the variable whose contents to read + * @return An option containing the variable contents or None if the + * variable does not exist + */ + override def read(variableName: String): Option[Any] = { + require(iMain != null) + + try { + iMain.valueOfTerm(variableName) + } catch { + // if any error returns None + case e: Throwable => { + logger.debug(s"Error reading variable name: ${variableName}", e) + clearLastException() + None + } + } + } + + /** + * Starts the interpreter, initializing any internal state. + * @return A reference to the interpreter + */ + override def start(): Interpreter = { + require(iMain == null && taskManager == null) + + taskManager = newTaskManager() + + logger.debug("Initializing task manager") + taskManager.start() + + iMain = newIMain(settings, new PrintWriter(lastResultOut, true)) + + //logger.debug("Initializing interpreter") + //iMain.initializeSynchronous() + + logger.debug("Initializing completer") + completer = new ReplCompletion(iMain) + + iMain.beQuietDuring { + //logger.info("Rerouting Console and System related input and output") + //updatePrintStreams(System.in, multiOutputStream, multiOutputStream) + + // ADD IMPORTS generates too many classes, client is responsible for adding import + logger.debug("Adding org.apache.spark.SparkContext._ to imports") + iMain.interpret("import org.apache.spark.SparkContext._") + + logger.debug("Adding the hack for the exception handling retrieval.") + iMain.bind("_exceptionHack", classOf[ExceptionHack].getName, exceptionHack, List("@transient")) + } + + this + } + + /** + * Attempts to perform code completion via the command. + * @param code The current cell to complete + * @param pos The cursor position + * @return The cursor position and list of possible completions + */ + override def completion(code: String, pos: Int): (Int, List[String]) = { + + require(completer != null) + + logger.debug(s"Attempting code completion for ${code}") + val result = completer.complete(code, pos) + + (result.cursor, result.candidates.map(_.toString)) + } + + /** + * Attempts to perform completeness checking for a statement by seeing if we can parse it + * using the scala parser. + * + * @param code The current cell to complete + * @return tuple of (completeStatus, indent) + */ + override def isComplete(code: String): (String, String) = { + import scala.language.existentials + val result = iMain.withoutWarnings { + val parse = iMain.parse(code) + parse match { + case Left(Results.Error) => ("invalid", "") + case Right(_) => ("invalid", "") + case Left(Results.Success) => + val lines = code.split("\n", -1) + val numLines = lines.length + // for multiline code blocks, require an empty line before executing + // to mimic the behavior of ipython + if (numLines > 1 && lines.last.matches("\\s*\\S.*")) { + ("incomplete", startingWhiteSpace(lines.last)) + } else { + ("complete", "") + } + case Left(Results.Incomplete) => + val lines = code.split("\n", -1) + // For now lets just grab the indent of the current line, if none default to 2 spaces. + ("incomplete", startingWhiteSpace(lines.last)) + } + } + lastResultOut.reset() + result + } + + private def startingWhiteSpace(line: String): String = { + val indent = "^\\s+".r.findFirstIn(line).getOrElse("") + // increase the indent if the line ends with => or { + if (line.matches(".*(?:(?:\\{)|(?:=>))\\s*")) { + indent + " " + } else { + indent + } + } + + override def newSettings(args: List[String]): Settings = { + val s = new Settings() + + val dir = ScalaInterpreter.ensureTemporaryFolder() + + s.processArguments(args ++ + List( + "-Yrepl-class-based", + "-Yrepl-outdir", s"$dir" + // useful for debugging compiler classpath or package issues + // "-uniqid", "-explaintypes", "-usejavacp", "-Ylog-classpath" + ), processAll = true) + s + } + + protected def interpretAddTask(code: String, silent: Boolean): Future[Results.Result] = { + if (iMain == null) throw new IllegalArgumentException("Interpreter not started yet!") + + taskManager.add { + // Add a task using the given state of our streams + StreamState.withStreams { + if (silent) { + iMain.withoutWarnings { + iMain.interpret(code) + } + } else { + iMain.interpret(code) + } + } + } + } + + private def retrieveLastException: Throwable = { + iMain.withoutWarnings { + iMain.interpret("_exceptionHack.lastException = lastException") + } + exceptionHack.lastException + } + + private def clearLastException(): Unit = { + iMain.directBind( + ExecutionExceptionName, + classOf[Throwable].getName, + null + ) + exceptionHack.lastException = null + } + + protected def interpretConstructExecuteError(output: String) = { + Option(retrieveLastException) match { + // Runtime error + case Some(e) => + val ex = e.asInstanceOf[Throwable] + clearLastException() + + // The scala REPL does a pretty good job of returning us a stack trace that is free from all the bits that the + // interpreter uses before it. + // + // The REPL emits its message as something like this, so trim off the first and last element + // + // java.lang.ArithmeticException: / by zero + // at failure(:17) + // at call_failure(:19) + // ... 40 elided + + val formattedException = output.split("\n") + + ExecuteError( + ex.getClass.getName, + ex.getLocalizedMessage, + formattedException.toList + ) + // Compile time error, need to check internal reporter + case _ => + if (iMain.reporter.hasErrors) + // TODO: This wrapper is not needed when just getting compile + // error that we are not parsing... maybe have it be purely + // output and have the error check this? + ExecuteError( + "Compile Error", output, List() + ) + else + // May as capture the output here. Could be useful + ExecuteError("Unknown Error", output, List()) + } + } +} + +/** + * Due to a bug in the scala interpreter under scala 2.11 (SI-8935) with IMain.valueOfTerm we can hack around it by + * binding an instance of ExceptionHack into iMain and interpret the "_exceptionHack.lastException = lastException". + * This makes it possible to extract the exception. + * + * TODO: Revisit this once Scala 2.12 is released. + */ +class ExceptionHack { + var lastException: Throwable = _ +} diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala index 08a8f07b7..ffd01a816 100644 --- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala +++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala @@ -19,7 +19,7 @@ package org.apache.toree.kernel.interpreter.scala import java.util -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.collection.mutable import scala.util.Try import org.apache.spark.SparkContext diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala index 82b7c9b7e..eef7e0ebf 100644 --- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala +++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala @@ -31,11 +31,12 @@ import org.slf4j.LoggerFactory import org.apache.toree.kernel.BuildInfo import org.apache.toree.kernel.protocol.v5.MIMEType import scala.annotation.tailrec -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.concurrent.{Await, Future} import scala.language.reflectiveCalls import scala.tools.nsc.Settings -import scala.tools.nsc.interpreter.{IR, OutputStream} +import scala.tools.nsc.interpreter.Results +import java.io.OutputStream import scala.tools.nsc.util.ClassPath import scala.util.matching.Regex import scala.concurrent.duration.Duration @@ -131,7 +132,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I } protected def interpreterArgs(kernel: KernelLike): List[String] = { - import scala.collection.JavaConverters._ + import scala.jdk.CollectionConverters._ if (kernel == null || kernel.config == null) { List() } @@ -188,7 +189,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I } override def interpret(code: String, silent: Boolean = false, output: Option[OutputStream]): - (Results.Result, Either[ExecuteOutput, ExecuteFailure]) = { + (org.apache.toree.interpreter.Results.Result, Either[ExecuteOutput, ExecuteFailure]) = { interpretBlock(code, silent) } @@ -277,7 +278,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I } protected def interpretBlock(code: String, silent: Boolean = false): - (Results.Result, Either[ExecuteOutput, ExecuteFailure]) = { + (org.apache.toree.interpreter.Results.Result, Either[ExecuteOutput, ExecuteFailure]) = { logger.trace(s"Interpreting line: $code") @@ -294,23 +295,23 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I Await.result(futureResultAndExecuteInfo, Duration.Inf) } - protected def interpretMapToCustomResult(future: Future[IR.Result]): Future[Results.Result] = { + protected def interpretMapToCustomResult(future: Future[Results.Result]): Future[org.apache.toree.interpreter.Results.Result] = { import scala.concurrent.ExecutionContext.Implicits.global future map { - case IR.Success => Results.Success - case IR.Error => Results.Error - case IR.Incomplete => Results.Incomplete + case Results.Success => org.apache.toree.interpreter.Results.Success + case Results.Error => org.apache.toree.interpreter.Results.Error + case Results.Incomplete => org.apache.toree.interpreter.Results.Incomplete } recover { - case ex: ExecutionException => Results.Aborted + case ex: ExecutionException => org.apache.toree.interpreter.Results.Aborted } } - protected def interpretMapToResultAndOutput(future: Future[Results.Result]): - Future[(Results.Result, Either[Map[String, String], ExecuteError])] = { + protected def interpretMapToResultAndOutput(future: Future[org.apache.toree.interpreter.Results.Result]): + Future[(org.apache.toree.interpreter.Results.Result, Either[Map[String, String], ExecuteError])] = { import scala.concurrent.ExecutionContext.Implicits.global future map { - case result @ (Results.Success | Results.Incomplete) => + case result @ (org.apache.toree.interpreter.Results.Success | org.apache.toree.interpreter.Results.Incomplete) => val lastOutput = lastResultOut.toString("UTF-8").trim lastResultOut.reset() @@ -320,17 +321,17 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I val output = obj.map(Displayers.display(_).asScala.toMap).getOrElse(Map.empty) (result, Left(output)) - case Results.Error => + case org.apache.toree.interpreter.Results.Error => val lastOutput = lastResultOut.toString("UTF-8").trim lastResultOut.reset() val (obj, defStr, text) = prepareResult(lastOutput) defStr.foreach(kernel.display.content(MIMEType.PlainText, _)) val output = interpretConstructExecuteError(text.get) - (Results.Error, Right(output)) + (org.apache.toree.interpreter.Results.Error, Right(output)) - case Results.Aborted => - (Results.Aborted, Right(null)) + case org.apache.toree.interpreter.Results.Aborted => + (org.apache.toree.interpreter.Results.Aborted, Right(null)) } } diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala index 29e988aa0..871db33e6 100644 --- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala +++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlInterpreter.scala @@ -25,7 +25,7 @@ import org.apache.toree.kernel.BuildInfo import scala.concurrent.Await import scala.concurrent.duration._ -import scala.tools.nsc.interpreter.{InputStream, OutputStream} +import java.io.{InputStream, OutputStream} /** * Represents an interpreter interface to Spark SQL. diff --git a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala index 4c6fd1a3a..0c0c6e543 100644 --- a/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala +++ b/sql-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/sql/SqlService.scala @@ -16,7 +16,7 @@ */ package org.apache.toree.kernel.interpreter.sql -import java.io.ByteArrayOutputStream +import java.io.{ByteArrayOutputStream, OutputStream} import org.apache.toree.interpreter.broker.BrokerService import org.apache.toree.kernel.api.KernelLike From 1f6b2e118f95dceb633bd31f5015bc9a62d9e151 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Sat, 12 Aug 2023 19:51:37 +0800 Subject: [PATCH 02/12] tolerate warning --- build.sbt | 2 +- .../scala/org/apache/toree/communication/SocketManager.scala | 2 +- .../toree/communication/socket/ZeroMQSocketRunnable.scala | 2 +- .../org/apache/toree/interpreter/broker/BrokerProcess.scala | 2 +- .../org/apache/toree/interpreter/broker/BrokerState.scala | 2 +- .../scala/org/apache/toree/utils/ArgumentParsingSupport.scala | 2 +- .../main/scala/org/apache/toree/utils/MultiClassLoader.scala | 2 +- .../apache/toree/interpreter/broker/BrokerProcessSpec.scala | 2 +- .../main/scala/org/apache/toree/boot/CommandLineOptions.scala | 2 +- .../org/apache/toree/boot/layer/ComponentInitialization.scala | 2 +- .../org/apache/toree/boot/layer/InterpreterManager.scala | 2 +- .../scala/org/apache/toree/boot/CommandLineOptionsSpec.scala | 2 +- .../main/scala/org/apache/toree/plugins/PluginManager.scala | 2 +- .../apache/toree/plugins/dependencies/DependencyManager.scala | 2 +- .../toree/kernel/interpreter/scala/ScalaDisplayers.scala | 2 +- .../toree/kernel/interpreter/scala/ScalaInterpreter.scala | 4 ++-- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build.sbt b/build.sbt index 7978987c8..df5923408 100644 --- a/build.sbt +++ b/build.sbt @@ -43,7 +43,7 @@ ThisBuild / scalacOptions ++= Seq( "-deprecation", "-unchecked", "-feature", - "-Xfatal-warnings", +// "-Xfatal-warnings", "-language:reflectiveCalls", "-target:jvm-1.8" ) diff --git a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala index 637994286..7041a58e1 100644 --- a/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala +++ b/communication/src/main/scala/org/apache/toree/communication/SocketManager.scala @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap import org.apache.toree.communication.socket._ import org.zeromq.{SocketType, ZMQ} -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ /** * Represents the factory for sockets that also manages ZMQ contexts and diff --git a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala index 0592bfdc6..66e71648d 100644 --- a/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala +++ b/communication/src/main/scala/org/apache/toree/communication/socket/ZeroMQSocketRunnable.scala @@ -20,7 +20,7 @@ import org.apache.toree.utils.LogLike import org.zeromq.{SocketType, ZMsg, ZMQ} import org.zeromq.ZMQ.Context -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import scala.util.Try /** diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala index 917d18d39..46af0e3f4 100644 --- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala +++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerProcess.scala @@ -23,7 +23,7 @@ import org.apache.commons.exec._ import org.apache.commons.exec.environment.EnvironmentUtils import org.apache.commons.io.{FilenameUtils, IOUtils} import org.slf4j.LoggerFactory -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ /** * Represents the process used to evaluate broker code. diff --git a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala index f79ddb373..55d331897 100644 --- a/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala +++ b/kernel-api/src/main/scala/org/apache/toree/interpreter/broker/BrokerState.scala @@ -35,7 +35,7 @@ import java.io.{InputStream, OutputStream} class BrokerState(private val maxQueuedCode: Int) { private val logger = LoggerFactory.getLogger(this.getClass) - import scala.jdk.CollectionConverters._ + import scala.collection.JavaConverters._ @volatile private var _isReady: Boolean = false diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala index c65c5ab74..cd258f6eb 100644 --- a/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala +++ b/kernel-api/src/main/scala/org/apache/toree/utils/ArgumentParsingSupport.scala @@ -18,7 +18,7 @@ package org.apache.toree.utils import joptsimple.{OptionSpec, OptionParser} -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import scala.language.implicitConversions import java.io.{PrintStream, OutputStream} diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala index 864eefbdc..b836e5acc 100644 --- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala @@ -22,7 +22,7 @@ import java.net.{URL, URLClassLoader} import java.util import org.slf4j.LoggerFactory -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import scala.util.{Failure, Success, Try} import scala.language.existentials diff --git a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala index 418744256..dde4cd598 100644 --- a/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala +++ b/kernel-api/src/test/scala/org/apache/toree/interpreter/broker/BrokerProcessSpec.scala @@ -205,7 +205,7 @@ class BrokerProcessSpec extends AnyFunSpec with Matchers brokerProcess.start() verify(mockExecutor).execute(any(),environmentCaptor.capture() , any()) - import scala.jdk.CollectionConverters._ + import scala.collection.JavaConverters._ val environment = environmentCaptor.getValue.asScala environment should contain theSameElementsAs TestEnvironment diff --git a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala index 882bf7221..59c04371b 100644 --- a/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala +++ b/kernel/src/main/scala/org/apache/toree/boot/CommandLineOptions.scala @@ -23,7 +23,7 @@ import com.typesafe.config.{Config, ConfigFactory} import joptsimple.{OptionParser, OptionSpec} import joptsimple.util.RegexMatcher._ -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ class CommandLineOptions(args: Seq[String]) { private val parser = new OptionParser() diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala index 241f441a0..f096062e7 100644 --- a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala +++ b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala @@ -33,7 +33,7 @@ import org.apache.toree.kernel.protocol.v5.kernel.ActorLoader import org.apache.toree.magic.MagicManager import org.apache.toree.plugins.PluginManager import org.apache.toree.utils.{LogLike, FileUtils} -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import org.apache.toree.plugins.AllInterpretersReady /** diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala index 1b5e0f3af..b1e5fa9a1 100644 --- a/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala +++ b/kernel/src/main/scala/org/apache/toree/boot/layer/InterpreterManager.scala @@ -20,7 +20,7 @@ package org.apache.toree.boot.layer import org.apache.toree.kernel.api.KernelLike import com.typesafe.config.Config import org.apache.toree.interpreter._ -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import org.slf4j.LoggerFactory diff --git a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala index 4d85e15a2..fbacfbaeb 100644 --- a/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala +++ b/kernel/src/test/scala/org/apache/toree/boot/CommandLineOptionsSpec.scala @@ -24,7 +24,7 @@ import joptsimple.OptionException import org.scalatest.funspec.AnyFunSpec import org.scalatest.matchers.should.Matchers -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ class CommandLineOptionsSpec extends AnyFunSpec with Matchers { diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala index 05a474722..ba7fc7639 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap import org.apache.toree.plugins.dependencies._ import org.slf4j.LoggerFactory -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import scala.util.{Failure, Success, Try} /** diff --git a/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala b/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala index 09278e0e7..6348cd22e 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/dependencies/DependencyManager.scala @@ -17,7 +17,7 @@ package org.apache.toree.plugins.dependencies import java.util.concurrent.ConcurrentHashMap -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import scala.reflect.runtime.universe.{Type, TypeTag} import scala.util.Try diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala index ffd01a816..08a8f07b7 100644 --- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala +++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaDisplayers.scala @@ -19,7 +19,7 @@ package org.apache.toree.kernel.interpreter.scala import java.util -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import scala.collection.mutable import scala.util.Try import org.apache.spark.SparkContext diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala index eef7e0ebf..81d5560d3 100644 --- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala +++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory import org.apache.toree.kernel.BuildInfo import org.apache.toree.kernel.protocol.v5.MIMEType import scala.annotation.tailrec -import scala.jdk.CollectionConverters._ +import scala.collection.JavaConverters._ import scala.concurrent.{Await, Future} import scala.language.reflectiveCalls import scala.tools.nsc.Settings @@ -132,7 +132,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I } protected def interpreterArgs(kernel: KernelLike): List[String] = { - import scala.jdk.CollectionConverters._ + import scala.collection.JavaConverters._ if (kernel == null || kernel.config == null) { List() } From c9f893e15242dcef3f42b566cedc344987c233c7 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Sat, 19 Aug 2023 11:37:16 +0800 Subject: [PATCH 03/12] ass compile on 2.13 --- build.sbt | 7 +++-- .../kernel/protocol/v5/client/Utilities.scala | 19 ++++++------ .../toree/magic/InternalClassLoader.scala | 2 +- .../apache/toree/utils/MultiClassLoader.scala | 2 +- .../v5/handler/CommInfoRequestHandler.scala | 11 +++---- .../kernel/protocol/v5/kernel/Utilities.scala | 19 ++++++------ .../apache/toree/magic/builtin/AddDeps.scala | 2 +- .../v5/kernel/socket/SocketConfigSpec.scala | 2 +- .../v5/stream/KernelOuputStreamSpec.scala | 2 +- .../scala/test/utils/DummyInterpreter.scala | 5 ++-- macros/project/plugins.sbt | 4 ++- .../apache/toree/plugins/PluginSearcher.scala | 4 +-- .../dependencies/ClassLoaderHelper.scala | 29 +++++++++++++++++++ .../toree/kernel/protocol/v5/package.scala | 2 +- .../toree/kernel/protocol/v5/HeaderSpec.scala | 2 +- .../protocol/v5/content/ClearOutputSpec.scala | 2 +- .../protocol/v5/content/CommCloseSpec.scala | 2 +- .../protocol/v5/content/CommMsgSpec.scala | 2 +- .../protocol/v5/content/CommOpenSpec.scala | 2 +- .../v5/content/CompleteReplyErrorSpec.scala | 2 +- .../v5/content/CompleteReplyOkSpec.scala | 2 +- .../v5/content/CompleteReplySpec.scala | 2 +- .../v5/content/CompleteRequestSpec.scala | 2 +- .../v5/content/ConnectReplySpec.scala | 2 +- .../v5/content/ConnectRequestSpec.scala | 2 +- .../protocol/v5/content/DisplayDataSpec.scala | 2 +- .../v5/content/ErrorContentSpec.scala | 2 +- .../v5/content/ExecuteInputSpec.scala | 2 +- .../v5/content/ExecuteReplyAbortSpec.scala | 2 +- .../v5/content/ExecuteReplyErrorSpec.scala | 2 +- .../v5/content/ExecuteReplyOkSpec.scala | 2 +- .../v5/content/ExecuteReplySpec.scala | 2 +- .../v5/content/ExecuteRequestSpec.scala | 2 +- .../v5/content/ExecuteResultSpec.scala | 2 +- .../v5/content/HistoryReplySpec.scala | 2 +- .../v5/content/HistoryRequestSpec.scala | 2 +- .../protocol/v5/content/InputReplySpec.scala | 2 +- .../v5/content/InputRequestSpec.scala | 2 +- .../v5/content/InspectReplyErrorSpec.scala | 2 +- .../v5/content/InspectReplyOkSpec.scala | 2 +- .../v5/content/InspectReplySpec.scala | 2 +- .../v5/content/InspectRequestSpec.scala | 2 +- .../v5/content/KernelInfoReplySpec.scala | 2 +- .../v5/content/KernelInfoRequestSpec.scala | 2 +- .../v5/content/KernelStatusSpec.scala | 2 +- .../v5/content/ShutdownReplySpec.scala | 2 +- .../v5/content/ShutdownRequestSpec.scala | 2 +- .../v5/content/StreamContentSpec.scala | 2 +- 48 files changed, 106 insertions(+), 72 deletions(-) create mode 100644 plugins/src/test/scala-2.13/org/apache/toree/plugins/dependencies/ClassLoaderHelper.scala diff --git a/build.sbt b/build.sbt index df5923408..31b8ee509 100644 --- a/build.sbt +++ b/build.sbt @@ -22,8 +22,9 @@ ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") + (if ((ThisBuild / isSnapshot ).value) "-SNAPSHOT" else "") ThisBuild / isSnapshot := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean ThisBuild / organization := "org.apache.toree.kernel" -ThisBuild / crossScalaVersions := Seq("2.13.10") -ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions ).value.head +ThisBuild / crossScalaVersions := Seq("2.13.8", "2.12.15") +//ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8") +ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.head ThisBuild / Dependencies.sparkVersion := { val envVar = "APACHE_SPARK_VERSION" val defaultVersion = "3.3.2" @@ -40,7 +41,7 @@ ThisBuild / Dependencies.sparkVersion := { // Compiler settings ThisBuild / scalacOptions ++= Seq( - "-deprecation", +// "-deprecation", "-unchecked", "-feature", // "-Xfatal-warnings", diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala index 07f713926..d0661ac19 100644 --- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala +++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala @@ -26,6 +26,7 @@ import org.apache.toree.kernel.protocol.v5.content.ExecuteRequest import org.apache.toree.utils.LogLike import play.api.libs.json.{JsPath, Json, JsonValidationError, Reads} +import scala.collection.mutable import scala.concurrent.duration._ object Utilities extends LogLike { @@ -78,15 +79,15 @@ object Utilities extends LogLike { } implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = { - var frames: Seq[ByteString] = Seq() - kernelMessage.ids.map((id : Array[Byte]) => frames = frames :+ ByteString.apply(id) ) - frames = frames :+ "" - frames = frames :+ kernelMessage.signature - frames = frames :+ Json.toJson(kernelMessage.header).toString() - frames = frames :+ Json.toJson(kernelMessage.parentHeader).toString() - frames = frames :+ Json.toJson(kernelMessage.metadata).toString - frames = frames :+ kernelMessage.contentString - ZMQMessage(frames : _*) + val frames: mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer() + kernelMessage.ids.map((id: Array[Byte]) => frames += ByteString.apply(id)) + frames += "" + frames += kernelMessage.signature + frames += Json.toJson(kernelMessage.header).toString() + frames += Json.toJson(kernelMessage.parentHeader).toString() + frames += Json.toJson(kernelMessage.metadata).toString + frames += kernelMessage.contentString + ZMQMessage(frames.toSeq : _*) } def parseAndHandle[T](json: String, reads: Reads[T], handler: T => Unit) : Unit = { diff --git a/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala index b79a70159..6d571d23f 100644 --- a/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/magic/InternalClassLoader.scala @@ -29,7 +29,7 @@ class InternalClassLoader( // TODO: Provides an exposed reference to the super loadClass to be stubbed // out in tests. - private[magic] def parentLoadClass(name: String, resolve: Boolean) = + private[magic] def parentLoadClass(name: String, resolve: Boolean): Class[_] = super.loadClass(name, resolve) /** diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala index b836e5acc..aa61c570b 100644 --- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala @@ -42,7 +42,7 @@ class MultiClassLoader( private val classLoaders: collection.Seq[ClassLoader] ) extends URLClassLoader( classLoaders.flatMap({ - case urlClassLoader: URLClassLoader => urlClassLoader.getURLs.to(collection.Seq) + case urlClassLoader: URLClassLoader => urlClassLoader.getURLs.toSeq case _ => Nil }).distinct.toArray, /* Create a parent chain based on a each classloader's parent */ { diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala index 4c049cd6a..8018a9a1c 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommInfoRequestHandler.scala @@ -40,10 +40,10 @@ class CommInfoRequestHandler( extends BaseHandler(actorLoader) with MessageLogSupport { - def buildCommMap(targetName: String) = { + def buildCommMap(targetName: String): Map[UUID, Map[UUID, UUID]] = { commStorage.getCommIdsFromTarget(targetName) match { case Some(commVector) => { - commVector.map(x => Map(x -> Map("target_name" -> targetName))).flatten.toMap + commVector.flatMap(x => Map(x -> Map("target_name" -> targetName))).toMap } case _ => { Map() @@ -54,13 +54,14 @@ class CommInfoRequestHandler( override def process(kernelMessage: KernelMessage): Future[_] = Future { logKernelMessageAction("Initiating CommInfo request for", kernelMessage) import scala.language.existentials - val commMap = (Json.parse(kernelMessage.contentString) \ "target_name").asOpt[String] match { + val commMap: Map[String, Map[String, String]] = + (Json.parse(kernelMessage.contentString) \ "target_name").asOpt[String] match { case Some(targetName) => { buildCommMap(targetName) } case None => { - //target_name is missing from the kernel message so return all comms over every target - commStorage.getTargets().map(buildCommMap(_)) + // target_name is missing from the kernel message so return all comms over every target + commStorage.getTargets().map(buildCommMap).reduce(_ ++ _) } } val commInfoReply = CommInfoReplyOk(commMap.asInstanceOf[Map[String, Map[String, String]]]) diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala index b1f785954..da89a1bcf 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/kernel/Utilities.scala @@ -26,6 +26,7 @@ import org.apache.toree.utils.LogLike import play.api.libs.json.JsonValidationError import play.api.libs.json.{JsPath, Json, Reads} +import scala.collection.mutable import scala.concurrent.duration._ object Utilities extends LogLike { @@ -77,15 +78,15 @@ object Utilities extends LogLike { } implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = { - var frames: Seq[ByteString] = Seq() - kernelMessage.ids.map((id : Array[Byte]) => frames = frames :+ ByteString.apply(id) ) - frames = frames :+ "" - frames = frames :+ kernelMessage.signature - frames = frames :+ Json.toJson(kernelMessage.header).toString() - frames = frames :+ Json.toJson(kernelMessage.parentHeader).toString() - frames = frames :+ Json.toJson(kernelMessage.metadata).toString - frames = frames :+ kernelMessage.contentString - ZMQMessage(frames : _*) + val frames: mutable.ListBuffer[ByteString] = mutable.ListBuffer() + kernelMessage.ids.map((id: Array[Byte]) => frames += ByteString.apply(id)) + frames += "" + frames += kernelMessage.signature + frames += Json.toJson(kernelMessage.header).toString() + frames += Json.toJson(kernelMessage.parentHeader).toString() + frames += Json.toJson(kernelMessage.metadata).toString + frames += kernelMessage.contentString + ZMQMessage(frames.toSeq : _*) } def parseAndHandle[T, U](json: String, reads: Reads[T], diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala index eb0112760..466dce10c 100644 --- a/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala +++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala @@ -91,7 +91,7 @@ class AddDeps extends LineMagic with IncludeInterpreter } else { (x, "*") } - }: (String, String)).to(collection.Set) + }: (String, String)).toSet val repositoriesWithCreds = dependencyDownloader.resolveRepositoriesAndCredentials(repository, credentials) diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala index f276ed130..c516aeab6 100644 --- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala +++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala @@ -71,7 +71,7 @@ class SocketConfigSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = socketConfigJson.validate[SocketConfig] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: SocketConfig) => valid ) should be (socketConfig) } diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala index 44b429325..7881eb0c8 100644 --- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala +++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/stream/KernelOuputStreamSpec.scala @@ -239,7 +239,7 @@ class KernelOuputStreamSpec val message = kernelOutputRelayProbe .receiveOne(MaxAkkaTestTimeout).asInstanceOf[KernelMessage] - message.ids(0).deep should equal (MessageType.Outgoing.Stream.toString.getBytes.deep) + message.ids.head.toIndexedSeq should equal (MessageType.Outgoing.Stream.toString.getBytes.toIndexedSeq) } it("should set the message type in the header of the kernel message to an execute_result") { diff --git a/kernel/src/test/scala/test/utils/DummyInterpreter.scala b/kernel/src/test/scala/test/utils/DummyInterpreter.scala index d7c7fab5f..2ef0434cc 100644 --- a/kernel/src/test/scala/test/utils/DummyInterpreter.scala +++ b/kernel/src/test/scala/test/utils/DummyInterpreter.scala @@ -17,13 +17,12 @@ package test.utils -import java.net.URL - import org.apache.toree.interpreter.Results.Result import org.apache.toree.interpreter.{ExecuteFailure, ExecuteOutput, Interpreter, LanguageInfo} import org.apache.toree.kernel.api.KernelLike -import scala.tools.nsc.interpreter.{InputStream, OutputStream} +import java.io.{InputStream, OutputStream} +import java.net.URL class DummyInterpreter(kernel: KernelLike) extends Interpreter { /** diff --git a/macros/project/plugins.sbt b/macros/project/plugins.sbt index 69d839d1c..106430432 100644 --- a/macros/project/plugins.sbt +++ b/macros/project/plugins.sbt @@ -16,4 +16,6 @@ */ resolvers += Resolver.sonatypeRepo("releases") -addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full) +if (scalaBinaryVersion.value == "2.12") { + addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full) +} diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala index 9ed47058c..9f3b69896 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala @@ -75,8 +75,8 @@ class PluginSearcher { s"Failed to load class info from classpath: ${classFinder.classpath.mkString(",")}", _: Throwable )) - val stream = tryStream.getOrElse(LazyList.empty) - ClassFinder.classInfoMap(stream.iterator) + val stream = tryStream.getOrElse(Stream.empty) + ClassFinder.classInfoMap(stream.toIterator) } /** diff --git a/plugins/src/test/scala-2.13/org/apache/toree/plugins/dependencies/ClassLoaderHelper.scala b/plugins/src/test/scala-2.13/org/apache/toree/plugins/dependencies/ClassLoaderHelper.scala new file mode 100644 index 000000000..20e185659 --- /dev/null +++ b/plugins/src/test/scala-2.13/org/apache/toree/plugins/dependencies/ClassLoaderHelper.scala @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ +package org.apache.toree.plugins.dependencies + +import java.net.URL +import java.lang.{ClassLoader => JClassLoader} + +import scala.reflect.internal.util.ScalaClassLoader + +object ClassLoaderHelper { + + def URLClassLoader(urls: Seq[URL], parent: JClassLoader): ScalaClassLoader.URLClassLoader = { + new scala.reflect.internal.util.ScalaClassLoader.URLClassLoader(urls, parent) + } +} diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala index 71864d528..45c060638 100644 --- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala +++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/package.scala @@ -36,7 +36,7 @@ package object v5 { Map.empty } else { // triple quotes due https://github.com/scala/bug/issues/6476 - kv.toMap.view.mapValues(v => Json.parse(s""""$v"""")).toMap + kv.toMap.mapValues(v => Json.parse(s""""$v"""")).toMap } } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala index 798ed38bb..92cf21c4a 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala @@ -63,7 +63,7 @@ class HeaderSpec extends AnyFunSpec with Matchers { val headerResults = headerJson.validate[Header] headerResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: Header) => valid ) should be (header) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala index d951d7a98..50c01e8ca 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala @@ -59,7 +59,7 @@ class ClearOutputSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = clearOutputJson.validate[ClearOutput] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ClearOutput) => valid ) should be (clearOutput) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala index c0ee54c78..815fd16ef 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala @@ -60,7 +60,7 @@ class CommCloseSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commCloseJson.validate[CommClose] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CommClose) => valid ) should be (commClose) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala index a018f725a..3e353b14f 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala @@ -88,7 +88,7 @@ class CommMsgSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commMsgJson.validate[CommMsg] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CommMsg) => valid ) should be (commMsg) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala index 364a6b4dd..b45b80ca4 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala @@ -61,7 +61,7 @@ class CommOpenSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commOpenJson.validate[CommOpen] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CommOpen) => valid ) should be (commOpen) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala index 47ddbf8ad..63646c7cf 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala @@ -61,7 +61,7 @@ class CompleteReplyErrorSpec extends AnyFunSpec with Matchers { val CompleteReplyOkResults = completeReplyErrorJson.validate[CompleteReplyError] CompleteReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReplyError) => valid ) should be (completeReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala index eecda7074..95fbf7f44 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala @@ -57,7 +57,7 @@ class CompleteReplyOkSpec extends AnyFunSpec with Matchers { val CompleteReplyOkResults = completeReplyOkJson.validate[CompleteReplyOk] CompleteReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReplyOk) => valid ) should be (completeReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala index a37a5a3f0..c9754628b 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala @@ -64,7 +64,7 @@ class CompleteReplySpec extends AnyFunSpec with Matchers { val CompleteReplyResults = completeReplyJson.validate[CompleteReply] CompleteReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReply) => valid ) should be (completeReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala index afec715d8..8e7a8f069 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala @@ -60,7 +60,7 @@ class CompleteRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = completeRequestJson.validate[CompleteRequest] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteRequest) => valid ) should be (completeRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala index 94c6dceee..e8a2f52d7 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala @@ -62,7 +62,7 @@ class ConnectReplySpec extends AnyFunSpec with Matchers { val ConnectReplyResults = connectReplyJson.validate[ConnectReply] ConnectReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ConnectReply) => valid ) should be (connectReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala index 593181108..e3465b815 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala @@ -55,7 +55,7 @@ class ConnectRequestSpec extends AnyFunSpec with Matchers { val ConnectRequestResults = connectRequestJson.validate[ConnectRequest] ConnectRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ConnectRequest) => valid ) should be (connectRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala index 206104299..0e45087de 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala @@ -62,7 +62,7 @@ class DisplayDataSpec extends AnyFunSpec with Matchers { val displayDataResults = displayDataJson.validate[DisplayData] displayDataResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: DisplayData) => valid ) should be (displayData) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala index ac9b57a41..9095097f8 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala @@ -58,7 +58,7 @@ class ErrorContentSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = errorJson.validate[ErrorContent] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ErrorContent) => valid ) should be (error) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala index 5a360a47e..7f2647f20 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala @@ -60,7 +60,7 @@ class ExecuteInputSpec extends AnyFunSpec with Matchers { val executeInputResults = executeInputJson.validate[ExecuteInput] executeInputResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteInput) => valid ) should be (executeInput) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala index 9669f2b8d..33bd0f081 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala @@ -55,7 +55,7 @@ class ExecuteReplyAbortSpec extends AnyFunSpec with Matchers { val ExecuteReplyAbortResults = executeReplyAbortJson.validate[ExecuteReplyAbort] ExecuteReplyAbortResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyAbort) => valid ) should be (executeReplyAbort) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala index 4140e5def..df371be01 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala @@ -59,7 +59,7 @@ class ExecuteReplyErrorSpec extends AnyFunSpec with Matchers { val ExecuteReplyErrorResults = executeReplyErrorJson.validate[ExecuteReplyError] ExecuteReplyErrorResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyError) => valid ) should be (executeReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala index bb235b010..8bf3ad2f7 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala @@ -58,7 +58,7 @@ class ExecuteReplyOkSpec extends AnyFunSpec with Matchers { val executeReplyOkResults = executeReplyOkJson.validate[ExecuteReplyOk] executeReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyOk) => valid ) should be (executeReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala index d7abd0f05..0016ad63a 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala @@ -61,7 +61,7 @@ class ExecuteReplySpec extends AnyFunSpec with Matchers { val executeReplyResults = executeReplyJson.validate[ExecuteReply] executeReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReply) => valid ) should be (executeReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala index 2678af280..e712b9c23 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala @@ -64,7 +64,7 @@ class ExecuteRequestSpec extends AnyFunSpec with Matchers { val executeRequestResults = executeRequestJson.validate[ExecuteRequest] executeRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteRequest) => valid ) should be (executeRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala index e5155e58c..dd40618f7 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala @@ -97,7 +97,7 @@ class ExecuteResultSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = executeResultJson.validate[ExecuteResult] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteResult) => valid ) should be (executeResult) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala index 4eb13c85a..c616c0bab 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala @@ -62,7 +62,7 @@ class HistoryReplySpec extends AnyFunSpec with Matchers { val CompleteRequestResults = historyReplyJson.validate[HistoryReply] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: HistoryReply) => valid ) should be (historyReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala index b79348442..7d5cdcb38 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala @@ -67,7 +67,7 @@ class HistoryRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = historyRequestJson.validate[HistoryRequest] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: HistoryRequest) => valid ) should be (historyRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala index 5127d2d95..87d47a660 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala @@ -60,7 +60,7 @@ class InputReplySpec extends AnyFunSpec with Matchers { val CompleteReplyResults = inputReplyJson.validate[InputReply] CompleteReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InputReply) => valid ) should be (inputReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala index ce98889bd..9b7b657a5 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala @@ -60,7 +60,7 @@ class InputRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = inputRequestJson.validate[InputRequest] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InputRequest) => valid ) should be (inputRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala index dcbb44362..34ab89b2f 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala @@ -59,7 +59,7 @@ class InspectReplyErrorSpec extends AnyFunSpec with Matchers { val InspectReplyErrorResults = inspectReplyErrorJson.validate[InspectReplyError] InspectReplyErrorResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReplyError) => valid ) should be (inspectReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala index d31f349a0..a474cb3ab 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala @@ -57,7 +57,7 @@ class InspectReplyOkSpec extends AnyFunSpec with Matchers { val InspectReplyOkResults = inspectReplyOkJson.validate[InspectReplyOk] InspectReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReplyOk) => valid ) should be (inspectReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala index 5d7ab6b74..4917cae69 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala @@ -61,7 +61,7 @@ class InspectReplySpec extends AnyFunSpec with Matchers { val InspectReplyResults = inspectReplyJson.validate[InspectReply] InspectReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReply) => valid ) should be (inspectReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala index 127e720fc..3fb8aa83c 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala @@ -61,7 +61,7 @@ class InspectRequestSpec extends AnyFunSpec with Matchers { val InspectRequestResults = inspectRequestJson.validate[InspectRequest] InspectRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectRequest) => valid ) should be (inspectRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala index 4d562fbc3..e10432dba 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala @@ -65,7 +65,7 @@ class KernelInfoReplySpec extends AnyFunSpec with Matchers { val kernelInfoReplyResults = kernelInfoReplyJson.validate[KernelInfoReply] kernelInfoReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelInfoReply) => valid ) should be (kernelInfoReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala index a35496d25..1f7cc2415 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala @@ -56,7 +56,7 @@ class KernelInfoRequestSpec extends AnyFunSpec with Matchers { val KernelInfoRequestResults = kernelInfoRequestJson.validate[KernelInfoRequest] KernelInfoRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelInfoRequest) => valid ) should be (kernelInfoRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala index 5be379639..814283fc9 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala @@ -57,7 +57,7 @@ class KernelStatusSpec extends AnyFunSpec with Matchers { val kernelStatusResults = kernelStatusJson.validate[KernelStatus] kernelStatusResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelStatus) => valid ) should be (kernelStatus) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala index 32e451b44..185a2e156 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala @@ -60,7 +60,7 @@ class ShutdownReplySpec extends AnyFunSpec with Matchers { val ShutdownReplyResults = shutdownReplyJson.validate[ShutdownReply] ShutdownReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ShutdownReply) => valid ) should be (shutdownReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala index afa4798fa..bd956416b 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala @@ -59,7 +59,7 @@ class ShutdownRequestSpec extends AnyFunSpec with Matchers { val ShutdownRequestResults = shutdownRequestJson.validate[ShutdownRequest] ShutdownRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ShutdownRequest) => valid ) should be (shutdownRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala index abd660034..aeaad77a2 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala @@ -58,7 +58,7 @@ class StreamContentSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = streamJson.validate[StreamContent] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: StreamContent) => valid ) should be (stream) } From 155ac06b0ab683cbd14c3f436d3ffe843b93fb27 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Mon, 21 Aug 2023 01:56:58 +0800 Subject: [PATCH 04/12] pass test on 2.13 --- build.sbt | 5 ++-- .../v5/client/socket/IOPubClientSpec.scala | 4 +-- .../toree/utils/DataFrameConverter.scala | 5 +++- .../toree/plugins/ClassFinderHelper.scala | 27 ++++++++++++++++++ .../toree/plugins/ClassFinderHelper.scala | 27 ++++++++++++++++++ .../toree/plugins/PluginSearcherSpec.scala | 28 ++++++++++--------- .../interpreter/scala/ScalaInterpreter.scala | 4 +-- 7 files changed, 79 insertions(+), 21 deletions(-) create mode 100644 plugins/src/test/scala-2.12/org/apache/toree/plugins/ClassFinderHelper.scala create mode 100644 plugins/src/test/scala-2.13/org/apache/toree/plugins/ClassFinderHelper.scala diff --git a/build.sbt b/build.sbt index 31b8ee509..cab592f0f 100644 --- a/build.sbt +++ b/build.sbt @@ -22,9 +22,8 @@ ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") + (if ((ThisBuild / isSnapshot ).value) "-SNAPSHOT" else "") ThisBuild / isSnapshot := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean ThisBuild / organization := "org.apache.toree.kernel" -ThisBuild / crossScalaVersions := Seq("2.13.8", "2.12.15") -//ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8") -ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.head +ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8") +ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last ThisBuild / Dependencies.sparkVersion := { val envVar = "APACHE_SPARK_VERSION" val defaultVersion = "3.3.2" diff --git a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala index 9cae4fb1a..f7b19ab30 100644 --- a/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala +++ b/client/src/test/scala/org/apache/toree/kernel/protocol/v5/client/socket/IOPubClientSpec.scala @@ -36,7 +36,7 @@ import org.mockito.ArgumentMatchers.{eq => mockEq, _} import org.mockito.Mockito._ import org.scalatest.concurrent.{Eventually, ScalaFutures} import org.scalatestplus.mockito.MockitoSugar -import org.scalatest.time.{Milliseconds, Span} +import org.scalatest.time.{Milliseconds, Seconds, Span} import org.scalatest.funspec.AnyFunSpecLike import org.scalatest.matchers.should.Matchers import org.scalatest.BeforeAndAfterEach @@ -60,7 +60,7 @@ class IOPubClientSpec extends TestKit(ActorSystem( { private val TestTimeout = Timeout(10.seconds) implicit override val patienceConfig = PatienceConfig( - timeout = scaled(Span(200, Milliseconds)), + timeout = scaled(Span(1, Seconds)), interval = scaled(Span(5, Milliseconds)) ) private val SignatureEnabled = true diff --git a/kernel/src/main/scala/org/apache/toree/utils/DataFrameConverter.scala b/kernel/src/main/scala/org/apache/toree/utils/DataFrameConverter.scala index ba75daa21..5ea98c3c2 100644 --- a/kernel/src/main/scala/org/apache/toree/utils/DataFrameConverter.scala +++ b/kernel/src/main/scala/org/apache/toree/utils/DataFrameConverter.scala @@ -21,6 +21,8 @@ import org.apache.spark.sql.{Dataset, Row} import org.apache.toree.plugins.Plugin import play.api.libs.json.{JsObject, Json} +import scala.collection.immutable +import scala.collection.mutable import scala.util.Try import org.apache.toree.plugins.annotations.Init @@ -84,7 +86,8 @@ object DataFrameConverter { def fieldToString(any: Any): String = any match { case null => "null" - case seq: Seq[_] => seq.mkString("[", ", ", "]") + case seq: immutable.Seq[_] => seq.mkString("[", ", ", "]") + case seq: mutable.Seq[_] => seq.mkString("[", ", ", "]") case _ => any.toString } diff --git a/plugins/src/test/scala-2.12/org/apache/toree/plugins/ClassFinderHelper.scala b/plugins/src/test/scala-2.12/org/apache/toree/plugins/ClassFinderHelper.scala new file mode 100644 index 000000000..81b7c95e7 --- /dev/null +++ b/plugins/src/test/scala-2.12/org/apache/toree/plugins/ClassFinderHelper.scala @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package org.apache.toree.plugins + +import org.clapper.classutil.ClassInfo + +trait ClassFinderHelper { + + def wrappedGetClassesReturnVal(classes: Seq[ClassInfo]): Object = { + classes.toStream + } +} diff --git a/plugins/src/test/scala-2.13/org/apache/toree/plugins/ClassFinderHelper.scala b/plugins/src/test/scala-2.13/org/apache/toree/plugins/ClassFinderHelper.scala new file mode 100644 index 000000000..ea7251554 --- /dev/null +++ b/plugins/src/test/scala-2.13/org/apache/toree/plugins/ClassFinderHelper.scala @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package org.apache.toree.plugins + +import org.clapper.classutil.ClassInfo + +trait ClassFinderHelper { + + def wrappedGetClassesReturnVal(classes: Seq[ClassInfo]): Object = { + LazyList.from(classes) + } +} diff --git a/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala b/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala index 36e46ee4b..4df4d6423 100644 --- a/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala +++ b/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala @@ -17,8 +17,9 @@ package org.apache.toree.plugins import java.io.File +import scala.collection.immutable -import org.clapper.classutil.{Modifier, ClassFinder} +import org.clapper.classutil.{ClassFinder, Modifier} import org.scalatestplus.mockito.MockitoSugar import org.scalatest.OneInstancePerTest import org.scalatest.funspec.AnyFunSpec @@ -27,8 +28,9 @@ import org.scalatest.matchers.should.Matchers import org.mockito.Mockito._ import test.utils.TestClassInfo + class PluginSearcherSpec extends AnyFunSpec with Matchers - with OneInstancePerTest with MockitoSugar + with OneInstancePerTest with MockitoSugar with ClassFinderHelper { private val mockClassFinder = mock[ClassFinder] private val pluginSearcher = new PluginSearcher { @@ -65,7 +67,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers name = "abstract.plugin", modifiers = Set(Modifier.Abstract) ) - private val classInfos = Seq( + private val classInfos = immutable.Seq( pluginClassInfo, directPluginClassInfo, directAsInterfacePluginClassInfo, indirectPluginClassInfo, indirectAsInterfacePluginClassInfo, @@ -77,7 +79,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins directly extending the Plugin class") { val expected = directPluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.internal.map(_.name) @@ -87,7 +89,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins directly extending the Plugin trait") { val expected = directAsInterfacePluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.internal.map(_.name) @@ -97,7 +99,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins indirectly extending the Plugin class") { val expected = indirectPluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.internal.map(_.name) @@ -107,7 +109,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins indirectly extending the Plugin trait") { val expected = indirectAsInterfacePluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.internal.map(_.name) @@ -120,7 +122,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers traitPluginClassInfo.name ) - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.internal.map(_.name) @@ -132,7 +134,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins directly extending the Plugin class") { val expected = directPluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.search().map(_.name).toSeq @@ -142,7 +144,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins directly extending the Plugin trait") { val expected = directAsInterfacePluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.search().map(_.name).toSeq @@ -152,7 +154,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins indirectly extending the Plugin class") { val expected = indirectPluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.search().map(_.name).toSeq @@ -162,7 +164,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers it("should find any plugins indirectly extending the Plugin trait") { val expected = indirectAsInterfacePluginClassInfo.name - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.search().map(_.name).toSeq @@ -175,7 +177,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers traitPluginClassInfo.name ) - doReturn(classInfos.toStream, Nil: _*).when(mockClassFinder).getClasses() + doReturn(wrappedGetClassesReturnVal(classInfos), Nil: _*).when(mockClassFinder).getClasses() val actual = pluginSearcher.search().map(_.name).toSeq diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala index 81d5560d3..7aaa2bf8e 100644 --- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala +++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala @@ -213,7 +213,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I definitions.append(s"$name: $func$funcType").append("\n") - case NamedResult(name, vtype, value) if read(name).nonEmpty => + case NamedResult(_, _, name, vtype, value) if read(name).nonEmpty => val result = read(name) @@ -419,7 +419,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I object ScalaInterpreter { val HigherOrderFunction: Regex = """(\w+):\s+(\(\s*.*=>\s*\w+\))(\w+)\s*.*""".r - val NamedResult: Regex = """(\w+):\s+([^=]+)\s+=\s*(.*)""".r + val NamedResult: Regex = """((val|var)\s+)?(\w+):\s+([^=]+)\s+=\s*(.*)""".r val Definition: Regex = """defined\s+(\w+)\s+(.+)""".r val Import: Regex = """import\s+([\w\.,\{\}\s]+)""".r From 448aa7612f928c6703946bb524d2bdf2b59b9514 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 14:26:42 +0800 Subject: [PATCH 05/12] rebase --- .../kernel/protocol/v5/client/Utilities.scala | 2 +- .../CoursierDependencyDownloader.scala | 2 +- .../dependencies/DependencyDownloader.scala | 8 ++++---- .../dependencies/IvyDependencyDownloader.scala | 6 +++--- .../apache/toree/utils/MultiClassLoader.scala | 4 ++-- .../protocol/v5/handler/CommCloseHandler.scala | 2 +- .../protocol/v5/handler/CommMsgHandler.scala | 2 +- .../protocol/v5/handler/CommOpenHandler.scala | 2 +- .../v5/kernel/socket/SocketConfigSpec.scala | 2 +- .../org/apache/toree/plugins/Plugin.scala | 12 ++++++------ .../apache/toree/plugins/PluginManager.scala | 18 +++++++++--------- .../apache/toree/plugins/PluginMethod.scala | 2 +- .../apache/toree/plugins/PluginSearcher.scala | 2 +- .../toree/kernel/protocol/v5/KMBuilder.scala | 4 ++-- .../toree/kernel/protocol/v5/HeaderSpec.scala | 2 +- .../protocol/v5/content/ClearOutputSpec.scala | 2 +- .../protocol/v5/content/CommCloseSpec.scala | 2 +- .../protocol/v5/content/CommMsgSpec.scala | 2 +- .../protocol/v5/content/CommOpenSpec.scala | 2 +- .../v5/content/CompleteReplyErrorSpec.scala | 2 +- .../v5/content/CompleteReplyOkSpec.scala | 2 +- .../v5/content/CompleteReplySpec.scala | 2 +- .../v5/content/CompleteRequestSpec.scala | 2 +- .../protocol/v5/content/ConnectReplySpec.scala | 2 +- .../v5/content/ConnectRequestSpec.scala | 2 +- .../protocol/v5/content/DisplayDataSpec.scala | 2 +- .../protocol/v5/content/ErrorContentSpec.scala | 2 +- .../protocol/v5/content/ExecuteInputSpec.scala | 2 +- .../v5/content/ExecuteReplyAbortSpec.scala | 2 +- .../v5/content/ExecuteReplyErrorSpec.scala | 2 +- .../v5/content/ExecuteReplyOkSpec.scala | 2 +- .../protocol/v5/content/ExecuteReplySpec.scala | 2 +- .../v5/content/ExecuteRequestSpec.scala | 2 +- .../v5/content/ExecuteResultSpec.scala | 2 +- .../protocol/v5/content/HistoryReplySpec.scala | 2 +- .../v5/content/HistoryRequestSpec.scala | 2 +- .../protocol/v5/content/InputReplySpec.scala | 2 +- .../protocol/v5/content/InputRequestSpec.scala | 2 +- .../v5/content/InspectReplyErrorSpec.scala | 2 +- .../v5/content/InspectReplyOkSpec.scala | 2 +- .../protocol/v5/content/InspectReplySpec.scala | 2 +- .../v5/content/InspectRequestSpec.scala | 2 +- .../v5/content/KernelInfoReplySpec.scala | 2 +- .../v5/content/KernelInfoRequestSpec.scala | 2 +- .../protocol/v5/content/KernelStatusSpec.scala | 2 +- .../v5/content/ShutdownReplySpec.scala | 2 +- .../v5/content/ShutdownRequestSpec.scala | 2 +- .../v5/content/StreamContentSpec.scala | 2 +- 48 files changed, 68 insertions(+), 68 deletions(-) diff --git a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala index d0661ac19..b1fc15495 100644 --- a/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala +++ b/client/src/main/scala/org/apache/toree/kernel/protocol/v5/client/Utilities.scala @@ -79,7 +79,7 @@ object Utilities extends LogLike { } implicit def KernelMessageToZMQMessage(kernelMessage : KernelMessage) : ZMQMessage = { - val frames: mutable.ListBuffer[ByteString] = scala.collection.mutable.ListBuffer() + val frames: mutable.ListBuffer[ByteString] = mutable.ListBuffer() kernelMessage.ids.map((id: Array[Byte]) => frames += ByteString.apply(id)) frames += "" frames += kernelMessage.signature diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala index fb88aad57..a7e8478e5 100644 --- a/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala @@ -105,7 +105,7 @@ class CoursierDependencyDownloader extends DependencyDownloader { artifactClassifier.map(c => Classifier(c)).getOrElse(Classifier.empty) ) } - )) + ).toSeq) printStream.println(s"Marking $groupId:$artifactId:$version for download") diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala index 666055fc8..36f8b50c0 100644 --- a/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala @@ -54,14 +54,14 @@ abstract class DependencyDownloader { transitive: Boolean = true, excludeBaseDependencies: Boolean = true, ignoreResolutionErrors: Boolean = true, - extraRepositories: collection.Seq[(URL, Option[Credentials])] = Nil, + extraRepositories: Seq[(URL, Option[Credentials])] = Nil, verbose: Boolean = false, trace: Boolean = false, configuration: Option[String] = None, artifactType: Option[String] = None, artifactClassifier: Option[String] = None, - excludes: collection.Set[(String,String)] = collection.Set.empty - ): collection.Seq[URI] + excludes: Set[(String,String)] = Set.empty + ): Seq[URI] /** * Sets the printstream to log to. @@ -89,7 +89,7 @@ abstract class DependencyDownloader { * * @return The list of repositories as URIs */ - def getRepositories: collection.Seq[URI] + def getRepositories: Seq[URI] /** * Sets the directory where all downloaded jars will be stored. diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala index fb53fdf06..47e6da9a8 100644 --- a/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/IvyDependencyDownloader.scala @@ -89,14 +89,14 @@ class IvyDependencyDownloader( transitive: Boolean = true, excludeBaseDependencies: Boolean, ignoreResolutionErrors: Boolean, - extraRepositories: collection.Seq[(URL, Option[Credentials])] = Nil, + extraRepositories: Seq[(URL, Option[Credentials])] = Nil, verbose: Boolean, trace: Boolean, configuration: Option[String] = None, artifactType: Option[String] = None, artifactClassifier: Option[String] = None, - excludes: collection.Set[(String,String)] = collection.Set.empty - ): collection.Seq[URI] = { + excludes: Set[(String,String)] = Set.empty + ): Seq[URI] = { // Start building the ivy.xml file val ivyFile = File.createTempFile("ivy-custom", ".xml") ivyFile.deleteOnExit() diff --git a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala index aa61c570b..a7cb5d9b8 100644 --- a/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/utils/MultiClassLoader.scala @@ -38,8 +38,8 @@ import scala.language.existentials * implementations of this class loader */ class MultiClassLoader( - private val urls: collection.Seq[URL], - private val classLoaders: collection.Seq[ClassLoader] + private val urls: Seq[URL], + private val classLoaders: Seq[ClassLoader] ) extends URLClassLoader( classLoaders.flatMap({ case urlClassLoader: URLClassLoader => urlClassLoader.getURLs.toSeq diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala index 7f6d4b2f0..2e7e62679 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommCloseHandler.scala @@ -78,7 +78,7 @@ class CommCloseHandler( } } - private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) = { + private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]): Unit = { // TODO: Determine proper response for a parse failure logger.warn("Parse error for Comm Close! Not responding!") } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala index be3d37bfe..ea4ffd5cc 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommMsgHandler.scala @@ -78,7 +78,7 @@ class CommMsgHandler( } } - private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) = { + private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]): Unit = { // TODO: Determine proper response for a parse failure logger.warn("Parse error for Comm Msg! Not responding!") } diff --git a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala index 60d02889b..08a33cbeb 100644 --- a/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala +++ b/kernel/src/main/scala/org/apache/toree/kernel/protocol/v5/handler/CommOpenHandler.scala @@ -82,7 +82,7 @@ class CommOpenHandler( } } - private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) = { + private def handleParseError(invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]): Unit = { // TODO: Determine proper response for a parse failure logger.warn("Parse error for Comm Open! Not responding!") } diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala index c516aeab6..f276ed130 100644 --- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala +++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala @@ -71,7 +71,7 @@ class SocketConfigSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = socketConfigJson.validate[SocketConfig] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: SocketConfig) => valid ) should be (socketConfig) } diff --git a/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala b/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala index f933c13b2..42f0eb82c 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/Plugin.scala @@ -70,31 +70,31 @@ trait Plugin { _internalPluginManager /** Represents all @init methods in the plugin. */ - @Internal private[plugins] final lazy val initMethods: collection.Seq[PluginMethod] = { + @Internal private[plugins] final lazy val initMethods: Seq[PluginMethod] = { allMethods.filter(_.isInit) } /** Represents all @destroy methods in the plugin. */ - @Internal private[plugins] final lazy val destroyMethods: collection.Seq[PluginMethod] = { + @Internal private[plugins] final lazy val destroyMethods: Seq[PluginMethod] = { allMethods.filter(_.isDestroy) } /** Represents all @event methods in the plugin. */ - @Internal private[plugins] final lazy val eventMethods: collection.Seq[PluginMethod] = { + @Internal private[plugins] final lazy val eventMethods: Seq[PluginMethod] = { allMethods.filter(_.isEvent) } /** Represents all @events methods in the plugin. */ - @Internal private[plugins] final lazy val eventsMethods: collection.Seq[PluginMethod] = { + @Internal private[plugins] final lazy val eventsMethods: Seq[PluginMethod] = { allMethods.filter(_.isEvents) } /** Represents all public/protected methods contained by this plugin. */ - private final lazy val allMethods: collection.Seq[PluginMethod] = + private final lazy val allMethods: Seq[PluginMethod] = getClass.getMethods.map(PluginMethod.apply(this, _: Method)) /** Represents mapping of event names to associated plugin methods. */ - @Internal private[plugins] final lazy val eventMethodMap: Map[String, collection.Seq[PluginMethod]] = { + @Internal private[plugins] final lazy val eventMethodMap: Map[String, Seq[PluginMethod]] = { val allEventMethods = (eventMethods ++ eventsMethods).distinct val allEventNames = allEventMethods.flatMap(_.eventNames).distinct allEventNames.map(name => diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala index ba7fc7639..8162f19ea 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginManager.scala @@ -76,7 +76,7 @@ class PluginManager( * * @return The collection of loaded plugins */ - def initialize(): collection.Seq[Plugin] = { + def initialize(): Seq[Plugin] = { val newPlugins = internalPlugins.flatMap(t => loadPlugin(t._1, t._2).toOption ).toSeq @@ -96,7 +96,7 @@ class PluginManager( // Search for plugins in our new paths, then add loaded plugins to list // NOTE: Iterator returned from plugin searcher, so avoid building a // large collection by performing all tasks together - @volatile var newPlugins = collection.Seq[Plugin]() + @volatile var newPlugins = Seq[Plugin]() pluginSearcher.search(paths: _*).foreach(ci => { // Add valid path to class loader pluginClassLoader.addURL(ci.location.toURI.toURL) @@ -162,7 +162,7 @@ class PluginManager( def initializePlugins( plugins: Seq[Plugin], scopedDependencyManager: DependencyManager = DependencyManager.Empty - ): collection.Seq[PluginMethodResult] = { + ): Seq[PluginMethodResult] = { val pluginMethods = plugins.flatMap(_.initMethods) val results = invokePluginMethods( pluginMethods, @@ -199,7 +199,7 @@ class PluginManager( plugins: Seq[Plugin], scopedDependencyManager: DependencyManager = DependencyManager.Empty, destroyOnFailure: Boolean = true - ): collection.Seq[PluginMethodResult] = { + ): Seq[PluginMethodResult] = { val pluginMethods = plugins.flatMap(_.destroyMethods) val results = invokePluginMethods( pluginMethods, @@ -278,7 +278,7 @@ class PluginManager( def fireEvent( eventName: String, scopedDependencies: Dependency[_ <: AnyRef]* - ): collection.Seq[PluginMethodResult] = { + ): Seq[PluginMethodResult] = { val dependencyManager = new DependencyManager scopedDependencies.foreach(d => dependencyManager.add(d)) fireEvent(eventName, dependencyManager) @@ -295,7 +295,7 @@ class PluginManager( def fireEvent( eventName: String, scopedDependencyManager: DependencyManager = DependencyManager.Empty - ): collection.Seq[PluginMethodResult] = { + ): Seq[PluginMethodResult] = { val methods = plugins.flatMap(_.eventMethodMap.getOrElse(eventName, Nil)) invokePluginMethods(methods.toSeq, scopedDependencyManager) @@ -313,9 +313,9 @@ class PluginManager( * @return The collection of results in order of priority */ private def invokePluginMethods( - pluginMethods: collection.Seq[PluginMethod], + pluginMethods: Seq[PluginMethod], scopedDependencyManager: DependencyManager - ): collection.Seq[PluginMethodResult] = { + ): Seq[PluginMethodResult] = { // Continue trying to invoke plugins until we finish them all or // we reach a state where no plugin can be completed val completedMethods = Array.ofDim[PluginMethodResult](pluginMethods.size) @@ -360,7 +360,7 @@ class PluginManager( * @param pluginMethods The collection of plugin methods to sort * @return The sorted plugin methods */ - private def prioritizePluginMethods(pluginMethods: collection.Seq[PluginMethod]) = + private def prioritizePluginMethods(pluginMethods: Seq[PluginMethod]) = pluginMethods .groupBy(_.priority) .flatMap(_._2.sortWith(_.plugin.priority > _.plugin.priority)) diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala index 9f07eaddd..65f4b939c 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala @@ -34,7 +34,7 @@ case class PluginMethod( method: Method ) { /** Represents the collection of names of events this method supports. */ - lazy val eventNames: collection.Seq[String] = { + lazy val eventNames: Seq[String] = { Option(method.getAnnotation(classOf[Event])) .map(_.name()).map(Seq(_)).getOrElse(Nil) ++ Option(method.getAnnotation(classOf[Events])) diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala index 9f3b69896..75fa6f920 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginSearcher.scala @@ -105,7 +105,7 @@ class PluginSearcher { extraClasses: Map[String, ClassInfo] ): Iterator[ClassInfo] = { @tailrec def classMatches( - classesToCheck: collection.Seq[ClassInfo] + classesToCheck: Seq[ClassInfo] ): Boolean = { if (classesToCheck.isEmpty) false else if (classesToCheck.exists(_.name == ancestor)) true diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala index ccc69a302..6acdeb8d5 100644 --- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala +++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KMBuilder.scala @@ -39,7 +39,7 @@ import org.apache.toree.kernel.protocol.v5.MessageType.MessageType * .withContentString("content").build **/ case class KMBuilder(km: KernelMessage = KernelMessage( - ids = Seq(), + ids = Seq.empty.toSeq, signature = "", header = HeaderBuilder.empty, parentHeader = HeaderBuilder.empty, @@ -49,7 +49,7 @@ case class KMBuilder(km: KernelMessage = KernelMessage( require(km != null) def withIds(newVal: Seq[Array[Byte]]) : KMBuilder = - KMBuilder(this.km.copy(ids = newVal)) + KMBuilder(this.km.copy(ids = newVal.toSeq)) def withSignature(newVal: String) : KMBuilder = KMBuilder(this.km.copy(signature = newVal)) diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala index 92cf21c4a..798ed38bb 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala @@ -63,7 +63,7 @@ class HeaderSpec extends AnyFunSpec with Matchers { val headerResults = headerJson.validate[Header] headerResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: Header) => valid ) should be (header) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala index 50c01e8ca..d951d7a98 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala @@ -59,7 +59,7 @@ class ClearOutputSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = clearOutputJson.validate[ClearOutput] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ClearOutput) => valid ) should be (clearOutput) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala index 815fd16ef..c0ee54c78 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala @@ -60,7 +60,7 @@ class CommCloseSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commCloseJson.validate[CommClose] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: CommClose) => valid ) should be (commClose) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala index 3e353b14f..a018f725a 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala @@ -88,7 +88,7 @@ class CommMsgSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commMsgJson.validate[CommMsg] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: CommMsg) => valid ) should be (commMsg) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala index b45b80ca4..364a6b4dd 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala @@ -61,7 +61,7 @@ class CommOpenSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commOpenJson.validate[CommOpen] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: CommOpen) => valid ) should be (commOpen) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala index 63646c7cf..47ddbf8ad 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala @@ -61,7 +61,7 @@ class CompleteReplyErrorSpec extends AnyFunSpec with Matchers { val CompleteReplyOkResults = completeReplyErrorJson.validate[CompleteReplyError] CompleteReplyOkResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReplyError) => valid ) should be (completeReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala index 95fbf7f44..eecda7074 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala @@ -57,7 +57,7 @@ class CompleteReplyOkSpec extends AnyFunSpec with Matchers { val CompleteReplyOkResults = completeReplyOkJson.validate[CompleteReplyOk] CompleteReplyOkResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReplyOk) => valid ) should be (completeReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala index c9754628b..a37a5a3f0 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala @@ -64,7 +64,7 @@ class CompleteReplySpec extends AnyFunSpec with Matchers { val CompleteReplyResults = completeReplyJson.validate[CompleteReply] CompleteReplyResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReply) => valid ) should be (completeReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala index 8e7a8f069..afec715d8 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala @@ -60,7 +60,7 @@ class CompleteRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = completeRequestJson.validate[CompleteRequest] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteRequest) => valid ) should be (completeRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala index e8a2f52d7..94c6dceee 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala @@ -62,7 +62,7 @@ class ConnectReplySpec extends AnyFunSpec with Matchers { val ConnectReplyResults = connectReplyJson.validate[ConnectReply] ConnectReplyResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ConnectReply) => valid ) should be (connectReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala index e3465b815..593181108 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala @@ -55,7 +55,7 @@ class ConnectRequestSpec extends AnyFunSpec with Matchers { val ConnectRequestResults = connectRequestJson.validate[ConnectRequest] ConnectRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ConnectRequest) => valid ) should be (connectRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala index 0e45087de..206104299 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala @@ -62,7 +62,7 @@ class DisplayDataSpec extends AnyFunSpec with Matchers { val displayDataResults = displayDataJson.validate[DisplayData] displayDataResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: DisplayData) => valid ) should be (displayData) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala index 9095097f8..ac9b57a41 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala @@ -58,7 +58,7 @@ class ErrorContentSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = errorJson.validate[ErrorContent] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ErrorContent) => valid ) should be (error) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala index 7f2647f20..5a360a47e 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala @@ -60,7 +60,7 @@ class ExecuteInputSpec extends AnyFunSpec with Matchers { val executeInputResults = executeInputJson.validate[ExecuteInput] executeInputResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteInput) => valid ) should be (executeInput) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala index 33bd0f081..9669f2b8d 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala @@ -55,7 +55,7 @@ class ExecuteReplyAbortSpec extends AnyFunSpec with Matchers { val ExecuteReplyAbortResults = executeReplyAbortJson.validate[ExecuteReplyAbort] ExecuteReplyAbortResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyAbort) => valid ) should be (executeReplyAbort) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala index df371be01..4140e5def 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala @@ -59,7 +59,7 @@ class ExecuteReplyErrorSpec extends AnyFunSpec with Matchers { val ExecuteReplyErrorResults = executeReplyErrorJson.validate[ExecuteReplyError] ExecuteReplyErrorResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyError) => valid ) should be (executeReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala index 8bf3ad2f7..bb235b010 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala @@ -58,7 +58,7 @@ class ExecuteReplyOkSpec extends AnyFunSpec with Matchers { val executeReplyOkResults = executeReplyOkJson.validate[ExecuteReplyOk] executeReplyOkResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyOk) => valid ) should be (executeReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala index 0016ad63a..d7abd0f05 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala @@ -61,7 +61,7 @@ class ExecuteReplySpec extends AnyFunSpec with Matchers { val executeReplyResults = executeReplyJson.validate[ExecuteReply] executeReplyResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReply) => valid ) should be (executeReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala index e712b9c23..2678af280 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala @@ -64,7 +64,7 @@ class ExecuteRequestSpec extends AnyFunSpec with Matchers { val executeRequestResults = executeRequestJson.validate[ExecuteRequest] executeRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteRequest) => valid ) should be (executeRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala index dd40618f7..e5155e58c 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala @@ -97,7 +97,7 @@ class ExecuteResultSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = executeResultJson.validate[ExecuteResult] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteResult) => valid ) should be (executeResult) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala index c616c0bab..4eb13c85a 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala @@ -62,7 +62,7 @@ class HistoryReplySpec extends AnyFunSpec with Matchers { val CompleteRequestResults = historyReplyJson.validate[HistoryReply] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: HistoryReply) => valid ) should be (historyReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala index 7d5cdcb38..b79348442 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala @@ -67,7 +67,7 @@ class HistoryRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = historyRequestJson.validate[HistoryRequest] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: HistoryRequest) => valid ) should be (historyRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala index 87d47a660..5127d2d95 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala @@ -60,7 +60,7 @@ class InputReplySpec extends AnyFunSpec with Matchers { val CompleteReplyResults = inputReplyJson.validate[InputReply] CompleteReplyResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: InputReply) => valid ) should be (inputReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala index 9b7b657a5..ce98889bd 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala @@ -60,7 +60,7 @@ class InputRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = inputRequestJson.validate[InputRequest] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: InputRequest) => valid ) should be (inputRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala index 34ab89b2f..dcbb44362 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala @@ -59,7 +59,7 @@ class InspectReplyErrorSpec extends AnyFunSpec with Matchers { val InspectReplyErrorResults = inspectReplyErrorJson.validate[InspectReplyError] InspectReplyErrorResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReplyError) => valid ) should be (inspectReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala index a474cb3ab..d31f349a0 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala @@ -57,7 +57,7 @@ class InspectReplyOkSpec extends AnyFunSpec with Matchers { val InspectReplyOkResults = inspectReplyOkJson.validate[InspectReplyOk] InspectReplyOkResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReplyOk) => valid ) should be (inspectReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala index 4917cae69..5d7ab6b74 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala @@ -61,7 +61,7 @@ class InspectReplySpec extends AnyFunSpec with Matchers { val InspectReplyResults = inspectReplyJson.validate[InspectReply] InspectReplyResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReply) => valid ) should be (inspectReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala index 3fb8aa83c..127e720fc 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala @@ -61,7 +61,7 @@ class InspectRequestSpec extends AnyFunSpec with Matchers { val InspectRequestResults = inspectRequestJson.validate[InspectRequest] InspectRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectRequest) => valid ) should be (inspectRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala index e10432dba..4d562fbc3 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala @@ -65,7 +65,7 @@ class KernelInfoReplySpec extends AnyFunSpec with Matchers { val kernelInfoReplyResults = kernelInfoReplyJson.validate[KernelInfoReply] kernelInfoReplyResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelInfoReply) => valid ) should be (kernelInfoReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala index 1f7cc2415..a35496d25 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala @@ -56,7 +56,7 @@ class KernelInfoRequestSpec extends AnyFunSpec with Matchers { val KernelInfoRequestResults = kernelInfoRequestJson.validate[KernelInfoRequest] KernelInfoRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelInfoRequest) => valid ) should be (kernelInfoRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala index 814283fc9..5be379639 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala @@ -57,7 +57,7 @@ class KernelStatusSpec extends AnyFunSpec with Matchers { val kernelStatusResults = kernelStatusJson.validate[KernelStatus] kernelStatusResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelStatus) => valid ) should be (kernelStatus) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala index 185a2e156..32e451b44 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala @@ -60,7 +60,7 @@ class ShutdownReplySpec extends AnyFunSpec with Matchers { val ShutdownReplyResults = shutdownReplyJson.validate[ShutdownReply] ShutdownReplyResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ShutdownReply) => valid ) should be (shutdownReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala index bd956416b..afa4798fa 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala @@ -59,7 +59,7 @@ class ShutdownRequestSpec extends AnyFunSpec with Matchers { val ShutdownRequestResults = shutdownRequestJson.validate[ShutdownRequest] ShutdownRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: ShutdownRequest) => valid ) should be (shutdownRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala index aeaad77a2..abd660034 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala @@ -58,7 +58,7 @@ class StreamContentSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = streamJson.validate[StreamContent] CompleteRequestResults.fold( - (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), + (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), (valid: StreamContent) => valid ) should be (stream) } From 542ac4c3e330e969ddae3f477a3fb0f33c46e08f Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 14:40:00 +0800 Subject: [PATCH 06/12] fix --- .../boot/layer/ComponentInitialization.scala | 7 ++--- .../apache/toree/plugins/PluginMethod.scala | 4 +-- .../toree/plugins/PluginSearcherSpec.scala | 2 +- project/Dependencies.scala | 4 +-- .../kernel/protocol/v5/KernelMessage.scala | 6 ++-- .../interpreter/scala/ScalaInterpreter.scala | 29 ++++++++++--------- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala index f096062e7..31bcecf9b 100644 --- a/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala +++ b/kernel/src/main/scala/org/apache/toree/boot/layer/ComponentInitialization.scala @@ -204,7 +204,7 @@ trait StandardComponentInitialization extends ComponentInitialization { private def initializePlugins( config: Config, pluginManager: PluginManager - ) = { + ): Unit = { val magicUrlArray = config.getStringList("magic_urls").asScala .map(s => new java.net.URL(s)).toArray @@ -224,12 +224,11 @@ trait StandardComponentInitialization extends ComponentInitialization { logger.debug("Loading external plugins") val externalPlugins = if (magicUrlArray.nonEmpty) { val externalPlugins = pluginManager.loadPlugins( - magicUrlArray.map(_.getFile).map(new File(_)).toIndexedSeq: _* + magicUrlArray.map(_.getFile).map(new File(_)).toSeq: _* ) pluginManager.initializePlugins(externalPlugins) externalPlugins } else Nil - val externalPluginsSize = externalPlugins.size - logger.info(s"$externalPluginsSize external plugins loaded") + logger.info(s"${externalPlugins.size} external plugins loaded") } } diff --git a/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala b/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala index 65f4b939c..3b5a554f1 100644 --- a/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala +++ b/plugins/src/main/scala/org/apache/toree/plugins/PluginMethod.scala @@ -110,10 +110,10 @@ case class PluginMethod( } } // Validate arguments - val arguments: Seq[Object] = dependencies.map(_.value.asInstanceOf[Object]).toSeq + val arguments: Seq[AnyRef] = dependencies.map(_.value.asInstanceOf[AnyRef]).toSeq // Invoke plugin method - method.invoke(plugin, arguments: _*) + method.invoke(plugin, arguments.toSeq: _*) }).map(SuccessPluginMethodResult.apply(this, _: Object)).recover { case i: InvocationTargetException => FailurePluginMethodResult(this, i.getTargetException) diff --git a/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala b/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala index 4df4d6423..6c90793fa 100644 --- a/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala +++ b/plugins/src/test/scala/org/apache/toree/plugins/PluginSearcherSpec.scala @@ -67,7 +67,7 @@ class PluginSearcherSpec extends AnyFunSpec with Matchers name = "abstract.plugin", modifiers = Set(Modifier.Abstract) ) - private val classInfos = immutable.Seq( + private val classInfos = Seq( pluginClassInfo, directPluginClassInfo, directAsInterfacePluginClassInfo, indirectPluginClassInfo, indirectAsInterfacePluginClassInfo, diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 55d63ed76..e873a48e0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -43,7 +43,7 @@ object Dependencies { val jeroMq = "org.zeromq" % "jeromq" % "0.5.3" // MPL v2 - val joptSimple = "net.sf.jopt-simple" % "jopt-simple" % "5.0.4" // MIT + val joptSimple = "net.sf.jopt-simple" % "jopt-simple" % "4.9" // MIT val playJson = "com.typesafe.play" %% "play-json" % "2.7.4" // Apache v2 @@ -65,7 +65,7 @@ object Dependencies { val sparkSql = Def.setting{ "org.apache.spark" %% "spark-sql" % sparkVersion.value } // Apache v2 val sparkStreaming = Def.setting{ "org.apache.spark" %% "spark-streaming" % sparkVersion.value } // Apache v2 - val springCore = "org.springframework" % "spring-core" % "5.2.22.RELEASE"// Apache v2 + val springCore = "org.springframework" % "spring-core" % "5.2.2.RELEASE"// Apache v2 // TOREE-552 Align Guava with Spark val guava = "com.google.guava" % "guava" % "14.0.1" // Apache v2 diff --git a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala index feb8a4497..40a9354df 100644 --- a/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala +++ b/protocol/src/main/scala/org/apache/toree/kernel/protocol/v5/KernelMessage.scala @@ -17,6 +17,8 @@ package org.apache.toree.kernel.protocol.v5 +import java.util.Objects + case class KernelMessage( ids: Seq[Array[Byte]], signature: String, @@ -26,13 +28,13 @@ case class KernelMessage( contentString: String ) { - override def equals ( o: Any ) = o match { + override def equals(o: Any): Boolean = o match { case km: KernelMessage => { var equal = ( ids.length == km.ids.length && signature == km.signature && header == km.header && parentHeader == km.parentHeader && metadata == km.metadata && contentString == km.contentString ) var i = ids.length while ( equal && ( 0 < i ) ) { i = i - 1 - equal = (java.util.Objects.deepEquals(ids(i), km.ids(i))) + equal = Objects.deepEquals(ids(i), km.ids(i)) } equal = true equal diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala index 7aaa2bf8e..fcaab09a7 100644 --- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala +++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala @@ -25,6 +25,7 @@ import org.apache.spark.SparkContext import org.apache.spark.sql.SparkSession import org.apache.spark.repl.Main import org.apache.toree.interpreter._ +import org.apache.toree.interpreter.{Results => ToreeResults} import org.apache.toree.kernel.api.{KernelLike, KernelOptions} import org.apache.toree.utils.TaskManager import org.slf4j.LoggerFactory @@ -189,7 +190,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I } override def interpret(code: String, silent: Boolean = false, output: Option[OutputStream]): - (org.apache.toree.interpreter.Results.Result, Either[ExecuteOutput, ExecuteFailure]) = { + (ToreeResults.Result, Either[ExecuteOutput, ExecuteFailure]) = { interpretBlock(code, silent) } @@ -278,7 +279,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I } protected def interpretBlock(code: String, silent: Boolean = false): - (org.apache.toree.interpreter.Results.Result, Either[ExecuteOutput, ExecuteFailure]) = { + (ToreeResults.Result, Either[ExecuteOutput, ExecuteFailure]) = { logger.trace(s"Interpreting line: $code") @@ -295,23 +296,23 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I Await.result(futureResultAndExecuteInfo, Duration.Inf) } - protected def interpretMapToCustomResult(future: Future[Results.Result]): Future[org.apache.toree.interpreter.Results.Result] = { + protected def interpretMapToCustomResult(future: Future[Results.Result]): Future[ToreeResults.Result] = { import scala.concurrent.ExecutionContext.Implicits.global future map { - case Results.Success => org.apache.toree.interpreter.Results.Success - case Results.Error => org.apache.toree.interpreter.Results.Error - case Results.Incomplete => org.apache.toree.interpreter.Results.Incomplete + case Results.Success => ToreeResults.Success + case Results.Error => ToreeResults.Error + case Results.Incomplete => ToreeResults.Incomplete } recover { - case ex: ExecutionException => org.apache.toree.interpreter.Results.Aborted + case ex: ExecutionException => ToreeResults.Aborted } } - protected def interpretMapToResultAndOutput(future: Future[org.apache.toree.interpreter.Results.Result]): - Future[(org.apache.toree.interpreter.Results.Result, Either[Map[String, String], ExecuteError])] = { + protected def interpretMapToResultAndOutput(future: Future[ToreeResults.Result]): + Future[(ToreeResults.Result, Either[Map[String, String], ExecuteError])] = { import scala.concurrent.ExecutionContext.Implicits.global future map { - case result @ (org.apache.toree.interpreter.Results.Success | org.apache.toree.interpreter.Results.Incomplete) => + case result @ (ToreeResults.Success | ToreeResults.Incomplete) => val lastOutput = lastResultOut.toString("UTF-8").trim lastResultOut.reset() @@ -321,17 +322,17 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I val output = obj.map(Displayers.display(_).asScala.toMap).getOrElse(Map.empty) (result, Left(output)) - case org.apache.toree.interpreter.Results.Error => + case ToreeResults.Error => val lastOutput = lastResultOut.toString("UTF-8").trim lastResultOut.reset() val (obj, defStr, text) = prepareResult(lastOutput) defStr.foreach(kernel.display.content(MIMEType.PlainText, _)) val output = interpretConstructExecuteError(text.get) - (org.apache.toree.interpreter.Results.Error, Right(output)) + (ToreeResults.Error, Right(output)) - case org.apache.toree.interpreter.Results.Aborted => - (org.apache.toree.interpreter.Results.Aborted, Right(null)) + case ToreeResults.Aborted => + (ToreeResults.Aborted, Right(null)) } } From 0152827344ec2416148323d4ec363411b71a18c6 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 14:46:12 +0800 Subject: [PATCH 07/12] test --- .../kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala | 2 +- .../scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ClearOutputSpec.scala | 2 +- .../apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala | 2 +- .../apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala | 2 +- .../apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala | 2 +- .../kernel/protocol/v5/content/CompleteReplyErrorSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/CompleteReplySpec.scala | 2 +- .../toree/kernel/protocol/v5/content/CompleteRequestSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ConnectReplySpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ConnectRequestSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/DisplayDataSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ErrorContentSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ExecuteInputSpec.scala | 2 +- .../kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala | 2 +- .../kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ExecuteReplySpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ExecuteResultSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/HistoryReplySpec.scala | 2 +- .../toree/kernel/protocol/v5/content/HistoryRequestSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/InputReplySpec.scala | 2 +- .../toree/kernel/protocol/v5/content/InputRequestSpec.scala | 2 +- .../kernel/protocol/v5/content/InspectReplyErrorSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/InspectReplySpec.scala | 2 +- .../toree/kernel/protocol/v5/content/InspectRequestSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala | 2 +- .../kernel/protocol/v5/content/KernelInfoRequestSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/KernelStatusSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ShutdownReplySpec.scala | 2 +- .../toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala | 2 +- .../toree/kernel/protocol/v5/content/StreamContentSpec.scala | 2 +- 35 files changed, 35 insertions(+), 35 deletions(-) diff --git a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala index f276ed130..c516aeab6 100644 --- a/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala +++ b/kernel/src/test/scala/org/apache/toree/kernel/protocol/v5/kernel/socket/SocketConfigSpec.scala @@ -71,7 +71,7 @@ class SocketConfigSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = socketConfigJson.validate[SocketConfig] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: SocketConfig) => valid ) should be (socketConfig) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala index 798ed38bb..92cf21c4a 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/HeaderSpec.scala @@ -63,7 +63,7 @@ class HeaderSpec extends AnyFunSpec with Matchers { val headerResults = headerJson.validate[Header] headerResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: Header) => valid ) should be (header) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala index d951d7a98..50c01e8ca 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala @@ -59,7 +59,7 @@ class ClearOutputSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = clearOutputJson.validate[ClearOutput] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ClearOutput) => valid ) should be (clearOutput) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala index c0ee54c78..815fd16ef 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala @@ -60,7 +60,7 @@ class CommCloseSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commCloseJson.validate[CommClose] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CommClose) => valid ) should be (commClose) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala index a018f725a..3e353b14f 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala @@ -88,7 +88,7 @@ class CommMsgSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commMsgJson.validate[CommMsg] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CommMsg) => valid ) should be (commMsg) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala index 364a6b4dd..b45b80ca4 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala @@ -61,7 +61,7 @@ class CommOpenSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = commOpenJson.validate[CommOpen] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CommOpen) => valid ) should be (commOpen) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala index 47ddbf8ad..63646c7cf 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala @@ -61,7 +61,7 @@ class CompleteReplyErrorSpec extends AnyFunSpec with Matchers { val CompleteReplyOkResults = completeReplyErrorJson.validate[CompleteReplyError] CompleteReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReplyError) => valid ) should be (completeReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala index eecda7074..95fbf7f44 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala @@ -57,7 +57,7 @@ class CompleteReplyOkSpec extends AnyFunSpec with Matchers { val CompleteReplyOkResults = completeReplyOkJson.validate[CompleteReplyOk] CompleteReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReplyOk) => valid ) should be (completeReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala index a37a5a3f0..c9754628b 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala @@ -64,7 +64,7 @@ class CompleteReplySpec extends AnyFunSpec with Matchers { val CompleteReplyResults = completeReplyJson.validate[CompleteReply] CompleteReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteReply) => valid ) should be (completeReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala index afec715d8..8e7a8f069 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala @@ -60,7 +60,7 @@ class CompleteRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = completeRequestJson.validate[CompleteRequest] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: CompleteRequest) => valid ) should be (completeRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala index 94c6dceee..e8a2f52d7 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala @@ -62,7 +62,7 @@ class ConnectReplySpec extends AnyFunSpec with Matchers { val ConnectReplyResults = connectReplyJson.validate[ConnectReply] ConnectReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ConnectReply) => valid ) should be (connectReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala index 593181108..e3465b815 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala @@ -55,7 +55,7 @@ class ConnectRequestSpec extends AnyFunSpec with Matchers { val ConnectRequestResults = connectRequestJson.validate[ConnectRequest] ConnectRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ConnectRequest) => valid ) should be (connectRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala index 206104299..0e45087de 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala @@ -62,7 +62,7 @@ class DisplayDataSpec extends AnyFunSpec with Matchers { val displayDataResults = displayDataJson.validate[DisplayData] displayDataResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: DisplayData) => valid ) should be (displayData) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala index ac9b57a41..9095097f8 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala @@ -58,7 +58,7 @@ class ErrorContentSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = errorJson.validate[ErrorContent] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ErrorContent) => valid ) should be (error) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala index 5a360a47e..7f2647f20 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala @@ -60,7 +60,7 @@ class ExecuteInputSpec extends AnyFunSpec with Matchers { val executeInputResults = executeInputJson.validate[ExecuteInput] executeInputResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteInput) => valid ) should be (executeInput) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala index 9669f2b8d..33bd0f081 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala @@ -55,7 +55,7 @@ class ExecuteReplyAbortSpec extends AnyFunSpec with Matchers { val ExecuteReplyAbortResults = executeReplyAbortJson.validate[ExecuteReplyAbort] ExecuteReplyAbortResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyAbort) => valid ) should be (executeReplyAbort) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala index 4140e5def..df371be01 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala @@ -59,7 +59,7 @@ class ExecuteReplyErrorSpec extends AnyFunSpec with Matchers { val ExecuteReplyErrorResults = executeReplyErrorJson.validate[ExecuteReplyError] ExecuteReplyErrorResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyError) => valid ) should be (executeReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala index bb235b010..8bf3ad2f7 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala @@ -58,7 +58,7 @@ class ExecuteReplyOkSpec extends AnyFunSpec with Matchers { val executeReplyOkResults = executeReplyOkJson.validate[ExecuteReplyOk] executeReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReplyOk) => valid ) should be (executeReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala index d7abd0f05..0016ad63a 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala @@ -61,7 +61,7 @@ class ExecuteReplySpec extends AnyFunSpec with Matchers { val executeReplyResults = executeReplyJson.validate[ExecuteReply] executeReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteReply) => valid ) should be (executeReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala index 2678af280..e712b9c23 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala @@ -64,7 +64,7 @@ class ExecuteRequestSpec extends AnyFunSpec with Matchers { val executeRequestResults = executeRequestJson.validate[ExecuteRequest] executeRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteRequest) => valid ) should be (executeRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala index e5155e58c..dd40618f7 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala @@ -97,7 +97,7 @@ class ExecuteResultSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = executeResultJson.validate[ExecuteResult] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ExecuteResult) => valid ) should be (executeResult) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala index 4eb13c85a..c616c0bab 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala @@ -62,7 +62,7 @@ class HistoryReplySpec extends AnyFunSpec with Matchers { val CompleteRequestResults = historyReplyJson.validate[HistoryReply] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: HistoryReply) => valid ) should be (historyReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala index b79348442..7d5cdcb38 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala @@ -67,7 +67,7 @@ class HistoryRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = historyRequestJson.validate[HistoryRequest] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: HistoryRequest) => valid ) should be (historyRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala index 5127d2d95..87d47a660 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala @@ -60,7 +60,7 @@ class InputReplySpec extends AnyFunSpec with Matchers { val CompleteReplyResults = inputReplyJson.validate[InputReply] CompleteReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InputReply) => valid ) should be (inputReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala index ce98889bd..9b7b657a5 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala @@ -60,7 +60,7 @@ class InputRequestSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = inputRequestJson.validate[InputRequest] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InputRequest) => valid ) should be (inputRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala index dcbb44362..34ab89b2f 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala @@ -59,7 +59,7 @@ class InspectReplyErrorSpec extends AnyFunSpec with Matchers { val InspectReplyErrorResults = inspectReplyErrorJson.validate[InspectReplyError] InspectReplyErrorResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReplyError) => valid ) should be (inspectReplyError) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala index d31f349a0..a474cb3ab 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala @@ -57,7 +57,7 @@ class InspectReplyOkSpec extends AnyFunSpec with Matchers { val InspectReplyOkResults = inspectReplyOkJson.validate[InspectReplyOk] InspectReplyOkResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReplyOk) => valid ) should be (inspectReplyOk) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala index 5d7ab6b74..4917cae69 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala @@ -61,7 +61,7 @@ class InspectReplySpec extends AnyFunSpec with Matchers { val InspectReplyResults = inspectReplyJson.validate[InspectReply] InspectReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectReply) => valid ) should be (inspectReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala index 127e720fc..3fb8aa83c 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectRequestSpec.scala @@ -61,7 +61,7 @@ class InspectRequestSpec extends AnyFunSpec with Matchers { val InspectRequestResults = inspectRequestJson.validate[InspectRequest] InspectRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: InspectRequest) => valid ) should be (inspectRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala index 4d562fbc3..e10432dba 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoReplySpec.scala @@ -65,7 +65,7 @@ class KernelInfoReplySpec extends AnyFunSpec with Matchers { val kernelInfoReplyResults = kernelInfoReplyJson.validate[KernelInfoReply] kernelInfoReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelInfoReply) => valid ) should be (kernelInfoReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala index a35496d25..1f7cc2415 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelInfoRequestSpec.scala @@ -56,7 +56,7 @@ class KernelInfoRequestSpec extends AnyFunSpec with Matchers { val KernelInfoRequestResults = kernelInfoRequestJson.validate[KernelInfoRequest] KernelInfoRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelInfoRequest) => valid ) should be (kernelInfoRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala index 5be379639..814283fc9 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/KernelStatusSpec.scala @@ -57,7 +57,7 @@ class KernelStatusSpec extends AnyFunSpec with Matchers { val kernelStatusResults = kernelStatusJson.validate[KernelStatus] kernelStatusResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: KernelStatus) => valid ) should be (kernelStatus) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala index 32e451b44..185a2e156 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownReplySpec.scala @@ -60,7 +60,7 @@ class ShutdownReplySpec extends AnyFunSpec with Matchers { val ShutdownReplyResults = shutdownReplyJson.validate[ShutdownReply] ShutdownReplyResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ShutdownReply) => valid ) should be (shutdownReply) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala index afa4798fa..bd956416b 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ShutdownRequestSpec.scala @@ -59,7 +59,7 @@ class ShutdownRequestSpec extends AnyFunSpec with Matchers { val ShutdownRequestResults = shutdownRequestJson.validate[ShutdownRequest] ShutdownRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: ShutdownRequest) => valid ) should be (shutdownRequest) } diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala index abd660034..aeaad77a2 100644 --- a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala +++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/StreamContentSpec.scala @@ -58,7 +58,7 @@ class StreamContentSpec extends AnyFunSpec with Matchers { val CompleteRequestResults = streamJson.validate[StreamContent] CompleteRequestResults.fold( - (invalid: Seq[(JsPath, Seq[JsonValidationError])]) => println("Failed!"), + (invalid: collection.Seq[(JsPath, collection.Seq[JsonValidationError])]) => println("Failed!"), (valid: StreamContent) => valid ) should be (stream) } From 97fb86edc9db7025204a0d0d5a2d155b4a4c8797 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 17:36:44 +0800 Subject: [PATCH 08/12] Fix cross build --- build.sbt | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/build.sbt b/build.sbt index cab592f0f..35858a450 100644 --- a/build.sbt +++ b/build.sbt @@ -17,13 +17,17 @@ import scala.util.Properties +lazy val scala212 = "2.12.15" +lazy val scala213 = "2.13.8" +lazy val supportedScalaVersions = List(scala212, scala213) + // Version settings ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") + (if ((ThisBuild / isSnapshot ).value) "-SNAPSHOT" else "") ThisBuild / isSnapshot := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean ThisBuild / organization := "org.apache.toree.kernel" ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8") -ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last +ThisBuild / scalaVersion := scala213 ThisBuild / Dependencies.sparkVersion := { val envVar = "APACHE_SPARK_VERSION" val defaultVersion = "3.3.2" @@ -40,10 +44,9 @@ ThisBuild / Dependencies.sparkVersion := { // Compiler settings ThisBuild / scalacOptions ++= Seq( -// "-deprecation", + "-deprecation", "-unchecked", "-feature", -// "-Xfatal-warnings", "-language:reflectiveCalls", "-target:jvm-1.8" ) @@ -117,13 +120,11 @@ ThisBuild / credentials += Credentials(Path.userHome / ".ivy2" / ".credentials") /** Root Toree project. */ lazy val root = (project in file(".")) - .settings(name := "toree", crossScalaVersions := Nil) + // crossScalaVersions must be set to Nil on the aggregating project + .settings(name := "toree", crossScalaVersions := Nil, publish / skip := true) .aggregate( macros,protocol,plugins,communication,kernelApi,client,scalaInterpreter,sqlInterpreter,kernel ) - .dependsOn( - macros,protocol,communication,kernelApi,client,scalaInterpreter,sqlInterpreter,kernel - ) /** * Project representing macros in Scala that must be compiled separately from @@ -202,10 +203,7 @@ lazy val kernel = (project in file("kernel")) enablePlugins(ScalaUnidocPlugin) (ScalaUnidoc / unidoc / scalacOptions) ++= Seq( "-Ymacro-expand:none", - "-skip-packages", Seq( - "org.apache.pekko", - "scala" - ).mkString(":"), + "-skip-packages", "org.apache.pekko:scala", "-no-link-warnings" // Suppresses problems with Scaladoc @throws links ) From 531f1d25cc5e4ebab0d8a053a6da288f8068a298 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 18:05:12 +0800 Subject: [PATCH 09/12] CI --- .github/workflows/build.yml | 3 ++- build.sbt | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9fa3694f..ac038ec77 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: fail-fast: false matrix: java: [ '8', '11' ] + scala: [ '2.12', '2.13' ] env: # define Java options for both official sbt and sbt-extras JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 @@ -55,7 +56,7 @@ jobs: curl -L -o $HOME/.sbt/launchers/1.3.12/sbt-launch.jar https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.3.12/sbt-launch.jar - name: Build run: | - make clean release + SCALA_VERSION=${{ matrix.scala }} make clean release - name: Run tests run: | make test diff --git a/build.sbt b/build.sbt index 35858a450..b8333df18 100644 --- a/build.sbt +++ b/build.sbt @@ -20,6 +20,10 @@ import scala.util.Properties lazy val scala212 = "2.12.15" lazy val scala213 = "2.13.8" lazy val supportedScalaVersions = List(scala212, scala213) +lazy val defaultScalaVersion = sys.env.get("SCALA_VERSION") match { + case Some(v) if v startsWith "2.12" => scala212 + case _ => scala213 +} // Version settings ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") + @@ -27,7 +31,7 @@ ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") + ThisBuild / isSnapshot := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean ThisBuild / organization := "org.apache.toree.kernel" ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8") -ThisBuild / scalaVersion := scala213 +ThisBuild / scalaVersion := defaultScalaVersion ThisBuild / Dependencies.sparkVersion := { val envVar = "APACHE_SPARK_VERSION" val defaultVersion = "3.3.2" From 162c74ce7c833f730dacf84e90039c0445c84c7f Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 19:45:21 +0800 Subject: [PATCH 10/12] fix --- .github/workflows/build.yml | 8 ++++---- Dockerfile | 10 +++++----- Dockerfile.toree-dev | 13 +++++-------- Makefile | 7 +++++-- build.sbt | 11 ++++++----- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac038ec77..177125cd6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,14 +56,14 @@ jobs: curl -L -o $HOME/.sbt/launchers/1.3.12/sbt-launch.jar https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.3.12/sbt-launch.jar - name: Build run: | - SCALA_VERSION=${{ matrix.scala }} make clean release + make SCALA_VERSION=${{ matrix.scala }} clean release - name: Run tests run: | - make test + make SCALA_VERSION=${{ matrix.scala }} test # See https://issues.apache.org/jira/browse/TOREE-526 # - name: Run system tests # run: | -# make system-test +# make SCALA_VERSION=${{ matrix.scala }} system-test - name: Run license eudit run: | - make audit-licenses + make SCALA_VERSION=${{ matrix.scala }} audit-licenses diff --git a/Dockerfile b/Dockerfile index 14c0fa762..98ae1ce7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,8 +26,8 @@ RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash - && \ npm install -g bower # for Apache Spark demos -ENV APACHE_SPARK_VERSION 3.3.2 -ENV APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13 +ARG APACHE_SPARK_VERSION=3.3.2 +ARG SCALA_VERSION=2.13 RUN apt-get -y update && \ apt-get -y install software-properties-common @@ -47,11 +47,11 @@ RUN echo "===> install Java" && \ update-java-alternatives -s java-8-oracle RUN cd /tmp && \ + if [ "$SCALA_VERSION" = "2.13" ]; then APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13; else APACHE_SPARK_CUSTOM_NAME=hadoop3; fi && \ wget -q https://archive.apache.org/dist/spark/spark-${APACHE_SPARK_VERSION}/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz && \ tar xzf spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz -C /usr/local && \ - rm spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz - -RUN cd /usr/local && ln -s spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} spark + rm spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz && \ + ln -snf /usr/local/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} /usr/local/spark # R support RUN apt-get update && \ diff --git a/Dockerfile.toree-dev b/Dockerfile.toree-dev index 59f6cabab..88731a63f 100644 --- a/Dockerfile.toree-dev +++ b/Dockerfile.toree-dev @@ -23,8 +23,8 @@ FROM jupyter/all-spark-notebook USER root # Spark dependencies -ENV APACHE_SPARK_VERSION 3.3.2 -ENV APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13 +ARG APACHE_SPARK_VERSION=3.3.2 +ARG SCALA_VERSION=2.13 RUN apt-get -y update && \ apt-get install -y --no-install-recommends openjdk-8-jdk ca-certificates-java && \ @@ -36,14 +36,11 @@ RUN apt-get -y update && \ # Installing Spark3 RUN cd /tmp && \ + if [ "$SCALA_VERSION" = "2.13" ]; then APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13; else APACHE_SPARK_CUSTOM_NAME=hadoop3; fi && \ wget -q https://archive.apache.org/dist/spark/spark-${APACHE_SPARK_VERSION}/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz && \ tar xzf spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz -C /usr/local && \ - rm spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz - -# Overwrite symlink -RUN cd /usr/local && \ - rm spark && \ - ln -s spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} spark + rm spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz && \ + ln -snf /usr/local/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} /usr/local/spark # Remove other scala kernels RUN cd /opt/conda/share/jupyter/kernels/ && \ diff --git a/Makefile b/Makefile index 656aa6222..8f1009901 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ endef RUN=$(RUN_PREFIX)$(1)$(RUN_SUFFIX) -ENV_OPTS:=APACHE_SPARK_VERSION=$(APACHE_SPARK_VERSION) VERSION=$(VERSION) IS_SNAPSHOT=$(IS_SNAPSHOT) +ENV_OPTS:=APACHE_SPARK_VERSION=$(APACHE_SPARK_VERSION) SCALA_VERSION=$(SCALA_VERSION) VERSION=$(VERSION) IS_SNAPSHOT=$(IS_SNAPSHOT) ASSEMBLY_JAR:=toree-assembly-$(VERSION)$(SNAPSHOT).jar @@ -83,7 +83,10 @@ clean: clean-dist @-docker rmi -f $(TOREE_DEV_IMAGE) .toree-dev-image: - @docker build -t $(TOREE_DEV_IMAGE) -f Dockerfile.toree-dev . + @docker build -t $(TOREE_DEV_IMAGE) -f Dockerfile.toree-dev \ + --build-arg APACHE_SPARK_VERSION=$(APACHE_SPARK_VERSION) \ + --build-arg SCALA_VERSION=$(SCALA_VERSION) \ + . touch $@ .clean-binder-image: diff --git a/build.sbt b/build.sbt index b8333df18..af0c54401 100644 --- a/build.sbt +++ b/build.sbt @@ -19,9 +19,8 @@ import scala.util.Properties lazy val scala212 = "2.12.15" lazy val scala213 = "2.13.8" -lazy val supportedScalaVersions = List(scala212, scala213) lazy val defaultScalaVersion = sys.env.get("SCALA_VERSION") match { - case Some(v) if v startsWith "2.12" => scala212 + case Some("2.12") => scala212 case _ => scala213 } @@ -30,7 +29,7 @@ ThisBuild / version := Properties.envOrElse("VERSION", "0.0.0-dev") + (if ((ThisBuild / isSnapshot ).value) "-SNAPSHOT" else "") ThisBuild / isSnapshot := Properties.envOrElse("IS_SNAPSHOT","true").toBoolean ThisBuild / organization := "org.apache.toree.kernel" -ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8") +ThisBuild / crossScalaVersions := Seq(scala212, scala213) ThisBuild / scalaVersion := defaultScalaVersion ThisBuild / Dependencies.sparkVersion := { val envVar = "APACHE_SPARK_VERSION" @@ -124,11 +123,13 @@ ThisBuild / credentials += Credentials(Path.userHome / ".ivy2" / ".credentials") /** Root Toree project. */ lazy val root = (project in file(".")) - // crossScalaVersions must be set to Nil on the aggregating project - .settings(name := "toree", crossScalaVersions := Nil, publish / skip := true) + .settings(name := "toree") .aggregate( macros,protocol,plugins,communication,kernelApi,client,scalaInterpreter,sqlInterpreter,kernel ) + .dependsOn( + macros,protocol,communication,kernelApi,client,scalaInterpreter,sqlInterpreter,kernel + ) /** * Project representing macros in Scala that must be compiled separately from From 3edc570899d20b6746be47a7c2a2e221e909d54f Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 19:52:22 +0800 Subject: [PATCH 11/12] fix --- .github/workflows/build.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 177125cd6..081415675 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,18 +42,15 @@ jobs: TEST_DILATION: 3 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: clean: true - - name: Checkout - uses: actions/setup-java@v2 + - name: Install JDK/SBT + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: ${{ matrix.java }} - - name: Add SBT launcher - run: | - mkdir -p $HOME/.sbt/launchers/1.3.12 - curl -L -o $HOME/.sbt/launchers/1.3.12/sbt-launch.jar https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.3.12/sbt-launch.jar + cache: 'sbt' - name: Build run: | make SCALA_VERSION=${{ matrix.scala }} clean release @@ -64,6 +61,6 @@ jobs: # - name: Run system tests # run: | # make SCALA_VERSION=${{ matrix.scala }} system-test - - name: Run license eudit + - name: Run license audit run: | make SCALA_VERSION=${{ matrix.scala }} audit-licenses From 3168b51c346aeabf30b011455dae9db972e0a912 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 20:16:14 +0800 Subject: [PATCH 12/12] nit --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 8d0f8d84b..f7cc74b56 100644 --- a/project/build.properties +++ b/project/build.properties @@ -15,4 +15,4 @@ # limitations under the License # -sbt.version=1.8.2 +sbt.version=1.5.5