Skip to content

Expunge mutable.Stack #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 18, 2019
Merged

Expunge mutable.Stack #164

merged 5 commits into from
Apr 18, 2019

Conversation

ashawley
Copy link
Member

@ashawley ashawley commented Oct 6, 2017

This is the second attempt of #150, but even if we wanted to entertain using it (increment scala-xml major version number to 2.0?), it is blocked by scala/scala-dev#291

  • Convert deprecated use of mutable.Stack to List
    • Changes the following members in the abstract class scala.xml.parsing.FactoryAdapter
      • attribStack
      • hStack
      • tagStack
      • scopeStack
    • This abstract class is used within the library, as well, by the following:
      • scala.xml.parsing.NoBindingFactoryAdapter implemented class
      • scala.xml.factory.XMLLoader.adapter static member

Before opening this PR, I had just reverted the first attempt, so when I compare this branch to the previous HEAD commit of master, I get "No changes between 25c7dc3 and 97e983e".

25c7dc3...97e983e

@ashawley ashawley added this to the 2.0 milestone Oct 11, 2017
ashawley and others added 5 commits April 18, 2019 10:34
Using assertTrue and == won't show expected versus result.
shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala:35: class Stack in package mutable is deprecated (since 2.12.0): Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead.
    val rest = new mutable.Stack[immutable.BitSet]
                           ^
shared/src/main/scala/scala/xml/include/sax/XIncluder.scala:129: class Stack in package mutable is deprecated (since 2.12.0): Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead.
  private val entities = new mutable.Stack[String]()
                                     ^
shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala:42: class Stack in package mutable is deprecated (since 2.12.0): Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead.
  val attribStack = new mutable.Stack[MetaData]
                                ^
shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala:43: class Stack in package mutable is deprecated (since 2.12.0): Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead.
  val hStack = new mutable.Stack[Node] // [ element ] contains siblings
                           ^
shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala:44: class Stack in package mutable is deprecated (since 2.12.0): Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead.
  val tagStack = new mutable.Stack[String]
                             ^
shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala:45: class Stack in package mutable is deprecated (since 2.12.0): Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead.
  var scopeStack = new mutable.Stack[NamespaceBinding]
                               ^
Scala 2.12.2 produced a lot more warnings about deprecation.  One of
them that affected scala-xml suggested dropping mutable.Stack in favor
of immutable.List and var.

I tried to preserve binary compatibility by creating members that use
the collection.mutable.Stack.apply factory method, since it won't
produce deprecation warnings. Must be only the constructor has
deprecation warnings? Regardless, I was committing fraudulent binary
compatibility: I created members of the type mima wants, but the
values are not actually used.

In all likelihood, no one uses the members of FactoryAdapter.  We
will just change everything to List, drop the use of mutable.Stack
entirely, break bincompat, add entries to mimaBinaryIssueFilters,
inform users, and call it fixed.
Make a note of binary compatability change in scaladoc for members
that were converted to mutable.Stack.
@ashawley ashawley changed the title Expunge mutable.Stack (2nd try) Expunge mutable.Stack Apr 18, 2019
@ashawley ashawley merged commit 8e94c6d into scala:master Apr 18, 2019
@ashawley ashawley deleted the stack-expunged branch April 18, 2019 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant