Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to compile Scala 2.11 scalalib with JDK 17 (#2530)
* Added methods needed to compile Scala 2.11 scalalib using JDK 17
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
scalalib/overrides-2.11/scala/collection/mutable/StringBuilder.scala.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) } | ||
|