From b04572b48a1c189c8ca10191dd619f5c33c51cc7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 25 Apr 2026 16:38:41 +0000 Subject: [PATCH 1/2] Remove unused scala-compiler and rhino dependencies - scala-compiler: only scala.reflect.Manifest was used, which is part of scala-library; no compiler internals (scala.tools.nsc etc.) were referenced anywhere - rhino: removed the optional server-side JavaScript execution feature (JavaScriptContext) and the corresponding Rhino type references in LiftSession (NativeArray, Scriptable, UniqueTag, fixScriptableObject) - Upgraded sbt-web from com.typesafe.sbt 1.4.4 (Bintray, defunct) to com.github.sbt 1.5.8 (Maven Central) so the build resolves cleanly All 282 tests pass. https://claude.ai/code/session_01AePRXsUCMkgsWYeHTTgR5T --- build.sbt | 2 - project/Dependencies.scala | 9 -- project/plugins.sbt | 2 +- .../scala/net/liftweb/http/LiftSession.scala | 21 ---- .../javascript/JavaScriptContext.scala | 112 ------------------ 5 files changed, 1 insertion(+), 145 deletions(-) delete mode 100644 web/webkit/src/main/scala/net/liftweb/javascript/JavaScriptContext.scala diff --git a/build.sbt b/build.sbt index 20013048b..d58ecdc34 100644 --- a/build.sbt +++ b/build.sbt @@ -101,7 +101,6 @@ lazy val util = description := "Utilities Library", Test / parallelExecution := false, libraryDependencies ++= Seq( - scala_compiler(scalaVersion.value), joda_time, joda_convert, commons_codec, @@ -139,7 +138,6 @@ lazy val webkit = Test / parallelExecution := false, libraryDependencies ++= Seq( commons_fileupload, - rhino, servlet_api, specs2Prov(scalaVersion.value), specs2MatchersProv(scalaVersion.value), diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 5e9c272d7..f7c68c4e1 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -43,18 +43,9 @@ object Dependencies { lazy val slf4j_api = "org.slf4j" % "slf4j-api" % slf4jVersion lazy val scala_xml = "org.scala-lang.modules" %% "scala-xml" % "2.4.0" lazy val scala_parallel_collections = "org.scala-lang.modules" %% "scala-parallel-collections" % "1.2.0" - lazy val rhino = "org.mozilla" % "rhino" % "1.9.0" lazy val scala_parser = "org.scala-lang.modules" %% "scala-parser-combinators" % "2.4.0" lazy val xerces = "xerces" % "xercesImpl" % "2.12.2" - lazy val scala_compiler: ModuleMap = (version: String) => { - if (version.startsWith("2")) { - "org.scala-lang" % "scala-compiler" % version - } else { - "org.scala-lang" % "scala3-compiler_3" % version - } - } - // Aliases lazy val mongo_driver = mongo_java_driver lazy val scalaz7 = scalaz7_core diff --git a/project/plugins.sbt b/project/plugins.sbt index 456061f4e..4de86dd48 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ DefaultOptions.addPluginResolvers resolvers += Resolver.typesafeRepo("releases") -addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.4.4") +addSbtPlugin("com.github.sbt" % "sbt-web" % "1.5.8") //addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "2.1.3") lazy val buildPlugin = RootProject(uri("https://github.com/lift/sbt-lift-build.git#01af51e838d2162ebeae56505a635860392b09a6")) diff --git a/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala b/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala index 33dbf18c7..e39c295ab 100644 --- a/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala +++ b/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala @@ -32,8 +32,6 @@ import Helpers._ import builtin.snippet._ import js._ import provider._ -import org.mozilla.javascript.Scriptable -import org.mozilla.javascript.UniqueTag import scala.xml.Group import org.json4s._ @@ -1231,15 +1229,6 @@ class LiftSession(private[http] val _contextPath: String, val underlyingId: Stri case b: Option[_] => runSourceContext(b.toList, xform, ns) case fut: LAFuture[_] => runSourceContext(fut.get(5.seconds).openOr(Empty), xform, ns) case node: scala.xml.Node => currentSourceContext.doWith(node)(processSurroundAndInclude("Source", xform(ns))) - case na: org.mozilla.javascript.NativeArray => - val len = na.getLength.toInt - val ar = new Array[Object](len) - var pos = 0 - while (pos < len) { - ar(pos) = na.get(pos, na) - pos += 1 - } - runSourceContext(ar.toList, xform, ns) case n: java.lang.Iterable[_] => runSourceContext(n.iterator(), xform, ns) case n: java.util.Iterator[_] => for {i <- n.asScala.toSeq; nodes <- currentSourceContext.doWith(i)(processSurroundAndInclude("Source", xform(ns)))} yield nodes @@ -1292,25 +1281,15 @@ class LiftSession(private[http] val _contextPath: String, val underlyingId: Stri retFunc _ } - private def fixScriptableObject(in: Any): Any = in match { - case UniqueTag.NOT_FOUND => Empty - case UniqueTag.NULL_VALUE => Empty - case x => x - } - def findField(name: List[String], cur: Any): Any = name.foldLeft(cur) { case (null, _) => Empty - case (so: Scriptable, name) => - fixScriptableObject(so.get(name, so)) case (m: java.util.Map[_, _], name) => m.get(name) case (m: PartialFunction[_, _] /* expect String,Any */, name) => (m.asInstanceOf[PartialFunction[String, Any]]).applyOrElse(name, null) - case (Full(so: Scriptable), name) => fixScriptableObject(so.get(name, so)) case (Full(m: java.util.Map[_, _]), name) => m.get(name) case (Full(m: PartialFunction[_, _] /* expect String,Any */), name) => (m.asInstanceOf[PartialFunction[String, Any]]).applyOrElse(name, null) - case (Some(so: Scriptable), name) => fixScriptableObject(so.get(name, so)) case (Some(m: java.util.Map[_, _]), name) => m.get(name) case (Some(m: PartialFunction[_, _] /* expect String,Any */), name) => (m.asInstanceOf[PartialFunction[String, Any]]).applyOrElse(name, null) diff --git a/web/webkit/src/main/scala/net/liftweb/javascript/JavaScriptContext.scala b/web/webkit/src/main/scala/net/liftweb/javascript/JavaScriptContext.scala deleted file mode 100644 index ffec58327..000000000 --- a/web/webkit/src/main/scala/net/liftweb/javascript/JavaScriptContext.scala +++ /dev/null @@ -1,112 +0,0 @@ -package net.liftweb.javascript - -import net.liftweb.http.{TransientRequestVar, RequestVar, LiftRules} -import net.liftweb.util._ -import Helpers._ -import org.mozilla.javascript.{NativeJavaObject, ScriptableObject, Context} -import scala.xml.NodeSeq -import net.liftweb.actor.LAFuture -import net.liftweb.common._ - -/** - * You can add a JavaScript context to Lift so that - * you can run server-side JavaScript as part of Lift page - * rendering. - * - * In Boot.scala, just do `JavaScriptContext.install()` - * and you get a JavaScript execution context around - * all HTTP requests. - */ -object JavaScriptContext { - /** - * Hook into LiftRules to put a JavaScript - * execution loanwrapper around everything and - * also slurp in