Skip to content

Commit

Permalink
Allow to compile Scala 2.11 scalalib with JDK 17 (#2530)
Browse files Browse the repository at this point in the history
* Added methods needed to compile Scala 2.11 scalalib using JDK 17
  • Loading branch information
rssh committed Jan 21, 2022
1 parent 5ca432b commit 36b4870
Showing 1 changed file with 33 additions and 0 deletions.
@@ -0,0 +1,33 @@
--- 2.11.12/scala/collection/mutable/StringBuilder.scala 2022-01-14 13:49:05.000000000 +0200
+++ overrides-2.11.12/scala/collection/mutable/StringBuilder.scala 2022-01-14 13:47:55.000000000 +0200
@@ -14,6 +14,14 @@
import scala.annotation.migration
import immutable.StringLike

+// used for compilation of scala-native with jdk8, when
+// we need to have isEmpty overrided, for building with jdk17
+trait StringBuilderIsEmptyProvider {
+
+ def isEmpty: Boolean
+
+}
+
/** A builder for mutable sequence of characters. This class provides an API
* mostly compatible with `java.lang.StringBuilder`, except where there are
* conflicts with the Scala collections API (such as the `reverse` method.)
@@ -34,6 +42,7 @@
with IndexedSeq[Char]
with StringLike[StringBuilder]
with Builder[Char, String]
+ with StringBuilderIsEmptyProvider
with Serializable {

override protected[this] def thisCollection: StringBuilder = this
@@ -72,6 +81,7 @@
arr
}

+ override def isEmpty: Boolean = underlying.length()==0
override def length: Int = underlying.length()
def length_=(n: Int) { underlying.setLength(n) }

0 comments on commit 36b4870

Please sign in to comment.