Skip to content

JDK 15: new JDK method means we can't call "isEmpty" on an Array[Char] due to ambiguous implicit conversions and can't compile scala.collection.mutable.StringBuilder #12172

Closed
scala/scala
#9292
@xuwei-k

Description

@xuwei-k

reproduction steps

run sbt compile in current 2.13.x branch
https://github.com/scala/scala/tree/8c86b7d7136839538cca0ff8fca50f59437564c0

problem

scala/scala/src/library/scala/collection/mutable/StringBuilder.scala:41:13: cannot override a concrete member without a third member that's overridden by both (this rule is designed to prevent ``accidental overrides'')
[error] override def isEmpty: Boolean (defined in trait SeqOps)
[error]   with <defaultmethod> def isEmpty(): Boolean (defined in trait CharSequence)
[error] final class StringBuilder(val underlying: java.lang.StringBuilder) extends AbstractSeq[Char]
[error]             ^

java.lang.CharSequence has isEmpty method since JDK 15

openjdk/jdk@113c48f

Welcome to Scala 2.13.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_201).
Type in expressions for evaluation. Or try :help.

scala> classOf[scala.collection.mutable.StringBuilder].getInterfaces
val res0: Array[Class[_]] = Array(interface scala.collection.mutable.ReusableBuilder, interface scala.collection.mutable.IndexedSeq, interface java.lang.CharSequence, interface java.io.Serializable)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions