Skip to content

Commit

Permalink
chore(build.sbt, TwirlParser): Adding Mima filters and tweaking to re…
Browse files Browse the repository at this point in the history
…move deprecations. playframework#390.
  • Loading branch information
brbrown25 committed Feb 1, 2022
1 parent e02f4e1 commit cb862d5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 16 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Dependencies._

import com.typesafe.tools.mima.core.IncompatibleMethTypeProblem
import com.typesafe.tools.mima.core.MissingClassProblem
import com.typesafe.tools.mima.core.Problem
import com.typesafe.tools.mima.core.ProblemFilters
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import org.scalajs.jsenv.nodejs.NodeJSEnv

Expand All @@ -18,7 +22,18 @@ def parserCombinators(scalaVersion: String) = "org.scala-lang.modules" %% "scala
}

val mimaSettings = Seq(
mimaPreviousArtifacts := previousVersion.map(organization.value %% name.value % _).toSet
mimaPreviousArtifacts := {
CrossVersion.partialVersion(scalaVersion.value) match {
// No release for Scala 3 yet
case Some((3, _)) => Set.empty
case _ => previousVersion.map(organization.value %% name.value % _).toSet
}
},
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[Problem]("play.twirl.parser.*"),
ProblemFilters.exclude[MissingClassProblem]("play.twirl.compiler.*"),
ProblemFilters.exclude[IncompatibleMethTypeProblem]("play.twirl.compiler.*"),
)
)

ThisBuild / sonatypeProfileName := "com.typesafe.play"
Expand Down
5 changes: 3 additions & 2 deletions parser/src/main/scala/play/twirl/parser/TwirlParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import scala.annotation.tailrec
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.ListBuffer
import scala.reflect.ClassTag
import scala.util.parsing.input.OffsetPosition

/**
Expand Down Expand Up @@ -330,7 +331,7 @@ class TwirlParser(val shouldParseInclusiveDot: Boolean) {

/** Match zero or more `parser` */
def several[T, BufferType <: mutable.Buffer[T]](parser: () => T, provided: BufferType = null)(implicit
manifest: Manifest[BufferType]
manifest: ClassTag[BufferType]
): BufferType = {
val ab =
if (provided != null) provided else manifest.runtimeClass.getConstructor().newInstance().asInstanceOf[BufferType]
Expand Down Expand Up @@ -749,7 +750,7 @@ class TwirlParser(val shouldParseInclusiveDot: Boolean) {
if (check(".")) {
methodCall() match {
case m: String => nextLink = m
case _ =>
case null =>
}
}

Expand Down

0 comments on commit cb862d5

Please sign in to comment.