forked from scala/scala
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backport] Make the CharSequence wrappers in Predef non-implicit, for…
… JDK 15 In JDK 15 CharSequence has an isEmpty method with a default implementation, which clashes with our Array[Char]#isEmpty, IndexedSeq[Char]#isEmpty, as well as our StringBuilder and reflect's Name. Backport of scala#9292 from 2.13.x to 2.12.x
- Loading branch information
Showing
6 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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
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
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,30 @@ | ||
package scala | ||
|
||
import org.junit.Assert.{ assertArrayEquals, assertFalse, assertTrue } | ||
import org.junit.Test | ||
|
||
import scala.runtime.BoxedUnit | ||
|
||
class ArrayTest { | ||
|
||
@Test | ||
def testArrayIsEmpty(): Unit = { | ||
assertTrue(Array[Int]().isEmpty) | ||
assertTrue(Array[Char]().isEmpty) // scala/bug#12172 | ||
assertTrue(Array[String]().isEmpty) | ||
|
||
assertFalse(Array(1).isEmpty) | ||
assertFalse(Array[Char](1).isEmpty) | ||
assertFalse(Array("").isEmpty) | ||
|
||
def ge[T](a: Array[T]) = a.isEmpty | ||
|
||
assertTrue(ge(Array[Int]())) | ||
assertTrue(ge(Array[Char]())) | ||
assertTrue(ge(Array[String]())) | ||
|
||
assertFalse(ge(Array(1))) | ||
assertFalse(ge(Array[Char]('x'))) | ||
assertFalse(ge(Array(""))) | ||
} | ||
} |