Skip to content

Commit 5d99ec4

Browse files
committed
Fix mima errors
Maybe just whitelist binary incompatabilities instead with mimaBinaryIssueFilters? https://github.com/typesafehub/migration-manager/wiki/sbt-plugin
1 parent 1da2e34 commit 5d99ec4

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

shared/src/main/scala/scala/xml/factory/XMLLoader.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ trait XMLLoader[T <: Node] {
3737
def loadXML(source: InputSource, parser: SAXParser): T = {
3838
val newAdapter = adapter
3939

40-
newAdapter.scopeStack = TopScope :: newAdapter.scopeStack
40+
newAdapter.scopes = TopScope :: newAdapter.scopes
4141
parser.parse(source, newAdapter)
42-
newAdapter.scopeStack = newAdapter.scopeStack.tail
42+
newAdapter.scopes = newAdapter.scopes.tail
4343

4444
newAdapter.rootElem.asInstanceOf[T]
4545
}

shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala

+27-21
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node
3838
var rootElem: Node = null
3939

4040
val buffer = new StringBuilder()
41-
var attribStack = List.empty[MetaData]
42-
var hStack = List.empty[Node] // [ element ] contains siblings
43-
var tagStack = List.empty[String]
44-
var scopeStack = List.empty[NamespaceBinding]
41+
var attribs = List.empty[MetaData]
42+
var nodes = List.empty[Node] // [ element ] contains siblings
43+
var tags = List.empty[String]
44+
var scopes = List.empty[NamespaceBinding]
45+
46+
// Fix compatability issues. Add MiMa exclusion rules, instead?
47+
var attribStack = collection.mutable.Stack(attribs)
48+
var hStack = collection.mutable.Stack(nodes)
49+
var tagStack = collection.mutable.Stack(tags)
50+
var scopeStack = collection.mutable.Stack(scopes)
4551

4652
var curTag: String = null
4753
var capture: Boolean = false
@@ -121,17 +127,17 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node
121127
attributes: Attributes): Unit =
122128
{
123129
captureText()
124-
tagStack = curTag :: tagStack
130+
tags = curTag :: tags
125131
curTag = qname
126132

127133
val localName = splitName(qname)._2
128134
capture = nodeContainsText(localName)
129135

130-
hStack = null :: hStack
136+
nodes = null :: nodes
131137
var m: MetaData = Null
132138
var scpe: NamespaceBinding =
133-
if (scopeStack.isEmpty) TopScope
134-
else scopeStack.head
139+
if (scopes.isEmpty) TopScope
140+
else scopes.head
135141

136142
for (i <- 0 until attributes.getLength()) {
137143
val qname = attributes getQName i
@@ -146,16 +152,16 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node
146152
m = Attribute(Option(pre), key, Text(value), m)
147153
}
148154

149-
scopeStack = scpe :: scopeStack
150-
attribStack = m :: attribStack
155+
scopes = scpe :: scopes
156+
attribs = m :: attribs
151157
}
152158

153159
/**
154160
* captures text, possibly normalizing whitespace
155161
*/
156162
def captureText(): Unit = {
157163
if (capture && buffer.length > 0)
158-
hStack = createText(buffer.toString) :: hStack
164+
nodes = createText(buffer.toString) :: nodes
159165

160166
buffer.clear()
161167
}
@@ -169,24 +175,24 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node
169175
*/
170176
override def endElement(uri: String, _localName: String, qname: String): Unit = {
171177
captureText()
172-
val metaData = attribStack.head
173-
attribStack = attribStack.tail
178+
val metaData = attribs.head
179+
attribs = attribs.tail
174180

175181
// reverse order to get it right
176-
val v = hStack.takeWhile(_ != null).reverse
177-
hStack = hStack.dropWhile(_ != null) match {
182+
val v = nodes.takeWhile(_ != null).reverse
183+
nodes = nodes.dropWhile(_ != null) match {
178184
case null :: hs => hs
179185
case hs => hs
180186
}
181187
val (pre, localName) = splitName(qname)
182-
val scp = scopeStack.head
183-
scopeStack = scopeStack.tail
188+
val scp = scopes.head
189+
scopes = scopes.tail
184190

185191
// create element
186192
rootElem = createNode(pre, localName, metaData, scp, v)
187-
hStack = rootElem :: hStack
188-
curTag = tagStack.head
189-
tagStack = tagStack.tail
193+
nodes = rootElem :: nodes
194+
curTag = tags.head
195+
tags = tags.tail
190196
capture = curTag != null && nodeContainsText(curTag) // root level
191197
}
192198

@@ -195,6 +201,6 @@ abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node
195201
*/
196202
override def processingInstruction(target: String, data: String) {
197203
captureText()
198-
hStack = hStack.reverse_:::(createProcInstr(target, data).toList)
204+
nodes = nodes.reverse_:::(createProcInstr(target, data).toList)
199205
}
200206
}

0 commit comments

Comments
 (0)